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.

292 lines
8.7 KiB

8 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
7 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. get 'intent', to: 'intents#show'
  18. devise_for :users, path: 'auth', controllers: {
  19. sessions: 'auth/sessions',
  20. registrations: 'auth/registrations',
  21. passwords: 'auth/passwords',
  22. confirmations: 'auth/confirmations',
  23. }
  24. get '/users/:username', to: redirect('/@%{username}'), constraints: lambda { |req| req.format.nil? || req.format.html? }
  25. resources :accounts, path: 'users', only: [:show], param: :username do
  26. resources :stream_entries, path: 'updates', only: [:show] do
  27. member do
  28. get :embed
  29. end
  30. end
  31. get :remote_follow, to: 'remote_follow#new'
  32. post :remote_follow, to: 'remote_follow#create'
  33. resources :statuses, only: [:show] do
  34. member do
  35. get :activity
  36. get :embed
  37. end
  38. end
  39. resources :followers, only: [:index], controller: :follower_accounts
  40. resources :following, only: [:index], controller: :following_accounts
  41. resource :follow, only: [:create], controller: :account_follow
  42. resource :unfollow, only: [:create], controller: :account_unfollow
  43. resource :outbox, only: [:show], module: :activitypub
  44. resource :inbox, only: [:create], module: :activitypub
  45. end
  46. resource :inbox, only: [:create], module: :activitypub
  47. get '/@:username', to: 'accounts#show', as: :short_account
  48. get '/@:username/with_replies', to: 'accounts#show', as: :short_account_with_replies
  49. get '/@:username/media', to: 'accounts#show', as: :short_account_media
  50. get '/@:account_username/:id', to: 'statuses#show', as: :short_account_status
  51. get '/@:account_username/:id/embed', to: 'statuses#embed', as: :embed_short_account_status
  52. namespace :settings do
  53. resource :profile, only: [:show, :update]
  54. resource :preferences, only: [:show, :update]
  55. resource :notifications, only: [:show, :update]
  56. resource :import, only: [:show, :create]
  57. resource :export, only: [:show]
  58. namespace :exports, constraints: { format: :csv } do
  59. resources :follows, only: :index, controller: :following_accounts
  60. resources :blocks, only: :index, controller: :blocked_accounts
  61. resources :mutes, only: :index, controller: :muted_accounts
  62. end
  63. resource :two_factor_authentication, only: [:show, :create, :destroy]
  64. namespace :two_factor_authentication do
  65. resources :recovery_codes, only: [:create]
  66. resource :confirmation, only: [:new, :create]
  67. end
  68. resource :follower_domains, only: [:show, :update]
  69. resources :applications, except: [:edit] do
  70. member do
  71. post :regenerate
  72. end
  73. end
  74. resource :delete, only: [:show, :destroy]
  75. resources :sessions, only: [:destroy]
  76. end
  77. resources :media, only: [:show]
  78. resources :tags, only: [:show]
  79. resources :emojis, only: [:show]
  80. get '/media_proxy/:id/(*any)', to: 'media_proxy#show', as: :media_proxy
  81. # Remote follow
  82. resource :authorize_follow, only: [:show, :create]
  83. resource :share, only: [:show, :create]
  84. namespace :admin do
  85. resources :subscriptions, only: [:index]
  86. resources :domain_blocks, only: [:index, :new, :create, :show, :destroy]
  87. resources :email_domain_blocks, only: [:index, :new, :create, :destroy]
  88. resource :settings, only: [:edit, :update]
  89. resources :instances, only: [:index] do
  90. collection do
  91. post :resubscribe
  92. end
  93. end
  94. resources :reports, only: [:index, :show, :update] do
  95. resources :reported_statuses, only: [:create, :update, :destroy]
  96. end
  97. resources :accounts, only: [:index, :show] do
  98. member do
  99. post :subscribe
  100. post :unsubscribe
  101. post :enable
  102. post :disable
  103. post :redownload
  104. post :memorialize
  105. end
  106. resource :reset, only: [:create]
  107. resource :silence, only: [:create, :destroy]
  108. resource :suspension, only: [:create, :destroy]
  109. resource :confirmation, only: [:create]
  110. resources :statuses, only: [:index, :create, :update, :destroy]
  111. resource :role do
  112. member do
  113. post :promote
  114. post :demote
  115. end
  116. end
  117. end
  118. resources :users, only: [] do
  119. resource :two_factor_authentication, only: [:destroy]
  120. end
  121. resources :custom_emojis, only: [:index, :new, :create, :update, :destroy] do
  122. member do
  123. post :copy
  124. post :enable
  125. post :disable
  126. end
  127. end
  128. resources :account_moderation_notes, only: [:create, :destroy]
  129. end
  130. get '/admin', to: redirect('/admin/settings/edit', status: 302)
  131. namespace :api do
  132. # PubSubHubbub outgoing subscriptions
  133. resources :subscriptions, only: [:show]
  134. post '/subscriptions/:id', to: 'subscriptions#update'
  135. # PubSubHubbub incoming subscriptions
  136. post '/push', to: 'push#update', as: :push
  137. # Salmon
  138. post '/salmon/:id', to: 'salmon#update', as: :salmon
  139. # OEmbed
  140. get '/oembed', to: 'oembed#show', as: :oembed
  141. # JSON / REST API
  142. namespace :v1 do
  143. resources :statuses, only: [:create, :show, :destroy] do
  144. scope module: :statuses do
  145. resources :reblogged_by, controller: :reblogged_by_accounts, only: :index
  146. resources :favourited_by, controller: :favourited_by_accounts, only: :index
  147. resource :reblog, only: :create
  148. post :unreblog, to: 'reblogs#destroy'
  149. resource :favourite, only: :create
  150. post :unfavourite, to: 'favourites#destroy'
  151. resource :mute, only: :create
  152. post :unmute, to: 'mutes#destroy'
  153. resource :pin, only: :create
  154. post :unpin, to: 'pins#destroy'
  155. end
  156. member do
  157. get :context
  158. get :card
  159. end
  160. end
  161. namespace :timelines do
  162. resource :home, only: :show, controller: :home
  163. resource :public, only: :show, controller: :public
  164. resources :tag, only: :show
  165. end
  166. resources :streaming, only: [:index]
  167. resources :custom_emojis, only: [:index]
  168. get '/search', to: 'search#index', as: :search
  169. resources :follows, only: [:create]
  170. resources :media, only: [:create, :update]
  171. resources :blocks, only: [:index]
  172. resources :mutes, only: [:index]
  173. resources :favourites, only: [:index]
  174. resources :reports, only: [:index, :create]
  175. namespace :apps do
  176. get :verify_credentials, to: 'credentials#show'
  177. end
  178. resources :apps, only: [:create]
  179. resource :instance, only: [:show]
  180. resource :domain_blocks, only: [:show, :create, :destroy]
  181. resources :follow_requests, only: [:index] do
  182. member do
  183. post :authorize
  184. post :reject
  185. end
  186. end
  187. resources :notifications, only: [:index, :show] do
  188. collection do
  189. post :clear
  190. post :dismiss
  191. end
  192. end
  193. namespace :accounts do
  194. get :verify_credentials, to: 'credentials#show'
  195. patch :update_credentials, to: 'credentials#update'
  196. resource :search, only: :show, controller: :search
  197. resources :relationships, only: :index
  198. end
  199. resources :accounts, only: [:show] do
  200. resources :statuses, only: :index, controller: 'accounts/statuses'
  201. resources :followers, only: :index, controller: 'accounts/follower_accounts'
  202. resources :following, only: :index, controller: 'accounts/following_accounts'
  203. member do
  204. post :follow
  205. post :unfollow
  206. post :block
  207. post :unblock
  208. post :mute
  209. post :unmute
  210. end
  211. end
  212. end
  213. namespace :web do
  214. resource :settings, only: [:update]
  215. resource :embed, only: [:create]
  216. resources :push_subscriptions, only: [:create] do
  217. member do
  218. put :update
  219. end
  220. end
  221. end
  222. end
  223. get '/web/(*any)', to: 'home#index', as: :web
  224. get '/about', to: 'about#show'
  225. get '/about/more', to: 'about#more'
  226. get '/terms', to: 'about#terms'
  227. root 'home#index'
  228. match '*unmatched_route',
  229. via: :all,
  230. to: 'application#raise_not_found',
  231. format: false
  232. end