mirror of
https://github.com/element-hq/dendrite.git
synced 2025-09-13 21:02:25 +03:00
Add pseudoID compatibility to Invites (#3126)
This commit is contained in:
parent
fea946d914
commit
d507c5fc95
17 changed files with 358 additions and 136 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue