mirror of
https://github.com/glitch-soc/mastodon.git
synced 2024-11-30 03:50:13 -05:00
This is a better way of detecting frontends
This commit is contained in:
parent
ed82421870
commit
da2b6dda6a
@ -9,7 +9,7 @@ class HomeController < ApplicationController
|
||||
@web_settings = Web::Setting.find_by(user: current_user)&.data || {}
|
||||
@admin = Account.find_local(Setting.site_contact_username)
|
||||
@streaming_api_base_url = Rails.configuration.x.streaming_api_base_url
|
||||
@frontend = (params[:frontend] and Rails.root.join('app', 'javascript', 'packs', 'frontends', '#{params[:frontend]}.js')) ? params[:frontend] : 'mastodon'
|
||||
@frontend = (params[:frontend] and Rails.configuration.x.available_frontends.include? params[:frontend] + '.js') ? params[:frontend] : 'mastodon'
|
||||
end
|
||||
|
||||
private
|
||||
|
7
config/initializers/frontends.rb
Normal file
7
config/initializers/frontends.rb
Normal file
@ -0,0 +1,7 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
Rails.application.configure do
|
||||
frontends = []
|
||||
Rails.root.join('app', 'javascript', 'packs', 'frontends').each_child(false) { |f| frontends.push f.to_s }
|
||||
config.x.available_frontends = frontends
|
||||
end
|
Loading…
Reference in New Issue
Block a user