mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 03:19:46 +00:00
Merge branch 'admin-role-script-support-npub' into 'main'
support npubs in admin:role script See merge request soapbox-pub/ditto!366
This commit is contained in:
commit
97951d5d91
1 changed files with 3 additions and 1 deletions
|
|
@ -4,11 +4,13 @@ import { DittoDB } from '@/db/DittoDB.ts';
|
|||
import { AdminSigner } from '@/signers/AdminSigner.ts';
|
||||
import { EventsDB } from '@/storages/EventsDB.ts';
|
||||
import { nostrNow } from '@/utils.ts';
|
||||
import { nip19 } from 'nostr-tools';
|
||||
|
||||
const kysely = await DittoDB.getInstance();
|
||||
const eventsDB = new EventsDB(kysely);
|
||||
|
||||
const [pubkey, role] = Deno.args;
|
||||
const [pubkeyOrNpub, role] = Deno.args;
|
||||
const pubkey = pubkeyOrNpub.startsWith('npub') ? nip19.decode(pubkeyOrNpub).data as string : pubkeyOrNpub;
|
||||
|
||||
if (!NSchema.id().safeParse(pubkey).success) {
|
||||
console.error('Invalid pubkey');
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue