about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/accounts_controller.rb4
-rw-r--r--app/controllers/activitypub/outboxes_controller.rb28
-rw-r--r--app/controllers/api/activitypub/activities_controller.rb27
-rw-r--r--app/controllers/api/activitypub/notes_controller.rb19
-rw-r--r--app/controllers/api/activitypub/outbox_controller.rb69
-rw-r--r--app/controllers/follower_accounts_controller.rb20
-rw-r--r--app/controllers/following_accounts_controller.rb20
-rw-r--r--app/controllers/statuses_controller.rb18
-rw-r--r--app/controllers/tags_controller.rb22
-rw-r--r--app/helpers/activitystreams2_builder_helper.rb8
-rw-r--r--app/lib/activitypub/adapter.rb13
-rw-r--r--app/lib/activitypub/tag_manager.rb69
-rw-r--r--app/presenters/activitypub/collection_presenter.rb5
-rw-r--r--app/serializers/activitypub/activity_serializer.rb27
-rw-r--r--app/serializers/activitypub/actor_serializer.rb53
-rw-r--r--app/serializers/activitypub/collection_serializer.rb26
-rw-r--r--app/serializers/activitypub/note_serializer.rb106
-rw-r--r--app/views/accounts/show.activitystreams2.rabl9
-rw-r--r--app/views/activitypub/base.activitystreams2.rabl1
-rw-r--r--app/views/activitypub/intransient.activitystreams2.rabl3
-rw-r--r--app/views/activitypub/types/announce.activitystreams2.rabl3
-rw-r--r--app/views/activitypub/types/collection.activitystreams2.rabl3
-rw-r--r--app/views/activitypub/types/create.activitystreams2.rabl3
-rw-r--r--app/views/activitypub/types/note.activitystreams2.rabl3
-rw-r--r--app/views/activitypub/types/ordered_collection.activitystreams2.rabl3
-rw-r--r--app/views/activitypub/types/ordered_collection_page.activitystreams2.rabl3
-rw-r--r--app/views/activitypub/types/person.activitystreams2.rabl3
-rw-r--r--app/views/api/activitypub/activities/_show_status.activitystreams2.rabl4
-rw-r--r--app/views/api/activitypub/activities/show_status_announce.activitystreams2.rabl8
-rw-r--r--app/views/api/activitypub/activities/show_status_create.activitystreams2.rabl8
-rw-r--r--app/views/api/activitypub/notes/show.activitystreams2.rabl11
-rw-r--r--app/views/api/activitypub/outbox/show.activitystreams2.rabl12
-rw-r--r--app/views/api/activitypub/outbox/show_page.activitystreams2.rabl16
-rw-r--r--app/views/well_known/webfinger/show.json.rabl6
-rw-r--r--app/views/well_known/webfinger/show.xml.ruby5
35 files changed, 412 insertions, 226 deletions
diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb
index 69b520df1..a95aabf1d 100644
--- a/app/controllers/accounts_controller.rb
+++ b/app/controllers/accounts_controller.rb
@@ -16,7 +16,9 @@ class AccountsController < ApplicationController
         render xml: AtomSerializer.render(AtomSerializer.new.feed(@account, @entries.to_a))
       end
 
-      format.activitystreams2
+      format.json do
+        render json: @account, serializer: ActivityPub::ActorSerializer, adapter: ActivityPub::Adapter
+      end
     end
   end
 
