mirror of
https://github.com/element-hq/dendrite.git
synced 2025-09-13 21:02:25 +03:00
syncapi: define specific interfaces for internal HTTP communications (#2416)
* syncapi: use finer-grained interfaces when making the syncapi * Use specific interfaces for syncapi-roomserver interactions * Define query access token api for shared http auth code
This commit is contained in:
parent
3c940c428d
commit
d86dcbef66
20 changed files with 95 additions and 91 deletions
|
@ -42,7 +42,7 @@ type ContextRespsonse struct {
|
|||
|
||||
func Context(
|
||||
req *http.Request, device *userapi.Device,
|
||||
rsAPI roomserver.RoomserverInternalAPI,
|
||||
rsAPI roomserver.SyncRoomserverAPI,
|
||||
syncDB storage.Database,
|
||||
roomID, eventID string,
|
||||
lazyLoadCache *caching.LazyLoadCache,
|
||||
|
|
|
@ -36,8 +36,7 @@ import (
|
|||
type messagesReq struct {
|
||||
ctx context.Context
|
||||
db storage.Database
|
||||
rsAPI api.RoomserverInternalAPI
|
||||
federation *gomatrixserverlib.FederationClient
|
||||
rsAPI api.SyncRoomserverAPI
|
||||
cfg *config.SyncAPI
|
||||
roomID string
|
||||
from *types.TopologyToken
|
||||
|
@ -61,8 +60,7 @@ type messagesResp struct {
|
|||
// See: https://matrix.org/docs/spec/client_server/latest.html#get-matrix-client-r0-rooms-roomid-messages
|
||||
func OnIncomingMessagesRequest(
|
||||
req *http.Request, db storage.Database, roomID string, device *userapi.Device,
|
||||
federation *gomatrixserverlib.FederationClient,
|
||||
rsAPI api.RoomserverInternalAPI,
|
||||
rsAPI api.SyncRoomserverAPI,
|
||||
cfg *config.SyncAPI,
|
||||
srp *sync.RequestPool,
|
||||
lazyLoadCache *caching.LazyLoadCache,
|
||||
|
@ -180,7 +178,6 @@ func OnIncomingMessagesRequest(
|
|||
ctx: req.Context(),
|
||||
db: db,
|
||||
rsAPI: rsAPI,
|
||||
federation: federation,
|
||||
cfg: cfg,
|
||||
roomID: roomID,
|
||||
from: &from,
|
||||
|
@ -247,7 +244,7 @@ func OnIncomingMessagesRequest(
|
|||
}
|
||||
}
|
||||
|
||||
func checkIsRoomForgotten(ctx context.Context, roomID, userID string, rsAPI api.RoomserverInternalAPI) (bool, error) {
|
||||
func checkIsRoomForgotten(ctx context.Context, roomID, userID string, rsAPI api.SyncRoomserverAPI) (bool, error) {
|
||||
req := api.QueryMembershipForUserRequest{
|
||||
RoomID: roomID,
|
||||
UserID: userID,
|
||||
|
|
|
@ -36,8 +36,8 @@ import (
|
|||
// nolint: gocyclo
|
||||
func Setup(
|
||||
csMux *mux.Router, srp *sync.RequestPool, syncDB storage.Database,
|
||||
userAPI userapi.UserInternalAPI, federation *gomatrixserverlib.FederationClient,
|
||||
rsAPI api.RoomserverInternalAPI,
|
||||
userAPI userapi.SyncUserAPI,
|
||||
rsAPI api.SyncRoomserverAPI,
|
||||
cfg *config.SyncAPI,
|
||||
lazyLoadCache *caching.LazyLoadCache,
|
||||
) {
|
||||
|
@ -53,7 +53,7 @@ func Setup(
|
|||
if err != nil {
|
||||
return util.ErrorResponse(err)
|
||||
}
|
||||
return OnIncomingMessagesRequest(req, syncDB, vars["roomID"], device, federation, rsAPI, cfg, srp, lazyLoadCache)
|
||||
return OnIncomingMessagesRequest(req, syncDB, vars["roomID"], device, rsAPI, cfg, srp, lazyLoadCache)
|
||||
})).Methods(http.MethodGet, http.MethodOptions)
|
||||
|
||||
v3mux.Handle("/user/{userId}/filter",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue