diff options
author | Fire Demon <firedemon@creature.cafe> | 2020-11-18 22:10:15 -0600 |
---|---|---|
committer | Fire Demon <firedemon@creature.cafe> | 2020-11-18 22:10:15 -0600 |
commit | 930f7145374adb79e92e9bdfcbc0d0044690b6c8 (patch) | |
tree | 6188688d3e48cd8a40fbe89adaf8db6bbf07d082 /app | |
parent | cfe8a3218addfd7e0cc82c6f0054572f3d8aa296 (diff) |
Always use indirect federation
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/api/v1/accounts/credentials_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/settings/profiles_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/statuses_controller.rb | 2 | ||||
-rw-r--r-- | app/lib/activitypub/adapter.rb | 1 | ||||
-rw-r--r-- | app/models/account.rb | 5 | ||||
-rw-r--r-- | app/presenters/activitypub/activity_presenter.rb | 4 | ||||
-rw-r--r-- | app/serializers/activitypub/actor_serializer.rb | 4 | ||||
-rw-r--r-- | app/serializers/activitypub/outbox_serializer.rb | 2 | ||||
-rw-r--r-- | app/serializers/activitypub/undo_announce_serializer.rb | 2 | ||||
-rw-r--r-- | app/serializers/rest/account_serializer.rb | 2 | ||||
-rw-r--r-- | app/services/activitypub/process_account_service.rb | 1 | ||||
-rw-r--r-- | app/services/backup_service.rb | 2 | ||||
-rw-r--r-- | app/services/process_mentions_service.rb | 2 | ||||
-rw-r--r-- | app/services/reblog_service.rb | 2 | ||||
-rw-r--r-- | app/views/settings/profiles/show.html.haml | 7 | ||||
-rw-r--r-- | app/workers/activitypub/distribution_worker.rb | 2 | ||||
-rw-r--r-- | app/workers/activitypub/reply_distribution_worker.rb | 2 |
17 files changed, 17 insertions, 27 deletions
diff --git a/app/controllers/api/v1/accounts/credentials_controller.rb b/app/controllers/api/v1/accounts/credentials_controller.rb index 3c8187a99..886c00282 100644 --- a/app/controllers/api/v1/accounts/credentials_controller.rb +++ b/app/controllers/api/v1/accounts/credentials_controller.rb @@ -22,7 +22,7 @@ class Api::V1::Accounts::CredentialsController < Api::BaseController def account_params params.permit(:display_name, :note, :avatar, :header, :locked, :bot, :discoverable, - :require_dereference, :show_replies, :show_unlisted, + :show_replies, :show_unlisted, fields_attributes: [:name, :value]) end diff --git a/app/controllers/settings/profiles_controller.rb b/app/controllers/settings/profiles_controller.rb index 541ba2d5d..e71ebbb10 100644 --- a/app/controllers/settings/profiles_controller.rb +++ b/app/controllers/settings/profiles_controller.rb @@ -21,7 +21,7 @@ class Settings::ProfilesController < Settings::BaseController def account_params params.require(:account).permit(:display_name, :note, :avatar, :header, :locked, :bot, :discoverable, - :require_dereference, :show_replies, :show_unlisted, :private, :require_auth, + :show_replies, :show_unlisted, :private, :require_auth, fields_attributes: [:name, :value]) end diff --git a/app/controllers/statuses_controller.rb b/app/controllers/statuses_controller.rb index 596ce9b84..a3ba43d7b 100644 --- a/app/controllers/statuses_controller.rb +++ b/app/controllers/statuses_controller.rb @@ -46,7 +46,7 @@ class StatusesController < ApplicationController def activity expires_in 3.minutes, public: @status.distributable? && public_fetch_mode? - render_with_cache json: ActivityPub::ActivityPresenter.from_status(@status, current_account&.domain), + render_with_cache json: ActivityPub::ActivityPresenter.from_status(@status, current_account&.domain, embed: true), content_type: 'application/activity+json', serializer: ActivityPub::ActivitySerializer, adapter: ActivityPub::Adapter, diff --git a/app/lib/activitypub/adapter.rb b/app/lib/activitypub/adapter.rb index bf5a49f05..3063f7a4b 100644 --- a/app/lib/activitypub/adapter.rb +++ b/app/lib/activitypub/adapter.rb @@ -9,7 +9,6 @@ class ActivityPub::Adapter < ActiveModelSerializers::Adapter::Base CONTEXT_EXTENSION_MAP = { direct_message: { 'litepub': 'http://litepub.social/ns#', 'directMessage': 'litepub:directMessage' }, edited: { 'mp' => 'https://the.monsterpit.net/ns#', 'edited' => 'mp:edited' }, - require_dereference: { 'mp' => 'https://the.monsterpit.net/ns#', 'requireDereference' => 'mp:requireDereference' }, show_replies: { 'mp' => 'https://the.monsterpit.net/ns#', 'showReplies' => 'mp:showReplies' }, show_unlisted: { 'mp' => 'https://the.monsterpit.net/ns#', 'showUnlisted' => 'mp:showUnlisted' }, private: { 'mp' => 'https://the.monsterpit.net/ns#', 'private' => 'mp:private' }, diff --git a/app/models/account.rb b/app/models/account.rb index b0def4028..90145ceb2 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -50,14 +50,13 @@ # avatar_storage_schema_version :integer # header_storage_schema_version :integer # devices_url :string -# sensitized_at :datetime -# suspension_origin :integer -# require_dereference :boolean default(FALSE), not null # show_replies :boolean default(TRUE), not null # show_unlisted :boolean default(TRUE), not null # private :boolean default(FALSE), not null # require_auth :boolean default(FALSE), not null # last_synced_at :datetime +# sensitized_at :datetime +# suspension_origin :integer # class Account < ApplicationRecord diff --git a/app/presenters/activitypub/activity_presenter.rb b/app/presenters/activitypub/activity_presenter.rb index 88aed1e4e..7f640ee9f 100644 --- a/app/presenters/activitypub/activity_presenter.rb +++ b/app/presenters/activitypub/activity_presenter.rb @@ -4,7 +4,7 @@ class ActivityPub::ActivityPresenter < ActiveModelSerializers::Model attributes :id, :type, :actor, :published, :to, :cc, :virtual_object class << self - def from_status(status, domain, update: false, embed: true) + def from_status(status, domain, update: false, embed: false) new.tap do |presenter| default_activity = update && status.edited.positive? ? 'Update' : 'Create' presenter.id = ActivityPub::TagManager.instance.activity_uri_for(status) @@ -14,7 +14,7 @@ class ActivityPub::ActivityPresenter < ActiveModelSerializers::Model presenter.to = ActivityPub::TagManager.instance.to(status, domain) presenter.cc = ActivityPub::TagManager.instance.cc(status, domain) - unless embed || !status.account.require_dereference + unless embed && !update presenter.virtual_object = ActivityPub::TagManager.instance.uri_for(status.proper) next end diff --git a/app/serializers/activitypub/actor_serializer.rb b/app/serializers/activitypub/actor_serializer.rb index 0c6205d7f..38c566937 100644 --- a/app/serializers/activitypub/actor_serializer.rb +++ b/app/serializers/activitypub/actor_serializer.rb @@ -25,8 +25,8 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer attribute :also_known_as, if: :also_known_as? attribute :suspended, if: :suspended? - context_extensions :require_dereference, :show_replies, :private, :require_auth, :metadata, :server_metadata - attributes :require_dereference, :show_replies, :show_unlisted, :private, :require_auth + context_extensions :show_replies, :private, :require_auth, :metadata, :server_metadata + attributes :show_replies, :show_unlisted, :private, :require_auth attributes :metadata, :server_metadata class EndpointsSerializer < ActivityPub::Serializer diff --git a/app/serializers/activitypub/outbox_serializer.rb b/app/serializers/activitypub/outbox_serializer.rb index d1708cc36..4de619efc 100644 --- a/app/serializers/activitypub/outbox_serializer.rb +++ b/app/serializers/activitypub/outbox_serializer.rb @@ -10,6 +10,6 @@ class ActivityPub::OutboxSerializer < ActivityPub::CollectionSerializer end def items - object.items.map { |status| ActivityPub::ActivityPresenter.from_status(status, instance_options[:domain], embed: false) } + object.items.map { |status| ActivityPub::ActivityPresenter.from_status(status, instance_options[:domain]) } end end diff --git a/app/serializers/activitypub/undo_announce_serializer.rb b/app/serializers/activitypub/undo_announce_serializer.rb index d48fcff73..535cda20a 100644 --- a/app/serializers/activitypub/undo_announce_serializer.rb +++ b/app/serializers/activitypub/undo_announce_serializer.rb @@ -22,6 +22,6 @@ class ActivityPub::UndoAnnounceSerializer < ActivityPub::Serializer end def virtual_object - ActivityPub::ActivityPresenter.from_status(object, instance_options[:domain], embed: false) + ActivityPub::ActivityPresenter.from_status(object, instance_options[:domain]) end end diff --git a/app/serializers/rest/account_serializer.rb b/app/serializers/rest/account_serializer.rb index 133f66201..1b780da90 100644 --- a/app/serializers/rest/account_serializer.rb +++ b/app/serializers/rest/account_serializer.rb @@ -7,7 +7,7 @@ class REST::AccountSerializer < ActiveModel::Serializer :note, :url, :avatar, :avatar_static, :header, :header_static, :followers_count, :following_count, :statuses_count, :last_status_at - attributes :require_dereference, :show_replies, :show_unlisted + attributes :show_replies, :show_unlisted has_one :moved_to_account, key: :moved, serializer: REST::AccountSerializer, if: :moved_and_not_nested? diff --git a/app/services/activitypub/process_account_service.rb b/app/services/activitypub/process_account_service.rb index 7e50dc776..ec1041b3d 100644 --- a/app/services/activitypub/process_account_service.rb +++ b/app/services/activitypub/process_account_service.rb @@ -92,7 +92,6 @@ class ActivityPub::ProcessAccountService < BaseService @account.also_known_as = as_array(@json['alsoKnownAs'] || []).map { |item| value_or_id(item) } @account.actor_type = actor_type @account.discoverable = @json['discoverable'] || false - @account.require_dereference = @json['requireDereference'] || false @account.show_replies = @json['showReplies'] || true @account.show_unlisted = @json['showUnlisted'] || true @account.private = @json['private'] || false diff --git a/app/services/backup_service.rb b/app/services/backup_service.rb index b83c08a98..e4d4c5a89 100644 --- a/app/services/backup_service.rb +++ b/app/services/backup_service.rb @@ -22,7 +22,7 @@ class BackupService < BaseService account.statuses.with_includes.reorder(nil).find_in_batches do |statuses| statuses.each do |status| - item = serialize_payload(ActivityPub::ActivityPresenter.from_status(status, nil), ActivityPub::ActivitySerializer, signer: @account, allow_local_only: true) + item = serialize_payload(ActivityPub::ActivityPresenter.from_status(status, nil, embed: true), ActivityPub::ActivitySerializer, signer: @account, allow_local_only: true) item.delete(:'@context') unless item[:type] == 'Announce' || item[:object][:attachment].blank? diff --git a/app/services/process_mentions_service.rb b/app/services/process_mentions_service.rb index 51c368264..6ee8550c4 100644 --- a/app/services/process_mentions_service.rb +++ b/app/services/process_mentions_service.rb @@ -37,7 +37,7 @@ class ProcessMentionsService < BaseService end def activitypub_json(domain) - @activitypub_json[domain] ||= Oj.dump(serialize_payload(ActivityPub::ActivityPresenter.from_status(@status, domain, embed: false), ActivityPub::ActivitySerializer, signer: @status.account, domain: domain)) + @activitypub_json[domain] ||= Oj.dump(serialize_payload(ActivityPub::ActivityPresenter.from_status(@status, domain), ActivityPub::ActivitySerializer, signer: @status.account, domain: domain)) end def check_for_spam(status) diff --git a/app/services/reblog_service.rb b/app/services/reblog_service.rb index 93b0c160b..ef7468194 100644 --- a/app/services/reblog_service.rb +++ b/app/services/reblog_service.rb @@ -61,7 +61,7 @@ class ReblogService < BaseService end def build_json(reblog) - Oj.dump(serialize_payload(ActivityPub::ActivityPresenter.from_status(reblog, reblog.account.domain, embed: false), ActivityPub::ActivitySerializer, signer: reblog.account, domain: reblog.account.domain)) + Oj.dump(serialize_payload(ActivityPub::ActivityPresenter.from_status(reblog, reblog.account.domain), ActivityPub::ActivitySerializer, signer: reblog.account, domain: reblog.account.domain)) end def curate!(status) diff --git a/app/views/settings/profiles/show.html.haml b/app/views/settings/profiles/show.html.haml index 1b7765f32..ef2600169 100644 --- a/app/views/settings/profiles/show.html.haml +++ b/app/views/settings/profiles/show.html.haml @@ -49,13 +49,6 @@ .fields-group = f.input :require_auth, as: :boolean, wrapper: :with_label, hint: t('simple_form.hints.defaults.require_auth') - %h4= t 'settings.profiles.advanced_privacy' - - %p.hint= t 'settings.profiles.advanced_privacy_html' - - .fields-group - = f.input :require_dereference, as: :boolean, wrapper: :with_label, hint: t('simple_form.hints.defaults.require_dereference_html') - %hr.spacer/ .fields-row diff --git a/app/workers/activitypub/distribution_worker.rb b/app/workers/activitypub/distribution_worker.rb index 948393c12..a8365ce8d 100644 --- a/app/workers/activitypub/distribution_worker.rb +++ b/app/workers/activitypub/distribution_worker.rb @@ -48,7 +48,7 @@ class ActivityPub::DistributionWorker def payload(inbox_url) domain = Addressable::URI.parse(inbox_url).normalized_host - @payload[domain] ||= Oj.dump(serialize_payload(ActivityPub::ActivityPresenter.from_status(@status, domain, update: true, embed: false), ActivityPub::ActivitySerializer, signer: @account, domain: domain)) + @payload[domain] ||= Oj.dump(serialize_payload(ActivityPub::ActivityPresenter.from_status(@status, domain, update: true), ActivityPub::ActivitySerializer, signer: @account, domain: domain)) end def relay! diff --git a/app/workers/activitypub/reply_distribution_worker.rb b/app/workers/activitypub/reply_distribution_worker.rb index 6b807e8bc..437a47a6e 100644 --- a/app/workers/activitypub/reply_distribution_worker.rb +++ b/app/workers/activitypub/reply_distribution_worker.rb @@ -32,6 +32,6 @@ class ActivityPub::ReplyDistributionWorker def payload(inbox_url) domain = Addressable::URI.parse(inbox_url).normalized_host - @payload[domain] ||= Oj.dump(serialize_payload(ActivityPub::ActivityPresenter.from_status(@status, domain, update: true, embed: false), ActivityPub::ActivitySerializer, signer: @status.account, domain: domain)) + @payload[domain] ||= Oj.dump(serialize_payload(ActivityPub::ActivityPresenter.from_status(@status, domain, update: true), ActivityPub::ActivitySerializer, signer: @status.account, domain: domain)) end end |