diff --git a/app/controllers/activitypub/outboxes_controller.rb b/app/controllers/activitypub/outboxes_controller.rb
new file mode 100644
index 000000000..6a58ccf24
--- /dev/null
+++ b/app/controllers/activitypub/outboxes_controller.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+class ActivityPub::OutboxesController < Api::BaseController
+  before_action :set_account
+
+  def show
+    @statuses = @account.statuses.permitted_for(@account, current_account).paginate_by_max_id(20, params[:max_id], params[:since_id])
+    @statuses = cache_collection(@statuses, Status)
+
+    render json: outbox_presenter, serializer: ActivityPub::CollectionSerializer, adapter: ActivityPub::Adapter
+  end
+
+  private
+
+  def set_account
+    @account = Account.find_local!(params[:account_username])
+  end
+
+  def outbox_presenter
+    ActivityPub::CollectionPresenter.new(
+      id: account_outbox_url(@account),
+      type: :ordered,
+      current: account_outbox_url(@account),
+      size: @account.statuses_count,
+      items: @statuses
+    )
+  end
+end
diff --git a/app/controllers/api/activitypub/activities_controller.rb b/app/controllers/api/activitypub/activities_controller.rb
deleted file mode 100644
index a880ee92f..000000000
--- a/app/controllers/api/activitypub/activities_controller.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-# frozen_string_literal: true
-
-class Api::ActivityPub::ActivitiesController < Api::BaseController
-  include Authorization
-
-  # before_action :set_follow, only: [:show_follow]
-  before_action :set_status, only: [:show_status]
-
-  respond_to :activitystreams2
-
-  # Show a status in AS2 format, as either an Announce (reblog) or a Create (post) activity.
-  def show_status
-    authorize @status, :show?
-
-    if @status.reblog?
-      render :show_status_announce
-    else
-      render :show_status_create
-    end
-  end
-
-  private
-
-  def set_status
-    @status = Status.find(params[:id])
-  end
-end
diff --git a/app/controllers/api/activitypub/notes_controller.rb b/app/controllers/api/activitypub/notes_controller.rb
deleted file mode 100644
index 96652b879..000000000
--- a/app/controllers/api/activitypub/notes_controller.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class Api::ActivityPub::NotesController < Api::BaseController
-  include Authorization
-
-  before_action :set_status
-
-  respond_to :activitystreams2
-
-  def show
-    authorize @status, :show?
-  end
-
-  private
-
-  def set_status
-    @status = Status.find(params[:id])
-  end
-end
diff --git a/app/controllers/api/activitypub/outbox_controller.rb b/app/controllers/api/activitypub/outbox_controller.rb
deleted file mode 100644
index 1af04cb54..000000000
--- a/app/controllers/api/activitypub/outbox_controller.rb
+++ /dev/null
@@ -1,69 +0,0 @@
-# frozen_string_literal: true
-
-class Api::ActivityPub::OutboxController < Api::BaseController
-  before_action :set_account
-
-  respond_to :activitystreams2
-
-  def show
-    if params[:max_id] || params[:since_id]
-      show_outbox_page
-    else
-      show_base_outbox
-    end
-  end
-
-  private
-
-  def show_base_outbox
-    @statuses = Status.as_outbox_timeline(@account)
-    @statuses = cache_collection(@statuses)
-
-    set_maps(@statuses)
-
-    set_first_last_page(@statuses)
-
-    render :show
-  end
-
-  def show_outbox_page
-    all_statuses = Status.as_outbox_timeline(@account)
-    @statuses = all_statuses.paginate_by_max_id(limit_param(DEFAULT_STATUSES_LIMIT), params[:max_id], params[:since_id])
-
-    all_statuses = cache_collection(all_statuses)
-    @statuses = cache_collection(@statuses)
-
-    set_maps(@statuses)
-
-    set_first_last_page(all_statuses)
-
-    @next_page_url = api_activitypub_outbox_url(pagination_params(max_id: @statuses.last.id))    unless @statuses.empty?
-    @prev_page_url = api_activitypub_outbox_url(pagination_params(since_id: @statuses.first.id)) unless @statuses.empty?
-
-    @paginated = @next_page_url || @prev_page_url
-    @part_of_url = api_activitypub_outbox_url
-
-    set_pagination_headers(@next_page_url, @prev_page_url)
-
-    render :show_page
-  end
-
-  def cache_collection(raw)
-    super(raw, Status)
-  end
-
-  def set_account
-    @account = Account.find(params[:id])
-  end
-
-  def set_first_last_page(statuses) # rubocop:disable Style/AccessorMethodName
-    return if statuses.empty?
-
-    @first_page_url = api_activitypub_outbox_url(max_id: statuses.first.id + 1)
-    @last_page_url = api_activitypub_outbox_url(since_id: statuses.last.id - 1)
-  end
-
-  def pagination_params(core_params)
-    params.permit(:local, :limit).merge(core_params)
-  end
-end
diff --git a/app/controllers/follower_accounts_controller.rb b/app/controllers/follower_accounts_controller.rb
index 1e7c7c406..e58c5ad46 100644
--- a/app/controllers/follower_accounts_controller.rb
+++ b/app/controllers/follower_accounts_controller.rb
@@ -5,5 +5,25 @@ class FollowerAccountsController < ApplicationController
 
   def index
     @follows = Follow.where(target_account: @account).recent.page(params[:page]).per(FOLLOW_PER_PAGE).preload(:account)
