Fix #798: Migrate SkipSSLVerify setting to per-server
This commit is contained in:
+19
-7
@@ -16,11 +16,12 @@ const (
|
||||
)
|
||||
|
||||
type ServerConnection struct {
|
||||
ServerType ServerType
|
||||
Hostname string
|
||||
AltHostname string
|
||||
Username string
|
||||
LegacyAuth bool
|
||||
ServerType ServerType
|
||||
Hostname string
|
||||
AltHostname string
|
||||
Username string
|
||||
LegacyAuth bool
|
||||
SkipSSLVerify bool
|
||||
}
|
||||
|
||||
type ServerConfig struct {
|
||||
@@ -50,7 +51,7 @@ type AppConfig struct {
|
||||
EnableLrcLib bool
|
||||
CustomLrcLibUrl string
|
||||
EnablePasswordStorage bool
|
||||
SkipSSLVerify bool
|
||||
SkipSSLVerify bool // Deprecated: use per-server SkipSSLVerify. Drop in future version.
|
||||
EnqueueBatchSize int
|
||||
Language string
|
||||
DisableDPIDetection bool
|
||||
@@ -212,7 +213,6 @@ func DefaultConfig(appVersionTag string) *Config {
|
||||
ShowTrackChangeNotification: false,
|
||||
EnableLrcLib: true,
|
||||
EnablePasswordStorage: true,
|
||||
SkipSSLVerify: false,
|
||||
EnqueueBatchSize: 100,
|
||||
Language: "auto",
|
||||
EnableAutoUpdateChecker: true,
|
||||
@@ -311,6 +311,7 @@ func ReadConfigFile(filepath, appVersionTag string) (*Config, error) {
|
||||
if err := toml.NewDecoder(f).Decode(c); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
c.migrateDeprecatedSettings()
|
||||
|
||||
// Backfill Subsonic to empty ServerType fields
|
||||
// for updating configs created before multiple MediaProviders were added
|
||||
@@ -331,6 +332,8 @@ func (c *Config) WriteConfigFile(filepath string) error {
|
||||
}
|
||||
defer writeLock.Unlock()
|
||||
|
||||
// clear deprecated global SkipSSLVerify after migrating to per-server settings
|
||||
c.Application.SkipSSLVerify = false
|
||||
b, err := toml.Marshal(c)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -339,3 +342,12 @@ func (c *Config) WriteConfigFile(filepath string) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Config) migrateDeprecatedSettings() {
|
||||
// Migrate deprecated global SkipSSLVerify to per-server settings
|
||||
if c.Application.SkipSSLVerify {
|
||||
for _, s := range c.Servers {
|
||||
s.SkipSSLVerify = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user