PGP fingerprint in profile

merge-requests/30/head
Bob Mottram 2020-07-06 11:14:41 +01:00
parent 6817cc8329
commit c34aa81962
17 changed files with 54 additions and 4 deletions

View File

@ -30,7 +30,9 @@ from metadata import metaDataNodeInfo
from pgp import getEmailAddress from pgp import getEmailAddress
from pgp import setEmailAddress from pgp import setEmailAddress
from pgp import getPGPpubKey from pgp import getPGPpubKey
from pgp import getPGPfingerprint
from pgp import setPGPpubKey from pgp import setPGPpubKey
from pgp import setPGPfingerprint
from xmpp import getXmppAddress from xmpp import getXmppAddress
from xmpp import setXmppAddress from xmpp import setXmppAddress
from ssb import getSSBAddress from ssb import getSSBAddress
@ -1549,6 +1551,7 @@ class PubServer(BaseHTTPRequestHandler):
optionsLink = optionsList[3] optionsLink = optionsList[3]
donateUrl = None donateUrl = None
PGPpubKey = None PGPpubKey = None
PGPfingerprint = None
xmppAddress = None xmppAddress = None
matrixAddress = None matrixAddress = None
blogAddress = None blogAddress = None
@ -1567,6 +1570,7 @@ class PubServer(BaseHTTPRequestHandler):
toxAddress = getToxAddress(actorJson) toxAddress = getToxAddress(actorJson)
emailAddress = getEmailAddress(actorJson) emailAddress = getEmailAddress(actorJson)
PGPpubKey = getPGPpubKey(actorJson) PGPpubKey = getPGPpubKey(actorJson)
PGPfingerprint = getPGPfingerprint(actorJson)
msg = htmlPersonOptions(self.server.translate, msg = htmlPersonOptions(self.server.translate,
self.server.baseDir, self.server.baseDir,
self.server.domain, self.server.domain,
@ -1577,7 +1581,8 @@ class PubServer(BaseHTTPRequestHandler):
pageNumber, donateUrl, pageNumber, donateUrl,
xmppAddress, matrixAddress, xmppAddress, matrixAddress,
ssbAddress, blogAddress, ssbAddress, blogAddress,
toxAddress, PGPpubKey, toxAddress,
PGPpubKey, PGPfingerprint,
emailAddress).encode('utf-8') emailAddress).encode('utf-8')
self._set_headers('text/html', len(msg), self._set_headers('text/html', len(msg),
cookie, callingDomain) cookie, callingDomain)
@ -6242,6 +6247,17 @@ class PubServer(BaseHTTPRequestHandler):
setPGPpubKey(actorJson, '') setPGPpubKey(actorJson, '')
actorChanged = True 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) currentDonateUrl = getDonationUrl(actorJson)
if fields.get('donateUrl'): if fields.get('donateUrl'):
if fields['donateUrl'] != currentDonateUrl: if fields['donateUrl'] != currentDonateUrl:

View File

@ -206,6 +206,7 @@
"Matrix": "Matrix", "Matrix": "Matrix",
"Email": "البريد الإلكتروني", "Email": "البريد الإلكتروني",
"PGP": "PGP", "PGP": "PGP",
"PGP Fingerprint": "بصمة PGP",
"This is a scheduled post.": "هذا هو المقرر المقرر.", "This is a scheduled post.": "هذا هو المقرر المقرر.",
"Remove scheduled posts": "إزالة المشاركات المجدولة", "Remove scheduled posts": "إزالة المشاركات المجدولة",
"Remove Twitter posts": "إزالة مشاركات Twitter", "Remove Twitter posts": "إزالة مشاركات Twitter",

View File

@ -206,6 +206,7 @@
"Matrix": "Matrix", "Matrix": "Matrix",
"Email": "Correu electrònic", "Email": "Correu electrònic",
"PGP": "PGP", "PGP": "PGP",
"PGP Fingerprint": "Empremta digital PGP",
"This is a scheduled post.": "Aquesta és una publicació programada.", "This is a scheduled post.": "Aquesta és una publicació programada.",
"Remove scheduled posts": "Elimineu les publicacions programades", "Remove scheduled posts": "Elimineu les publicacions programades",
"Remove Twitter posts": "Elimina les publicacions de Twitter", "Remove Twitter posts": "Elimina les publicacions de Twitter",

View File

