diff --git a/app/src/main/java/io/legado/app/help/JsExtensions.kt b/app/src/main/java/io/legado/app/help/JsExtensions.kt index d321f57fb..9e4bca018 100644 --- a/app/src/main/java/io/legado/app/help/JsExtensions.kt +++ b/app/src/main/java/io/legado/app/help/JsExtensions.kt @@ -1,5 +1,6 @@ package io.legado.app.help +import android.util.Base64 import io.legado.app.model.analyzeRule.AnalyzeUrl import io.legado.app.utils.EncoderUtils import io.legado.app.utils.MD5Utils @@ -29,8 +30,8 @@ object JsExtensions { return EncoderUtils.base64Decode(str) } - fun base64Encode(str: String): String? { - return EncoderUtils.base64Encode(str) + fun base64Encode(str: String, flags: Int = Base64.NO_WRAP): String? { + return EncoderUtils.base64Encode(str, flags) } fun strToMd5By32(str: String): String? { diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt index b4bb0276e..82a767ab5 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt @@ -1,6 +1,7 @@ package io.legado.app.model.analyzeRule import android.text.TextUtils +import android.util.Base64 import androidx.annotation.Keep import io.legado.app.constant.AppConst.SCRIPT_ENGINE import io.legado.app.constant.Pattern.JS_PATTERN @@ -576,8 +577,8 @@ class AnalyzeRule(private var book: BaseBook? = null) { return EncoderUtils.base64Decode(str) } - fun base64Encode(str: String): String? { - return EncoderUtils.base64Encode(str) + fun base64Encode(str: String, flags: Int = Base64.NO_WRAP): String? { + return EncoderUtils.base64Encode(str, flags) } fun strToMd5By32(str: String): String? { diff --git a/app/src/main/java/io/legado/app/utils/EncoderUtils.kt b/app/src/main/java/io/legado/app/utils/EncoderUtils.kt index 8e5c03522..4858113e3 100644 --- a/app/src/main/java/io/legado/app/utils/EncoderUtils.kt +++ b/app/src/main/java/io/legado/app/utils/EncoderUtils.kt @@ -33,7 +33,7 @@ object EncoderUtils { } } - fun base64Encode(str: String): String? { - return Base64.encodeToString(str.toByteArray(), Base64.DEFAULT) + fun base64Encode(str: String, flags: Int = Base64.NO_WRAP): String? { + return Base64.encodeToString(str.toByteArray(), flags) } } \ No newline at end of file