+
+    respond_to do |format|
+      format.html
+
+      format.json do
+        render json: collection_presenter, serializer: ActivityPub::CollectionSerializer, adapter: ActivityPub::Adapter
+      end
+    end
+  end
+
+  private
+
+  def collection_presenter
+    ActivityPub::CollectionPresenter.new(
+      id: account_followers_url(@account),
+      type: :ordered,
+      current: account_followers_url(@account),
+      size: @account.followers_count,
+      items: @follows.map { |f| ActivityPub::TagManager.instance.uri_for(f.account) }
+    )
   end
 end
diff --git a/app/controllers/following_accounts_controller.rb b/app/controllers/following_accounts_controller.rb
index f4488eef5..69f29cd70 100644
--- a/app/controllers/following_accounts_controller.rb
+++ b/app/controllers/following_accounts_controller.rb
@@ -5,5 +5,25 @@ class FollowingAccountsController < ApplicationController
 
   def index
     @follows = Follow.where(account: @account).recent.page(params[:page]).per(FOLLOW_PER_PAGE).preload(:target_account)
+
+    respond_to do |format|
+      format.html
+
+      format.json do
+        render json: collection_presenter, serializer: ActivityPub::CollectionSerializer, adapter: ActivityPub::Adapter
+      end
+    end
+  end
+
+  private
+
+  def collection_presenter
+    ActivityPub::CollectionPresenter.new(
+      id: account_following_index_url(@account),
+      type: :ordered,
+      current: account_following_index_url(@account),
+      size: @account.following_count,
+      items: @follows.map { |f| ActivityPub::TagManager.instance.uri_for(f.target_account) }
+    )
   end
 end
diff --git a/app/controllers/statuses_controller.rb b/app/controllers/statuses_controller.rb
index 59c9d0a87..8e0ce0ec3 100644
--- a/app/controllers/statuses_controller.rb
+++ b/app/controllers/statuses_controller.rb
@@ -11,10 +11,22 @@ class StatusesController < ApplicationController
   before_action :check_account_suspension
 
   def show
-    @ancestors   = @status.reply? ? cache_collection(@status.ancestors(current_account), Status) : []
-    @descendants = cache_collection(@status.descendants(current_account), Status)
+    respond_to do |format|
+      format.html do
+        @ancestors   = @status.reply? ? cache_collection(@status.ancestors(current_account), Status) : []
+        @descendants = cache_collection(@status.descendants(current_account), Status)
+
+        render 'stream_entries/show'
+      end
+
+      format.json do
+        render json: @status, serializer: ActivityPub::NoteSerializer, adapter: ActivityPub::Adapter
+      end
+    end
+  end
 
-    render 'stream_entries/show'
+  def activity
+    render json: @status, serializer: ActivityPub::ActivitySerializer, adapter: ActivityPub::Adapter
   end
 
   private
diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb
index 53149edf0..8bcce9e13 100644
--- a/app/controllers/tags_controller.rb
+++ b/app/controllers/tags_controller.rb
@@ -5,7 +5,27 @@ class TagsController < ApplicationController
 
   def show
     @tag      = Tag.find_by!(name: params[:id].downcase)
-    @statuses = @tag.nil? ? [] : Status.as_tag_timeline(@tag, current_account, params[:local]).paginate_by_max_id(20, params[:max_id])
+    @statuses = Status.as_tag_timeline(@tag, current_account, params[:local]).paginate_by_max_id(20, params[:max_id])
     @statuses = cache_collection(@statuses, Status)
+
+    respond_to do |format|
+      format.html
+
+      format.json do
+        render json: collection_presenter, serializer: ActivityPub::CollectionSerializer, adapter: ActivityPub::Adapter
+      end
+    end
+  end
+
+  private
+
+  def collection_presenter
+    ActivityPub::CollectionPresenter.new(
+      id: tag_url(@tag),
+      type: :ordered,
+      current: tag_url(@tag),
+      size: @tag.statuses.count,
+      items: @statuses.map { |s| ActivityPub::TagManager.instance.uri_for(s) }
+    )
   end
 end
