possible a good fix

This commit is contained in:
simon
2024-09-15 12:49:47 +02:00
parent 1fe1438ecf
commit 39880a6214
2 changed files with 38 additions and 0 deletions

17
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,17 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}\\index"
}
]
}

View File

@@ -44,6 +44,27 @@ const Login: React.FC = () => {
useEffect(() => {
(async () => {
// add a test that checks if the url contains http/https
if (_apiUrl.startsWith("http") || _apiUrl.startsWith("https")) {
{
setServer({
address: _apiUrl,
});
}
} else {
//check if url requires ssl
// use curl to see if https is required
// if not use http
// if yes use https
const test = fetch("http://jellyfin.oakgrove.site/web/#/home.html")
.then((response) => console.log(response))
.catch((error) => console.error(error));
const test2 = fetch("https://jellyfin.oakgrove.site/web/#/home.html")
.then((response) => console.log(response))
.catch((error) => console.error(error));
}
if (_apiUrl) {
setServer({
address: _apiUrl,