diff --git a/components/dm-settings-modal.html b/components/dm-settings-modal.html index c442e3fe..4de6b779 100644 --- a/components/dm-settings-modal.html +++ b/components/dm-settings-modal.html @@ -62,16 +62,16 @@
-

DM Relay Hints

+

NIP-17 Relay List

- Publish relay hints for direct messages as kind:10050 events. Use WSS-only relay URLs so encrypted DM delivery stays secure. + Publish your NIP-17 relay list for direct messages as kind:10050 events. Use WSS-only relay URLs so encrypted DM delivery stays secure.

- +
diff --git a/js/ui/profileModalController.js b/js/ui/profileModalController.js index 6939d687..cc07eebf 100644 --- a/js/ui/profileModalController.js +++ b/js/ui/profileModalController.js @@ -1042,6 +1042,7 @@ export class ProfileModalController { this.adminSuperNpub = resolvedAdminSuperNpub; this.adminDmImageUrl = resolvedAdminDmImageUrl; this.bitvidWebsiteUrl = resolvedbitvidWebsiteUrl; + this.hasShownRelayWarning = false; this.internalState = { savedProfiles: [], @@ -2795,6 +2796,7 @@ export class ProfileModalController { ? this.normalizeHexPubkey(actorPubkey) : this.resolveActiveDmActor(); + this.hasShownRelayWarning = false; this.setDirectMessageRecipient(null, { reason: "clear" }); this.resetAttachmentQueue({ clearInput: true }); this.dmReadReceiptCache.clear(); @@ -5374,6 +5376,11 @@ export class ProfileModalController { return; } + if (this.hasShownRelayWarning) { + return; + } + this.hasShownRelayWarning = true; + this.showStatus( "Privacy warning: direct messages are using your default relays because no NIP-17 relay list is available.", { autoHideMs: 5000 }, diff --git a/tests/profile-modal-controller.test.mjs b/tests/profile-modal-controller.test.mjs index 3bcc27d8..8e825092 100644 --- a/tests/profile-modal-controller.test.mjs +++ b/tests/profile-modal-controller.test.mjs @@ -1307,3 +1307,26 @@ test('history pane lazily initializes the watch history renderer', async () => { assert.equal(controller.profileHistoryRenderer, null); assert.equal(controller.boundProfileHistoryVisibility, null); }); + +test('handleDirectMessagesRelayWarning throttles status updates', async (t) => { + const statusCalls = []; + const controller = createController({ + showStatus: (message) => statusCalls.push(message), + }); + await controller.load(); + + const detail = { warning: 'dm-relays-fallback' }; + + controller.handleDirectMessagesRelayWarning(detail); + assert.equal(statusCalls.length, 1); + assert.match(statusCalls[0], /Privacy warning/); + + // Second call should be suppressed + controller.handleDirectMessagesRelayWarning(detail); + assert.equal(statusCalls.length, 1); + + // Reset should allow it again + controller.handleActiveDmIdentityChanged('newpubkey'); + controller.handleDirectMessagesRelayWarning(detail); + assert.equal(statusCalls.length, 2); +});