From 1616cfd0c4196b298fd5699621f17e07e68de768 Mon Sep 17 00:00:00 2001 From: Thijn Geurts Date: Thu, 8 Feb 2024 14:27:12 +0100 Subject: [PATCH] fix: Automatically prepend https for Overseerr, Sonarr and Radarr when choosing port 443 --- ui/src/components/Settings/Overseerr/index.tsx | 5 ++++- ui/src/components/Settings/Radarr/index.tsx | 6 ++++-- ui/src/components/Settings/Sonarr/index.tsx | 6 ++++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/ui/src/components/Settings/Overseerr/index.tsx b/ui/src/components/Settings/Overseerr/index.tsx index d977966f..39c3a273 100644 --- a/ui/src/components/Settings/Overseerr/index.tsx +++ b/ui/src/components/Settings/Overseerr/index.tsx @@ -79,7 +79,10 @@ const OverseerrSettings = () => { ? hostnameRef.current.value : hostnameRef.current.value.includes('https://') ? hostnameRef.current.value - : 'http://' + hostnameRef.current.value + : portRef.current.value == '443' + ? 'https://' + hostnameRef.current.value + : 'http://' + hostnameRef.current.value + const payload = { overseerr_url: addPortToUrl(hostnameVal, +portRef.current.value), overseerr_api_key: apiKeyRef.current.value, diff --git a/ui/src/components/Settings/Radarr/index.tsx b/ui/src/components/Settings/Radarr/index.tsx index 88fff991..42b18f0f 100644 --- a/ui/src/components/Settings/Radarr/index.tsx +++ b/ui/src/components/Settings/Radarr/index.tsx @@ -74,10 +74,12 @@ const RadarrSettings = () => { portRef.current?.value && apiKeyRef.current?.value ) { - const hostnameVal = hostnameRef.current.value.includes('http') + const hostnameVal = hostnameRef.current.value.includes('http://') ? hostnameRef.current.value - : hostnameRef.current.value.includes('https') + : hostnameRef.current.value.includes('https://') ? hostnameRef.current.value + : portRef.current.value == '443' ? + 'https://' + hostnameRef.current.value : 'http://' + hostnameRef.current.value let radarr_url = `${addPortToUrl(hostnameVal, +portRef.current.value)}` diff --git a/ui/src/components/Settings/Sonarr/index.tsx b/ui/src/components/Settings/Sonarr/index.tsx index 117d5f55..0e0c87b6 100644 --- a/ui/src/components/Settings/Sonarr/index.tsx +++ b/ui/src/components/Settings/Sonarr/index.tsx @@ -74,10 +74,12 @@ const SonarrSettings = () => { portRef.current?.value && apiKeyRef.current?.value ) { - const hostnameVal = hostnameRef.current.value.includes('http') + const hostnameVal = hostnameRef.current.value.includes('http://') ? hostnameRef.current.value - : hostnameRef.current.value.includes('https') + : hostnameRef.current.value.includes('https://') ? hostnameRef.current.value + : portRef.current.value == '443' + ? 'https://' + hostnameRef.current.value : 'http://' + hostnameRef.current.value let url = `${addPortToUrl(hostnameVal, +portRef.current.value)}`