mirror of
https://github.com/usual2970/certimate.git
synced 2025-06-10 22:49:51 +00:00
feat update placeholder syntax in notify templates
This commit is contained in:
parent
0556d68a4e
commit
16bc12c15b
@ -13,8 +13,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
defaultExpireSubject = "您有 {COUNT} 张证书即将过期"
|
||||
defaultExpireMessage = "有 {COUNT} 张证书即将过期,域名分别为 {DOMAINS},请保持关注!"
|
||||
defaultExpireSubject = "您有 ${COUNT} 张证书即将过期"
|
||||
defaultExpireMessage = "有 ${COUNT} 张证书即将过期,域名分别为 ${DOMAINS},请保持关注!"
|
||||
)
|
||||
|
||||
type CertificateRepository interface {
|
||||
@ -88,11 +88,11 @@ func buildMsg(records []domain.Certificate) *domain.NotifyMessage {
|
||||
countStr := strconv.Itoa(count)
|
||||
domainStr := strings.Join(domains, ";")
|
||||
|
||||
subject = strings.ReplaceAll(subject, "{COUNT}", countStr)
|
||||
subject = strings.ReplaceAll(subject, "{DOMAINS}", domainStr)
|
||||
subject = strings.ReplaceAll(subject, "${COUNT}", countStr)
|
||||
subject = strings.ReplaceAll(subject, "${DOMAINS}", domainStr)
|
||||
|
||||
message = strings.ReplaceAll(message, "{COUNT}", countStr)
|
||||
message = strings.ReplaceAll(message, "{DOMAINS}", domainStr)
|
||||
message = strings.ReplaceAll(message, "${COUNT}", countStr)
|
||||
message = strings.ReplaceAll(message, "${DOMAINS}", domainStr)
|
||||
|
||||
// 返回消息
|
||||
return &domain.NotifyMessage{
|
||||
|
@ -33,8 +33,8 @@ export type NotifyTemplate = {
|
||||
};
|
||||
|
||||
export const defaultNotifyTemplate: NotifyTemplate = {
|
||||
subject: "您有 {COUNT} 张证书即将过期",
|
||||
message: "有 {COUNT} 张证书即将过期,域名分别为 {DOMAINS},请保持关注!",
|
||||
subject: "您有 ${COUNT} 张证书即将过期",
|
||||
message: "有 ${COUNT} 张证书即将过期,域名分别为 ${DOMAINS},请保持关注!",
|
||||
};
|
||||
// #endregion
|
||||
|
||||
|
@ -19,10 +19,10 @@
|
||||
"settings.notification.template.card.title": "Template",
|
||||
"settings.notification.template.form.subject.label": "Subject",
|
||||
"settings.notification.template.form.subject.placeholder": "Please enter notification subject",
|
||||
"settings.notification.template.form.subject.tooltip": "Optional variables ({COUNT}: number of expiring soon)",
|
||||
"settings.notification.template.form.subject.tooltip": "Optional variables (${COUNT}: number of expiring soon)",
|
||||
"settings.notification.template.form.message.label": "Message",
|
||||
"settings.notification.template.form.message.placeholder": "Please enter notification message",
|
||||
"settings.notification.template.form.message.tooltip": "Optional variables ({COUNT}: number of expiring soon. {DOMAINS}: Domain list)",
|
||||
"settings.notification.template.form.message.tooltip": "Optional variables (${COUNT}: number of expiring soon. ${DOMAINS}: Domain list)",
|
||||
"settings.notification.channels.card.title": "Channels",
|
||||
"settings.notification.channel.enabled.on": "On",
|
||||
"settings.notification.channel.enabled.off": "Off",
|
||||
|
@ -19,10 +19,10 @@
|
||||
"settings.notification.template.card.title": "通知模板",
|
||||
"settings.notification.template.form.subject.label": "通知主题",
|
||||
"settings.notification.template.form.subject.placeholder": "请输入通知主题",
|
||||
"settings.notification.template.form.subject.tooltip": "可选的变量({COUNT}: 即将过期张数)",
|
||||
"settings.notification.template.form.subject.tooltip": "可选的变量(${COUNT}: 即将过期张数)",
|
||||
"settings.notification.template.form.message.label": "通知内容",
|
||||
"settings.notification.template.form.message.placeholder": "请输入通知内容",
|
||||
"settings.notification.template.form.message.tooltip": "可选的变量({COUNT}: 即将过期张数;{DOMAINS}: 域名列表)",
|
||||
"settings.notification.template.form.message.tooltip": "可选的变量(${COUNT}: 即将过期张数;${DOMAINS}: 域名列表)",
|
||||
"settings.notification.channels.card.title": "通知渠道",
|
||||
"settings.notification.channel.enabled.on": "启用",
|
||||
"settings.notification.channel.enabled.off": "未启用",
|
||||
|
Loading…
x
Reference in New Issue
Block a user