- Reduced `fetchListIncrementally` timeout to 4000ms to fail faster on bad relays.
- Added 15s timeout to decryption calls in `HashtagPreferencesService`, `UserBlockListManager`, and `SubscriptionsManager` to prevent infinite hangs.
- Added handling for "message channel closed" error in `nip07Adapter` with a backoff delay to allow extension recovery.
- Prioritized preserving cached data on decryption failure instead of resetting to empty state.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Moved NIP-07 extension detection and permission logic from `NostrClient` to `nip07` provider.
- Removed redundant `login` method from `NostrClient`.
- Increased concurrency and added timeouts to `fetchListIncrementally` to prevent hanging on slow relays.
- Updated `UserBlocks` to force full fetch on cache miss, fixing "empty list" issues.
- Updated unit tests for login permissions and hashtag preferences to reflect architectural changes.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Update `fetchListIncrementally` in `js/nostr/client.js` to throw an error if all relays fail, preventing empty returns from being interpreted as data loss.
- Update `HashtagPreferencesService`, `UserBlockListManager`, and `SubscriptionsManager` to handle fetch errors gracefully without wiping local state.
- Update `js/nostr/nip07Permissions.js` to use a short timeout (3s) for experimental permission requests, fixing "clunky" login issues while preserving user interaction time for standard login.
- Remove `try/catch` in `adminListStore.js` fetch logic to allow error propagation to the fallback cache logic.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Added `scripts/agent/validate-events.mjs` to validate event builders against schemas.
- Fixed `NOTE_TYPES.REPOST` schema content format (json instead of empty).
- Added `NOTE_TYPES.MUTE_LIST` and `buildMuteListEvent`.
- Added `buildProfileMetadataEvent` to standardise Kind 0 creation.
- Updated `js/ui/profileModalController.js` to use `buildProfileMetadataEvent`.
- Updated `js/userBlocks.js` to use `buildMuteListEvent` for publishing mute list snapshots.
- Updated `docs/nostr-event-schemas.md` with new schemas and builders.
- Add `isSessionActor` helper to `js/nostr/sessionActor.js` to identify ephemeral keys.
- Update `js/nostr/viewEvents.js` to namespace view deduplication caches by `actorPubkey` to prevent data leakage between sessions.
- Block comment publishing for session actors in `js/nostr/commentEvents.js`.
- Block watch history list publishing for session actors in `js/nostr/client.js`.
- Block user block list publishing for session actors in `js/userBlocks.js`.
- Block hashtag preference publishing for session actors in `js/services/hashtagPreferencesService.js`.
- Add inline documentation clarifying variable sources.
- Updated `profileCache.js` to support clearing runtime memory on signer change.
- Updated `NostrClient` to trigger `clearSignerRuntime` on `setActiveSigner`.
- Updated list services (`subscriptions`, `userBlocks`, `hashtagPreferences`, `watchHistory`) to listen for `runtimeCleared` and reload data.
- Updated `NostrClient` sync metadata methods to default to the active profile pubkey.
- Added `partition-updated` event emission to `profileCache`.
Implements a `SyncMetadataStore` to persist last-seen timestamps for replaceable lists (Kind 10000, 30000, 30002, 30015).
Adds `fetchListIncrementally` helper to `NostrClient` which performs per-relay `since` queries.
Updates `SubscriptionsManager`, `UserBlockListManager`, `HashtagPreferencesService`, and `adminListStore` to utilize incremental fetching.
Prevents local cache wipes when incremental fetches return empty results (indicating "no updates").
- Prioritize Kind 10000 events with `d=user-blocks` over plain mute lists in `loadBlocks`.
- Add `isTaggedBlockListEvent` helper for differentiation.
- Add regression test case to `tests/user-blocks.test.mjs` verifying that tagged lists override newer plain lists.
This commit modifies `js/userBlocks.js` to correctly parse Kind 10000 events that have empty content but populated `p` tags (used by clients like Primal). Previously, these events were treated as empty block lists, causing the user's block list to be cleared.
Changes:
- Refactored `loadBlocks` to check for empty content and fallback to extracting pubkeys from tags using `extractPubkeysFromTags`.
- Updated `loadBlocks` to use a sequential promise strategy (`Promise.any` then `Promise.allSettled`) to ensure eventual consistency without race conditions or double-processing.
- Added extensive tests in `tests/user-blocks.test.mjs` covering tag-only lists, whitespace content, and concurrency scenarios.
- Refactored `js/userBlocks.js` to merge Kind 10000 and Kind 30002 events on load, preventing overwritten mutes.
- Updated `js/constants.js` to set `DEFAULT_TRUSTED_MUTE_HIDE_THRESHOLD` to 4, enabling soft-hide (blur) behavior for lower mute counts.
- Update `ModerationService` to recognize session actors and load mutes from local storage.
- Update `UserBlockListManager` to persist blocks locally for session actors without relay publication.
- Ensure `submitReport` falls back to the session actor's signer.
- Add `resolveStorage` helper to safely access localStorage.
- Added `seedLocalBaseline` to `js/userBlocks.js` to merge admin blacklist into local block list for session actors.
- Implemented `_saveLocal` and `_loadLocal` in `js/userBlocks.js` to persist local-only block lists to `localStorage`.
- Updated `loadBlocks` to prioritize local storage for session actors, bypassing relay fetching when local data exists.
- Modified `js/app.js` to call `seedLocalBaseline` with the admin blacklist during initialization if the user is anonymous.
- Ensured `UserBlockListManager` correctly resolves `localStorage` in various environments (browser/test).
- Verified changes with `tests/user-blocks-local-seed.test.mjs`.