mirror of
https://github.com/zero-peak/ZeroOmega.git
synced 2025-01-22 15:08:12 -05:00
Fix a few issues related to upgrading.
This commit is contained in:
parent
d8d54f4b43
commit
17427ae13f
@ -3,6 +3,9 @@ Revision =
|
|||||||
time = if time then new Date(time) else new Date()
|
time = if time then new Date(time) else new Date()
|
||||||
return time.getTime().toString(16)
|
return time.getTime().toString(16)
|
||||||
compare: (a, b) ->
|
compare: (a, b) ->
|
||||||
|
return 0 if not a and not b
|
||||||
|
return -1 if not a
|
||||||
|
return 1 if not b
|
||||||
return 1 if a.length > b.length
|
return 1 if a.length > b.length
|
||||||
return -1 if a.length < b.length
|
return -1 if a.length < b.length
|
||||||
return 1 if a > b
|
return 1 if a > b
|
||||||
|
@ -27,14 +27,15 @@ module.exports = class SwitchySharp
|
|||||||
if @_monitorTimerId
|
if @_monitorTimerId
|
||||||
clearInterval @_monitorTimerId
|
clearInterval @_monitorTimerId
|
||||||
@_monitorTimerId = null
|
@_monitorTimerId = null
|
||||||
if @_getOptionsResolver
|
|
||||||
@port.postMessage({action: 'getOptions'})
|
|
||||||
switch msg?.action
|
switch msg?.action
|
||||||
when 'state'
|
when 'state'
|
||||||
# State changed.
|
# State changed.
|
||||||
OmegaTarget.Log.log(msg)
|
OmegaTarget.Log.log(msg)
|
||||||
|
if @_getOptionsResolver
|
||||||
|
@port.postMessage({action: 'getOptions'})
|
||||||
when 'options'
|
when 'options'
|
||||||
@_getOptionsResolver?(msg.options)
|
@_getOptionsResolver?(msg.options)
|
||||||
|
@_getOptionsResolver = null
|
||||||
|
|
||||||
_onDisconnect: (msg) ->
|
_onDisconnect: (msg) ->
|
||||||
@port = null
|
@port = null
|
||||||
|
@ -48,6 +48,7 @@ module.exports = (oldOptions, i18n) ->
|
|||||||
'purple': '#d497ee'
|
'purple': '#d497ee'
|
||||||
'': '#99ccee'
|
'': '#99ccee'
|
||||||
|
|
||||||
|
seenFixedProfile = false
|
||||||
for own _, oldProfile of oldProfiles
|
for own _, oldProfile of oldProfiles
|
||||||
profile = null
|
profile = null
|
||||||
switch oldProfile['proxyMode']
|
switch oldProfile['proxyMode']
|
||||||
@ -64,6 +65,7 @@ module.exports = (oldOptions, i18n) ->
|
|||||||
else
|
else
|
||||||
profile.pacUrl = url
|
profile.pacUrl = url
|
||||||
when 'manual'
|
when 'manual'
|
||||||
|
seenFixedProfile = true
|
||||||
profile = OmegaPac.Profiles.create(
|
profile = OmegaPac.Profiles.create(
|
||||||
profileType: 'FixedProfile'
|
profileType: 'FixedProfile'
|
||||||
)
|
)
|
||||||
@ -116,6 +118,21 @@ module.exports = (oldOptions, i18n) ->
|
|||||||
OmegaPac.Profiles.updateRevision(profile)
|
OmegaPac.Profiles.updateRevision(profile)
|
||||||
options[OmegaPac.Profiles.nameAsKey(profile.name)] = profile
|
options[OmegaPac.Profiles.nameAsKey(profile.name)] = profile
|
||||||
|
|
||||||
|
if not seenFixedProfile
|
||||||
|
exampleFixedProfileName = 'Example Profile'
|
||||||
|
options[OmegaPac.Profiles.nameAsKey(exampleFixedProfileName)] =
|
||||||
|
bypassList: [
|
||||||
|
pattern: "<local>"
|
||||||
|
conditionType: "BypassCondition"
|
||||||
|
]
|
||||||
|
profileType: "FixedProfile"
|
||||||
|
name: exampleFixedProfileName
|
||||||
|
color: "#99ccee"
|
||||||
|
fallbackProxy:
|
||||||
|
port: 8080
|
||||||
|
scheme: "http"
|
||||||
|
host: "proxy.example.com"
|
||||||
|
|
||||||
startupId = config['startupProfileId']
|
startupId = config['startupProfileId']
|
||||||
options['-startupProfileName'] = nameMap[startupId] || ''
|
options['-startupProfileName'] = nameMap[startupId] || ''
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user