mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-15 21:56:18 -08:00
fix(settings): show the locked-groups row on the M3U rail and roll the relock timeout back to the recovered value
- The M3U groups rail now renders the same "N locked · Enter PIN to show" row as the portal category rail, so locked groups no longer vanish without an in-context unlock. - A failed relock-timeout write rolls back to the value read after the settings retry, not to the pre-retry default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b32940f690
commit
5d6c378f22
10 files changed
+136
-2
No files matched your search
@@ -64,11 +64,14 @@ export async function persistParentalLockEnabled(
|
||||
export async function persistParentalLockRelockMinutes(
|
||||
settings: SettingsWriter,
|
||||
minutes: number,
|
||||
previous: number
|
||||
readCurrent: () => number
|
||||
): Promise<boolean> {
|
||||
if (!(await ensureParentalLockSettingsReadable(settings))) {
|
||||
return false;
|
||||
}
|
||||
// Read AFTER the retry: a recovered read replaces the defaults, and a
|
||||
// rollback to the pre-retry value would write the default back.
|
||||
const previous = readCurrent();
|
||||
try {
|
||||
await settings.updateSettings({
|
||||
parentalLockRelockMinutes:
|
||||
|
||||
@@ -248,6 +248,27 @@ describe('ParentalLockService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('rolls a failed relock write back to the value recovered by the retry', async () => {
|
||||
storageFailure.set('load');
|
||||
const service = await createService();
|
||||
const loadSettings = TestBed.inject(SettingsStore)
|
||||
.loadSettings as jest.Mock;
|
||||
loadSettings.mockImplementationOnce(async () => {
|
||||
storageFailure.set(null);
|
||||
parentalLockRelockMinutes.set(60);
|
||||
});
|
||||
updateSettings.mockImplementationOnce(async () => {
|
||||
parentalLockRelockMinutes.set(30);
|
||||
throw new Error('QuotaExceededError');
|
||||
});
|
||||
|
||||
await expect(service.setRelockMinutes(30)).resolves.toBe(false);
|
||||
|
||||
expect(updateSettings).toHaveBeenLastCalledWith({
|
||||
parentalLockRelockMinutes: 60,
|
||||
});
|
||||
});
|
||||
|
||||
it('refuses parental-lock settings writes while settings stay unreadable', async () => {
|
||||
storageFailure.set('load');
|
||||
prompt.requestPin.mockResolvedValue('1234');
|
||||
|
||||
@@ -335,7 +335,7 @@ export class ParentalLockService {
|
||||
return persistParentalLockRelockMinutes(
|
||||
this.settingsStore,
|
||||
minutes,
|
||||
this.relockMinutes()
|
||||
() => this.relockMinutes()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user