diff --git a/app/helpers/context_helper.rb b/app/helpers/context_helper.rb index a0c1781d24..229227df4f 100644 --- a/app/helpers/context_helper.rb +++ b/app/helpers/context_helper.rb @@ -4,6 +4,7 @@ module ContextHelper NAMED_CONTEXT_MAP = { activitystreams: 'https://www.w3.org/ns/activitystreams', security: 'https://w3id.org/security/v1', + miscellany: 'https://purl.archive.org/socialweb/miscellany', }.freeze CONTEXT_EXTENSION_MAP = { diff --git a/app/serializers/activitypub/actor_serializer.rb b/app/serializers/activitypub/actor_serializer.rb index a6281e23b9..a4990a4733 100644 --- a/app/serializers/activitypub/actor_serializer.rb +++ b/app/serializers/activitypub/actor_serializer.rb @@ -4,10 +4,10 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer include RoutingHelper include FormattingHelper - context :security + context :security, :miscellany - context_extensions :manually_approves_followers, :featured, :also_known_as, - :moved_to, :property_value, :discoverable, :olm, :suspended, + context_extensions :featured, :also_known_as, + :property_value, :discoverable, :olm, :suspended, :memorial, :indexable, :attribution_domains attributes :id, :type, :following, :followers, diff --git a/app/serializers/activitypub/hashtag_serializer.rb b/app/serializers/activitypub/hashtag_serializer.rb index 2b24eb8cc1..5dbd0fc458 100644 --- a/app/serializers/activitypub/hashtag_serializer.rb +++ b/app/serializers/activitypub/hashtag_serializer.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class ActivityPub::HashtagSerializer < ActivityPub::Serializer - context_extensions :hashtag + context :miscellany include RoutingHelper diff --git a/app/serializers/activitypub/note_serializer.rb b/app/serializers/activitypub/note_serializer.rb index 27e058199d..a27562adef 100644 --- a/app/serializers/activitypub/note_serializer.rb +++ b/app/serializers/activitypub/note_serializer.rb @@ -3,7 +3,9 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer include FormattingHelper - context_extensions :atom_uri, :conversation, :sensitive, :voters_count + context :miscellany + + context_extensions :atom_uri, :conversation, :voters_count attributes :id, :type, :summary, :in_reply_to, :published, :url, @@ -254,7 +256,7 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer end class TagSerializer < ActivityPub::Serializer - context_extensions :hashtag + context :miscellany include RoutingHelper diff --git a/config/initializers/json_ld_miscellany.rb b/config/initializers/json_ld_miscellany.rb new file mode 100644 index 0000000000..3ff18ccf74 --- /dev/null +++ b/config/initializers/json_ld_miscellany.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true +# This file generated automatically from https://purl.archive.org/socialweb/miscellany +require 'json/ld' +class JSON::LD::Context + add_preloaded("http://purl.archive.org/socialweb/miscellany") do + new(processingMode: "json-ld-1.1", term_definitions: { + "Hashtag" => TermDefinition.new("Hashtag", id: "https://www.w3.org/ns/activitystreams#Hashtag", simple: true), + "as" => TermDefinition.new("as", id: "https://www.w3.org/ns/activitystreams#", simple: true, prefix: true), + "manuallyApprovesFollowers" => TermDefinition.new("manuallyApprovesFollowers", id: "https://www.w3.org/ns/activitystreams#manuallyApprovesFollowers", type_mapping: "http://www.w3.org/2001/XMLSchema#boolean"), + "movedTo" => TermDefinition.new("movedTo", id: "https://www.w3.org/ns/activitystreams#movedTo", type_mapping: "@id"), + "sensitive" => TermDefinition.new("sensitive", id: "https://www.w3.org/ns/activitystreams#sensitive", type_mapping: "http://www.w3.org/2001/XMLSchema#boolean"), + "xsd" => TermDefinition.new("xsd", id: "http://www.w3.org/2001/XMLSchema#", simple: true, prefix: true) + }) + end + alias_preloaded("https://purl.archive.org/socialweb/miscellany", "http://purl.archive.org/socialweb/miscellany") +end