add purge local and remote media

This commit is contained in:
MeaTLoTioN 2023-01-17 22:04:23 +00:00
parent 8e99185335
commit 00efec62d9
2 changed files with 52 additions and 0 deletions

26
purge_local_media Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
usage() {
echo "Not enough arguments supplied."
echo "Syntax: $(basename $0) {date yyyy-mm-dd}"
echo
}
if [[ $# -lt 1 ]]; then
usage
exit 1
fi
. $(dirname $0)/auth
DS=$1
TS=$(date -d "${DS}" "+%s%3N")
echo "Converting ${DS} to ${TS}"
curl -s --insecure -X POST \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{}' "http://localhost:8008/_synapse/admin/v1/media/matrix.erb.pw/delete?before_ts=${TS}" \
# | sed 's/,/,\n /g; s/{/{\n /g; s/}/\n}/g'
echo

26
purge_remote_media Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
usage() {
echo "Not enough arguments supplied."
echo "Syntax: $(basename $0) {date yyyy-mm-dd}"
echo
}
if [[ $# -lt 1 ]]; then
usage
exit 1
fi
. $(dirname $0)/auth
DS=$1
TS=$(date -d "${DS}" "+%s%3N")
echo "Converting ${DS} to ${TS}"
curl -s --insecure -X POST \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{}' "http://localhost:8008/_synapse/admin/v1/purge_media_cache?before_ts=${TS}" \
# | sed 's/,/,\n /g; s/{/{\n /g; s/}/\n}/g'
echo