From d276d3b4c314c89c09b70c7eec33efd2c66d38e3 Mon Sep 17 00:00:00 2001 From: blomios Date: Fri, 2 Oct 2026 11:49:36 +0200 Subject: [PATCH] fix: show Laya model download progress and surface errors in Settings (#12) Track download progress in layaService (bytes/total, phase, error state) and expose it through the laya status route. Render a progress bar during model download in Settings via a layaStatusPresentation service, and display download/status errors inline instead of failing silently. Cover progress tracking and status presentation with tests. Co-Authored-By: Claude Opus 4.8 --- public/css/main.css | 54 ++++++ public/index.html | 14 +- public/js/pages/Settings.js | 114 ++++++++++--- public/js/services/layaStatusPresentation.js | 63 +++++++ server/routes/laya.js | 2 +- server/services/layaService.js | 165 ++++++++++++++++--- test/layaService.test.js | 79 ++++++++- test/layaStatusPresentation.test.js | 43 +++++ 8 files changed, 486 insertions(+), 48 deletions(-) create mode 100644 public/js/services/layaStatusPresentation.js create mode 100644 test/layaStatusPresentation.test.js diff --git a/public/css/main.css b/public/css/main.css index 740d055..d42530d 100644 --- a/public/css/main.css +++ b/public/css/main.css @@ -776,6 +776,60 @@ h4 { gap: var(--space-sm); } +.laya-progress { + margin-top: var(--space-md); +} + +.laya-progress-track { + position: relative; + height: 8px; + overflow: hidden; + border-radius: 999px; + background: var(--color-bg-secondary); +} + +.laya-progress-bar { + display: block; + width: 0; + height: 100%; + border-radius: inherit; + background: var(--color-accent); + transition: width var(--transition-fast); +} + +.laya-progress-track.indeterminate .laya-progress-bar { + width: 35%; + animation: laya-progress-indeterminate 1.2s ease-in-out infinite; +} + +@keyframes laya-progress-indeterminate { + from { transform: translateX(-120%); } + to { transform: translateX(360%); } +} + +@media (prefers-reduced-motion: reduce) { + .laya-progress-track.indeterminate .laya-progress-bar { + animation: none; + width: 100%; + opacity: .45; + } +} + +.laya-details-toggle { + margin-top: var(--space-sm); + padding-left: 0; +} + +.laya-error-details { + margin-top: var(--space-xs); + padding: var(--space-sm); + border-radius: var(--radius-sm); + background: var(--color-bg-secondary); + color: var(--color-text-muted); + white-space: pre-wrap; + overflow-wrap: anywhere; +} + .laya-model-actions { justify-content: flex-start; margin: var(--space-md) 0; diff --git a/public/index.html b/public/index.html index 47dfdea..cba891e 100644 --- a/public/index.html +++ b/public/index.html @@ -10,7 +10,7 @@ nodecast-tv | IPTV Player - +
+ + +
+

The model runs on this server. Channel names and metadata are not sent to an AI service.

@@ -1171,6 +1180,7 @@ + @@ -1180,7 +1190,7 @@ - +