From 67d9869364b4c7a4e1a95f345aff7819535e4212 Mon Sep 17 00:00:00 2001 From: blomios Date: Fri, 2 Oct 2026 16:09:13 +0200 Subject: [PATCH] feat: add Settings live stream analysis button and diagnose Laya batch failure (#14) Add a Settings action to manually rerun Live TV stream analysis: it triggers an admin-guarded projection rebuild endpoint that groups streams into logical channels (covering channels present before the projection existed) and reruns language/Laya detection, with progress presented via liveAnalysisPresentation. Harden the Laya batch path that failed with 'Local AI language matching failed' by surfacing the underlying cause and falling back to standard matching cleanly. Guard admin-only rebuild through a new authz helper and cover routes, service and presentation with tests. Co-Authored-By: Claude Opus 4.8 --- public/css/main.css | 24 ++++ public/index.html | 25 +++- public/js/api.js | 4 +- public/js/pages/Settings.js | 107 ++++++++++++++++++ .../js/services/liveAnalysisPresentation.js | 48 ++++++++ server/auth.js | 3 +- server/authz.js | 5 + server/db/liveProjectionSchema.js | 14 ++- server/db/sqlite.js | 2 + server/routes/live.js | 32 +++++- server/services/liveProjectionService.js | 65 ++++++++--- test/liveAnalysisPresentation.test.js | 39 +++++++ test/liveProjectionRoutes.test.js | 21 ++++ test/liveProjectionService.test.js | 22 +++- 14 files changed, 386 insertions(+), 25 deletions(-) create mode 100644 public/js/services/liveAnalysisPresentation.js create mode 100644 server/authz.js create mode 100644 test/liveAnalysisPresentation.test.js create mode 100644 test/liveProjectionRoutes.test.js diff --git a/public/css/main.css b/public/css/main.css index c2cbe27..932f0ce 100644 --- a/public/css/main.css +++ b/public/css/main.css @@ -768,6 +768,30 @@ h4 { background: var(--color-bg-tertiary); } +.live-analysis-panel { + margin-bottom: var(--space-md); + padding: var(--space-md); + border-radius: var(--radius-sm); + background: var(--color-bg-tertiary); +} + +.live-analysis-panel [hidden] { + display: none !important; +} + +.live-analysis-heading { + display: flex; + align-items: flex-start; + justify-content: space-between; + gap: var(--space-md); +} + +@media (max-width: 600px) { + .live-analysis-heading { + flex-direction: column; + } +} + .laya-model-panel [hidden] { display: none !important; } diff --git a/public/index.html b/public/index.html index 0aaee98..274d708 100644 --- a/public/index.html +++ b/public/index.html @@ -10,7 +10,7 @@ nodecast-tv | IPTV Player - +

Channel matching

Choose how Nodecast TV identifies matching streams and languages.

+
+
+
+ Channel analysis +
Group matching streams into channels and update detected languages.
+
+ +
+

Use this to analyze channels that were added before automatic analysis was enabled.

+
Checking status…
+ +
+ + +