2023-08-11 19:28:48 +00:00
|
|
|
#!/bin/sh
|
2023-08-12 21:59:36 +00:00
|
|
|
//bin/true; exec deno run -A "$0" "$@"
|
2023-08-11 19:28:48 +00:00
|
|
|
import {
|
|
|
|
antiDuplicationPolicy,
|
|
|
|
hellthreadPolicy,
|
|
|
|
pipeline,
|
|
|
|
rateLimitPolicy,
|
|
|
|
readStdin,
|
|
|
|
writeStdout,
|
|
|
|
} from 'https://gitlab.com/soapbox-pub/strfry-policies/-/raw/v0.1.0/mod.ts';
|
|
|
|
|
|
|
|
for await (const msg of readStdin()) {
|
|
|
|
const result = await pipeline(msg, [
|
2023-08-12 21:59:36 +00:00
|
|
|
[hellthreadPolicy, { limit: 10 }],
|
2023-08-11 19:28:48 +00:00
|
|
|
[antiDuplicationPolicy, { ttl: 60000, minLength: 50 }],
|
|
|
|
[rateLimitPolicy, { whitelist: ['127.0.0.1'] }],
|
|
|
|
]);
|
|
|
|
|
|
|
|
writeStdout(result);
|
|
|
|
}
|
|
|
|
|