add cfg file setting to skip SSL verification
This commit is contained in:
@@ -46,6 +46,7 @@ type AppConfig struct {
|
||||
DefaultPlaylistID string
|
||||
ShowTrackChangeNotification bool
|
||||
EnableLrcLib bool
|
||||
SkipSSLVerify bool
|
||||
|
||||
// Experimental - may be removed in future
|
||||
FontNormalTTF string
|
||||
@@ -170,6 +171,7 @@ func DefaultConfig(appVersionTag string) *Config {
|
||||
SaveQueueToServer: false,
|
||||
ShowTrackChangeNotification: false,
|
||||
EnableLrcLib: true,
|
||||
SkipSSLVerify: false,
|
||||
},
|
||||
AlbumPage: AlbumPageConfig{
|
||||
TracklistColumns: []string{"Artist", "Time", "Plays", "Favorite", "Rating"},
|
||||
|
||||
@@ -2,6 +2,7 @@ package backend
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"errors"
|
||||
"log"
|
||||
"net/http"
|
||||
@@ -176,6 +177,7 @@ func (s *ServerManager) connect(connection ServerConnection, password string) (m
|
||||
log.Printf("error creating Jellyfin client: %s", err.Error())
|
||||
return nil, err
|
||||
}
|
||||
s.checkSetInsecureSkipVerify(client.HTTPClient)
|
||||
cli = &jellyfinMP.JellyfinServer{
|
||||
Client: *client,
|
||||
}
|
||||
@@ -186,6 +188,7 @@ func (s *ServerManager) connect(connection ServerConnection, password string) (m
|
||||
log.Printf("error creating Jellyfin alternative client: %s", err.Error())
|
||||
return nil, err
|
||||
}
|
||||
s.checkSetInsecureSkipVerify(altClient.HTTPClient)
|
||||
altCli = &jellyfinMP.JellyfinServer{
|
||||
Client: *altClient,
|
||||
}
|
||||
@@ -200,6 +203,7 @@ func (s *ServerManager) connect(connection ServerConnection, password string) (m
|
||||
ClientName: res.AppName,
|
||||
},
|
||||
}
|
||||
s.checkSetInsecureSkipVerify(cli.(*subsonicMP.SubsonicServer).Client.Client)
|
||||
altCli = &subsonicMP.SubsonicServer{
|
||||
Client: subsonic.Client{
|
||||
Client: &http.Client{Timeout: 10 * time.Second},
|
||||
@@ -209,6 +213,7 @@ func (s *ServerManager) connect(connection ServerConnection, password string) (m
|
||||
ClientName: res.AppName,
|
||||
},
|
||||
}
|
||||
s.checkSetInsecureSkipVerify(altCli.(*subsonicMP.SubsonicServer).Client.Client)
|
||||
}
|
||||
var authError error
|
||||
pingChan := make(chan bool, 2) // false for primary hostname, true for alternate
|
||||
@@ -238,3 +243,11 @@ func (s *ServerManager) connect(connection ServerConnection, password string) (m
|
||||
return cli, authError
|
||||
}
|
||||
}
|
||||
|
||||
func (s *ServerManager) checkSetInsecureSkipVerify(cli *http.Client) {
|
||||
if s.config.Application.SkipSSLVerify {
|
||||
cli.Transport = &http.Transport{
|
||||
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user