From c34aa81962d2916decfd698524458d6c4c98590a Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 6 Jul 2020 11:14:41 +0100 Subject: [PATCH] PGP fingerprint in profile --- daemon.py | 18 +++++++++++++++++- translations/ar.json | 1 + translations/ca.json | 1 + translations/cy.json | 1 + translations/de.json | 1 + translations/en.json | 3 ++- translations/es.json | 1 + translations/fr.json | 1 + translations/ga.json | 1 + translations/hi.json | 3 ++- translations/it.json | 1 + translations/ja.json | 1 + translations/oc.json | 1 + translations/pt.json | 1 + translations/ru.json | 1 + translations/zh.json | 1 + webinterface.py | 21 ++++++++++++++++++++- 17 files changed, 54 insertions(+), 4 deletions(-) diff --git a/daemon.py b/daemon.py index df1dd3ba..53a9ae6a 100644 --- a/daemon.py +++ b/daemon.py @@ -30,7 +30,9 @@ from metadata import metaDataNodeInfo from pgp import getEmailAddress from pgp import setEmailAddress from pgp import getPGPpubKey +from pgp import getPGPfingerprint from pgp import setPGPpubKey +from pgp import setPGPfingerprint from xmpp import getXmppAddress from xmpp import setXmppAddress from ssb import getSSBAddress @@ -1549,6 +1551,7 @@ class PubServer(BaseHTTPRequestHandler): optionsLink = optionsList[3] donateUrl = None PGPpubKey = None + PGPfingerprint = None xmppAddress = None matrixAddress = None blogAddress = None @@ -1567,6 +1570,7 @@ class PubServer(BaseHTTPRequestHandler): toxAddress = getToxAddress(actorJson) emailAddress = getEmailAddress(actorJson) PGPpubKey = getPGPpubKey(actorJson) + PGPfingerprint = getPGPfingerprint(actorJson) msg = htmlPersonOptions(self.server.translate, self.server.baseDir, self.server.domain, @@ -1577,7 +1581,8 @@ class PubServer(BaseHTTPRequestHandler): pageNumber, donateUrl, xmppAddress, matrixAddress, ssbAddress, blogAddress, - toxAddress, PGPpubKey, + toxAddress, + PGPpubKey, PGPfingerprint, emailAddress).encode('utf-8') self._set_headers('text/html', len(msg), cookie, callingDomain) @@ -6242,6 +6247,17 @@ class PubServer(BaseHTTPRequestHandler): setPGPpubKey(actorJson, '') actorChanged = True + currentPGPfingerprint = getPGPfingerprint(actorJson) + if fields.get('openpgp'): + if fields['openpgp'] != currentPGPfingerprint: + setPGPfingerprint(actorJson, + fields['openpgp']) + actorChanged = True + else: + if currentPGPfingerprint: + setPGPfingerprint(actorJson, '') + actorChanged = True + currentDonateUrl = getDonationUrl(actorJson) if fields.get('donateUrl'): if fields['donateUrl'] != currentDonateUrl: diff --git a/translations/ar.json b/translations/ar.json index 60bc5a4e..54d95f0f 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -206,6 +206,7 @@ "Matrix": "Matrix", "Email": "البريد الإلكتروني", "PGP": "PGP", + "PGP Fingerprint": "بصمة PGP", "This is a scheduled post.": "هذا هو المقرر المقرر.", "Remove scheduled posts": "إزالة المشاركات المجدولة", "Remove Twitter posts": "إزالة مشاركات Twitter", diff --git a/translations/ca.json b/translations/ca.json index 844521d3..dd8dda94 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -206,6 +206,7 @@ "Matrix": "Matrix", "Email": "Correu electrònic", "PGP": "PGP", + "PGP Fingerprint": "Empremta digital PGP", "This is a scheduled post.": "Aquesta és una publicació programada.", "Remove scheduled posts": "Elimineu les publicacions programades", "Remove Twitter posts": "Elimina les publicacions de Twitter", diff --git a/translations/cy.json b/translations/cy.json index f7536e90..cdf3f64e 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -206,6 +206,7 @@ "Matrix": "Matrix", "Email": "E-bost", "PGP": "PGP", + "PGP Fingerprint": "Olion Bysedd PGP", "This is a scheduled post.": "Mae hon yn swydd wedi'i hamserlennu.", "Remove scheduled posts": "Tynnwch y swyddi a drefnwyd", "Remove Twitter posts": "Dileu postiadau Twitter", diff --git a/translations/de.json b/translations/de.json index f784ebbf..846c781a 100644 --- a/translations/de.json +++ b/translations/de.json @@ -206,6 +206,7 @@ "Matrix": "Matrix", "Email": "Email", "PGP": "PGP", + "PGP Fingerprint": "PGP Fingerabdruck", "This is a scheduled post.": "Dies ist ein geplanter Beitrag.", "Remove scheduled posts": "Geplante Posts entfernen", "Remove Twitter posts": "Entfernen Sie Twitter-Posts", diff --git a/translations/en.json b/translations/en.json index e11d6ade..a8f3c2f7 100644 --- a/translations/en.json +++ b/translations/en.json @@ -205,7 +205,8 @@ "XMPP": "XMPP", "Matrix": "Matrix", "Email": "Email", - "PGP": "PGP", + "PGP": "PGP Key", + "PGP Fingerprint": "PGP Fingerprint", "This is a scheduled post.": "This is a scheduled post.", "Remove scheduled posts": "Remove scheduled posts", "Remove Twitter posts": "Remove Twitter posts", diff --git a/translations/es.json b/translations/es.json index dc580101..d3c74ace 100644 --- a/translations/es.json +++ b/translations/es.json @@ -206,6 +206,7 @@ "Matrix": "Matrix", "Email": "Email", "PGP": "PGP", + "PGP Fingerprint": "Huella digital PGP", "This is a scheduled post.": "Esta es una publicación programada.", "Remove scheduled posts": "Eliminar publicaciones programadas", "Remove Twitter posts": "Eliminar publicaciones de Twitter", diff --git a/translations/fr.json b/translations/fr.json index a9cbcb8a..1ce7efc3 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -206,6 +206,7 @@ "Matrix": "Matrix", "Email": "Email", "PGP": "PGP", + "PGP Fingerprint": "Empreinte digitale PGP", "This is a scheduled post.": "Il s'agit d'un article programmé.", "Remove scheduled posts": "Supprimer les messages planifiés", "Remove Twitter posts": "Supprimer les messages Twitter", diff --git a/translations/ga.json b/translations/ga.json index 603202d8..d8073b3a 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -206,6 +206,7 @@ "Matrix": "Matrix", "Email": "Ríomhphost", "PGP": "PGP", + "PGP Fingerprint": "Méarlorg PGP", "This is a scheduled post.": "Is post sceidealta é seo.", "Remove scheduled posts": "Bain na poist sceidealta", "Remove Twitter posts": "Bain poist Twitter", diff --git a/translations/hi.json b/translations/hi.json index 9f02c144..d28e0768 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -205,7 +205,8 @@ "XMPP": "XMPP", "Matrix": "Matrix", "Email": "ईमेल", - "PGP": "PGP", + "PGP": "पीजीपी", + "PGP Fingerprint": "पीजीपी फिंगरप्रिंट", "This is a scheduled post.": "यह एक अनुसूचित पद है।", "Remove scheduled posts": "अनुसूचित पदों को हटा दें", "Remove Twitter posts": "ट्विटर पोस्ट हटाएं", diff --git a/translations/it.json b/translations/it.json index 3fe48c28..92a91a40 100644 --- a/translations/it.json +++ b/translations/it.json @@ -206,6 +206,7 @@ "Matrix": "Matrix", "Email": "E-mail", "PGP": "PGP", + "PGP Fingerprint": "Impronta digitale PGP", "This is a scheduled post.": "Questo è un post programmato", "Remove scheduled posts": "Rimuovi i post programmati", "Remove Twitter posts": "Rimuovi i post di Twitter", diff --git a/translations/ja.json b/translations/ja.json index f3e6d6bb..d7bb800b 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -206,6 +206,7 @@ "Matrix": "Matrix", "Email": "Eメール", "PGP": "PGP", + "PGP Fingerprint": "PGPフィンガープリント", "This is a scheduled post.": "これはスケジュールされた投稿です。", "Remove scheduled posts": "スケジュールされた投稿を削除する", "Remove Twitter posts": "Twitterの投稿を削除する", diff --git a/translations/oc.json b/translations/oc.json index ba8b1c55..cb288851 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -202,6 +202,7 @@ "Matrix": "Matrix", "Email": "Email", "PGP": "PGP", + "PGP Fingerprint": "PGP Fingerprint", "This is a scheduled post.": "This is a scheduled post.", "Remove scheduled posts": "Remove scheduled posts", "Remove Twitter posts": "Remove Twitter posts", diff --git a/translations/pt.json b/translations/pt.json index 2f9c5b5e..ccbc94dd 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -206,6 +206,7 @@ "Matrix": "Matrix", "Email": "Email", "PGP": "PGP", + "PGP Fingerprint": "Impressão digital PGP", "This is a scheduled post.": "Esta é uma postagem agendada.", "Remove scheduled posts": "Remover postagens agendadas", "Remove Twitter posts": "Remover postagens do Twitter", diff --git a/translations/ru.json b/translations/ru.json index 290f301f..616e621e 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -206,6 +206,7 @@ "Matrix": "Matrix", "Email": "Эл. адрес", "PGP": "PGP", + "PGP Fingerprint": "PGP Отпечаток пальца", "This is a scheduled post.": "Это запланированный пост.", "Remove scheduled posts": "Удалить запланированные сообщения", "Remove Twitter posts": "Удалить сообщения из Твиттера", diff --git a/translations/zh.json b/translations/zh.json index bd0ba1eb..c378bd5b 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -205,6 +205,7 @@ "Matrix": "Matrix", "Email": "电子邮件", "PGP": "PGP", + "PGP Fingerprint": "PGP指纹", "This is a scheduled post.": "这是预定的帖子。", "Remove scheduled posts": "删除预定的帖子", "Remove Twitter posts": "删除Twitter帖子", diff --git a/webinterface.py b/webinterface.py index 95604f7e..a8f7521a 100644 --- a/webinterface.py +++ b/webinterface.py @@ -19,6 +19,7 @@ from person import personBoxJson from person import isPersonSnoozed from pgp import getEmailAddress from pgp import getPGPpubKey +from pgp import getPGPfingerprint from xmpp import getXmppAddress from ssb import getSSBAddress from tox import getToxAddress @@ -1050,6 +1051,7 @@ def htmlEditProfile(translate: {}, baseDir: str, path: str, donateUrl = '' emailAddress = '' PGPpubKey = '' + PGPfingerprint = '' xmppAddress = '' matrixAddress = '' ssbAddress = '' @@ -1066,6 +1068,7 @@ def htmlEditProfile(translate: {}, baseDir: str, path: str, toxAddress = getToxAddress(actorJson) emailAddress = getEmailAddress(actorJson) PGPpubKey = getPGPpubKey(actorJson) + PGPfingerprint = getPGPfingerprint(actorJson) if actorJson.get('name'): displayNickname = actorJson['name'] if actorJson.get('summary'): @@ -1331,6 +1334,12 @@ def htmlEditProfile(translate: {}, baseDir: str, path: str, translate['Email'] + '
' editProfileForm += \ ' ' + editProfileForm += \ + '
' + editProfileForm += \ + ' ' editProfileForm += \ '
' editProfileForm += \ @@ -2550,13 +2559,15 @@ def htmlProfile(defaultTimeline: str, donateSection = '' donateUrl = getDonationUrl(profileJson) PGPpubKey = getPGPpubKey(profileJson) + PGPfingerprint = getPGPfingerprint(profileJson) emailAddress = getEmailAddress(profileJson) xmppAddress = getXmppAddress(profileJson) matrixAddress = getMatrixAddress(profileJson) ssbAddress = getSSBAddress(profileJson) toxAddress = getToxAddress(profileJson) if donateUrl or xmppAddress or matrixAddress or \ - ssbAddress or toxAddress or PGPpubKey or emailAddress: + ssbAddress or toxAddress or PGPpubKey or \ + PGPfingerprint or emailAddress: donateSection = '
\n' donateSection += '
\n' if donateUrl: @@ -2583,6 +2594,10 @@ def htmlProfile(defaultTimeline: str, donateSection += \ '

Tox:

\n' + if PGPfingerprint: + donateSection += \ + '

PGP: ' + \ + PGPfingerprint.replace('\n', '
') + '

\n' if PGPpubKey: donateSection += \ '

' + PGPpubKey.replace('\n', '
') + '

\n' @@ -5314,6 +5329,7 @@ def htmlPersonOptions(translate: {}, baseDir: str, blogAddress: str, toxAddress: str, PGPpubKey: str, + PGPfingerprint: str, emailAddress) -> str: """Show options for a person: view/follow/block/report """ @@ -5411,6 +5427,9 @@ def htmlPersonOptions(translate: {}, baseDir: str, if toxAddress: optionsStr += \ '

Tox: ' + toxAddress + '

' + if PGPfingerprint: + optionsStr += '

PGP: ' + \ + PGPfingerprint.replace('\n', '
') + '

' if PGPpubKey: optionsStr += '

' + \ PGPpubKey.replace('\n', '
') + '

'