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)