mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-29 08:52:25 +00:00
Add DM privacy indicators and relay hint publishing
This commit is contained in:
1 parent
e1d58a2530
commit
924ed9b482
9 files changed
+597
-8
No files matched your search
@@ -18,6 +18,7 @@ export function MessageThread({
|
||||
messages = [],
|
||||
state = "idle",
|
||||
errorType = "",
|
||||
privacyMode = "nip04",
|
||||
} = {}) {
|
||||
if (!doc) {
|
||||
throw new Error("MessageThread requires a document reference.");
|
||||
@@ -39,6 +40,21 @@ export function MessageThread({
|
||||
createElement(doc, "span", "dm-message-thread__status", contact.status),
|
||||
);
|
||||
}
|
||||
const normalizedPrivacy =
|
||||
typeof privacyMode === "string" ? privacyMode.trim().toLowerCase() : "";
|
||||
const isNip17 = normalizedPrivacy === "nip17" || normalizedPrivacy === "private";
|
||||
const privacyLabel = `Privacy: ${isNip17 ? "NIP-17" : "NIP-04"}`;
|
||||
const privacyHint = isNip17
|
||||
? "NIP-17 gift-wraps your DM so relays only see the wrapper and relay hints."
|
||||
: "NIP-04 sends a direct encrypted DM; relays can still see sender and recipient metadata.";
|
||||
const privacyBadge = createElement(
|
||||
doc,
|
||||
"span",
|
||||
"dm-message-thread__status",
|
||||
privacyLabel,
|
||||
);
|
||||
privacyBadge.title = privacyHint;
|
||||
header.appendChild(privacyBadge);
|
||||
root.appendChild(header);
|
||||
|
||||
const timeline = createElement(doc, "div", "dm-message-thread__timeline");
|
||||
|
||||
Reference in new issue
Block a user