mirror of
https://github.com/adnanh/webhook.git
synced 2026-07-26 17:19:17 +08:00
added support for x-hub-signature
This commit is contained in:
+5
-1
@@ -45,6 +45,10 @@ func (h *Hook) UnmarshalJSON(j []byte) error {
|
||||
h.Cwd = v.(string)
|
||||
}
|
||||
|
||||
if v, ok := m["secret"]; ok {
|
||||
h.Secret = v.(string)
|
||||
}
|
||||
|
||||
if v, ok := m["trigger-rule"]; ok {
|
||||
rule := v.(map[string]interface{})
|
||||
|
||||
@@ -126,7 +130,7 @@ func New(hookFile string) (*Hooks, error) {
|
||||
func (h *Hooks) Match(id string, params interface{}) *Hook {
|
||||
for i := range h.list {
|
||||
if h.list[i].ID == id {
|
||||
if h.list[i].Rule != nil && h.list[i].Rule.Evaluate(params) {
|
||||
if h.list[i].Rule == nil || (h.list[i].Rule != nil && h.list[i].Rule.Evaluate(params)) {
|
||||
return &h.list[i]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user