mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-22 18:45:41 +01:00
Extract SPA-handled routes to stand-alone file (#33190)
This commit is contained in:
parent
72a4da83fd
commit
58c40caeb4
2 changed files with 35 additions and 34 deletions
|
@ -16,37 +16,6 @@ def redirect_with_vary(path)
|
|||
end
|
||||
|
||||
Rails.application.routes.draw do
|
||||
# Paths of routes on the web app that to not require to be indexed or
|
||||
# have alternative format representations requiring separate controllers
|
||||
web_app_paths = %w(
|
||||
/getting-started
|
||||
/keyboard-shortcuts
|
||||
/home
|
||||
/public
|
||||
/public/local
|
||||
/public/remote
|
||||
/conversations
|
||||
/lists/(*any)
|
||||
/links/(*any)
|
||||
/notifications/(*any)
|
||||
/notifications_v2/(*any)
|
||||
/favourites
|
||||
/bookmarks
|
||||
/pinned
|
||||
/start/(*any)
|
||||
/directory
|
||||
/explore/(*any)
|
||||
/search
|
||||
/publish
|
||||
/follow_requests
|
||||
/blocks
|
||||
/domain_blocks
|
||||
/mutes
|
||||
/followed_tags
|
||||
/statuses/(*any)
|
||||
/deck/(*any)
|
||||
).freeze
|
||||
|
||||
root 'home#index'
|
||||
|
||||
mount LetterOpenerWeb::Engine, at: 'letter_opener' if Rails.env.development?
|
||||
|
@ -226,9 +195,7 @@ Rails.application.routes.draw do
|
|||
|
||||
draw(:api)
|
||||
|
||||
web_app_paths.each do |path|
|
||||
get path, to: 'home#index'
|
||||
end
|
||||
draw(:web_app)
|
||||
|
||||
get '/web/(*any)', to: redirect('/%{any}', status: 302), as: :web, defaults: { any: '' }, format: false
|
||||
get '/about', to: 'about#show'
|
||||
|
|
34
config/routes/web_app.rb
Normal file
34
config/routes/web_app.rb
Normal file
|
@ -0,0 +1,34 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Paths handled by the React application, which do not:
|
||||
# - Require indexing
|
||||
# - Have alternative format representations
|
||||
|
||||
%w(
|
||||
/blocks
|
||||
/bookmarks
|
||||
/conversations
|
||||
/deck/(*any)
|
||||
/directory
|
||||
/domain_blocks
|
||||
/explore/(*any)
|
||||
/favourites
|
||||
/follow_requests
|
||||
/followed_tags
|
||||
/getting-started
|
||||
/home
|
||||
/keyboard-shortcuts
|
||||
/links/(*any)
|
||||
/lists/(*any)
|
||||
/mutes
|
||||
/notifications_v2/(*any)
|
||||
/notifications/(*any)
|
||||
/pinned
|
||||
/public
|
||||
/public/local
|
||||
/public/remote
|
||||
/publish
|
||||
/search
|
||||
/start/(*any)
|
||||
/statuses/(*any)
|
||||
).each { |path| get path, to: 'home#index' }
|
Loading…
Reference in a new issue