activitypub: fix LD context
Some checks failed
ci/woodpecker/push/lint-client Pipeline failed
ci/woodpecker/push/lint-backend Pipeline failed
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-sw Pipeline failed
ci/woodpecker/push/test Pipeline failed
Some checks failed
ci/woodpecker/push/lint-client Pipeline failed
ci/woodpecker/push/lint-backend Pipeline failed
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-sw Pipeline failed
ci/woodpecker/push/test Pipeline failed
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
|
||||||
schema: 'http://schema.org/',
|
schema: 'http://schema.org/',
|
||||||
PropertyValue: {
|
PropertyValue: 'schema:PropertyValue',
|
||||||
'@id': 'schema:PropertyValue',
|
value: 'schema:value',
|
||||||
'@context': {
|
|
||||||
'value': 'schema:value',
|
|
||||||
'name': 'schema:name',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
// Misskey
|
// Misskey
|
||||||
misskey: 'https://misskey-hub.net/ns#',
|
misskey: 'https://misskey-hub.net/ns#',
|
||||||
'_misskey_quote': {
|
'_misskey_quote': {
|
||||||
|
|
|
@ -24,6 +24,7 @@ export async function renderPerson(user: ILocalUser) {
|
||||||
const attachment: {
|
const attachment: {
|
||||||
type: 'PropertyValue',
|
type: 'PropertyValue',
|
||||||
name: string,
|
name: string,
|
||||||
|
'schema:name': string,
|
||||||
value: string,
|
value: string,
|
||||||
identifier?: IIdentifier
|
identifier?: IIdentifier
|
||||||
}[] = [];
|
}[] = [];
|
||||||
|
@ -44,6 +45,15 @@ export async function renderPerson(user: ILocalUser) {
|
||||||
attachment.push({
|
attachment.push({
|
||||||
type: 'PropertyValue',
|
type: 'PropertyValue',
|
||||||
name: field.name,
|
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,
|
value,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue