From fee2d0b47e206022841372617631ca403458e3d3 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 5 May 2021 10:31:35 +0100 Subject: [PATCH 1/7] Check that local gpg key exists --- pgp.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pgp.py b/pgp.py index 9b18c8cc3..19a1d0f42 100644 --- a/pgp.py +++ b/pgp.py @@ -362,7 +362,9 @@ def hasLocalPGPkey() -> bool: homeDir = str(Path.home()) gpgDir = homeDir + '/.gnupg' if os.path.isdir(gpgDir): - return True + keyId = _pgpLocalPublicKeyId() + if keyId: + return True return False From 8415c7d3f2aac53a78aac5980db69caf10c3ff19 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 5 May 2021 10:53:00 +0100 Subject: [PATCH 2/7] Show pgp public key --- README_commandline.md | 1 + desktop_client.py | 9 +++++++++ pgp.py | 4 ++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/README_commandline.md b/README_commandline.md index a01428ca0..f4a175c05 100644 --- a/README_commandline.md +++ b/README_commandline.md @@ -478,6 +478,7 @@ following [page number] Show accounts that you are following followers [page number] Show accounts that are following you approve [handle] Approve a follow request deny [handle] Deny a follow request +pgp Show your PGP public key ``` If you have a GPG key configured on your local system and are sending a direct message to someone who has a PGP key (the exported key, not just the key ID) set as a tag on their profile then it will try to encrypt the message automatically. So under some conditions end-to-end encryption is possible, such that the instance server only sees ciphertext. Conversely, for arriving direct messages if they are PGP encrypted then the desktop client will try to obtain the relevant public key and decrypt. diff --git a/desktop_client.py b/desktop_client.py index 4d3f94ae4..ebc3730f2 100644 --- a/desktop_client.py +++ b/desktop_client.py @@ -45,6 +45,7 @@ from posts import c2sBoxJson from posts import downloadAnnounce from announce import sendAnnounceViaServer from announce import sendUndoAnnounceViaServer +from pgp import pgpLocalPublicKey from pgp import pgpDecrypt from pgp import hasLocalPGPkey from pgp import pgpEncryptToActor @@ -124,6 +125,8 @@ def _desktopHelp() -> None: 'Approve a follow request') print(indent + 'deny [handle] ' + 'Deny a follow request') + print(indent + 'pgp ' + + 'Show your PGP public key') print('') @@ -2324,6 +2327,12 @@ def runDesktopClient(baseDir: str, proxyType: str, httpPrefix: str, _sayCommand(sayStr, sayStr, originalScreenReader, systemLanguage, espeak) print('') + elif commandStr.startswith('pgp') or commandStr.startswith('gpg'): + if not hasLocalPGPkey(): + print('No PGP public key was found') + else: + print(pgpLocalPublicKey()) + print('') elif commandStr.startswith('h'): _desktopHelp() sayStr = 'Press Enter to continue...' diff --git a/pgp.py b/pgp.py index 19a1d0f42..37444c126 100644 --- a/pgp.py +++ b/pgp.py @@ -423,7 +423,7 @@ def _pgpLocalPublicKeyId() -> str: return result.decode('utf-8').replace('"', '').strip() -def _pgpLocalPublicKey() -> str: +def pgpLocalPublicKey() -> str: """Gets the local pgp public key """ keyId = _pgpLocalPublicKeyId() @@ -457,7 +457,7 @@ def pgpPublicKeyUpload(baseDir: str, session, if not test: if debug: print('Getting PGP public key') - PGPpubKey = _pgpLocalPublicKey() + PGPpubKey = pgpLocalPublicKey() if not PGPpubKey: return None PGPpubKeyId = _pgpLocalPublicKeyId() From 61d650c6f7cef10c9b8f185db9ecd2be13c69508 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 5 May 2021 10:57:29 +0100 Subject: [PATCH 3/7] Check for public key --- desktop_client.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/desktop_client.py b/desktop_client.py index ebc3730f2..6c19a422d 100644 --- a/desktop_client.py +++ b/desktop_client.py @@ -1366,17 +1366,20 @@ def runDesktopClient(baseDir: str, proxyType: str, httpPrefix: str, desktopShown = False while (1): if not pgpKeyUpload: - sayStr = indent + 'Uploading PGP public key' - _sayCommand(sayStr, sayStr, screenreader, - systemLanguage, espeak) - pgpPublicKeyUpload(baseDir, session, - nickname, password, - domain, port, httpPrefix, - cachedWebfingers, personCache, - debug, False) - sayStr = indent + 'PGP public key uploaded' - _sayCommand(sayStr, sayStr, screenreader, - systemLanguage, espeak) + if not hasLocalPGPkey(): + print('No PGP public key was found') + else: + sayStr = indent + 'Uploading PGP public key' + _sayCommand(sayStr, sayStr, screenreader, + systemLanguage, espeak) + pgpPublicKeyUpload(baseDir, session, + nickname, password, + domain, port, httpPrefix, + cachedWebfingers, personCache, + debug, False) + sayStr = indent + 'PGP public key uploaded' + _sayCommand(sayStr, sayStr, screenreader, + systemLanguage, espeak) pgpKeyUpload = True boxJson = c2sBoxJson(baseDir, session, From 60aad9cfd245142015fa7549b81b2656a6be590d Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 5 May 2021 11:13:26 +0100 Subject: [PATCH 4/7] Get pgp public key when default keyid is unavailable --- pgp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pgp.py b/pgp.py index 37444c126..81720f3a3 100644 --- a/pgp.py +++ b/pgp.py @@ -362,7 +362,7 @@ def hasLocalPGPkey() -> bool: homeDir = str(Path.home()) gpgDir = homeDir + '/.gnupg' if os.path.isdir(gpgDir): - keyId = _pgpLocalPublicKeyId() + keyId = pgpLocalPublicKey() if keyId: return True return False @@ -428,7 +428,7 @@ def pgpLocalPublicKey() -> str: """ keyId = _pgpLocalPublicKeyId() if not keyId: - return None + keyId = '' cmdStr = "gpg --armor --export " + keyId proc = subprocess.Popen([cmdStr], stdout=subprocess.PIPE, shell=True) From 0e93c781ccc283cf46c0b8129d6da3e22b5c8e3e Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 5 May 2021 13:08:42 +0100 Subject: [PATCH 5/7] Option to have round avatars --- epicyon-blog.css | 3 +++ epicyon-links.css | 3 +++ epicyon-profile.css | 5 ++++- theme/light/theme.json | 1 + theme/night/theme.json | 1 + theme/zen/theme.json | 1 + 6 files changed, 13 insertions(+), 1 deletion(-) diff --git a/epicyon-blog.css b/epicyon-blog.css index 355ca73bd..fc790d702 100644 --- a/epicyon-blog.css +++ b/epicyon-blog.css @@ -1,6 +1,7 @@ @charset "UTF-8"; :root { + --avatar-rounding: 10%; --main-bg-color: #282c37; --link-bg-color: #282c37; --title-color: #999; @@ -795,6 +796,7 @@ div.gallery img { padding: 0px 0px; -ms-transform: translateY(-10%); transform: translateY(-10%); + border-radius: var(--avatar-rounding); } .cwButton { border-radius: var(--button-corner-radius); @@ -1150,6 +1152,7 @@ div.gallery img { padding: 0px 0px; -ms-transform: translateY(-10%); transform: translateY(-10%); + border-radius: var(--avatar-rounding); } .cwButton { border-radius: var(--button-corner-radius); diff --git a/epicyon-links.css b/epicyon-links.css index 328f1ae89..67dcdc7ef 100644 --- a/epicyon-links.css +++ b/epicyon-links.css @@ -1,6 +1,7 @@ @charset "UTF-8"; :root { + --avatar-rounding: 10%; --main-bg-color: #282c37; --link-bg-color: #282c37; --dropdown-fg-color: #dddddd; @@ -1052,6 +1053,7 @@ aside .toggle-inside li { padding: 0px 0px; -ms-transform: translateY(-10%); transform: translateY(-10%); + border-radius: var(--avatar-rounding); } .buttonevent { border-radius: var(--button-corner-radius); @@ -1522,6 +1524,7 @@ aside .toggle-inside li { padding: 0px 0px; -ms-transform: translateY(-10%); transform: translateY(-10%); + border-radius: var(--avatar-rounding); } .buttonevent { border-radius: var(--button-corner-radius); diff --git a/epicyon-profile.css b/epicyon-profile.css index 754bb0bc5..0ee6b0695 100644 --- a/epicyon-profile.css +++ b/epicyon-profile.css @@ -1,6 +1,7 @@ @charset "UTF-8"; :root { + --avatar-rounding: 10%; --timeline-icon-width: 50px; --timeline-icon-width-mobile: 100px; --header-bg-color: #282c37; @@ -341,7 +342,7 @@ a:focus { } .profileHeader .title { - border-radius: 10%; + border-radius: var(--avatar-rounding); position: absolute; bottom: 100%; left: 25px; @@ -1332,6 +1333,7 @@ div.container { padding: 0px 0px; -ms-transform: translateY(-10%); transform: translateY(-10%); + border-radius: var(--avatar-rounding); } .buttonevent { border-radius: var(--button-event-corner-radius); @@ -1975,6 +1977,7 @@ div.container { padding: 0px 0px; -ms-transform: translateY(-10%); transform: translateY(-10%); + border-radius: var(--avatar-rounding); } .buttonevent { border-radius: var(--button-event-corner-radius); diff --git a/theme/light/theme.json b/theme/light/theme.json index 5533d3e65..58abe93eb 100644 --- a/theme/light/theme.json +++ b/theme/light/theme.json @@ -1,4 +1,5 @@ { + "avatar-rounding": "50%", "button-selected": "#999", "button-background": "#bbbbbb", "button-background-hover": "#999", diff --git a/theme/night/theme.json b/theme/night/theme.json index d6001e49a..4335d43ba 100644 --- a/theme/night/theme.json +++ b/theme/night/theme.json @@ -1,4 +1,5 @@ { + "avatar-rounding": "50%", "newswire-publish-icon": "True", "full-width-timeline-buttons": "False", "icons-as-buttons": "False", diff --git a/theme/zen/theme.json b/theme/zen/theme.json index 7eb3b5d86..24892fcb7 100644 --- a/theme/zen/theme.json +++ b/theme/zen/theme.json @@ -1,4 +1,5 @@ { + "avatar-rounding": "50%", "dropdown-bg-color-hover": "#463b35", "cw-color": "#d5c7b7", "main-fg-color": "#d5c7b7", From 05e27a9033c13a36c8d79adf4df042d0cccca642 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 5 May 2021 13:17:41 +0100 Subject: [PATCH 6/7] Icons get darker --- theme/light/theme.json | 1 + 1 file changed, 1 insertion(+) diff --git a/theme/light/theme.json b/theme/light/theme.json index 58abe93eb..f74baaf99 100644 --- a/theme/light/theme.json +++ b/theme/light/theme.json @@ -1,5 +1,6 @@ { "avatar-rounding": "50%", + "icon-brightness-change": "80%", "button-selected": "#999", "button-background": "#bbbbbb", "button-background-hover": "#999", From 984158e91641fcc1a88c8bee53e7c9c0ba102eeb Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 5 May 2021 13:51:16 +0100 Subject: [PATCH 7/7] Rounded avatar on options screen --- epicyon-options.css | 2 ++ 1 file changed, 2 insertions(+) diff --git a/epicyon-options.css b/epicyon-options.css index 49d7b8911..daaee8700 100644 --- a/epicyon-options.css +++ b/epicyon-options.css @@ -1,6 +1,7 @@ @charset "UTF-8"; :root { + --avatar-rounding: 10%; --options-bg-color: #282c37; --options-link-bg-color: transparent; --options-fg-color: #dddddd; @@ -144,6 +145,7 @@ a:focus { } .options img { + border-radius: var(--avatar-rounding); background-color: var(--options-bg-color); width: 15%; }