mirror of
https://github.com/pppscn/SmsForwarder
synced 2024-11-08 01:10:23 +00:00
优化:提升发送通道多参数分隔的兼容性
This commit is contained in:
parent
c2ab087155
commit
0aba25ffe2
@ -284,6 +284,12 @@ class EmailFragment : BaseFragment<FragmentSendersEmailBinding?>(), View.OnClick
|
||||
val startTls = binding!!.sbStartTls.isChecked
|
||||
val toEmail = binding!!.etToEmail.text.toString().trim()
|
||||
val title = binding!!.etTitleTemplate.text.toString().trim()
|
||||
if (TextUtils.isEmpty(fromEmail) || TextUtils.isEmpty(pwd) || TextUtils.isEmpty(toEmail)) {
|
||||
throw Exception(getString(R.string.invalid_email))
|
||||
}
|
||||
if (mailType == getString(R.string.other_mail_type) && (TextUtils.isEmpty(host) || TextUtils.isEmpty(port))) {
|
||||
throw Exception(getString(R.string.invalid_email_server))
|
||||
}
|
||||
|
||||
return EmailSetting(mailType, fromEmail, pwd, nickname, host, port, ssl, startTls, toEmail, title)
|
||||
}
|
||||
|
@ -66,8 +66,8 @@ class DingtalkGroupRobotUtils private constructor() {
|
||||
} else {
|
||||
atMap["isAtAll"] = false
|
||||
if (!TextUtils.isEmpty(setting.atMobiles)) {
|
||||
val atMobilesArray: Array<String>? = setting.atMobiles?.split(",".toRegex())?.toTypedArray()
|
||||
if (atMobilesArray != null) {
|
||||
val atMobilesArray: Array<String> = setting.atMobiles.toString().replace("[,,;;]".toRegex(), ",").trim(',').split(',').toTypedArray()
|
||||
if (atMobilesArray.isNotEmpty()) {
|
||||
val atMobilesList: MutableList<String> = ArrayList()
|
||||
for (atMobile in atMobilesArray) {
|
||||
if (TextUtils.isDigitsOnly(atMobile)) {
|
||||
|
@ -155,7 +155,7 @@ class DingtalkInnerRobotUtils private constructor() {
|
||||
|
||||
val textMsgMap: MutableMap<String, Any> = mutableMapOf()
|
||||
textMsgMap["robotCode"] = setting.appKey
|
||||
textMsgMap["userIds"] = setting.userIds.split('|').toTypedArray()
|
||||
textMsgMap["userIds"] = setting.userIds.replace("[,,;;|]".toRegex(), "|").trim('|').split('|').toTypedArray()
|
||||
textMsgMap["msgKey"] = setting.msgKey
|
||||
textMsgMap["msgParam"] = Gson().toJson(msgParam)
|
||||
|
||||
|
@ -115,15 +115,7 @@ class EmailUtils {
|
||||
}
|
||||
|
||||
//收件地址
|
||||
val toAddressList = ArrayList<String>()
|
||||
val emailArray = setting.toEmail.toString().split("[,,;;]".toRegex())
|
||||
if (emailArray.isNotEmpty()) {
|
||||
for (email in emailArray) {
|
||||
toAddressList.add(email)
|
||||
}
|
||||
} else {
|
||||
toAddressList.add(setting.toEmail.toString())
|
||||
}
|
||||
val toAddressList = setting.toEmail.toString().replace("[,,;;]".toRegex(), ",").trim(',').split(',') as ArrayList<String>
|
||||
|
||||
//创建邮箱
|
||||
val mail = Mail().apply {
|
||||
|
@ -141,7 +141,7 @@ class WebhookUtils {
|
||||
"PATCH" -> XHttp.patch(requestUrl).keepJson(true)
|
||||
else -> XHttp.post(requestUrl).keepJson(true)
|
||||
}
|
||||
webParams.split("&").forEach {
|
||||
webParams.trim('&').split("&").forEach {
|
||||
val param = it.split("=")
|
||||
if (param.size == 2) {
|
||||
postRequest.params(
|
||||
|
@ -274,6 +274,7 @@
|
||||
<string name="invalid_name">Channel name cannot be empty</string>
|
||||
<string name="invalid_token">invalid token</string>
|
||||
<string name="invalid_email">Email parameter is incomplete</string>
|
||||
<string name="invalid_email_server">Email Server parameter is incomplete</string>
|
||||
<string name="invalid_bark_icon">The bark-icon is not a valid URL</string>
|
||||
<string name="invalid_bark_url">The bark-url is not a valid URL</string>
|
||||
<string name="invalid_bark_server">bark-server is empty or not a valid URL</string>
|
||||
|
@ -274,7 +274,8 @@
|
||||
<string name="failed_to_fwd">发送失败:</string>
|
||||
<string name="invalid_name">通道名称不能为空</string>
|
||||
<string name="invalid_token">token不合法</string>
|
||||
<string name="invalid_email">邮箱参数不完整</string>
|
||||
<string name="invalid_email">发件邮箱/登录密码/收件地址不可为空</string>
|
||||
<string name="invalid_email_server">服务器信息的主机/端口不可为空</string>
|
||||
<string name="invalid_bark_icon">消息图标不是有效URL</string>
|
||||
<string name="invalid_bark_url">消息链接不是有效URL</string>
|
||||
<string name="invalid_bark_server">bark-server为空 或 不是有效URL</string>
|
||||
|
Loading…
Reference in New Issue
Block a user