mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-14 21:26:15 -08:00
fix(server-storage): an outage on the sign-in page also unverifies the instance
reportOffline() left `verified` set while the page was unauthorized, so a sign-in retried after an outage skipped the instance check and could send the old instance's token to a replacement database. Verification is now cleared on any outage; only the state change stays guarded, so the workspace remains locked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ee7c13ce82
commit
555a836bd7
2 files changed
+18
-4
No files matched your search
@@ -93,4 +93,14 @@ describe('ServerStorageStatusService', () => {
|
||||
expect(status.state()).toBe('online');
|
||||
expect(readServerAccessToken('i-1')).toBe('kept');
|
||||
});
|
||||
|
||||
it('checks the instance again after an outage on the sign-in page', () => {
|
||||
status.activate(instance, jest.fn());
|
||||
status.reportUnauthorized();
|
||||
|
||||
status.reportOffline();
|
||||
|
||||
expect(status.state()).toBe('unauthorized');
|
||||
expect(status.isVerified()).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -77,11 +77,15 @@ export class ServerStorageStatusService {
|
||||
}
|
||||
|
||||
reportOffline(): void {
|
||||
if (!this.isActive()) {
|
||||
return;
|
||||
}
|
||||
// It may come back as another database (a replaced volume at the
|
||||
// same address): no token, no writes until it is checked, also
|
||||
// from the sign-in page.
|
||||
this.verified = false;
|
||||
// A late failure after sign-out must not unlock the workspace.
|
||||
if (this.isActive() && this.stateSignal() !== 'unauthorized') {
|
||||
// It may come back as another database (a replaced volume at
|
||||
// the same address): no token, no writes until it is checked.
|
||||
this.verified = false;
|
||||
if (this.stateSignal() !== 'unauthorized') {
|
||||
this.stateSignal.set('offline');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user