mirror of
https://github.com/GrakovNe/lissen-android.git
synced 2025-12-23 14:08:36 -05:00
This commit is contained in:
@@ -53,8 +53,8 @@ android {
|
||||
applicationId = "org.grakovne.lissen"
|
||||
minSdk = 28
|
||||
targetSdk = 36
|
||||
versionCode = 10714
|
||||
versionName = "1.7.14-$commitHash"
|
||||
versionCode = 10800
|
||||
versionName = "1.8.0-$commitHash"
|
||||
|
||||
buildConfigField("String", "GIT_HASH", "\"$commitHash\"")
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.grakovne.lissen.channel.common
|
||||
import com.squareup.moshi.Moshi
|
||||
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
|
||||
import org.grakovne.lissen.lib.domain.connection.ServerRequestHeader
|
||||
import org.grakovne.lissen.lib.domain.fixUriScheme
|
||||
import org.grakovne.lissen.persistence.preferences.LissenSharedPreferences
|
||||
import retrofit2.Retrofit
|
||||
import retrofit2.converter.moshi.MoshiConverterFactory
|
||||
@@ -17,7 +18,7 @@ class ApiClient(
|
||||
val retrofit: Retrofit =
|
||||
Retrofit
|
||||
.Builder()
|
||||
.baseUrl(host)
|
||||
.baseUrl(host.fixUriScheme())
|
||||
.client(httpClient)
|
||||
.addConverterFactory(MoshiConverterFactory.create(moshi))
|
||||
.build()
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
package org.grakovne.lissen.lib.domain
|
||||
|
||||
fun String.fixUriScheme() = when (this.startsWith("http://") || this.startsWith("https://")) {
|
||||
true -> this
|
||||
false -> "http://$this"
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package org.grakovne.lissen.lib.domain.connection
|
||||
|
||||
import androidx.annotation.Keep
|
||||
import com.squareup.moshi.JsonClass
|
||||
import org.grakovne.lissen.lib.domain.fixUriScheme
|
||||
import java.net.URI
|
||||
import java.util.UUID
|
||||
|
||||
@@ -34,12 +35,7 @@ data class LocalUrl(
|
||||
return this
|
||||
.filter { validCharacters.matches(it.toString()) }
|
||||
.trim()
|
||||
.let {
|
||||
when (it.startsWith("http://") || it.startsWith("https://")) {
|
||||
true -> it
|
||||
false -> "http://$it"
|
||||
}
|
||||
}
|
||||
.fixUriScheme()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user