Add subscription debug panel (Ctrl+Shift+D)

Hidden dev tool showing NDK uptime, live subscription status,
per-relay connection state, per-tab last-updated timestamps,
and recent feed diagnostics log. Polls every 2s while visible.
Closes with Ctrl+Shift+D, Escape, or X button.
This commit is contained in:
Jure
2026-03-23 19:12:29 +01:00
parent 911cbea72d
commit 1f50afded7
8 changed files with 174 additions and 3 deletions

View File

@@ -57,16 +57,22 @@ export function saveRelayUrls(urls: string[]) {
}
let ndk: NDK | null = null;
let ndkCreatedAt: number | null = null;
export function getNDK(): NDK {
if (!ndk) {
ndk = new NDK({
explicitRelayUrls: getStoredRelayUrls(),
});
ndkCreatedAt = Date.now();
}
return ndk;
}
export function getNDKUptimeMs(): number | null {
return ndkCreatedAt ? Date.now() - ndkCreatedAt : null;
}
/**
* Destroy the current NDK instance and create a fresh one.
* Preserves the signer (login state) but resets all relay connections.
@@ -87,6 +93,7 @@ export async function resetNDK(): Promise<void> {
ndk = new NDK({
explicitRelayUrls: getStoredRelayUrls(),
});
ndkCreatedAt = Date.now();
// Restore signer so user stays logged in
if (oldSigner) {