chore: some refactoring

This commit is contained in:
florian 2023-08-02 07:44:40 +02:00
parent 071ea884ab
commit 6df01a1846
3 changed files with 15 additions and 5 deletions

View File

@ -12,7 +12,7 @@ import {
isVideo,
prepareContent,
} from './nostrImageDownload';
import { blockedPublicKeys, defaultRelays, nfswTags, adultNPubs } from './env';
import { blockedPublicKeys, defaultRelays, adultContentTags, adultNPubs } from './env';
import Settings from './Settings';
import SlideView from './SlideView';
import GridView from './GridView';
@ -157,7 +157,7 @@ const SlideShow = () => {
const showAdultContentWarning =
!settings.showAdult &&
(nfswTags.some(t => settings.tags.includes(t)) || adultNPubs.some(p => settings.npubs.includes(p)));
(adultContentTags.some(t => settings.tags.includes(t)) || adultNPubs.some(p => settings.npubs.includes(p)));
if (showAdultContentWarning) {
return <AdultContentInfo></AdultContentInfo>;

View File

@ -51,7 +51,12 @@ export const visibleHashTags = [
'travel',
];
export const nfswTags = [
/* All posts with the following hashtags are flagged as adult / NSFW are not shown
by default. Users can enable this content through the adult content flag
in the UI or through a URL parameter.
*/
export const adultContentTags = [
'adult',
'ass',
'blowjob',
@ -89,6 +94,10 @@ export const nfswTags = [
'xxx',
];
/* These profiles are flagged as adult / NSFW and their content is not shown
by default. Users can enable their content through the adult content flag
in the UI or through a URL parameter.
*/
export const adultNPubs = [
'npub10m75ad8pc6wtlt67f6wjeug4hpqurc68842ve5ne47u9lkjqa0lq8ja88s', // 313Chris:hellokitty_headbang:
'npub12jedfuhk2wfr7syr38t2f55652khuyz9f88r63ftm0j2vudxq9sqq7677r', // Erikha
@ -141,6 +150,7 @@ export const adultNPubs = [
export const adultPublicKeys = adultNPubs.map(npub => (nip19.decode(npub).data as string).toLowerCase());
/* The following profiles have questionable content and are blocked completely on slidestr.net */
export const blockedNPubs = [
'npub1awxh85c5wasj60d42uvmzuza2uvjazff9m7skg2vf7x2f8gykwkqykxktf', // AIイラスト',
'npub1xfu7047thly6aghl79z97kckkvwfvtcx88n6wq7c2tlng484d8xqv0kuvv', // Erandis Vol

View File

@ -1,6 +1,6 @@
import { NDKFilter, NDKKind, NDKTag } from '@nostr-dev-kit/ndk';
import { nip19 } from 'nostr-tools';
import { nfswTags, adultPublicKeys } from './env';
import { adultContentTags, adultPublicKeys } from './env';
export type NostrImage = {
url: string;
@ -79,7 +79,7 @@ export const hasContentWarning = ({ 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;
return tags.filter((t: string[]) => t[0] === 't' && adultContentTags.includes(t[1])).length > 0;
};
export const isAdultRelated = ({ tags, pubkey }: { tags?: NDKTag[]; pubkey: string }) => {