@contextをちゃんと付ける (#7522)

This commit is contained in:
MeiMei 2021-05-19 16:00:08 +09:00 committed by GitHub
parent d752275730
commit bfd215542b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 27 additions and 30 deletions

View File

@ -15,17 +15,8 @@ export const renderActivity = (x: any): IActivity | null => {
return Object.assign({
'@context': [
'https://www.w3.org/ns/activitystreams',
'https://w3id.org/security/v1'
]
}, x);
};
export const attachLdSignature = async (activity: any, user: { id: User['id']; host: null; }): Promise<IActivity | null> => {
if (activity == null) return null;
const keypair = await getUserKeypair(user.id);
const obj = {
'https://w3id.org/security/v1',
{
// as non-standards
manuallyApprovesFollowers: 'as:manuallyApprovesFollowers',
sensitive: 'as:sensitive',
@ -50,9 +41,15 @@ export const attachLdSignature = async (activity: any, user: { id: User['id']; h
'isCat': 'misskey:isCat',
// vcard
vcard: 'http://www.w3.org/2006/vcard/ns#',
}
]
}, x);
};
activity['@context'].push(obj);
export const attachLdSignature = async (activity: any, user: { id: User['id']; host: null; }): Promise<IActivity | null> => {
if (activity == null) return null;
const keypair = await getUserKeypair(user.id);
const ldSignature = new LdSignature();
ldSignature.debug = false;