summaryrefslogtreecommitdiff
path: root/src/remote/activitypub/renderer/index.ts
blob: 63447b0c43bbe691b5d01faa614b27d7b5aaf610 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import config from '../../../config';
import { v4 as uuid } from 'uuid';

export const renderActivity = (x: any) => {
	if (x == null) return null;

	if (x !== null && typeof x === 'object' && x.id == null) {
		x.id = `${config.url}/${uuid()}`;
	}

	return Object.assign({
		'@context': [
			'https://www.w3.org/ns/activitystreams',
			'https://w3id.org/security/v1',
			{ Hashtag: 'as:Hashtag' }
		]
	}, x);
};