aboutsummaryrefslogtreecommitdiff
path: root/roomserver/inthttp/server.go
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2020-09-10 14:39:18 +0100
committerGitHub <noreply@github.com>2020-09-10 14:39:18 +0100
commit39507bacc3dbfc532e0d69b42957c87f27af4c77 (patch)
tree7ad845e1b25e03e7b7d7cd2d49278fe843c2ff86 /roomserver/inthttp/server.go
parent35564dd73c48b16b97cd1a972a9b9bc65ec6d7ef (diff)
Peeking via MSC2753 (#1370)
Initial implementation of MSC2753, as tested by https://github.com/matrix-org/sytest/pull/944. Doesn't yet handle unpeeks, peeked EDUs, or history viz changing during a peek - these will follow. https://github.com/matrix-org/dendrite/pull/1370 has full details.
Diffstat (limited to 'roomserver/inthttp/server.go')
-rw-r--r--roomserver/inthttp/server.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/roomserver/inthttp/server.go b/roomserver/inthttp/server.go
index 97f2a360..5816d4d8 100644
--- a/roomserver/inthttp/server.go
+++ b/roomserver/inthttp/server.go
@@ -63,6 +63,17 @@ func AddRoutes(r api.RoomserverInternalAPI, internalAPIMux *mux.Router) {
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
}),
)
+ internalAPIMux.Handle(RoomserverPerformPeekPath,
+ httputil.MakeInternalAPI("performPeek", func(req *http.Request) util.JSONResponse {
+ var request api.PerformPeekRequest
+ var response api.PerformPeekResponse
+ if err := json.NewDecoder(req.Body).Decode(&request); err != nil {
+ return util.MessageResponse(http.StatusBadRequest, err.Error())
+ }
+ r.PerformPeek(req.Context(), &request, &response)
+ return util.JSONResponse{Code: http.StatusOK, JSON: &response}
+ }),
+ )
internalAPIMux.Handle(RoomserverPerformPublishPath,
httputil.MakeInternalAPI("performPublish", func(req *http.Request) util.JSONResponse {
var request api.PerformPublishRequest