mirror of
https://github.com/gedoor/legado.git
synced 2024-09-03 09:55:00 +08:00
优化
This commit is contained in:
parent
c1cd578e42
commit
a78cfffa11
@ -8,11 +8,10 @@ import com.bumptech.glide.load.data.DataFetcher
|
||||
import com.bumptech.glide.load.model.GlideUrl
|
||||
import com.bumptech.glide.util.ContentLengthInputStream
|
||||
import com.bumptech.glide.util.Preconditions
|
||||
import io.legado.app.constant.AppConst
|
||||
import io.legado.app.data.appDb
|
||||
import io.legado.app.exception.NoStackTraceException
|
||||
import io.legado.app.help.http.okHttpClient
|
||||
import io.legado.app.help.http.addHeaders
|
||||
import io.legado.app.help.http.okHttpClient
|
||||
import io.legado.app.utils.isWifiConnect
|
||||
import okhttp3.Call
|
||||
import okhttp3.Request
|
||||
@ -40,7 +39,9 @@ class OkHttpStreamFetcher(private val url: GlideUrl, private val options: Option
|
||||
}
|
||||
val requestBuilder: Request.Builder = Request.Builder().url(url.toStringUrl())
|
||||
val headerMap = HashMap<String, String>()
|
||||
|
||||
for ((key, value) in url.headers.entries) {
|
||||
headerMap[key] = value
|
||||
}
|
||||
options.get(OkHttpModelLoader.sourceOriginOption)?.let { sourceUrl ->
|
||||
val source = appDb.bookSourceDao.getBookSource(sourceUrl)
|
||||
?: appDb.rssSourceDao.getByKey(sourceUrl)
|
||||
@ -48,9 +49,6 @@ class OkHttpStreamFetcher(private val url: GlideUrl, private val options: Option
|
||||
headerMap.putAll(it)
|
||||
}
|
||||
}
|
||||
for ((key, value) in url.headers.entries) {
|
||||
headerMap.put(key, value)
|
||||
}
|
||||
requestBuilder.addHeaders(headerMap)
|
||||
val request: Request = requestBuilder.build()
|
||||
this.callback = callback
|
||||
|
Loading…
Reference in New Issue
Block a user