aboutsummaryrefslogtreecommitdiff
path: root/federationapi/routing/routing.go
diff options
context:
space:
mode:
authorTill <2353100+S7evinK@users.noreply.github.com>2023-05-23 19:37:04 +0200
committerGitHub <noreply@github.com>2023-05-23 19:37:04 +0200
commit5d6221d1917c3494fed57e055e46928aaa4b5bda (patch)
treea331041924b7372b57945314b03365ffaff07574 /federationapi/routing/routing.go
parent2eae8dc489f056df5aec0ee4ace1b8ba8260e18e (diff)
Move `MakeLeave` to GMSL (#3085)
Basically the same API shape as for `/make_join` https://github.com/matrix-org/gomatrixserverlib/pull/385
Diffstat (limited to 'federationapi/routing/routing.go')
-rw-r--r--federationapi/routing/routing.go20
1 files changed, 16 insertions, 4 deletions
diff --git a/federationapi/routing/routing.go b/federationapi/routing/routing.go
index 7be0857a..fad06c1c 100644
--- a/federationapi/routing/routing.go
+++ b/federationapi/routing/routing.go
@@ -412,7 +412,7 @@ func Setup(
},
)).Methods(http.MethodPut)
- v1fedmux.Handle("/make_leave/{roomID}/{eventID}", MakeFedAPI(
+ v1fedmux.Handle("/make_leave/{roomID}/{userID}", MakeFedAPI(
"federation_make_leave", cfg.Matrix.ServerName, cfg.Matrix.IsLocalServerName, keys, wakeup,
func(httpReq *http.Request, request *fclient.FederationRequest, vars map[string]string) util.JSONResponse {
if roomserverAPI.IsServerBannedFromRoom(httpReq.Context(), rsAPI, vars["roomID"], request.Origin()) {
@@ -421,10 +421,22 @@ func Setup(
JSON: spec.Forbidden("Forbidden by server ACLs"),
}
}
- roomID := vars["roomID"]
- eventID := vars["eventID"]
+ roomID, err := spec.NewRoomID(vars["roomID"])
+ if err != nil {
+ return util.JSONResponse{
+ Code: http.StatusBadRequest,
+ JSON: spec.InvalidParam("Invalid RoomID"),
+ }
+ }
+ userID, err := spec.NewUserID(vars["userID"], true)
+ if err != nil {
+ return util.JSONResponse{
+ Code: http.StatusBadRequest,
+ JSON: spec.InvalidParam("Invalid UserID"),
+ }
+ }
return MakeLeave(
- httpReq, request, cfg, rsAPI, roomID, eventID,
+ httpReq, request, cfg, rsAPI, *roomID, *userID,
)
},
)).Methods(http.MethodGet)