fix: make including msg optional for alyun and clairify the carrier restrictions (#6636)

Co-authored-by: IsayIsee <1091921+Solin@user.noreply.gitee.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Frank Elsinga <frank@elsinga.de>
This commit is contained in:
IsayIsee 2026-01-09 14:53:50 +08:00 committed by GitHub
parent 50ab0b8d52
commit 0511686f8a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 56 additions and 16 deletions

View File

@ -19,7 +19,9 @@ class AliyunSMS extends NotificationProvider {
name: monitorJSON["name"],
time: heartbeatJSON["localDateTime"],
status: this.statusToString(heartbeatJSON["status"]),
msg: this.removeIpAndDomain(heartbeatJSON["msg"]),
...(notification.optionalParameters && {
msg: this.removeIpAndDomain(heartbeatJSON["msg"]),
}),
});
if (await this.sendSms(notification, msgBody)) {
return okMsg;
@ -29,7 +31,9 @@ class AliyunSMS extends NotificationProvider {
name: "",
time: "",
status: "",
msg: this.removeIpAndDomain(msg),
...(notification.optionalParameters && {
msg: this.removeIpAndDomain(msg),
}),
});
if (await this.sendSms(notification, msgBody)) {
return okMsg;

View File

@ -4,25 +4,34 @@
{{ $t("AccessKeyId") }}
<span style="color: red"><sup>*</sup></span>
</label>
<input id="accessKeyId" v-model="$parent.notification.accessKeyId" type="text" class="form-control" required />
<HiddenInput
id="accessKeyId"
v-model="$parent.notification.accessKeyId"
:required="true"
autocomplete="new-password"
></HiddenInput>
<label for="secretAccessKey" class="form-label">
{{ $t("SecretAccessKey") }}
<span style="color: red"><sup>*</sup></span>
</label>
<input
<HiddenInput
id="secretAccessKey"
v-model="$parent.notification.secretAccessKey"
type="text"
class="form-control"
required
/>
:required="true"
autocomplete="new-password"
></HiddenInput>
<label for="phonenumber" class="form-label">
{{ $t("PhoneNumbers") }}
<span style="color: red"><sup>*</sup></span>
</label>
<input id="phonenumber" v-model="$parent.notification.phonenumber" type="text" class="form-control" required />
<HiddenInput
id="phonenumber"
v-model="$parent.notification.phonenumber"
:required="true"
autocomplete="new-password"
></HiddenInput>
<label for="templateCode" class="form-label">
{{ $t("TemplateCode") }}
@ -41,13 +50,28 @@
<span style="color: red"><sup>*</sup></span>
</label>
<input id="signName" v-model="$parent.notification.signName" type="text" class="form-control" required />
<div class="form-check form-switch">
<label class="form-check-label">{{ $t("OptionalParameters") }}</label>
<input
id="optionalParameters"
v-model="$parent.notification.optionalParameters"
class="form-check-input"
type="checkbox"
/>
<div class="form-text">{{ $t("aliyun_enable_optional_variables_at_the_risk_of_non_delivery") }}</div>
</div>
<br />
<div class="form-text">
<p>
{{ $t("Sms template must contain parameters: ") }}
<br />
<code>${name} ${time} ${status} ${msg}</code>
</p>
<i18n-t tag="p" keypath="aliyun-template-requirements-and-parameters">
<template #parameters>
<code>${name} ${time} ${status}</code>
</template>
</i18n-t>
<i18n-t tag="p" keypath="aliyun-template-optional-parameters">
<template #parameters>
<code>${msg}</code>
</template>
</i18n-t>
<i18n-t tag="p" keypath="Read more:">
<a href="https://help.aliyun.com/document_detail/101414.html" target="_blank">
https://help.aliyun.com/document_detail/101414.html
@ -56,3 +80,12 @@
</div>
</div>
</template>
<script>
import HiddenInput from "../HiddenInput.vue";
export default {
components: {
HiddenInput,
},
};
</script>

View File

@ -737,7 +737,10 @@
"PhoneNumbers": "PhoneNumbers",
"TemplateCode": "TemplateCode",
"SignName": "SignName",
"Sms template must contain parameters: ": "Sms template must contain parameters: ",
"OptionalParameters": "Optional Parameters",
"aliyun_enable_optional_variables_at_the_risk_of_non_delivery": "Due to carrier restrictions, enable optional variables at the risk of non-delivery",
"aliyun-template-requirements-and-parameters": "The aliyun SMS template must contain parameters: {parameters}",
"aliyun-template-optional-parameters": "Optional parameters: {parameters}",
"Bark API Version": "Bark API Version",
"Bark Endpoint": "Bark Endpoint",
"Bark Group": "Bark Group",