From 77818c99ceafab8a5a194eb7c9e8b618f98677c8 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 12 Mar 2021 12:17:44 +0000 Subject: [PATCH] Don't show ciphertext in the web interface --- translations/ar.json | 3 ++- translations/ca.json | 3 ++- translations/cy.json | 3 ++- translations/de.json | 3 ++- translations/en.json | 3 ++- translations/es.json | 3 ++- translations/fr.json | 3 ++- translations/ga.json | 3 ++- translations/hi.json | 3 ++- translations/it.json | 3 ++- translations/ja.json | 3 ++- translations/ku.json | 3 ++- translations/oc.json | 3 ++- translations/pt.json | 3 ++- translations/ru.json | 3 ++- translations/zh.json | 3 ++- webapp_post.py | 24 ++++++++++++++---------- 17 files changed, 46 insertions(+), 26 deletions(-) diff --git a/translations/ar.json b/translations/ar.json index a692a6a57..0f9847479 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -400,5 +400,6 @@ "heart": "قلب", "counselor": "مستشار", "Counselors": "المستشارين", - "shocked": "صدمت" + "shocked": "صدمت", + "Encrypted": "مشفر" } diff --git a/translations/ca.json b/translations/ca.json index 238dd2388..b44f228fe 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -400,5 +400,6 @@ "heart": "cor", "counselor": "conseller", "Counselors": "Consellers", - "shocked": "sorprès" + "shocked": "sorprès", + "Encrypted": "Xifrat" } diff --git a/translations/cy.json b/translations/cy.json index c7f6571b3..0f8362073 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -400,5 +400,6 @@ "heart": "galon", "counselor": "cynghorydd", "Counselors": "Cynghorwyr", - "shocked": "sioc" + "shocked": "sioc", + "Encrypted": "Amgryptio" } diff --git a/translations/de.json b/translations/de.json index 86c95ae49..bf5189e6c 100644 --- a/translations/de.json +++ b/translations/de.json @@ -400,5 +400,6 @@ "heart": "herz", "counselor": "Beraterin", "Counselors": "Berater", - "shocked": "schockiert" + "shocked": "schockiert", + "Encrypted": "Verschlüsselt" } diff --git a/translations/en.json b/translations/en.json index c778ff142..6840c67f2 100644 --- a/translations/en.json +++ b/translations/en.json @@ -400,5 +400,6 @@ "heart": "heart", "counselor": "counselor", "Counselors": "Counselors", - "shocked": "shocked" + "shocked": "shocked", + "Encrypted": "Encrypted" } diff --git a/translations/es.json b/translations/es.json index bf7c27980..901f8b515 100644 --- a/translations/es.json +++ b/translations/es.json @@ -400,5 +400,6 @@ "heart": "corazón", "counselor": "Consejera", "Counselors": "Consejeras", - "shocked": "conmocionada" + "shocked": "conmocionada", + "Encrypted": "Cifrada" } diff --git a/translations/fr.json b/translations/fr.json index 9606d3656..6d25dbd97 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -400,5 +400,6 @@ "heart": "cœur", "counselor": "Conseillère", "Counselors": "Conseillères", - "shocked": "sous le choc" + "shocked": "sous le choc", + "Encrypted": "Crypté" } diff --git a/translations/ga.json b/translations/ga.json index 1d3c2f16b..a997cb359 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -400,5 +400,6 @@ "heart": "chroí", "counselor": "Comhairleoir", "Counselors": "Comhairleoirí", - "shocked": "ionadh" + "shocked": "ionadh", + "Encrypted": "Criptithe" } diff --git a/translations/hi.json b/translations/hi.json index b72bbd022..0bc6813a1 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -400,5 +400,6 @@ "heart": "दिल", "counselor": "काउंसलर", "Counselors": "सलाहकार", - "shocked": "हैरान" + "shocked": "हैरान", + "Encrypted": "को गोपित" } diff --git a/translations/it.json b/translations/it.json index bc58e8605..347d904e7 100644 --- a/translations/it.json +++ b/translations/it.json @@ -400,5 +400,6 @@ "heart": "cuore", "counselor": "Consulente", "Counselors": "Consiglieri", - "shocked": "scioccata" + "shocked": "scioccata", + "Encrypted": "Crittografato" } diff --git a/translations/ja.json b/translations/ja.json index 818558412..ba402b9b3 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -400,5 +400,6 @@ "heart": "ハート", "counselor": "カウンセラー", "Counselors": "カウンセラー", - "shocked": "ショックを受けた" + "shocked": "ショックを受けた", + "Encrypted": "暗号化" } diff --git a/translations/ku.json b/translations/ku.json index d69187b4a..5e74514b1 100644 --- a/translations/ku.json +++ b/translations/ku.json @@ -400,5 +400,6 @@ "heart": "dil", "counselor": "Pêşnîyarvan", "Counselors": "Selêwirmendan", - "shocked": "şok kirin" + "shocked": "şok kirin", + "Encrypted": "Encîfre kirin" } diff --git a/translations/oc.json b/translations/oc.json index 6ecbfdf50..f355a9485 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -396,5 +396,6 @@ "heart": "heart", "counselor": "Counselors", "Counselors": "Counselors", - "shocked": "shocked" + "shocked": "shocked", + "Encrypted": "Encrypted" } diff --git a/translations/pt.json b/translations/pt.json index 1ddc7dc65..b7b3206c8 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -400,5 +400,6 @@ "heart": "coração", "counselor": "Conselheira", "Counselors": "Conselheiras", - "shocked": "chocada" + "shocked": "chocada", + "Encrypted": "Criptografada" } diff --git a/translations/ru.json b/translations/ru.json index ae4081d8a..bdf9754f8 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -400,5 +400,6 @@ "heart": "сердце", "counselor": "Советник", "Counselors": "Советники", - "shocked": "потрясенный" + "shocked": "потрясенный", + "Encrypted": "Зашифрованный" } diff --git a/translations/zh.json b/translations/zh.json index a81c63693..7814ba6bd 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -400,5 +400,6 @@ "heart": "心", "counselor": "顾问", "Counselors": "辅导员", - "shocked": "震惊的" + "shocked": "震惊的", + "Encrypted": "加密的" } diff --git a/webapp_post.py b/webapp_post.py index 36aec0653..1cd2099b6 100644 --- a/webapp_post.py +++ b/webapp_post.py @@ -21,6 +21,7 @@ from posts import postIsMuted from posts import getPersonBox from posts import downloadAnnounce from posts import populateRepliesJson +from utils import isPGPEncrypted from utils import isDM from utils import rejectPostId from utils import isRecentPost @@ -1570,17 +1571,20 @@ def individualPostAsHtml(allowDownloads: bool, _logPostTiming(enableTimingLog, postStartTime, '16') - if not isPatch: - objectContent = \ - removeLongWords(postJsonObject['object']['content'], 40, []) - objectContent = removeTextFormatting(objectContent) - objectContent = \ - switchWords(baseDir, nickname, domain, objectContent) - objectContent = htmlReplaceEmailQuote(objectContent) - objectContent = htmlReplaceQuoteMarks(objectContent) + if not isPGPEncrypted(postJsonObject['object']['content']): + if not isPatch: + objectContent = \ + removeLongWords(postJsonObject['object']['content'], 40, []) + objectContent = removeTextFormatting(objectContent) + objectContent = \ + switchWords(baseDir, nickname, domain, objectContent) + objectContent = htmlReplaceEmailQuote(objectContent) + objectContent = htmlReplaceQuoteMarks(objectContent) + else: + objectContent = \ + postJsonObject['object']['content'] else: - objectContent = \ - postJsonObject['object']['content'] + objectContent = '🔒 ' + translate['Encrypted'] objectContent = '
' + objectContent + '
'