From 9ed626d4f73428e2bcc58121307164ba434c46b1 Mon Sep 17 00:00:00 2001 From: Nulo Date: Thu, 22 Feb 2024 09:40:47 -0300 Subject: [PATCH] WIP --- src/scripts/add-post-to-announcements.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/scripts/add-post-to-announcements.ts b/src/scripts/add-post-to-announcements.ts index 9e4b136..24a0c11 100644 --- a/src/scripts/add-post-to-announcements.ts +++ b/src/scripts/add-post-to-announcements.ts @@ -4,6 +4,7 @@ import envPaths from 'env-paths' import { Level } from 'level' import Store from '../server/store/index.js' +import { nanoid } from 'nanoid' const paths = envPaths('social.distributed.press') @@ -19,8 +20,20 @@ const db = new Level(storage, { valueEncoding: 'json' }) const store = new Store(db) console.log(`Posting: ${content}`) +const actor=await store.announcements.getInfo() + await store.announcements.outbox.add({ -id: + '@context': 'https://www.w3.org/ns/activitystreams', + type: 'Note', + id: `${actor.actorUrl}/outbox/${nanoid()}`, + actor: actor.actorUrl, + attributedTo: actor.actorUrl, + published: new Date().toUTCString(), + "to": ["https://www.w3.org/ns/activitystreams#Public"], + "cc": ["https://social.distributed.press/v1/@sutty@sutty.nl/followers"], + object: { + + } }) await store.admins.add(list)