@ -206,6 +206,7 @@
"Matrix": "Matrix", "Matrix": "Matrix",
"Email": "E-bost", "Email": "E-bost",
"PGP": "PGP", "PGP": "PGP",
"PGP Fingerprint": "Olion Bysedd PGP",
"This is a scheduled post.": "Mae hon yn swydd wedi'i hamserlennu.", "This is a scheduled post.": "Mae hon yn swydd wedi'i hamserlennu.",
"Remove scheduled posts": "Tynnwch y swyddi a drefnwyd", "Remove scheduled posts": "Tynnwch y swyddi a drefnwyd",
"Remove Twitter posts": "Dileu postiadau Twitter", "Remove Twitter posts": "Dileu postiadau Twitter",

View File

@ -206,6 +206,7 @@
"Matrix": "Matrix", "Matrix": "Matrix",
"Email": "Email", "Email": "Email",
"PGP": "PGP", "PGP": "PGP",
"PGP Fingerprint": "PGP Fingerabdruck",
"This is a scheduled post.": "Dies ist ein geplanter Beitrag.", "This is a scheduled post.": "Dies ist ein geplanter Beitrag.",
"Remove scheduled posts": "Geplante Posts entfernen", "Remove scheduled posts": "Geplante Posts entfernen",
"Remove Twitter posts": "Entfernen Sie Twitter-Posts", "Remove Twitter posts": "Entfernen Sie Twitter-Posts",

View File

@ -205,7 +205,8 @@
"XMPP": "XMPP", "XMPP": "XMPP",
"Matrix": "Matrix", "Matrix": "Matrix",
"Email": "Email", "Email": "Email",
"PGP": "PGP", "PGP": "PGP Key",
"PGP Fingerprint": "PGP Fingerprint",
"This is a scheduled post.": "This is a scheduled post.", "This is a scheduled post.": "This is a scheduled post.",
"Remove scheduled posts": "Remove scheduled posts", "Remove scheduled posts": "Remove scheduled posts",
"Remove Twitter posts": "Remove Twitter posts", "Remove Twitter posts": "Remove Twitter posts",

View File

@ -206,6 +206,7 @@
"Matrix": "Matrix", "Matrix": "Matrix",
"Email": "Email", "Email": "Email",
"PGP": "PGP", "PGP": "PGP",
"PGP Fingerprint": "Huella digital PGP",
"This is a scheduled post.": "Esta es una publicación programada.", "This is a scheduled post.": "Esta es una publicación programada.",
"Remove scheduled posts": "Eliminar publicaciones programadas", "Remove scheduled posts": "Eliminar publicaciones programadas",
"Remove Twitter posts": "Eliminar publicaciones de Twitter", "Remove Twitter posts": "Eliminar publicaciones de Twitter",

View File

@ -206,6 +206,7 @@
"Matrix": "Matrix", "Matrix": "Matrix",
"Email": "Email", "Email": "Email",
"PGP": "PGP", "PGP": "PGP",
"PGP Fingerprint": "Empreinte digitale PGP",
"This is a scheduled post.": "Il s'agit d'un article programmé.", "This is a scheduled post.": "Il s'agit d'un article programmé.",
"Remove scheduled posts": "Supprimer les messages planifiés", "Remove scheduled posts": "Supprimer les messages planifiés",
"Remove Twitter posts": "Supprimer les messages Twitter", "Remove Twitter posts": "Supprimer les messages Twitter",

View File

@ -206,6 +206,7 @@
"Matrix": "Matrix", "Matrix": "Matrix",
"Email": "Ríomhphost", "Email": "Ríomhphost",
"PGP": "PGP", "PGP": "PGP",
"PGP Fingerprint": "Méarlorg PGP",
"This is a scheduled post.": "Is post sceidealta é seo.", "This is a scheduled post.": "Is post sceidealta é seo.",
"Remove scheduled posts": "Bain na poist sceidealta", "Remove scheduled posts": "Bain na poist sceidealta",
"Remove Twitter posts": "Bain poist Twitter", "Remove Twitter posts": "Bain poist Twitter",

View File

@ -205,7 +205,8 @@
"XMPP": "XMPP", "XMPP": "XMPP",
"Matrix": "Matrix", "Matrix": "Matrix",
"Email": "ईमेल", "Email": "ईमेल",
"PGP": "PGP", "PGP": "पीजीपी",
"PGP Fingerprint": "पीजीपी फिंगरप्रिंट",
"This is a scheduled post.": "यह एक अनुसूचित पद है।", "This is a scheduled post.": "यह एक अनुसूचित पद है।",
"Remove scheduled posts": "अनुसूचित पदों को हटा दें", "Remove scheduled posts": "अनुसूचित पदों को हटा दें",
"Remove Twitter posts": "ट्विटर पोस्ट हटाएं", "Remove Twitter posts": "ट्विटर पोस्ट हटाएं",

View File

