mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-04 19:34:35 -05:00
Improve Http Client Configuration (#786)
* Improve Http Client Configuration * Lint
This commit is contained in:
@@ -14,6 +14,7 @@ import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.source.model.UpdateStrategy
|
||||
import eu.kanade.tachiyomi.source.online.HttpSource
|
||||
import mu.KotlinLogging
|
||||
import okhttp3.CacheControl
|
||||
import org.jetbrains.exposed.sql.ResultRow
|
||||
import org.jetbrains.exposed.sql.SortOrder
|
||||
import org.jetbrains.exposed.sql.and
|
||||
@@ -280,7 +281,7 @@ object Manga {
|
||||
}
|
||||
|
||||
source.client.newCall(
|
||||
GET(thumbnailUrl, source.headers),
|
||||
GET(thumbnailUrl, source.headers, cache = CacheControl.FORCE_NETWORK),
|
||||
).await()
|
||||
}
|
||||
|
||||
@@ -306,7 +307,7 @@ object Manga {
|
||||
mangaEntry[MangaTable.thumbnail_url]
|
||||
?: throw NullPointerException("No thumbnail found")
|
||||
network.client.newCall(
|
||||
GET(thumbnailUrl),
|
||||
GET(thumbnailUrl, cache = CacheControl.FORCE_NETWORK),
|
||||
).await()
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import eu.kanade.tachiyomi.source.CatalogueSource
|
||||
import eu.kanade.tachiyomi.source.Source
|
||||
import eu.kanade.tachiyomi.source.SourceFactory
|
||||
import mu.KotlinLogging
|
||||
import okhttp3.Request
|
||||
import okhttp3.CacheControl
|
||||
import okio.buffer
|
||||
import okio.sink
|
||||
import okio.source
|
||||
@@ -272,8 +272,10 @@ object Extension {
|
||||
url: String,
|
||||
savePath: String,
|
||||
) {
|
||||
val request = Request.Builder().url(url).build()
|
||||
val response = network.client.newCall(request).await()
|
||||
val response =
|
||||
network.client.newCall(
|
||||
GET(url, cache = CacheControl.FORCE_NETWORK),
|
||||
).await()
|
||||
|
||||
val downloadedFile = File(savePath)
|
||||
downloadedFile.sink().buffer().use { sink ->
|
||||
@@ -350,7 +352,7 @@ object Extension {
|
||||
|
||||
return getImageResponse(cacheSaveDir, apkName) {
|
||||
network.client.newCall(
|
||||
GET(iconUrl),
|
||||
GET(iconUrl, cache = CacheControl.FORCE_NETWORK),
|
||||
).await()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user