The code powering m.abunchtell.com https://m.abunchtell.com
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

routes.rb 10 KiB

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