mirror of
http://gitea.phreedom.club/localhost_frssoft/pleroma-cli
synced 2024-11-23 00:01:26 +00:00
Compare commits
3 commits
27c3bb40a3
...
bf4e53e8ad
Author | SHA1 | Date | |
---|---|---|---|
localhost_frssoft | bf4e53e8ad | ||
localhost_frssoft | 34439334f1 | ||
localhost_frssoft | 098669af16 |
|
@ -6,6 +6,7 @@
|
|||
"default_visibility": "unlisted",
|
||||
"format_time": "+%d.%m.%Y %H:%M:%S",
|
||||
"boost_symbol": "[>>]",
|
||||
"statuses_separator": "\n==========",
|
||||
"reversed_statuses": false,
|
||||
"quoting_reply": true,
|
||||
"public_list_instances": [
|
||||
|
|
117
pleroma-cli.sh
117
pleroma-cli.sh
|
@ -11,6 +11,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)
|
||||
statuses_separator=$(jj -i config.json statuses_separator)
|
||||
reversed_statuses=$(jj -i config.json reversed_statuses)
|
||||
quoting_reply=$(jj -i config.json quoting_reply)
|
||||
|
||||
|
@ -303,7 +304,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()
|
||||
|
@ -323,17 +324,20 @@ statuses_render()
|
|||
for i in $ids_massive; do
|
||||
status=$(echo "$jsonmassive" | jj "#[id=$i]")
|
||||
|
||||
whoacct=$(echo $status | jj account.acct)
|
||||
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"
|
||||
visibility_status=$(echo $status | jj visibility)
|
||||
echo "| $(date -d $dateutc "$format_time") $visibility_status $whoacct"
|
||||
echo "| <$id_status> $uri"
|
||||
if [ -n "$reply_to_id" ]; then
|
||||
echo "Reply to: $reply_to_id"
|
||||
echo "| Reply to: $reply_to_id"
|
||||
fi
|
||||
if [ -n "$reblog" ]; then
|
||||
echo "$boost_symbol $reblog"
|
||||
echo "| $boost_symbol $reblog"
|
||||
fi
|
||||
spoiler_text=$(echo "$status" | jj spoiler_text)
|
||||
if [ -n "$spoiler_text" ]; then
|
||||
|
@ -343,12 +347,54 @@ statuses_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
|
||||
echo '[Attachments:]'
|
||||
echo "$attachments" | tee -a attachments.m3u8
|
||||
fi
|
||||
echo '=========='
|
||||
echo "$statuses_separator"
|
||||
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 +414,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,16 +453,32 @@ timeline_menu()
|
|||
offset=$(jj -i preload 0.id)
|
||||
json=$(timeline_api '' $offset)
|
||||
;;
|
||||
"Reply")
|
||||
"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")
|
||||
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
|
||||
|
@ -425,8 +490,15 @@ timeline_menu()
|
|||
echo $http_code
|
||||
fi
|
||||
done
|
||||
;;
|
||||
"Favorite")
|
||||
}
|
||||
|
||||
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
|
||||
|
@ -438,27 +510,6 @@ timeline_menu()
|
|||
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 ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
share_api_status()
|
||||
{
|
||||
post_request -w "%{http_code}" --url $instance_point/statuses/$1/reblog --output /dev/null
|
||||
}
|
||||
|
||||
favorite_api_status()
|
||||
{
|
||||
post_request -w "%{http_code}" --url $instance_point/statuses/$1/favourite --output /dev/null
|
||||
}
|
||||
|
||||
write_api_status()
|
||||
|
|
Loading…
Reference in a new issue