Compare commits

...

2 commits

2 changed files with 14 additions and 7 deletions

View file

@ -2,7 +2,8 @@
"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,
"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

@ -6,6 +6,7 @@ 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) enabled_nsfw=$(jj -i config.json enabled_nsfw)
hide_reblogs=$(jj -i config.json hide_reblogs)
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)
@ -316,18 +317,20 @@ 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]")
whoacct=$(echo "$status" | jj account.acct)
reblog=$(echo "$status" | jj reblog.id) reblog=$(echo "$status" | jj reblog.id)
if [ "$hide_reblogs" = 'true' ] && [ -n "$reblog" ]; then
continue
fi
sensitive=$(echo "$status" | jj sensitive)
if [ "$enabled_nsfw" = 'false' ] && [ "$sensitive" = 'true' ]; then
continue
fi
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)
id_status=$(echo "$status" | jj id) id_status=$(echo "$status" | jj id)
@ -347,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