2020-06-04 09:43:07 -05:00
|
|
|
package inthttp
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/gorilla/mux"
|
2020-06-12 08:55:57 -05:00
|
|
|
"github.com/matrix-org/dendrite/internal/httputil"
|
2020-06-04 09:43:07 -05:00
|
|
|
"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-06-29 09:29:39 -05:00
|
|
|
)
|
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
|
|
|
)
|
|
|
|
|
2020-07-02 09:41:18 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryPublishedRoomsPath,
|
2022-08-08 10:04:05 -05:00
|
|
|
httputil.MakeInternalRPCAPI(RoomserverQueryPublishedRoomsPath, r.QueryPublishedRooms),
|
2020-07-02 09:41:18 -05:00
|
|
|
)
|
2022-08-08 09:36:14 -05:00
|
|
|
|
2020-06-04 09:43:07 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryLatestEventsAndStatePath,
|
2022-08-08 10:04:05 -05:00
|
|
|
httputil.MakeInternalRPCAPI(RoomserverQueryLatestEventsAndStatePath, r.QueryLatestEventsAndState),
|
2020-06-04 09:43:07 -05:00
|
|
|
)
|
2022-08-08 09:36:14 -05:00
|
|
|
|
2020-06-04 09:43:07 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryStateAfterEventsPath,
|
2022-08-08 10:04:05 -05:00
|
|
|
httputil.MakeInternalRPCAPI(RoomserverQueryStateAfterEventsPath, r.QueryStateAfterEvents),
|
2020-06-04 09:43:07 -05:00
|
|
|
)
|
2022-08-08 09:36:14 -05:00
|
|
|
|
2020-06-04 09:43:07 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryEventsByIDPath,
|
2022-08-08 10:04:05 -05:00
|
|
|
httputil.MakeInternalRPCAPI(RoomserverQueryEventsByIDPath, r.QueryEventsByID),
|
2020-06-04 09:43:07 -05:00
|
|
|
)
|
2022-08-08 09:36:14 -05:00
|
|
|
|
2020-06-04 09:43:07 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryMembershipForUserPath,
|
2022-08-08 10:04:05 -05:00
|
|
|
httputil.MakeInternalRPCAPI(RoomserverQueryMembershipForUserPath, r.QueryMembershipForUser),
|
2020-06-04 09:43:07 -05:00
|
|
|
)
|
2022-08-08 09:36:14 -05:00
|
|
|
|
2020-06-04 09:43:07 -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),
|
2020-06-04 09:43:07 -05:00
|
|
|
)
|
2022-08-08 09:36:14 -05:00
|
|
|
|
2020-09-24 10:18:13 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryServerJoinedToRoomPath,
|
2022-08-08 10:04:05 -05:00
|
|
|
httputil.MakeInternalRPCAPI(RoomserverQueryServerJoinedToRoomPath, r.QueryServerJoinedToRoom),
|
2020-09-24 10:18:13 -05:00
|
|
|
)
|
2022-08-08 09:36:14 -05:00
|
|
|
|
2020-06-04 09:43:07 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryServerAllowedToSeeEventPath,
|
2022-08-08 10:04:05 -05:00
|
|
|
httputil.MakeInternalRPCAPI(RoomserverQueryServerAllowedToSeeEventPath, r.QueryServerAllowedToSeeEvent),
|
2020-06-04 09:43:07 -05:00
|
|
|
)
|
2022-08-08 09:36:14 -05:00
|
|
|
|
2020-06-04 09:43:07 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryMissingEventsPath,
|
2022-08-08 10:04:05 -05:00
|
|
|
httputil.MakeInternalRPCAPI(RoomserverQueryMissingEventsPath, r.QueryMissingEvents),
|
2020-06-04 09:43:07 -05:00
|
|
|
)
|
2022-08-08 09:36:14 -05:00
|
|
|
|
2020-06-04 09:43:07 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryStateAndAuthChainPath,
|
2022-08-08 10:04:05 -05:00
|
|
|
httputil.MakeInternalRPCAPI(RoomserverQueryStateAndAuthChainPath, r.QueryStateAndAuthChain),
|
2020-06-04 09:43:07 -05:00
|
|
|
)
|
2022-08-08 09:36:14 -05:00
|
|
|
|
2020-06-04 09:43:07 -05:00
|
|
|
internalAPIMux.Handle(
|
2020-06-11 13:50:40 -05:00
|
|
|
RoomserverPerformBackfillPath,
|
2022-08-08 10:04:05 -05:00
|
|
|
httputil.MakeInternalRPCAPI(RoomserverPerformBackfillPath, r.PerformBackfill),
|
2020-06-04 09:43:07 -05:00
|
|
|
)
|
2022-08-08 09:36:14 -05:00
|
|
|
|
2020-11-05 04:19:23 -06:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverPerformForgetPath,
|
2022-08-08 10:04:05 -05:00
|
|
|
httputil.MakeInternalRPCAPI(RoomserverPerformForgetPath, r.PerformForget),
|
2020-11-05 04:19:23 -06:00
|
|
|
)
|
2022-08-08 09:36:14 -05:00
|
|
|
|
2020-06-04 09:43:07 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryRoomVersionCapabilitiesPath,
|
2022-08-08 10:04:05 -05:00
|
|
|
httputil.MakeInternalRPCAPI(RoomserverQueryRoomVersionCapabilitiesPath, r.QueryRoomVersionCapabilities),
|
2020-06-04 09:43:07 -05:00
|
|
|
)
|
2022-08-08 09:36:14 -05:00
|
|
|
|
2020-06-04 09:43:07 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryRoomVersionForRoomPath,
|
2022-08-08 10:04:05 -05:00
|
|
|
httputil.MakeInternalRPCAPI(RoomserverQueryRoomVersionForRoomPath, r.QueryRoomVersionForRoom),
|
2020-06-04 09:43:07 -05:00
|
|
|
)
|
2022-08-08 09:36:14 -05:00
|
|
|
|
2020-06-04 09:43:07 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverSetRoomAliasPath,
|
2022-08-08 10:04:05 -05:00
|
|
|
httputil.MakeInternalRPCAPI(RoomserverSetRoomAliasPath, r.SetRoomAlias),
|
2020-06-04 09:43:07 -05:00
|
|
|
)
|
2022-08-08 09:36:14 -05:00
|
|
|
|
2020-06-04 09:43:07 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverGetRoomIDForAliasPath,
|
2022-08-08 10:04:05 -05:00
|
|
|
httputil.MakeInternalRPCAPI(RoomserverGetRoomIDForAliasPath, r.GetRoomIDForAlias),
|
2020-06-04 09:43:07 -05:00
|
|
|
)
|
2022-08-08 09:36:14 -05:00
|
|
|
|
2020-06-04 09:43:07 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverGetAliasesForRoomIDPath,
|
2022-08-08 10:04:05 -05:00
|
|
|
httputil.MakeInternalRPCAPI(RoomserverGetAliasesForRoomIDPath, r.GetAliasesForRoomID),
|
2020-06-04 09:43:07 -05:00
|
|
|
)
|
2022-08-08 09:36:14 -05:00
|
|
|
|
2020-06-04 09:43:07 -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),
|
2022-05-25 04:05:30 -05:00
|
|
|
)
|
2020-06-04 09:43:07 -05:00
|
|
|
}
|