2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 06:47:20 +08:00

feat: 支持 webhook, close #695

This commit is contained in:
2026-01-08 23:04:37 +08:00
parent 978c9b2fc3
commit ab6e0903f5
13 changed files with 813 additions and 86 deletions

View File

@@ -112,7 +112,13 @@ func Entrance(t *gotext.Locale, conf *config.Config, session *sessions.Manager)
return
}
// 情况四:非调试模式且未通过验证的请求,返回错误
// 情况四:Webhook 访问,跳过验证
if strings.HasPrefix(r.URL.Path, "/webhook/") {
next.ServeHTTP(w, r)
return
}
// 情况五:非调试模式且未通过验证的请求,返回错误
if !conf.App.Debug &&
sess.Missing("verify_entrance") &&
r.URL.Path != "/robots.txt" {

View File

@@ -0,0 +1,21 @@
package request
type WebHookCreate struct {
Name string `json:"name" form:"name" validate:"required"`
Script string `json:"script" form:"script" validate:"required"`
Raw bool `json:"raw" form:"raw"`
User string `json:"user" form:"user"`
}
type WebHookUpdate struct {
ID uint `json:"id" form:"id" uri:"id" validate:"required|exists:web_hooks,id"`
Name string `json:"name" form:"name" validate:"required"`
Script string `json:"script" form:"script" validate:"required"`
Raw bool `json:"raw" form:"raw"`
User string `json:"user" form:"user" validate:"required"`
Status bool `json:"status" form:"status"`
}
type WebHookKey struct {
Key string `json:"key" form:"key" uri:"key" validate:"required"`
}