From cbc4373a3a4fd8e1fdccc11048a3b961b23131db Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Fri, 19 Jan 2024 12:03:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9Abark=E5=8A=A0?= =?UTF-8?q?=E5=AF=86=E6=8E=A8=E9=80=81=EF=BC=88=E5=85=BC=E5=AE=B9`v3.3.0`?= =?UTF-8?q?=E4=B9=8B=E5=89=8D=E7=9A=84=E9=85=8D=E7=BD=AE=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/idormy/sms/forwarder/utils/sender/BarkUtils.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/idormy/sms/forwarder/utils/sender/BarkUtils.kt b/app/src/main/java/com/idormy/sms/forwarder/utils/sender/BarkUtils.kt index 222186a8..22372ebb 100644 --- a/app/src/main/java/com/idormy/sms/forwarder/utils/sender/BarkUtils.kt +++ b/app/src/main/java/com/idormy/sms/forwarder/utils/sender/BarkUtils.kt @@ -17,7 +17,7 @@ import javax.crypto.Cipher import javax.crypto.spec.IvParameterSpec import javax.crypto.spec.SecretKeySpec -@Suppress("RegExpRedundantEscape") +@Suppress("RegExpRedundantEscape", "UselessCallOnNotNull") class BarkUtils { companion object { @@ -81,7 +81,9 @@ class BarkUtils { val requestMsg: String = Gson().toJson(msgMap) Log.i(TAG, "requestMsg:$requestMsg") //推送加密 - if (setting.transformation.isNotEmpty() && "none" != setting.transformation && setting.key.isNotEmpty() && setting.iv.isNotEmpty()) { + if (setting.transformation.isNullOrBlank() || "none" == setting.transformation || setting.key.isNullOrBlank() || setting.iv.isNullOrBlank()) { + request.upJson(requestMsg) + } else { val transformation = setting.transformation.replace("AES128", "AES").replace("AES192", "AES").replace("AES256", "AES") val ciphertext = encrypt(requestMsg, transformation, setting.key, setting.iv) //Log.d(TAG, "ciphertext: $ciphertext") @@ -91,8 +93,6 @@ class BarkUtils { //request.params("iv", URLEncoder.encode(setting.iv, "UTF-8")) request.params("ciphertext", ciphertext) request.headers("Content-Type", "application/x-www-form-urlencoded") - } else { - request.upJson(requestMsg) } request.ignoreHttpsCert() //忽略https证书