en:tecdoc:abusenotif

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
en:tecdoc:abusenotif [2021/03/17 16:18]
jomat [Content Reports]
en:tecdoc:abusenotif [2021/07/01 19:15]
jomat [User Reg Notifications]
Line 25: Line 25:
 #!/usr/bin/zsh #!/usr/bin/zsh
  
-AT='MDMA...'+# access token of @abuse:… 
 +AT='MDMA... 
 +# admin room to send notifications to
 ROOM='!x1y2z3:example.com' ROOM='!x1y2z3:example.com'
-IP=$1+# ip of the new user, with gdpr redaction to /24 
 +IP=`echo $1|cut -d. -f1-3`.0 
 + 
 +#read stdin
 SI=`/bin/cat` SI=`/bin/cat`
-echo `date` $SI >> /tmp/newuserlog+#try to retrieve new user id
 U=`echo $SI|jq -r .user_id` U=`echo $SI|jq -r .user_id`
  
Line 35: Line 40:
 [ "null" = "$U" ] && exit 0 [ "null" = "$U" ] && exit 0
  
 +# send notification
 curl -X PUT "https://asra.gr/_matrix/client/r0/rooms/${ROOM}/send/m.room.message/"`uuid -m -F SIV`"?access_token=${AT}" -H  "accept: application/json" -H  "Content-Type: application/json" -d " \"body\": \"@room New user registered: ${U} from ${IP}\",  \"msgtype\": \"m.text\"}" >> /tmp/reguser.txt 2>> /tmp/reguser.txt curl -X PUT "https://asra.gr/_matrix/client/r0/rooms/${ROOM}/send/m.room.message/"`uuid -m -F SIV`"?access_token=${AT}" -H  "accept: application/json" -H  "Content-Type: application/json" -d " \"body\": \"@room New user registered: ${U} from ${IP}\",  \"msgtype\": \"m.text\"}" >> /tmp/reguser.txt 2>> /tmp/reguser.txt
 </code> </code>
  • en/tecdoc/abusenotif.txt
  • Last modified: 2021/08/22 10:04
  • by jomat