pull/42/head
kunfei 5 years ago
parent 4398b324c3
commit f3513e6ea8
  1. 5
      app/src/main/java/io/legado/app/help/JsExtensions.kt
  2. 5
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt
  3. 4
      app/src/main/java/io/legado/app/utils/EncoderUtils.kt

@ -1,5 +1,6 @@
package io.legado.app.help package io.legado.app.help
import android.util.Base64
import io.legado.app.model.analyzeRule.AnalyzeUrl import io.legado.app.model.analyzeRule.AnalyzeUrl
import io.legado.app.utils.EncoderUtils import io.legado.app.utils.EncoderUtils
import io.legado.app.utils.MD5Utils import io.legado.app.utils.MD5Utils
@ -29,8 +30,8 @@ object JsExtensions {
return EncoderUtils.base64Decode(str) return EncoderUtils.base64Decode(str)
} }
fun base64Encode(str: String): String? { fun base64Encode(str: String, flags: Int = Base64.NO_WRAP): String? {
return EncoderUtils.base64Encode(str) return EncoderUtils.base64Encode(str, flags)
} }
fun strToMd5By32(str: String): String? { fun strToMd5By32(str: String): String? {

@ -1,6 +1,7 @@
package io.legado.app.model.analyzeRule package io.legado.app.model.analyzeRule
import android.text.TextUtils import android.text.TextUtils
import android.util.Base64
import androidx.annotation.Keep import androidx.annotation.Keep
import io.legado.app.constant.AppConst.SCRIPT_ENGINE import io.legado.app.constant.AppConst.SCRIPT_ENGINE
import io.legado.app.constant.Pattern.JS_PATTERN import io.legado.app.constant.Pattern.JS_PATTERN
@ -576,8 +577,8 @@ class AnalyzeRule(private var book: BaseBook? = null) {
return EncoderUtils.base64Decode(str) return EncoderUtils.base64Decode(str)
} }
fun base64Encode(str: String): String? { fun base64Encode(str: String, flags: Int = Base64.NO_WRAP): String? {
return EncoderUtils.base64Encode(str) return EncoderUtils.base64Encode(str, flags)
} }
fun strToMd5By32(str: String): String? { fun strToMd5By32(str: String): String? {

@ -33,7 +33,7 @@ object EncoderUtils {
} }
} }
fun base64Encode(str: String): String? { fun base64Encode(str: String, flags: Int = Base64.NO_WRAP): String? {
return Base64.encodeToString(str.toByteArray(), Base64.DEFAULT) return Base64.encodeToString(str.toByteArray(), flags)
} }
} }
Loading…
Cancel
Save