mirror of
https://github.com/1f349/dendrite.git
synced 2024-11-09 22:42:58 +00:00
Define component interfaces based on consumers (2/2) (#2425)
* convert remaining interfaces * Tidy up the userapi interfaces
This commit is contained in:
parent
e4da04e75b
commit
9957752a9d
@ -38,7 +38,7 @@ func AddPublicRoutes(
|
||||
transactionsCache *transactions.Cache,
|
||||
fsAPI federationAPI.ClientFederationAPI,
|
||||
userAPI userapi.ClientUserAPI,
|
||||
userDirectoryProvider userapi.UserDirectoryProvider,
|
||||
userDirectoryProvider userapi.QuerySearchProfilesAPI,
|
||||
keyAPI keyserverAPI.ClientKeyAPI,
|
||||
extRoomsProvider api.ExtraPublicRoomsProvider,
|
||||
) {
|
||||
|
@ -53,7 +53,7 @@ func Setup(
|
||||
rsAPI roomserverAPI.ClientRoomserverAPI,
|
||||
asAPI appserviceAPI.AppServiceQueryAPI,
|
||||
userAPI userapi.ClientUserAPI,
|
||||
userDirectoryProvider userapi.UserDirectoryProvider,
|
||||
userDirectoryProvider userapi.QuerySearchProfilesAPI,
|
||||
federation *gomatrixserverlib.FederationClient,
|
||||
syncProducer *producers.SyncAPIProducer,
|
||||
transactionsCache *transactions.Cache,
|
||||
|
@ -36,7 +36,7 @@ func SearchUserDirectory(
|
||||
device *userapi.Device,
|
||||
userAPI userapi.ClientUserAPI,
|
||||
rsAPI api.ClientRoomserverAPI,
|
||||
provider userapi.UserDirectoryProvider,
|
||||
provider userapi.QuerySearchProfilesAPI,
|
||||
serverName gomatrixserverlib.ServerName,
|
||||
searchString string,
|
||||
limit int,
|
||||
|
@ -37,7 +37,7 @@ import (
|
||||
type PineconeUserProvider struct {
|
||||
r *pineconeRouter.Router
|
||||
s *pineconeSessions.Sessions
|
||||
userAPI userapi.UserProfileAPI
|
||||
userAPI userapi.QuerySearchProfilesAPI
|
||||
fedClient *gomatrixserverlib.FederationClient
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ const PublicURL = "/_matrix/p2p/profiles"
|
||||
func NewPineconeUserProvider(
|
||||
r *pineconeRouter.Router,
|
||||
s *pineconeSessions.Sessions,
|
||||
userAPI userapi.UserProfileAPI,
|
||||
userAPI userapi.QuerySearchProfilesAPI,
|
||||
fedClient *gomatrixserverlib.FederationClient,
|
||||
) *PineconeUserProvider {
|
||||
p := &PineconeUserProvider{
|
||||
|
@ -14,17 +14,13 @@ import (
|
||||
// implements as proxy calls, with built-in backoff/retries/etc. Errors returned from functions in
|
||||
// this interface are of type FederationClientError
|
||||
type FederationClient interface {
|
||||
gomatrixserverlib.BackfillClient
|
||||
gomatrixserverlib.FederatedStateClient
|
||||
GetUserDevices(ctx context.Context, s gomatrixserverlib.ServerName, userID string) (res gomatrixserverlib.RespUserDevices, err error)
|
||||
ClaimKeys(ctx context.Context, s gomatrixserverlib.ServerName, oneTimeKeys map[string]map[string]string) (res gomatrixserverlib.RespClaimKeys, err error)
|
||||
QueryKeys(ctx context.Context, s gomatrixserverlib.ServerName, keys map[string][]string) (res gomatrixserverlib.RespQueryKeys, err error)
|
||||
GetEvent(ctx context.Context, s gomatrixserverlib.ServerName, eventID string) (res gomatrixserverlib.Transaction, err error)
|
||||
MSC2836EventRelationships(ctx context.Context, dst gomatrixserverlib.ServerName, r gomatrixserverlib.MSC2836EventRelationshipsRequest, roomVersion gomatrixserverlib.RoomVersion) (res gomatrixserverlib.MSC2836EventRelationshipsResponse, err error)
|
||||
MSC2946Spaces(ctx context.Context, dst gomatrixserverlib.ServerName, roomID string, suggestedOnly bool) (res gomatrixserverlib.MSC2946SpacesResponse, err error)
|
||||
LookupServerKeys(ctx context.Context, s gomatrixserverlib.ServerName, keyRequests map[gomatrixserverlib.PublicKeyLookupRequest]gomatrixserverlib.Timestamp) ([]gomatrixserverlib.ServerKeys, error)
|
||||
GetEventAuth(ctx context.Context, s gomatrixserverlib.ServerName, roomVersion gomatrixserverlib.RoomVersion, roomID, eventID string) (res gomatrixserverlib.RespEventAuth, err error)
|
||||
LookupMissingEvents(ctx context.Context, s gomatrixserverlib.ServerName, roomID string, missing gomatrixserverlib.MissingEvents, roomVersion gomatrixserverlib.RoomVersion) (res gomatrixserverlib.RespMissingEvents, err error)
|
||||
}
|
||||
|
||||
// FederationClientError is returned from FederationClient methods in the event of a problem.
|
||||
@ -43,17 +39,10 @@ type FederationInternalAPI interface {
|
||||
FederationClient
|
||||
gomatrixserverlib.KeyDatabase
|
||||
ClientFederationAPI
|
||||
|
||||
KeyRing() *gomatrixserverlib.KeyRing
|
||||
RoomserverFederationAPI
|
||||
|
||||
QueryServerKeys(ctx context.Context, request *QueryServerKeysRequest, response *QueryServerKeysResponse) error
|
||||
|
||||
// PerformDirectoryLookup looks up a remote room ID from a room alias.
|
||||
PerformDirectoryLookup(
|
||||
ctx context.Context,
|
||||
request *PerformDirectoryLookupRequest,
|
||||
response *PerformDirectoryLookupResponse,
|
||||
) error
|
||||
// Query the server names of the joined hosts in a room.
|
||||
// Unlike QueryJoinedHostsInRoom, this function returns a de-duplicated slice
|
||||
// containing only the server names (without information for membership events).
|
||||
@ -63,30 +52,6 @@ type FederationInternalAPI interface {
|
||||
request *QueryJoinedHostServerNamesInRoomRequest,
|
||||
response *QueryJoinedHostServerNamesInRoomResponse,
|
||||
) error
|
||||
// Handle an instruction to make_join & send_join with a remote server.
|
||||
PerformJoin(
|
||||
ctx context.Context,
|
||||
request *PerformJoinRequest,
|
||||
response *PerformJoinResponse,
|
||||
)
|
||||
// Handle an instruction to peek a room on a remote server.
|
||||
PerformOutboundPeek(
|
||||
ctx context.Context,
|
||||
request *PerformOutboundPeekRequest,
|
||||
response *PerformOutboundPeekResponse,
|
||||
) error
|
||||
// Handle an instruction to make_leave & send_leave with a remote server.
|
||||
PerformLeave(
|
||||
ctx context.Context,
|
||||
request *PerformLeaveRequest,
|
||||
response *PerformLeaveResponse,
|
||||
) error
|
||||
// Handle sending an invite to a remote server.
|
||||
PerformInvite(
|
||||
ctx context.Context,
|
||||
request *PerformInviteRequest,
|
||||
response *PerformInviteResponse,
|
||||
) error
|
||||
// Notifies the federation sender that these servers may be online and to retry sending messages.
|
||||
PerformServersAlive(
|
||||
ctx context.Context,
|
||||
@ -105,6 +70,31 @@ type ClientFederationAPI interface {
|
||||
QueryJoinedHostServerNamesInRoom(ctx context.Context, request *QueryJoinedHostServerNamesInRoomRequest, response *QueryJoinedHostServerNamesInRoomResponse) error
|
||||
}
|
||||
|
||||
type RoomserverFederationAPI interface {
|
||||
gomatrixserverlib.BackfillClient
|
||||
gomatrixserverlib.FederatedStateClient
|
||||
KeyRing() *gomatrixserverlib.KeyRing
|
||||
|
||||
// PerformDirectoryLookup looks up a remote room ID from a room alias.
|
||||
PerformDirectoryLookup(ctx context.Context, request *PerformDirectoryLookupRequest, response *PerformDirectoryLookupResponse) error
|
||||
// Handle an instruction to make_join & send_join with a remote server.
|
||||
PerformJoin(ctx context.Context, request *PerformJoinRequest, response *PerformJoinResponse)
|
||||
// Handle an instruction to make_leave & send_leave with a remote server.
|
||||
PerformLeave(ctx context.Context, request *PerformLeaveRequest, response *PerformLeaveResponse) error
|
||||
// Handle sending an invite to a remote server.
|
||||
PerformInvite(ctx context.Context, request *PerformInviteRequest, response *PerformInviteResponse) error
|
||||
// Handle an instruction to peek a room on a remote server.
|
||||
PerformOutboundPeek(ctx context.Context, request *PerformOutboundPeekRequest, response *PerformOutboundPeekResponse) error
|
||||
// Query the server names of the joined hosts in a room.
|
||||
// Unlike QueryJoinedHostsInRoom, this function returns a de-duplicated slice
|
||||
// containing only the server names (without information for membership events).
|
||||
// The response will include this server if they are joined to the room.
|
||||
QueryJoinedHostServerNamesInRoom(ctx context.Context, request *QueryJoinedHostServerNamesInRoomRequest, response *QueryJoinedHostServerNamesInRoomResponse) error
|
||||
GetEventAuth(ctx context.Context, s gomatrixserverlib.ServerName, roomVersion gomatrixserverlib.RoomVersion, roomID, eventID string) (res gomatrixserverlib.RespEventAuth, err error)
|
||||
GetEvent(ctx context.Context, s gomatrixserverlib.ServerName, eventID string) (res gomatrixserverlib.Transaction, err error)
|
||||
LookupMissingEvents(ctx context.Context, s gomatrixserverlib.ServerName, roomID string, missing gomatrixserverlib.MissingEvents, roomVersion gomatrixserverlib.RoomVersion) (res gomatrixserverlib.RespMissingEvents, err error)
|
||||
}
|
||||
|
||||
type QueryServerKeysRequest struct {
|
||||
ServerName gomatrixserverlib.ServerName
|
||||
KeyIDToCriteria map[gomatrixserverlib.KeyID]gomatrixserverlib.PublicKeyNotaryQueryCriteria
|
||||
|
@ -49,7 +49,7 @@ func AddPublicRoutes(
|
||||
userAPI userapi.UserInternalAPI,
|
||||
federation *gomatrixserverlib.FederationClient,
|
||||
keyRing gomatrixserverlib.JSONVerifier,
|
||||
rsAPI roomserverAPI.RoomserverInternalAPI,
|
||||
rsAPI roomserverAPI.FederationRoomserverAPI,
|
||||
federationAPI federationAPI.FederationInternalAPI,
|
||||
keyAPI keyserverAPI.KeyInternalAPI,
|
||||
servers federationAPI.ServersInRoomProvider,
|
||||
|
@ -33,7 +33,7 @@ import (
|
||||
func Backfill(
|
||||
httpReq *http.Request,
|
||||
request *gomatrixserverlib.FederationRequest,
|
||||
rsAPI api.RoomserverInternalAPI,
|
||||
rsAPI api.FederationRoomserverAPI,
|
||||
roomID string,
|
||||
cfg *config.FederationAPI,
|
||||
) util.JSONResponse {
|
||||
|
@ -26,7 +26,7 @@ import (
|
||||
func GetEventAuth(
|
||||
ctx context.Context,
|
||||
request *gomatrixserverlib.FederationRequest,
|
||||
rsAPI api.RoomserverInternalAPI,
|
||||
rsAPI api.FederationRoomserverAPI,
|
||||
roomID string,
|
||||
eventID string,
|
||||
) util.JSONResponse {
|
||||
|
@ -29,7 +29,7 @@ import (
|
||||
func GetEvent(
|
||||
ctx context.Context,
|
||||
request *gomatrixserverlib.FederationRequest,
|
||||
rsAPI api.RoomserverInternalAPI,
|
||||
rsAPI api.FederationRoomserverAPI,
|
||||
eventID string,
|
||||
origin gomatrixserverlib.ServerName,
|
||||
) util.JSONResponse {
|
||||
@ -56,7 +56,7 @@ func GetEvent(
|
||||
func allowedToSeeEvent(
|
||||
ctx context.Context,
|
||||
origin gomatrixserverlib.ServerName,
|
||||
rsAPI api.RoomserverInternalAPI,
|
||||
rsAPI api.FederationRoomserverAPI,
|
||||
eventID string,
|
||||
) *util.JSONResponse {
|
||||
var authResponse api.QueryServerAllowedToSeeEventResponse
|
||||
@ -82,7 +82,7 @@ func allowedToSeeEvent(
|
||||
}
|
||||
|
||||
// fetchEvent fetches the event without auth checks. Returns an error if the event cannot be found.
|
||||
func fetchEvent(ctx context.Context, rsAPI api.RoomserverInternalAPI, eventID string) (*gomatrixserverlib.Event, *util.JSONResponse) {
|
||||
func fetchEvent(ctx context.Context, rsAPI api.FederationRoomserverAPI, eventID string) (*gomatrixserverlib.Event, *util.JSONResponse) {
|
||||
var eventsResponse api.QueryEventsByIDResponse
|
||||
err := rsAPI.QueryEventsByID(
|
||||
ctx,
|
||||
|
@ -35,7 +35,7 @@ func InviteV2(
|
||||
roomID string,
|
||||
eventID string,
|
||||
cfg *config.FederationAPI,
|
||||
rsAPI api.RoomserverInternalAPI,
|
||||
rsAPI api.FederationRoomserverAPI,
|
||||
keys gomatrixserverlib.JSONVerifier,
|
||||
) util.JSONResponse {
|
||||
inviteReq := gomatrixserverlib.InviteV2Request{}
|
||||
@ -72,7 +72,7 @@ func InviteV1(
|
||||
roomID string,
|
||||
eventID string,
|
||||
cfg *config.FederationAPI,
|
||||
rsAPI api.RoomserverInternalAPI,
|
||||
rsAPI api.FederationRoomserverAPI,
|
||||
keys gomatrixserverlib.JSONVerifier,
|
||||
) util.JSONResponse {
|
||||
roomVer := gomatrixserverlib.RoomVersionV1
|
||||
@ -110,7 +110,7 @@ func processInvite(
|
||||
roomID string,
|
||||
eventID string,
|
||||
cfg *config.FederationAPI,
|
||||
rsAPI api.RoomserverInternalAPI,
|
||||
rsAPI api.FederationRoomserverAPI,
|
||||
keys gomatrixserverlib.JSONVerifier,
|
||||
) util.JSONResponse {
|
||||
|
||||
|
@ -34,7 +34,7 @@ func MakeJoin(
|
||||
httpReq *http.Request,
|
||||
request *gomatrixserverlib.FederationRequest,
|
||||
cfg *config.FederationAPI,
|
||||
rsAPI api.RoomserverInternalAPI,
|
||||
rsAPI api.FederationRoomserverAPI,
|
||||
roomID, userID string,
|
||||
remoteVersions []gomatrixserverlib.RoomVersion,
|
||||
) util.JSONResponse {
|
||||
@ -165,7 +165,7 @@ func SendJoin(
|
||||
httpReq *http.Request,
|
||||
request *gomatrixserverlib.FederationRequest,
|
||||
cfg *config.FederationAPI,
|
||||
rsAPI api.RoomserverInternalAPI,
|
||||
rsAPI api.FederationRoomserverAPI,
|
||||
keys gomatrixserverlib.JSONVerifier,
|
||||
roomID, eventID string,
|
||||
) util.JSONResponse {
|
||||
|
@ -30,7 +30,7 @@ func MakeLeave(
|
||||
httpReq *http.Request,
|
||||
request *gomatrixserverlib.FederationRequest,
|
||||
cfg *config.FederationAPI,
|
||||
rsAPI api.RoomserverInternalAPI,
|
||||
rsAPI api.FederationRoomserverAPI,
|
||||
roomID, userID string,
|
||||
) util.JSONResponse {
|
||||
_, domain, err := gomatrixserverlib.SplitID('@', userID)
|
||||
@ -122,7 +122,7 @@ func SendLeave(
|
||||
httpReq *http.Request,
|
||||
request *gomatrixserverlib.FederationRequest,
|
||||
cfg *config.FederationAPI,
|
||||
rsAPI api.RoomserverInternalAPI,
|
||||
rsAPI api.FederationRoomserverAPI,
|
||||
keys gomatrixserverlib.JSONVerifier,
|
||||
roomID, eventID string,
|
||||
) util.JSONResponse {
|
||||
|
@ -34,7 +34,7 @@ type getMissingEventRequest struct {
|
||||
func GetMissingEvents(
|
||||
httpReq *http.Request,
|
||||
request *gomatrixserverlib.FederationRequest,
|
||||
rsAPI api.RoomserverInternalAPI,
|
||||
rsAPI api.FederationRoomserverAPI,
|
||||
roomID string,
|
||||
) util.JSONResponse {
|
||||
var gme getMissingEventRequest
|
||||
|
@ -30,7 +30,7 @@ type openIDUserInfoResponse struct {
|
||||
// GetOpenIDUserInfo implements GET /_matrix/federation/v1/openid/userinfo
|
||||
func GetOpenIDUserInfo(
|
||||
httpReq *http.Request,
|
||||
userAPI userapi.UserInternalAPI,
|
||||
userAPI userapi.FederationUserAPI,
|
||||
) util.JSONResponse {
|
||||
token := httpReq.URL.Query().Get("access_token")
|
||||
if len(token) == 0 {
|
||||
|
@ -29,7 +29,7 @@ func Peek(
|
||||
httpReq *http.Request,
|
||||
request *gomatrixserverlib.FederationRequest,
|
||||
cfg *config.FederationAPI,
|
||||
rsAPI api.RoomserverInternalAPI,
|
||||
rsAPI api.FederationRoomserverAPI,
|
||||
roomID, peekID string,
|
||||
remoteVersions []gomatrixserverlib.RoomVersion,
|
||||
) util.JSONResponse {
|
||||
|
@ -29,7 +29,7 @@ import (
|
||||
// GetProfile implements GET /_matrix/federation/v1/query/profile
|
||||
func GetProfile(
|
||||
httpReq *http.Request,
|
||||
userAPI userapi.UserInternalAPI,
|
||||
userAPI userapi.FederationUserAPI,
|
||||
cfg *config.FederationAPI,
|
||||
) util.JSONResponse {
|
||||
userID, field := httpReq.FormValue("user_id"), httpReq.FormValue("field")
|
||||
|
@ -23,7 +23,7 @@ type filter struct {
|
||||
}
|
||||
|
||||
// GetPostPublicRooms implements GET and POST /publicRooms
|
||||
func GetPostPublicRooms(req *http.Request, rsAPI roomserverAPI.RoomserverInternalAPI) util.JSONResponse {
|
||||
func GetPostPublicRooms(req *http.Request, rsAPI roomserverAPI.FederationRoomserverAPI) util.JSONResponse {
|
||||
var request PublicRoomReq
|
||||
if fillErr := fillPublicRoomsReq(req, &request); fillErr != nil {
|
||||
return *fillErr
|
||||
@ -42,7 +42,7 @@ func GetPostPublicRooms(req *http.Request, rsAPI roomserverAPI.RoomserverInterna
|
||||
}
|
||||
|
||||
func publicRooms(
|
||||
ctx context.Context, request PublicRoomReq, rsAPI roomserverAPI.RoomserverInternalAPI,
|
||||
ctx context.Context, request PublicRoomReq, rsAPI roomserverAPI.FederationRoomserverAPI,
|
||||
) (*gomatrixserverlib.RespPublicRooms, error) {
|
||||
|
||||
var response gomatrixserverlib.RespPublicRooms
|
||||
@ -111,7 +111,7 @@ func fillPublicRoomsReq(httpReq *http.Request, request *PublicRoomReq) *util.JSO
|
||||
}
|
||||
|
||||
// due to lots of switches
|
||||
func fillInRooms(ctx context.Context, roomIDs []string, rsAPI roomserverAPI.RoomserverInternalAPI) ([]gomatrixserverlib.PublicRoom, error) {
|
||||
func fillInRooms(ctx context.Context, roomIDs []string, rsAPI roomserverAPI.FederationRoomserverAPI) ([]gomatrixserverlib.PublicRoom, error) {
|
||||
avatarTuple := gomatrixserverlib.StateKeyTuple{EventType: "m.room.avatar", StateKey: ""}
|
||||
nameTuple := gomatrixserverlib.StateKeyTuple{EventType: "m.room.name", StateKey: ""}
|
||||
canonicalTuple := gomatrixserverlib.StateKeyTuple{EventType: gomatrixserverlib.MRoomCanonicalAlias, StateKey: ""}
|
||||
|
@ -32,7 +32,7 @@ func RoomAliasToID(
|
||||
httpReq *http.Request,
|
||||
federation *gomatrixserverlib.FederationClient,
|
||||
cfg *config.FederationAPI,
|
||||
rsAPI roomserverAPI.RoomserverInternalAPI,
|
||||
rsAPI roomserverAPI.FederationRoomserverAPI,
|
||||
senderAPI federationAPI.FederationInternalAPI,
|
||||
) util.JSONResponse {
|
||||
roomAlias := httpReq.FormValue("room_alias")
|
||||
|
@ -47,11 +47,11 @@ import (
|
||||
func Setup(
|
||||
fedMux, keyMux, wkMux *mux.Router,
|
||||
cfg *config.FederationAPI,
|
||||
rsAPI roomserverAPI.RoomserverInternalAPI,
|
||||
rsAPI roomserverAPI.FederationRoomserverAPI,
|
||||
fsAPI federationAPI.FederationInternalAPI,
|
||||
keys gomatrixserverlib.JSONVerifier,
|
||||
federation *gomatrixserverlib.FederationClient,
|
||||
userAPI userapi.UserInternalAPI,
|
||||
userAPI userapi.FederationUserAPI,
|
||||
keyAPI keyserverAPI.KeyInternalAPI,
|
||||
mscCfg *config.MSCs,
|
||||
servers federationAPI.ServersInRoomProvider,
|
||||
@ -497,7 +497,7 @@ func Setup(
|
||||
|
||||
func ErrorIfLocalServerNotInRoom(
|
||||
ctx context.Context,
|
||||
rsAPI api.RoomserverInternalAPI,
|
||||
rsAPI api.FederationRoomserverAPI,
|
||||
roomID string,
|
||||
) *util.JSONResponse {
|
||||
// Check if we think we're in this room. If we aren't then
|
||||
|
@ -82,7 +82,7 @@ func Send(
|
||||
request *gomatrixserverlib.FederationRequest,
|
||||
txnID gomatrixserverlib.TransactionID,
|
||||
cfg *config.FederationAPI,
|
||||
rsAPI api.RoomserverInternalAPI,
|
||||
rsAPI api.FederationRoomserverAPI,
|
||||
keyAPI keyapi.KeyInternalAPI,
|
||||
keys gomatrixserverlib.JSONVerifier,
|
||||
federation *gomatrixserverlib.FederationClient,
|
||||
@ -182,7 +182,7 @@ func Send(
|
||||
|
||||
type txnReq struct {
|
||||
gomatrixserverlib.Transaction
|
||||
rsAPI api.RoomserverInternalAPI
|
||||
rsAPI api.FederationRoomserverAPI
|
||||
keyAPI keyapi.KeyInternalAPI
|
||||
ourServerName gomatrixserverlib.ServerName
|
||||
keys gomatrixserverlib.JSONVerifier
|
||||
|
@ -183,7 +183,7 @@ func (c *txnFedClient) LookupMissingEvents(ctx context.Context, s gomatrixserver
|
||||
return c.getMissingEvents(missing)
|
||||
}
|
||||
|
||||
func mustCreateTransaction(rsAPI api.RoomserverInternalAPI, fedClient txnFederationClient, pdus []json.RawMessage) *txnReq {
|
||||
func mustCreateTransaction(rsAPI api.FederationRoomserverAPI, fedClient txnFederationClient, pdus []json.RawMessage) *txnReq {
|
||||
t := &txnReq{
|
||||
rsAPI: rsAPI,
|
||||
keys: &test.NopJSONVerifier{},
|
||||
|
@ -27,7 +27,7 @@ import (
|
||||
func GetState(
|
||||
ctx context.Context,
|
||||
request *gomatrixserverlib.FederationRequest,
|
||||
rsAPI api.RoomserverInternalAPI,
|
||||
rsAPI api.FederationRoomserverAPI,
|
||||
roomID string,
|
||||
) util.JSONResponse {
|
||||
eventID, err := parseEventIDParam(request)
|
||||
@ -50,7 +50,7 @@ func GetState(
|
||||
func GetStateIDs(
|
||||
ctx context.Context,
|
||||
request *gomatrixserverlib.FederationRequest,
|
||||
rsAPI api.RoomserverInternalAPI,
|
||||
rsAPI api.FederationRoomserverAPI,
|
||||
roomID string,
|
||||
) util.JSONResponse {
|
||||
eventID, err := parseEventIDParam(request)
|
||||
@ -97,7 +97,7 @@ func parseEventIDParam(
|
||||
func getState(
|
||||
ctx context.Context,
|
||||
request *gomatrixserverlib.FederationRequest,
|
||||
rsAPI api.RoomserverInternalAPI,
|
||||
rsAPI api.FederationRoomserverAPI,
|
||||
roomID string,
|
||||
eventID string,
|
||||
) (stateEvents, authEvents []*gomatrixserverlib.HeaderedEvent, errRes *util.JSONResponse) {
|
||||
|
@ -55,10 +55,10 @@ var (
|
||||
|
||||
// CreateInvitesFrom3PIDInvites implements POST /_matrix/federation/v1/3pid/onbind
|
||||
func CreateInvitesFrom3PIDInvites(
|
||||
req *http.Request, rsAPI api.RoomserverInternalAPI,
|
||||
req *http.Request, rsAPI api.FederationRoomserverAPI,
|
||||
cfg *config.FederationAPI,
|
||||
federation *gomatrixserverlib.FederationClient,
|
||||
userAPI userapi.UserInternalAPI,
|
||||
userAPI userapi.FederationUserAPI,
|
||||
) util.JSONResponse {
|
||||
var body invites
|
||||
if reqErr := httputil.UnmarshalJSONRequest(req, &body); reqErr != nil {
|
||||
@ -105,7 +105,7 @@ func ExchangeThirdPartyInvite(
|
||||
httpReq *http.Request,
|
||||
request *gomatrixserverlib.FederationRequest,
|
||||
roomID string,
|
||||
rsAPI api.RoomserverInternalAPI,
|
||||
rsAPI api.FederationRoomserverAPI,
|
||||
cfg *config.FederationAPI,
|
||||
federation *gomatrixserverlib.FederationClient,
|
||||
) util.JSONResponse {
|
||||
@ -203,10 +203,10 @@ func ExchangeThirdPartyInvite(
|
||||
// Returns an error if there was a problem building the event or fetching the
|
||||
// necessary data to do so.
|
||||
func createInviteFrom3PIDInvite(
|
||||
ctx context.Context, rsAPI api.RoomserverInternalAPI,
|
||||
ctx context.Context, rsAPI api.FederationRoomserverAPI,
|
||||
cfg *config.FederationAPI,
|
||||
inv invite, federation *gomatrixserverlib.FederationClient,
|
||||
userAPI userapi.UserInternalAPI,
|
||||
userAPI userapi.FederationUserAPI,
|
||||
) (*gomatrixserverlib.Event, error) {
|
||||
verReq := api.QueryRoomVersionForRoomRequest{RoomID: inv.RoomID}
|
||||
verRes := api.QueryRoomVersionForRoomResponse{}
|
||||
@ -270,7 +270,7 @@ func createInviteFrom3PIDInvite(
|
||||
// Returns an error if something failed during the process.
|
||||
func buildMembershipEvent(
|
||||
ctx context.Context,
|
||||
builder *gomatrixserverlib.EventBuilder, rsAPI api.RoomserverInternalAPI,
|
||||
builder *gomatrixserverlib.EventBuilder, rsAPI api.FederationRoomserverAPI,
|
||||
cfg *config.FederationAPI,
|
||||
) (*gomatrixserverlib.Event, error) {
|
||||
eventsNeeded, err := gomatrixserverlib.StateNeededForEventBuilder(builder)
|
||||
|
@ -29,12 +29,13 @@ import (
|
||||
type KeyInternalAPI interface {
|
||||
SyncKeyAPI
|
||||
ClientKeyAPI
|
||||
UserKeyAPI
|
||||
|
||||
// SetUserAPI assigns a user API to query when extracting device names.
|
||||
SetUserAPI(i userapi.UserInternalAPI)
|
||||
// InputDeviceListUpdate from a federated server EDU
|
||||
InputDeviceListUpdate(ctx context.Context, req *InputDeviceListUpdateRequest, res *InputDeviceListUpdateResponse)
|
||||
|
||||
PerformDeleteKeys(ctx context.Context, req *PerformDeleteKeysRequest, res *PerformDeleteKeysResponse)
|
||||
QueryDeviceMessages(ctx context.Context, req *QueryDeviceMessagesRequest, res *QueryDeviceMessagesResponse)
|
||||
QuerySignatures(ctx context.Context, req *QuerySignaturesRequest, res *QuerySignaturesResponse)
|
||||
}
|
||||
@ -49,6 +50,12 @@ type ClientKeyAPI interface {
|
||||
PerformClaimKeys(ctx context.Context, req *PerformClaimKeysRequest, res *PerformClaimKeysResponse)
|
||||
}
|
||||
|
||||
// API functions required by the userapi
|
||||
type UserKeyAPI interface {
|
||||
PerformUploadKeys(ctx context.Context, req *PerformUploadKeysRequest, res *PerformUploadKeysResponse)
|
||||
PerformDeleteKeys(ctx context.Context, req *PerformDeleteKeysRequest, res *PerformDeleteKeysResponse)
|
||||
}
|
||||
|
||||
// API functions required by the syncapi
|
||||
type SyncKeyAPI interface {
|
||||
QueryKeyChanges(ctx context.Context, req *QueryKeyChangesRequest, res *QueryKeyChangesResponse)
|
||||
|
@ -19,10 +19,12 @@ type RoomserverInternalAPI interface {
|
||||
SyncRoomserverAPI
|
||||
AppserviceRoomserverAPI
|
||||
ClientRoomserverAPI
|
||||
UserRoomserverAPI
|
||||
FederationRoomserverAPI
|
||||
|
||||
// needed to avoid chicken and egg scenario when setting up the
|
||||
// interdependencies between the roomserver and other input APIs
|
||||
SetFederationAPI(fsAPI fsAPI.FederationInternalAPI, keyRing *gomatrixserverlib.KeyRing)
|
||||
SetFederationAPI(fsAPI fsAPI.RoomserverFederationAPI, keyRing *gomatrixserverlib.KeyRing)
|
||||
SetAppserviceAPI(asAPI asAPI.AppServiceQueryAPI)
|
||||
SetUserAPI(userAPI userapi.UserInternalAPI)
|
||||
|
||||
@ -62,48 +64,6 @@ type RoomserverInternalAPI interface {
|
||||
res *PerformPublishResponse,
|
||||
)
|
||||
|
||||
PerformInboundPeek(
|
||||
ctx context.Context,
|
||||
req *PerformInboundPeekRequest,
|
||||
res *PerformInboundPeekResponse,
|
||||
) error
|
||||
|
||||
QueryPublishedRooms(
|
||||
ctx context.Context,
|
||||
req *QueryPublishedRoomsRequest,
|
||||
res *QueryPublishedRoomsResponse,
|
||||
) error
|
||||
|
||||
// Query if we think we're still in a room.
|
||||
QueryServerJoinedToRoom(
|
||||
ctx context.Context,
|
||||
req *QueryServerJoinedToRoomRequest,
|
||||
res *QueryServerJoinedToRoomResponse,
|
||||
) error
|
||||
|
||||
// Query whether a server is allowed to see an event
|
||||
QueryServerAllowedToSeeEvent(
|
||||
ctx context.Context,
|
||||
req *QueryServerAllowedToSeeEventRequest,
|
||||
res *QueryServerAllowedToSeeEventResponse,
|
||||
) error
|
||||
|
||||
// Query missing events for a room from roomserver
|
||||
QueryMissingEvents(
|
||||
ctx context.Context,
|
||||
req *QueryMissingEventsRequest,
|
||||
res *QueryMissingEventsResponse,
|
||||
) error
|
||||
|
||||
// Query to get state and auth chain for a (potentially hypothetical) event.
|
||||
// Takes lists of PrevEventIDs and AuthEventsIDs and uses them to calculate
|
||||
// the state and auth chain to return.
|
||||
QueryStateAndAuthChain(
|
||||
ctx context.Context,
|
||||
req *QueryStateAndAuthChainRequest,
|
||||
res *QueryStateAndAuthChainResponse,
|
||||
) error
|
||||
|
||||
// QueryAuthChain returns the entire auth chain for the event IDs given.
|
||||
// The response includes the events in the request.
|
||||
// Omits without error for any missing auth events. There will be no duplicates.
|
||||
@ -115,8 +75,6 @@ type RoomserverInternalAPI interface {
|
||||
|
||||
// QueryRoomsForUser retrieves a list of room IDs matching the given query.
|
||||
QueryRoomsForUser(ctx context.Context, req *QueryRoomsForUserRequest, res *QueryRoomsForUserResponse) error
|
||||
// QueryServerBannedFromRoom returns whether a server is banned from a room by server ACLs.
|
||||
QueryServerBannedFromRoom(ctx context.Context, req *QueryServerBannedFromRoomRequest, res *QueryServerBannedFromRoomResponse) error
|
||||
|
||||
// PerformRoomUpgrade upgrades a room to a newer version
|
||||
PerformRoomUpgrade(ctx context.Context, req *PerformRoomUpgradeRequest, resp *PerformRoomUpgradeResponse)
|
||||
@ -285,3 +243,35 @@ type ClientRoomserverAPI interface {
|
||||
SetRoomAlias(ctx context.Context, req *SetRoomAliasRequest, res *SetRoomAliasResponse) error
|
||||
RemoveRoomAlias(ctx context.Context, req *RemoveRoomAliasRequest, res *RemoveRoomAliasResponse) error
|
||||
}
|
||||
|
||||
type UserRoomserverAPI interface {
|
||||
QueryLatestEventsAndStateAPI
|
||||
QueryCurrentState(ctx context.Context, req *QueryCurrentStateRequest, res *QueryCurrentStateResponse) error
|
||||
QueryMembershipsForRoom(ctx context.Context, req *QueryMembershipsForRoomRequest, res *QueryMembershipsForRoomResponse) error
|
||||
}
|
||||
|
||||
type FederationRoomserverAPI interface {
|
||||
InputRoomEventsAPI
|
||||
QueryLatestEventsAndStateAPI
|
||||
QueryBulkStateContentAPI
|
||||
// QueryServerBannedFromRoom returns whether a server is banned from a room by server ACLs.
|
||||
QueryServerBannedFromRoom(ctx context.Context, req *QueryServerBannedFromRoomRequest, res *QueryServerBannedFromRoomResponse) error
|
||||
QueryRoomVersionForRoom(ctx context.Context, req *QueryRoomVersionForRoomRequest, res *QueryRoomVersionForRoomResponse) error
|
||||
GetRoomIDForAlias(ctx context.Context, req *GetRoomIDForAliasRequest, res *GetRoomIDForAliasResponse) error
|
||||
QueryEventsByID(ctx context.Context, req *QueryEventsByIDRequest, res *QueryEventsByIDResponse) error
|
||||
// Query to get state and auth chain for a (potentially hypothetical) event.
|
||||
// Takes lists of PrevEventIDs and AuthEventsIDs and uses them to calculate
|
||||
// the state and auth chain to return.
|
||||
QueryStateAndAuthChain(ctx context.Context, req *QueryStateAndAuthChainRequest, res *QueryStateAndAuthChainResponse) error
|
||||
// Query if we think we're still in a room.
|
||||
QueryServerJoinedToRoom(ctx context.Context, req *QueryServerJoinedToRoomRequest, res *QueryServerJoinedToRoomResponse) error
|
||||
QueryPublishedRooms(ctx context.Context, req *QueryPublishedRoomsRequest, res *QueryPublishedRoomsResponse) error
|
||||
// Query missing events for a room from roomserver
|
||||
QueryMissingEvents(ctx context.Context, req *QueryMissingEventsRequest, res *QueryMissingEventsResponse) error
|
||||
// Query whether a server is allowed to see an event
|
||||
QueryServerAllowedToSeeEvent(ctx context.Context, req *QueryServerAllowedToSeeEventRequest, res *QueryServerAllowedToSeeEventResponse) error
|
||||
PerformInboundPeek(ctx context.Context, req *PerformInboundPeekRequest, res *PerformInboundPeekResponse) error
|
||||
PerformInvite(ctx context.Context, req *PerformInviteRequest, res *PerformInviteResponse) error
|
||||
// Query a given amount (or less) of events prior to a given set of events.
|
||||
PerformBackfill(ctx context.Context, req *PerformBackfillRequest, res *PerformBackfillResponse) error
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ type RoomserverInternalAPITrace struct {
|
||||
Impl RoomserverInternalAPI
|
||||
}
|
||||
|
||||
func (t *RoomserverInternalAPITrace) SetFederationAPI(fsAPI fsAPI.FederationInternalAPI, keyRing *gomatrixserverlib.KeyRing) {
|
||||
func (t *RoomserverInternalAPITrace) SetFederationAPI(fsAPI fsAPI.RoomserverFederationAPI, keyRing *gomatrixserverlib.KeyRing) {
|
||||
t.Impl.SetFederationAPI(fsAPI, keyRing)
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ func GetStateEvent(ctx context.Context, rsAPI QueryEventsAPI, roomID string, tup
|
||||
}
|
||||
|
||||
// IsServerBannedFromRoom returns whether the server is banned from a room by server ACLs.
|
||||
func IsServerBannedFromRoom(ctx context.Context, rsAPI RoomserverInternalAPI, roomID string, serverName gomatrixserverlib.ServerName) bool {
|
||||
func IsServerBannedFromRoom(ctx context.Context, rsAPI FederationRoomserverAPI, roomID string, serverName gomatrixserverlib.ServerName) bool {
|
||||
req := &QueryServerBannedFromRoomRequest{
|
||||
ServerName: serverName,
|
||||
RoomID: roomID,
|
||||
|
@ -43,7 +43,7 @@ type RoomserverInternalAPI struct {
|
||||
ServerName gomatrixserverlib.ServerName
|
||||
KeyRing gomatrixserverlib.JSONVerifier
|
||||
ServerACLs *acls.ServerACLs
|
||||
fsAPI fsAPI.FederationInternalAPI
|
||||
fsAPI fsAPI.RoomserverFederationAPI
|
||||
asAPI asAPI.AppServiceQueryAPI
|
||||
NATSClient *nats.Conn
|
||||
JetStream nats.JetStreamContext
|
||||
@ -87,7 +87,7 @@ func NewRoomserverAPI(
|
||||
// SetFederationInputAPI passes in a federation input API reference so that we can
|
||||
// avoid the chicken-and-egg problem of both the roomserver input API and the
|
||||
// federation input API being interdependent.
|
||||
func (r *RoomserverInternalAPI) SetFederationAPI(fsAPI fsAPI.FederationInternalAPI, keyRing *gomatrixserverlib.KeyRing) {
|
||||
func (r *RoomserverInternalAPI) SetFederationAPI(fsAPI fsAPI.RoomserverFederationAPI, keyRing *gomatrixserverlib.KeyRing) {
|
||||
r.fsAPI = fsAPI
|
||||
r.KeyRing = keyRing
|
||||
|
||||
|
@ -82,7 +82,7 @@ type Inputer struct {
|
||||
JetStream nats.JetStreamContext
|
||||
Durable nats.SubOpt
|
||||
ServerName gomatrixserverlib.ServerName
|
||||
FSAPI fedapi.FederationInternalAPI
|
||||
FSAPI fedapi.RoomserverFederationAPI
|
||||
KeyRing gomatrixserverlib.JSONVerifier
|
||||
ACLs *acls.ServerACLs
|
||||
InputRoomEventTopic string
|
||||
|
@ -44,7 +44,7 @@ type missingStateReq struct {
|
||||
roomInfo *types.RoomInfo
|
||||
inputer *Inputer
|
||||
keys gomatrixserverlib.JSONVerifier
|
||||
federation fedapi.FederationInternalAPI
|
||||
federation fedapi.RoomserverFederationAPI
|
||||
roomsMu *internal.MutexByRoom
|
||||
servers []gomatrixserverlib.ServerName
|
||||
hadEvents map[string]bool
|
||||
|
@ -38,7 +38,7 @@ const maxBackfillServers = 5
|
||||
type Backfiller struct {
|
||||
ServerName gomatrixserverlib.ServerName
|
||||
DB storage.Database
|
||||
FSAPI federationAPI.FederationInternalAPI
|
||||
FSAPI federationAPI.RoomserverFederationAPI
|
||||
KeyRing gomatrixserverlib.JSONVerifier
|
||||
|
||||
// The servers which should be preferred above other servers when backfilling
|
||||
@ -228,7 +228,7 @@ func (r *Backfiller) fetchAndStoreMissingEvents(ctx context.Context, roomVer gom
|
||||
// backfillRequester implements gomatrixserverlib.BackfillRequester
|
||||
type backfillRequester struct {
|
||||
db storage.Database
|
||||
fsAPI federationAPI.FederationInternalAPI
|
||||
fsAPI federationAPI.RoomserverFederationAPI
|
||||
thisServer gomatrixserverlib.ServerName
|
||||
preferServer map[gomatrixserverlib.ServerName]bool
|
||||
bwExtrems map[string][]string
|
||||
@ -240,7 +240,7 @@ type backfillRequester struct {
|
||||
}
|
||||
|
||||
func newBackfillRequester(
|
||||
db storage.Database, fsAPI federationAPI.FederationInternalAPI, thisServer gomatrixserverlib.ServerName,
|
||||
db storage.Database, fsAPI federationAPI.RoomserverFederationAPI, thisServer gomatrixserverlib.ServerName,
|
||||
bwExtrems map[string][]string, preferServers []gomatrixserverlib.ServerName,
|
||||
) *backfillRequester {
|
||||
preferServer := make(map[gomatrixserverlib.ServerName]bool)
|
||||
|
@ -35,7 +35,7 @@ import (
|
||||
type Inviter struct {
|
||||
DB storage.Database
|
||||
Cfg *config.RoomServer
|
||||
FSAPI federationAPI.FederationInternalAPI
|
||||
FSAPI federationAPI.RoomserverFederationAPI
|
||||
Inputer *input.Inputer
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ import (
|
||||
type Joiner struct {
|
||||
ServerName gomatrixserverlib.ServerName
|
||||
Cfg *config.RoomServer
|
||||
FSAPI fsAPI.FederationInternalAPI
|
||||
FSAPI fsAPI.RoomserverFederationAPI
|
||||
RSAPI rsAPI.RoomserverInternalAPI
|
||||
DB storage.Database
|
||||
|
||||
|
@ -37,7 +37,7 @@ import (
|
||||
type Leaver struct {
|
||||
Cfg *config.RoomServer
|
||||
DB storage.Database
|
||||
FSAPI fsAPI.FederationInternalAPI
|
||||
FSAPI fsAPI.RoomserverFederationAPI
|
||||
UserAPI userapi.UserInternalAPI
|
||||
Inputer *input.Inputer
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ import (
|
||||
type Peeker struct {
|
||||
ServerName gomatrixserverlib.ServerName
|
||||
Cfg *config.RoomServer
|
||||
FSAPI fsAPI.FederationInternalAPI
|
||||
FSAPI fsAPI.RoomserverFederationAPI
|
||||
DB storage.Database
|
||||
|
||||
Inputer *input.Inputer
|
||||
|
@ -30,7 +30,7 @@ import (
|
||||
type Unpeeker struct {
|
||||
ServerName gomatrixserverlib.ServerName
|
||||
Cfg *config.RoomServer
|
||||
FSAPI fsAPI.FederationInternalAPI
|
||||
FSAPI fsAPI.RoomserverFederationAPI
|
||||
DB storage.Database
|
||||
|
||||
Inputer *input.Inputer
|
||||
|
@ -87,7 +87,7 @@ func NewRoomserverClient(
|
||||
}
|
||||
|
||||
// SetFederationInputAPI no-ops in HTTP client mode as there is no chicken/egg scenario
|
||||
func (h *httpRoomserverInternalAPI) SetFederationAPI(fsAPI fsInputAPI.FederationInternalAPI, keyRing *gomatrixserverlib.KeyRing) {
|
||||
func (h *httpRoomserverInternalAPI) SetFederationAPI(fsAPI fsInputAPI.RoomserverFederationAPI, keyRing *gomatrixserverlib.KeyRing) {
|
||||
}
|
||||
|
||||
// SetAppserviceAPI no-ops in HTTP client mode as there is no chicken/egg scenario
|
||||
|
@ -47,7 +47,7 @@ type Monolith struct {
|
||||
|
||||
// Optional
|
||||
ExtPublicRoomsProvider api.ExtraPublicRoomsProvider
|
||||
ExtUserDirectoryProvider userapi.UserDirectoryProvider
|
||||
ExtUserDirectoryProvider userapi.QuerySearchProfilesAPI
|
||||
}
|
||||
|
||||
// AddAllPublicRoutes attaches all public paths to the given router
|
||||
|
@ -26,34 +26,33 @@ import (
|
||||
|
||||
// UserInternalAPI is the internal API for information about users and devices.
|
||||
type UserInternalAPI interface {
|
||||
UserProfileAPI
|
||||
QueryAcccessTokenAPI
|
||||
|
||||
AppserviceUserAPI
|
||||
SyncUserAPI
|
||||
ClientUserAPI
|
||||
MediaUserAPI
|
||||
FederationUserAPI
|
||||
|
||||
QueryOpenIDToken(ctx context.Context, req *QueryOpenIDTokenRequest, res *QueryOpenIDTokenResponse) error
|
||||
}
|
||||
|
||||
type QueryAcccessTokenAPI interface {
|
||||
QueryAccessToken(ctx context.Context, req *QueryAccessTokenRequest, res *QueryAccessTokenResponse) error
|
||||
}
|
||||
|
||||
type UserLoginAPI interface {
|
||||
QueryAccountByPassword(ctx context.Context, req *QueryAccountByPasswordRequest, res *QueryAccountByPasswordResponse) error
|
||||
QuerySearchProfilesAPI // used by p2p demos
|
||||
}
|
||||
|
||||
// api functions required by the appservice api
|
||||
type AppserviceUserAPI interface {
|
||||
PerformAccountCreation(ctx context.Context, req *PerformAccountCreationRequest, res *PerformAccountCreationResponse) error
|
||||
PerformDeviceCreation(ctx context.Context, req *PerformDeviceCreationRequest, res *PerformDeviceCreationResponse) error
|
||||
}
|
||||
|
||||
// api functions required by the media api
|
||||
type MediaUserAPI interface {
|
||||
QueryAcccessTokenAPI
|
||||
}
|
||||
|
||||
// api functions required by the federation api
|
||||
type FederationUserAPI interface {
|
||||
QueryOpenIDToken(ctx context.Context, req *QueryOpenIDTokenRequest, res *QueryOpenIDTokenResponse) error
|
||||
QueryProfile(ctx context.Context, req *QueryProfileRequest, res *QueryProfileResponse) error
|
||||
}
|
||||
|
||||
// api functions required by the sync api
|
||||
type SyncUserAPI interface {
|
||||
QueryAcccessTokenAPI
|
||||
QueryAccountData(ctx context.Context, req *QueryAccountDataRequest, res *QueryAccountDataResponse) error
|
||||
@ -63,6 +62,7 @@ type SyncUserAPI interface {
|
||||
QueryDeviceInfos(ctx context.Context, req *QueryDeviceInfosRequest, res *QueryDeviceInfosResponse) error
|
||||
}
|
||||
|
||||
// api functions required by the client api
|
||||
type ClientUserAPI interface {
|
||||
QueryAcccessTokenAPI
|
||||
LoginTokenInternalAPI
|
||||
@ -97,14 +97,18 @@ type ClientUserAPI interface {
|
||||
PerformSaveThreePIDAssociation(ctx context.Context, req *PerformSaveThreePIDAssociationRequest, res *struct{}) error
|
||||
}
|
||||
|
||||
type UserDirectoryProvider interface {
|
||||
// custom api functions required by pinecone / p2p demos
|
||||
type QuerySearchProfilesAPI interface {
|
||||
QuerySearchProfiles(ctx context.Context, req *QuerySearchProfilesRequest, res *QuerySearchProfilesResponse) error
|
||||
}
|
||||
|
||||
// UserProfileAPI provides functions for getting user profiles
|
||||
type UserProfileAPI interface {
|
||||
QueryProfile(ctx context.Context, req *QueryProfileRequest, res *QueryProfileResponse) error
|
||||
QuerySearchProfiles(ctx context.Context, req *QuerySearchProfilesRequest, res *QuerySearchProfilesResponse) error
|
||||
// common function for creating authenticated endpoints (used in client/media/sync api)
|
||||
type QueryAcccessTokenAPI interface {
|
||||
QueryAccessToken(ctx context.Context, req *QueryAccessTokenRequest, res *QueryAccessTokenResponse) error
|
||||
}
|
||||
|
||||
type UserLoginAPI interface {
|
||||
QueryAccountByPassword(ctx context.Context, req *QueryAccountByPasswordRequest, res *QueryAccountByPasswordResponse) error
|
||||
}
|
||||
|
||||
type PerformKeyBackupRequest struct {
|
||||
|
@ -29,7 +29,7 @@ type OutputStreamEventConsumer struct {
|
||||
ctx context.Context
|
||||
cfg *config.UserAPI
|
||||
userAPI api.UserInternalAPI
|
||||
rsAPI rsapi.RoomserverInternalAPI
|
||||
rsAPI rsapi.UserRoomserverAPI
|
||||
jetstream nats.JetStreamContext
|
||||
durable string
|
||||
db storage.Database
|
||||
@ -45,7 +45,7 @@ func NewOutputStreamEventConsumer(
|
||||
store storage.Database,
|
||||
pgClient pushgateway.Client,
|
||||
userAPI api.UserInternalAPI,
|
||||
rsAPI rsapi.RoomserverInternalAPI,
|
||||
rsAPI rsapi.UserRoomserverAPI,
|
||||
syncProducer *producers.SyncAPI,
|
||||
) *OutputStreamEventConsumer {
|
||||
return &OutputStreamEventConsumer{
|
||||
@ -455,7 +455,7 @@ func (s *OutputStreamEventConsumer) evaluatePushRules(ctx context.Context, event
|
||||
|
||||
type ruleSetEvalContext struct {
|
||||
ctx context.Context
|
||||
rsAPI rsapi.RoomserverInternalAPI
|
||||
rsAPI rsapi.UserRoomserverAPI
|
||||
mem *localMembership
|
||||
roomID string
|
||||
roomSize int
|
||||
|
@ -48,7 +48,7 @@ type UserInternalAPI struct {
|
||||
ServerName gomatrixserverlib.ServerName
|
||||
// AppServices is the list of all registered AS
|
||||
AppServices []config.ApplicationService
|
||||
KeyAPI keyapi.KeyInternalAPI
|
||||
KeyAPI keyapi.UserKeyAPI
|
||||
}
|
||||
|
||||
func (a *UserInternalAPI) InputAccountData(ctx context.Context, req *api.InputAccountDataRequest, res *api.InputAccountDataResponse) error {
|
||||
|
@ -44,8 +44,8 @@ func AddInternalRoutes(router *mux.Router, intAPI api.UserInternalAPI) {
|
||||
// can call functions directly on the returned API or via an HTTP interface using AddInternalRoutes.
|
||||
func NewInternalAPI(
|
||||
base *base.BaseDendrite, cfg *config.UserAPI,
|
||||
appServices []config.ApplicationService, keyAPI keyapi.KeyInternalAPI,
|
||||
rsAPI rsapi.RoomserverInternalAPI, pgClient pushgateway.Client,
|
||||
appServices []config.ApplicationService, keyAPI keyapi.UserKeyAPI,
|
||||
rsAPI rsapi.UserRoomserverAPI, pgClient pushgateway.Client,
|
||||
) api.UserInternalAPI {
|
||||
js, _ := jetstream.Prepare(base.ProcessContext, &cfg.Matrix.JetStream)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user