mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-02 10:52:27 +00:00
The admin whitelist hydrates asynchronously (remote fetch, then a second hex-pubkey rebuild once NostrTools loads) and does not always emit a change we can hook — e.g. loaded-from-cache-unchanged, or the async hex rebuild that emits nothing. So at startup getWhitelistPubkeys() was empty, resolveFilters() returned null, no subscription opened, and the onWhitelistChange restart never fired: ingest stayed silent even when a whitelisted author had foreign NIP-71 videos on the relays. Fix: bounded retry (every 2s, ~60s) that re-attempts opening the subscription until the author scope hydrates, in addition to the onWhitelistChange listener. Author-scoping is kept deliberately — a broad kinds:[21,22,...] subscription would be a REQ firehose that violates bitvid's relay fan-out invariants. Also adds dev-mode logging (subscribe author/kind count; per-flush events in / injected) so ingest is observable in the console. Tests: new race test (empty whitelist at start -> authors hydrate without an emit -> retry subscribes); mutation-verified. Co-Authored-By: Claude Opus 4.8 <[email protected]>