diff --git a/omega-target-chromium-extension/background.coffee b/omega-target-chromium-extension/background.coffee index 4b86d65..d624860 100644 --- a/omega-target-chromium-extension/background.coffee +++ b/omega-target-chromium-extension/background.coffee @@ -175,6 +175,7 @@ options.watchProxyChange (details) -> return unless details notControllableBefore = options.proxyNotControllable() internal = false + noRevert = false switch details['levelOfControl'] when "controlled_by_other_extensions", "not_controllable" reason = @@ -183,6 +184,7 @@ options.watchProxyChange (details) -> else 'app' options.setProxyNotControllable(reason) + noRevert = true else options.setProxyNotControllable(null) @@ -200,7 +202,7 @@ options.watchProxyChange (details) -> clearTimeout(timeout) if timeout? parsed = null timeout = setTimeout (-> - options.setExternalProfile(parsed, {noRevert: true, internal: internal}) + options.setExternalProfile(parsed, {noRevert: noRevert, internal: internal}) ), 500 parsed = options.parseExternalProfile(details) diff --git a/omega-target/src/default_options.coffee b/omega-target/src/default_options.coffee index 6bae674..0d40a8e 100644 --- a/omega-target/src/default_options.coffee +++ b/omega-target/src/default_options.coffee @@ -4,7 +4,7 @@ module.exports = -> "-refreshOnProfileChange": true "-startupProfileName": "" "-quickSwitchProfiles": [] - "-revertProxyChanges": false + "-revertProxyChanges": true "-confirmDeletion": true "-showInspectMenu": true "-downloadInterval": 1440 diff --git a/omega-target/src/options.coffee b/omega-target/src/options.coffee index 39ea426..83fc92c 100644 --- a/omega-target/src/options.coffee +++ b/omega-target/src/options.coffee @@ -20,6 +20,7 @@ class Options _storage: null _state: null _currentProfileName: null + _revertToProfileName: null _watchingProfiles: {} _tempProfile: null _tempProfileRules: {} @@ -774,11 +775,14 @@ class Options # @returns {Promise} A promise which is fulfilled when the profile is set ### setExternalProfile: (profile, args) -> - if not args?.noRevert and @_options['-revertProxyChanges'] + if @_options['-revertProxyChanges'] and not @_isSystem if profile.name != @_currentProfileName and @_currentProfileName - if not @_isSystem - @applyProfile(@_currentProfileName) + if not args?.noRevert + @applyProfile(@_revertToProfileName) + @_revertToProfileName = null return + else + @_revertToProfileName ?= @_currentProfileName p = OmegaPac.Profiles.byName(profile.name, @_options) if p if args?.internal