Add strfry policies and members-only LDAP policy
This will look up nostr pubkeys in the LDAP directory to allow or deny publishing notes to the relay.
This commit is contained in:
23
extras/strfry/strfry-policy.ts
Executable file
23
extras/strfry/strfry-policy.ts
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
//bin/true; exec deno run -A "$0" "$@"
|
||||
import {
|
||||
antiDuplicationPolicy,
|
||||
hellthreadPolicy,
|
||||
pipeline,
|
||||
rateLimitPolicy,
|
||||
readStdin,
|
||||
writeStdout,
|
||||
} from 'https://gitlab.com/soapbox-pub/strfry-policies/-/raw/develop/mod.ts';
|
||||
|
||||
import ldapPolicy from './ldap-policy.ts';
|
||||
|
||||
for await (const msg of readStdin()) {
|
||||
const result = await pipeline(msg, [
|
||||
[hellthreadPolicy, { limit: 10 }],
|
||||
[antiDuplicationPolicy, { ttl: 60000, minLength: 50 }],
|
||||
[rateLimitPolicy, { whitelist: ['127.0.0.1'] }],
|
||||
[ldapPolicy],
|
||||
]);
|
||||
|
||||
writeStdout(result);
|
||||
}
|
||||
Reference in New Issue
Block a user