Release 2.7.3.3: dark theme and Amnezia vpn:// import fixes.
This commit is contained in:
@@ -90,7 +90,17 @@ func (c *Config) UpsertProfile(name, proxy string) error {
|
||||
}
|
||||
|
||||
// UpsertProfileWithProtocol creates/updates a profile and optionally sets protocol.
|
||||
// The upserted profile becomes Active.
|
||||
func (c *Config) UpsertProfileWithProtocol(name, proxy string, proto Protocol) error {
|
||||
return c.upsertProfile(name, proxy, proto, true)
|
||||
}
|
||||
|
||||
// UpsertProfileKeepActive creates/updates a profile without changing Active.
|
||||
func (c *Config) UpsertProfileKeepActive(name, proxy string, proto Protocol) error {
|
||||
return c.upsertProfile(name, proxy, proto, false)
|
||||
}
|
||||
|
||||
func (c *Config) upsertProfile(name, proxy string, proto Protocol, activate bool) error {
|
||||
name = strings.TrimSpace(name)
|
||||
if name == "" {
|
||||
return fmt.Errorf("имя профиля пустое")
|
||||
@@ -110,7 +120,9 @@ func (c *Config) UpsertProfileWithProtocol(name, proxy string, proto Protocol) e
|
||||
if len(c.Profiles[i].Listen) == 0 {
|
||||
c.Profiles[i].Listen = defaultListen()
|
||||
}
|
||||
c.Active = name
|
||||
if activate {
|
||||
c.Active = name
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@@ -121,7 +133,9 @@ func (c *Config) UpsertProfileWithProtocol(name, proxy string, proto Protocol) e
|
||||
Proxy: proxy,
|
||||
Listen: defaultListen(),
|
||||
})
|
||||
c.Active = name
|
||||
if activate {
|
||||
c.Active = name
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user