2020-06-04 09:43:07 -05:00
|
|
|
package inthttp
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/gorilla/mux"
|
2022-08-11 11:23:35 -05:00
|
|
|
|
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
|
2022-12-05 06:53:36 -06:00
|
|
|
func AddRoutes(r api.RoomserverInternalAPI, internalAPIMux *mux.Router, enableMetrics bool) {
|
2022-08-11 09:29:33 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverInputRoomEventsPath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverInputRoomEvents", enableMetrics, r.InputRoomEvents),
|
2022-08-11 09:29:33 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverPerformInvitePath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverPerformInvite", enableMetrics, r.PerformInvite),
|
2022-06-29 09:29:39 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverPerformJoinPath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverPerformJoin", enableMetrics, r.PerformJoin),
|
2022-08-11 09:29:33 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverPerformLeavePath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverPerformLeave", enableMetrics, r.PerformLeave),
|
2022-08-11 09:29:33 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverPerformPeekPath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverPerformPeek", enableMetrics, r.PerformPeek),
|
2022-08-11 09:29:33 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverPerformInboundPeekPath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverPerformInboundPeek", enableMetrics, r.PerformInboundPeek),
|
2022-08-11 09:29:33 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverPerformUnpeekPath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverPerformUnpeek", enableMetrics, r.PerformUnpeek),
|
2022-08-11 09:29:33 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverPerformRoomUpgradePath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverPerformRoomUpgrade", enableMetrics, r.PerformRoomUpgrade),
|
2022-08-11 09:29:33 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverPerformPublishPath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverPerformPublish", enableMetrics, r.PerformPublish),
|
2022-08-11 09:29:33 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverPerformAdminEvacuateRoomPath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverPerformAdminEvacuateRoom", enableMetrics, r.PerformAdminEvacuateRoom),
|
2022-08-11 09:29:33 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverPerformAdminEvacuateUserPath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverPerformAdminEvacuateUser", enableMetrics, r.PerformAdminEvacuateUser),
|
2022-08-11 09:29:33 -05:00
|
|
|
)
|
|
|
|
|
2022-10-31 04:13:28 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverPerformAdminDownloadStatePath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverPerformAdminDownloadState", enableMetrics, r.PerformAdminDownloadState),
|
2022-10-31 04:13:28 -05:00
|
|
|
)
|
|
|
|
|
2020-07-02 09:41:18 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryPublishedRoomsPath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryPublishedRooms", enableMetrics, r.QueryPublishedRooms),
|
2020-07-02 09:41:18 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
2020-06-04 09:43:07 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryLatestEventsAndStatePath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryLatestEventsAndState", enableMetrics, r.QueryLatestEventsAndState),
|
2020-06-04 09:43:07 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
2020-06-04 09:43:07 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryStateAfterEventsPath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryStateAfterEvents", enableMetrics, r.QueryStateAfterEvents),
|
2020-06-04 09:43:07 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
2020-06-04 09:43:07 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryEventsByIDPath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryEventsByID", enableMetrics, r.QueryEventsByID),
|
2020-06-04 09:43:07 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
2020-06-04 09:43:07 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryMembershipForUserPath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryMembershipForUser", enableMetrics, r.QueryMembershipForUser),
|
2020-06-04 09:43:07 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
2020-06-04 09:43:07 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryMembershipsForRoomPath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryMembershipsForRoom", enableMetrics, r.QueryMembershipsForRoom),
|
2020-06-04 09:43:07 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
2020-09-24 10:18:13 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryServerJoinedToRoomPath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryServerJoinedToRoom", enableMetrics, r.QueryServerJoinedToRoom),
|
2020-09-24 10:18:13 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
2020-06-04 09:43:07 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryServerAllowedToSeeEventPath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryServerAllowedToSeeEvent", enableMetrics, r.QueryServerAllowedToSeeEvent),
|
2020-06-04 09:43:07 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
2020-06-04 09:43:07 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryMissingEventsPath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryMissingEvents", enableMetrics, r.QueryMissingEvents),
|
2020-06-04 09:43:07 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
2020-06-04 09:43:07 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryStateAndAuthChainPath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryStateAndAuthChain", enableMetrics, r.QueryStateAndAuthChain),
|
2020-06-04 09:43:07 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
2020-06-04 09:43:07 -05:00
|
|
|
internalAPIMux.Handle(
|
2020-06-11 13:50:40 -05:00
|
|
|
RoomserverPerformBackfillPath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverPerformBackfill", enableMetrics, r.PerformBackfill),
|
2020-06-04 09:43:07 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
2020-11-05 04:19:23 -06:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverPerformForgetPath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverPerformForget", enableMetrics, r.PerformForget),
|
2020-11-05 04:19:23 -06:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
2020-06-04 09:43:07 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryRoomVersionCapabilitiesPath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryRoomVersionCapabilities", enableMetrics, r.QueryRoomVersionCapabilities),
|
2020-06-04 09:43:07 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
2020-06-04 09:43:07 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryRoomVersionForRoomPath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryRoomVersionForRoom", enableMetrics, r.QueryRoomVersionForRoom),
|
2020-06-04 09:43:07 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
2020-06-04 09:43:07 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverSetRoomAliasPath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverSetRoomAlias", enableMetrics, r.SetRoomAlias),
|
2020-06-04 09:43:07 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
2020-06-04 09:43:07 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverGetRoomIDForAliasPath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverGetRoomIDForAlias", enableMetrics, r.GetRoomIDForAlias),
|
2020-06-04 09:43:07 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
2020-06-04 09:43:07 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverGetAliasesForRoomIDPath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverGetAliasesForRoomID", enableMetrics, r.GetAliasesForRoomID),
|
2020-06-04 09:43:07 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
2020-06-04 09:43:07 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverRemoveRoomAliasPath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverRemoveRoomAlias", enableMetrics, r.RemoveRoomAlias),
|
2022-08-11 09:29:33 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryCurrentStatePath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryCurrentState", enableMetrics, r.QueryCurrentState),
|
2022-08-11 09:29:33 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryRoomsForUserPath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryRoomsForUser", enableMetrics, r.QueryRoomsForUser),
|
2022-08-11 09:29:33 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryBulkStateContentPath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryBulkStateContent", enableMetrics, r.QueryBulkStateContent),
|
2022-08-11 09:29:33 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQuerySharedUsersPath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverQuerySharedUsers", enableMetrics, r.QuerySharedUsers),
|
2022-08-11 09:29:33 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryKnownUsersPath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryKnownUsers", enableMetrics, r.QueryKnownUsers),
|
2022-08-11 09:29:33 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryServerBannedFromRoomPath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryServerBannedFromRoom", enableMetrics, r.QueryServerBannedFromRoom),
|
2022-08-11 09:29:33 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryAuthChainPath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryAuthChain", enableMetrics, r.QueryAuthChain),
|
2022-08-11 09:29:33 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryRestrictedJoinAllowed,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryRestrictedJoinAllowed", enableMetrics, r.QueryRestrictedJoinAllowed),
|
2022-05-25 04:05:30 -05:00
|
|
|
)
|
2022-08-11 11:23:35 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryMembershipAtEventPath,
|
2022-12-05 06:53:36 -06:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryMembershipAtEventPath", enableMetrics, r.QueryMembershipAtEvent),
|
2022-08-11 11:23:35 -05:00
|
|
|
)
|
2022-12-12 01:20:59 -06:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryLeftMembersPath,
|
|
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryLeftMembersPath", enableMetrics, r.QueryLeftUsers),
|
|
|
|
)
|
2020-06-04 09:43:07 -05:00
|
|
|
}
|