Replying to Avatar G.M.Joe

nostr:npub1tcekjparmkju6k83r5tzmzjvjwy0nnajlrwyk35us9g7x7wx80ys9hjmky ich sehe du nutzt strfry als Relay. Gibt es da möglichkeiten das Relays zu managen? Also Wort blacklisten oder Bulk Aktionen um Notes zu löschen?

Per script, ja! Nennt sich "Policy" oder "Plugin" und es gibt paar frameworks. Aber an sich ist das erstmal nichts anderes als ein program/befehl der einfach das Event auf STDIN bekommt: https://github.com/hoytech/strfry/blob/master/docs/plugins.md

Es gibt sowohl ein Framework in Deno von Alex Gleason als auch ein Go framework mit denen man die schreiben kann.

Aber die aller einfachste Variante ist im Grunde:

#!/bin/sh

input=$(cat)

if test "$(echo $input | wc -c)" = 0; then exit 1; fi

id=$(echo $input | jq -r ".event.id")

kind=$(echo $input | jq -r ".event.kind")

msg=$(echo $input | jq -r ".event.content")

rtmsg=""

if test $kind = 1; then

case $msg in

*badword*) rtmsg='{"id": "'$id'", "action": "shadowReject"}';;

esac

fi

echo $rtmsg

exit 0

Gibt bei weitem bessere Beispiele - aber das dient eher als Orientierung. :)

Reply to this note

Please Login to reply.

Discussion

Ok. Das werd ich mir mal anschauen. Danke.