admin command to delete all remote media within the past x time
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
@@ -96,6 +96,12 @@ enum MediaCommand {
|
||||
|
||||
/// - Deletes a codeblock list of MXC URLs from our database and on the filesystem
|
||||
DeleteList,
|
||||
|
||||
// - Deletes all remote media in the last <x> amount of time using filesystem metadata first created at date.
|
||||
DeletePastRemoteMedia {
|
||||
/// - The duration (at or after), e.g. "5m" to delete all media in the past 5 minutes
|
||||
duration: String,
|
||||
},
|
||||
}
|
||||
|
||||
#[cfg_attr(test, derive(Debug))]
|
||||
@@ -785,6 +791,17 @@ impl Service {
|
||||
));
|
||||
}
|
||||
}
|
||||
MediaCommand::DeletePastRemoteMedia { duration } => {
|
||||
let deleted_count = services()
|
||||
.media
|
||||
.delete_all_remote_media_at_after_time(duration)
|
||||
.await?;
|
||||
|
||||
return Ok(RoomMessageEventContent::text_plain(format!(
|
||||
"Deleted {} total files.",
|
||||
deleted_count
|
||||
)));
|
||||
}
|
||||
},
|
||||
AdminCommand::Users(command) => match command {
|
||||
UserCommand::List => match services().users.list_local_users() {
|
||||
|
||||
Reference in New Issue
Block a user