Created: 2021-04-27

Pleroma scripts

This is a place where I'll collect some admin scripts that I use on my pleroma server.

This is little script extracts the so called mrf_simple policy configs that I use.
It also takes the comments from each line and puts them side-by-side in a nice table. The idea was to have an ability to publish also my reason for blocking other instances.

sed -n '/config :pleroma, :mrf_simple,/,/^[ \s\t]*\]$/p' ${1} \
| sed '1 s/^.*$/MRF_SIMPLE policies on this server/;
        s/^[ \t]*\([a-z]\+\):[^\[]\+\[/.: \1 :./;
        $ d;
        s/^[ \t]*"\([^"]\+\)", \(#.*\)$/\1 \2/;
' \
| column -s '#' -t \
| sed '1 a\
' \
| sed '/.:[^:]\+:./a\
' \
| sed '1 i <pre>\
' \
| sed '$ a\
</pre>'