blur nsfw attachments

This commit is contained in:
SrGooglo 2025-03-21 18:46:48 +00:00
parent f63d3a3ba1
commit 2741ccdb4d
2 changed files with 92 additions and 79 deletions

View File

@ -14,7 +14,7 @@ const renderDebug = localStorage.getItem("render_debug") === "true"
const Attachment = React.memo((props) => { const Attachment = React.memo((props) => {
const [loaded, setLoaded] = React.useState(false) const [loaded, setLoaded] = React.useState(false)
const [nsfwAccepted, setNsfwAccepted] = React.useState(false)
const [mimeType, setMimeType] = React.useState(null) const [mimeType, setMimeType] = React.useState(null)
try { try {
@ -111,6 +111,17 @@ const Attachment = React.memo((props) => {
className="attachment" className="attachment"
onDoubleClick={onDoubleClickAttachment} onDoubleClick={onDoubleClickAttachment}
> >
{props.attachment.flags &&
props.attachment.flags.includes("nsfw") &&
!nsfwAccepted && (
<div className="nsfw_alert">
<h2>This media may contain sensitive content</h2>
<Button onClick={() => setNsfwAccepted(true)}>
Show anyways
</Button>
</div>
)}
{renderMedia()} {renderMedia()}
</div> </div>
) )

View File

@ -67,7 +67,7 @@
z-index: 200; z-index: 200;
padding: 10px 0; padding: 40px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -80,6 +80,8 @@
border-radius: 8px; border-radius: 8px;
gap: 10px;
backdrop-filter: blur(25px); backdrop-filter: blur(25px);
-webkit-backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px);