aboutsummaryrefslogtreecommitdiff
path: root/federationapi/routing/routing.go
diff options
context:
space:
mode:
Diffstat (limited to 'federationapi/routing/routing.go')
-rw-r--r--federationapi/routing/routing.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/federationapi/routing/routing.go b/federationapi/routing/routing.go
index 8865022f..4f998821 100644
--- a/federationapi/routing/routing.go
+++ b/federationapi/routing/routing.go
@@ -78,6 +78,7 @@ func Setup(
v2keysmux := keyMux.PathPrefix("/v2").Subrouter()
v1fedmux := fedMux.PathPrefix("/v1").Subrouter()
v2fedmux := fedMux.PathPrefix("/v2").Subrouter()
+ v3fedmux := fedMux.PathPrefix("/v3").Subrouter()
wakeup := &FederationWakeups{
FsAPI: fsAPI,
@@ -191,6 +192,37 @@ func Setup(
},
)).Methods(http.MethodPut, http.MethodOptions)
+ v3fedmux.Handle("/invite/{roomID}/{userID}", MakeFedAPI(
+ "federation_invite", 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()) {
+ return util.JSONResponse{
+ Code: http.StatusForbidden,
+ JSON: spec.Forbidden("Forbidden by server ACLs"),
+ }
+ }
+
+ userID, err := spec.NewUserID(vars["userID"], true)
+ if err != nil {
+ return util.JSONResponse{
+ Code: http.StatusBadRequest,
+ JSON: spec.InvalidParam("Invalid UserID"),
+ }
+ }
+ roomID, err := spec.NewRoomID(vars["roomID"])
+ if err != nil {
+ return util.JSONResponse{
+ Code: http.StatusBadRequest,
+ JSON: spec.InvalidParam("Invalid RoomID"),
+ }
+ }
+ return InviteV3(
+ httpReq, request, *roomID, *userID,
+ cfg, rsAPI, keys,
+ )
+ },
+ )).Methods(http.MethodPut, http.MethodOptions)
+
v1fedmux.Handle("/3pid/onbind", httputil.MakeExternalAPI("3pid_onbind",
func(req *http.Request) util.JSONResponse {
return CreateInvitesFrom3PIDInvites(req, rsAPI, cfg, federation, userAPI)