mirror of
http://gitea.phreedom.club/localhost_frssoft/pleroma-cli
synced 2024-11-27 17:31:27 +00:00
Decrypt GPG messages
This commit is contained in:
parent
201025ff77
commit
713ec5b487
|
@ -27,6 +27,11 @@ Depends:
|
||||||
* [jj](http://gitea.phreedom.club/localhost_frssoft/jj)
|
* [jj](http://gitea.phreedom.club/localhost_frssoft/jj)
|
||||||
* [curl](https://curl.se/)
|
* [curl](https://curl.se/)
|
||||||
* [fzy](https://github.com/jhawthorn/fzy)
|
* [fzy](https://github.com/jhawthorn/fzy)
|
||||||
* Any browser (links set by default) - for authorization on instances
|
* Any browser (links set by default) - for authorization on instances
|
||||||
|
|
||||||
|
Opt. Depends:
|
||||||
|
* gpg - for decrypt PGP messages
|
||||||
|
* awk - parse PGP standart messages
|
||||||
|
* Any media player
|
||||||
|
|
||||||
Also, thk Tolstoevsky for Pleroma instance (set by default instance)
|
Also, thk Tolstoevsky for Pleroma instance (set by default instance)
|
||||||
|
|
|
@ -390,6 +390,11 @@ html_to_txt_render()
|
||||||
sed -e "s/<br[^>]*>/\n/g ; s/<p[^>]*>/\n/g ; s/<[^>]*>//g ; s/>*/>/g ; s/<*/</g ; s/"/\"/g ; s/'/'/g"
|
sed -e "s/<br[^>]*>/\n/g ; s/<p[^>]*>/\n/g ; s/<[^>]*>//g ; s/>*/>/g ; s/<*/</g ; s/"/\"/g ; s/'/'/g"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
find_pgp_message()
|
||||||
|
{
|
||||||
|
awk '/-----BEGIN PGP MESSAGE-----/,/-----END PGP MESSAGE----/'
|
||||||
|
}
|
||||||
|
|
||||||
delq()
|
delq()
|
||||||
{
|
{
|
||||||
sed 's/"//g'
|
sed 's/"//g'
|
||||||
|
@ -473,7 +478,12 @@ statuses_render()
|
||||||
if [ "$sensitive" = 'true' -o "$sensitive_reblog" = 'true' ]; then
|
if [ "$sensitive" = 'true' -o "$sensitive_reblog" = 'true' ]; then
|
||||||
echo '[NSFW]'
|
echo '[NSFW]'
|
||||||
fi
|
fi
|
||||||
echo "$status" | jj -r content | delqse | html_to_txt_render
|
status_content=$(echo "$status" | jj -r content | delqse | html_to_txt_render)
|
||||||
|
pgp_crypted=$(echo "$status_content" | find_pgp_message)
|
||||||
|
if [ -n "$pgp_crypted" ]; then
|
||||||
|
menu_pgp='\nDecrypt GPG'
|
||||||
|
fi
|
||||||
|
echo "$status_content"
|
||||||
attachments=$(echo "$status" | jj -l 'media_attachments.#.remote_url' | delq)
|
attachments=$(echo "$status" | jj -l 'media_attachments.#.remote_url' | delq)
|
||||||
menuattachments=
|
menuattachments=
|
||||||
if [ -n "$attachments" ]; then
|
if [ -n "$attachments" ]; then
|
||||||
|
@ -487,12 +497,13 @@ statuses_render()
|
||||||
next=0
|
next=0
|
||||||
force_stop=0
|
force_stop=0
|
||||||
while [ "$next" -eq 0 ]; do
|
while [ "$next" -eq 0 ]; do
|
||||||
per_status_menu=$(echo "Next$menuattachments\nFavorite$s_f_menu\nBookmark\nReply\nBack" | fzy)
|
per_status_menu=$(echo "Next$menuattachments"$menu_pgp"\nFavorite$s_f_menu\nBookmark\nReply\nBack" | fzy)
|
||||||
case "$per_status_menu" in
|
case "$per_status_menu" in
|
||||||
"Next")
|
"Next")
|
||||||
next=1
|
next=1
|
||||||
clear
|
clear
|
||||||
;;
|
;;
|
||||||
|
"Decrypt GPG") echo "$pgp_crypted" | gpg -d ;;
|
||||||
"Media")
|
"Media")
|
||||||
for one_media in $attachments; do
|
for one_media in $attachments; do
|
||||||
$default_media_player "$one_media"
|
$default_media_player "$one_media"
|
||||||
|
|
Loading…
Reference in a new issue