mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Add Matrix webhook (#10831)
* Add Matrix webhook Signed-off-by: Till Faelligen <tfaelligen@gmail.com> * Add template and related translations for Matrix hook Signed-off-by: Till Faelligen <tfaelligen@gmail.com> * Add actual webhook routes and form Signed-off-by: Till Faelligen <tfaelligen@gmail.com> * Add missing file Signed-off-by: Till Faelligen <tfaelligen@gmail.com> * Update modules/webhook/matrix_test.go * Use stricter regex to replace URLs Signed-off-by: Till Faelligen <tfaelligen@gmail.com> * Escape url and text Signed-off-by: Till Faelligen <tfaelligen@gmail.com> * Remove unnecessary whitespace * Fix copy and paste mistake Co-Authored-By: Tulir Asokan <tulir@maunium.net> * Fix indention inconsistency * Use Authorization header instead of url parameter * Add raw commit information to webhook Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Tulir Asokan <tulir@maunium.net>
This commit is contained in:
		@@ -313,6 +313,20 @@ func (f *NewTelegramHookForm) Validate(ctx *macaron.Context, errs binding.Errors
 | 
			
		||||
	return validate(errs, ctx.Data, f, ctx.Locale)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewMatrixHookForm form for creating Matrix hook
 | 
			
		||||
type NewMatrixHookForm struct {
 | 
			
		||||
	HomeserverURL string `binding:"Required;ValidUrl"`
 | 
			
		||||
	RoomID        string `binding:"Required"`
 | 
			
		||||
	AccessToken   string `binding:"Required"`
 | 
			
		||||
	MessageType   int
 | 
			
		||||
	WebhookForm
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Validate validates the fields
 | 
			
		||||
func (f *NewMatrixHookForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
 | 
			
		||||
	return validate(errs, ctx.Data, f, ctx.Locale)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewMSTeamsHookForm form for creating MS Teams hook
 | 
			
		||||
type NewMSTeamsHookForm struct {
 | 
			
		||||
	PayloadURL string `binding:"Required;ValidUrl"`
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user