mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-14 21:26:15 -08:00
fix(pwa): stay in server mode when a known server does not answer
A failed start-up probe used to fall back to browser mode, which showed an empty library while the backend restarted and let new playlists land in the browser. The browser now remembers the server; without an answer it starts in server mode, offline, and reloads once the server is back. Settings → Server shows the backend address instead of the page's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8714b3b445
commit
3bfd5394ef
13 files changed
+357
-69
No files matched your search
@@ -170,7 +170,13 @@ expose desktop-only actions in the PWA/shared UI.
|
||||
deployment wrote a runtime `BACKEND_URL` into `window.__IPTVNATOR_CONFIG__`
|
||||
(the Docker entrypoint does; hosted builds and Electron never probe). On
|
||||
`storage: 'server'` it imports `apps/web/src/app/server-storage/` lazily and
|
||||
merges `provideServerStorage()` into the app config. Everything else of the
|
||||
merges `provideServerStorage()` into the app config, and remembers the
|
||||
instance under `iptvnator-server:instance`. When the probe gets no answer
|
||||
(network error, timeout, or a 5xx such as nginx's 502 while the backend
|
||||
restarts), a browser that remembers this backend still starts in server
|
||||
mode, offline, and reloads once the server answers; it never falls back to
|
||||
an empty browser library. An answer without server storage, or a 404 from
|
||||
an older backend, forgets it (`server-storage-start.ts`). Everything else of the
|
||||
client lives behind the `@iptvnator/services/server-storage` sub-entry, so
|
||||
other builds never load it; `ServerStorageStatusService` and the token
|
||||
helpers stay in the main `@iptvnator/services` barrel because the rail,
|
||||
|
||||
@@ -170,7 +170,7 @@ https://claude.ai/artifact/3WheJAgeNL5ag6kmtPrJcD
|
||||
|
||||
| Situation | Behavior |
|
||||
| --- | --- |
|
||||
| Probe fails or times out (2.5 s) | Browser mode, no server UI. |
|
||||
| Probe gets no answer (network error, 2.5 s timeout, 5xx) | Server mode, offline, if this browser used this backend before (`iptvnator-server:instance`); the page reloads once the server answers. Otherwise browser mode. An answer without server storage, or a 404, forgets the server. |
|
||||
| Request fails after boot | Status `offline`, banner, write failures show a snackbar; retry on `visibilitychange` and every 30 s. |
|
||||
| `401` | Status `unauthorized`, stored token cleared, redirect to sign-in. |
|
||||
| `413` | Snackbar names the limit. |
|
||||
|
||||
Reference in new issue
Block a user