diff --git a/app/src/main/java/io/legado/app/help/glide/GlideHeaders.kt b/app/src/main/java/io/legado/app/help/glide/GlideHeaders.kt new file mode 100644 index 000000000..a488c61f7 --- /dev/null +++ b/app/src/main/java/io/legado/app/help/glide/GlideHeaders.kt @@ -0,0 +1,11 @@ +package io.legado.app.help.glide + +import com.bumptech.glide.load.model.Headers + +class GlideHeaders(private val headers: MutableMap) : Headers { + + override fun getHeaders(): MutableMap { + return headers + } + +} \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt index 65b36ee37..2802921d5 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt @@ -4,7 +4,6 @@ import android.annotation.SuppressLint import android.util.Base64 import androidx.annotation.Keep import com.bumptech.glide.load.model.GlideUrl -import com.bumptech.glide.load.model.LazyHeaders import com.script.SimpleBindings import io.legado.app.constant.AppConst.SCRIPT_ENGINE import io.legado.app.constant.AppConst.UA_NAME @@ -17,6 +16,7 @@ import io.legado.app.exception.ConcurrentException import io.legado.app.help.CacheManager import io.legado.app.help.JsExtensions import io.legado.app.help.config.AppConfig +import io.legado.app.help.glide.GlideHeaders import io.legado.app.help.http.* import io.legado.app.utils.* import kotlinx.coroutines.runBlocking @@ -540,13 +540,7 @@ class AnalyzeUrl( */ fun getGlideUrl(): GlideUrl { setCookie(source?.getKey()) - val headers = LazyHeaders.Builder() - //删除glide默认ua - headers.setHeader(UA_NAME, null as String?) - headerMap.forEach { (key, value) -> - headers.addHeader(key, value) - } - return GlideUrl(url, headers.build()) + return GlideUrl(url, GlideHeaders(headerMap)) } fun getUserAgent(): String {