Skip to content

Commit 136de69

Browse files
authored
Merge pull request #631 from dahlia/fix/joinmastodon.org/ns
Add `http://joinmastodon.org/ns` to preloaded JSON-LD contexts
2 parents 1b7a03b + c7c2048 commit 136de69

2 files changed

Lines changed: 49 additions & 0 deletions

File tree

CHANGES.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@ Version 2.0.6
88

99
To be released.
1010

11+
### @fedify/vocab-runtime
12+
13+
- Added `http://joinmastodon.org/ns` to preloaded JSON-LD contexts.
14+
This URL has never served a real JSON-LD context document (Mastodon
15+
has always inlined the term definitions), but some ActivityPub
16+
implementations put it as a bare URL in their `@context`, causing
17+
JSON-LD processors to fail with a 404. [[#630], [#631]]
18+
19+
[#630]: https://github.com/fedify-dev/fedify/issues/630
20+
[#631]: https://github.com/fedify-dev/fedify/pull/631
21+
1122

1223
Version 2.0.5
1324
-------------

packages/vocab-runtime/src/contexts.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4314,6 +4314,44 @@ const preloadedContexts: Record<string, unknown> = {
43144314
},
43154315
},
43164316
},
4317+
4318+
// Mastodon's "toot:" namespace. The URL http://joinmastodon.org/ns has
4319+
// *never* served a real JSON-LD context document—Mastodon has always inlined
4320+
// these term definitions directly in every outgoing @context array. However,
4321+
// some ActivityPub implementations (e.g., Bonfire) put the bare URL in their
4322+
// @context, which causes JSON-LD processors to try to dereference it and fail
4323+
// with a 404. We ship a built-in copy here so that Fedify can parse such
4324+
// documents without a network round-trip to a URL that will never resolve.
4325+
// See: https://github.com/mastodon/joinmastodon/issues/148
4326+
// https://github.com/fedify-dev/fedify/issues/630
4327+
"http://joinmastodon.org/ns": {
4328+
"@context": {
4329+
"toot": "http://joinmastodon.org/ns#",
4330+
"Emoji": "toot:Emoji",
4331+
"featured": {
4332+
"@id": "toot:featured",
4333+
"@type": "@id",
4334+
},
4335+
"featuredTags": {
4336+
"@id": "toot:featuredTags",
4337+
"@type": "@id",
4338+
},
4339+
"focalPoint": {
4340+
"@container": "@list",
4341+
"@id": "toot:focalPoint",
4342+
},
4343+
"blurhash": "toot:blurhash",
4344+
"discoverable": "toot:discoverable",
4345+
"indexable": "toot:indexable",
4346+
"memorial": "toot:memorial",
4347+
"votersCount": "toot:votersCount",
4348+
"suspended": "toot:suspended",
4349+
"attributionDomains": {
4350+
"@id": "toot:attributionDomains",
4351+
"@type": "@id",
4352+
},
4353+
},
4354+
},
43174355
};
43184356

43194357
export default preloadedContexts;

0 commit comments

Comments
 (0)