fix(settings): gate the Electron cached category/content reads while locks are unknown

The warm-route hydration reads the cache directly; it now returns nothing
while the lock store withholds everything, like the live reads.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
4grayandClaude Fable 5.1 committed 2026-09-26 12:44:56 +02:00
1 parent 870a2ec7fd
commit d2d9a56096
3 files changed
+20 -1

No files matched your search

+2 -1
View File
@@ -119,7 +119,8 @@ store), and while the lock is active with the store unreadable
predicate answers true and the set-based filters (PWA Xtream, Stalker
content and search, the M3U channel list) receive
`ALL_CATEGORIES_WITHHELD`, and `ElectronXtreamDataSource` serves no
categories, content or search hits either, since its SQLite index may still
categories, content, cached categories/content (the warm-route hydration
path) or search hits either, since its SQLite index may still
carry a stale stamp — under which a row WITHOUT a genre is withheld
too (`isStalkerItemWithheld`, `isStalkerCategoryLocked`), since "no genre"
must not be the one row a withheld catalog still shows — so the whole
@@ -66,6 +66,12 @@ describe('ElectronXtreamDataSource (DB-first strategy)', () => {
await expect(
harness.dataSource.searchContent(playlistId, 'news', ['live'])
).resolves.toEqual([]);
await expect(
harness.dataSource.getCachedCategories(playlistId, 'live')
).resolves.toEqual([]);
await expect(
harness.dataSource.getCachedContent(playlistId, 'live')
).resolves.toEqual([]);
expect(
harness.dbService.getXtreamCategories
).not.toHaveBeenCalled();
@@ -273,6 +273,12 @@ export class ElectronXtreamDataSource implements IXtreamDataSource {
playlistId: string,
type: CategoryType
): Promise<XtreamCategoryFromDb[]> {
// Same fail-closed gate as the live reads: the warm-route hydration
// reads the cache directly and must not publish rows a stale index
// stamp still marks unlocked.
if (this.parentalLock.withholdsEverything?.()) {
return [];
}
return this.dbService.getXtreamCategories(
playlistId,
mapCategoryTypeToDbType(type)
@@ -403,6 +409,12 @@ export class ElectronXtreamDataSource implements IXtreamDataSource {
playlistId: string,
type: StreamType
): Promise<XtreamContentItem[]> {
// Same fail-closed gate as the live reads: the warm-route hydration
// reads the cache directly and must not publish rows a stale index
// stamp still marks unlocked.
if (this.parentalLock.withholdsEverything?.()) {
return [];
}
return this.dbService.getXtreamContent(playlistId, type);
}