feat: 添加/修改通知方式时可选择不发送测试信息

This commit is contained in:
Akkia 2022-04-23 02:07:46 +08:00
parent 213b2ee2e3
commit 7d03da21f3
No known key found for this signature in database
GPG Key ID: DABE9A4AB2DD7EF3
3 changed files with 14 additions and 1 deletions

View File

@ -395,6 +395,7 @@ type notificationForm struct {
RequestHeader string
RequestBody string
VerifySSL string
SkipCheck string
}
func (ma *memberAPI) addOrEditNotification(c *gin.Context) {
@ -416,7 +417,12 @@ func (ma *memberAPI) addOrEditNotification(c *gin.Context) {
Notification: &n,
Server: nil,
}
err = ns.Send("这是测试消息")
// 勾选了跳过检查
if nf.SkipCheck == "on" {
err = nil
} else {
err = ns.Send("这是测试消息")
}
}
if err == nil {
// 保证Tag不为空

View File

@ -154,6 +154,7 @@ function addOrEditNotification(notification) {
} else {
modal.find(".ui.nf-ssl.checkbox").checkbox("set unchecked");
}
modal.find(".ui.nf-skip-check.checkbox").checkbox("set unchecked");
showFormModal(
".notification.modal",
"#notificationForm",

View File

@ -44,6 +44,12 @@
<label>验证SSL</label>
</div>
</div>
<div class="field">
<div class="ui nf-skip-check checkbox">
<input name="SkipCheck" type="checkbox" tabindex="0" class="hidden">
<label>不发送测试信息</label>
</div>
</div>
</form>
</div>
<div class="actions">