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
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.

View File

@ -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...'

View File

@ -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);

View File

@ -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);

View File

@ -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%;
}

View File

@ -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);

10
pgp.py
View File

@ -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()

View File

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

View File

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

View File

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