mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-18 16:21:24 +01:00
add admin command to delete all remote media files
This commit is contained in:
parent
d7087c66bb
commit
9d14c5d461
4 changed files with 98 additions and 2 deletions
|
|
@ -161,4 +161,27 @@ impl service::media::Data for KeyValueDatabase {
|
|||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn all_file_metadata(
|
||||
&self,
|
||||
) -> Box<
|
||||
dyn Iterator<Item = Result<(OwnedMxcUri, FileMeta, MediaFileKey)>> + '_,
|
||||
> {
|
||||
Box::new(
|
||||
self.mediaid_file
|
||||
.iter()
|
||||
.map(|(key, _)| {
|
||||
let key = MediaFileKey::new(key);
|
||||
|
||||
let parts = MediaFileKeyParts::try_from(&key)?;
|
||||
if parts.width != 0 && parts.height != 0 {
|
||||
// Skip thumbnails
|
||||
return Ok(None);
|
||||
};
|
||||
|
||||
Ok(Some((parts.mxc, parts.meta, key)))
|
||||
})
|
||||
.filter_map(Result::transpose),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue