2020-06-04 16:43:07 +02:00
|
|
|
package inthttp
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/gorilla/mux"
|
2022-08-11 18:23:35 +02:00
|
|
|
|
2020-06-12 15:55:57 +02:00
|
|
|
"github.com/matrix-org/dendrite/internal/httputil"
|
2020-06-04 16:43:07 +02: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 16:29:33 +02:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverInputRoomEventsPath,
|
|
|
|
httputil.MakeInternalRPCAPI("RoomserverInputRoomEvents", r.InputRoomEvents),
|
|
|
|
)
|
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverPerformInvitePath,
|
|
|
|
httputil.MakeInternalRPCAPI("RoomserverPerformInvite", r.PerformInvite),
|
2022-06-29 16:29:39 +02:00
|
|
|
)
|
2022-08-11 16:29:33 +02: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 10:13:28 +01:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverPerformAdminDownloadStatePath,
|
|
|
|
httputil.MakeInternalRPCAPI("RoomserverPerformAdminDownloadState", r.PerformAdminDownloadState),
|
|
|
|
)
|
|
|
|
|
2020-07-02 16:41:18 +02:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryPublishedRoomsPath,
|
2022-08-11 16:29:33 +02:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryPublishedRooms", r.QueryPublishedRooms),
|
2020-07-02 16:41:18 +02:00
|
|
|
)
|
2022-08-11 16:29:33 +02:00
|
|
|
|
2020-06-04 16:43:07 +02:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryLatestEventsAndStatePath,
|
2022-08-11 16:29:33 +02:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryLatestEventsAndState", r.QueryLatestEventsAndState),
|
2020-06-04 16:43:07 +02:00
|
|
|
)
|
2022-08-11 16:29:33 +02:00
|
|
|
|
2020-06-04 16:43:07 +02:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryStateAfterEventsPath,
|
2022-08-11 16:29:33 +02:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryStateAfterEvents", r.QueryStateAfterEvents),
|
2020-06-04 16:43:07 +02:00
|
|
|
)
|
2022-08-11 16:29:33 +02:00
|
|
|
|
2020-06-04 16:43:07 +02:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryEventsByIDPath,
|
2022-08-11 16:29:33 +02:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryEventsByID", r.QueryEventsByID),
|
2020-06-04 16:43:07 +02:00
|
|
|
)
|
2022-08-11 16:29:33 +02:00
|
|
|
|
2020-06-04 16:43:07 +02:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryMembershipForUserPath,
|
2022-08-11 16:29:33 +02:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryMembershipForUser", r.QueryMembershipForUser),
|
2020-06-04 16:43:07 +02:00
|
|
|
)
|
2022-08-11 16:29:33 +02:00
|
|
|
|
2020-06-04 16:43:07 +02:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryMembershipsForRoomPath,
|
2022-08-11 16:29:33 +02:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryMembershipsForRoom", r.QueryMembershipsForRoom),
|
2020-06-04 16:43:07 +02:00
|
|
|
)
|
2022-08-11 16:29:33 +02:00
|
|
|
|
2020-09-24 17:18:13 +02:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryServerJoinedToRoomPath,
|
2022-08-11 16:29:33 +02:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryServerJoinedToRoom", r.QueryServerJoinedToRoom),
|
2020-09-24 17:18:13 +02:00
|
|
|
)
|
2022-08-11 16:29:33 +02:00
|
|
|
|
2020-06-04 16:43:07 +02:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryServerAllowedToSeeEventPath,
|
2022-08-11 16:29:33 +02:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryServerAllowedToSeeEvent", r.QueryServerAllowedToSeeEvent),
|
2020-06-04 16:43:07 +02:00
|
|
|
)
|
2022-08-11 16:29:33 +02:00
|
|
|
|
2020-06-04 16:43:07 +02:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryMissingEventsPath,
|
2022-08-11 16:29:33 +02:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryMissingEvents", r.QueryMissingEvents),
|
2020-06-04 16:43:07 +02:00
|
|
|
)
|
2022-08-11 16:29:33 +02:00
|
|
|
|
2020-06-04 16:43:07 +02:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryStateAndAuthChainPath,
|
2022-08-11 16:29:33 +02:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryStateAndAuthChain", r.QueryStateAndAuthChain),
|
2020-06-04 16:43:07 +02:00
|
|
|
)
|
2022-08-11 16:29:33 +02:00
|
|
|
|
2020-06-04 16:43:07 +02:00
|
|
|
internalAPIMux.Handle(
|
2020-06-11 20:50:40 +02:00
|
|
|
RoomserverPerformBackfillPath,
|
2022-08-11 16:29:33 +02:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverPerformBackfill", r.PerformBackfill),
|
2020-06-04 16:43:07 +02:00
|
|
|
)
|
2022-08-11 16:29:33 +02:00
|
|
|
|
2020-11-05 11:19:23 +01:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverPerformForgetPath,
|
2022-08-11 16:29:33 +02:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverPerformForget", r.PerformForget),
|
2020-11-05 11:19:23 +01:00
|
|
|
)
|
2022-08-11 16:29:33 +02:00
|
|
|
|
2020-06-04 16:43:07 +02:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryRoomVersionCapabilitiesPath,
|
2022-08-11 16:29:33 +02:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryRoomVersionCapabilities", r.QueryRoomVersionCapabilities),
|
2020-06-04 16:43:07 +02:00
|
|
|
)
|
2022-08-11 16:29:33 +02:00
|
|
|
|
2020-06-04 16:43:07 +02:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryRoomVersionForRoomPath,
|
2022-08-11 16:29:33 +02:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryRoomVersionForRoom", r.QueryRoomVersionForRoom),
|
2020-06-04 16:43:07 +02:00
|
|
|
)
|
2022-08-11 16:29:33 +02:00
|
|
|
|
2020-06-04 16:43:07 +02:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverSetRoomAliasPath,
|
2022-08-11 16:29:33 +02:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverSetRoomAlias", r.SetRoomAlias),
|
2020-06-04 16:43:07 +02:00
|
|
|
)
|
2022-08-11 16:29:33 +02:00
|
|
|
|
2020-06-04 16:43:07 +02:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverGetRoomIDForAliasPath,
|
2022-08-11 16:29:33 +02:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverGetRoomIDForAlias", r.GetRoomIDForAlias),
|
2020-06-04 16:43:07 +02:00
|
|
|
)
|
2022-08-11 16:29:33 +02:00
|
|
|
|
2020-06-04 16:43:07 +02:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverGetAliasesForRoomIDPath,
|
2022-08-11 16:29:33 +02:00
|
|
|
httputil.MakeInternalRPCAPI("RoomserverGetAliasesForRoomID", r.GetAliasesForRoomID),
|
2020-06-04 16:43:07 +02:00
|
|
|
)
|
2022-08-11 16:29:33 +02:00
|
|
|
|
2020-06-04 16:43:07 +02:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverRemoveRoomAliasPath,
|
2022-08-11 16:29:33 +02: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 11:05:30 +02:00
|
|
|
)
|
2022-08-11 18:23:35 +02:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
RoomserverQueryMembershipAtEventPath,
|
|
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryMembershipAtEventPath", r.QueryMembershipAtEvent),
|
|
|
|
)
|
2020-06-04 16:43:07 +02:00
|
|
|
}
|