dendrite/roomserver/inthttp/server.go

202 lines
6 KiB
Go
Raw Normal View History

package inthttp
import (
"github.com/gorilla/mux"
"github.com/matrix-org/dendrite/internal/httputil"
"github.com/matrix-org/dendrite/roomserver/api"
)
// AddRoutes adds the RoomserverInternalAPI handlers to the http.ServeMux.
// nolint: gocyclo
func AddRoutes(r api.RoomserverInternalAPI, internalAPIMux *mux.Router) {
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverInputRoomEventsPath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverInputRoomEventsPath, r.InputRoomEvents),
2022-08-08 09:36:14 -05:00
)
internalAPIMux.Handle(
RoomserverPerformInvitePath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverPerformInvitePath, r.PerformInvite),
2022-08-08 09:36:14 -05:00
)
internalAPIMux.Handle(
RoomserverPerformJoinPath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverPerformJoinPath, r.PerformJoin),
2022-08-08 09:36:14 -05:00
)
internalAPIMux.Handle(
RoomserverPerformLeavePath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverPerformLeavePath, r.PerformLeave),
2022-08-08 09:36:14 -05:00
)
internalAPIMux.Handle(
RoomserverPerformPeekPath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverPerformPeekPath, r.PerformPeek),
2022-08-08 09:36:14 -05:00
)
internalAPIMux.Handle(
RoomserverPerformInboundPeekPath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverPerformInboundPeekPath, r.PerformInboundPeek),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverPerformUnpeekPath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverPerformUnpeekPath, r.PerformUnpeek),
2022-08-08 09:36:14 -05:00
)
internalAPIMux.Handle(
RoomserverPerformRoomUpgradePath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverPerformRoomUpgradePath, r.PerformRoomUpgrade),
2022-08-08 09:36:14 -05:00
)
internalAPIMux.Handle(
RoomserverPerformPublishPath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverPerformPublishPath, r.PerformPublish),
2022-08-08 09:36:14 -05:00
)
internalAPIMux.Handle(
RoomserverPerformAdminEvacuateRoomPath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverPerformAdminEvacuateRoomPath, r.PerformAdminEvacuateRoom),
2022-08-08 09:36:14 -05:00
)
internalAPIMux.Handle(
RoomserverPerformAdminEvacuateUserPath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverPerformAdminEvacuateUserPath, r.PerformAdminEvacuateUser),
2022-08-08 09:36:14 -05:00
)
internalAPIMux.Handle(
RoomserverQueryPublishedRoomsPath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverQueryPublishedRoomsPath, r.QueryPublishedRooms),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverQueryLatestEventsAndStatePath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverQueryLatestEventsAndStatePath, r.QueryLatestEventsAndState),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverQueryStateAfterEventsPath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverQueryStateAfterEventsPath, r.QueryStateAfterEvents),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverQueryEventsByIDPath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverQueryEventsByIDPath, r.QueryEventsByID),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverQueryMembershipForUserPath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverQueryMembershipForUserPath, r.QueryMembershipForUser),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverQueryMembershipsForRoomPath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverQueryMembershipsForRoomPath, r.QueryMembershipsForRoom),
2022-08-08 09:36:14 -05:00
)
internalAPIMux.Handle(
RoomserverQueryServerJoinedToRoomPath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverQueryServerJoinedToRoomPath, r.QueryServerJoinedToRoom),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverQueryServerJoinedToRoomPath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverQueryServerJoinedToRoomPath, r.QueryServerJoinedToRoom),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverQueryServerAllowedToSeeEventPath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverQueryServerAllowedToSeeEventPath, r.QueryServerAllowedToSeeEvent),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverQueryMissingEventsPath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverQueryMissingEventsPath, r.QueryMissingEvents),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverQueryStateAndAuthChainPath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverQueryStateAndAuthChainPath, r.QueryStateAndAuthChain),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverPerformBackfillPath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverPerformBackfillPath, r.PerformBackfill),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverPerformForgetPath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverPerformForgetPath, r.PerformForget),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverQueryRoomVersionCapabilitiesPath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverQueryRoomVersionCapabilitiesPath, r.QueryRoomVersionCapabilities),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverQueryRoomVersionForRoomPath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverQueryRoomVersionForRoomPath, r.QueryRoomVersionForRoom),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverSetRoomAliasPath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverSetRoomAliasPath, r.SetRoomAlias),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverGetRoomIDForAliasPath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverGetRoomIDForAliasPath, r.GetRoomIDForAlias),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverGetAliasesForRoomIDPath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverGetAliasesForRoomIDPath, r.GetAliasesForRoomID),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverRemoveRoomAliasPath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverRemoveRoomAliasPath, r.RemoveRoomAlias),
2022-08-08 09:36:14 -05:00
)
internalAPIMux.Handle(
RoomserverQueryCurrentStatePath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverQueryCurrentStatePath, r.QueryCurrentState),
2022-08-08 09:36:14 -05:00
)
internalAPIMux.Handle(
RoomserverQueryRoomsForUserPath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverQueryRoomsForUserPath, r.QueryRoomsForUser),
2022-08-08 09:36:14 -05:00
)
internalAPIMux.Handle(
RoomserverQueryBulkStateContentPath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverQueryBulkStateContentPath, r.QueryBulkStateContent),
2022-08-08 09:36:14 -05:00
)
internalAPIMux.Handle(
RoomserverQuerySharedUsersPath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverQuerySharedUsersPath, r.QuerySharedUsers),
2022-08-08 09:36:14 -05:00
)
internalAPIMux.Handle(
RoomserverQueryKnownUsersPath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverQueryKnownUsersPath, r.QueryKnownUsers),
2022-08-08 09:36:14 -05:00
)
internalAPIMux.Handle(
RoomserverQueryServerBannedFromRoomPath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverQueryServerBannedFromRoomPath, r.QueryServerBannedFromRoom),
2022-08-08 09:36:14 -05:00
)
internalAPIMux.Handle(
RoomserverQueryAuthChainPath,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverQueryAuthChainPath, r.QueryAuthChain),
2022-08-08 09:36:14 -05:00
)
internalAPIMux.Handle(
RoomserverQueryRestrictedJoinAllowed,
2022-08-08 10:04:05 -05:00
httputil.MakeInternalRPCAPI(RoomserverQueryRestrictedJoinAllowed, r.QueryRestrictedJoinAllowed),
)
}