Decrypt GPG messages

This commit is contained in:
localhost_frssoft 2022-05-08 20:40:18 +03:00
parent 201025ff77
commit 713ec5b487
2 changed files with 19 additions and 3 deletions

View File

@ -27,6 +27,11 @@ Depends:
* [jj](http://gitea.phreedom.club/localhost_frssoft/jj)
* [curl](https://curl.se/)
* [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)

View File

@ -390,6 +390,11 @@ html_to_txt_render()
sed -e "s/<br[^>]*>/\n/g ; s/<p[^>]*>/\n/g ; s/<[^>]*>//g ; s/&gt;*/>/g ; s/&lt;*/</g ; s/&quot;/\"/g ; s/&#39;/'/g"
}
find_pgp_message()
{
awk '/-----BEGIN PGP MESSAGE-----/,/-----END PGP MESSAGE----/'
}
delq()
{
sed 's/"//g'
@ -473,7 +478,12 @@ statuses_render()
if [ "$sensitive" = 'true' -o "$sensitive_reblog" = 'true' ]; then
echo '[NSFW]'
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)
menuattachments=
if [ -n "$attachments" ]; then
@ -487,12 +497,13 @@ statuses_render()
next=0
force_stop=0
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
"Next")
next=1
clear
;;
"Decrypt GPG") echo "$pgp_crypted" | gpg -d ;;
"Media")
for one_media in $attachments; do
$default_media_player "$one_media"