mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-08-01 07:21:33 -07:00
fix(stats): validate max-titles against allowlist instead of positive-in
- `loadMaxTitles` now rejects values not in `MAX_TITLES_OPTIONS` (e.g. arbitrary integers like 8) - Add test covering unsupported-but-numeric stored values
This commit is contained in:
@@ -37,7 +37,7 @@ export function loadMaxTitles(): number | null {
|
||||
const raw = getStorage()?.getItem(MAX_TITLES_KEY);
|
||||
if (raw === null || raw === undefined) return null;
|
||||
const value = Number(raw);
|
||||
return Number.isInteger(value) && value > 0 ? value : null;
|
||||
return (MAX_TITLES_OPTIONS as readonly number[]).includes(value) ? value : null;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user