Add optional photo providers, layout studio and scoped integrations

This commit is contained in:
Pigway
2026-10-08 23:18:11 +08:00
parent 3643fae86a
commit 69a0841868
38 changed files with 2843 additions and 41 deletions
+11 -2
View File
@@ -32,10 +32,15 @@ class DeviceRegistry:
for id, entry in devices.items():
if not entry.get("enabled", True):
continue
if entry.get("driver") != "kokonna":
raise ValueError("Unsupported configured device driver")
if not __import__("re").fullmatch(r"[a-z0-9-]{1,60}", id):
raise ValueError("Invalid configured device ID")
if entry.get("driver") == "generic_http_frame":
from pigway_frame_flow.drivers.generic_http import GenericHTTPDriver
self.drivers[id] = GenericHTTPDriver(id, entry, settings)
continue
if entry.get("driver") != "kokonna":
raise ValueError("Unsupported configured device driver")
client: MockClient | KokonnaClient
if settings.mock:
root = settings.data_dir / "cache" / id
@@ -71,4 +76,8 @@ class DeviceRegistry:
def official_widgets(self, id: str):
self.get(id)
if id not in self.official:
raise FlowError(
E.UNSUPPORTED_CAPABILITY, "This driver has no official widgets", 422
)
return self.official[id].widgets()