mirror of
http://gitea.phreedom.club/localhost_frssoft/pleroma-cli
synced 2024-12-02 04:06:34 +00:00
Compare commits
No commits in common. "bf4e53e8adc10f1de832ab3df6c86bb4b929f53c" and "27c3bb40a3c659f3a0e29a29886a58671f3f5d35" have entirely different histories.
bf4e53e8ad
...
27c3bb40a3
|
@ -6,7 +6,6 @@
|
||||||
"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,7 +11,6 @@ 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)
|
||||||
|
|
||||||
|
@ -304,7 +303,7 @@ delqse()
|
||||||
|
|
||||||
statuses_api_account()
|
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()
|
status_api_one()
|
||||||
|
@ -324,20 +323,17 @@ 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)
|
||||||
visibility_status=$(echo $status | jj visibility)
|
echo "$(date -d $dateutc "$format_time") <$id_status> $uri"
|
||||||
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
|
||||||
|
@ -347,54 +343,12 @@ 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:]'
|
echo "$attachments" >> attachments.m3u8
|
||||||
echo "$attachments" | tee -a attachments.m3u8
|
|
||||||
fi
|
fi
|
||||||
echo "$statuses_separator"
|
echo '=========='
|
||||||
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
|
||||||
|
@ -414,12 +368,9 @@ 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\nReply\nShare\nFavorite' | fzy)
|
menuthread=$(echo 'Back' | 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
|
||||||
}
|
}
|
||||||
|
@ -453,32 +404,16 @@ timeline_menu()
|
||||||
offset=$(jj -i preload 0.id)
|
offset=$(jj -i preload 0.id)
|
||||||
json=$(timeline_api '' $offset)
|
json=$(timeline_api '' $offset)
|
||||||
;;
|
;;
|
||||||
"Reply") reply_mode ;;
|
"Reply")
|
||||||
"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
|
||||||
|
@ -490,15 +425,8 @@ share_mode()
|
||||||
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
|
||||||
|
@ -510,6 +438,27 @@ favourite_mode()
|
||||||
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