9134e7d216
CC12: renderer views/ (5 screens + Onboarding + settings cards) + lib/ (theme/thumb/datetime/id/qualityOptions/useClipboardLink/queueStats); main core/ (buildArgs/validation/indexerCore/ytdlpPolicy). git mv preserved history; all src+test imports updated. Build emits view chunks from views/, 344 tests + typecheck green, live probe rendered all screens. CC7: wc/onProgress is the leading arg everywhere — downloadAppUpdate(wc,url), indexSource(onProgress,url,signal), indexSourceCancelable(onProgress,url). CC10: closed by-design — jsonStore backs all records; settings stay in electron-store for DPAPI secret encryption (a deliberate two-store split). Also closes the UI24/W4 context-menu cross-reference. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
24 lines
961 B
TypeScript
24 lines
961 B
TypeScript
import type { ErrorLogEntry } from '@shared/ipc'
|
||
import { isValidErrorLogEntry } from './core/validation'
|
||
import { createJsonStore } from './jsonStore'
|
||
import { ERRORLOG_MAX_ENTRIES } from './constants'
|
||
|
||
// Plain JSON in userData, same shape as history.ts. Persisted so a failure
|
||
// report survives the queue item being cleared (Seal's "debug report"). Atomic
|
||
// writes / corruption backup / caching come from the shared jsonStore (R1–R3).
|
||
// Per-entry validation (isValidErrorLogEntry) so a hand-edited or corrupted
|
||
// errorlog.json can't feed the UI entries with the wrong shape. (audit S5)
|
||
const store = createJsonStore('errorlog.json', isValidErrorLogEntry, ERRORLOG_MAX_ENTRIES)
|
||
|
||
export function listErrorLog(): ErrorLogEntry[] {
|
||
return store.read()
|
||
}
|
||
|
||
export function addErrorLog(entry: ErrorLogEntry): ErrorLogEntry[] {
|
||
return store.write([entry, ...listErrorLog()])
|
||
}
|
||
|
||
export function clearErrorLog(): ErrorLogEntry[] {
|
||
return store.write([])
|
||
}
|