strix

A simple web UI for motion
git clone https://www.brianlane.com/git/strix
Log | Files | Refs | LICENSE

commit fb36fdeeebd9ea8f55b436b2ad2c1dc630cd3972
parent 59b1dab522d543f21060034a374f1044ee41fa70
Author: Brian C. Lane <bcl@brianlane.com>
Date:   Sat,  4 Jun 2022 17:29:38 -0700

ui: Use the camera list from the API

Diffstat:
Msrc/strix/ui/index.html | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/strix/ui/index.html b/src/strix/ui/index.html @@ -10,6 +10,8 @@ <div id="live-feeds"> </div> <script type="text/javascript"> +var cameras = []; + function set_feed_href() { var feeds = Array.from(document.querySelectorAll(".feed-href")); feeds.forEach(feed => { @@ -78,7 +80,7 @@ function update_events() { }); } -function setup_page(cameras) { +function setup_page() { event_offsets = new Map(); // Setup the camera HTML @@ -124,7 +126,9 @@ function setup_page(cameras) { fetch("/api/cameras/list") .then(resp => resp.json()) .then(data => { - setup_page(data.cameras); + // This is a global variable, used by several functions + cameras = data.cameras; + setup_page(); }); </script> </body>