mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-02 06:12:45 +00:00
Add QueryServerJoinedToRoom
to federation sender API
This commit is contained in:
parent
b9a575919a
commit
73c0c91bbd
9 changed files with 108 additions and 0 deletions
|
@ -15,6 +15,7 @@ import (
|
|||
// HTTP paths for the internal HTTP API
|
||||
const (
|
||||
FederationSenderQueryJoinedHostServerNamesInRoomPath = "/federationsender/queryJoinedHostServerNamesInRoom"
|
||||
FederationSenderQueryServerJoinedToRoomPath = "/federationsender/queryServerJoinedToRoom"
|
||||
FederationSenderQueryServerKeysPath = "/federationsender/queryServerKeys"
|
||||
|
||||
FederationSenderPerformDirectoryLookupRequestPath = "/federationsender/performDirectoryLookup"
|
||||
|
@ -115,6 +116,19 @@ func (h *httpFederationSenderInternalAPI) QueryJoinedHostServerNamesInRoom(
|
|||
return httputil.PostJSON(ctx, span, h.httpClient, apiURL, request, response)
|
||||
}
|
||||
|
||||
// QueryServerJoinedToRoom implements FederationSenderInternalAPI
|
||||
func (h *httpFederationSenderInternalAPI) QueryServerJoinedToRoom(
|
||||
ctx context.Context,
|
||||
request *api.QueryServerJoinedToRoomRequest,
|
||||
response *api.QueryServerJoinedToRoomResponse,
|
||||
) error {
|
||||
span, ctx := opentracing.StartSpanFromContext(ctx, "QueryServerJoinedToRoom")
|
||||
defer span.Finish()
|
||||
|
||||
apiURL := h.federationSenderURL + FederationSenderQueryServerJoinedToRoomPath
|
||||
return httputil.PostJSON(ctx, span, h.httpClient, apiURL, request, response)
|
||||
}
|
||||
|
||||
// Handle an instruction to make_join & send_join with a remote server.
|
||||
func (h *httpFederationSenderInternalAPI) PerformJoin(
|
||||
ctx context.Context,
|
||||
|
|
|
@ -27,6 +27,20 @@ func AddRoutes(intAPI api.FederationSenderInternalAPI, internalAPIMux *mux.Route
|
|||
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
|
||||
}),
|
||||
)
|
||||
internalAPIMux.Handle(
|
||||
FederationSenderQueryServerJoinedToRoomPath,
|
||||
httputil.MakeInternalAPI("QueryServerJoinedToRoom", func(req *http.Request) util.JSONResponse {
|
||||
var request api.QueryServerJoinedToRoomRequest
|
||||
var response api.QueryServerJoinedToRoomResponse
|
||||
if err := json.NewDecoder(req.Body).Decode(&request); err != nil {
|
||||
return util.ErrorResponse(err)
|
||||
}
|
||||
if err := intAPI.QueryServerJoinedToRoom(req.Context(), &request, &response); err != nil {
|
||||
return util.ErrorResponse(err)
|
||||
}
|
||||
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
|
||||
}),
|
||||
)
|
||||
internalAPIMux.Handle(
|
||||
FederationSenderPerformJoinRequestPath,
|
||||
httputil.MakeInternalAPI("PerformJoinRequest", func(req *http.Request) util.JSONResponse {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue