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

View file

@ -12,6 +12,7 @@ for i in $ids; do
# Fields
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')
reblog=$(echo "$json" | jj -l "#[id=$i].reblog.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
echo "$status_media_attachments" > "$main_basedir"/all_statuses/$instance/$status_id/media_attachments.m3u8
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/*
touch -d "$status_date" "$main_basedir"/all_statuses/$instance/$status_id
done