add cfg file setting to skip SSL verification

This commit is contained in:
Drew Weymouth
2024-07-28 08:22:07 -07:00
parent c3d3cf92a7
commit 1f8e8d2936
2 changed files with 15 additions and 0 deletions
+13
View File
@@ -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},
}
}
}