summaryrefslogtreecommitdiff
path: root/src/remote/activitypub
diff options
context:
space:
mode:
authorMeiMei <30769358+mei23@users.noreply.github.com>2021-05-19 16:00:08 +0900
committerGitHub <noreply@github.com>2021-05-19 16:00:08 +0900
commitbfd215542b0ba569d6966c214af63e4240d1146e (patch)
tree1741bf9f933b450430fb96ad5daa947be2353d9c /src/remote/activitypub
parentfix bug (diff)
downloadsharkey-bfd215542b0ba569d6966c214af63e4240d1146e.tar.gz
sharkey-bfd215542b0ba569d6966c214af63e4240d1146e.tar.bz2
sharkey-bfd215542b0ba569d6966c214af63e4240d1146e.zip
@contextをちゃんと付ける (#7522)
Diffstat (limited to 'src/remote/activitypub')
-rw-r--r--src/remote/activitypub/renderer/index.ts57
1 files changed, 27 insertions, 30 deletions
diff --git a/src/remote/activitypub/renderer/index.ts b/src/remote/activitypub/renderer/index.ts
index 3283c88bd4..84500e9491 100644
--- a/src/remote/activitypub/renderer/index.ts
+++ b/src/remote/activitypub/renderer/index.ts
@@ -15,7 +15,33 @@ export const renderActivity = (x: any): IActivity | null => {
return Object.assign({
'@context': [
'https://www.w3.org/ns/activitystreams',
- 'https://w3id.org/security/v1'
+ 'https://w3id.org/security/v1',
+ {
+ // as non-standards
+ manuallyApprovesFollowers: 'as:manuallyApprovesFollowers',
+ sensitive: 'as:sensitive',
+ Hashtag: 'as:Hashtag',
+ quoteUrl: 'as:quoteUrl',
+ // Mastodon
+ toot: 'http://joinmastodon.org/ns#',
+ Emoji: 'toot:Emoji',
+ featured: 'toot:featured',
+ discoverable: 'toot:discoverable',
+ // schema
+ schema: 'http://schema.org#',
+ PropertyValue: 'schema:PropertyValue',
+ value: 'schema:value',
+ // Misskey
+ misskey: `${config.url}/ns#`,
+ '_misskey_content': 'misskey:_misskey_content',
+ '_misskey_quote': 'misskey:_misskey_quote',
+ '_misskey_reaction': 'misskey:_misskey_reaction',
+ '_misskey_votes': 'misskey:_misskey_votes',
+ '_misskey_talk': 'misskey:_misskey_talk',
+ 'isCat': 'misskey:isCat',
+ // vcard
+ vcard: 'http://www.w3.org/2006/vcard/ns#',
+ }
]
}, x);
};
@@ -25,35 +51,6 @@ export const attachLdSignature = async (activity: any, user: { id: User['id']; h
const keypair = await getUserKeypair(user.id);
- const obj = {
- // as non-standards
- manuallyApprovesFollowers: 'as:manuallyApprovesFollowers',
- sensitive: 'as:sensitive',
- Hashtag: 'as:Hashtag',
- quoteUrl: 'as:quoteUrl',
- // Mastodon
- toot: 'http://joinmastodon.org/ns#',
- Emoji: 'toot:Emoji',
- featured: 'toot:featured',
- discoverable: 'toot:discoverable',
- // schema
- schema: 'http://schema.org#',
- PropertyValue: 'schema:PropertyValue',
- value: 'schema:value',
- // Misskey
- misskey: `${config.url}/ns#`,
- '_misskey_content': 'misskey:_misskey_content',
- '_misskey_quote': 'misskey:_misskey_quote',
- '_misskey_reaction': 'misskey:_misskey_reaction',
- '_misskey_votes': 'misskey:_misskey_votes',
- '_misskey_talk': 'misskey:_misskey_talk',
- 'isCat': 'misskey:isCat',
- // vcard
- vcard: 'http://www.w3.org/2006/vcard/ns#',
- };
-
- activity['@context'].push(obj);
-
const ldSignature = new LdSignature();
ldSignature.debug = false;
activity = await ldSignature.signRsaSignature2017(activity, keypair.privateKey, `${config.url}/users/${user.id}#main-key`);