mirror of
https://github.com/smolgrrr/TAO.git
synced 2024-09-20 09:21:25 +00:00
add censorship
This commit is contained in:
parent
f6ac34b451
commit
af9d99b8ee
@ -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 (
|
||||||
|
@ -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) {
|
||||||
|
if (!blacklistUrl.some(blacklistedUrl => event.content.includes(blacklistedUrl))) {
|
||||||
cb(event, relay.url);
|
cb(event, relay.url);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
subList.push(sub);
|
subList.push(sub);
|
||||||
|
Loading…
Reference in New Issue
Block a user