mirror of
https://github.com/pppscn/SmsForwarder
synced 2025-08-03 01:17:41 +08:00
优化:webhook通道替换POST时替换webParams中[timestamp]/[sign]标签
This commit is contained in:
parent
16fa5ffa62
commit
a5a1a62873
@ -107,7 +107,7 @@ class App : Application(), CactusCallback, Configuration.Provider by Core {
|
|||||||
try {
|
try {
|
||||||
TinkerLoadLibrary.installNativeLibraryPath(classLoader, soFile)
|
TinkerLoadLibrary.installNativeLibraryPath(classLoader, soFile)
|
||||||
} catch (throwable: Throwable) {
|
} catch (throwable: Throwable) {
|
||||||
Log.e("APP", throwable.message!!)
|
Log.e("APP", throwable.message.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
//启动前台服务
|
//启动前台服务
|
||||||
|
@ -104,6 +104,8 @@ class WebhookUtils {
|
|||||||
.replace("[title]", escapeJson(simInfo))
|
.replace("[title]", escapeJson(simInfo))
|
||||||
.replace("[card_slot]", escapeJson(simInfo))
|
.replace("[card_slot]", escapeJson(simInfo))
|
||||||
.replace("[receive_time]", receiveTime)
|
.replace("[receive_time]", receiveTime)
|
||||||
|
.replace("[timestamp]", timestamp.toString())
|
||||||
|
.replace("[sign]", sign)
|
||||||
} else {
|
} else {
|
||||||
bodyMsg = webParams.replace("[from]", URLEncoder.encode(from, "UTF-8"))
|
bodyMsg = webParams.replace("[from]", URLEncoder.encode(from, "UTF-8"))
|
||||||
.replace("[content]", URLEncoder.encode(content, "UTF-8"))
|
.replace("[content]", URLEncoder.encode(content, "UTF-8"))
|
||||||
@ -114,6 +116,8 @@ class WebhookUtils {
|
|||||||
.replace("[title]", URLEncoder.encode(simInfo, "UTF-8"))
|
.replace("[title]", URLEncoder.encode(simInfo, "UTF-8"))
|
||||||
.replace("[card_slot]", URLEncoder.encode(simInfo, "UTF-8"))
|
.replace("[card_slot]", URLEncoder.encode(simInfo, "UTF-8"))
|
||||||
.replace("[receive_time]", URLEncoder.encode(receiveTime, "UTF-8"))
|
.replace("[receive_time]", URLEncoder.encode(receiveTime, "UTF-8"))
|
||||||
|
.replace("[timestamp]", URLEncoder.encode(timestamp.toString(), "UTF-8"))
|
||||||
|
.replace("[sign]", URLEncoder.encode(sign, "UTF-8"))
|
||||||
}
|
}
|
||||||
val body = RequestBody.create(MediaType.parse(contentType), bodyMsg)
|
val body = RequestBody.create(MediaType.parse(contentType), bodyMsg)
|
||||||
requestBuilder = Request.Builder()
|
requestBuilder = Request.Builder()
|
||||||
|
@ -685,7 +685,7 @@
|
|||||||
<string name="webhook_server">Webhook Server</string>
|
<string name="webhook_server">Webhook Server</string>
|
||||||
<string name="webhook_server_tips">For example: https://a.b.com/msg?token=xyz</string>
|
<string name="webhook_server_tips">For example: https://a.b.com/msg?token=xyz</string>
|
||||||
<string name="webhook_params">Params</string>
|
<string name="webhook_params">Params</string>
|
||||||
<string name="webhook_params_tips">For example: payload=%7B%22text%22%3A%22[msg]%22%7D [msg] will be replaced with SMS content.\nJson format is supported, for example: {text:[msg]}.\nNote: msg is automatically UTF-8 encoded except in JSON format</string>
|
<string name="webhook_params_tips">For example: payload=%7B%22text%22%3A%22[msg]%22%7D [msg] will be replaced with SMS content.\nJson format is supported, for example: {\"text\":\"[msg]\"}.\nNote: msg is automatically UTF-8 encoded except in JSON format</string>
|
||||||
<string name="webhook_secret">Secret: If it is empty, the sign will not be calculated</string>
|
<string name="webhook_secret">Secret: If it is empty, the sign will not be calculated</string>
|
||||||
<string name="headers">Headers</string>
|
<string name="headers">Headers</string>
|
||||||
<string name="header_key">Key</string>
|
<string name="header_key">Key</string>
|
||||||
|
@ -686,7 +686,7 @@
|
|||||||
<string name="webhook_server">Webhook Server</string>
|
<string name="webhook_server">Webhook Server</string>
|
||||||
<string name="webhook_server_tips">例如:https://a.b.com/msg?token=xyz</string>
|
<string name="webhook_server_tips">例如:https://a.b.com/msg?token=xyz</string>
|
||||||
<string name="webhook_params">Params</string>
|
<string name="webhook_params">Params</string>
|
||||||
<string name="webhook_params_tips">例如:payload=%7B%22text%22%3A%22[msg]%22%7D [msg]将被替换成短信内容。\n支持Json格式,例如:{"text":[msg]}。\n注意:除JSON格式外,msg会自动进行UTF-8编码</string>
|
<string name="webhook_params_tips">例如:payload=%7B%22text%22%3A%22[msg]%22%7D [msg]将被替换成短信内容。\n支持Json格式,例如:{\"text\":\"[msg]\"}。\n注意:除JSON格式外,msg会自动进行UTF-8编码</string>
|
||||||
<string name="webhook_secret">Secret:置空则不计算sign</string>
|
<string name="webhook_secret">Secret:置空则不计算sign</string>
|
||||||
<string name="headers">Headers</string>
|
<string name="headers">Headers</string>
|
||||||
<string name="header_key">Key</string>
|
<string name="header_key">Key</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user