You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

514 lines
16 KiB

8 years ago
7 years ago
Add Keybase integration (#10297) * create account_identity_proofs table * add endpoint for keybase to check local proofs * add async task to update validity and liveness of proofs from keybase * first pass keybase proof CRUD * second pass keybase proof creation * clean up proof list and add badges * add avatar url to keybase api * Always highlight the “Identity Proofs” navigation item when interacting with proofs. * Update translations. * Add profile URL. * Reorder proofs. * Add proofs to bio. * Update settings/identity_proofs front-end. * Use `link_to`. * Only encode query params if they exist. URLs without params had a trailing `?`. * Only show live proofs. * change valid to active in proof list and update liveness before displaying * minor fixes * add keybase config at well-known path * extremely naive feature flagging off the identity proof UI * fixes for rubocop * make identity proofs page resilient to potential keybase issues * normalize i18n * tweaks for brakeman * remove two unused translations * cleanup and add more localizations * make keybase_contacts an admin setting * fix ExternalProofService my_domain * use Addressable::URI in identity proofs * use active model serializer for keybase proof config * more cleanup of keybase proof config * rename proof is_valid and is_live to proof_valid and proof_live * cleanup * assorted tweaks for more robust communication with keybase * Clean up * Small fixes * Display verified identity identically to verified links * Clean up unused CSS * Add caching for Keybase avatar URLs * Remove keybase_contacts setting
5 years ago
Add WebAuthn as an alternative 2FA method (#14466) * feat: add possibility of adding WebAuthn security keys to use as 2FA This adds a basic UI for enabling WebAuthn 2FA. We did a little refactor to the Settings page for editing the 2FA methods – now it will list the methods that are available to the user (TOTP and WebAuthn) and from there they'll be able to add or remove any of them. Also, it's worth mentioning that for enabling WebAuthn it's required to have TOTP enabled, so the first time that you go to the 2FA Settings page, you'll be asked to set it up. This work was inspired by the one donde by Github in their platform, and despite it could be approached in different ways, we decided to go with this one given that we feel that this gives a great UX. Co-authored-by: Facundo Padula <facundo.padula@cedarcode.com> * feat: add request for WebAuthn as second factor at login if enabled This commits adds the feature for using WebAuthn as a second factor for login when enabled. If users have WebAuthn enabled, now a page requesting for the use of a WebAuthn credential for log in will appear, although a link redirecting to the old page for logging in using a two-factor code will also be present. Co-authored-by: Facundo Padula <facundo.padula@cedarcode.com> * feat: add possibility of deleting WebAuthn Credentials Co-authored-by: Facundo Padula <facundo.padula@cedarcode.com> * feat: disable WebAuthn when an Admin disables 2FA for a user Co-authored-by: Facundo Padula <facundo.padula@cedarcode.com> * feat: remove ability to disable TOTP leaving only WebAuthn as 2FA Following examples form other platforms like Github, we decided to make Webauthn 2FA secondary to 2FA with TOTP, so that we removed the possibility of removing TOTP authentication only, leaving users with just WEbAuthn as 2FA. Instead, users will have to click on 'Disable 2FA' in order to remove second factor auth. The reason for WebAuthn being secondary to TOPT is that in that way, users will still be able to log in using their code from their phone's application if they don't have their security keys with them – or maybe even lost them. * We had to change a little the flow for setting up TOTP, given that now it's possible to setting up again if you already had TOTP, in order to let users modify their authenticator app – given that now it's not possible for them to disable TOTP and set it up again with another authenticator app. So, basically, now instead of storing the new `otp_secret` in the user, we store it in the session until the process of set up is finished. This was because, as it was before, when users clicked on 'Edit' in the new two-factor methods lists page, but then went back without finishing the flow, their `otp_secret` had been changed therefore invalidating their previous authenticator app, making them unable to log in again using TOTP. Co-authored-by: Facundo Padula <facundo.padula@cedarcode.com> * refactor: fix eslint errors The PR build was failing given that linting returning some errors. This commit attempts to fix them. * refactor: normalize i18n translations The build was failing given that i18n translations files were not normalized. This commits fixes that. * refactor: avoid having the webauthn gem locked to a specific version * refactor: use symbols for routes without '/' * refactor: avoid sending webauthn disabled email when 2FA is disabled When an admins disable 2FA for users, we were sending two mails to them, one notifying that 2FA was disabled and the other to notify that WebAuthn was disabled. As the second one is redundant since the first email includes it, we can remove it and send just one email to users. * refactor: avoid creating new env variable for webauthn_origin config * refactor: improve flash error messages for webauthn pages Co-authored-by: Facundo Padula <facundo.padula@cedarcode.com>
3 years ago
Add WebAuthn as an alternative 2FA method (#14466) * feat: add possibility of adding WebAuthn security keys to use as 2FA This adds a basic UI for enabling WebAuthn 2FA. We did a little refactor to the Settings page for editing the 2FA methods – now it will list the methods that are available to the user (TOTP and WebAuthn) and from there they'll be able to add or remove any of them. Also, it's worth mentioning that for enabling WebAuthn it's required to have TOTP enabled, so the first time that you go to the 2FA Settings page, you'll be asked to set it up. This work was inspired by the one donde by Github in their platform, and despite it could be approached in different ways, we decided to go with this one given that we feel that this gives a great UX. Co-authored-by: Facundo Padula <facundo.padula@cedarcode.com> * feat: add request for WebAuthn as second factor at login if enabled This commits adds the feature for using WebAuthn as a second factor for login when enabled. If users have WebAuthn enabled, now a page requesting for the use of a WebAuthn credential for log in will appear, although a link redirecting to the old page for logging in using a two-factor code will also be present. Co-authored-by: Facundo Padula <facundo.padula@cedarcode.com> * feat: add possibility of deleting WebAuthn Credentials Co-authored-by: Facundo Padula <facundo.padula@cedarcode.com> * feat: disable WebAuthn when an Admin disables 2FA for a user Co-authored-by: Facundo Padula <facundo.padula@cedarcode.com> * feat: remove ability to disable TOTP leaving only WebAuthn as 2FA Following examples form other platforms like Github, we decided to make Webauthn 2FA secondary to 2FA with TOTP, so that we removed the possibility of removing TOTP authentication only, leaving users with just WEbAuthn as 2FA. Instead, users will have to click on 'Disable 2FA' in order to remove second factor auth. The reason for WebAuthn being secondary to TOPT is that in that way, users will still be able to log in using their code from their phone's application if they don't have their security keys with them – or maybe even lost them. * We had to change a little the flow for setting up TOTP, given that now it's possible to setting up again if you already had TOTP, in order to let users modify their authenticator app – given that now it's not possible for them to disable TOTP and set it up again with another authenticator app. So, basically, now instead of storing the new `otp_secret` in the user, we store it in the session until the process of set up is finished. This was because, as it was before, when users clicked on 'Edit' in the new two-factor methods lists page, but then went back without finishing the flow, their `otp_secret` had been changed therefore invalidating their previous authenticator app, making them unable to log in again using TOTP. Co-authored-by: Facundo Padula <facundo.padula@cedarcode.com> * refactor: fix eslint errors The PR build was failing given that linting returning some errors. This commit attempts to fix them. * refactor: normalize i18n translations The build was failing given that i18n translations files were not normalized. This commits fixes that. * refactor: avoid having the webauthn gem locked to a specific version * refactor: use symbols for routes without '/' * refactor: avoid sending webauthn disabled email when 2FA is disabled When an admins disable 2FA for users, we were sending two mails to them, one notifying that 2FA was disabled and the other to notify that WebAuthn was disabled. As the second one is redundant since the first email includes it, we can remove it and send just one email to users. * refactor: avoid creating new env variable for webauthn_origin config * refactor: improve flash error messages for webauthn pages Co-authored-by: Facundo Padula <facundo.padula@cedarcode.com>
3 years ago
Add Keybase integration (#10297) * create account_identity_proofs table * add endpoint for keybase to check local proofs * add async task to update validity and liveness of proofs from keybase * first pass keybase proof CRUD * second pass keybase proof creation * clean up proof list and add badges * add avatar url to keybase api * Always highlight the “Identity Proofs” navigation item when interacting with proofs. * Update translations. * Add profile URL. * Reorder proofs. * Add proofs to bio. * Update settings/identity_proofs front-end. * Use `link_to`. * Only encode query params if they exist. URLs without params had a trailing `?`. * Only show live proofs. * change valid to active in proof list and update liveness before displaying * minor fixes * add keybase config at well-known path * extremely naive feature flagging off the identity proof UI * fixes for rubocop * make identity proofs page resilient to potential keybase issues * normalize i18n * tweaks for brakeman * remove two unused translations * cleanup and add more localizations * make keybase_contacts an admin setting * fix ExternalProofService my_domain * use Addressable::URI in identity proofs * use active model serializer for keybase proof config * more cleanup of keybase proof config * rename proof is_valid and is_live to proof_valid and proof_live * cleanup * assorted tweaks for more robust communication with keybase * Clean up * Small fixes * Display verified identity identically to verified links * Clean up unused CSS * Add caching for Keybase avatar URLs * Remove keybase_contacts setting
5 years ago
Add Keybase integration (#10297) * create account_identity_proofs table * add endpoint for keybase to check local proofs * add async task to update validity and liveness of proofs from keybase * first pass keybase proof CRUD * second pass keybase proof creation * clean up proof list and add badges * add avatar url to keybase api * Always highlight the “Identity Proofs” navigation item when interacting with proofs. * Update translations. * Add profile URL. * Reorder proofs. * Add proofs to bio. * Update settings/identity_proofs front-end. * Use `link_to`. * Only encode query params if they exist. URLs without params had a trailing `?`. * Only show live proofs. * change valid to active in proof list and update liveness before displaying * minor fixes * add keybase config at well-known path * extremely naive feature flagging off the identity proof UI * fixes for rubocop * make identity proofs page resilient to potential keybase issues * normalize i18n * tweaks for brakeman * remove two unused translations * cleanup and add more localizations * make keybase_contacts an admin setting * fix ExternalProofService my_domain * use Addressable::URI in identity proofs * use active model serializer for keybase proof config * more cleanup of keybase proof config * rename proof is_valid and is_live to proof_valid and proof_live * cleanup * assorted tweaks for more robust communication with keybase * Clean up * Small fixes * Display verified identity identically to verified links * Clean up unused CSS * Add caching for Keybase avatar URLs * Remove keybase_contacts setting
5 years ago
Account domain blocks (#2381) * Add <ostatus:conversation /> tag to Atom input/output Only uses ref attribute (not href) because href would be the alternate link that's always included also. Creates new conversation for every non-reply status. Carries over conversation for every reply. Keeps remote URIs verbatim, generates local URIs on the fly like the rest of them. * Conversation muting - prevents notifications that reference a conversation (including replies, favourites, reblogs) from being created. API endpoints /api/v1/statuses/:id/mute and /api/v1/statuses/:id/unmute Currently no way to tell when a status/conversation is muted, so the web UI only has a "disable notifications" button, doesn't work as a toggle * Display "Dismiss notifications" on all statuses in notifications column, not just own * Add "muted" as a boolean attribute on statuses JSON For now always false on contained reblogs, since it's only relevant for statuses returned from the notifications endpoint, which are not nested Remove "Disable notifications" from detailed status view, since it's only relevant in the notifications column * Up max class length * Remove pending test for conversation mute * Add tests, clean up * Rename to "mute conversation" and "unmute conversation" * Raise validation error when trying to mute/unmute status without conversation * Adding account domain blocks that filter notifications and public timelines * Add tests for domain blocks in notifications, public timelines Filter reblogs of blocked domains from home * Add API for listing and creating account domain blocks * API for creating/deleting domain blocks, tests for Status#ancestors and Status#descendants, filter domain blocks from them * Filter domains in streaming API * Update account_domain_block_spec.rb
7 years ago
Web Push Notifications (#3243) * feat: Register push subscription * feat: Notify when mentioned * feat: Boost, favourite, reply, follow, follow request * feat: Notification interaction * feat: Handle change of public key * feat: Unsubscribe if things go wrong * feat: Do not send normal notifications if push is enabled * feat: Focus client if open * refactor: Move push logic to WebPushSubscription * feat: Better title and body * feat: Localize messages * chore: Fix lint errors * feat: Settings * refactor: Lazy load * fix: Check if push settings exist * feat: Device-based preferences * refactor: Simplify logic * refactor: Pull request feedback * refactor: Pull request feedback * refactor: Create /api/web/push_subscriptions endpoint * feat: Spec PushSubscriptionController * refactor: WebPushSubscription => Web::PushSubscription * feat: Spec Web::PushSubscription * feat: Display first media attachment * feat: Support direction * fix: Stuff broken while rebasing * refactor: Integration with session activations * refactor: Cleanup * refactor: Simplify implementation * feat: Set VAPID keys via environment * chore: Comments * fix: Crash when no alerts * fix: Set VAPID keys in testing environment * fix: Follow link * feat: Notification actions * fix: Delete previous subscription * chore: Temporary logs * refactor: Move migration to a later date * fix: Fetch the correct session activation and misc bugs * refactor: Move migration to a later date * fix: Remove follow request (no notifications) * feat: Send administrator contact to push service * feat: Set time-to-live * fix: Do not show sensitive images * fix: Reducer crash in error handling * feat: Add badge * chore: Fix lint error * fix: Checkbox label overlap * fix: Check for payload support * fix: Rename action "type" (crash in latest Chrome) * feat: Action to expand notification * fix: Lint errors * fix: Unescape notification body * fix: Do not allow boosting if the status is hidden * feat: Add VAPID keys to the production sample environment * fix: Strip HTML tags from status * refactor: Better error messages * refactor: Handle browser not implementing the VAPID protocol (Samsung Internet) * fix: Error when target_status is nil * fix: Handle lack of image * fix: Delete reference to invalid subscriptions * feat: Better error handling * fix: Unescape HTML characters after tags are striped * refactor: Simpify code * fix: Modify to work with #4091 * Sort strings alphabetically * i18n: Updated Polish translation it annoys me that it's not fully localized :P * refactor: Use current_session in PushSubscriptionController * fix: Rebase mistake * fix: Set cacheName to mastodon * refactor: Pull request feedback * refactor: Remove logging statements * chore(yarn): Fix conflicts with master * chore(yarn): Copy latest from master * chore(yarn): Readd offline-plugin * refactor: Use save! and update! * refactor: Send notifications async * fix: Allow retry when push fails * fix: Save track for failed pushes * fix: Minify sw.js * fix: Remove account_id from fabricator
6 years ago
8 years ago
  1. # frozen_string_literal: true
  2. require 'sidekiq_unique_jobs/web'
  3. require 'sidekiq-scheduler/web'
  4. Sidekiq::Web.set :session_secret, Rails.application.secrets[:secret_key_base]
  5. Rails.application.routes.draw do
  6. root 'home#index'
  7. mount LetterOpenerWeb::Engine, at: 'letter_opener' if Rails.env.development?
  8. health_check_routes
  9. authenticate :user, lambda { |u| u.admin? } do
  10. mount Sidekiq::Web, at: 'sidekiq', as: :sidekiq
  11. mount PgHero::Engine, at: 'pghero', as: :pghero
  12. end
  13. use_doorkeeper do
  14. controllers authorizations: 'oauth/authorizations',
  15. authorized_applications: 'oauth/authorized_applications',
  16. tokens: 'oauth/tokens'
  17. end
  18. get '.well-known/host-meta', to: 'well_known/host_meta#show', as: :host_meta, defaults: { format: 'xml' }
  19. get '.well-known/nodeinfo', to: 'well_known/nodeinfo#index', as: :nodeinfo, defaults: { format: 'json' }
  20. get '.well-known/webfinger', to: 'well_known/webfinger#show', as: :webfinger
  21. get '.well-known/change-password', to: redirect('/auth/edit')
  22. get '.well-known/keybase-proof-config', to: 'well_known/keybase_proof_config#show'
  23. get '/nodeinfo/2.0', to: 'well_known/nodeinfo#show', as: :nodeinfo_schema
  24. get 'manifest', to: 'manifests#show', defaults: { format: 'json' }
  25. get 'intent', to: 'intents#show'
  26. get 'custom.css', to: 'custom_css#show', as: :custom_css
  27. resource :instance_actor, path: 'actor', only: [:show] do
  28. resource :inbox, only: [:create], module: :activitypub
  29. end
  30. devise_scope :user do
  31. get '/invite/:invite_code', to: 'auth/registrations#new', as: :public_invite
  32. namespace :auth do
  33. resource :setup, only: [:show, :update], controller: :setup
  34. resource :challenge, only: [:create], controller: :challenges
  35. get 'sessions/security_key_options', to: 'sessions#webauthn_options'
  36. end
  37. end
  38. devise_for :users, path: 'auth', controllers: {
  39. omniauth_callbacks: 'auth/omniauth_callbacks',
  40. sessions: 'auth/sessions',
  41. registrations: 'auth/registrations',
  42. passwords: 'auth/passwords',
  43. confirmations: 'auth/confirmations',
  44. }
  45. get '/users/:username', to: redirect('/@%{username}'), constraints: lambda { |req| req.format.nil? || req.format.html? }
  46. get '/authorize_follow', to: redirect { |_, request| "/authorize_interaction?#{request.params.to_query}" }
  47. resources :accounts, path: 'users', only: [:show], param: :username do
  48. get :remote_follow, to: 'remote_follow#new'
  49. post :remote_follow, to: 'remote_follow#create'
  50. resources :statuses, only: [:show] do
  51. member do
  52. get :activity
  53. get :embed
  54. end
  55. resources :replies, only: [:index], module: :activitypub
  56. end
  57. resources :followers, only: [:index], controller: :follower_accounts
  58. resources :following, only: [:index], controller: :following_accounts
  59. resource :follow, only: [:create], controller: :account_follow
  60. resource :unfollow, only: [:create], controller: :account_unfollow
  61. resource :outbox, only: [:show], module: :activitypub
  62. resource :inbox, only: [:create], module: :activitypub
  63. resource :claim, only: [:create], module: :activitypub
  64. resources :collections, only: [:show], module: :activitypub
  65. end
  66. resource :inbox, only: [:create], module: :activitypub
  67. get '/@:username', to: 'accounts#show', as: :short_account
  68. get '/@:username/with_replies', to: 'accounts#show', as: :short_account_with_replies
  69. get '/@:username/media', to: 'accounts#show', as: :short_account_media
  70. get '/@:username/tagged/:tag', to: 'accounts#show', as: :short_account_tag
  71. get '/@:account_username/:id', to: 'statuses#show', as: :short_account_status
  72. get '/@:account_username/:id/embed', to: 'statuses#embed', as: :embed_short_account_status
  73. get '/interact/:id', to: 'remote_interaction#new', as: :remote_interaction
  74. post '/interact/:id', to: 'remote_interaction#create'
  75. get '/explore', to: 'directories#index', as: :explore
  76. get '/explore/:id', to: 'directories#show', as: :explore_hashtag
  77. get '/settings', to: redirect('/settings/profile')
  78. namespace :settings do
  79. resource :profile, only: [:show, :update] do
  80. resources :pictures, only: :destroy
  81. end
  82. get :preferences, to: redirect('/settings/preferences/appearance')
  83. namespace :preferences do
  84. resource :appearance, only: [:show, :update], controller: :appearance
  85. resource :notifications, only: [:show, :update]
  86. resource :other, only: [:show, :update], controller: :other
  87. end
  88. resource :import, only: [:show, :create]
  89. resource :export, only: [:show, :create]
  90. namespace :exports, constraints: { format: :csv } do
  91. resources :follows, only: :index, controller: :following_accounts
  92. resources :blocks, only: :index, controller: :blocked_accounts
  93. resources :mutes, only: :index, controller: :muted_accounts
  94. resources :lists, only: :index, controller: :lists
  95. resources :domain_blocks, only: :index, controller: :blocked_domains
  96. end
  97. resources :two_factor_authentication_methods, only: [:index] do
  98. collection do
  99. post :disable
  100. end
  101. end
  102. resource :otp_authentication, only: [:show, :create], controller: 'two_factor_authentication/otp_authentication'
  103. resources :webauthn_credentials, only: [:index, :new, :create, :destroy],
  104. path: 'security_keys',
  105. controller: 'two_factor_authentication/webauthn_credentials' do
  106. collection do
  107. get :options
  108. end
  109. end
  110. namespace :two_factor_authentication do
  111. resources :recovery_codes, only: [:create]
  112. resource :confirmation, only: [:new, :create]
  113. end
  114. resources :identity_proofs, only: [:index, :new, :create, :destroy]
  115. resources :applications, except: [:edit] do
  116. member do
  117. post :regenerate
  118. end
  119. end
  120. resource :delete, only: [:show, :destroy]
  121. resource :migration, only: [:show, :create]
  122. namespace :migration do
  123. resource :redirect, only: [:new, :create, :destroy]
  124. end
  125. resources :aliases, only: [:index, :create, :destroy]
  126. resources :sessions, only: [:destroy]
  127. resources :featured_tags, only: [:index, :create, :destroy]
  128. end
  129. resources :media, only: [:show] do
  130. get :player
  131. end
  132. resources :tags, only: [:show]
  133. resources :emojis, only: [:show]
  134. resources :invites, only: [:index, :create, :destroy]
  135. resources :filters, except: [:show]
  136. resource :relationships, only: [:show, :update]
  137. get '/public', to: 'public_timelines#show', as: :public_timeline
  138. get '/media_proxy/:id/(*any)', to: 'media_proxy#show', as: :media_proxy
  139. resource :authorize_interaction, only: [:show, :create]
  140. resource :share, only: [:show, :create]
  141. namespace :admin do
  142. get '/dashboard', to: 'dashboard#index'
  143. resources :domain_allows, only: [:new, :create, :show, :destroy]
  144. resources :domain_blocks, only: [:new, :create, :show, :destroy, :update, :edit]
  145. resources :email_domain_blocks, only: [:index, :new, :create, :destroy]
  146. resources :action_logs, only: [:index]
  147. resources :warning_presets, except: [:new]
  148. resources :announcements, except: [:show] do
  149. member do
  150. post :publish
  151. post :unpublish
  152. end
  153. end
  154. resource :settings, only: [:edit, :update]
  155. resources :site_uploads, only: [:destroy]
  156. resources :invites, only: [:index, :create, :destroy] do
  157. collection do
  158. post :deactivate_all
  159. end
  160. end
  161. resources :relays, only: [:index, :new, :create, :destroy] do
  162. member do
  163. post :enable
  164. post :disable
  165. end
  166. end
  167. resources :instances, only: [:index, :show], constraints: { id: /[^\/]+/ }
  168. resources :reports, only: [:index, :show] do
  169. member do
  170. post :assign_to_self
  171. post :unassign
  172. post :reopen
  173. post :resolve
  174. end
  175. resources :reported_statuses, only: [:create]
  176. end
  177. resources :report_notes, only: [:create, :destroy]
  178. resources :accounts, only: [:index, :show] do
  179. member do
  180. post :enable
  181. post :unsilence
  182. post :unsuspend
  183. post :redownload
  184. post :remove_avatar
  185. post :remove_header
  186. post :memorialize
  187. post :approve
  188. post :reject
  189. end
  190. resource :change_email, only: [:show, :update]
  191. resource :reset, only: [:create]
  192. resource :action, only: [:new, :create], controller: 'account_actions'
  193. resources :statuses, only: [:index, :show, :create, :update, :destroy]
  194. resources :relationships, only: [:index]
  195. resource :confirmation, only: [:create] do
  196. collection do
  197. post :resend
  198. end
  199. end
  200. resource :role, only: [] do
  201. member do
  202. post :promote
  203. post :demote
  204. end
  205. end
  206. end
  207. resources :pending_accounts, only: [:index] do
  208. collection do
  209. post :approve_all
  210. post :reject_all
  211. post :batch
  212. end
  213. end
  214. resources :users, only: [] do
  215. resource :two_factor_authentication, only: [:destroy]
  216. end
  217. resources :custom_emojis, only: [:index, :new, :create] do
  218. collection do
  219. post :batch
  220. end
  221. end
  222. resources :account_moderation_notes, only: [:create, :destroy]
  223. resources :tags, only: [:index, :show, :update] do
  224. collection do
  225. post :approve_all
  226. post :reject_all
  227. post :batch
  228. end
  229. end
  230. end
  231. get '/admin', to: redirect('/admin/dashboard', status: 302)
  232. namespace :api do
  233. # OEmbed
  234. get '/oembed', to: 'oembed#show', as: :oembed
  235. # Identity proofs
  236. get :proofs, to: 'proofs#index'
  237. # JSON / REST API
  238. namespace :v1 do
  239. resources :statuses, only: [:create, :show, :destroy] do
  240. scope module: :statuses do
  241. resources :reblogged_by, controller: :reblogged_by_accounts, only: :index
  242. resources :favourited_by, controller: :favourited_by_accounts, only: :index
  243. resource :reblog, only: :create
  244. post :unreblog, to: 'reblogs#destroy'
  245. resource :favourite, only: :create
  246. post :unfavourite, to: 'favourites#destroy'
  247. resource :bookmark, only: :create
  248. post :unbookmark, to: 'bookmarks#destroy'
  249. resource :mute, only: :create
  250. post :unmute, to: 'mutes#destroy'
  251. resource :pin, only: :create
  252. post :unpin, to: 'pins#destroy'
  253. end
  254. member do
  255. get :context
  256. end
  257. end
  258. namespace :timelines do
  259. resource :home, only: :show, controller: :home
  260. resource :public, only: :show, controller: :public
  261. resources :tag, only: :show
  262. resources :list, only: :show
  263. end
  264. resources :streaming, only: [:index]
  265. resources :custom_emojis, only: [:index]
  266. resources :suggestions, only: [:index, :destroy]
  267. resources :scheduled_statuses, only: [:index, :show, :update, :destroy]
  268. resources :preferences, only: [:index]
  269. resources :announcements, only: [:index] do
  270. scope module: :announcements do
  271. resources :reactions, only: [:update, :destroy]
  272. end
  273. member do
  274. post :dismiss
  275. end
  276. end
  277. # namespace :crypto do
  278. # resources :deliveries, only: :create
  279. # namespace :keys do
  280. # resource :upload, only: [:create]
  281. # resource :query, only: [:create]
  282. # resource :claim, only: [:create]
  283. # resource :count, only: [:show]
  284. # end
  285. # resources :encrypted_messages, only: [:index] do
  286. # collection do
  287. # post :clear
  288. # end
  289. # end
  290. # end
  291. resources :conversations, only: [:index, :destroy] do
  292. member do
  293. post :read
  294. end
  295. end
  296. resources :media, only: [:create, :update, :show]
  297. resources :blocks, only: [:index]
  298. resources :mutes, only: [:index]
  299. resources :favourites, only: [:index]
  300. resources :bookmarks, only: [:index]
  301. resources :reports, only: [:create]
  302. resources :trends, only: [:index]
  303. resources :filters, only: [:index, :create, :show, :update, :destroy]
  304. resources :endorsements, only: [:index]
  305. resources :markers, only: [:index, :create]
  306. namespace :apps do
  307. get :verify_credentials, to: 'credentials#show'
  308. end
  309. resources :apps, only: [:create]
  310. resource :instance, only: [:show] do
  311. resources :peers, only: [:index], controller: 'instances/peers'
  312. resource :activity, only: [:show], controller: 'instances/activity'
  313. end
  314. resource :domain_blocks, only: [:show, :create, :destroy]
  315. resource :directory, only: [:show]
  316. resources :follow_requests, only: [:index] do
  317. member do
  318. post :authorize
  319. post :reject
  320. end
  321. end
  322. resources :notifications, only: [:index, :show] do
  323. collection do
  324. post :clear
  325. end
  326. member do
  327. post :dismiss
  328. end
  329. end
  330. namespace :accounts do
  331. get :verify_credentials, to: 'credentials#show'
  332. patch :update_credentials, to: 'credentials#update'
  333. resource :search, only: :show, controller: :search
  334. resources :relationships, only: :index
  335. end
  336. resources :accounts, only: [:create, :show] do
  337. resources :statuses, only: :index, controller: 'accounts/statuses'
  338. resources :followers, only: :index, controller: 'accounts/follower_accounts'
  339. resources :following, only: :index, controller: 'accounts/following_accounts'
  340. resources :lists, only: :index, controller: 'accounts/lists'
  341. resources :identity_proofs, only: :index, controller: 'accounts/identity_proofs'
  342. member do
  343. post :follow
  344. post :unfollow
  345. post :block
  346. post :unblock
  347. post :mute
  348. post :unmute
  349. end
  350. resource :pin, only: :create, controller: 'accounts/pins'
  351. post :unpin, to: 'accounts/pins#destroy'
  352. resource :note, only: :create, controller: 'accounts/notes'
  353. end
  354. resources :lists, only: [:index, :create, :show, :update, :destroy] do
  355. resource :accounts, only: [:show, :create, :destroy], controller: 'lists/accounts'
  356. end
  357. namespace :featured_tags do
  358. get :suggestions, to: 'suggestions#index'
  359. end
  360. resources :featured_tags, only: [:index, :create, :destroy]
  361. resources :polls, only: [:create, :show] do
  362. resources :votes, only: :create, controller: 'polls/votes'
  363. end
  364. namespace :push do
  365. resource :subscription, only: [:create, :show, :update, :destroy]
  366. end
  367. namespace :admin do
  368. resources :accounts, only: [:index, :show] do
  369. member do
  370. post :enable
  371. post :unsilence
  372. post :unsuspend
  373. post :approve
  374. post :reject
  375. end
  376. resource :action, only: [:create], controller: 'account_actions'
  377. end
  378. resources :reports, only: [:index, :show] do
  379. member do
  380. post :assign_to_self
  381. post :unassign
  382. post :reopen
  383. post :resolve
  384. end
  385. end
  386. end
  387. end
  388. namespace :v2 do
  389. resources :media, only: [:create]
  390. get '/search', to: 'search#index', as: :search
  391. end
  392. namespace :web do
  393. resource :settings, only: [:update]
  394. resource :embed, only: [:create]
  395. resources :push_subscriptions, only: [:create] do
  396. member do
  397. put :update
  398. end
  399. end
  400. end
  401. end
  402. get '/web/(*any)', to: 'home#index', as: :web
  403. get '/about', to: 'about#show'
  404. get '/about/more', to: 'about#more'
  405. get '/terms', to: 'about#terms'
  406. match '/', via: [:post, :put, :patch, :delete], to: 'application#raise_not_found', format: false
  407. match '*unmatched_route', via: :all, to: 'application#raise_not_found', format: false
  408. end