@ -206,6 +206,7 @@
"Matrix": "Matrix", "Matrix": "Matrix",
"Email": "E-mail", "Email": "E-mail",
"PGP": "PGP", "PGP": "PGP",
"PGP Fingerprint": "Impronta digitale PGP",
"This is a scheduled post.": "Questo è un post programmato", "This is a scheduled post.": "Questo è un post programmato",
"Remove scheduled posts": "Rimuovi i post programmati", "Remove scheduled posts": "Rimuovi i post programmati",
"Remove Twitter posts": "Rimuovi i post di Twitter", "Remove Twitter posts": "Rimuovi i post di Twitter",

View File

@ -206,6 +206,7 @@
"Matrix": "Matrix", "Matrix": "Matrix",
"Email": "Eメール", "Email": "Eメール",
"PGP": "PGP", "PGP": "PGP",
"PGP Fingerprint": "PGPフィンガープリント",
"This is a scheduled post.": "これはスケジュールされた投稿です。", "This is a scheduled post.": "これはスケジュールされた投稿です。",
"Remove scheduled posts": "スケジュールされた投稿を削除する", "Remove scheduled posts": "スケジュールされた投稿を削除する",
"Remove Twitter posts": "Twitterの投稿を削除する", "Remove Twitter posts": "Twitterの投稿を削除する",

View File

@ -202,6 +202,7 @@
"Matrix": "Matrix", "Matrix": "Matrix",
"Email": "Email", "Email": "Email",
"PGP": "PGP", "PGP": "PGP",
"PGP Fingerprint": "PGP Fingerprint",
"This is a scheduled post.": "This is a scheduled post.", "This is a scheduled post.": "This is a scheduled post.",
"Remove scheduled posts": "Remove scheduled posts", "Remove scheduled posts": "Remove scheduled posts",
"Remove Twitter posts": "Remove Twitter posts", "Remove Twitter posts": "Remove Twitter posts",

View File

@ -206,6 +206,7 @@
"Matrix": "Matrix", "Matrix": "Matrix",
"Email": "Email", "Email": "Email",
"PGP": "PGP", "PGP": "PGP",
"PGP Fingerprint": "Impressão digital PGP",
"This is a scheduled post.": "Esta é uma postagem agendada.", "This is a scheduled post.": "Esta é uma postagem agendada.",
"Remove scheduled posts": "Remover postagens agendadas", "Remove scheduled posts": "Remover postagens agendadas",
"Remove Twitter posts": "Remover postagens do Twitter", "Remove Twitter posts": "Remover postagens do Twitter",

View File

@ -206,6 +206,7 @@
"Matrix": "Matrix", "Matrix": "Matrix",
"Email": "Эл. адрес", "Email": "Эл. адрес",
"PGP": "PGP", "PGP": "PGP",
"PGP Fingerprint": "PGP Отпечаток пальца",
"This is a scheduled post.": "Это запланированный пост.", "This is a scheduled post.": "Это запланированный пост.",
"Remove scheduled posts": "Удалить запланированные сообщения", "Remove scheduled posts": "Удалить запланированные сообщения",
"Remove Twitter posts": "Удалить сообщения из Твиттера", "Remove Twitter posts": "Удалить сообщения из Твиттера",

View File

@ -205,6 +205,7 @@
"Matrix": "Matrix", "Matrix": "Matrix",
"Email": "电子邮件", "Email": "电子邮件",
"PGP": "PGP", "PGP": "PGP",
"PGP Fingerprint": "PGP指纹",
"This is a scheduled post.": "这是预定的帖子。", "This is a scheduled post.": "这是预定的帖子。",
"Remove scheduled posts": "删除预定的帖子", "Remove scheduled posts": "删除预定的帖子",
"Remove Twitter posts": "删除Twitter帖子", "Remove Twitter posts": "删除Twitter帖子",

View File

