mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-06 21:02:28 +00:00
Handle NIP-44 decryptor DM errors
This commit is contained in:
1 parent
6d6407d5a6
commit
25ac2a2c6b
1 file changed
+24
@@ -5212,6 +5212,15 @@ export class ProfileModalController {
|
|||||||
const error = detail?.error || detail?.failure || detail;
|
const error = detail?.error || detail?.failure || detail;
|
||||||
const reason = detail?.context?.reason || "";
|
const reason = detail?.context?.reason || "";
|
||||||
const errorCode = error?.code || "";
|
const errorCode = error?.code || "";
|
||||||
|
const errorMessage =
|
||||||
|
typeof error === "string"
|
||||||
|
? error
|
||||||
|
: typeof error?.message === "string"
|
||||||
|
? error.message
|
||||||
|
: "";
|
||||||
|
const requiresNip44Decryptor =
|
||||||
|
typeof errorMessage === "string" &&
|
||||||
|
errorMessage.includes("Gift wrap events require a NIP-44 decryptor");
|
||||||
|
|
||||||
const isBenign =
|
const isBenign =
|
||||||
reason === "no-decryptors" ||
|
reason === "no-decryptors" ||
|
||||||
@@ -5231,6 +5240,21 @@ export class ProfileModalController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (requiresNip44Decryptor) {
|
||||||
|
const nip44Message =
|
||||||
|
"NIP-17 direct messages require a NIP-44-capable signer or extension. Unlock or update your extension to continue.";
|
||||||
|
if (!this.directMessagesCache.length) {
|
||||||
|
this.setMessagesLoadingState("error", {
|
||||||
|
message: nip44Message,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setMessagesAnnouncement(nip44Message);
|
||||||
|
this.updateMessagesReloadState();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!this.directMessagesCache.length) {
|
if (!this.directMessagesCache.length) {
|
||||||
this.setMessagesLoadingState("error", {
|
this.setMessagesLoadingState("error", {
|
||||||
message: "Unable to sync direct messages right now.",
|
message: "Unable to sync direct messages right now.",
|
||||||
|
|||||||
Reference in new issue
Block a user