# HG changeset patch # User Peter Gervai # Date 1678310874 -3600 # Node ID 3336c2c14bae9b265fa2d8aa3ca6031be3772e5a # Parent 3d9a0d238469fdf181581555ea41d556cfbe4f49 Add mass_event_remove.sh: simple script redact events collected from the db diff -r 3d9a0d238469 -r 3336c2c14bae synapse/mass_event_remove.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/synapse/mass_event_remove.sh Wed Mar 08 22:27:54 2023 +0100 @@ -0,0 +1,25 @@ +#!/bin/bash +# +# remove a list of events from a specific room +# +# create event list like: +# sudo -u postgres psql synapse -Atc \ +# "SELECT event_id FROM events e LEFT JOIN event_json ej USING(event_id) WHERE e.room_id='"'!'"NrRVEWbxnLuHdvlPhM:grin.hu' AND ej.json ~ 'gorelol.ori-club.xyz'" > events.data +# +# +. ./_config.sh + +room_id="!NrRVEWbxnLuHdvlPhM:grin.hu" +reason="spamming" + +f_event="events.data" + +cat $f_event | while read evt; do + #echo "== event: $evt ==" + method='PUT' + data="{\"reason\":\"${reason}\"}" + cmd="/_matrix/client/v3/rooms/${room_id}/redact/${evt}/"`uuid` + #echo "${method} $cmd $data" + curl -d "${data}" -X "${method}" -H "Authorization: Bearer ${T}" "${SRV}${cmd}" +done +