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..6c19a422d 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('') @@ -1363,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, @@ -2324,6 +2330,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/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-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%; } 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/pgp.py b/pgp.py index 9b18c8cc3..81720f3a3 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 = pgpLocalPublicKey() + if keyId: + return True return False @@ -421,12 +423,12 @@ def _pgpLocalPublicKeyId() -> str: return result.decode('utf-8').replace('"', '').strip() -def _pgpLocalPublicKey() -> str: +def pgpLocalPublicKey() -> str: """Gets the local pgp public key """ keyId = _pgpLocalPublicKeyId() if not keyId: - return None + keyId = '' cmdStr = "gpg --armor --export " + keyId proc = subprocess.Popen([cmdStr], stdout=subprocess.PIPE, shell=True) @@ -455,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() diff --git a/theme/light/theme.json b/theme/light/theme.json index 5533d3e65..f74baaf99 100644 --- a/theme/light/theme.json +++ b/theme/light/theme.json @@ -1,4 +1,6 @@ { + "avatar-rounding": "50%", + "icon-brightness-change": "80%", "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",