From 27c3bb40a3c659f3a0e29a29886a58671f3f5d35 Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Fri, 15 Apr 2022 15:03:35 +0300 Subject: [PATCH] Added NSFW statuses filter --- config.json | 1 + pleroma-cli.sh | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/config.json b/config.json index e0f3bc6..fd52a27 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,7 @@ { "instance": "soc.phreedom.club", "max_statuses": 40, + "enabled_nsfw": false, "default_content_type": "text/markdown", "default_visibility": "unlisted", "format_time": "+%d.%m.%Y %H:%M:%S", diff --git a/pleroma-cli.sh b/pleroma-cli.sh index 79d3235..22d0575 100755 --- a/pleroma-cli.sh +++ b/pleroma-cli.sh @@ -5,6 +5,7 @@ alias default_auth_browser=links instance_point="https://$instance/api/v1" instance_point_pleroma="https://$instance/api/pleroma" instance_hist='instance.hist' +enabled_nsfw=$(jj -i config.json enabled_nsfw) max_statuses=$(jj -i config.json max_statuses) default_visibility=$(jj -i config.json default_visibility) default_content_type=$(jj -i config.json default_content_type) @@ -312,11 +313,16 @@ status_api_one() statuses_render() { + if [ "$enabled_nsfw" = 'false' ]; then + ids_massive=$(echo "$jsonmassive" | jj -l '#[sensitive=false]#.id' | delq) + jsonmassive=$(echo "$jsonmassive" | jj '#[sensitive=false]#') + fi if [ "$reversed_statuses" = 'true' ]; then ids_massive=$(echo $ids_massive | tr ' ' '\n' | tac | tr '\n' ' ') fi for i in $ids_massive; do status=$(echo "$jsonmassive" | jj "#[id=$i]") + reblog=$(echo $status | jj reblog.id) uri=$(echo $status | jj uri) id_status=$(echo $status | jj id)