From 48c298f5f8920c3b77634ca9ec81ff9083a8cc21 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 21 Oct 2021 17:58:01 +0100 Subject: [PATCH] Show selectable lists --- daemon.py | 4 +++- 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/sw.json | 3 ++- translations/zh.json | 3 ++- webapp_profile.py | 24 +++++++++++++++++++++--- 19 files changed, 58 insertions(+), 21 deletions(-) diff --git a/daemon.py b/daemon.py index 3323b2c4a..e2f63938a 100644 --- a/daemon.py +++ b/daemon.py @@ -11774,7 +11774,9 @@ class PubServer(BaseHTTPRequestHandler): city, self.server.userAgentsBlocked, accessKeys, - defaultReplyIntervalHours).encode('utf-8') + defaultReplyIntervalHours, + self.server.CWlists, + self.server.listsEnabled).encode('utf-8') if msg: msglen = len(msg) self._set_headers('text/html', msglen, diff --git a/translations/ar.json b/translations/ar.json index 325f09dc4..2ae899465 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -488,5 +488,6 @@ "Members": "أعضاء", "Join": "انضم", "Leave": "يترك", - "System Monitor": "مراقب النظام" + "System Monitor": "مراقب النظام", + "Add content warnings for the following sites": "أضف تحذيرات المحتوى للمواقع التالية" } diff --git a/translations/ca.json b/translations/ca.json index 8e7b37c08..f4861d724 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -488,5 +488,6 @@ "Members": "Membres", "Join": "Uneix-te", "Leave": "Marxa", - "System Monitor": "Monitor del sistema" + "System Monitor": "Monitor del sistema", + "Add content warnings for the following sites": "Afegiu advertiments de contingut per als llocs següents" } diff --git a/translations/cy.json b/translations/cy.json index 97daf5510..f25c5a27c 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -488,5 +488,6 @@ "Members": "Aelodau", "Join": "Ymunwch", "Leave": "Gadewch", - "System Monitor": "Monitor System" + "System Monitor": "Monitor System", + "Add content warnings for the following sites": "Ychwanegwch rybuddion cynnwys ar gyfer y gwefannau canlynol" } diff --git a/translations/de.json b/translations/de.json index 0667373c2..e2760a864 100644 --- a/translations/de.json +++ b/translations/de.json @@ -488,5 +488,6 @@ "Members": "Mitglieder", "Join": "Verbinden", "Leave": "Verlassen", - "System Monitor": "Systemmonitor" + "System Monitor": "Systemmonitor", + "Add content warnings for the following sites": "Inhaltswarnungen für die folgenden Websites hinzufügen" } diff --git a/translations/en.json b/translations/en.json index d7b71a414..4e8d3ec13 100644 --- a/translations/en.json +++ b/translations/en.json @@ -488,5 +488,6 @@ "Members": "Members", "Join": "Join", "Leave": "Leave", - "System Monitor": "System Monitor" + "System Monitor": "System Monitor", + "Add content warnings for the following sites": "Add content warnings for the following sites" } diff --git a/translations/es.json b/translations/es.json index 1bd72c84e..67cf33835 100644 --- a/translations/es.json +++ b/translations/es.json @@ -488,5 +488,6 @@ "Members": "Miembros", "Join": "Entrar", "Leave": "Dejar", - "System Monitor": "Monitor del sistema" + "System Monitor": "Monitor del sistema", + "Add content warnings for the following sites": "Agregue advertencias de contenido para los siguientes sitios" } diff --git a/translations/fr.json b/translations/fr.json index 16f396e53..056a914c0 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -488,5 +488,6 @@ "Members": "Membres", "Join": "Rejoindre", "Leave": "Laisser", - "System Monitor": "Moniteur système" + "System Monitor": "Moniteur système", + "Add content warnings for the following sites": "Ajouter des avertissements de contenu pour les sites suivants" } diff --git a/translations/ga.json b/translations/ga.json index eb0b12af3..73f740bcf 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -488,5 +488,6 @@ "Members": "Baill", "Join": "Bí páirteach", "Leave": "Fág", - "System Monitor": "Monatóir Córais" + "System Monitor": "Monatóir Córais", + "Add content warnings for the following sites": "Cuir rabhaidh ábhair leis na suíomhanna seo a leanas" } diff --git a/translations/hi.json b/translations/hi.json index b93a3180d..c4e475f2d 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -488,5 +488,6 @@ "Members": "सदस्यों", "Join": "शामिल हों", "Leave": "छोड़ना", - "System Monitor": "सिस्टम मॉनिटर" + "System Monitor": "सिस्टम मॉनिटर", + "Add content warnings for the following sites": "निम्नलिखित साइटों के लिए सामग्री चेतावनियाँ जोड़ें" } diff --git a/translations/it.json b/translations/it.json index 4ea931172..4648aedae 100644 --- a/translations/it.json +++ b/translations/it.json @@ -488,5 +488,6 @@ "Members": "Membri", "Join": "Aderire", "Leave": "Lasciare", - "System Monitor": "Monitor di sistema" + "System Monitor": "Monitor di sistema", + "Add content warnings for the following sites": "Aggiungi avvisi sui contenuti per i seguenti siti" } diff --git a/translations/ja.json b/translations/ja.json index d751c83aa..0fe46e4f4 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -488,5 +488,6 @@ "Members": "メンバー", "Join": "加入", "Leave": "離れる", - "System Monitor": "システムモニター" + "System Monitor": "システムモニター", + "Add content warnings for the following sites": "次のサイトのコンテンツ警告を追加します" } diff --git a/translations/ku.json b/translations/ku.json index bf383bdfe..1c4f7dd19 100644 --- a/translations/ku.json +++ b/translations/ku.json @@ -488,5 +488,6 @@ "Members": "Endam", "Join": "Bihevgirêdan", "Leave": "Terikandin", - "System Monitor": "System Monitor" + "System Monitor": "System Monitor", + "Add content warnings for the following sites": "Ji bo malperên jêrîn hişyariyên naverokê zêde bikin" } diff --git a/translations/oc.json b/translations/oc.json index c2e6f0c8f..d898dfa43 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -484,5 +484,6 @@ "Members": "Members", "Join": "Join", "Leave": "Leave", - "System Monitor": "System Monitor" + "System Monitor": "System Monitor", + "Add content warnings for the following sites": "Add content warnings for the following sites" } diff --git a/translations/pt.json b/translations/pt.json index 75444a1b5..789df52ea 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -488,5 +488,6 @@ "Members": "Membros", "Join": "Juntar", "Leave": "Sair", - "System Monitor": "Monitor de Sistema" + "System Monitor": "Monitor de Sistema", + "Add content warnings for the following sites": "Adicione avisos de conteúdo para os seguintes sites" } diff --git a/translations/ru.json b/translations/ru.json index 83597b5b0..2352871d7 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -488,5 +488,6 @@ "Members": "Члены", "Join": "Присоединиться", "Leave": "Оставлять", - "System Monitor": "Системный монитор" + "System Monitor": "Системный монитор", + "Add content warnings for the following sites": "Добавить предупреждения о содержании для следующих сайтов" } diff --git a/translations/sw.json b/translations/sw.json index c658897b2..3e7aa7b8d 100644 --- a/translations/sw.json +++ b/translations/sw.json @@ -488,5 +488,6 @@ "Members": "Wanachama", "Join": "Jiunge", "Leave": "Ondoka", - "System Monitor": "Ufuatiliaji wa Mfumo" + "System Monitor": "Ufuatiliaji wa Mfumo", + "Add content warnings for the following sites": "Ongeza maonyo ya yaliyomo kwa wavuti zifuatazo" } diff --git a/translations/zh.json b/translations/zh.json index db16066e8..e7104146b 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -488,5 +488,6 @@ "Members": "会员", "Join": "加入", "Leave": "离开", - "System Monitor": "系统监视器" + "System Monitor": "系统监视器", + "Add content warnings for the following sites": "为以下网站添加内容警告" } diff --git a/webapp_profile.py b/webapp_profile.py index 2db29478b..4cf45c2ef 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -1518,7 +1518,8 @@ def _htmlEditProfileSharedItems(baseDir: str, nickname: str, domain: str, def _htmlEditProfileFiltering(baseDir: str, nickname: str, domain: str, userAgentsBlocked: str, translate: {}, - replyIntervalHours: int) -> str: + replyIntervalHours: int, + CWlists: {}, listsEnabled: str) -> str: """Filtering and blocking section of edit profile screen """ filterStr = '' @@ -1674,6 +1675,21 @@ def _htmlEditProfileFiltering(baseDir: str, nickname: str, domain: str, 'userAgentsBlockedStr', userAgentsBlockedStr, 200, '', False) + idx = 'Add content warnings for the following sites' + editProfileForm += \ + '\n' + + for listName, item in CWlists.items(): + name = listName + variableName = 'list' + name.replace(' ', '').replace("'", '') + if listName in listsEnabled: + listIsEnabled = True + else: + listIsEnabled = False + if translate.get(name): + name = translate[name] + editProfileForm += editCheckBox(name, variableName, listIsEnabled) + editProfileForm += endEditSection() return editProfileForm @@ -1956,7 +1972,8 @@ def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str, textModeBanner: str, city: str, userAgentsBlocked: str, accessKeys: {}, - defaultReplyIntervalHours: int) -> str: + defaultReplyIntervalHours: int, + CWlists: {}, listsEnabled: str) -> str: """Shows the edit profile screen """ path = path.replace('/inbox', '').replace('/outbox', '') @@ -2152,7 +2169,8 @@ def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str, editProfileForm += \ _htmlEditProfileFiltering(baseDir, nickname, domain, userAgentsBlocked, translate, - replyIntervalHours) + replyIntervalHours, + CWlists, listsEnabled) # git projects section editProfileForm += \