Add pubkey whitelist to strfry policy
And allow the local akkounts instance to publish on the local relay
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { Policy } from 'https://gitlab.com/soapbox-pub/strfry-policies/-/raw/develop/mod.ts';
|
||||
import type { IterablePubkeys, Policy } from 'https://gitlab.com/soapbox-pub/strfry-policies/-/raw/develop/mod.ts';
|
||||
import { Client } from 'npm:ldapts';
|
||||
import { nip57 } from '@nostr/tools';
|
||||
|
||||
@@ -7,6 +7,7 @@ interface LdapConfig {
|
||||
bindDN: string;
|
||||
password: string;
|
||||
searchDN: string;
|
||||
whitelistPubkeys?: IterablePubkeys;
|
||||
}
|
||||
|
||||
const ldapPolicy: Policy<LdapConfig> = async (msg, opts) => {
|
||||
@@ -15,6 +16,12 @@ const ldapPolicy: Policy<LdapConfig> = async (msg, opts) => {
|
||||
let { pubkey } = msg.event;
|
||||
let out = { id: msg.event.id }
|
||||
|
||||
if (opts.whitelistPubkeys.includes(pubkey)) {
|
||||
out['action'] = 'accept';
|
||||
out['msg'] = '';
|
||||
return out;
|
||||
}
|
||||
|
||||
// Zap receipt
|
||||
if (kind === 9735) {
|
||||
const descriptionTag = tags.find(([t, v]) => t === 'description' && v);
|
||||
|
||||
@@ -19,6 +19,7 @@ const ldapConfig = {
|
||||
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(',')
|
||||
}
|
||||
|
||||
for await (const msg of readStdin()) {
|
||||
|
||||
Reference in New Issue
Block a user