Skip to content

Commit d9aee3a

Browse files
committed
Fix HTTPS crashes... hopefully.
1 parent 2159fcc commit d9aee3a

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

app/src/main/java/com/craftworks/music/providers/navidrome/CheckNavidromeURL.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ fun checkNavidromeURL(navidromeUrl: String, username: String, password: String):
3030

3131
with(statusUrl.openConnection() as HttpURLConnection) {
3232
requestMethod = "GET" // optional default is GET
33-
34-
33+
instanceFollowRedirects = true
3534
Log.d("GET", "\nSent 'GET' request to URL : $url; Response Code : $responseCode")
3635

3736
if (responseCode == 404){
@@ -45,6 +44,7 @@ fun checkNavidromeURL(navidromeUrl: String, username: String, password: String):
4544
}
4645
}
4746

47+
4848
} catch (e: Exception) {
4949
Log.d("NAVIDROME", "Unknown Error.")
5050
navidromeStatus.value = "Invalid URL"

app/src/main/java/com/craftworks/music/ui/elements/dialogs/ProviderDialogs.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,13 @@ fun CreateMediaProviderDialog(setShowDialog: (Boolean) -> Unit, context: Context
244244
try {
245245
username = username.trim()
246246
password = password.trim()
247+
if (url.startsWith("https")){
248+
url = url.removeSuffix("/").trim() + ":443"
249+
}
247250
//saveManager(context).saveSettings()
248251
if (checkNavidromeURL(url, username, password)) {
249252
val server = NavidromeProvider(
250-
url.removeSuffix("/"),
253+
url,
251254
username,
252255
password
253256
)

0 commit comments

Comments
 (0)