diff --git a/pleroma-cli.sh b/pleroma-cli.sh index 22d0575..cb69b5e 100755 --- a/pleroma-cli.sh +++ b/pleroma-cli.sh @@ -303,7 +303,7 @@ delqse() statuses_api_account() { - default_curl_opt "$instance_point/accounts/$1/statuses?limit=$max_statuses" + default_curl_opt "$instance_point/accounts/$1/statuses?limit=$max_statuses&max_id=$2&min_id=$3" } status_api_one() @@ -349,6 +349,47 @@ statuses_render() done } +statuses_view_menu() +{ + sub_menu_lvl=2 + json=$(statuses_api_account $1) + while [ $sub_menu_lvl -eq 2 ]; do + clear + echo "[Statuses $1]" + ids_massive=$(echo $json | jj -l \#.id | delq) + jsonmassive=$json + statuses_render + menustatuses=$(echo 'Prev\nNext\nReply\nShare\nFavorite\nThread\nBack' | fzy) + case "$menustatuses" in + "Back") sub_menu_lvl=1 ;; + "Prev") + indexator=$(expr $max_statuses - 1) + echo '#EXTM3U' > attachments.m3u8 + clear + offset=$(echo $json | jj $indexator.id) + json=$(statuses_api_account $1 $offset) + ;; + "Next") + echo '#EXTM3U' > attachments.m3u8 + clear + offset=$(echo $json | jj 0.id) + json=$(statuses_api_account $1 '' $offset) + ;; + "Reply") reply_mode ;; + "Share") share_mode ;; + "Favorite") favourite_mode ;; + "Thread") thread_open ;; + esac + done +} + +thread_open() +{ + echo 'Input id' + read status_id + thread_menu $status_id +} + thread_menu() { sub_menu_lvl=2 @@ -368,9 +409,12 @@ thread_menu() ids_massive=$(echo $jsonthread | jj -l \#.id | delq) jsonmassive=$jsonthread statuses_render - menuthread=$(echo 'Back' | fzy) + menuthread=$(echo 'Back\nReply\nShare\nFavorite' | fzy) case "$menuthread" in "Back") sub_menu_lvl=1 ;; + "Reply") reply_mode ;; + "Share") share_mode ;; + "Favorite") favourite_mode ;; esac done } @@ -404,63 +448,65 @@ timeline_menu() offset=$(jj -i preload 0.id) json=$(timeline_api '' $offset) ;; - "Reply") - echo 'Input id' - read status_id - if [ "$quoting_reply" = 'true' ]; then - status_api_one $status_id | jj content | html_to_txt_render | sed 's/^/> /' > tmp_status.md - fi - write_status_menu $status_id - - ;; - "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 - echo $http_code - fi - done - ;; - "Favorite") - echo 'Input id (s - stop)' - favoritemode=1 - while [ $favoritemode -eq 1 ]; do - read status_id - if [ "$status_id" = 's' ]; then - favoritemode=0 - else - favorite_api_status $status_id - echo $http_code - fi - done - ;; - "Thread") - indexator=$(expr $max_statuses - 1) - echo 'Input id' - read status_id - thread_menu $status_id - ;; - "Main menu") - sub_menu_lvl=0 ;; + "Reply") reply_mode ;; + "Share") share_mode ;; + "Favorite") favourite_mode ;; + "Thread") thread_open ;; + "Main menu") sub_menu_lvl=0 ;; esac done } +reply_mode() +{ + echo 'Input id' + read status_id + if [ "$quoting_reply" = 'true' ]; then + status_api_one $status_id | jj content | html_to_txt_render | sed 's/^/> /' > tmp_status.md + fi + write_status_menu $status_id +} + share_api_status() { post_request -w "%{http_code}" --url $instance_point/statuses/$1/reblog --output /dev/null } +share_mode() +{ + 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 + echo $http_code + fi + done +} + favorite_api_status() { post_request -w "%{http_code}" --url $instance_point/statuses/$1/favourite --output /dev/null } +favourite_mode() +{ + echo 'Input id (s - stop)' + favoritemode=1 + while [ $favoritemode -eq 1 ]; do + read status_id + if [ "$status_id" = 's' ]; then + favoritemode=0 + else + favorite_api_status $status_id + echo $http_code + fi + done +} + write_api_status() { if [ -n "$mediaattach" ]; then