fix: recognize displayed terminal versions and clean obsolete gallery remnants
Community checks / verify (push) Skipped
Verify Frame Flow / verify (push) Failing after 11m49s

This commit is contained in:
渡口浪人
2026-10-23 22:57:53 +08:00
parent 64bd8dd736
commit 30bc5a0bad
19 changed files with 606 additions and 68 deletions
+16 -1
View File
@@ -256,7 +256,10 @@ def install_libraries(app, service):
offset: int = Query(0, ge=0),
limit: int = Query(50, ge=1, le=200),
):
if not any(t["id"] == terminal_id for t in libraries.terminals()):
terminal = next(
(t for t in libraries.terminals() if t["id"] == terminal_id), None
)
if terminal is None:
raise FlowError(E.NOT_FOUND, "Terminal not found", 404)
binding = libraries.binding(terminal_id)
if not binding:
@@ -269,6 +272,17 @@ def install_libraries(app, service):
+ " ORDER BY v.created_at DESC,v.asset_id LIMIT ? OFFSET ?",
(*args, limit, offset),
)
current_asset = None
if rows and terminal["transport_supported"]:
try:
device = service.registry.get(terminal_id).device()
if device.status == "online":
current = service.current_content(terminal_id, device=device)
if current["synced"] and current["source_known"]:
current_asset = current["asset_id"]
except FlowError:
# Offline devices must not hide locally generated versions.
pass
items = []
for row in rows:
version = next(
@@ -292,6 +306,7 @@ def install_libraries(app, service):
{
**version,
"operation": operation,
"current": row["asset_id"] == current_asset,
"delivery_status": operation["status"]
if operation
else "GENERATED",