add purge_history and purge_history_status

This commit is contained in:
MeaTLoTioN 2023-01-18 00:21:00 +00:00
parent 00efec62d9
commit 69a2278865
2 changed files with 55 additions and 0 deletions

30
purge_history Executable file
View File

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

25
purge_history_status Executable file
View File

@ -0,0 +1,25 @@
#!/bin/bash
usage() {
echo "Not enough arguments supplied."
echo "Syntax: $(basename $0) {statusid}"
echo
}
if [[ $# -lt 1 ]]; then
usage
exit 1
fi
. $(dirname $0)/auth
SID=$1
echo "Using status_id: ${SID}"
curl -s -X GET \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
"http://localhost:8008/_synapse/admin/v1/purge_history_status/${SID}" \
# | sed 's/,/,\n /g; s/{/{\n /g; s/}/\n}/g'
echo