From 0f80b26b4e81184d6e917c370ab346d51c479907 Mon Sep 17 00:00:00 2001 From: qwqtoday Date: Fri, 9 Aug 2024 15:46:48 +0800 Subject: [PATCH] add the route --- syncapi/routing/routing.go | 11 +++++++++++ syncapi/routing/threads.go | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/syncapi/routing/routing.go b/syncapi/routing/routing.go index 78188d1b6..bf1d9e978 100644 --- a/syncapi/routing/routing.go +++ b/syncapi/routing/routing.go @@ -157,6 +157,16 @@ func Setup( }, httputil.WithAllowGuests()), ).Methods(http.MethodGet, http.MethodOptions) + v1unstablemux.Handle("/rooms/{roomId}/threads", httputil.MakeAuthAPI("threads", userAPI, func(req *http.Request, device *userapi.Device) util.JSONResponse { + vars, err := httputil.URLDecodeMapValues(mux.Vars(req)) + if err != nil { + return util.ErrorResponse(err) + } + + return Threads( + req, device, syncDB, rsAPI, vars["roomId"], + ) + })) v3mux.Handle("/search", httputil.MakeAuthAPI("search", userAPI, func(req *http.Request, device *userapi.Device) util.JSONResponse { if !cfg.Fulltext.Enabled { @@ -200,4 +210,5 @@ func Setup( return GetMemberships(req, device, vars["roomID"], syncDB, rsAPI, membership, notMembership, at) }, httputil.WithAllowGuests()), ).Methods(http.MethodGet, http.MethodOptions) + } diff --git a/syncapi/routing/threads.go b/syncapi/routing/threads.go index 175ece197..76e50a55b 100644 --- a/syncapi/routing/threads.go +++ b/syncapi/routing/threads.go @@ -23,7 +23,7 @@ type ThreadsResponse struct { func Threads( req *http.Request, - device userapi.Device, + device *userapi.Device, syncDB storage.Database, rsAPI api.SyncRoomserverAPI, rawRoomID string) util.JSONResponse {