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.

210 lines
6.1 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 :pubsubhubbub, 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: :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. get '/timelines/home', to: 'timelines#home', as: :home_timeline
  110. get '/timelines/public', to: 'timelines#public', as: :public_timeline
  111. get '/timelines/tag/:id', to: 'timelines#tag', as: :hashtag_timeline
  112. get '/search', to: 'search#index', as: :search
  113. resources :follows, only: [:create]
  114. resources :media, only: [:create]
  115. resources :apps, only: [:create]
  116. resources :blocks, only: [:index]
  117. resources :mutes, only: [:index]
  118. resources :favourites, only: [:index]
  119. resources :reports, only: [:index, :create]
  120. resource :instance, only: [:show]
  121. resource :domain_blocks, only: [:show, :create, :destroy]
  122. resources :follow_requests, only: [:index] do
  123. member do
  124. post :authorize
  125. post :reject
  126. end
  127. end
  128. resources :notifications, only: [:index, :show] do
  129. collection do
  130. post :clear
  131. post :dismiss
  132. end
  133. end
  134. resources :accounts, only: [:show] do
  135. collection do
  136. get :relationships
  137. get :verify_credentials
  138. patch :update_credentials
  139. get :search
  140. end
  141. member do
  142. get :statuses
  143. get :followers
  144. get :following
  145. post :follow
  146. post :unfollow
  147. post :block
  148. post :unblock
  149. post :mute
  150. post :unmute
  151. end
  152. end
  153. end
  154. namespace :web do
  155. resource :settings, only: [:update]
  156. end
  157. end
  158. get '/web/(*any)', to: 'home#index', as: :web
  159. get '/about', to: 'about#show'
  160. get '/about/more', to: 'about#more'
  161. get '/terms', to: 'about#terms'
  162. root 'home#index'
  163. match '*unmatched_route',
  164. via: :all,
  165. to: 'application#raise_not_found',
  166. format: false
  167. end