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