Merge remote-tracking branch 'origin/develop' into media3-flat

This commit is contained in:
tzugen 2022-05-30 16:11:59 +02:00
commit 669b51c0d2
No known key found for this signature in database
GPG Key ID: 61E9C34BC10EC930
2 changed files with 14 additions and 2 deletions

View File

@ -8,6 +8,7 @@ import java.security.cert.X509Certificate
import java.util.concurrent.TimeUnit.MILLISECONDS
import javax.net.ssl.SSLContext
import javax.net.ssl.X509TrustManager
import okhttp3.Credentials
import okhttp3.OkHttpClient
import okhttp3.ResponseBody
import okhttp3.logging.HttpLoggingInterceptor
@ -73,7 +74,19 @@ class SubsonicAPIClient(
.addQueryParameter("c", config.clientID)
.addQueryParameter("f", "json")
.build()
chain.proceed(originalRequest.newBuilder().url(newUrl).build())
val newRequestBuilder = originalRequest.newBuilder().url(newUrl)
if (originalRequest.url.username.isNotEmpty() &&
originalRequest.url.password.isNotEmpty()
) {
newRequestBuilder.addHeader(
"Authorization",
Credentials.basic(
originalRequest.url.username,
originalRequest.url.password
)
)
}
chain.proceed(newRequestBuilder.build())
}
.addInterceptor(versionInterceptor)
.addInterceptor(proxyPasswordInterceptor)

View File

@ -298,7 +298,6 @@ class EditServerFragment : Fragment(), OnBackPressedHandler {
url = URL(urlString)
if (
urlString != urlString.trim(' ') ||
urlString.contains("@") ||
url.host.isNullOrBlank()
) {
throw MalformedURLException()