add censorship

This commit is contained in:
smolgrrr 2024-07-22 18:36:10 +10:00
parent f6ac34b451
commit af9d99b8ee
2 changed files with 7 additions and 2 deletions

View File

@ -6,6 +6,7 @@ export interface UploadResult {
error?: string; error?: string;
} }
const whitelistImageURL = ["nostr.build", "void.cat", "blossom.oxtr"];
/** /**
* Upload file to void.cat * Upload file to void.cat
* https://void.cat/swagger/index.html * https://void.cat/swagger/index.html
@ -64,7 +65,7 @@ export const renderMedia = (files: string[]) => {
<div style={{ display: 'grid', gridTemplateColumns, gridTemplateRows, gap: '2px' }}> <div style={{ display: 'grid', gridTemplateColumns, gridTemplateRows, gap: '2px' }}>
{files.map((file, index) => { {files.map((file, index) => {
// Check if the file is from allowed domains // Check if the file is from allowed domains
const isFromAllowedDomain = file.includes("i.nostr.build") || file.includes("void.cat"); const isFromAllowedDomain = whitelistImageURL.some(domain => file.includes(domain));
if (file && (file.endsWith(".mp4") || file.endsWith(".webm"))) { if (file && (file.endsWith(".mp4") || file.endsWith(".webm"))) {
return ( return (

View File

@ -11,6 +11,8 @@ type Subscribe = {
unsub?: boolean; unsub?: boolean;
}; };
const blacklistUrl = ["lain.la", "casualcrypto.date"];
const subList: Array<Subscription> = []; const subList: Array<Subscription> = [];
const currentSubList: Array<Subscribe> = []; const currentSubList: Array<Subscribe> = [];
const relayMap = new Map<string, Relay>(); const relayMap = new Map<string, Relay>();
@ -40,7 +42,9 @@ const subscribe = (
) => { ) => {
const sub = relay.subscribe([filter], { const sub = relay.subscribe([filter], {
onevent(event) { onevent(event) {
cb(event, relay.url); if (!blacklistUrl.some(blacklistedUrl => event.content.includes(blacklistedUrl))) {
cb(event, relay.url);
}
}, },
}); });
subList.push(sub); subList.push(sub);