[backend/federation] Preload webfinger JSON-LD context definition

This commit is contained in:
Laura Hausmann 2024-10-24 19:27:04 +02:00
parent 29cbf5cb4b
commit 1c2c958dfb
No known key found for this signature in database
GPG key ID: D044E84C5BE01605
2 changed files with 17 additions and 6 deletions

View file

@ -0,0 +1,10 @@
{
"@context": {
"wf": "https://purl.archive.org/socialweb/webfinger#",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"webfinger": {
"@id": "wf:webfinger",
"@type": "xsd:string"
}
}
}

View file

@ -15,12 +15,13 @@ public static class LdHelpers
{ {
private static readonly Dictionary<string, RemoteDocument> PreloadedContexts = new() private static readonly Dictionary<string, RemoteDocument> PreloadedContexts = new()
{ {
["https://www.w3.org/ns/activitystreams"] = GetPreloadedContext("as.json"), ["https://purl.archive.org/socialweb/webfinger"] = GetPreloadedContext("wf.json"),
["https://w3id.org/security/v1"] = GetPreloadedContext("security.json"), ["https://www.w3.org/ns/activitystreams"] = GetPreloadedContext("as.json"),
["http://joinmastodon.org/ns"] = GetPreloadedContext("toot.json"), ["https://w3id.org/security/v1"] = GetPreloadedContext("security.json"),
["https://gotosocial.org/ns"] = GetPreloadedContext("gts.json"), ["http://joinmastodon.org/ns"] = GetPreloadedContext("toot.json"),
["http://schema.org/"] = GetPreloadedContext("schema.json"), ["https://gotosocial.org/ns"] = GetPreloadedContext("gts.json"),
["litepub-0.1"] = GetPreloadedContext("litepub.json") ["http://schema.org/"] = GetPreloadedContext("schema.json"),
["litepub-0.1"] = GetPreloadedContext("litepub.json")
}; };
private static readonly ConcurrentDictionary<string, RemoteDocument> ContextCache = new(); private static readonly ConcurrentDictionary<string, RemoteDocument> ContextCache = new();