mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-06 04:42:57 +00:00
Refactor user blocking to prioritize standard NIP-51 Mute Lists
- Updates `js/userBlocks.js` to write block entries to a standard Kind 10000 Mute List event. - Implements a hybrid storage model: unencrypted public mutes are stored in `p` tags, while private blocks are stored in the encrypted event content. - Maintains read compatibility with legacy `d=user-blocks` lists (both Kind 10000 and Kind 30002) by merging and prioritizing the newest event timestamp. - Updates local caching to persist both public mutes and private blocks, preventing data loss or "zombie" entries on reload. - Updates `js/subscriptions.js` to correctly detect NIP-44 capabilities on `Nip07Adapter` signers, fixing a regression where NIP-04 fallback was skipped. - Updates `js/nostrEventSchemas.js` to mark `USER_BLOCK_LIST` as legacy and define `MUTE_LIST`. - Updates unit tests to verify the new multi-kind fetching and merged publishing logic. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
8383a4f18b
commit
de5e453b34
3 files changed
+43
-16
No files matched your search
+7
-2
@@ -887,8 +887,13 @@ class SubscriptionsManager {
|
||||
signer = await nostrClient.ensureActiveSignerForPubkey(userPubkey);
|
||||
}
|
||||
|
||||
const signerHasNip04 = typeof signer?.nip04Decrypt === "function";
|
||||
const signerHasNip44 = typeof signer?.nip44Decrypt === "function";
|
||||
const signerCapabilities = signer?.capabilities;
|
||||
const signerHasNip04 =
|
||||
typeof signer?.nip04Decrypt === "function" &&
|
||||
(!signerCapabilities || signerCapabilities.nip04 !== false);
|
||||
const signerHasNip44 =
|
||||
typeof signer?.nip44Decrypt === "function" &&
|
||||
(!signerCapabilities || signerCapabilities.nip44 !== false);
|
||||
|
||||
const nostrApi = allowPermissionPrompt
|
||||
? typeof window !== "undefined"
|
||||
|
||||
Reference in new issue
Block a user