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;
}
const whitelistImageURL = ["nostr.build", "void.cat", "blossom.oxtr"];
/**
* Upload file to void.cat
* https://void.cat/swagger/index.html
@ -64,7 +65,7 @@ export const renderMedia = (files: string[]) => {
<div style={{ display: 'grid', gridTemplateColumns, gridTemplateRows, gap: '2px' }}>
{files.map((file, index) => {
// 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"))) {
return (

View File

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