diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2017-07-15 03:01:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-15 03:01:39 +0200 |
commit | 8c45cd0e3683b528b65f416681c8272d5650f32d (patch) | |
tree | aee4a1e6d339446f7d9cc59fab61547353b89e56 /config | |
parent | 3fbf1bf35acf89d1e397fa2e632529bf5105fe02 (diff) |
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
Diffstat (limited to 'config')
-rw-r--r-- | config/initializers/inflections.rb | 2 | ||||
-rw-r--r-- | config/initializers/mime_types.rb | 5 | ||||
-rw-r--r-- | config/locales/ca.yml | 9 | ||||
-rw-r--r-- | config/locales/en.yml | 9 | ||||
-rw-r--r-- | config/locales/fa.yml | 9 | ||||
-rw-r--r-- | config/locales/fr.yml | 9 | ||||
-rw-r--r-- | config/locales/he.yml | 9 | ||||
-rw-r--r-- | config/locales/id.yml | 9 | ||||
-rw-r--r-- | config/locales/ja.yml | 9 | ||||
-rw-r--r-- | config/locales/ko.yml | 9 | ||||
-rw-r--r-- | config/locales/no.yml | 9 | ||||
-rw-r--r-- | config/locales/oc.yml | 9 | ||||
-rw-r--r-- | config/locales/pl.yml | 9 | ||||
-rw-r--r-- | config/locales/pt-BR.yml | 9 | ||||
-rw-r--r-- | config/locales/pt.yml | 9 | ||||
-rw-r--r-- | config/locales/th.yml | 9 | ||||
-rw-r--r-- | config/locales/tr.yml | 9 | ||||
-rw-r--r-- | config/locales/zh-CN.yml | 9 | ||||
-rw-r--r-- | config/locales/zh-HK.yml | 9 | ||||
-rw-r--r-- | config/routes.rb | 16 |
20 files changed, 12 insertions, 164 deletions
diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index a7b1ef690..26275d092 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -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 diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb index b1b73c846..30e91ad63 100644 --- a/config/initializers/mime_types.rb +++ b/config/initializers/mime_types.rb @@ -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) diff --git a/config/locales/ca.yml b/config/locales/ca.yml index f63aee3e6..0ba893a12 100644 --- a/config/locales/ca.yml +++ b/config/locales/ca.yml @@ -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? diff --git a/config/locales/en.yml b/config/locales/en.yml index 79efddfad..be1f15e25 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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? diff --git a/config/locales/fa.yml b/config/locales/fa.yml index ade76d670..218d859bb 100644 --- a/config/locales/fa.yml +++ b/config/locales/fa.yml @@ -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: آیا مطمئن هستید؟ diff --git a/config/locales/fr.yml b/config/locales/fr.yml index cba217651..65e681b20 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -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 ? diff --git a/config/locales/he.yml b/config/locales/he.yml index 21f8f1dc4..251b6914e 100644 --- a/config/locales/he.yml +++ b/config/locales/he.yml @@ -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: בטוח? diff --git a/config/locales/id.yml b/config/locales/id.yml index e3fe96331..7bda52c78 100644 --- a/config/locales/id.yml +++ b/config/locales/id.yml @@ -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? diff --git a/config/locales/ja.yml b/config/locales/ja.yml index 37d82a205..fda87526d 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -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: 本当に実行しますか? diff --git a/config/locales/ko.yml b/config/locales/ko.yml index bafc19993..c7c310cfe 100644 --- a/config/locales/ko.yml +++ b/config/locales/ko.yml @@ -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: 정말로 실행하시겠습니까? diff --git a/config/locales/no.yml b/config/locales/no.yml index 004e1ff80..cf94524d2 100644 --- a/config/locales/no.yml +++ b/config/locales/no.yml @@ -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? diff --git a/config/locales/oc.yml b/config/locales/oc.yml index 91a6ca791..2eb85be58 100644 --- a/config/locales/oc.yml +++ b/config/locales/oc.yml @@ -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 ? diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 9ee6c0540..6f2831670 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -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? diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index 355c20d05..5ba763ae4 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -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? diff --git a/config/locales/pt.yml b/config/locales/pt.yml index 40be8a6c5..346fcdda8 100644 --- a/config/locales/pt.yml +++ b/config/locales/pt.yml @@ -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? diff --git a/config/locales/th.yml b/config/locales/th.yml index 263babdd0..17eb96110 100644 --- a/config/locales/th.yml +++ b/config/locales/th.yml @@ -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: แน่ใจนะ? diff --git a/config/locales/tr.yml b/config/locales/tr.yml index e7864cc57..bb83991cd 100644 --- a/config/locales/tr.yml +++ b/config/locales/tr.yml @@ -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? diff --git a/config/locales/zh-CN.yml b/config/locales/zh-CN.yml index 650d4bd15..0526ec1ba 100644 --- a/config/locales/zh-CN.yml +++ b/config/locales/zh-CN.yml @@ -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: 你确定吗? diff --git a/config/locales/zh-HK.yml b/config/locales/zh-HK.yml index d2db78be1..06f9ab63d 100644 --- a/config/locales/zh-HK.yml +++ b/config/locales/zh-HK.yml @@ -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: 你確定嗎? diff --git a/config/routes.rb b/config/routes.rb index 9171d02d4..dda3534eb 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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 |