fix: Renamed NSFW to adult Content

This commit is contained in:
florian 2023-08-02 07:30:39 +02:00
parent 4a1414b7aa
commit 071ea884ab
8 changed files with 36 additions and 36 deletions

View File

@ -12,7 +12,7 @@ const App = () => {
useEffect(() => {
if (currentSettings.npubs.length == 0 && currentSettings.tags.length == 0) {
nav({ ...currentSettings, tags: defaultHashTags, showNsfw: false });
nav({ ...currentSettings, tags: defaultHashTags, showAdult: false });
}
}, []);

View File

@ -7,21 +7,21 @@ const AdultContentInfo = () => {
const proceed = (e: MouseEvent<HTMLButtonElement>) => {
e.preventDefault();
nav({ ...currentSettings, showNsfw: true });
nav({ ...currentSettings, showAdult: true });
};
const goBack = (e: MouseEvent<HTMLButtonElement>) => {
e.preventDefault();
nav({ npubs: [], tags: [], showNsfw: false });
nav({...currentSettings, npubs: [], tags: [], showAdult: false });
};
return (
<div className="disclaimer">
<div className="disclaimer-content">
<div className="warning" style={{ textAlign: 'center' }}>
NSFW Content Warning
Adult Content Warning
</div>
<br />
You are attempting to access a user profile (npub) or a tag that has been flagged as NSFW (Not Safe For Work).
You are attempting to access a user profile (npub) or a tag that has been flagged as adult (Not Safe For Work).
This indicates that the content you are about to view might be offensive or inappropriate for certain users. If
you are under 18 years old, we kindly request that you refrain from proceeding further.
</div>

View File

@ -23,7 +23,7 @@ const Disclaimer = ({ disclaimerAccepted, setDisclaimerAccepted }: DisclaimerPro
<br />
The content presented on this site is <b>entirely user-generated</b> and remains <b>unmoderated</b>. Images and
videos are sourced from the NOSTR platform and are not hosted on this site. Content filtering efforts are made
to avoid NSFW (Not Safe For Work) content, but we cannot guarantee complete safety. Please use discretion and be
to avoid adult content, but we cannot guarantee complete safety. Please use discretion and be
responsible while engaging with the material on this platform. By using this site, you agree not to hold the
site owners, operators, and affiliates liable for any content-related experiences.
</div>

View File

@ -16,7 +16,7 @@ type Mode = 'all' | 'tags' | 'user';
const SettingsDialog = ({ onClose }: SettingsProps) => {
const { nav, currentSettings } = useNav();
const { getProfile } = useNDK();
const [showNsfw, setShowNsfw] = useState(currentSettings.showNsfw || false);
const [showAdult, setShowAdult] = useState(currentSettings.showAdult || false);
const [showReplies, setShowReplies] = useState(currentSettings.showReplies || false);
const [showReposts, setShowReposts] = useState(currentSettings.showReposts || false);
const [selectedTags, setSelectedTags] = useState<Tag[]>(
@ -33,13 +33,13 @@ const SettingsDialog = ({ onClose }: SettingsProps) => {
const validTags = selectedTags.filter(t => t.selected).map(t => t.name);
if (mode == 'user' && validNpubs.length == 1) {
nav({ ...currentSettings, tags: [], npubs: validNpubs, showNsfw, showReplies, showReposts });
nav({ ...currentSettings, tags: [], npubs: validNpubs, showAdult, showReplies, showReposts });
} else if (mode == 'tags' && validTags.length > 0) {
nav({ ...currentSettings, tags: validTags, npubs: [], showNsfw, showReplies, showReposts });
nav({ ...currentSettings, tags: validTags, npubs: [], showAdult, showReplies, showReposts });
} else if (mode == 'tags') {
nav({ ...currentSettings, tags: defaultHashTags, npubs: [], showNsfw, showReplies, showReposts });
nav({ ...currentSettings, tags: defaultHashTags, npubs: [], showAdult, showReplies, showReposts });
} else {
nav({ ...currentSettings, tags: [], npubs: [], showNsfw, showReplies, showReposts });
nav({ ...currentSettings, tags: [], npubs: [], showAdult, showReplies, showReposts });
}
onClose();
@ -101,7 +101,7 @@ const SettingsDialog = ({ onClose }: SettingsProps) => {
name="replies"
type="checkbox"
checked={showReplies}
onChange={e => setShowNsfw(e.target.checked)}
onChange={e => setShowAdult(e.target.checked)}
/>
</div>
<label htmlFor="replies" onClick={() => setShowReplies(n => !n)} style={{ userSelect: 'none' }}>
@ -113,7 +113,7 @@ const SettingsDialog = ({ onClose }: SettingsProps) => {
name="reposts"
type="checkbox"
checked={showReposts}
onChange={e => setShowNsfw(e.target.checked)}
onChange={e => setShowAdult(e.target.checked)}
/>
<label htmlFor="reposts" onClick={() => setShowReposts(n => !n)} style={{ userSelect: 'none' }}>
Include Reposts
@ -123,11 +123,11 @@ const SettingsDialog = ({ onClose }: SettingsProps) => {
)}
<div className="content-warning">
<div>
<input name="nsfw" type="checkbox" checked={showNsfw} onChange={e => setShowNsfw(e.target.checked)} />
<input name="adult" type="checkbox" checked={showAdult} onChange={e => setShowAdult(e.target.checked)} />
</div>
<label htmlFor="nsfw" onClick={() => setShowNsfw(n => !n)} style={{ userSelect: 'none' }}>
<div className="warning">NSFW Content</div>
Allow NSFW to be shown and ignore content warnings.
<label htmlFor="adult" onClick={() => setShowAdult(n => !n)} style={{ userSelect: 'none' }}>
<div className="warning">NSFW / adult content</div>
Allow adult content to be shown and ignore content warnings.
</label>
</div>
</div>

View File

@ -7,12 +7,12 @@ import {
buildFilter,
extractImageUrls,
isImage,
isNsfwRelated,
isAdultRelated,
isReply,
isVideo,
prepareContent,
} from './nostrImageDownload';
import { blockedPublicKeys, defaultRelays, nfswTags, nsfwNPubs } from './env';
import { blockedPublicKeys, defaultRelays, nfswTags, adultNPubs } from './env';
import Settings from './Settings';
import SlideView from './SlideView';
import GridView from './GridView';
@ -82,7 +82,7 @@ const SlideShow = () => {
!blockedPublicKeys.includes(event.pubkey.toLowerCase()) && // remove blocked authors
(settings.showReplies || !event.isReply) &&
oldPosts.findIndex(p => p.id === event.id) === -1 && // not duplicate
(settings.showNsfw || !isNsfwRelated(event))
(settings.showAdult || !isAdultRelated(event))
) {
return [...oldPosts, event];
}
@ -156,8 +156,8 @@ const SlideShow = () => {
const fullScreen = document.fullscreenElement !== null;
const showAdultContentWarning =
!settings.showNsfw &&
(nfswTags.some(t => settings.tags.includes(t)) || nsfwNPubs.some(p => settings.npubs.includes(p)));
!settings.showAdult &&
(nfswTags.some(t => settings.tags.includes(t)) || adultNPubs.some(p => settings.npubs.includes(p)));
if (showAdultContentWarning) {
return <AdultContentInfo></AdultContentInfo>;

View File

@ -70,7 +70,7 @@ export const nfswTags = [
'naked',
'nakedart',
'nasstr',
'nsfw',
'adult',
'nude',
'nodestr',
'nudeart',
@ -89,7 +89,7 @@ export const nfswTags = [
'xxx',
];
export const nsfwNPubs = [
export const adultNPubs = [
'npub10m75ad8pc6wtlt67f6wjeug4hpqurc68842ve5ne47u9lkjqa0lq8ja88s', // 313Chris:hellokitty_headbang:
'npub12jedfuhk2wfr7syr38t2f55652khuyz9f88r63ftm0j2vudxq9sqq7677r', // Erikha
'npub13806pd9p833wkgyemeqddjzdksunlq9gszq4yjnhw4l57sjjhwlq6m79nj', // Orvalho
@ -139,7 +139,7 @@ export const nsfwNPubs = [
'npub1p4j4zfxvdgjrs26wx5dh9uvsvqfv8xa7ew89vv60nxang8cn0sxshyj28r', // Porn search bot
];
export const nsfwPublicKeys = nsfwNPubs.map(npub => (nip19.decode(npub).data as string).toLowerCase());
export const adultPublicKeys = adultNPubs.map(npub => (nip19.decode(npub).data as string).toLowerCase());
export const blockedNPubs = [
'npub1awxh85c5wasj60d42uvmzuza2uvjazff9m7skg2vf7x2f8gykwkqykxktf', // AIイラスト',

View File

@ -1,6 +1,6 @@
import { NDKFilter, NDKKind, NDKTag } from '@nostr-dev-kit/ndk';
import { nip19 } from 'nostr-tools';
import { nfswTags, nsfwPublicKeys } from './env';
import { nfswTags, adultPublicKeys } from './env';
export type NostrImage = {
url: string;
@ -76,17 +76,17 @@ export const hasContentWarning = ({ tags }: { tags?: NDKTag[] }) => {
return tags.filter((t: string[]) => t[0] === 'content-warning').length > 0;
};
export const hasNsfwTag = ({ tags }: { tags?: NDKTag[] }) => {
export const hasAdultTag = ({ tags }: { tags?: NDKTag[] }) => {
if (!tags) return false;
// ["e", "aab5a68f29d76a04ad79fe7e489087b802ee0f946689d73b0e15931dd40a7af3", "", "reply"]
return tags.filter((t: string[]) => t[0] === 't' && nfswTags.includes(t[1])).length > 0;
};
export const isNsfwRelated = ({ tags, pubkey }: { tags?: NDKTag[]; pubkey: string }) => {
export const isAdultRelated = ({ tags, pubkey }: { tags?: NDKTag[]; pubkey: string }) => {
return (
hasContentWarning({ tags }) || // block content warning
hasNsfwTag({ tags }) || // block nsfw tags
nsfwPublicKeys.includes(pubkey.toLowerCase()) // block nsfw authors
hasAdultTag({ tags }) || // block adult tags
adultPublicKeys.includes(pubkey.toLowerCase()) // block adult authors
);
};

View File

@ -2,7 +2,7 @@ import { useMemo } from 'react';
import { useNavigate, useParams, useSearchParams } from 'react-router-dom';
export type Settings = {
showNsfw: boolean;
showAdult: boolean;
showReplies: boolean;
showReposts: boolean;
tags: string[];
@ -15,18 +15,18 @@ const useNav = () => {
const navigate = useNavigate();
const currentSettings: Settings = useMemo(() => {
const nsfw = searchParams.get('nsfw') === 'true';
const adult = searchParams.get('adult') === 'true';
const replies = searchParams.get('replies') === 'true';
const reposts = searchParams.get('reposts') === 'true';
console.log(`tags = ${tags}, npub = ${npub}, nsfw = ${nsfw}, replies = ${replies}, reposts = ${reposts}`);
console.log(`tags = ${tags}, npub = ${npub}, adult = ${adult}, replies = ${replies}, reposts = ${reposts}`);
const useTags = tags?.split(',') || [];
return {
tags: useTags,
npubs: npub ? [npub] : [],
showNsfw: nsfw,
showAdult: adult,
showReplies: replies,
showReposts: reposts,
};
@ -37,8 +37,8 @@ const useNav = () => {
const validNpubs = settings.npubs.filter(t => t.length > 0);
const searchParams = [];
if (settings.showNsfw) {
searchParams.push('nsfw=true');
if (settings.showAdult) {
searchParams.push('adult=true');
}
if (settings.showReplies) {
searchParams.push('replies=true');