diff --git a/app/helpers/activitystreams2_builder_helper.rb b/app/helpers/activitystreams2_builder_helper.rb
deleted file mode 100644
index 717b470f0..000000000
--- a/app/helpers/activitystreams2_builder_helper.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-# frozen_string_literal: true
-
-module Activitystreams2BuilderHelper
-  # Gets a usable name for an account, using display name or username.
-  def account_name(account)
-    account.display_name.presence || account.username
-  end
-end
diff --git a/app/lib/activitypub/adapter.rb b/app/lib/activitypub/adapter.rb
new file mode 100644
index 000000000..0a70207bc
--- /dev/null
+++ b/app/lib/activitypub/adapter.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class ActivityPub::Adapter < ActiveModelSerializers::Adapter::Base
+  def self.default_key_transform
+    :camel_lower
+  end
+
+  def serializable_hash(options = nil)
+    options = serialization_options(options)
+    serialized_hash = { '@context': 'https://www.w3.org/ns/activitystreams' }.merge(ActiveModelSerializers::Adapter::Attributes.new(serializer, instance_options).serializable_hash(options))
+    self.class.transform_key_casing!(serialized_hash, instance_options)
+  end
+end
diff --git a/app/lib/activitypub/tag_manager.rb b/app/lib/activitypub/tag_manager.rb
new file mode 100644
index 000000000..ec42bcad3
--- /dev/null
+++ b/app/lib/activitypub/tag_manager.rb
@@ -0,0 +1,69 @@
+# frozen_string_literal: true
+
+require 'singleton'
+
+class ActivityPub::TagManager
+  include Singleton
+  include RoutingHelper
+
+  COLLECTIONS = {
+    public: 'https://www.w3.org/ns/activitystreams#Public',
+  }.freeze
+
+  def url_for(target)
+    return target.url if target.respond_to?(:local?) && !target.local?
+
+    case target.object_type
+    when :person
+      short_account_url(target)
+    when :note, :comment, :activity
+      short_account_status_url(target.account, target)
+    end
+  end
+
+  def uri_for(target)
+    return target.uri if target.respond_to?(:local?) && !target.local?
+
+    case target.object_type
+    when :person
+      account_url(target)
+    when :note, :comment, :activity
+      account_status_url(target.account, target)
+    end
+  end
+
+  # Primary audience of a status
+  # Public statuses go out to primarily the public collection
+  # Unlisted and private statuses go out primarily to the followers collection
+  # Others go out only to the people they mention
+  def to(status)
+    case status.visibility
+    when 'public'
+      [COLLECTIONS[:public]]
+    when 'unlisted', 'private'
+      [account_followers_url(status.account)]
+    when 'direct'
+      status.mentions.map { |mention| uri_for(mention.account) }
+    end
+  end
+
+  # Secondary audience of a status
+  # Public statuses go out to followers as well
+  # Unlisted statuses go to the public as well
+  # Both of those and private statuses also go to the people mentioned in them
+  # Direct ones don't have a secondary audience
+  def cc(status)
+    cc = []
+
+    case status.visibility
+    when 'public'
+      cc << account_followers_url(status.account)
+    when 'unlisted'
+      cc << COLLECTIONS[:public]
+    end
+
+    cc.concat(status.mentions.map { |mention| uri_for(mention.account) }) unless status.direct_visibility?
+
+    cc
+  end
+end
diff --git a/app/presenters/activitypub/collection_presenter.rb b/app/presenters/activitypub/collection_presenter.rb
new file mode 100644
index 000000000..6bae2955e
--- /dev/null
+++ b/app/presenters/activitypub/collection_presenter.rb
@@ -0,0 +1,5 @@
+# frozen_string_literal: true
+
+class ActivityPub::CollectionPresenter < ActiveModelSerializers::Model
+  attributes :id, :type, :current, :size, :items
+end
diff --git a/app/serializers/activitypub/activity_serializer.rb b/app/serializers/activitypub/activity_serializer.rb
new file mode 100644
index 000000000..69e2160c5
--- /dev/null
+++ b/app/serializers/activitypub/activity_serializer.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+class ActivityPub::ActivitySerializer < ActiveModel::Serializer
+  attributes :id, :type, :actor, :to, :cc
+
+  has_one :proper, key: :object, serializer: ActivityPub::NoteSerializer
+
+  def id
+    [ActivityPub::TagManager.instance.uri_for(object), '/activity'].join
+  end
+
+  def type
+    object.reblog? ? 'Announce' : 'Create'
+  end
+
+  def actor
+    ActivityPub::TagManager.instance.uri_for(object.account)
+  end
+
+  def to
+    ActivityPub::TagManager.instance.to(object)
+  end
+
+  def cc
+    ActivityPub::TagManager.instance.cc(object)
+  end
+end
diff --git a/app/serializers/activitypub/actor_serializer.rb b/app/serializers/activitypub/actor_serializer.rb
new file mode 100644
index 000000000..56806152e
--- /dev/null
+++ b/app/serializers/activitypub/actor_serializer.rb
@@ -0,0 +1,53 @@
+# frozen_string_literal: true
+
+class ActivityPub::ActorSerializer < ActiveModel::Serializer
+  include RoutingHelper
+
+  attributes :id, :type, :following, :followers,
+             :inbox, :outbox, :preferred_username,
+             :name, :summary, :icon, :image
+
+  def id
+    account_url(object)
+  end
+
+  def type
+    'Person'
+  end
+
+  def following
+    account_following_index_url(object)
+  end
+
+  def followers
+    account_followers_url(object)
+  end
+
+  def inbox
+    nil
+  end
+
+  def outbox
+    account_outbox_url(object)
+  end
+
+  def preferred_username
+    object.username
+  end
+
+  def name
+    object.display_name
+  end
+
+  def summary
+    Formatter.instance.simplified_format(object)
+  end
+
+  def icon
+    full_asset_url(object.avatar.url(:original))
+  end
+
+  def image
+    full_asset_url(object.header.url(:original))
+  end
+end
diff --git a/app/serializers/activitypub/collection_serializer.rb b/app/serializers/activitypub/collection_serializer.rb
new file mode 100644
index 000000000..baaba7654
--- /dev/null
+++ b/app/serializers/activitypub/collection_serializer.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class ActivityPub::CollectionSerializer < ActiveModel::Serializer
+  def self.serializer_for(model, options)
+    return ActivityPub::ActivitySerializer if model.class.name == 'Status'
+    super
+  end
+
+  attributes :id, :type, :total_items,
+             :current
+
+  has_many :items, key: :ordered_items
+
+  def type
+    case object.type
+    when :ordered
+      'OrderedCollection'
+    else
+      'Collection'
+    end
+  end
+
+  def total_items
+    object.size
+  end
+end
diff --git a/app/serializers/activitypub/note_serializer.rb b/app/serializers/activitypub/note_serializer.rb
new file mode 100644
index 000000000..ffdc6175d
--- /dev/null
+++ b/app/serializers/activitypub/note_serializer.rb
@@ -0,0 +1,106 @@
+# frozen_string_literal: true
+
+class ActivityPub::NoteSerializer < ActiveModel::Serializer
+  attributes :id, :type, :summary, :content,
+             :in_reply_to, :published, :url,
+             :actor, :to, :cc, :sensitive
+
+  has_many :media_attachments, key: :attachment
+  has_many :virtual_tags, key: :tag
+
+  def id
+    ActivityPub::TagManager.instance.uri_for(object)
+  end
+
+  def type
+    'Note'
+  end
+
+  def summary
+    object.spoiler_text.presence
+  end
+
+  def content
+    Formatter.instance.format(object)
+  end
+
+  def in_reply_to
+    ActivityPub::TagManager.instance.uri_for(object.thread) if object.reply?
+  end
+
+  def published
+    object.created_at.iso8601
+  end
+
+  def url
+    ActivityPub::TagManager.instance.url_for(object)
+  end
+
+  def actor
+    ActivityPub::TagManager.instance.uri_for(object.account)
+  end
+
+  def to
+    ActivityPub::TagManager.instance.to(object)
+  end
+
+  def cc
+    ActivityPub::TagManager.instance.cc(object)
+  end
+
+  def virtual_tags
+    object.mentions + object.tags
+  end
+
+  class MediaAttachmentSerializer < ActiveModel::Serializer
+    include RoutingHelper
+
+    attributes :type, :media_type, :url
+
+    def type
+      'Document'
+    end
+
+    def media_type
+      object.file_content_type
+    end
+
+    def url
+      object.local? ? full_asset_url(object.file.url(:original, false)) : object.remote_url
+    end
+  end
+
+  class MentionSerializer < ActiveModel::Serializer
+    attributes :type, :href, :name
+
+    def type
+      'Mention'
+    end
+
+    def href
+      ActivityPub::TagManager.instance.uri_for(object.account)
+    end
+
+    def name
+      "@#{object.account.acct}"
+    end
+  end
+
+  class TagSerializer < ActiveModel::Serializer
+    include RoutingHelper
+
+    attributes :type, :href, :name
+
+    def type
+      'Hashtag'
+    end
+
+    def href
+      tag_url(object)
+    end
+
+    def name
+      "##{object.name}"
+    end
+  end
+end
diff --git a/app/views/accounts/show.activitystreams2.rabl b/app/views/accounts/show.activitystreams2.rabl
deleted file mode 100644
index 2c0a4ad3a..000000000
--- a/app/views/accounts/show.activitystreams2.rabl
+++ /dev/null
@@ -1,9 +0,0 @@
-extends 'activitypub/types/person.activitystreams2.rabl'
-
-object @account
-
-attributes display_name: :name, username: :preferredUsername, note: :summary
-
-node(:icon)   { |account| full_asset_url(account.avatar.url(:original)) }
-node(:image)  { |account| full_asset_url(account.header.url(:original)) }
-node(:outbox) { |account| api_activitypub_outbox_url(account.id) }
diff --git a/app/views/activitypub/base.activitystreams2.rabl b/app/views/activitypub/base.activitystreams2.rabl
deleted file mode 100644
index c5e94997a..000000000
--- a/app/views/activitypub/base.activitystreams2.rabl
+++ /dev/null
@@ -1 +0,0 @@
-node(:'@context') { 'https://www.w3.org/ns/activitystreams' }
diff --git a/app/views/activitypub/intransient.activitystreams2.rabl b/app/views/activitypub/intransient.activitystreams2.rabl
deleted file mode 100644
index 968e451c2..000000000
--- a/app/views/activitypub/intransient.activitystreams2.rabl
+++ /dev/null
@@ -1,3 +0,0 @@
-extends 'activitypub/base.activitystreams2.rabl'
-
-node(:id) { request.original_url }
diff --git a/app/views/activitypub/types/announce.activitystreams2.rabl b/app/views/activitypub/types/announce.activitystreams2.rabl
deleted file mode 100644
index 4a29aa134..000000000
--- a/app/views/activitypub/types/announce.activitystreams2.rabl
+++ /dev/null
@@ -1,3 +0,0 @@
-extends 'activitypub/intransient.activitystreams2.rabl'
-
-node(:type) { 'Announce' }
diff --git a/app/views/activitypub/types/collection.activitystreams2.rabl b/app/views/activitypub/types/collection.activitystreams2.rabl
deleted file mode 100644
index cc0e532b7..000000000
--- a/app/views/activitypub/types/collection.activitystreams2.rabl
+++ /dev/null
@@ -1,3 +0,0 @@
-extends 'activitypub/intransient.activitystreams2.rabl'
-
-node(:type) { 'Collection' }
diff --git a/app/views/activitypub/types/create.activitystreams2.rabl b/app/views/activitypub/types/create.activitystreams2.rabl
deleted file mode 100644
index e41a056a7..000000000
--- a/app/views/activitypub/types/create.activitystreams2.rabl
+++ /dev/null
@@ -1,3 +0,0 @@
-extends 'activitypub/intransient.activitystreams2.rabl'
-
-node(:type) { 'Create' }
diff --git a/app/views/activitypub/types/note.activitystreams2.rabl b/app/views/activitypub/types/note.activitystreams2.rabl
deleted file mode 100644
index 39c74d4ba..000000000
--- a/app/views/activitypub/types/note.activitystreams2.rabl
+++ /dev/null
@@ -1,3 +0,0 @@
-extends 'activitypub/intransient.activitystreams2.rabl'
-
-node(:type) { 'Note' }
diff --git a/app/views/activitypub/types/ordered_collection.activitystreams2.rabl b/app/views/activitypub/types/ordered_collection.activitystreams2.rabl
deleted file mode 100644
index 2cda6f4d0..000000000
--- a/app/views/activitypub/types/ordered_collection.activitystreams2.rabl
+++ /dev/null
@@ -1,3 +0,0 @@
-extends 'activitypub/types/collection.activitystreams2.rabl'
-
-node(:type) { 'OrderedCollection' }
diff --git a/app/views/activitypub/types/ordered_collection_page.activitystreams2.rabl b/app/views/activitypub/types/ordered_collection_page.activitystreams2.rabl
deleted file mode 100644
index 9937d11e9..000000000
--- a/app/views/activitypub/types/ordered_collection_page.activitystreams2.rabl
+++ /dev/null
@@ -1,3 +0,0 @@
-extends 'activitypub/types/ordered_collection.activitystreams2.rabl'
-
-node(:type) { 'OrderedCollectionPage' }
diff --git a/app/views/activitypub/types/person.activitystreams2.rabl b/app/views/activitypub/types/person.activitystreams2.rabl
deleted file mode 100644
index 487a60791..000000000
--- a/app/views/activitypub/types/person.activitystreams2.rabl
+++ /dev/null
@@ -1,3 +0,0 @@
-extends 'activitypub/intransient.activitystreams2.rabl'
-
-node(:type) { 'Person' }
diff --git a/app/views/api/activitypub/activities/_show_status.activitystreams2.rabl b/app/views/api/activitypub/activities/_show_status.activitystreams2.rabl
deleted file mode 100644
index 472bf5dbd..000000000
--- a/app/views/api/activitypub/activities/_show_status.activitystreams2.rabl
+++ /dev/null
@@ -1,4 +0,0 @@
-object @status
-
-node(:actor)     { |status| TagManager.instance.url_for(status.account) }
-node(:published) { |status| status.created_at.to_time.xmlschema }
\ No newline at end of file
diff --git a/app/views/api/activitypub/activities/show_status_announce.activitystreams2.rabl b/app/views/api/activitypub/activities/show_status_announce.activitystreams2.rabl
deleted file mode 100644
index 44ac1ba2f..000000000
--- a/app/views/api/activitypub/activities/show_status_announce.activitystreams2.rabl
+++ /dev/null
@@ -1,8 +0,0 @@
-extends 'activitypub/types/announce.activitystreams2.rabl'
-extends 'api/activitypub/activities/_show_status.activitystreams2.rabl'
-
-object @status
-
-node(:name)   { |status| t('activitypub.activity.announce.name', account_name: account_name(status.account)) }
-node(:url)    { |status| TagManager.instance.url_for(status) }
-node(:object) { |status| api_activitypub_status_url(status.reblog_of_id) }
diff --git a/app/views/api/activitypub/activities/show_status_create.activitystreams2.rabl b/app/views/api/activitypub/activities/show_status_create.activitystreams2.rabl
deleted file mode 100644
index ff4d39eca..000000000
--- a/app/views/api/activitypub/activities/show_status_create.activitystreams2.rabl
+++ /dev/null
@@ -1,8 +0,0 @@
-extends 'activitypub/types/create.activitystreams2.rabl'
-extends 'api/activitypub/activities/_show_status.activitystreams2.rabl'
-
-object @status
-
-node(:name)   { |status| t('activitypub.activity.create.name', account_name: account_name(status.account)) }
-node(:url)    { |status| TagManager.instance.url_for(status) }
-node(:object) { |status| api_activitypub_note_url(status) }
diff --git a/app/views/api/activitypub/notes/show.activitystreams2.rabl b/app/views/api/activitypub/notes/show.activitystreams2.rabl
deleted file mode 100644
index d962f4438..000000000
--- a/app/views/api/activitypub/notes/show.activitystreams2.rabl
+++ /dev/null
@@ -1,11 +0,0 @@
-extends 'activitypub/types/note.activitystreams2.rabl'
-
-object @status
-
-attributes :content
-
-node(:name)         { |status| status.content }
-node(:url)          { |status| TagManager.instance.url_for(status) }
-node(:attributedTo) { |status| TagManager.instance.url_for(status.account) }
-node(:inReplyTo)    { |status| api_activitypub_note_url(status.thread) } if @status.thread
-node(:published)    { |status| status.created_at.to_time.xmlschema }
diff --git a/app/views/api/activitypub/outbox/show.activitystreams2.rabl b/app/views/api/activitypub/outbox/show.activitystreams2.rabl
deleted file mode 100644
index 273b15e82..000000000
--- a/app/views/api/activitypub/outbox/show.activitystreams2.rabl
+++ /dev/null
@@ -1,12 +0,0 @@
-extends 'activitypub/types/ordered_collection.activitystreams2.rabl'
-
-object @account
-
-node(:totalItems) { @statuses.count }
-node(:current)    { @first_page_url } if @first_page_url
-node(:first)      { @first_page_url } if @first_page_url
-node(:last)       { @last_page_url } if @last_page_url
-
-node(:name)       { |account| t('activitypub.outbox.name', account_name: account_name(account)) }
-node(:summary)    { |account| t('activitypub.outbox.summary', account_name: account_name(account)) }
-node(:updated)    { |account| (@statuses.empty? ? account.created_at.to_time : @statuses.first.updated_at.to_time).xmlschema }
diff --git a/app/views/api/activitypub/outbox/show_page.activitystreams2.rabl b/app/views/api/activitypub/outbox/show_page.activitystreams2.rabl
deleted file mode 100644
index b6433ccf2..000000000
--- a/app/views/api/activitypub/outbox/show_page.activitystreams2.rabl
+++ /dev/null
@@ -1,16 +0,0 @@
-extends 'activitypub/types/ordered_collection_page.activitystreams2.rabl'
-
-object @account
-
-node(:items) do
-  @statuses.map { |status| api_activitypub_status_url(status) }
-end
-
-node(:next)       { @next_page_url } if @next_page_url
-node(:prev)       { @prev_page_url } if @prev_page_url
-node(:current)    { @first_page_url } if @first_page_url
-node(:first)      { @first_page_url } if @first_page_url
-node(:last)       { @last_page_url } if @last_page_url
-node(:partOf)     { @part_of_url } if @part_of_url
-
-node(:updated)    { |account| (@statuses.empty? ? account.created_at.to_time : @statuses.first.updated_at.to_time).xmlschema }
diff --git a/app/views/well_known/webfinger/show.json.rabl b/app/views/well_known/webfinger/show.json.rabl
index 123d1d11a..af11cd207 100644
--- a/app/views/well_known/webfinger/show.json.rabl
+++ b/app/views/well_known/webfinger/show.json.rabl
@@ -3,14 +3,14 @@ object @account
 node(:subject) { @canonical_account_uri }
 
 node(:aliases) do
