mirror of
https://github.com/gedoor/legado.git
synced 2025-01-08 11:47:32 +08:00
更新帮助文档;更新cacheFile
This commit is contained in:
parent
97bfb324e7
commit
a13ed0453b
@ -31,8 +31,21 @@
|
||||
|
||||
* 获取登录后的cookie
|
||||
```
|
||||
java.getCookie("http://baidu.com", null) => userid=1234;pwd=adbcd
|
||||
java.getCookie("http://baidu.com", "userid") => 1234
|
||||
获取全部
|
||||
cookie.getCookie(url)
|
||||
获取某一键值
|
||||
cookie.getKey(url,key)
|
||||
```
|
||||
|
||||
* 缓存网络文件
|
||||
```
|
||||
获取
|
||||
java.cacheFile(url)
|
||||
java.cacheFile(url,saveTime)
|
||||
执行内容
|
||||
eval(String(java.cacheFile(url)))
|
||||
删除缓存文件
|
||||
cache.delete(java.md5Encode16(url))
|
||||
```
|
||||
|
||||
* 请求头,支持http代理,socks4 socks5代理设置
|
||||
|
@ -139,8 +139,9 @@ interface JsExtensions {
|
||||
fun cacheFile(url: String, saveTime: Int = 0): String? {
|
||||
val key = md5Encode16(url)
|
||||
val _cache = CacheManager.get(key)
|
||||
val value = ajax(url) ?: ""
|
||||
if(_cache.isNullOrBlank()) {
|
||||
if(_cache.isNullOrBlank()) {
|
||||
log("首次下载${url}...")
|
||||
val value = ajax(url) ?: ""
|
||||
CacheManager.put(key, value as Any, saveTime)
|
||||
}
|
||||
return _cache
|
||||
|
Loading…
Reference in New Issue
Block a user