Testing a regex policy, spam countermeasure.

main
SleepingCrows 2024-07-13 00:00:01 -04:00
parent 15af26fcaa
commit b578e499ac
1 changed files with 2 additions and 1 deletions

View File

@ -1,11 +1,12 @@
import { NPolicy, NostrEvent, NostrRelayOK } from '@nostrify/nostrify'; import { NPolicy, NostrEvent, NostrRelayOK } from '@nostrify/nostrify';
import { AntiDuplicationPolicy, HashtagPolicy, PubkeyBanPolicy, KeywordPolicy, PipePolicy } from '@nostrify/nostrify/policies'; import { AntiDuplicationPolicy, HashtagPolicy, PubkeyBanPolicy, RegexPolicy, KeywordPolicy, PipePolicy } from '@nostrify/nostrify/policies';
const kv = await Deno.openKv(); const kv = await Deno.openKv();
export default class AppPolicy implements NPolicy { export default class AppPolicy implements NPolicy {
async call(event: NostrEvent): Promise<NostrRelayOK> { async call(event: NostrEvent): Promise<NostrRelayOK> {
const policy = new PipePolicy([ const policy = new PipePolicy([
new RegexPolicy(/This is a post from *(.+)/igm),
new KeywordPolicy([ new KeywordPolicy([
'NSFW sexual content', 'NSFW sexual content',
':nsfw:', ':nsfw:',