summaryrefslogtreecommitdiff
path: root/src/remote/activitypub
diff options
context:
space:
mode:
authormei23 <m@m544.net>2018-08-25 13:11:54 +0900
committermei23 <m@m544.net>2018-08-25 13:11:54 +0900
commit92828028db28c92d7d36324d445a69d62351df48 (patch)
tree932891ca38ba63f7d255e4774bae7bc57e7e8a78 /src/remote/activitypub
parentUse resolvable ActivityPub keyId (diff)
downloadsharkey-92828028db28c92d7d36324d445a69d62351df48.tar.gz
sharkey-92828028db28c92d7d36324d445a69d62351df48.tar.bz2
sharkey-92828028db28c92d7d36324d445a69d62351df48.zip
Add Activity id if missing
Diffstat (limited to 'src/remote/activitypub')
-rw-r--r--src/remote/activitypub/renderer/index.ts23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/remote/activitypub/renderer/index.ts b/src/remote/activitypub/renderer/index.ts
index ee7f496162..55b2801cad 100644
--- a/src/remote/activitypub/renderer/index.ts
+++ b/src/remote/activitypub/renderer/index.ts
@@ -1,7 +1,16 @@
-export default (x: any) => Object.assign({
- '@context': [
- 'https://www.w3.org/ns/activitystreams',
- 'https://w3id.org/security/v1',
- { Hashtag: 'as:Hashtag' }
- ]
-}, x);
+import config from '../../../config';
+import * as uuid from 'uuid';
+
+export default (x: any) => {
+ if (x !== null && typeof x === 'object' && x.id == null) {
+ x.id = `${config.url}/${uuid.v4()}`;
+ }
+
+ return Object.assign({
+ '@context': [
+ 'https://www.w3.org/ns/activitystreams',
+ 'https://w3id.org/security/v1',
+ { Hashtag: 'as:Hashtag' }
+ ]
+ }, x);
+};