mirror of
https://github.com/gedoor/legado.git
synced 2024-09-03 09:55:00 +08:00
fix: 特定情况下登录UI无法保存登录状态
数据库中存在cookie,登录头也有cookie,后者会被前者覆盖
This commit is contained in:
parent
d79b5e8139
commit
39f368817b
@ -95,11 +95,17 @@ interface BaseSource : JsExtensions {
|
||||
* 保存登录头部信息,map格式,访问时自动添加
|
||||
*/
|
||||
fun putLoginHeader(header: String) {
|
||||
val headerMap = GSON.fromJsonObject<Map<String, String>>(header).getOrNull()
|
||||
val cookie = headerMap?.get("Cookie") ?: headerMap?.get("cookie")
|
||||
cookie?.let {
|
||||
CookieStore.replaceCookie(getKey(), it)
|
||||
}
|
||||
CacheManager.put("loginHeader_${getKey()}", header)
|
||||
}
|
||||
|
||||
fun removeLoginHeader() {
|
||||
CacheManager.delete("loginHeader_${getKey()}")
|
||||
CookieStore.removeCookie(getKey())
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user