From 5c3c0772ac7acec0ba22e5518b2fa6121faf9aa0 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 30 May 2021 15:06:28 +0100 Subject: [PATCH 01/10] Secondary submit button --- webapp_create_post.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/webapp_create_post.py b/webapp_create_post.py index 8d5d6a251..c781e26bd 100644 --- a/webapp_create_post.py +++ b/webapp_create_post.py @@ -772,6 +772,13 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {}, newPostForm += extraFields + citationsStr + dateAndLocation if not mediaInstance or replyStr: newPostForm += newPostImageSection + + newPostForm += '
\n' + newPostForm += \ + ' \n' + newPostForm += '
\n' + newPostForm += ' \n' newPostForm += '\n' From 78b45717acdf5a293da77b1701014f1f2840426d Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 30 May 2021 15:09:54 +0100 Subject: [PATCH 02/10] Extra container --- webapp_create_post.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webapp_create_post.py b/webapp_create_post.py index c781e26bd..020955705 100644 --- a/webapp_create_post.py +++ b/webapp_create_post.py @@ -773,11 +773,11 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {}, if not mediaInstance or replyStr: newPostForm += newPostImageSection - newPostForm += '
\n' + newPostForm += '
\n' newPostForm += \ ' \n' - newPostForm += '
\n' + newPostForm += '
\n' newPostForm += ' \n' newPostForm += '\n' From 0f68c1b036a5342db6985a479c7acbdd5ac71bac Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 30 May 2021 15:10:51 +0100 Subject: [PATCH 03/10] Remove container --- webapp_create_post.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webapp_create_post.py b/webapp_create_post.py index 020955705..c781e26bd 100644 --- a/webapp_create_post.py +++ b/webapp_create_post.py @@ -773,11 +773,11 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {}, if not mediaInstance or replyStr: newPostForm += newPostImageSection - newPostForm += '
\n' + newPostForm += '
\n' newPostForm += \ ' \n' - newPostForm += '
\n' + newPostForm += '
\n' newPostForm += ' \n' newPostForm += '\n' From 4d293c30c04ecc2f6cd513b01e1dbf24551e1ca8 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 30 May 2021 15:12:01 +0100 Subject: [PATCH 04/10] Change container type --- webapp_create_post.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp_create_post.py b/webapp_create_post.py index c781e26bd..4340d9ba3 100644 --- a/webapp_create_post.py +++ b/webapp_create_post.py @@ -773,7 +773,7 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {}, if not mediaInstance or replyStr: newPostForm += newPostImageSection - newPostForm += '
\n' + newPostForm += '
\n' newPostForm += \ ' \n' From 24bf38d104ca4f649cfbde46f5ca2b40839717e3 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 30 May 2021 15:19:26 +0100 Subject: [PATCH 05/10] Extra submit button on edit profile screen --- webapp_profile.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/webapp_profile.py b/webapp_profile.py index ca01cbb9a..3adda2e8f 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -1983,6 +1983,15 @@ def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str, 'name="deactivateThisAccount"> ' + \ translate['Deactivate this account'] + '
\n' editProfileForm += '
\n' + + editProfileForm += '
\n' + editProfileForm += \ + '
\n' + \ + ' \n' + \ + '
\n' + editProfileForm += '
\n' + editProfileForm += '
\n' editProfileForm += '\n' editProfileForm += htmlFooter() From c2a77fdd4415ec3bed9a714cd081b8678400e68c Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 30 May 2021 15:27:26 +0100 Subject: [PATCH 06/10] Access keys on edit profile screen --- daemon.py | 8 +++++++- webapp_profile.py | 8 +++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/daemon.py b/daemon.py index fee03986e..079e1df29 100644 --- a/daemon.py +++ b/daemon.py @@ -10465,6 +10465,12 @@ class PubServer(BaseHTTPRequestHandler): city = self._getSpoofedCity(baseDir, nickname, domain) else: city = self.server.city + + accessKeys = self.server.accessKeys + if '/users/' in path: + if self.server.keyShortcuts.get(nickname): + accessKeys = self.server.keyShortcuts[nickname] + msg = htmlEditProfile(self.server.cssCache, translate, baseDir, @@ -10475,7 +10481,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.themeName, peertubeInstances, self.server.textModeBanner, - city).encode('utf-8') + city, accessKeys).encode('utf-8') if msg: msglen = len(msg) self._set_headers('text/html', msglen, diff --git a/webapp_profile.py b/webapp_profile.py index 3adda2e8f..b0eead02e 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -1081,7 +1081,8 @@ def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str, domain: str, port: int, httpPrefix: str, defaultTimeline: str, theme: str, peertubeInstances: [], - textModeBanner: str, city: str) -> str: + textModeBanner: str, city: str, + accessKeys: {}) -> str: """Shows the edit profile screen """ imageFormats = getImageFormats() @@ -1611,8 +1612,9 @@ def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str, editProfileForm += '
\n' editProfileForm += \ '
\n' + \ - ' \n' + \ + ' \n' + \ '
\n' editProfileForm += '
\n' From 1a410dd8caa153373417116d2732e60ab7484fa1 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 30 May 2021 18:05:09 +0100 Subject: [PATCH 07/10] Avoid duplicate accesskey --- webapp_profile.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/webapp_profile.py b/webapp_profile.py index b0eead02e..eb5dc48df 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -353,8 +353,7 @@ def _getProfileHeader(baseDir: str, httpPrefix: str, htmlStr = '\n\n
\n' htmlStr += ' \n' + translate['Switch to timeline view'] + '">\n' htmlStr += ' \n' From d8dff6e80427dde03c7bcc979e2c584217afbe3c Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 30 May 2021 18:38:41 +0100 Subject: [PATCH 08/10] Custom new post submit button text --- daemon.py | 37 ++++++++++++++++++++++++++++++++++--- 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_create_post.py | 9 ++++++--- webapp_profile.py | 16 ++++++++++++++++ 19 files changed, 88 insertions(+), 22 deletions(-) diff --git a/daemon.py b/daemon.py index 079e1df29..e38a3f0a6 100644 --- a/daemon.py +++ b/daemon.py @@ -2324,6 +2324,10 @@ class PubServer(BaseHTTPRequestHandler): if self.server.keyShortcuts.get(nickname): accessKeys = self.server.keyShortcuts[nickname] + customSubmitText = \ + getConfigParam(baseDir, + 'customSubmitText') + msg = htmlNewPost(self.server.cssCache, False, self.server.translate, baseDir, @@ -2337,7 +2341,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.defaultTimeline, self.server.newswire, self.server.themeName, - True, accessKeys).encode('utf-8') + True, accessKeys, + customSubmitText).encode('utf-8') msglen = len(msg) self._set_headers('text/html', msglen, cookie, callingDomain) @@ -2433,6 +2438,10 @@ class PubServer(BaseHTTPRequestHandler): if self.server.keyShortcuts.get(nickname): accessKeys = self.server.keyShortcuts[nickname] + customSubmitText = \ + getConfigParam(baseDir, + 'customSubmitText') + msg = htmlNewPost(self.server.cssCache, False, self.server.translate, baseDir, @@ -2445,7 +2454,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.defaultTimeline, self.server.newswire, self.server.themeName, - True, accessKeys).encode('utf-8') + True, accessKeys, + customSubmitText).encode('utf-8') msglen = len(msg) self._set_headers('text/html', msglen, cookie, callingDomain) @@ -4440,6 +4450,22 @@ class PubServer(BaseHTTPRequestHandler): 'youtubedomain', '') self.server.YTReplacementDomain = None + # change custom post submit button text + currCustomSubmitText = \ + getConfigParam(baseDir, + 'customSubmitText') + if fields.get('customSubmitText'): + if fields['customSubmitText'] != \ + currCustomSubmitText: + customText = fields['customSubmitText'] + setConfigParam(baseDir, + 'customSubmitText', + customText) + else: + if currCustomSubmitText: + setConfigParam(baseDir, + 'customSubmitText', '') + # change instance description currInstanceDescriptionShort = \ getConfigParam(baseDir, @@ -10421,6 +10447,10 @@ class PubServer(BaseHTTPRequestHandler): if self.server.keyShortcuts.get(nickname): accessKeys = self.server.keyShortcuts[nickname] + customSubmitText = \ + getConfigParam(baseDir, + 'customSubmitText') + msg = htmlNewPost(self.server.cssCache, mediaInstance, translate, @@ -10435,7 +10465,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.defaultTimeline, self.server.newswire, self.server.themeName, - noDropDown, accessKeys).encode('utf-8') + noDropDown, accessKeys, + customSubmitText).encode('utf-8') if not msg: print('Error replying to ' + inReplyToUrl) self._404() diff --git a/translations/ar.json b/translations/ar.json index 88649d5fe..0d4c968d2 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -446,5 +446,6 @@ "Artists": "الفنانين", "Graphic Design": "التصميم الجرافيكي", "Import Theme": "استيراد الموضوع", - "Export Theme": "موضوع التصدير" + "Export Theme": "موضوع التصدير", + "Custom post submit button text": "عرف نشر إرسال نص زر" } diff --git a/translations/ca.json b/translations/ca.json index 680c9d1c3..481bc633e 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -446,5 +446,6 @@ "Artists": "Artistes", "Graphic Design": "Disseny gràfic", "Import Theme": "Importació temàtica", - "Export Theme": "Tema d'exportació" + "Export Theme": "Tema d'exportació", + "Custom post submit button text": "Text de botó d'enviament de publicacions personalitzades" } diff --git a/translations/cy.json b/translations/cy.json index 9ebef4a9c..c5543a1ac 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -446,5 +446,6 @@ "Artists": "Artistiaid", "Graphic Design": "Dylunio Graffig", "Import Theme": "Thema Mewnforio", - "Export Theme": "Thema Allforio" + "Export Theme": "Thema Allforio", + "Custom post submit button text": "Testun Post Post Post" } diff --git a/translations/de.json b/translations/de.json index dd04ed255..e18f86cf0 100644 --- a/translations/de.json +++ b/translations/de.json @@ -446,5 +446,6 @@ "Artists": "Künstler", "Graphic Design": "Grafikdesign", "Import Theme": "Theme importieren", - "Export Theme": "Theme exportieren" + "Export Theme": "Theme exportieren", + "Custom post submit button text": "Benutzerdefinierte Post-Senden Schaltfläche Text" } diff --git a/translations/en.json b/translations/en.json index 6633fda6b..6e7ac30d8 100644 --- a/translations/en.json +++ b/translations/en.json @@ -446,5 +446,6 @@ "Artists": "Artists", "Graphic Design": "Graphic Design", "Import Theme": "Import Theme", - "Export Theme": "Export Theme" + "Export Theme": "Export Theme", + "Custom post submit button text": "Custom post submit button text" } diff --git a/translations/es.json b/translations/es.json index 0d3099a2c..7311d5e78 100644 --- a/translations/es.json +++ b/translations/es.json @@ -446,5 +446,6 @@ "Artists": "Artistas", "Graphic Design": "Diseño gráfico", "Import Theme": "Tema de importación", - "Export Theme": "Tema de exportación" + "Export Theme": "Tema de exportación", + "Custom post submit button text": "POST POST PERSONALIZADO Botón Texto" } diff --git a/translations/fr.json b/translations/fr.json index f49bd5d2b..605cb43ce 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -446,5 +446,6 @@ "Artists": "Artistes", "Graphic Design": "Conception graphique", "Import Theme": "Import thème", - "Export Theme": "Thème d'exportation" + "Export Theme": "Thème d'exportation", + "Custom post submit button text": "Texte de bouton d'envoi postal personnalisé" } diff --git a/translations/ga.json b/translations/ga.json index 5ac04d5f0..9df731cb5 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -446,5 +446,6 @@ "Artists": "Ealaíontóirí", "Graphic Design": "Dearadh grafach", "Import Theme": "Téama Iompórtáil", - "Export Theme": "Téama Easpórtála" + "Export Theme": "Téama Easpórtála", + "Custom post submit button text": "Post saincheaptha Cuir isteach an cnaipe Téacs" } diff --git a/translations/hi.json b/translations/hi.json index c401ae54e..824a2c346 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -446,5 +446,6 @@ "Artists": "कलाकार की", "Graphic Design": "ग्राफ़िक डिज़ाइन", "Import Theme": "आयात विषय", - "Export Theme": "निर्यात विषय" + "Export Theme": "निर्यात विषय", + "Custom post submit button text": "कस्टम पोस्ट सबमिट बटन टेक्स्ट" } diff --git a/translations/it.json b/translations/it.json index d35b5f80a..45e304652 100644 --- a/translations/it.json +++ b/translations/it.json @@ -446,5 +446,6 @@ "Artists": "Artiste", "Graphic Design": "Graphic design", "Import Theme": "Tema dell'importazione", - "Export Theme": "Esportare tema" + "Export Theme": "Esportare tema", + "Custom post submit button text": "Pulsante di invio del post personalizzato" } diff --git a/translations/ja.json b/translations/ja.json index 3d35359d2..aba165a20 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -446,5 +446,6 @@ "Artists": "アーティスト", "Graphic Design": "グラフィックデザイン", "Import Theme": "輸入テーマ", - "Export Theme": "テーマをエクスポートします" + "Export Theme": "テーマをエクスポートします", + "Custom post submit button text": "カスタムポスト送信ボタンテキスト" } diff --git a/translations/ku.json b/translations/ku.json index bc81ed21e..a5e686051 100644 --- a/translations/ku.json +++ b/translations/ku.json @@ -446,5 +446,6 @@ "Artists": "Hunermend", "Graphic Design": "Sêwirana grafîkî", "Import Theme": "Mijara Import", - "Export Theme": "Mijara Export" + "Export Theme": "Mijara Export", + "Custom post submit button text": "Nivîsa bişkojka paşîn a paşîn" } diff --git a/translations/oc.json b/translations/oc.json index dddf3f19c..a0ab81de1 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -442,5 +442,6 @@ "Artists": "Artists", "Graphic Design": "Graphic Design", "Import Theme": "Import Theme", - "Export Theme": "Export Theme" + "Export Theme": "Export Theme", + "Custom post submit button text": "Custom post submit button text" } diff --git a/translations/pt.json b/translations/pt.json index 0673e74ae..3ce0bc69a 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -446,5 +446,6 @@ "Artists": "Artistas", "Graphic Design": "Design gráfico", "Import Theme": "Importar tema", - "Export Theme": "Exportar tema" + "Export Theme": "Exportar tema", + "Custom post submit button text": "Texto de botão de envio de post personalizado" } diff --git a/translations/ru.json b/translations/ru.json index 9a29cf93e..70ce88f87 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -446,5 +446,6 @@ "Artists": "Художники", "Graphic Design": "Графический дизайн", "Import Theme": "Импортировать тему", - "Export Theme": "Экспортная тема" + "Export Theme": "Экспортная тема", + "Custom post submit button text": "Пользовательский пост Отправить кнопку текста" } diff --git a/translations/zh.json b/translations/zh.json index c3db57343..ba268fc9a 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -446,5 +446,6 @@ "Artists": "艺人", "Graphic Design": "平面设计", "Import Theme": "进口主题", - "Export Theme": "出口主题" + "Export Theme": "出口主题", + "Custom post submit button text": "自定义发布提交按钮文本" } diff --git a/webapp_create_post.py b/webapp_create_post.py index 4340d9ba3..19f2e0e05 100644 --- a/webapp_create_post.py +++ b/webapp_create_post.py @@ -187,7 +187,7 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {}, domainFull: str, defaultTimeline: str, newswire: {}, theme: str, noDropDown: bool, - accessKeys: {}) -> str: + accessKeys: {}, customSubmitText: str) -> str: """New post screen """ replyStr = '' @@ -702,9 +702,12 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {}, ' \n' + submitText = translate['Submit'] + if customSubmitText: + submitText = customSubmitText newPostForm += \ ' \n' newPostForm += ' \n' @@ -776,7 +779,7 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {}, newPostForm += '
\n' newPostForm += \ ' \n' + submitText + '">\n' newPostForm += '
\n' newPostForm += ' \n' diff --git a/webapp_profile.py b/webapp_profile.py index eb5dc48df..b97d0e9a9 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -1359,6 +1359,8 @@ def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str, # Instance details section instanceDescription = \ getConfigParam(baseDir, 'instanceDescription') + customSubmitText = \ + getConfigParam(baseDir, 'customSubmitText') instanceDescriptionShort = \ getConfigParam(baseDir, 'instanceDescriptionShort') instanceTitle = \ @@ -1401,6 +1403,20 @@ def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str, instanceStr += \ ' ' + + instanceStr += \ + ' ' + if customSubmitText: + instanceStr += \ + '
' + else: + instanceStr += \ + '
' + instanceStr += \ ' ' From d83528cb1a0e68f0a473cd2fd0f48e8125687e2c Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 30 May 2021 18:45:42 +0100 Subject: [PATCH 09/10] Remove second submit button --- webapp_create_post.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/webapp_create_post.py b/webapp_create_post.py index 19f2e0e05..dbffab321 100644 --- a/webapp_create_post.py +++ b/webapp_create_post.py @@ -776,12 +776,6 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {}, if not mediaInstance or replyStr: newPostForm += newPostImageSection - newPostForm += '
\n' - newPostForm += \ - ' \n' - newPostForm += '
\n' - newPostForm += ' \n' newPostForm += '\n' From 2a62dd7e268948700126c353e72d32c1d59baa2d Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 30 May 2021 18:55:19 +0100 Subject: [PATCH 10/10] Compare using custom submit button text --- daemon.py | 23 ++++++++++------------- webapp_create_post.py | 6 ++++++ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/daemon.py b/daemon.py index e38a3f0a6..fb6a3f4f5 100644 --- a/daemon.py +++ b/daemon.py @@ -2324,9 +2324,7 @@ class PubServer(BaseHTTPRequestHandler): if self.server.keyShortcuts.get(nickname): accessKeys = self.server.keyShortcuts[nickname] - customSubmitText = \ - getConfigParam(baseDir, - 'customSubmitText') + customSubmitText = getConfigParam(baseDir, 'customSubmitText') msg = htmlNewPost(self.server.cssCache, False, self.server.translate, @@ -2438,9 +2436,7 @@ class PubServer(BaseHTTPRequestHandler): if self.server.keyShortcuts.get(nickname): accessKeys = self.server.keyShortcuts[nickname] - customSubmitText = \ - getConfigParam(baseDir, - 'customSubmitText') + customSubmitText = getConfigParam(baseDir, 'customSubmitText') msg = htmlNewPost(self.server.cssCache, False, self.server.translate, @@ -4452,8 +4448,7 @@ class PubServer(BaseHTTPRequestHandler): # change custom post submit button text currCustomSubmitText = \ - getConfigParam(baseDir, - 'customSubmitText') + getConfigParam(baseDir, 'customSubmitText') if fields.get('customSubmitText'): if fields['customSubmitText'] != \ currCustomSubmitText: @@ -10447,9 +10442,7 @@ class PubServer(BaseHTTPRequestHandler): if self.server.keyShortcuts.get(nickname): accessKeys = self.server.keyShortcuts[nickname] - customSubmitText = \ - getConfigParam(baseDir, - 'customSubmitText') + customSubmitText = getConfigParam(baseDir, 'customSubmitText') msg = htmlNewPost(self.server.cssCache, mediaInstance, @@ -13325,9 +13318,13 @@ class PubServer(BaseHTTPRequestHandler): not fields.get('pinToProfile'): print('WARN: no message, image description or pin') return -1 + submitText = self.server.translate['Submit'] + customSubmitText = \ + getConfigParam(self.server.baseDir, 'customSubmitText') + if customSubmitText: + submitText = customSubmitText if fields.get('submitPost'): - if fields['submitPost'] != \ - self.server.translate['Submit']: + if fields['submitPost'] != submitText: print('WARN: no submit field ' + fields['submitPost']) return -1 else: diff --git a/webapp_create_post.py b/webapp_create_post.py index dbffab321..19f2e0e05 100644 --- a/webapp_create_post.py +++ b/webapp_create_post.py @@ -776,6 +776,12 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {}, if not mediaInstance or replyStr: newPostForm += newPostImageSection + newPostForm += '
\n' + newPostForm += \ + ' \n' + newPostForm += '
\n' + newPostForm += ' \n' newPostForm += '\n'