Improvment status actions; added reblog.id

This commit is contained in:
localhost_frssoft 2022-08-06 11:42:39 +03:00
parent 60ff687f24
commit 5436687c43
2 changed files with 21 additions and 12 deletions

View file

@ -996,18 +996,22 @@ if [ "$daemon_mode" = 'yes' ]; then
statuses_auto_update & statuses_auto_update &
while true; do while true; do
sleep 5 sleep 5
statuses_to_fav=$(/bin/ls $main_basedir/all_statuses/$instance/*/favourite 2>/dev/null) for file_func in favourite share; do
statuses_to_share=$(/bin/ls $main_basedir/all_statuses/$instance/*/share 2>/dev/null) statuses_file_action=$(/bin/ls $main_basedir/all_statuses/$instance/*/$file_func 2>/dev/null)
if [ -n "$statuses_to_fav" ]; then if [ -n "$statuses_file_action" ]; then
status_id=$(dirname "$statuses_to_fav" | sed 's/.*\///g') dir_status=$(dirname "$statuses_file_action")
favorite_api_status $status_id if [ -f "$dir_status/reblog.id" ]; then
rm $statuses_to_fav status_id=$(cat $dir_status/reblog.id)
fi else
if [ -n "$statuses_to_share" ]; then status_id=$(echo $dir_status | sed 's/.*\///g')
status_id=$(dirname "$statuses_to_share" | sed 's/.*\///g') fi
share_api_status $status_id
rm $statuses_to_share case $file_func in
fi 'favourite') favorite_api_status "$status_id" ; rm "$statuses_file_action" ;;
'share') share_api_status $status_id ; rm "$statuses_file_action" ;;
esac
fi
done
done done
fi fi

View file

@ -12,6 +12,7 @@ for i in $ids; do
# Fields # Fields
content=$(echo "$json" | jj "#[id=$i].content" | "$main_basedir"/utils/html_to_txt_render) content=$(echo "$json" | jj "#[id=$i].content" | "$main_basedir"/utils/html_to_txt_render)
status_media_attachments=$(echo "$json" | jj -l "#[id=$i].media_attachments.#.url" | tr -d '"\v') status_media_attachments=$(echo "$json" | jj -l "#[id=$i].media_attachments.#.url" | tr -d '"\v')
reblog=$(echo "$json" | jj -l "#[id=$i].reblog.id")
chmod 711 "$main_basedir"/all_statuses/$instance/$status_id chmod 711 "$main_basedir"/all_statuses/$instance/$status_id
@ -21,6 +22,10 @@ for i in $ids; do
if [ -n "$status_media_attachments" ]; then if [ -n "$status_media_attachments" ]; then
echo "$status_media_attachments" > "$main_basedir"/all_statuses/$instance/$status_id/media_attachments.m3u8 echo "$status_media_attachments" > "$main_basedir"/all_statuses/$instance/$status_id/media_attachments.m3u8
fi fi
if [ -n "$reblog" ]; then
echo "$reblog" > "$main_basedir"/all_statuses/$instance/$status_id/reblog.id
fi
chmod 600 "$main_basedir"/all_statuses/$instance/$status_id/* chmod 600 "$main_basedir"/all_statuses/$instance/$status_id/*
touch -d "$status_date" "$main_basedir"/all_statuses/$instance/$status_id touch -d "$status_date" "$main_basedir"/all_statuses/$instance/$status_id
done done