fix(server-storage): keep URL favorites, flush before moving, cache-full and cut-off bodies

- Moving M3U favorites keeps URL favorites and anything the server cannot
  resolve; only older channel ids are translated.
- Queued user-data edits are sent before the move writes combined values.
- A re-read that does not fit the cache keeps the old cache and baseline
  together.
- A response body cut off after its headers counts as offline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
4grayandClaude Opus 5.5 committed 2026-10-12 07:00:07 +02:00
1 parent 4afd4bcc33
commit 72c84a3eba
11 files changed
+141 -35

No files matched your search

@@ -107,7 +107,27 @@ export class ServerApiClient {
}
async getJson<T>(path: string): Promise<T> {
return (await this.request(path)).json() as Promise<T>;
return this.readJson<T>(await this.request(path));
}
/**
* A body cut off after the headers arrived is an outage too; malformed
* JSON is not.
*/
async readJson<T>(response: Response): Promise<T> {
try {
return (await response.json()) as T;
} catch (error) {
if (error instanceof SyntaxError) {
throw error;
}
this.options.status.reportOffline();
throw new ServerApiError(
0,
'network',
'The server is not reachable.'
);
}
}
sendJson(