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.

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