Skip to content

Commit

Permalink
优化
Browse files Browse the repository at this point in the history
  • Loading branch information
gedoor committed Oct 16, 2022
1 parent 8e64419 commit 18ae731
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions app/src/main/java/io/legado/app/help/JsExtensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package io.legado.app.help
import android.net.Uri
import android.util.Base64
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.HMac
import cn.hutool.core.util.HexUtil
import cn.hutool.crypto.symmetric.SymmetricCrypto
import cn.hutool.crypto.SecureUtil
import io.legado.app.constant.AppConst
import io.legado.app.constant.AppConst.dateFormat
import io.legado.app.constant.AppLog
Expand Down Expand Up @@ -178,13 +178,16 @@ interface JsExtensions {
/**
* 缓存以文本方式保存的文件 如.js .txt等
* @param urlStr 网络文件的链接
* @param saveTime 缓存时间,单位:秒
* @return 返回缓存后的文件内容
*/
fun cacheFile(urlStr: String): String? {
return cacheFile(urlStr, 0)
}

/**
* 缓存以文本方式保存的文件 如.js .txt等
* @param saveTime 缓存时间,单位:秒
*/
fun cacheFile(urlStr: String, saveTime: Int): String? {
val key = md5Encode16(urlStr)
val cache = CacheManager.getFile(key)
Expand Down Expand Up @@ -675,7 +678,7 @@ interface JsExtensions {
iv: ByteArray?
): SymmetricCrypto {
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(
Expand Down

0 comments on commit 18ae731

Please sign in to comment.