summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2024-09-11 09:50:03 +0200
committerEugen Rochko <eugen@zeonfederated.com>2024-09-12 07:25:45 +0200
commit5a7ea1dd2ff4a01b514d9f6e9b25d203f264b60c (patch)
tree6576ff4af3e3fa2117daaa1a0be4b588fe977854
parent9e12fa254e8956f1f8765a76b2c6ea54e47cfdae (diff)
Change some inline term definitions to new JSON-LD contextfix-context-socialweb-miscellany
-rw-r--r--app/helpers/context_helper.rb1
-rw-r--r--app/serializers/activitypub/actor_serializer.rb6
-rw-r--r--app/serializers/activitypub/hashtag_serializer.rb2
-rw-r--r--app/serializers/activitypub/note_serializer.rb6
-rw-r--r--config/initializers/json_ld_miscellany.rb16
5 files changed, 25 insertions, 6 deletions
diff --git a/app/helpers/context_helper.rb b/app/helpers/context_helper.rb
index a0c1781d240..229227df4f1 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 a6281e23b91..a4990a4733e 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 2b24eb8cc15..5dbd0fc458a 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 27e058199d6..a27562adef5 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 00000000000..3ff18ccf747
--- /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