NSFW filter changed and disabled by default; mark NSFW content

This commit is contained in:
localhost_frssoft 2022-04-19 11:06:21 +03:00
parent 9c2e71a655
commit 135554fe5b
2 changed files with 8 additions and 5 deletions

View file

@ -2,7 +2,7 @@
"instance": "soc.phreedom.club", "instance": "soc.phreedom.club",
"max_statuses": 40, "max_statuses": 40,
"per_status_mode": false, "per_status_mode": false,
"enabled_nsfw": false, "enabled_nsfw": true,
"hide_reblogs": false, "hide_reblogs": false,
"default_content_type": "text/markdown", "default_content_type": "text/markdown",
"default_visibility": "unlisted", "default_visibility": "unlisted",

View file

@ -317,10 +317,6 @@ 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
@ -330,6 +326,10 @@ statuses_render()
if [ "$hide_reblogs" = 'true' ] && [ -n "$reblog" ]; then if [ "$hide_reblogs" = 'true' ] && [ -n "$reblog" ]; then
continue continue
fi fi
sensitive=$(echo "$status" | jj sensitive)
if [ "$enabled_nsfw" = 'false' ] && [ "$sensitive" = 'true' ]; then
continue
fi
whoacct=$(echo "$status" | jj account.acct) whoacct=$(echo "$status" | jj account.acct)
reblogacct=$(echo "$status" | jj reblog.account.acct) reblogacct=$(echo "$status" | jj reblog.account.acct)
uri=$(echo "$status" | jj uri) uri=$(echo "$status" | jj uri)
@ -350,6 +350,9 @@ statuses_render()
if [ -n "$spoiler_text" ]; then if [ -n "$spoiler_text" ]; then
echo "#[$spoiler_text]" echo "#[$spoiler_text]"
fi fi
if [ "$sensitive" = 'true' ]; then
echo '[NSFW]'
fi
echo "$status" | jj -r content | delqse | html_to_txt_render echo "$status" | jj -r content | delqse | html_to_txt_render
attachments=$(echo "$status" | jj -l media_attachments.#.remote_url | delq) attachments=$(echo "$status" | jj -l media_attachments.#.remote_url | delq)
if [ -n "$attachments" ]; then if [ -n "$attachments" ]; then