mirror of
https://github.com/hoornet/vega.git
synced 2026-05-13 13:48:35 -07:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user