Lock option: only show dashboard while locked; Sound Lab only in the desktop apps
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9203cab4df
commit
f043e1a261
10 files changed
+58
-19
No files matched your search
@@ -301,6 +301,7 @@ class App:
|
||||
self.remote_writers: set[asyncio.StreamWriter] = set()
|
||||
self.remote_error = ""
|
||||
self.locked = False # desktop app window read-only until unlocked with the PIN
|
||||
self.lock_dash = False # while locked the app window shows nothing but the dashboard
|
||||
self.lang = "" # UI language chosen in the desktop app ("" = not chosen yet, English)
|
||||
# demo mode: the real DSPs are disconnected and a simulated one runs inside the server
|
||||
self.demo = {"enabled": False, "model": "408"}
|
||||
@@ -319,6 +320,7 @@ class App:
|
||||
now = time.time()
|
||||
self.sessions = {k: v for k, v in cfg.get("sessions", {}).items() if v > now}
|
||||
self.locked = bool(cfg.get("locked"))
|
||||
self.lock_dash = bool(cfg.get("lock_dash"))
|
||||
self.lang = cfg.get("lang") if cfg.get("lang") in ("en", "de") else ""
|
||||
m = cfg.get("mute_all") or {}
|
||||
self.mute_all = {"active": bool(m.get("active")), "restore": {
|
||||
@@ -411,7 +413,7 @@ class App:
|
||||
def save(self):
|
||||
sessions = {k: v for k, v in self.sessions.items() if k not in self.app_sessions}
|
||||
cfg = {"devices": [d.config() for d in self.real_devices()], "auth": self.auth,
|
||||
"sessions": sessions, "limiter": self.limiter, "remote": self.remote, "locked": self.locked,
|
||||
"sessions": sessions, "limiter": self.limiter, "remote": self.remote, "locked": self.locked, "lock_dash": self.lock_dash,
|
||||
"soundfield": self.soundfield, "logo": self.logo, "dashboard": self.dashboard,
|
||||
"mute_all": {"active": self.mute_all["active"],
|
||||
"restore": {k: v for k, v in self.mute_all["restore"].items() if k != "demo"}}}
|
||||
@@ -1105,7 +1107,7 @@ class App:
|
||||
is_app = session in self.app_sessions
|
||||
if path == "/api/auth":
|
||||
await self.respond_json(writer, 200, {"authenticated": bool(session), "app": is_app,
|
||||
"locked": is_app and self.locked,
|
||||
"locked": is_app and self.locked, "lock_dash": is_app and self.lock_dash,
|
||||
"lang": self.lang if is_app else ""})
|
||||
return
|
||||
if path == "/api/login" and method == "POST":
|
||||
@@ -1130,6 +1132,18 @@ class App:
|
||||
self.save()
|
||||
await self.respond_json(writer, 200, {"lang": self.lang})
|
||||
return
|
||||
if path.startswith("/api/rew/") and not is_app: # REW runs next to the desktop app
|
||||
await self.respond_json(writer, 403, {"error": "desktop app only"})
|
||||
return
|
||||
if path == "/api/lock-dash" and method == "POST":
|
||||
if not is_app:
|
||||
await self.respond_json(writer, 403, {"error": "desktop app only"})
|
||||
else:
|
||||
self.lock_dash = bool(data.get("enabled"))
|
||||
self.save()
|
||||
self.broadcast({"type": "lockdash", "enabled": self.lock_dash})
|
||||
await self.respond_json(writer, 200, {"enabled": self.lock_dash})
|
||||
return
|
||||
if path in ("/api/lock", "/api/unlock") and method == "POST":
|
||||
if not is_app:
|
||||
await self.respond_json(writer, 403, {"error": "desktop app only"})
|
||||
|
||||
Reference in new issue
Block a user