forked from FoundKeyGang/FoundKey
activitypub: fix LD context
ActivityPub through ActivityStreams 2.0 requires the use of the
expansion algorithm from JSON-LD 1.0 which is not able to handle nested contexts.
Fixes commit 21ab8e75ee
, thanks to sn0w.
This commit is contained in:
parent
a9c6e51051
commit
be950f5313
2 changed files with 12 additions and 7 deletions
|
@ -46,13 +46,8 @@ export const renderActivity = (x: any): IActivity | null => {
|
|||
},
|
||||
// schema
|
||||
schema: 'http://schema.org/',
|
||||
PropertyValue: {
|
||||
'@id': 'schema:PropertyValue',
|
||||
'@context': {
|
||||
'value': 'schema:value',
|
||||
'name': 'schema:name',
|
||||
},
|
||||
},
|
||||
PropertyValue: 'schema:PropertyValue',
|
||||
value: 'schema:value',
|
||||
// Misskey
|
||||
misskey: 'https://misskey-hub.net/ns#',
|
||||
'_misskey_quote': {
|
||||
|
|
|
@ -24,6 +24,7 @@ export async function renderPerson(user: ILocalUser) {
|
|||
const attachment: {
|
||||
type: 'PropertyValue',
|
||||
name: string,
|
||||
'schema:name': string,
|
||||
value: string,
|
||||
identifier?: IIdentifier
|
||||
}[] = [];
|
||||
|
@ -44,6 +45,15 @@ export async function renderPerson(user: ILocalUser) {
|
|||
attachment.push({
|
||||
type: 'PropertyValue',
|
||||
name: field.name,
|
||||
// uses "name" for backward compatibility, but JSON-LD-expanding
|
||||
// it ends up being the ActivityPub name property, which is not
|
||||
// correct for this type. which is why we also send the "correct"
|
||||
// schema.org name property field, which would not be recognized
|
||||
// by people just processing JSON-LD as JSON as allowed by the spec.
|
||||
// it would be nicer to do this with JSON-LD context, but this is
|
||||
// only possible when using JSON-LD 1.1 with nested contexts, but
|
||||
// activitystreams 2.0 requires the JSON-LD 1.0 expansion algorithm.
|
||||
'schema:name': field.name,
|
||||
value,
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue