misskey-awawa/src/remote/activitypub/renderer/index.ts

19 lines
411 B
TypeScript
Raw Normal View History

2018-08-25 04:11:54 +00:00
import config from '../../../config';
import { v4 as uuid } from 'uuid';
2018-08-25 04:11:54 +00:00
export const renderActivity = (x: any) => {
2018-11-16 18:25:48 +00:00
if (x == null) return null;
2018-08-25 04:11:54 +00:00
if (x !== null && typeof x === 'object' && x.id == null) {
x.id = `${config.url}/${uuid()}`;
2018-08-25 04:11:54 +00:00
}
return Object.assign({
'@context': [
'https://www.w3.org/ns/activitystreams',
'https://w3id.org/security/v1',
{ Hashtag: 'as:Hashtag' }
]
}, x);
};