-  [TagManager.instance.url_for(@account), TagManager.instance.uri_for(@account)]
+  [short_account_url(@account), account_url(@account)]
 end
 
 node(:links) do
   [
-    { rel: 'http://webfinger.net/rel/profile-page', type: 'text/html', href: TagManager.instance.url_for(@account) },
+    { rel: 'http://webfinger.net/rel/profile-page', type: 'text/html', href: account_url(@account) },
     { rel: 'http://schemas.google.com/g/2010#updates-from', type: 'application/atom+xml', href: account_url(@account, format: 'atom') },
-    { rel: 'self', type: 'application/activity+json', href: TagManager.instance.url_for(@account) },
+    { rel: 'self', type: 'application/activity+json', href: account_url(@account) },
     { rel: 'salmon', href: api_salmon_url(@account.id) },
     { rel: 'magic-public-key', href: "data:application/magic-public-key,#{@magic_key}" },
     { rel: 'http://ostatus.org/schema/1.0/subscribe', template: "#{authorize_follow_url}?acct={uri}" },
diff --git a/app/views/well_known/webfinger/show.xml.ruby b/app/views/well_known/webfinger/show.xml.ruby
index fc0ab5b84..844742d68 100644
--- a/app/views/well_known/webfinger/show.xml.ruby
+++ b/app/views/well_known/webfinger/show.xml.ruby
@@ -1,10 +1,11 @@
 Nokogiri::XML::Builder.new do |xml|
   xml.XRD(xmlns: 'http://docs.oasis-open.org/ns/xri/xrd-1.0') do
     xml.Subject @canonical_account_uri
-    xml.Alias TagManager.instance.url_for(@account)
-    xml.Alias TagManager.instance.uri_for(@account)
+    xml.Alias short_account_url(@account)
+    xml.Alias account_url(@account)
     xml.Link(rel: 'http://webfinger.net/rel/profile-page', type: 'text/html', href: TagManager.instance.url_for(@account))
     xml.Link(rel: 'http://schemas.google.com/g/2010#updates-from', type: 'application/atom+xml', href: account_url(@account, format: 'atom'))
+    xml.Link(rel: 'self', type: 'application/activity+json', href: account_url(@account))
     xml.Link(rel: 'salmon', href: api_salmon_url(@account.id))
     xml.Link(rel: 'magic-public-key', href: "data:application/magic-public-key,#{@magic_key}")
     xml.Link(rel: 'http://ostatus.org/schema/1.0/subscribe', template: "#{authorize_follow_url}?acct={uri}")