From 311a4e7dea3ef7376f5345d8f077adb941e7a904 Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Sat, 16 Apr 2022 13:39:07 +0300 Subject: [PATCH] Added: Share + favorite function --- pleroma-cli.sh | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/pleroma-cli.sh b/pleroma-cli.sh index 432f3b6..08531ac 100755 --- a/pleroma-cli.sh +++ b/pleroma-cli.sh @@ -365,7 +365,7 @@ statuses_view_menu() ids_massive=$(echo $json | jj -l \#.id | delq) jsonmassive=$json statuses_render - menustatuses=$(echo 'Prev\nNext\nReply\nShare\nFavorite\nThread\nBack' | fzy) + menustatuses=$(echo 'Prev\nNext\nReply\nShare\nFavorite\nShare and favorite\nThread\nBack' | fzy) case "$menustatuses" in "Back") sub_menu_lvl=1 ;; "Prev") @@ -384,6 +384,7 @@ statuses_view_menu() "Reply") reply_mode ;; "Share") share_mode ;; "Favorite") favourite_mode ;; + "Share and favorite") share_and_favorite_mode ;; "Thread") thread_open ;; esac done @@ -415,12 +416,13 @@ thread_menu() ids_massive=$(echo $jsonthread | jj -l \#.id | delq) jsonmassive=$jsonthread statuses_render - menuthread=$(echo 'Back\nReply\nShare\nFavorite' | fzy) + menuthread=$(echo 'Back\nReply\nShare\nFavorite\nShare and favorite' | fzy) case "$menuthread" in "Back") sub_menu_lvl=1 ;; "Reply") reply_mode ;; "Share") share_mode ;; "Favorite") favourite_mode ;; + "Share and favorite") share_and_favorite_mode ;; esac done } @@ -439,7 +441,7 @@ timeline_menu() ids_massive=$(echo $json | jj -l \#.id | delq) jsonmassive=$json statuses_render - menu=$(echo 'Prev\nNext\nReply\nShare\nFavorite\nThread\nMain menu' | fzy) + menu=$(echo 'Prev\nNext\nReply\nShare\nFavorite\nShare and favorite\nThread\nMain menu' | fzy) case $menu in "Prev") indexator=$(expr $max_statuses - 1) @@ -457,6 +459,7 @@ timeline_menu() "Reply") reply_mode ;; "Share") share_mode ;; "Favorite") favourite_mode ;; + "Share and favorite") share_and_favorite_mode ;; "Thread") thread_open ;; "Main menu") sub_menu_lvl=0 ;; esac @@ -473,6 +476,23 @@ reply_mode() write_status_menu $status_id } +share_and_favorite_mode() +{ + echo 'Input id (s - stop)' + shareandfavmode=1 + while [ $shareandfavmode -eq 1 ]; do + read status_id + if [ "$status_id" = 's' ]; then + shareandfavmode=0 + else + share_api_status $status_id + echo $http_code + favorite_api_status $status_id + echo $http_code + fi + done +} + share_api_status() { post_request -w "%{http_code}" --url $instance_point/statuses/$1/reblog --output /dev/null