|
|
@ -3,11 +3,11 @@ package io.legado.app.help |
|
|
|
import android.net.Uri |
|
|
|
import android.net.Uri |
|
|
|
import android.util.Base64 |
|
|
|
import android.util.Base64 |
|
|
|
import androidx.annotation.Keep |
|
|
|
import androidx.annotation.Keep |
|
|
|
|
|
|
|
import cn.hutool.core.util.HexUtil |
|
|
|
|
|
|
|
import cn.hutool.crypto.SecureUtil |
|
|
|
import cn.hutool.crypto.digest.DigestUtil |
|
|
|
import cn.hutool.crypto.digest.DigestUtil |
|
|
|
import cn.hutool.crypto.digest.HMac |
|
|
|
import cn.hutool.crypto.digest.HMac |
|
|
|
import cn.hutool.core.util.HexUtil |
|
|
|
|
|
|
|
import cn.hutool.crypto.symmetric.SymmetricCrypto |
|
|
|
import cn.hutool.crypto.symmetric.SymmetricCrypto |
|
|
|
import cn.hutool.crypto.SecureUtil |
|
|
|
|
|
|
|
import io.legado.app.constant.AppConst |
|
|
|
import io.legado.app.constant.AppConst |
|
|
|
import io.legado.app.constant.AppConst.dateFormat |
|
|
|
import io.legado.app.constant.AppConst.dateFormat |
|
|
|
import io.legado.app.constant.AppLog |
|
|
|
import io.legado.app.constant.AppLog |
|
|
@ -178,13 +178,16 @@ interface JsExtensions { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 缓存以文本方式保存的文件 如.js .txt等 |
|
|
|
* 缓存以文本方式保存的文件 如.js .txt等 |
|
|
|
* @param urlStr 网络文件的链接 |
|
|
|
* @param urlStr 网络文件的链接 |
|
|
|
* @param saveTime 缓存时间,单位:秒 |
|
|
|
|
|
|
|
* @return 返回缓存后的文件内容 |
|
|
|
* @return 返回缓存后的文件内容 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
fun cacheFile(urlStr: String): String? { |
|
|
|
fun cacheFile(urlStr: String): String? { |
|
|
|
return cacheFile(urlStr, 0) |
|
|
|
return cacheFile(urlStr, 0) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 缓存以文本方式保存的文件 如.js .txt等 |
|
|
|
|
|
|
|
* @param saveTime 缓存时间,单位:秒 |
|
|
|
|
|
|
|
*/ |
|
|
|
fun cacheFile(urlStr: String, saveTime: Int): String? { |
|
|
|
fun cacheFile(urlStr: String, saveTime: Int): String? { |
|
|
|
val key = md5Encode16(urlStr) |
|
|
|
val key = md5Encode16(urlStr) |
|
|
|
val cache = CacheManager.getFile(key) |
|
|
|
val cache = CacheManager.getFile(key) |
|
|
@ -675,7 +678,7 @@ interface JsExtensions { |
|
|
|
iv: ByteArray? |
|
|
|
iv: ByteArray? |
|
|
|
): SymmetricCrypto { |
|
|
|
): SymmetricCrypto { |
|
|
|
val symmetricCrypto = SymmetricCrypto(transformation, key) |
|
|
|
val symmetricCrypto = SymmetricCrypto(transformation, key) |
|
|
|
return if (iv != null && !iv.isEmpty()) symmetricCrypto.setIv(iv) else symmetricCrypto |
|
|
|
return if (iv != null && iv.isNotEmpty()) symmetricCrypto.setIv(iv) else symmetricCrypto |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun createSymmetricCrypto( |
|
|
|
fun createSymmetricCrypto( |
|
|
|