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:
4grayandClaude Opus 5.5 committed 2026-10-12 00:16:56 +02:00
1 parent 8714b3b445
commit 3bfd5394ef
13 files changed
+357 -69

No files matched your search

@@ -3,6 +3,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TranslateModule } from '@ngx-translate/core';
import { ServerStorageStatusService } from '@iptvnator/services';
import {
SERVER_STORAGE_CONFIG,
ServerMigrationService,
ServerStorageSession,
} from '@iptvnator/services/server-storage';
@@ -37,6 +38,10 @@ describe('SettingsServerSectionComponent', () => {
providers: [
{ provide: ServerStorageSession, useValue: session },
{ provide: ServerMigrationService, useValue: migration },
{
provide: SERVER_STORAGE_CONFIG,
useValue: { baseUrl: 'http://nas.local:4333/api' },
},
{
provide: ServerStorageStatusService,
useValue: {
@@ -64,6 +69,9 @@ describe('SettingsServerSectionComponent', () => {
const text = fixture.nativeElement.textContent;
expect(text).toContain('/data/databases/iptvnator.db');
expect(byTestId('server-address')?.textContent?.trim()).toBe(
'http://nas.local:4333'
);
expect(byTestId('server-state')?.dataset['state']).toBe('online');
expect(fixture.componentInstance.sizeLabel()).toBe('38.0 MB');
expect(byTestId('server-sign-out')).toBeNull();