feat(komga): ignore dns over https (#6335)

This commit is contained in:
Gauthier 2021-03-29 19:04:40 +08:00 committed by GitHub
parent 21cf5dac2d
commit 7655bf6483
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 112 additions and 101 deletions

View File

@ -1,3 +1,11 @@
## 1.2.23
Minimum Komga version required: `0.75.0`
### Features
* ignore DNS over HTTPS so it can reach IP addresses
## 1.2.22
Minimum Komga version required: `0.75.0`

View File

@ -5,13 +5,13 @@ ext {
extName = 'Komga'
pkgNameSuffix = 'all.komga'
extClass = '.KomgaFactory'
extVersionCode = 22
extVersionCode = 23
libVersion = '1.2'
}
dependencies {
implementation 'io.reactivex:rxandroid:1.2.1'
implementation 'io.reactivex:rxjava:1.3.6'
implementation 'io.reactivex:rxjava:1.3.8'
}
apply from: "$rootDir/common.gradle"

View File

@ -28,6 +28,7 @@ import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.online.HttpSource
import okhttp3.Credentials
import okhttp3.Dns
import okhttp3.Headers
import okhttp3.HttpUrl
import okhttp3.OkHttpClient
@ -336,6 +337,7 @@ open class Komga(suffix: String = "") : ConfigurableSource, HttpSource() {
override val name = "Komga${if (suffix.isNotBlank()) " ($suffix)" else ""}"
override val lang = "en"
override val supportsLatest = true
private val LOG_TAG = "extension.all.komga${if (suffix.isNotBlank()) ".$suffix" else ""}"
override val baseUrl by lazy { getPrefBaseUrl() }
private val username by lazy { getPrefUsername() }
@ -361,6 +363,7 @@ open class Komga(suffix: String = "") : ConfigurableSource, HttpSource() {
.build()
}
}
.dns(Dns.SYSTEM) // don't use DNS over HTTPS as it breaks IP addressing
.build()
override fun setupPreferenceScreen(screen: androidx.preference.PreferenceScreen) {
@ -428,6 +431,7 @@ open class Komga(suffix: String = "") : ConfigurableSource, HttpSource() {
private fun getPrefPassword(): String = preferences.getString(PASSWORD_TITLE, PASSWORD_DEFAULT)!!
init {
if (baseUrl.isNotBlank()) {
Single.fromCallable {
client.newCall(GET("$baseUrl/api/v1/libraries", headers)).execute()
}
@ -537,6 +541,7 @@ open class Komga(suffix: String = "") : ConfigurableSource, HttpSource() {
}
)
}
}
companion object {
private const val ADDRESS_TITLE = "Address"
@ -550,7 +555,5 @@ open class Komga(suffix: String = "") : ConfigurableSource, HttpSource() {
private const val TYPE_SERIES = "Series"
private const val TYPE_READLISTS = "Read lists"
private const val LOG_TAG = "extension.all.komga"
}
}