Merge branch 'cli' into 'main'
Add a CLI task to publish events as the Ditto admin See merge request soapbox-pub/ditto!101
This commit is contained in:
commit
aa64029041
|
@ -0,0 +1,23 @@
|
|||
import * as pipeline from '@/pipeline.ts';
|
||||
import { signAdminEvent } from '@/sign.ts';
|
||||
import { type EventStub } from '@/utils/api.ts';
|
||||
import { nostrNow } from '@/utils.ts';
|
||||
|
||||
switch (Deno.args[0]) {
|
||||
case 'publish':
|
||||
await publish(JSON.parse(Deno.args[1]));
|
||||
break;
|
||||
default:
|
||||
console.log('Usage: deno run -A scripts/admin.ts <command>');
|
||||
}
|
||||
|
||||
async function publish(t: EventStub) {
|
||||
const event = await signAdminEvent({
|
||||
content: '',
|
||||
created_at: nostrNow(),
|
||||
tags: [],
|
||||
...t,
|
||||
});
|
||||
|
||||
await pipeline.handleEvent(event);
|
||||
}
|
|
@ -16,7 +16,7 @@ const instanceController: AppController = async (c) => {
|
|||
uri: host,
|
||||
title: meta.name ?? 'Ditto',
|
||||
description: meta.about ?? 'Nostr and the Fediverse',
|
||||
short_description: meta.tagline ?? 'Nostr and the Fediverse',
|
||||
short_description: meta.tagline ?? meta.about ?? 'Nostr and the Fediverse',
|
||||
registrations: Conf.registrations,
|
||||
max_toot_chars: Conf.postCharLimit,
|
||||
configuration: {
|
||||
|
|
|
@ -179,6 +179,7 @@ export {
|
|||
activityJson,
|
||||
createAdminEvent,
|
||||
createEvent,
|
||||
type EventStub,
|
||||
localRequest,
|
||||
paginated,
|
||||
type PaginationParams,
|
||||
|
|
Loading…
Reference in New Issue