diff options
author | Fire Demon <firedemon@creature.cafe> | 2020-08-07 00:20:41 -0500 |
---|---|---|
committer | Fire Demon <firedemon@creature.cafe> | 2020-08-30 05:45:17 -0500 |
commit | 256e85e32608f012209fd1d52486174995b77905 (patch) | |
tree | 37cef8207a19ae8c364243bac597a4c45df97e72 /app/serializers/activitypub | |
parent | 93b17730518898d7de5ce1a3c6cc4df40f30c79d (diff) |
[Feature, Federation] Add support for arbitarty account and server metadata fields
Diffstat (limited to 'app/serializers/activitypub')
-rw-r--r-- | app/serializers/activitypub/actor_serializer.rb | 11 | ||||
-rw-r--r-- | app/serializers/activitypub/note_serializer.rb | 7 |
2 files changed, 16 insertions, 2 deletions
diff --git a/app/serializers/activitypub/actor_serializer.rb b/app/serializers/activitypub/actor_serializer.rb index 8e5e5b4bb..d9d47808e 100644 --- a/app/serializers/activitypub/actor_serializer.rb +++ b/app/serializers/activitypub/actor_serializer.rb @@ -24,8 +24,9 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer attribute :moved_to, if: :moved? attribute :also_known_as, if: :also_known_as? - context_extensions :require_dereference, :show_replies, :private, :require_auth + context_extensions :require_dereference, :show_replies, :private, :require_auth, :metadata, :server_metadata attributes :require_dereference, :show_replies, :show_unlisted, :private, :require_auth + attributes :metadata, :server_metadata class EndpointsSerializer < ActivityPub::Serializer include RoutingHelper @@ -136,6 +137,14 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer object.fields + object.identity_proofs.active end + def metadata + object.metadata.cached_fields_json + end + + def server_metadata + Mastodon::Version.server_metadata_json + end + def moved_to ActivityPub::TagManager.instance.uri_for(object.moved_to_account) end diff --git a/app/serializers/activitypub/note_serializer.rb b/app/serializers/activitypub/note_serializer.rb index 86dc64590..3d99e29c4 100644 --- a/app/serializers/activitypub/note_serializer.rb +++ b/app/serializers/activitypub/note_serializer.rb @@ -3,7 +3,7 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer context_extensions :atom_uri, :conversation, :sensitive, :voters_count, :direct_message - context_extensions :edited + context_extensions :edited, :server_metadata attributes :id, :type, :summary, :in_reply_to, :published, :url, @@ -18,6 +18,7 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer attribute :content_map, if: :language? attribute :direct_message, if: :non_public? + attribute :server_metadata has_many :media_attachments, key: :attachment has_many :virtual_tags, key: :tag @@ -195,6 +196,10 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer object.title.present? end + def server_metadata + Mastodon::Version.server_metadata_json + end + class MediaAttachmentSerializer < ActivityPub::Serializer context_extensions :blurhash, :focal_point |