mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-16 15:02:43 +00:00
webhook: matrix use v3 endpoint and drop headers
This commit is contained in:
parent
99830a40a1
commit
94dd22a784
3 changed files with 5 additions and 6 deletions
|
@ -47,9 +47,10 @@ func (matrixHandler) UnmarshalForm(bind func(any)) forms.WebhookForm {
|
|||
bind(&form)
|
||||
form.AuthorizationHeader = "Bearer " + strings.TrimSpace(form.AccessToken)
|
||||
|
||||
// https://spec.matrix.org/v1.10/client-server-api/#sending-events-to-a-room
|
||||
return forms.WebhookForm{
|
||||
WebhookCoreForm: form.WebhookCoreForm,
|
||||
URL: fmt.Sprintf("%s/_matrix/client/r0/rooms/%s/send/m.room.message", form.HomeserverURL, url.PathEscape(form.RoomID)),
|
||||
URL: fmt.Sprintf("%s/_matrix/client/v3/rooms/%s/send/m.room.message", form.HomeserverURL, url.PathEscape(form.RoomID)),
|
||||
ContentType: webhook_model.ContentTypeJSON,
|
||||
Secret: "",
|
||||
HTTPMethod: http.MethodPut,
|
||||
|
@ -89,7 +90,7 @@ func (matrixHandler) NewRequest(ctx context.Context, w *webhook_model.Webhook, t
|
|||
}
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
|
||||
return req, body, shared.AddDefaultHeaders(req, []byte(w.Secret), t, body) // likely useless, but has always been sent historially
|
||||
return req, body, nil
|
||||
}
|
||||
|
||||
const matrixPayloadSizeLimit = 1024 * 64
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue