diff --git a/pleroma-cli.sh b/pleroma-cli.sh index 85e8050..208bb4b 100755 --- a/pleroma-cli.sh +++ b/pleroma-cli.sh @@ -3,6 +3,8 @@ instance=$(jj -i config.json instance) alias default_auth_browser=links +export main_basedir=$(dirname $0) + proxy_init() { main_proxy=$(jj -i config.json main_proxy) @@ -437,6 +439,8 @@ statuses_render() if [ "$reversed_statuses" = 'true' ]; then ids_massive=$(echo "$ids_massive" | tr ' ' '\n' | tac | tr '\n' ' ') fi + echo "$jsonmassive" | ./utils/statuses2files.sh + ./utils/extract_text_content.sh for i in $ids_massive; do status=$(echo "$jsonmassive" | jj "#[id=$i]") reblog=$(echo "$status" | jj reblog.id) diff --git a/utils/delq b/utils/delq new file mode 100755 index 0000000..8b2e90f --- /dev/null +++ b/utils/delq @@ -0,0 +1,3 @@ +#!/bin/sh + +sed 's/"//g' diff --git a/utils/delqse b/utils/delqse new file mode 100755 index 0000000..dd2fcc4 --- /dev/null +++ b/utils/delqse @@ -0,0 +1,3 @@ +#!/bin/sh + +sed 's/^"//g; s/"$//g' diff --git a/utils/extract_text_content.sh b/utils/extract_text_content.sh new file mode 100755 index 0000000..9bae7c3 --- /dev/null +++ b/utils/extract_text_content.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# Extract some content from statuses + +for i in "$main_basedir"/statuses/*/*.json; do + content=$(jj -i $i content | "$main_basedir"/utils/html_to_txt_render) + status_id=$(jj -i $i 'id') + status_date=$(jj -i $i 'created_at') + touch -d "$status_date" "$main_basedir"/statuses/$status_id + jj -i $i content | "$main_basedir"/utils/html_to_txt_render > "$main_basedir"/statuses/$status_id/content + chmod 600 "$main_basedir"/statuses/$status_id/content +done diff --git a/utils/find_pgp_message b/utils/find_pgp_message new file mode 100755 index 0000000..bf2f149 --- /dev/null +++ b/utils/find_pgp_message @@ -0,0 +1,4 @@ +#!/bin/sh + +awk '/-----BEGIN PGP MESSAGE-----/,/-----END PGP MESSAGE----/' + diff --git a/utils/html_to_txt_render b/utils/html_to_txt_render new file mode 100755 index 0000000..aa34354 --- /dev/null +++ b/utils/html_to_txt_render @@ -0,0 +1,3 @@ +#!/bin/sh +sed -e "s/]*>/\n/g ; s/]*>/\n/g ; s/<[^>]*>//g ; s/>*/>/g ; s/<*/ "$main_basedir"/statuses/$i/$i.json + chmod 600 "$main_basedir"/statuses/$i/$i.json +done +"$main_basedir"/utils/extract_text_content.sh