mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
admin-role script: minor tweaks
This commit is contained in:
parent
97951d5d91
commit
72ca7af7f0
1 changed files with 2 additions and 2 deletions
|
|
@ -1,16 +1,16 @@
|
||||||
import { NSchema } from '@nostrify/nostrify';
|
import { NSchema } from '@nostrify/nostrify';
|
||||||
|
import { nip19 } from 'nostr-tools';
|
||||||
|
|
||||||
import { DittoDB } from '@/db/DittoDB.ts';
|
import { DittoDB } from '@/db/DittoDB.ts';
|
||||||
import { AdminSigner } from '@/signers/AdminSigner.ts';
|
import { AdminSigner } from '@/signers/AdminSigner.ts';
|
||||||
import { EventsDB } from '@/storages/EventsDB.ts';
|
import { EventsDB } from '@/storages/EventsDB.ts';
|
||||||
import { nostrNow } from '@/utils.ts';
|
import { nostrNow } from '@/utils.ts';
|
||||||
import { nip19 } from 'nostr-tools';
|
|
||||||
|
|
||||||
const kysely = await DittoDB.getInstance();
|
const kysely = await DittoDB.getInstance();
|
||||||
const eventsDB = new EventsDB(kysely);
|
const eventsDB = new EventsDB(kysely);
|
||||||
|
|
||||||
const [pubkeyOrNpub, role] = Deno.args;
|
const [pubkeyOrNpub, role] = Deno.args;
|
||||||
const pubkey = pubkeyOrNpub.startsWith('npub') ? nip19.decode(pubkeyOrNpub).data as string : pubkeyOrNpub;
|
const pubkey = pubkeyOrNpub.startsWith('npub1') ? nip19.decode(pubkeyOrNpub as `npub1${string}`).data : pubkeyOrNpub;
|
||||||
|
|
||||||
if (!NSchema.id().safeParse(pubkey).success) {
|
if (!NSchema.id().safeParse(pubkey).success) {
|
||||||
console.error('Invalid pubkey');
|
console.error('Invalid pubkey');
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue