优化
This commit is contained in:
@@ -5,8 +5,8 @@ package io.legado.app.help.http
|
|||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
import io.legado.app.data.appDb
|
import io.legado.app.data.appDb
|
||||||
import io.legado.app.data.entities.Cookie
|
import io.legado.app.data.entities.Cookie
|
||||||
import io.legado.app.help.http.api.CookieManager
|
|
||||||
import io.legado.app.help.CacheManager
|
import io.legado.app.help.CacheManager
|
||||||
|
import io.legado.app.help.http.api.CookieManager
|
||||||
import io.legado.app.utils.NetworkUtils
|
import io.legado.app.utils.NetworkUtils
|
||||||
|
|
||||||
object CookieStore : CookieManager {
|
object CookieStore : CookieManager {
|
||||||
@@ -44,7 +44,7 @@ object CookieStore : CookieManager {
|
|||||||
CacheManager.getFromMemory("${domain}_cookie")?.let { return it }
|
CacheManager.getFromMemory("${domain}_cookie")?.let { return it }
|
||||||
val cookieBean = appDb.cookieDao.get(domain)
|
val cookieBean = appDb.cookieDao.get(domain)
|
||||||
val cookie = cookieBean?.cookie ?: ""
|
val cookie = cookieBean?.cookie ?: ""
|
||||||
CacheManager.putMemory(url, cookie ?: "")
|
CacheManager.putMemory(url, cookie)
|
||||||
return cookie
|
return cookie
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -528,8 +528,7 @@ class AnalyzeUrl(
|
|||||||
val cookieMap = CookieStore.cookieToMap(cookie)
|
val cookieMap = CookieStore.cookieToMap(cookie)
|
||||||
val customCookieMap = CookieStore.cookieToMap(headerMap["Cookie"] ?: "")
|
val customCookieMap = CookieStore.cookieToMap(headerMap["Cookie"] ?: "")
|
||||||
cookieMap.putAll(customCookieMap)
|
cookieMap.putAll(customCookieMap)
|
||||||
val newCookie = CookieStore.mapToCookie(cookieMap)
|
CookieStore.mapToCookie(cookieMap)?.let {
|
||||||
newCookie?.let {
|
|
||||||
headerMap.put("Cookie", it)
|
headerMap.put("Cookie", it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user