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.

237 lines
7.2 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
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/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: lambda { |req| req.format.nil? || req.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 :statuses, only: [:show] do
  32. member do
  33. get :activity
  34. end
  35. end
  36. resources :followers, only: [:index], controller: :follower_accounts
  37. resources :following, only: [:index], controller: :following_accounts
  38. resource :follow, only: [:create], controller: :account_follow
  39. resource :unfollow, only: [:create], controller: :account_unfollow
  40. resource :outbox, only: [:show], module: :activitypub
  41. end
  42. get '/@:username', to: 'accounts#show', as: :short_account
  43. get '/@:account_username/:id', to: 'statuses#show', as: :short_account_status
  44. namespace :settings do
  45. resource :profile, only: [:show, :update]
  46. resource :preferences, only: [:show, :update]
  47. resource :import, only: [:show, :create]
  48. resource :export, only: [:show]
  49. namespace :exports, constraints: { format: :csv } do
  50. resources :follows, only: :index, controller: :following_accounts
  51. resources :blocks, only: :index, controller: :blocked_accounts
  52. resources :mutes, only: :index, controller: :muted_accounts
  53. end
  54. resource :two_factor_authentication, only: [:show, :create, :destroy]
  55. namespace :two_factor_authentication do
  56. resources :recovery_codes, only: [:create]
  57. resource :confirmation, only: [:new, :create]
  58. end
  59. resource :follower_domains, only: [:show, :update]
  60. resource :delete, only: [:show, :destroy]
  61. resources :sessions, only: [:destroy]
  62. end
  63. resources :media, only: [:show]
  64. resources :tags, only: [:show]
  65. # Remote follow
  66. resource :authorize_follow, only: [:show, :create]
  67. namespace :admin do
  68. resources :subscriptions, only: [:index]
  69. resources :domain_blocks, only: [:index, :new, :create, :show, :destroy]
  70. resource :settings, only: [:edit, :update]
  71. resources :instances, only: [:index] do
  72. collection do
  73. post :resubscribe
  74. end
  75. end
  76. resources :reports, only: [:index, :show, :update] do
  77. resources :reported_statuses, only: [:create, :update, :destroy]
  78. end
  79. resources :accounts, only: [:index, :show] do
  80. member do
  81. post :subscribe
  82. post :unsubscribe
  83. post :redownload
  84. end
  85. resource :reset, only: [:create]
  86. resource :silence, only: [:create, :destroy]
  87. resource :suspension, only: [:create, :destroy]
  88. resource :confirmation, only: [:create]
  89. resources :statuses, only: [:index, :create, :update, :destroy]
  90. end
  91. resources :users, only: [] do
  92. resource :two_factor_authentication, only: [:destroy]
  93. end
  94. end
  95. get '/admin', to: redirect('/admin/settings/edit', status: 302)
  96. namespace :api do
  97. # PubSubHubbub outgoing subscriptions
  98. resources :subscriptions, only: [:show]
  99. post '/subscriptions/:id', to: 'subscriptions#update'
  100. # PubSubHubbub incoming subscriptions
  101. post '/push', to: 'push#update', as: :push
  102. # Salmon
  103. post '/salmon/:id', to: 'salmon#update', as: :salmon
  104. # OEmbed
  105. get '/oembed', to: 'oembed#show', as: :oembed
  106. # JSON / REST API
  107. namespace :v1 do
  108. resources :statuses, only: [:create, :show, :destroy] do
  109. scope module: :statuses do
  110. resources :reblogged_by, controller: :reblogged_by_accounts, only: :index
  111. resources :favourited_by, controller: :favourited_by_accounts, only: :index
  112. resource :reblog, only: :create
  113. post :unreblog, to: 'reblogs#destroy'
  114. resource :favourite, only: :create
  115. post :unfavourite, to: 'favourites#destroy'
  116. resource :mute, only: :create
  117. post :unmute, to: 'mutes#destroy'
  118. end
  119. member do
  120. get :context
  121. get :card
  122. end
  123. end
  124. namespace :timelines do
  125. resource :home, only: :show, controller: :home
  126. resource :public, only: :show, controller: :public
  127. resources :tag, only: :show
  128. end
  129. resources :streaming, only: [:index]
  130. get '/search', to: 'search#index', as: :search
  131. resources :follows, only: [:create]
  132. resources :media, only: [:create]
  133. resources :apps, only: [:create]
  134. resources :blocks, only: [:index]
  135. resources :mutes, only: [:index]
  136. resources :favourites, only: [:index]
  137. resources :reports, only: [:index, :create]
  138. resource :instance, only: [:show]
  139. resource :domain_blocks, only: [:show, :create, :destroy]
  140. resources :follow_requests, only: [:index] do
  141. member do
  142. post :authorize
  143. post :reject
  144. end
  145. end
  146. resources :notifications, only: [:index, :show] do
  147. collection do
  148. post :clear
  149. post :dismiss
  150. end
  151. end
  152. namespace :accounts do
  153. get :verify_credentials, to: 'credentials#show'
  154. patch :update_credentials, to: 'credentials#update'
  155. resource :search, only: :show, controller: :search
  156. resources :relationships, only: :index
  157. end
  158. resources :accounts, only: [:show] do
  159. resources :statuses, only: :index, controller: 'accounts/statuses'
  160. resources :followers, only: :index, controller: 'accounts/follower_accounts'
  161. resources :following, only: :index, controller: 'accounts/following_accounts'
  162. member do
  163. post :follow
  164. post :unfollow
  165. post :block
  166. post :unblock
  167. post :mute
  168. post :unmute
  169. end
  170. end
  171. end
  172. namespace :web do
  173. resource :settings, only: [:update]
  174. resources :push_subscriptions, only: [:create] do
  175. member do
  176. put :update
  177. end
  178. end
  179. end
  180. end
  181. get '/web/(*any)', to: 'home#index', as: :web
  182. get '/about', to: 'about#show'
  183. get '/about/more', to: 'about#more'
  184. get '/terms', to: 'about#terms'
  185. root 'home#index'
  186. match '*unmatched_route',
  187. via: :all,
  188. to: 'application#raise_not_found',
  189. format: false
  190. end