mirror of
https://github.com/discourse/discourse.git
synced 2025-06-02 16:29:32 +08:00
FEATURE: Add basic support for Safe Mode
In Safe Mode all JS extensions and site customizations are disabled. To access Safe Mode visit `sitename.org/safe-mode`
This commit is contained in:
20
app/controllers/safe_mode_controller.rb
Normal file
20
app/controllers/safe_mode_controller.rb
Normal file
@ -0,0 +1,20 @@
|
||||
class SafeModeController < ApplicationController
|
||||
layout 'no_ember'
|
||||
skip_before_filter :preload_json, :check_xhr
|
||||
|
||||
def index
|
||||
end
|
||||
|
||||
def enter
|
||||
safe_mode = []
|
||||
safe_mode << "no_custom" if params["no_customizations"] == "true"
|
||||
safe_mode << "no_plugins" if params["no_plugins"] == "true"
|
||||
safe_mode << "only_official" if params["only_official"] == "true"
|
||||
|
||||
if safe_mode.length > 0
|
||||
redirect_to path("/?safe_mode=#{safe_mode.join("%2C")}")
|
||||
else
|
||||
redirect_to :index
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user