forked from extern/fediwall
Filter bad words also in spoiler text and media descriptions
This commit is contained in:
parent
9f8057e4d5
commit
c6abbcd342
@ -186,9 +186,10 @@ const filterStatus = (cfg: Config, status: MastodonStatus) => {
|
||||
if (cfg.hideBots && status.account?.bot) return false;
|
||||
if (cfg.badWords.length) {
|
||||
const pattern = new RegExp(`\\b(${cfg.badWords.map(regexEscape).join("|")})\\b`, 'i');
|
||||
if (status.tags?.find((tag: any) => cfg.badWords.includes(tag.name)))
|
||||
return false;
|
||||
if (status.content.match(pattern))
|
||||
if (status.tags?.find((tag: any) => cfg.badWords.includes(tag.name))
|
||||
|| status.content.match(pattern)
|
||||
|| status.spoiler_text?.match(pattern)
|
||||
|| status.media_attachments?.find(media => media.description?.match(pattern)))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -68,6 +68,7 @@ export type MastodonStatus = {
|
||||
media_attachments: Array<MastodonMediaAttachment>;
|
||||
reblog?: MastodonStatus | null;
|
||||
sensitive: boolean;
|
||||
spoiler_text?: string | null;
|
||||
tags: Array<MastodonTag>;
|
||||
uri: string;
|
||||
url?: string | null;
|
||||
|
Loading…
Reference in New Issue
Block a user