@ -19,6 +19,7 @@ from person import personBoxJson
from person import isPersonSnoozed from person import isPersonSnoozed
from pgp import getEmailAddress from pgp import getEmailAddress
from pgp import getPGPpubKey from pgp import getPGPpubKey
from pgp import getPGPfingerprint
from xmpp import getXmppAddress from xmpp import getXmppAddress
from ssb import getSSBAddress from ssb import getSSBAddress
from tox import getToxAddress from tox import getToxAddress
@ -1050,6 +1051,7 @@ def htmlEditProfile(translate: {}, baseDir: str, path: str,
donateUrl = '' donateUrl = ''
emailAddress = '' emailAddress = ''
PGPpubKey = '' PGPpubKey = ''
PGPfingerprint = ''
xmppAddress = '' xmppAddress = ''
matrixAddress = '' matrixAddress = ''
ssbAddress = '' ssbAddress = ''
@ -1066,6 +1068,7 @@ def htmlEditProfile(translate: {}, baseDir: str, path: str,
toxAddress = getToxAddress(actorJson) toxAddress = getToxAddress(actorJson)
emailAddress = getEmailAddress(actorJson) emailAddress = getEmailAddress(actorJson)
PGPpubKey = getPGPpubKey(actorJson) PGPpubKey = getPGPpubKey(actorJson)
PGPfingerprint = getPGPfingerprint(actorJson)
if actorJson.get('name'): if actorJson.get('name'):
displayNickname = actorJson['name'] displayNickname = actorJson['name']
if actorJson.get('summary'): if actorJson.get('summary'):
@ -1331,6 +1334,12 @@ def htmlEditProfile(translate: {}, baseDir: str, path: str,
translate['Email'] + '</label><br>' translate['Email'] + '</label><br>'
editProfileForm += \ editProfileForm += \
' <input type="text" name="email" value="' + emailAddress + '">' ' <input type="text" name="email" value="' + emailAddress + '">'
editProfileForm += \
'<label class="labels">' + \
translate['PGP Fingerprint'] + '</label><br>'
editProfileForm += \
' <input type="text" name="openpgp" value="' + \
PGPfingerprint + '">'
editProfileForm += \ editProfileForm += \
'<label class="labels">' + translate['PGP'] + '</label><br>' '<label class="labels">' + translate['PGP'] + '</label><br>'
editProfileForm += \ editProfileForm += \
@ -2550,13 +2559,15 @@ def htmlProfile(defaultTimeline: str,
donateSection = '' donateSection = ''
donateUrl = getDonationUrl(profileJson) donateUrl = getDonationUrl(profileJson)
PGPpubKey = getPGPpubKey(profileJson) PGPpubKey = getPGPpubKey(profileJson)
PGPfingerprint = getPGPfingerprint(profileJson)
emailAddress = getEmailAddress(profileJson) emailAddress = getEmailAddress(profileJson)
xmppAddress = getXmppAddress(profileJson) xmppAddress = getXmppAddress(profileJson)
matrixAddress = getMatrixAddress(profileJson) matrixAddress = getMatrixAddress(profileJson)
ssbAddress = getSSBAddress(profileJson) ssbAddress = getSSBAddress(profileJson)
toxAddress = getToxAddress(profileJson) toxAddress = getToxAddress(profileJson)
if donateUrl or xmppAddress or matrixAddress or \ if donateUrl or xmppAddress or matrixAddress or \
ssbAddress or toxAddress or PGPpubKey or emailAddress: ssbAddress or toxAddress or PGPpubKey or \
PGPfingerprint or emailAddress:
donateSection = '<div class="container">\n' donateSection = '<div class="container">\n'
donateSection += ' <center>\n' donateSection += ' <center>\n'
if donateUrl: if donateUrl:
@ -2583,6 +2594,10 @@ def htmlProfile(defaultTimeline: str,
donateSection += \ donateSection += \
'<p>Tox: <label class="ssbaddr">' + \ '<p>Tox: <label class="ssbaddr">' + \
toxAddress + '</label></p>\n' toxAddress + '</label></p>\n'
if PGPfingerprint:
donateSection += \
'<p class="pgp">PGP: ' + \
PGPfingerprint.replace('\n', '<br>') + '</p>\n'
if PGPpubKey: if PGPpubKey:
donateSection += \ donateSection += \
'<p class="pgp">' + PGPpubKey.replace('\n', '<br>') + '</p>\n' '<p class="pgp">' + PGPpubKey.replace('\n', '<br>') + '</p>\n'
@ -5314,6 +5329,7 @@ def htmlPersonOptions(translate: {}, baseDir: str,
blogAddress: str, blogAddress: str,
toxAddress: str, toxAddress: str,
PGPpubKey: str, PGPpubKey: str,
PGPfingerprint: str,
emailAddress) -> str: emailAddress) -> str:
"""Show options for a person: view/follow/block/report """Show options for a person: view/follow/block/report
""" """
@ -5411,6 +5427,9 @@ def htmlPersonOptions(translate: {}, baseDir: str,
if toxAddress: if toxAddress:
optionsStr += \ optionsStr += \
'<p class="imText">Tox: ' + toxAddress + '</p>' '<p class="imText">Tox: ' + toxAddress + '</p>'
if PGPfingerprint:
optionsStr += '<p class="pgp">PGP: ' + \
PGPfingerprint.replace('\n', '<br>') + '</p>'
if PGPpubKey: if PGPpubKey:
optionsStr += '<p class="pgp">' + \ optionsStr += '<p class="pgp">' + \
PGPpubKey.replace('\n', '<br>') + '</p>' PGPpubKey.replace('\n', '<br>') + '</p>'