Added quoting reply mode; change write status menu behaviour

This commit is contained in:
localhost_frssoft 2022-04-15 10:53:57 +03:00
parent 49119c1d64
commit e928d6f23a
2 changed files with 15 additions and 4 deletions

View file

@ -6,6 +6,7 @@
"format_time": "+%d.%m.%Y %H:%M:%S", "format_time": "+%d.%m.%Y %H:%M:%S",
"boost_symbol": "[>>]", "boost_symbol": "[>>]",
"reversed_statuses": false, "reversed_statuses": false,
"quoting_reply": true,
"public_list_instances": [ "public_list_instances": [
"outerheaven.club", "outerheaven.club",
"stereophonic.space", "stereophonic.space",

View file

@ -11,6 +11,7 @@ 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)
reversed_statuses=$(jj -i config.json reversed_statuses) reversed_statuses=$(jj -i config.json reversed_statuses)
quoting_reply=$(jj -i config.json quoting_reply)
#[AUTH SECTION] #[AUTH SECTION]
mkdir -m 711 -p .app_sessions mkdir -m 711 -p .app_sessions
@ -301,7 +302,12 @@ delqse()
statuses_api_account() statuses_api_account()
{ {
default_curl_opt "accounts/$1/statuses?limit=$max_statuses" default_curl_opt "$instance_point/accounts/$1/statuses?limit=$max_statuses"
}
status_api_one()
{
default_curl_opt "$instance_point/statuses/$1"
} }
statuses_render() statuses_render()
@ -395,8 +401,11 @@ timeline_menu()
"Reply") "Reply")
echo 'Input id' echo 'Input id'
read status_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 write_status_menu $status_id
indexator=$(expr $max_statuses - 1)
;; ;;
"Share") "Share")
echo 'Input id (s - stop)' echo 'Input id (s - stop)'
@ -507,9 +516,9 @@ write_status_menu()
if [ -n "$http_code" ]; then if [ -n "$http_code" ]; then
echo "Send state: $http_code" echo "Send state: $http_code"
fi fi
wrirepostmenu=$(echo "Write\nSend\nAdd attach\nChange type\nVisiblity\nBack\nMain menu" | fzy) wrirepostmenu=$(echo "Edit\nSend\nAdd attach\nChange type\nVisiblity\nReset\nBack\nMain menu" | fzy)
case $wrirepostmenu in case $wrirepostmenu in
"Write") echo > tmp_status.md; $EDITOR tmp_status.md ;; "Edit") $EDITOR tmp_status.md ;;
"Send") http_code=$(write_api_status "$(cat tmp_status.md)") ;; "Send") http_code=$(write_api_status "$(cat tmp_status.md)") ;;
"Add attach") "Add attach")
echo 'Input path to attach (ex. @image.png or @/full/path/to/attach.png)' echo 'Input path to attach (ex. @image.png or @/full/path/to/attach.png)'
@ -519,6 +528,7 @@ write_status_menu()
"Visiblity") "Visiblity")
status_visibility=$(echo 'public\nunlisted\nlocal\nprivate\ndirect\nlist' | fzy) status_visibility=$(echo 'public\nunlisted\nlocal\nprivate\ndirect\nlist' | fzy)
;; ;;
"Reset") echo > tmp_status.md ;;
"Back") sub_menu_lvl=$(expr $level - 1) ;; "Back") sub_menu_lvl=$(expr $level - 1) ;;
"Main menu") sub_menu_lvl=0 ;; "Main menu") sub_menu_lvl=0 ;;
esac esac