feat: nip-36
This commit is contained in:
parent
6195325200
commit
0cb52cc961
@ -83,6 +83,7 @@ export default function Note(props: NoteProps) {
|
||||
const { pinned, bookmarked } = useSelector((s: RootState) => s.login);
|
||||
const publisher = useEventPublisher();
|
||||
const [translated, setTranslated] = useState<Translation>();
|
||||
const [contentWarningAccepted, setContentWarningAccepted] = useState(false);
|
||||
const { formatMessage } = useIntl();
|
||||
const reactions = useMemo(() => getReactions(related, ev.id, EventKind.Reaction), [related, ev]);
|
||||
const groupReactions = useMemo(() => {
|
||||
@ -161,8 +162,32 @@ export default function Note(props: NoteProps) {
|
||||
</b>
|
||||
);
|
||||
}
|
||||
const contentWarning = ev.tags.find(a => a[0] === "content-warning");
|
||||
if (contentWarning && !contentWarningAccepted) {
|
||||
return (
|
||||
<div
|
||||
className="note-invoice"
|
||||
onClick={e => {
|
||||
e.stopPropagation();
|
||||
setContentWarningAccepted(true);
|
||||
}}>
|
||||
<FormattedMessage defaultMessage="This note has been marked as sensitive, click here to reveal" />
|
||||
{contentWarning[1] && (
|
||||
<>
|
||||
<br />
|
||||
<FormattedMessage
|
||||
defaultMessage="Reason: {reason}"
|
||||
values={{
|
||||
reason: contentWarning[1],
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return <Text content={body} tags={ev.tags} creator={ev.pubkey} />;
|
||||
}, [ev]);
|
||||
}, [ev, contentWarningAccepted]);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
if (entry && inView && extendable === false) {
|
||||
|
@ -49,6 +49,7 @@ export function NoteCreator(props: NoteCreatorProps) {
|
||||
const [preview, setPreview] = useState<RawEvent>();
|
||||
const [showAdvanced, setShowAdvanced] = useState(false);
|
||||
const [zapForward, setZapForward] = useState("");
|
||||
const [sensitive, setSensitiveContent] = useState<string>();
|
||||
const uploader = useFileUpload();
|
||||
|
||||
async function sendNote() {
|
||||
@ -68,6 +69,10 @@ export function NoteCreator(props: NoteCreatorProps) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (sensitive) {
|
||||
extraTags ??= [];
|
||||
extraTags.push(["content-warning", sensitive]);
|
||||
}
|
||||
const ev = replyTo ? await publisher.reply(replyTo, note, extraTags) : await publisher.note(note, extraTags);
|
||||
console.debug("Sending note: ", ev);
|
||||
publisher.broadcast(ev);
|
||||
@ -192,6 +197,9 @@ export function NoteCreator(props: NoteCreatorProps) {
|
||||
<p>
|
||||
<FormattedMessage defaultMessage="All zaps sent to this note will be received by the following LNURL" />
|
||||
</p>
|
||||
<b className="warning">
|
||||
<FormattedMessage defaultMessage="Not all clients support this yet" />
|
||||
</b>
|
||||
<input
|
||||
type="text"
|
||||
className="w-max"
|
||||
@ -201,6 +209,28 @@ export function NoteCreator(props: NoteCreatorProps) {
|
||||
value={zapForward}
|
||||
onChange={e => setZapForward(e.target.value)}
|
||||
/>
|
||||
<h4>
|
||||
<FormattedMessage defaultMessage="Sensitive Content" />
|
||||
</h4>
|
||||
<p>
|
||||
<FormattedMessage defaultMessage="Users must accept the content warning to show the content of your note." />
|
||||
</p>
|
||||
<b className="warning">
|
||||
<FormattedMessage defaultMessage="Not all clients support this yet" />
|
||||
</b>
|
||||
<div className="flex">
|
||||
<input
|
||||
className="w-max"
|
||||
type="text"
|
||||
value={sensitive}
|
||||
onChange={e => setSensitiveContent(e.target.value)}
|
||||
maxLength={50}
|
||||
minLength={1}
|
||||
placeholder={formatMessage({
|
||||
defaultMessage: "Reason",
|
||||
})}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</Modal>
|
||||
|
@ -12,6 +12,7 @@
|
||||
--highlight: #8b5cf6;
|
||||
--error: #ff6053;
|
||||
--success: #2ad544;
|
||||
--warning: #ff8800;
|
||||
|
||||
--gray-superlight: #eee;
|
||||
--gray-light: #999;
|
||||
@ -480,6 +481,10 @@ body.scroll-lock {
|
||||
color: var(--error);
|
||||
}
|
||||
|
||||
.warning {
|
||||
color: var(--warning);
|
||||
}
|
||||
|
||||
.bg-error {
|
||||
background-color: var(--error);
|
||||
}
|
||||
|
@ -199,6 +199,9 @@
|
||||
"Adk34V": {
|
||||
"defaultMessage": "Setup your Profile"
|
||||
},
|
||||
"AkCxS/": {
|
||||
"defaultMessage": "Reason"
|
||||
},
|
||||
"AnLrRC": {
|
||||
"defaultMessage": "Non-Zap",
|
||||
"description": "Non-Zap, Regular LN payment"
|
||||
@ -372,6 +375,9 @@
|
||||
"KAhAcM": {
|
||||
"defaultMessage": "Enter LNDHub config"
|
||||
},
|
||||
"KLo3SP": {
|
||||
"defaultMessage": "Reason: {reason}"
|
||||
},
|
||||
"KQvWvD": {
|
||||
"defaultMessage": "Deleted"
|
||||
},
|
||||
@ -518,6 +524,9 @@
|
||||
"UQ3pOC": {
|
||||
"defaultMessage": "On Nostr, many people have the same username. User names and identity are separate things. You can get a unique identifier in the next step."
|
||||
},
|
||||
"UUPFlt": {
|
||||
"defaultMessage": "Users must accept the content warning to show the content of your note."
|
||||
},
|
||||
"Up5U7K": {
|
||||
"defaultMessage": "Block"
|
||||
},
|
||||
@ -594,6 +603,9 @@
|
||||
"aWpBzj": {
|
||||
"defaultMessage": "Show more"
|
||||
},
|
||||
"bQdA2k": {
|
||||
"defaultMessage": "Sensitive Content"
|
||||
},
|
||||
"brAXSu": {
|
||||
"defaultMessage": "Pick a username"
|
||||
},
|
||||
@ -672,6 +684,9 @@
|
||||
"gDzDRs": {
|
||||
"defaultMessage": "Emoji to send when reactiong to a note"
|
||||
},
|
||||
"gXgY3+": {
|
||||
"defaultMessage": "Not all clients support this yet"
|
||||
},
|
||||
"gjBiyj": {
|
||||
"defaultMessage": "Loading..."
|
||||
},
|
||||
@ -947,6 +962,9 @@
|
||||
"wvFw6Y": {
|
||||
"defaultMessage": "Hey, it looks like you dont have a NIP-05 handle yet, you should get one! Check out {link}"
|
||||
},
|
||||
"x/q8d5": {
|
||||
"defaultMessage": "This note has been marked as sensitive, click here to reveal"
|
||||
},
|
||||
"x82IOl": {
|
||||
"defaultMessage": "Mute"
|
||||
},
|
||||
|
@ -64,6 +64,7 @@
|
||||
"ADmfQT": "Parent",
|
||||
"ASRK0S": "This author has been muted",
|
||||
"Adk34V": "Setup your Profile",
|
||||
"AkCxS/": "Reason",
|
||||
"AnLrRC": "Non-Zap",
|
||||
"AyGauy": "Login",
|
||||
"B4C47Y": "name too short",
|
||||
@ -121,6 +122,7 @@
|
||||
"K3r6DQ": "Delete",
|
||||
"K7AkdL": "Show",
|
||||
"KAhAcM": "Enter LNDHub config",
|
||||
"KLo3SP": "Reason: {reason}",
|
||||
"KQvWvD": "Deleted",
|
||||
"KWuDfz": "I have saved my keys, continue",
|
||||
"KahimY": "Unknown event kind: {kind}",
|
||||
@ -168,6 +170,7 @@
|
||||
"TpgeGw": "Hex Salt..",
|
||||
"UDYlxu": "Pending Subscriptions",
|
||||
"UQ3pOC": "On Nostr, many people have the same username. User names and identity are separate things. You can get a unique identifier in the next step.",
|
||||
"UUPFlt": "Users must accept the content warning to show the content of your note.",
|
||||
"Up5U7K": "Block",
|
||||
"VBadwB": "Hmm, can't find a key manager extension.. try reloading the page.",
|
||||
"VN0+Fz": "Balance: {amount} sats",
|
||||
@ -193,6 +196,7 @@
|
||||
"ZUZedV": "Lightning Donation:",
|
||||
"a5UPxh": "Fund developers and platforms providing NIP-05 verification services",
|
||||
"aWpBzj": "Show more",
|
||||
"bQdA2k": "Sensitive Content",
|
||||
"brAXSu": "Pick a username",
|
||||
"bxv59V": "Just now",
|
||||
"c+oiJe": "Install Extension",
|
||||
@ -218,6 +222,7 @@
|
||||
"gBdUXk": "Save your keys!",
|
||||
"gDZkld": "Snort is a Nostr UI, nostr is a decentralised protocol for saving and distributing \"notes\".",
|
||||
"gDzDRs": "Emoji to send when reactiong to a note",
|
||||
"gXgY3+": "Not all clients support this yet",
|
||||
"gjBiyj": "Loading...",
|
||||
"h8XMJL": "Badges",
|
||||
"hCUivF": "Notes will stream in real time into global and posts tab",
|
||||
@ -308,6 +313,7 @@
|
||||
"wqyN/i": "Find out more info about {service} at {link}",
|
||||
"wtLjP6": "Copy ID",
|
||||
"wvFw6Y": "Hey, it looks like you dont have a NIP-05 handle yet, you should get one! Check out {link}",
|
||||
"x/q8d5": "This note has been marked as sensitive, click here to reveal",
|
||||
"x82IOl": "Mute",
|
||||
"xIoGG9": "Go to",
|
||||
"xJ9n2N": "Your public key",
|
||||
|
Loading…
x
Reference in New Issue
Block a user