|
|
@ -27,12 +27,10 @@ val cookieJar by lazy { |
|
|
|
if (cookies.isEmpty()) return |
|
|
|
if (cookies.isEmpty()) return |
|
|
|
//临时保存 书源启用cookie选项再添加到数据库 |
|
|
|
//临时保存 书源启用cookie选项再添加到数据库 |
|
|
|
val cookieBuilder = StringBuilder() |
|
|
|
val cookieBuilder = StringBuilder() |
|
|
|
cookies.forEach { |
|
|
|
cookies.forEachIndexed { index, cookie -> |
|
|
|
if (it.value != "") { |
|
|
|
if (index > 0) cookieBuilder.append("; ") |
|
|
|
cookieBuilder.append(it.name).append("=").append(it.value).append(";") |
|
|
|
cookieBuilder.append(cookie.name).append('=').append(cookie.value) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
cookieBuilder.deleteCharAt(cookieBuilder.lastIndexOf(";")) |
|
|
|
|
|
|
|
val domain = NetworkUtils.getSubDomain(url.toString()) |
|
|
|
val domain = NetworkUtils.getSubDomain(url.toString()) |
|
|
|
CacheManager.putMemory("${domain}_cookieJar", cookieBuilder.toString()) |
|
|
|
CacheManager.putMemory("${domain}_cookieJar", cookieBuilder.toString()) |
|
|
|
} |
|
|
|
} |
|
|
|