Compare commits

...

2 commits

2 changed files with 43 additions and 55 deletions

View file

@ -5,6 +5,7 @@
"default_visibility": "unlisted",
"format_time": "+%d.%m.%Y %H:%M:%S",
"boost_symbol": "[>>]",
"reversed_statuses": false,
"public_list_instances": [
"outerheaven.club",
"stereophonic.space",

View file

@ -10,6 +10,7 @@ default_visibility=$(jj -i config.json default_visibility)
default_content_type=$(jj -i config.json default_content_type)
format_time=$(jj -i config.json format_time)
boost_symbol=$(jj -i config.json boost_symbol)
reversed_statuses=$(jj -i config.json reversed_statuses)
#[AUTH SECTION]
mkdir -m 711 -p .app_sessions
@ -303,6 +304,39 @@ statuses_api_account()
default_curl_opt "accounts/$1/statuses?limit=$max_statuses"
}
statuses_render()
{
if [ "$reversed_statuses" = 'true' ]; then
ids_massive=$(echo $ids_massive | tr ' ' '\n' | tac | tr '\n' ' ')
fi
for i in $ids_massive; do
status=$(echo "$jsonmassive" | jj "#[id=$i]")
reblog=$(echo $status | jj reblog.id)
uri=$(echo $status | jj uri)
id_status=$(echo $status | jj id)
dateutc=$(echo $status | jj created_at)
reply_to_id=$(echo $status | jj in_reply_to_id)
echo "$(date -d $dateutc "$format_time") <$id_status> $uri"
if [ -n "$reply_to_id" ]; then
echo "Reply to: $reply_to_id"
fi
if [ -n "$reblog" ]; then
echo "$boost_symbol $reblog"
fi
spoiler_text=$(echo "$status" | jj spoiler_text)
if [ -n "$spoiler_text" ]; then
echo "#[$spoiler_text]"
fi
echo "$status" | jj -r content | delqse | html_to_txt_render
attachments=$(echo $status | jj -l media_attachments.#.remote_url | delq)
if [ -n "$attachments" ]; then
echo "#EXTINF:-1, $uri" >> attachments.m3u8
echo "$attachments" >> attachments.m3u8
fi
echo '=========='
done
}
thread_menu()
{
sub_menu_lvl=2
@ -316,34 +350,15 @@ thread_menu()
else
jsonthread="$descendants"
fi
indexator=$(expr $(echo $jsonthread | jj \#) - 1)
counter=0
while [ $sub_menu_lvl -eq 2 ]; do
clear
echo '[Thread]'
while [ ! $indexator -eq $counter ]; do
status=$(echo $jsonthread | jj $counter)
uri=$(echo $status | jj uri)
id_status=$(echo $status | jj id)
dateutc=$(echo $status | jj created_at)
reply_to_id=$(echo $status | jj in_reply_to_id)
echo "$(date -d $dateutc "$format_time") <$id_status> $uri"
if [ -n "$reply_to_id" ]; then
echo "Reply to: $reply_to_id"
fi
echo "$status" | jj -r content | delqse | html_to_txt_render
attachments=$(echo $status | jj -l media_attachments.#.remote_url | delq)
if [ -n "$attachments" ]; then
echo "#EXTINF:-1, $uri" >> attachments.m3u8
echo "$attachments" >> attachments.m3u8
fi
counter=$(expr $counter + 1)
echo '_____'
done
ids_massive=$(echo $jsonthread | jj -l \#.id | delq)
jsonmassive=$jsonthread
statuses_render
menuthread=$(echo 'Back' | fzy)
case "$menuthread" in
"Back")
sub_menu_lvl=1 ;;
"Back") sub_menu_lvl=1 ;;
esac
done
}
@ -356,38 +371,12 @@ timeline_api()
timeline_menu()
{
json=$(timeline_api)
indexator=$(expr $max_statuses - 1)
sub_menu_lvl=1
echo '#EXTM3U' > attachments.m3u8
while [ $sub_menu_lvl -eq 1 ]; do
while [ $indexator -gt 0 ]; do
status=$(echo "$json" | jj $indexator)
reblog=$(echo $status | jj reblog)
uri=$(echo $status | jj uri)
id_status=$(echo $status | jj id)
dateutc=$(echo $status | jj created_at)
reply_to_id=$(echo $status | jj in_reply_to_id)
echo "$(date -d $dateutc "$format_time") <$id_status> $uri"
if [ -n "$reply_to_id" ]; then
echo "Reply to: $reply_to_id"
fi
if [ -n "$reblog" ]; then
echo "$boost_symbol"
fi
spoiler_text=$(echo "$status" | jj spoiler_text)
if [ -n "$spoiler_text" ]; then
echo "#[$spoiler_text]"
fi
echo "$status" | jj -r content | delqse | html_to_txt_render
attachments=$(echo $status | jj -l media_attachments.#.remote_url | sed 's/"//g')
if [ -n "$attachments" ]; then
echo "#EXTINF:-1, $uri" >> attachments.m3u8
echo "$attachments" >> attachments.m3u8
fi
indexator=$(expr $indexator - 1)
echo '_____'
done
ids_massive=$(echo $json | jj -l \#.id | delq)
jsonmassive=$json
statuses_render
menu=$(echo 'Prev\nNext\nReply\nShare\nFavorite\nThread\nMain menu' | fzy)
case $menu in
"Prev")
@ -398,7 +387,6 @@ timeline_menu()
json=$(timeline_api $offset)
;;
"Next")
indexator=$(expr $max_statuses - 1)
echo '#EXTM3U' > attachments.m3u8
clear
offset=$(jj -i preload 0.id)
@ -446,7 +434,6 @@ timeline_menu()
sub_menu_lvl=0 ;;
esac
done
}
share_api_status()