Added share mode in timeline

This commit is contained in:
localhost_frssoft 2022-04-12 01:02:16 +03:00
parent 03cda2b6d9
commit c11c139eec

View file

@ -78,8 +78,9 @@ timeline_menu()
while [ $indexator -gt 0 ]; do
status=$(echo $json | jj $indexator)
uri=$(echo $status | jj uri)
id_status=$(echo $status | jj id)
dateutc=$(echo $status | jj created_at)
echo "$(date -d $dateutc) <-> $uri"
echo "$(date -d $dateutc) <$id_status> $uri"
echo $status | jj content | sed -e 's/<br[^>]*>/\n/g ; s/<[^>]*>//g ; s/&gt;*/>/g ; s/&lt;*/</g ; s/&quot;/"/g'
attachments=$(echo $status | jj -l media_attachments.#.remote_url | sed 's/"//g')
if [ -n "$attachments" ]; then
@ -90,7 +91,7 @@ timeline_menu()
echo '_____'
done
indexator=$(expr $max_statuses - 1)
menu=$(echo 'Prev\nNext\nMain menu' | fzy)
menu=$(echo 'Prev\nNext\nShare\nMain menu' | fzy)
case $menu in
"Prev")
echo '#EXTM3U' > attachments.m3u8
@ -104,6 +105,19 @@ timeline_menu()
offset=$(jj -i preload 0.id)
json=$(timeline_api $offset)
;;
"Share")
echo 'Input id (s - stop)'
sharemode=1
while [ $sharemode -eq 1 ]; do
read status_id
if [ "$status_id" = 's' ]; then
sharemode=0
else
share_api_status $status_id >> /dev/null
echo $http_code
fi
done
;;
"Main menu")
sub_menu_lvl=0 ;;
esac
@ -111,6 +125,11 @@ timeline_menu()
}
share_api_status()
{
curl -w "%{http_code}" -X POST -s --compressed -H "Authorization: Bearer $auth" --url $instance_point/statuses/$1/reblog
}
write_api_status()
{
curl -s --compressed -H "Authorization: Bearer $auth" --url $instance_point/statuses \