-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Refactor Webhook + Add X-Hub-Signature #16176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
96a3f78
84e3ddc
98a2a8e
07e3c3d
bcbd291
3d83b19
d4bdaa7
784e8a0
68be93f
a86a45a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright 2021 The Gitea Authors. All rights reserved. | ||
// Use of this source code is governed by a MIT-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package migrations | ||
|
||
import ( | ||
"xorm.io/xorm" | ||
) | ||
|
||
func dropWebhookColumns(x *xorm.Engine) error { | ||
// Make sure the columns exist before dropping them | ||
type Webhook struct { | ||
Signature string `xorm:"TEXT"` | ||
IsSSL bool `xorm:"is_ssl"` | ||
} | ||
if err := x.Sync2(new(Webhook)); err != nil { | ||
return err | ||
} | ||
|
||
type HookTask struct { | ||
Typ models.HookType `xorm:"VARCHAR(16) index"` | ||
URL string `xorm:"TEXT"` | ||
Signature string `xorm:"TEXT"` | ||
HTTPMethod string `xorm:"http_method"` | ||
ContentType models.HookContentType | ||
IsSSL bool | ||
} | ||
if err := x.Sync2(new(HookTask)); err != nil { | ||
return err | ||
} | ||
|
||
sess := x.NewSession() | ||
defer sess.Close() | ||
if err := sess.Begin(); err != nil { | ||
return err | ||
} | ||
if err := dropTableColumns(sess, "webhook", "signature", "is_ssl"); err != nil { | ||
return err | ||
} | ||
if err := dropTableColumns(sess, "hook_task", "typ", "url", "signature", "http_method", "content_type", "is_ssl"); err != nil { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't know why this columns should be dropped? webhook maybe changed after hook_task finished. So these columns will keep the original information when requesting. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Webhook: HookTask: |
||
return err | ||
} | ||
|
||
return sess.Commit() | ||
} |
Uh oh!
There was an error while loading. Please reload this page.