js添加cache变量,可以用来存储token之类的变量,可以设置时效

pull/487/head^2
gedoor 4 years ago
parent dc58cc7672
commit 946c08e21f
  1. 4
      app/src/main/assets/updateLog.md
  2. 1
      app/src/main/java/io/legado/app/help/CacheManager.kt

@ -6,7 +6,9 @@
**2020/11/18** **2020/11/18**
* 优化导航栏 * 优化导航栏
* js添加java.log(msg: String)用于调试时输出消息 * js添加java.log(msg: String)用于调试时输出消息
* js添加cookie对象,可用方法见io.legado.app.help.http.api.CookieManager * js添加cookie变量,方法见io.legado.app.help.http.api.CookieManager
* js添加cache变量,可以用来存储token之类的临时值,可以设置保存时间,方法见io.legado.app.help.CacheManager
* 需要token的网站可以用js来写了,比如阿里tts
**2020/11/16** **2020/11/16**
* 修复导出添加替换净化引起的bug * 修复导出添加替换净化引起的bug

@ -5,6 +5,7 @@ import io.legado.app.data.entities.Cache
object CacheManager { object CacheManager {
@JvmOverloads
fun put(key: String, value: Any, saveTime: Int = 0) { fun put(key: String, value: Any, saveTime: Int = 0) {
val deadline = if (saveTime == 0) 0 else System.currentTimeMillis() + saveTime * 1000 val deadline = if (saveTime == 0) 0 else System.currentTimeMillis() + saveTime * 1000
val cache = Cache(key, value.toString(), deadline) val cache = Cache(key, value.toString(), deadline)

Loading…
Cancel
Save