Added NSFW statuses filter

This commit is contained in:
localhost_frssoft 2022-04-15 15:03:35 +03:00
parent e928d6f23a
commit 27c3bb40a3
2 changed files with 7 additions and 0 deletions

View file

@ -1,6 +1,7 @@
{ {
"instance": "soc.phreedom.club", "instance": "soc.phreedom.club",
"max_statuses": 40, "max_statuses": 40,
"enabled_nsfw": false,
"default_content_type": "text/markdown", "default_content_type": "text/markdown",
"default_visibility": "unlisted", "default_visibility": "unlisted",
"format_time": "+%d.%m.%Y %H:%M:%S", "format_time": "+%d.%m.%Y %H:%M:%S",

View file

@ -5,6 +5,7 @@ alias default_auth_browser=links
instance_point="https://$instance/api/v1" instance_point="https://$instance/api/v1"
instance_point_pleroma="https://$instance/api/pleroma" instance_point_pleroma="https://$instance/api/pleroma"
instance_hist='instance.hist' instance_hist='instance.hist'
enabled_nsfw=$(jj -i config.json enabled_nsfw)
max_statuses=$(jj -i config.json max_statuses) max_statuses=$(jj -i config.json max_statuses)
default_visibility=$(jj -i config.json default_visibility) default_visibility=$(jj -i config.json default_visibility)
default_content_type=$(jj -i config.json default_content_type) default_content_type=$(jj -i config.json default_content_type)
@ -312,11 +313,16 @@ status_api_one()
statuses_render() 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 if [ "$reversed_statuses" = 'true' ]; then
ids_massive=$(echo $ids_massive | tr ' ' '\n' | tac | tr '\n' ' ') ids_massive=$(echo $ids_massive | tr ' ' '\n' | tac | tr '\n' ' ')
fi fi
for i in $ids_massive; do for i in $ids_massive; do
status=$(echo "$jsonmassive" | jj "#[id=$i]") status=$(echo "$jsonmassive" | jj "#[id=$i]")
reblog=$(echo $status | jj reblog.id) reblog=$(echo $status | jj reblog.id)
uri=$(echo $status | jj uri) uri=$(echo $status | jj uri)
id_status=$(echo $status | jj id) id_status=$(echo $status | jj id)