Merge branch 'main' of ssh://code.freedombone.net:2222/bashrc/epicyon

main
Bob Mottram 2021-05-05 14:56:48 +01:00
commit 45567531e4
10 changed files with 46 additions and 16 deletions

View File

@ -478,6 +478,7 @@ following [page number] Show accounts that you are following
followers [page number] Show accounts that are following you followers [page number] Show accounts that are following you
approve [handle] Approve a follow request approve [handle] Approve a follow request
deny [handle] Deny 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. 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.

View File

@ -45,6 +45,7 @@ from posts import c2sBoxJson
from posts import downloadAnnounce from posts import downloadAnnounce
from announce import sendAnnounceViaServer from announce import sendAnnounceViaServer
from announce import sendUndoAnnounceViaServer from announce import sendUndoAnnounceViaServer
from pgp import pgpLocalPublicKey
from pgp import pgpDecrypt from pgp import pgpDecrypt
from pgp import hasLocalPGPkey from pgp import hasLocalPGPkey
from pgp import pgpEncryptToActor from pgp import pgpEncryptToActor
@ -124,6 +125,8 @@ def _desktopHelp() -> None:
'Approve a follow request') 'Approve a follow request')
print(indent + 'deny [handle] ' + print(indent + 'deny [handle] ' +
'Deny a follow request') 'Deny a follow request')
print(indent + 'pgp ' +
'Show your PGP public key')
print('') print('')
@ -1363,6 +1366,9 @@ def runDesktopClient(baseDir: str, proxyType: str, httpPrefix: str,
desktopShown = False desktopShown = False
while (1): while (1):
if not pgpKeyUpload: if not pgpKeyUpload:
if not hasLocalPGPkey():
print('No PGP public key was found')
else:
sayStr = indent + 'Uploading PGP public key' sayStr = indent + 'Uploading PGP public key'
_sayCommand(sayStr, sayStr, screenreader, _sayCommand(sayStr, sayStr, screenreader,
systemLanguage, espeak) systemLanguage, espeak)
@ -2324,6 +2330,12 @@ def runDesktopClient(baseDir: str, proxyType: str, httpPrefix: str,
_sayCommand(sayStr, sayStr, originalScreenReader, _sayCommand(sayStr, sayStr, originalScreenReader,
systemLanguage, espeak) systemLanguage, espeak)
print('') 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'): elif commandStr.startswith('h'):
_desktopHelp() _desktopHelp()
sayStr = 'Press Enter to continue...' sayStr = 'Press Enter to continue...'

View File

@ -1,6 +1,7 @@
@charset "UTF-8"; @charset "UTF-8";
:root { :root {
--avatar-rounding: 10%;
--main-bg-color: #282c37; --main-bg-color: #282c37;
--link-bg-color: #282c37; --link-bg-color: #282c37;
--title-color: #999; --title-color: #999;
@ -795,6 +796,7 @@ div.gallery img {
padding: 0px 0px; padding: 0px 0px;
-ms-transform: translateY(-10%); -ms-transform: translateY(-10%);
transform: translateY(-10%); transform: translateY(-10%);
border-radius: var(--avatar-rounding);
} }
.cwButton { .cwButton {
border-radius: var(--button-corner-radius); border-radius: var(--button-corner-radius);
@ -1150,6 +1152,7 @@ div.gallery img {
padding: 0px 0px; padding: 0px 0px;
-ms-transform: translateY(-10%); -ms-transform: translateY(-10%);
transform: translateY(-10%); transform: translateY(-10%);
border-radius: var(--avatar-rounding);
} }
.cwButton { .cwButton {
border-radius: var(--button-corner-radius); border-radius: var(--button-corner-radius);

View File

@ -1,6 +1,7 @@
@charset "UTF-8"; @charset "UTF-8";
:root { :root {
--avatar-rounding: 10%;
--main-bg-color: #282c37; --main-bg-color: #282c37;
--link-bg-color: #282c37; --link-bg-color: #282c37;
--dropdown-fg-color: #dddddd; --dropdown-fg-color: #dddddd;
@ -1052,6 +1053,7 @@ aside .toggle-inside li {
padding: 0px 0px; padding: 0px 0px;
-ms-transform: translateY(-10%); -ms-transform: translateY(-10%);
transform: translateY(-10%); transform: translateY(-10%);
border-radius: var(--avatar-rounding);
} }
.buttonevent { .buttonevent {
border-radius: var(--button-corner-radius); border-radius: var(--button-corner-radius);
@ -1522,6 +1524,7 @@ aside .toggle-inside li {
padding: 0px 0px; padding: 0px 0px;
-ms-transform: translateY(-10%); -ms-transform: translateY(-10%);
transform: translateY(-10%); transform: translateY(-10%);
border-radius: var(--avatar-rounding);
} }
.buttonevent { .buttonevent {
border-radius: var(--button-corner-radius); border-radius: var(--button-corner-radius);

View File

@ -1,6 +1,7 @@
@charset "UTF-8"; @charset "UTF-8";
:root { :root {
--avatar-rounding: 10%;
--options-bg-color: #282c37; --options-bg-color: #282c37;
--options-link-bg-color: transparent; --options-link-bg-color: transparent;
--options-fg-color: #dddddd; --options-fg-color: #dddddd;
@ -144,6 +145,7 @@ a:focus {
} }
.options img { .options img {
border-radius: var(--avatar-rounding);
background-color: var(--options-bg-color); background-color: var(--options-bg-color);
width: 15%; width: 15%;
} }

View File

@ -1,6 +1,7 @@
@charset "UTF-8"; @charset "UTF-8";
:root { :root {
--avatar-rounding: 10%;
--timeline-icon-width: 50px; --timeline-icon-width: 50px;
--timeline-icon-width-mobile: 100px; --timeline-icon-width-mobile: 100px;
--header-bg-color: #282c37; --header-bg-color: #282c37;
@ -341,7 +342,7 @@ a:focus {
} }
.profileHeader .title { .profileHeader .title {
border-radius: 10%; border-radius: var(--avatar-rounding);
position: absolute; position: absolute;
bottom: 100%; bottom: 100%;
left: 25px; left: 25px;
@ -1332,6 +1333,7 @@ div.container {
padding: 0px 0px; padding: 0px 0px;
-ms-transform: translateY(-10%); -ms-transform: translateY(-10%);
transform: translateY(-10%); transform: translateY(-10%);
border-radius: var(--avatar-rounding);
} }
.buttonevent { .buttonevent {
border-radius: var(--button-event-corner-radius); border-radius: var(--button-event-corner-radius);
@ -1975,6 +1977,7 @@ div.container {
padding: 0px 0px; padding: 0px 0px;
-ms-transform: translateY(-10%); -ms-transform: translateY(-10%);
transform: translateY(-10%); transform: translateY(-10%);
border-radius: var(--avatar-rounding);
} }
.buttonevent { .buttonevent {
border-radius: var(--button-event-corner-radius); border-radius: var(--button-event-corner-radius);

8
pgp.py
View File

@ -362,6 +362,8 @@ def hasLocalPGPkey() -> bool:
homeDir = str(Path.home()) homeDir = str(Path.home())
gpgDir = homeDir + '/.gnupg' gpgDir = homeDir + '/.gnupg'
if os.path.isdir(gpgDir): if os.path.isdir(gpgDir):
keyId = pgpLocalPublicKey()
if keyId:
return True return True
return False return False
@ -421,12 +423,12 @@ def _pgpLocalPublicKeyId() -> str:
return result.decode('utf-8').replace('"', '').strip() return result.decode('utf-8').replace('"', '').strip()
def _pgpLocalPublicKey() -> str: def pgpLocalPublicKey() -> str:
"""Gets the local pgp public key """Gets the local pgp public key
""" """
keyId = _pgpLocalPublicKeyId() keyId = _pgpLocalPublicKeyId()
if not keyId: if not keyId:
return None keyId = ''
cmdStr = "gpg --armor --export " + keyId cmdStr = "gpg --armor --export " + keyId
proc = subprocess.Popen([cmdStr], proc = subprocess.Popen([cmdStr],
stdout=subprocess.PIPE, shell=True) stdout=subprocess.PIPE, shell=True)
@ -455,7 +457,7 @@ def pgpPublicKeyUpload(baseDir: str, session,
if not test: if not test:
if debug: if debug:
print('Getting PGP public key') print('Getting PGP public key')
PGPpubKey = _pgpLocalPublicKey() PGPpubKey = pgpLocalPublicKey()
if not PGPpubKey: if not PGPpubKey:
return None return None
PGPpubKeyId = _pgpLocalPublicKeyId() PGPpubKeyId = _pgpLocalPublicKeyId()

View File

@ -1,4 +1,6 @@
{ {
"avatar-rounding": "50%",
"icon-brightness-change": "80%",
"button-selected": "#999", "button-selected": "#999",
"button-background": "#bbbbbb", "button-background": "#bbbbbb",
"button-background-hover": "#999", "button-background-hover": "#999",

View File

@ -1,4 +1,5 @@
{ {
"avatar-rounding": "50%",
"newswire-publish-icon": "True", "newswire-publish-icon": "True",
"full-width-timeline-buttons": "False", "full-width-timeline-buttons": "False",
"icons-as-buttons": "False", "icons-as-buttons": "False",

View File

@ -1,4 +1,5 @@
{ {
"avatar-rounding": "50%",
"dropdown-bg-color-hover": "#463b35", "dropdown-bg-color-hover": "#463b35",
"cw-color": "#d5c7b7", "cw-color": "#d5c7b7",
"main-fg-color": "#d5c7b7", "main-fg-color": "#d5c7b7",