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.

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