Release Drafter / Update release notes draft (pull_request) Failing after 3s
This turns our relay into a public remote-sign-in relay
39 lines
1.1 KiB
TypeScript
Executable File
39 lines
1.1 KiB
TypeScript
Executable File
#!/bin/sh
|
|
//bin/true; exec deno run --unstable-kv -A "$0" "$@"
|
|
import {
|
|
AntiDuplicationPolicy,
|
|
AnyPolicy,
|
|
FiltersPolicy,
|
|
HellthreadPolicy,
|
|
PipePolicy,
|
|
readStdin,
|
|
writeStdout,
|
|
} from 'jsr:@nostrify/policies';
|
|
import { strfry } from 'jsr:@nostrify/strfry';
|
|
import { LdapConfig, LdapPolicy } from './ldap-policy.ts';
|
|
import { load } from "https://deno.land/std@0.224.0/dotenv/mod.ts";
|
|
|
|
const dirname = new URL('.', import.meta.url).pathname;
|
|
await load({ envPath: `${dirname}/.env`, export: true });
|
|
|
|
const ldapConfig: LdapConfig = {
|
|
url: Deno.env.get("LDAP_URL"),
|
|
bindDN: Deno.env.get("LDAP_BIND_DN"),
|
|
password: Deno.env.get("LDAP_PASSWORD"),
|
|
searchDN: Deno.env.get("LDAP_SEARCH_DN"),
|
|
whitelistPubkeys: Deno.env.get("WHITELIST_PUBKEYS")?.split(',')
|
|
}
|
|
|
|
const policy = new AnyPolicy([
|
|
// Allow NIP-46 (kind 24133) ephemeral events from anyone
|
|
new FiltersPolicy([{ kinds: [24133] }]),
|
|
// All other events go through this pipeline
|
|
new PipePolicy([
|
|
new HellthreadPolicy({ limit: 10 }),
|
|
new AntiDuplicationPolicy({ kv: await Deno.openKv(), expireIn: 60000, minLength: 50 }),
|
|
new LdapPolicy(ldapConfig)
|
|
])
|
|
]);
|
|
|
|
await strfry(policy);
|