mirror of
http://gitea.phreedom.club/localhost_frssoft/pleroma-cli
synced 2024-11-29 23:01:28 +00:00
Compare commits
No commits in common. "bf4e53e8adc10f1de832ab3df6c86bb4b929f53c" and "27c3bb40a3c659f3a0e29a29886a58671f3f5d35" have entirely different histories.
bf4e53e8ad
...
27c3bb40a3
|
@ -6,7 +6,6 @@
|
|||
"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": [
|
||||
|
|
153
pleroma-cli.sh
153
pleroma-cli.sh
|
@ -11,7 +11,6 @@ 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)
|
||||
|
||||
|
@ -304,7 +303,7 @@ delqse()
|
|||
|
||||
statuses_api_account()
|
||||
{
|
||||
default_curl_opt "$instance_point/accounts/$1/statuses?limit=$max_statuses&max_id=$2&min_id=$3"
|
||||
default_curl_opt "$instance_point/accounts/$1/statuses?limit=$max_statuses"
|
||||
}
|
||||
|
||||
status_api_one()
|
||||
|
@ -323,21 +322,18 @@ statuses_render()
|
|||
fi
|
||||
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)
|
||||
visibility_status=$(echo $status | jj visibility)
|
||||
echo "| $(date -d $dateutc "$format_time") $visibility_status $whoacct"
|
||||
echo "| <$id_status> $uri"
|
||||
echo "$(date -d $dateutc "$format_time") <$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
|
||||
|
@ -347,54 +343,12 @@ statuses_render()
|
|||
attachments=$(echo $status | jj -l media_attachments.#.remote_url | delq)
|
||||
if [ -n "$attachments" ]; then
|
||||
echo "#EXTINF:-1, $uri" >> attachments.m3u8
|
||||
echo '[Attachments:]'
|
||||
echo "$attachments" | tee -a attachments.m3u8
|
||||
echo "$attachments" >> attachments.m3u8
|
||||
fi
|
||||
echo "$statuses_separator"
|
||||
echo '=========='
|
||||
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
|
||||
|
@ -414,12 +368,9 @@ thread_menu()
|
|||
ids_massive=$(echo $jsonthread | jj -l \#.id | delq)
|
||||
jsonmassive=$jsonthread
|
||||
statuses_render
|
||||
menuthread=$(echo 'Back\nReply\nShare\nFavorite' | fzy)
|
||||
menuthread=$(echo 'Back' | fzy)
|
||||
case "$menuthread" in
|
||||
"Back") sub_menu_lvl=1 ;;
|
||||
"Reply") reply_mode ;;
|
||||
"Share") share_mode ;;
|
||||
"Favorite") favourite_mode ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
@ -453,65 +404,63 @@ timeline_menu()
|
|||
offset=$(jj -i preload 0.id)
|
||||
json=$(timeline_api '' $offset)
|
||||
;;
|
||||
"Reply") reply_mode ;;
|
||||
"Share") share_mode ;;
|
||||
"Favorite") favourite_mode ;;
|
||||
"Thread") thread_open ;;
|
||||
"Main menu") sub_menu_lvl=0 ;;
|
||||
"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 ;;
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue