diff --git a/frigate_camera_control_bridge/app.py b/frigate_camera_control_bridge/app.py index 5a092b0..1deddf4 100644 --- a/frigate_camera_control_bridge/app.py +++ b/frigate_camera_control_bridge/app.py @@ -1660,6 +1660,19 @@ class CameraControlBridge: self.send_response(401) self.end_headers() return + if parsed.path == "/refresh": + try: + bridge.refresh_frigate_inventory() + token_param = urllib.parse.parse_qs(parsed.query).get("token", [None])[0] + token_query = f"&token={urllib.parse.quote(token_param)}" if token_param else "" + self.send_response(303) + self.send_header("Location", f"/?lang={urllib.parse.quote(lang)}{token_query}") + self.end_headers() + except Exception as exc: + self.send_response(500) + self.end_headers() + self.wfile.write(str(exc).encode("utf-8")) + return parts = parsed.path.strip("/").split("/") if len(parts) == 3 and parts[0] == "action": action_id = urllib.parse.unquote(parts[1]) diff --git a/frigate_camera_control_bridge/static/app.css b/frigate_camera_control_bridge/static/app.css index 34e15ab..815753d 100644 --- a/frigate_camera_control_bridge/static/app.css +++ b/frigate_camera_control_bridge/static/app.css @@ -76,6 +76,43 @@ h1 { justify-content: flex-end; } +.refresh-form { + margin: 0; +} + +.refresh-button { + display: grid; + width: 38px; + height: 38px; + place-items: center; + border: 1px solid var(--line-strong); + border-radius: 6px; + padding: 0; + background: #ffffff; + color: #1f3a5f; + cursor: pointer; +} + +.refresh-button:hover { + border-color: var(--blue); + color: var(--blue-dark); +} + +.refresh-button:focus-visible { + outline: 3px solid rgba(29, 78, 216, 0.25); + outline-offset: 2px; +} + +.refresh-button svg { + width: 20px; + height: 20px; + fill: none; + stroke: currentColor; + stroke-linecap: round; + stroke-linejoin: round; + stroke-width: 2; +} + .language-form { display: inline-flex; align-items: center; @@ -517,6 +554,10 @@ h3 { width: 100%; } + .refresh-form { + margin-left: auto; + } + .grid-single, .control-grid { grid-template-columns: 1fr; diff --git a/frigate_camera_control_bridge/templates/index.html b/frigate_camera_control_bridge/templates/index.html index 644f239..2be9233 100644 --- a/frigate_camera_control_bridge/templates/index.html +++ b/frigate_camera_control_bridge/templates/index.html @@ -15,6 +15,16 @@ {global_actions}