mirror of
http://gitea.phreedom.club/localhost_frssoft/pleroma-cli
synced 2024-11-23 03:01:27 +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",
|
"default_visibility": "unlisted",
|
||||||
"format_time": "+%d.%m.%Y %H:%M:%S",
|
"format_time": "+%d.%m.%Y %H:%M:%S",
|
||||||
"boost_symbol": "[>>]",
|
"boost_symbol": "[>>]",
|
||||||
|
"statuses_separator": "\n==========",
|
||||||
"reversed_statuses": false,
|
"reversed_statuses": false,
|
||||||
"quoting_reply": true,
|
"quoting_reply": true,
|
||||||
"public_list_instances": [
|
"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)
|
default_content_type=$(jj -i config.json default_content_type)
|
||||||
format_time=$(jj -i config.json format_time)
|
format_time=$(jj -i config.json format_time)
|
||||||
boost_symbol=$(jj -i config.json boost_symbol)
|
boost_symbol=$(jj -i config.json boost_symbol)
|
||||||
|
statuses_separator=$(jj -i config.json statuses_separator)
|
||||||
reversed_statuses=$(jj -i config.json reversed_statuses)
|
reversed_statuses=$(jj -i config.json reversed_statuses)
|
||||||
quoting_reply=$(jj -i config.json quoting_reply)
|
quoting_reply=$(jj -i config.json quoting_reply)
|
||||||
|
|
||||||
|
@ -303,7 +304,7 @@ delqse()
|
||||||
|
|
||||||
statuses_api_account()
|
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()
|
status_api_one()
|
||||||
|
@ -323,17 +324,20 @@ statuses_render()
|
||||||
for i in $ids_massive; do
|
for i in $ids_massive; do
|
||||||
status=$(echo "$jsonmassive" | jj "#[id=$i]")
|
status=$(echo "$jsonmassive" | jj "#[id=$i]")
|
||||||
|
|
||||||
|
whoacct=$(echo $status | jj account.acct)
|
||||||
reblog=$(echo $status | jj reblog.id)
|
reblog=$(echo $status | jj reblog.id)
|
||||||
uri=$(echo $status | jj uri)
|
uri=$(echo $status | jj uri)
|
||||||
id_status=$(echo $status | jj id)
|
id_status=$(echo $status | jj id)
|
||||||
dateutc=$(echo $status | jj created_at)
|
dateutc=$(echo $status | jj created_at)
|
||||||
reply_to_id=$(echo $status | jj in_reply_to_id)
|
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
|
if [ -n "$reply_to_id" ]; then
|
||||||
echo "Reply to: $reply_to_id"
|
echo "| Reply to: $reply_to_id"
|
||||||
fi
|
fi
|
||||||
if [ -n "$reblog" ]; then
|
if [ -n "$reblog" ]; then
|
||||||
echo "$boost_symbol $reblog"
|
echo "| $boost_symbol $reblog"
|
||||||
fi
|
fi
|
||||||
spoiler_text=$(echo "$status" | jj spoiler_text)
|
spoiler_text=$(echo "$status" | jj spoiler_text)
|
||||||
if [ -n "$spoiler_text" ]; then
|
if [ -n "$spoiler_text" ]; then
|
||||||
|
@ -343,12 +347,54 @@ statuses_render()
|
||||||
attachments=$(echo $status | jj -l media_attachments.#.remote_url | delq)
|
attachments=$(echo $status | jj -l media_attachments.#.remote_url | delq)
|
||||||
if [ -n "$attachments" ]; then
|
if [ -n "$attachments" ]; then
|
||||||
echo "#EXTINF:-1, $uri" >> attachments.m3u8
|
echo "#EXTINF:-1, $uri" >> attachments.m3u8
|
||||||
echo "$attachments" >> attachments.m3u8
|
echo '[Attachments:]'
|
||||||
|
echo "$attachments" | tee -a attachments.m3u8
|
||||||
fi
|
fi
|
||||||
echo '=========='
|
echo "$statuses_separator"
|
||||||
done
|
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()
|
thread_menu()
|
||||||
{
|
{
|
||||||
sub_menu_lvl=2
|
sub_menu_lvl=2
|
||||||
|
@ -368,9 +414,12 @@ thread_menu()
|
||||||
ids_massive=$(echo $jsonthread | jj -l \#.id | delq)
|
ids_massive=$(echo $jsonthread | jj -l \#.id | delq)
|
||||||
jsonmassive=$jsonthread
|
jsonmassive=$jsonthread
|
||||||
statuses_render
|
statuses_render
|
||||||
menuthread=$(echo 'Back' | fzy)
|
menuthread=$(echo 'Back\nReply\nShare\nFavorite' | fzy)
|
||||||
case "$menuthread" in
|
case "$menuthread" in
|
||||||
"Back") sub_menu_lvl=1 ;;
|
"Back") sub_menu_lvl=1 ;;
|
||||||
|
"Reply") reply_mode ;;
|
||||||
|
"Share") share_mode ;;
|
||||||
|
"Favorite") favourite_mode ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -404,16 +453,32 @@ timeline_menu()
|
||||||
offset=$(jj -i preload 0.id)
|
offset=$(jj -i preload 0.id)
|
||||||
json=$(timeline_api '' $offset)
|
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'
|
echo 'Input id'
|
||||||
read status_id
|
read status_id
|
||||||
if [ "$quoting_reply" = 'true' ]; then
|
if [ "$quoting_reply" = 'true' ]; then
|
||||||
status_api_one $status_id | jj content | html_to_txt_render | sed 's/^/> /' > tmp_status.md
|
status_api_one $status_id | jj content | html_to_txt_render | sed 's/^/> /' > tmp_status.md
|
||||||
fi
|
fi
|
||||||
write_status_menu $status_id
|
write_status_menu $status_id
|
||||||
|
}
|
||||||
|
|
||||||
;;
|
share_api_status()
|
||||||
"Share")
|
{
|
||||||
|
post_request -w "%{http_code}" --url $instance_point/statuses/$1/reblog --output /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
share_mode()
|
||||||
|
{
|
||||||
echo 'Input id (s - stop)'
|
echo 'Input id (s - stop)'
|
||||||
sharemode=1
|
sharemode=1
|
||||||
while [ $sharemode -eq 1 ]; do
|
while [ $sharemode -eq 1 ]; do
|
||||||
|
@ -425,8 +490,15 @@ timeline_menu()
|
||||||
echo $http_code
|
echo $http_code
|
||||||
fi
|
fi
|
||||||
done
|
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)'
|
echo 'Input id (s - stop)'
|
||||||
favoritemode=1
|
favoritemode=1
|
||||||
while [ $favoritemode -eq 1 ]; do
|
while [ $favoritemode -eq 1 ]; do
|
||||||
|
@ -438,27 +510,6 @@ timeline_menu()
|
||||||
echo $http_code
|
echo $http_code
|
||||||
fi
|
fi
|
||||||
done
|
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()
|
write_api_status()
|
||||||
|
|
Loading…
Reference in a new issue