mirror of
https://github.com/matrix-org/dendrite
synced 2024-11-05 07:29:03 +01:00
738686ae68
This adds a new admin endpoint `/_dendrite/admin/purgeRoom/{roomID}`. It completely erases all database entries for a given room ID. The roomserver will start by clearing all data for that room and then will generate an output event to notify downstream components (i.e. the sync API and federation API) to do the same. It does not currently clear media and it is currently not implemented for SQLite since it relies on SQL array operations right now. Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com> Co-authored-by: Till Faelligen <2353100+S7evinK@users.noreply.github.com>
216 lines
7 KiB
Go
216 lines
7 KiB
Go
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, enableMetrics bool) {
|
|
internalAPIMux.Handle(
|
|
RoomserverInputRoomEventsPath,
|
|
httputil.MakeInternalRPCAPI("RoomserverInputRoomEvents", enableMetrics, r.InputRoomEvents),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverPerformInvitePath,
|
|
httputil.MakeInternalRPCAPI("RoomserverPerformInvite", enableMetrics, r.PerformInvite),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverPerformJoinPath,
|
|
httputil.MakeInternalRPCAPI("RoomserverPerformJoin", enableMetrics, r.PerformJoin),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverPerformLeavePath,
|
|
httputil.MakeInternalRPCAPI("RoomserverPerformLeave", enableMetrics, r.PerformLeave),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverPerformPeekPath,
|
|
httputil.MakeInternalRPCAPI("RoomserverPerformPeek", enableMetrics, r.PerformPeek),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverPerformInboundPeekPath,
|
|
httputil.MakeInternalRPCAPI("RoomserverPerformInboundPeek", enableMetrics, r.PerformInboundPeek),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverPerformUnpeekPath,
|
|
httputil.MakeInternalRPCAPI("RoomserverPerformUnpeek", enableMetrics, r.PerformUnpeek),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverPerformRoomUpgradePath,
|
|
httputil.MakeInternalRPCAPI("RoomserverPerformRoomUpgrade", enableMetrics, r.PerformRoomUpgrade),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverPerformPublishPath,
|
|
httputil.MakeInternalRPCAPI("RoomserverPerformPublish", enableMetrics, r.PerformPublish),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverPerformAdminEvacuateRoomPath,
|
|
httputil.MakeInternalRPCAPI("RoomserverPerformAdminEvacuateRoom", enableMetrics, r.PerformAdminEvacuateRoom),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverPerformAdminEvacuateUserPath,
|
|
httputil.MakeInternalRPCAPI("RoomserverPerformAdminEvacuateUser", enableMetrics, r.PerformAdminEvacuateUser),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverPerformAdminPurgeRoomPath,
|
|
httputil.MakeInternalRPCAPI("RoomserverPerformAdminPurgeRoom", enableMetrics, r.PerformAdminPurgeRoom),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverPerformAdminDownloadStatePath,
|
|
httputil.MakeInternalRPCAPI("RoomserverPerformAdminDownloadState", enableMetrics, r.PerformAdminDownloadState),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverQueryPublishedRoomsPath,
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryPublishedRooms", enableMetrics, r.QueryPublishedRooms),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverQueryLatestEventsAndStatePath,
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryLatestEventsAndState", enableMetrics, r.QueryLatestEventsAndState),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverQueryStateAfterEventsPath,
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryStateAfterEvents", enableMetrics, r.QueryStateAfterEvents),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverQueryEventsByIDPath,
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryEventsByID", enableMetrics, r.QueryEventsByID),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverQueryMembershipForUserPath,
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryMembershipForUser", enableMetrics, r.QueryMembershipForUser),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverQueryMembershipsForRoomPath,
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryMembershipsForRoom", enableMetrics, r.QueryMembershipsForRoom),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverQueryServerJoinedToRoomPath,
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryServerJoinedToRoom", enableMetrics, r.QueryServerJoinedToRoom),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverQueryServerAllowedToSeeEventPath,
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryServerAllowedToSeeEvent", enableMetrics, r.QueryServerAllowedToSeeEvent),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverQueryMissingEventsPath,
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryMissingEvents", enableMetrics, r.QueryMissingEvents),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverQueryStateAndAuthChainPath,
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryStateAndAuthChain", enableMetrics, r.QueryStateAndAuthChain),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverPerformBackfillPath,
|
|
httputil.MakeInternalRPCAPI("RoomserverPerformBackfill", enableMetrics, r.PerformBackfill),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverPerformForgetPath,
|
|
httputil.MakeInternalRPCAPI("RoomserverPerformForget", enableMetrics, r.PerformForget),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverQueryRoomVersionCapabilitiesPath,
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryRoomVersionCapabilities", enableMetrics, r.QueryRoomVersionCapabilities),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverQueryRoomVersionForRoomPath,
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryRoomVersionForRoom", enableMetrics, r.QueryRoomVersionForRoom),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverSetRoomAliasPath,
|
|
httputil.MakeInternalRPCAPI("RoomserverSetRoomAlias", enableMetrics, r.SetRoomAlias),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverGetRoomIDForAliasPath,
|
|
httputil.MakeInternalRPCAPI("RoomserverGetRoomIDForAlias", enableMetrics, r.GetRoomIDForAlias),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverGetAliasesForRoomIDPath,
|
|
httputil.MakeInternalRPCAPI("RoomserverGetAliasesForRoomID", enableMetrics, r.GetAliasesForRoomID),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverRemoveRoomAliasPath,
|
|
httputil.MakeInternalRPCAPI("RoomserverRemoveRoomAlias", enableMetrics, r.RemoveRoomAlias),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverQueryCurrentStatePath,
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryCurrentState", enableMetrics, r.QueryCurrentState),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverQueryRoomsForUserPath,
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryRoomsForUser", enableMetrics, r.QueryRoomsForUser),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverQueryBulkStateContentPath,
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryBulkStateContent", enableMetrics, r.QueryBulkStateContent),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverQuerySharedUsersPath,
|
|
httputil.MakeInternalRPCAPI("RoomserverQuerySharedUsers", enableMetrics, r.QuerySharedUsers),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverQueryKnownUsersPath,
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryKnownUsers", enableMetrics, r.QueryKnownUsers),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverQueryServerBannedFromRoomPath,
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryServerBannedFromRoom", enableMetrics, r.QueryServerBannedFromRoom),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverQueryAuthChainPath,
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryAuthChain", enableMetrics, r.QueryAuthChain),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverQueryRestrictedJoinAllowed,
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryRestrictedJoinAllowed", enableMetrics, r.QueryRestrictedJoinAllowed),
|
|
)
|
|
internalAPIMux.Handle(
|
|
RoomserverQueryMembershipAtEventPath,
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryMembershipAtEventPath", enableMetrics, r.QueryMembershipAtEvent),
|
|
)
|
|
|
|
internalAPIMux.Handle(
|
|
RoomserverQueryLeftMembersPath,
|
|
httputil.MakeInternalRPCAPI("RoomserverQueryLeftMembersPath", enableMetrics, r.QueryLeftUsers),
|
|
)
|
|
}
|