Improve ActivityPub representations (#3844)
* Improve webfinger templates and make tests more flexible * Clean up AS2 representation of actor * Refactor outbox * Create activities representation * Add representations of followers/following collections, do not redirect /users/:username route if format is empty * Remove unused translations * ActivityPub endpoint for single statuses, add ActivityPub::TagManager for better URL/URI generation * Add ActivityPub::TagManager#to * Represent all attachments as Document instead of Image/Video specifically (Because for remote ones we may not know for sure) Add mentions and hashtags representation to AP notes * Add AP-resolvable hashtag URIs * Use ActiveModelSerializers for ActivityPub * Clean up unused translations * Separate route for object and activity * Adjust cc/to matrices * Add to/cc to activities, ensure announce activity embeds target status and not the wrapper status, add "id" to all collections
This commit is contained in:
parent
3fbf1bf35a
commit
8c45cd0e36
61 changed files with 443 additions and 725 deletions
|
@ -14,4 +14,6 @@ ActiveSupport::Inflector.inflections(:en) do |inflect|
|
|||
inflect.acronym 'StatsD'
|
||||
inflect.acronym 'OEmbed'
|
||||
inflect.acronym 'ActivityPub'
|
||||
inflect.acronym 'PubSubHubbub'
|
||||
inflect.acronym 'ActivityStreams'
|
||||
end
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
Mime::Type.register "application/json", :json, %w( text/x-json application/jsonrequest application/jrd+json )
|
||||
Mime::Type.register "text/xml", :xml, %w( application/xml application/atom+xml application/xrd+xml )
|
||||
Mime::Type.register "application/activity+json", :activitystreams2
|
||||
Mime::Type.register 'application/json', :json, %w(text/x-json application/jsonrequest application/jrd+json application/activity+json)
|
||||
Mime::Type.register 'text/xml', :xml, %w(application/xml application/atom+xml application/xrd+xml)
|
||||
|
|
|
@ -30,15 +30,6 @@ ca:
|
|||
remote_follow: Seguir
|
||||
reserved_username: El nom d'usuari està reservat
|
||||
unfollow: Deixar de seguir
|
||||
activitypub:
|
||||
activity:
|
||||
announce:
|
||||
name: "%{account_name} shared an activity."
|
||||
create:
|
||||
name: "%{account_name} created a note."
|
||||
outbox:
|
||||
name: "%{account_name}'s Outbox"
|
||||
summary: A collection of activities from user %{account_name}.
|
||||
admin:
|
||||
accounts:
|
||||
are_you_sure: Estàs segur?
|
||||
|
|
|
@ -44,15 +44,6 @@ en:
|
|||
remote_follow: Remote follow
|
||||
reserved_username: The username is reserved
|
||||
unfollow: Unfollow
|
||||
activitypub:
|
||||
activity:
|
||||
announce:
|
||||
name: "%{account_name} shared an activity."
|
||||
create:
|
||||
name: "%{account_name} created a note."
|
||||
outbox:
|
||||
name: "%{account_name}'s Outbox"
|
||||
summary: A collection of activities from user %{account_name}.
|
||||
admin:
|
||||
accounts:
|
||||
are_you_sure: Are you sure?
|
||||
|
|
|
@ -29,15 +29,6 @@ fa:
|
|||
posts: نوشته
|
||||
remote_follow: پیگیری غیرمستقیم
|
||||
unfollow: پایان پیگیری
|
||||
activitypub:
|
||||
activity:
|
||||
announce:
|
||||
name: "%{account_name} فعالیتی آغاز کرد."
|
||||
create:
|
||||
name: "%{account_name} یادداشتی نوشت."
|
||||
outbox:
|
||||
name: صندوق خروجی %{account_name}
|
||||
summary: مجموعهای از فعالیتهای کاربر %{account_name}.
|
||||
admin:
|
||||
accounts:
|
||||
are_you_sure: آیا مطمئن هستید؟
|
||||
|
|
|
@ -30,15 +30,6 @@ fr:
|
|||
remote_follow: Suivre à distance
|
||||
reserved_username: Ce nom d’utilisateur⋅ice est réservé
|
||||
unfollow: Ne plus suivre
|
||||
activitypub:
|
||||
activity:
|
||||
announce:
|
||||
name: "%{account_name} a partagé une activité."
|
||||
create:
|
||||
name: "%{account_name} a créé une note."
|
||||
outbox:
|
||||
name: Boîte d’envoi de %{account_name}
|
||||
summary: Liste d’activités de %{account_name}
|
||||
admin:
|
||||
accounts:
|
||||
are_you_sure: Êtes-vous certain⋅e ?
|
||||
|
|
|
@ -29,15 +29,6 @@ he:
|
|||
posts: הודעות
|
||||
remote_follow: מעקב מרחוק
|
||||
unfollow: הפסקת מעקב
|
||||
activitypub:
|
||||
activity:
|
||||
announce:
|
||||
name: הודעה שותפה על ידי %{account_name}.
|
||||
create:
|
||||
name: הודעה חדשה מאת %{account_name}.
|
||||
outbox:
|
||||
name: תיבת הדוא"ל היוצא של %{account_name}
|
||||
summary: אוסף הפעילויות של %{account_name}.
|
||||
admin:
|
||||
accounts:
|
||||
are_you_sure: בטוח?
|
||||
|
|
|
@ -29,15 +29,6 @@ id:
|
|||
posts: Postingan
|
||||
remote_follow: Mengikuti
|
||||
unfollow: Berhenti mengikuti
|
||||
activitypub:
|
||||
activity:
|
||||
announce:
|
||||
name: "%{account_name} membagikan aktivitas."
|
||||
create:
|
||||
name: "%{account_name} membuat catatan."
|
||||
outbox:
|
||||
name: "%{account_name} Outbox"
|
||||
summary: Koleksi aktivitas dari pengguna %{account_name}.
|
||||
admin:
|
||||
accounts:
|
||||
are_you_sure: Anda yakin?
|
||||
|
|
|
@ -30,15 +30,6 @@ ja:
|
|||
remote_follow: リモートフォロー
|
||||
reserved_username: このユーザー名は予約されています。
|
||||
unfollow: フォロー解除
|
||||
activitypub:
|
||||
activity:
|
||||
announce:
|
||||
name: "%{account_name} さんがアクティビティをシェアしました"
|
||||
create:
|
||||
name: "%{account_name} さんがノートを作成しました"
|
||||
outbox:
|
||||
name: "%{account_name} さんの送信トレイ"
|
||||
summary: "%{account_name} さんからのアクティビティコレクション"
|
||||
admin:
|
||||
accounts:
|
||||
are_you_sure: 本当に実行しますか?
|
||||
|
|
|
@ -30,15 +30,6 @@ ko:
|
|||
remote_follow: 리모트 팔로우
|
||||
reserved_username: 이 아이디는 예약되어 있습니다.
|
||||
unfollow: 팔로우 해제
|
||||
activitypub:
|
||||
activity:
|
||||
announce:
|
||||
name: "%{account_name} 님이 액티비티를 공유했습니다"
|
||||
create:
|
||||
name: "%{account_name} 님이 노트를 작성했습니다"
|
||||
outbox:
|
||||
name: "%{account_name} 님의 송신함"
|
||||
summary: "%{account_name} 님의 액티비티 모음"
|
||||
admin:
|
||||
accounts:
|
||||
are_you_sure: 정말로 실행하시겠습니까?
|
||||
|
|
|
@ -29,15 +29,6 @@
|
|||
posts: Poster
|
||||
remote_follow: Følg fra andre instanser
|
||||
unfollow: Avfølg
|
||||
activitypub:
|
||||
activity:
|
||||
announce:
|
||||
name: "%{account_name} delte en aktivitet."
|
||||
create:
|
||||
name: "%{account_name} laget en aktivitet."
|
||||
outbox:
|
||||
name: "%{account_name} sin utboks"
|
||||
summary: En samling aktiviteter fra brukeren %{account_name}.
|
||||
admin:
|
||||
accounts:
|
||||
are_you_sure: Er du sikker?
|
||||
|
|
|
@ -29,15 +29,6 @@ oc:
|
|||
posts: Estatuts
|
||||
remote_follow: Sègre a distància
|
||||
unfollow: Quitar de sègre
|
||||
activitypub:
|
||||
activity:
|
||||
announce:
|
||||
name: "%{account_name} a partejat una activitat."
|
||||
create:
|
||||
name: "%{account_name} a creat una nòta."
|
||||
outbox:
|
||||
name: "%{account_name}'s Outbox"
|
||||
summary: A collection of activities from user %{account_name}.
|
||||
admin:
|
||||
accounts:
|
||||
are_you_sure: Sètz segur ?
|
||||
|
|
|
@ -44,15 +44,6 @@ pl:
|
|||
remote_follow: Zdalne śledzenie
|
||||
reserved_username: Ta nazwa użytkownika jest zarezerwowana.
|
||||
unfollow: Przestań śledzić
|
||||
activitypub:
|
||||
activity:
|
||||
announce:
|
||||
name: "%{account_name} udostępnił(a) aktywność."
|
||||
create:
|
||||
name: "%{account_name} utworzył(a) wpis."
|
||||
outbox:
|
||||
name: Skrzynka %{account_name}
|
||||
summary: Zbiór aktywności użytkownika %{account_name}.
|
||||
admin:
|
||||
accounts:
|
||||
are_you_sure: Jesteś tego pewien?
|
||||
|
|
|
@ -29,15 +29,6 @@ pt-BR:
|
|||
posts: Posts
|
||||
remote_follow: Acesso remoto
|
||||
unfollow: Unfollow
|
||||
activitypub:
|
||||
activity:
|
||||
announce:
|
||||
name: "%{account_name} compartilhou uma atividade."
|
||||
create:
|
||||
name: "%{account_name} criou uma nota."
|
||||
outbox:
|
||||
name: "%{account_name}'s Outbox"
|
||||
summary: Uma coleção de atividades do usuário %{account_name}.
|
||||
admin:
|
||||
accounts:
|
||||
are_you_sure: Você tem certeza?
|
||||
|
|
|
@ -29,15 +29,6 @@ pt:
|
|||
posts: Posts
|
||||
remote_follow: Seguir remotamente
|
||||
unfollow: Deixar de seguir
|
||||
activitypub:
|
||||
activity:
|
||||
announce:
|
||||
name: "%{account_name} anunciou uma atividade."
|
||||
create:
|
||||
name: "%{account_name} criou uma nota."
|
||||
outbox:
|
||||
name: "%{account_name}'s Outbox"
|
||||
summary: Uma coleção de atividades do usuário %{account_name}.
|
||||
admin:
|
||||
accounts:
|
||||
are_you_sure: Tens a certeza?
|
||||
|
|
|
@ -29,15 +29,6 @@ th:
|
|||
posts: โพสต์
|
||||
remote_follow: Remote follow
|
||||
unfollow: เลิกติดตาม
|
||||
activitypub:
|
||||
activity:
|
||||
announce:
|
||||
name: "%{account_name} แชร์กิจกรรม."
|
||||
create:
|
||||
name: "%{account_name} สร้างโน๊ต."
|
||||
outbox:
|
||||
name: "%{account_name}'s Outbox"
|
||||
summary: รวมกิจกรรมของผู้ใช้ %{account_name}.
|
||||
admin:
|
||||
accounts:
|
||||
are_you_sure: แน่ใจนะ?
|
||||
|
|
|
@ -29,15 +29,6 @@ tr:
|
|||
posts: Gönderiler
|
||||
remote_follow: Uzaktan takip et
|
||||
unfollow: Takibi bırak
|
||||
activitypub:
|
||||
activity:
|
||||
announce:
|
||||
name: "%{account_name} bir aktivite paylaştı."
|
||||
create:
|
||||
name: "%{account_name} bir not oluşturdu."
|
||||
outbox:
|
||||
name: "%{account_name}'in Gönderdikleri"
|
||||
summary: "%{account_name}'den gelen aktiviteler."
|
||||
admin:
|
||||
accounts:
|
||||
are_you_sure: Emin misiniz?
|
||||
|
|
|
@ -29,15 +29,6 @@ zh-CN:
|
|||
posts: 嘟文
|
||||
remote_follow: 跨站关注
|
||||
unfollow: 取消关注
|
||||
activitypub:
|
||||
activity:
|
||||
announce:
|
||||
name: "%{account_name} 分享了一个活动。"
|
||||
create:
|
||||
name: "%{account_name} 创建了一个记事。"
|
||||
outbox:
|
||||
name: "%{account_name} 的集合"
|
||||
summary: "%{account_name} 的活动集合"
|
||||
admin:
|
||||
accounts:
|
||||
are_you_sure: 你确定吗?
|
||||
|
|
|
@ -29,15 +29,6 @@ zh-HK:
|
|||
posts: 文章
|
||||
remote_follow: 跨站關注
|
||||
unfollow: 取消關注
|
||||
activitypub:
|
||||
activity:
|
||||
announce:
|
||||
name: "%{account_name} 分享了一項活動。"
|
||||
create:
|
||||
name: "%{account_name} 新增了一篇筆記。"
|
||||
outbox:
|
||||
name: "%{account_name} 的活動"
|
||||
summary: "%{account_name} 分享的活動列表。"
|
||||
admin:
|
||||
accounts:
|
||||
are_you_sure: 你確定嗎?
|
||||
|
|
|
@ -26,7 +26,7 @@ Rails.application.routes.draw do
|
|||
confirmations: 'auth/confirmations',
|
||||
}
|
||||
|
||||
get '/users/:username', to: redirect('/@%{username}'), constraints: { format: :html }
|
||||
get '/users/:username', to: redirect('/@%{username}'), constraints: lambda { |req| req.format.nil? }
|
||||
|
||||
resources :accounts, path: 'users', only: [:show], param: :username do
|
||||
resources :stream_entries, path: 'updates', only: [:show] do
|
||||
|
@ -38,10 +38,17 @@ Rails.application.routes.draw do
|
|||
get :remote_follow, to: 'remote_follow#new'
|
||||
post :remote_follow, to: 'remote_follow#create'
|
||||
|
||||
resources :statuses, only: [:show] do
|
||||
member do
|
||||
get :activity
|
||||
end
|
||||
end
|
||||
|
||||
resources :followers, only: [:index], controller: :follower_accounts
|
||||
resources :following, only: [:index], controller: :following_accounts
|
||||
resource :follow, only: [:create], controller: :account_follow
|
||||
resource :unfollow, only: [:create], controller: :account_unfollow
|
||||
resource :outbox, only: [:show], module: :activitypub
|
||||
end
|
||||
|
||||
get '/@:username', to: 'accounts#show', as: :short_account
|
||||
|
@ -119,13 +126,6 @@ Rails.application.routes.draw do
|
|||
# OEmbed
|
||||
get '/oembed', to: 'oembed#show', as: :oembed
|
||||
|
||||
# ActivityPub
|
||||
namespace :activitypub do
|
||||
get '/users/:id/outbox', to: 'outbox#show', as: :outbox
|
||||
get '/statuses/:id', to: 'activities#show_status', as: :status
|
||||
resources :notes, only: [:show]
|
||||
end
|
||||
|
||||
# JSON / REST API
|
||||
namespace :v1 do
|
||||
resources :statuses, only: [:create, :show, :destroy] do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue