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