unoffical wafrn mirror
wafrn.net
atproto
social-network
activitypub
fork
Configure Feed
Select the types of activity you want to include in your feed.
1import { completeEnvironment } from '../backendOptions.js'
2import { activityPubObject } from '../../interfaces/fediverse/activityPubObject.js'
3import { User } from '../../models/user.js'
4import { postPetitionSigned } from './postPetitionSigned.js'
5
6async function signAndAccept(req: any, remoteUser: User, user: User) {
7 const acceptMessage: activityPubObject = {
8 '@context': 'https://www.w3.org/ns/activitystreams',
9 id: `${completeEnvironment.frontendUrl}/fediverse/accept/${encodeURIComponent(req.body.id)}`,
10 type: 'Accept',
11 actor: `${completeEnvironment.frontendUrl}/fediverse/blog/${(await user).url.toLowerCase()}`,
12 object: req.body
13 }
14 if (remoteUser.remoteInbox === '') {
15 throw new Error('Remote inbox is empty')
16 }
17 return await postPetitionSigned(acceptMessage, await user, await remoteUser.remoteInbox)
18}
19
20export { signAndAccept }