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.

212 lines
6.4 KiB

8 years ago
7 years ago
7 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
8 years ago
  1. # frozen_string_literal: true
  2. require 'sidekiq/web'
  3. require 'sidekiq-scheduler/web'
  4. Rails.application.routes.draw do
  5. mount LetterOpenerWeb::Engine, at: 'letter_opener' if Rails.env.development?
  6. authenticate :user, lambda { |u| u.admin? } do
  7. mount Sidekiq::Web, at: 'sidekiq', as: :sidekiq
  8. mount PgHero::Engine, at: 'pghero', as: :pghero
  9. end
  10. use_doorkeeper do
  11. controllers authorizations: 'oauth/authorizations', authorized_applications: 'oauth/authorized_applications'
  12. end
  13. get '.well-known/host-meta', to: 'well_known/host_meta#show', as: :host_meta, defaults: { format: 'xml' }
  14. get '.well-known/webfinger', to: 'well_known/webfinger#show', as: :webfinger
  15. devise_for :users, path: 'auth', controllers: {
  16. sessions: 'auth/sessions',
  17. registrations: 'auth/registrations',
  18. passwords: 'auth/passwords',
  19. confirmations: 'auth/confirmations',
  20. }
  21. get '/users/:username', to: redirect('/@%{username}'), constraints: { format: :html }
  22. resources :accounts, path: 'users', only: [:show], param: :username do
  23. resources :stream_entries, path: 'updates', only: [:show] do
  24. member do
  25. get :embed
  26. end
  27. end
  28. get :remote_follow, to: 'remote_follow#new'
  29. post :remote_follow, to: 'remote_follow#create'
  30. resources :followers, only: [:index], controller: :follower_accounts
  31. resources :following, only: [:index], controller: :following_accounts
  32. resource :follow, only: [:create], controller: :account_follow
  33. resource :unfollow, only: [:create], controller: :account_unfollow
  34. end
  35. get '/@:username', to: 'accounts#show', as: :short_account
  36. get '/@:account_username/:id', to: 'statuses#show', as: :short_account_status
  37. namespace :settings do
  38. resource :profile, only: [:show, :update]
  39. resource :preferences, only: [:show, :update]
  40. resource :import, only: [:show, :create]
  41. resource :export, only: [:show]
  42. namespace :exports, constraints: { format: :csv } do
  43. resources :follows, only: :index, controller: :following_accounts
  44. resources :blocks, only: :index, controller: :blocked_accounts
  45. resources :mutes, only: :index, controller: :muted_accounts
  46. end
  47. resource :two_factor_authentication, only: [:show, :create, :destroy]
  48. namespace :two_factor_authentication do
  49. resources :recovery_codes, only: [:create]
  50. resource :confirmation, only: [:new, :create]
  51. end
  52. resource :follower_domains, only: [:show, :update]
  53. end
  54. resources :media, only: [:show]
  55. resources :tags, only: [:show]
  56. # Remote follow
  57. resource :authorize_follow, only: [:show, :create]
  58. namespace :admin do
  59. resources :subscriptions, only: [:index]
  60. resources :domain_blocks, only: [:index, :new, :create, :show, :destroy]
  61. resource :settings, only: [:edit, :update]
  62. resources :instances, only: [:index]
  63. resources :reports, only: [:index, :show, :update] do
  64. resources :reported_statuses, only: [:update, :destroy]
  65. end
  66. resources :accounts, only: [:index, :show] do
  67. resource :reset, only: [:create]
  68. resource :silence, only: [:create, :destroy]
  69. resource :suspension, only: [:create, :destroy]
  70. resource :confirmation, only: [:create]
  71. end
  72. resources :users, only: [] do
  73. resource :two_factor_authentication, only: [:destroy]
  74. end
  75. end
  76. get '/admin', to: redirect('/admin/settings/edit', status: 302)
  77. namespace :api do
  78. # PubSubHubbub outgoing subscriptions
  79. resources :subscriptions, only: [:show]
  80. post '/subscriptions/:id', to: 'subscriptions#update'
  81. # PubSubHubbub incoming subscriptions
  82. post '/push', to: 'push#update', as: :push
  83. # Salmon
  84. post '/salmon/:id', to: 'salmon#update', as: :salmon
  85. # OEmbed
  86. get '/oembed', to: 'oembed#show', as: :oembed
  87. # ActivityPub
  88. namespace :activitypub do
  89. get '/users/:id/outbox', to: 'outbox#show', as: :outbox
  90. get '/statuses/:id', to: 'activities#show_status', as: :status
  91. resources :notes, only: [:show]
  92. end
  93. # JSON / REST API
  94. namespace :v1 do
  95. resources :statuses, only: [:create, :show, :destroy] do
  96. member do
  97. get :context
  98. get :card
  99. get :reblogged_by
  100. get :favourited_by
  101. post :reblog
  102. post :unreblog
  103. post :favourite
  104. post :unfavourite
  105. post :mute
  106. post :unmute
  107. end
  108. end
  109. namespace :timelines do
  110. resource :home, only: :show, controller: :home
  111. resource :public, only: :show, controller: :public
  112. resources :tag, only: :show
  113. end
  114. resources :streaming, only: [:index]
  115. get '/search', to: 'search#index', as: :search
  116. resources :follows, only: [:create]
  117. resources :media, only: [:create]
  118. resources :apps, only: [:create]
  119. resources :blocks, only: [:index]
  120. resources :mutes, only: [:index]
  121. resources :favourites, only: [:index]
  122. resources :reports, only: [:index, :create]
  123. resource :instance, only: [:show]
  124. resource :domain_blocks, only: [:show, :create, :destroy]
  125. resources :follow_requests, only: [:index] do
  126. member do
  127. post :authorize
  128. post :reject
  129. end
  130. end
  131. resources :notifications, only: [:index, :show] do
  132. collection do
  133. post :clear
  134. post :dismiss
  135. end
  136. end
  137. namespace :accounts do
  138. get :verify_credentials, to: 'credentials#show'
  139. patch :update_credentials, to: 'credentials#update'
  140. resource :search, only: :show, controller: :search
  141. resources :relationships, only: :index
  142. end
  143. resources :accounts, only: [:show] do
  144. resources :statuses, only: :index, controller: 'accounts/statuses'
  145. resources :followers, only: :index, controller: 'accounts/follower_accounts'
  146. resources :following, only: :index, controller: 'accounts/following_accounts'
  147. member do
  148. post :follow
  149. post :unfollow
  150. post :block
  151. post :unblock
  152. post :mute
  153. post :unmute
  154. end
  155. end
  156. end
  157. namespace :web do
  158. resource :settings, only: [:update]
  159. end
  160. end
  161. get '/web/(*any)', to: 'home#index', as: :web
  162. get '/about', to: 'about#show'
  163. get '/about/more', to: 'about#more'
  164. get '/terms', to: 'about#terms'
  165. root 'home#index'
  166. match '*unmatched_route',
  167. via: :all,
  168. to: 'application#raise_not_found',
  169. format: false
  170. end