From 33cbc841b3361e0d055488b8718da88403952029 Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Mon, 22 Aug 2022 12:36:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9A`Telegram`=E5=8F=91?= =?UTF-8?q?=E9=80=81=E9=80=9A=E9=81=93=E4=BB=85`POST`=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E6=97=B6=E8=BD=AC=E4=B9=89=E5=8E=9F=E5=A7=8B=E7=9F=AD=E4=BF=A1?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E4=B8=AD=E7=9A=84`<``>``&``"`=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=EF=BC=88=E6=AD=A3=E5=88=99=E6=9B=BF=E6=8D=A2=E4=B8=8D?= =?UTF-8?q?=E5=BD=B1=E5=93=8D=EF=BC=89=20#210?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../idormy/sms/forwarder/utils/sender/TelegramUtils.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/idormy/sms/forwarder/utils/sender/TelegramUtils.kt b/app/src/main/java/com/idormy/sms/forwarder/utils/sender/TelegramUtils.kt index effb9c0c..c3951076 100644 --- a/app/src/main/java/com/idormy/sms/forwarder/utils/sender/TelegramUtils.kt +++ b/app/src/main/java/com/idormy/sms/forwarder/utils/sender/TelegramUtils.kt @@ -32,6 +32,11 @@ class TelegramUtils private constructor() { rule: Rule?, logId: Long?, ) { + if (setting.method == null || setting.method == "POST") { + msgInfo.content = htmlEncode(msgInfo.content) + msgInfo.simInfo = htmlEncode(msgInfo.simInfo) + } + val content: String = if (rule != null) { msgInfo.getContentForSend(rule.smsTemplate, rule.regexReplace) } else { @@ -52,7 +57,7 @@ class TelegramUtils private constructor() { } else { val bodyMap: MutableMap = mutableMapOf() bodyMap["chat_id"] = setting.chatId - bodyMap["text"] = htmlEncode(content) + bodyMap["text"] = content bodyMap["parse_mode"] = "HTML" bodyMap["disable_web_page_preview"] = "true" val requestMsg: String = Gson().toJson(bodyMap) @@ -100,7 +105,7 @@ class TelegramUtils private constructor() { } request.keepJson(true) - .ignoreHttpsCert() + //.ignoreHttpsCert() .timeOut((SettingUtils.requestTimeout * 1000).toLong()) //超时时间10s .cacheMode(CacheMode.NO_CACHE) .retryCount(SettingUtils.requestRetryTimes) //超时重试的次数