From 4f111a189aafb2ccc31b30f8f87dcfd744925e70 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 8 Nov 2021 20:21:54 +0000 Subject: [PATCH] Set content license from admin profile --- daemon.py | 18 ++++++++++++++++++ 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 | 8 ++++++++ 19 files changed, 60 insertions(+), 17 deletions(-) diff --git a/daemon.py b/daemon.py index 7efe607a8..839efb229 100644 --- a/daemon.py +++ b/daemon.py @@ -4903,6 +4903,24 @@ class PubServer(BaseHTTPRequestHandler): setConfigParam(baseDir, 'libretranslateApiKey', '') + # change instance short description + if fields.get('contentLicenseUrl'): + if fields['contentLicenseUrl'] != \ + self.server.contentLicenseUrl: + licenseStr = fields['contentLicenseUrl'] + setConfigParam(baseDir, + 'contentLicenseUrl', + licenseStr) + self.server.contentLicenseUrl = \ + licenseStr + else: + licenseStr = \ + 'https://creativecommons.org/licenses/by/4.0' + setConfigParam(baseDir, + 'contentLicenseUrl', + licenseStr) + self.server.contentLicenseUrl = licenseStr + # change instance short description currInstanceDescriptionShort = \ getConfigParam(baseDir, diff --git a/translations/ar.json b/translations/ar.json index f71b30e40..53e3d7da9 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -491,5 +491,6 @@ "System Monitor": "مراقب النظام", "Add content warnings for the following sites": "أضف تحذيرات المحتوى للمواقع التالية", "Known Web Crawlers": "برامج زحف الويب المعروفة", - "Add to the calendar": "أضف إلى التقويم" + "Add to the calendar": "أضف إلى التقويم", + "Content License": "ترخيص المحتوى" } diff --git a/translations/ca.json b/translations/ca.json index 07205607c..fb0b7340d 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -491,5 +491,6 @@ "System Monitor": "Monitor del sistema", "Add content warnings for the following sites": "Afegiu advertiments de contingut per als llocs següents", "Known Web Crawlers": "Exploradors web coneguts", - "Add to the calendar": "Afegeix al calendari" + "Add to the calendar": "Afegeix al calendari", + "Content License": "Llicència de contingut" } diff --git a/translations/cy.json b/translations/cy.json index 6a3715cb6..d1eaf3d76 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -491,5 +491,6 @@ "System Monitor": "Monitor System", "Add content warnings for the following sites": "Ychwanegwch rybuddion cynnwys ar gyfer y gwefannau canlynol", "Known Web Crawlers": "Crawlers Gwe Hysbys", - "Add to the calendar": "Ychwanegwch at y calendr" + "Add to the calendar": "Ychwanegwch at y calendr", + "Content License": "Trwydded Cynnwys" } diff --git a/translations/de.json b/translations/de.json index da33ff00f..a94268597 100644 --- a/translations/de.json +++ b/translations/de.json @@ -491,5 +491,6 @@ "System Monitor": "Systemmonitor", "Add content warnings for the following sites": "Inhaltswarnungen für die folgenden Websites hinzufügen", "Known Web Crawlers": "Bekannte Web-Crawler", - "Add to the calendar": "Zum Kalender hinzufügen" + "Add to the calendar": "Zum Kalender hinzufügen", + "Content License": "Inhaltslizenz" } diff --git a/translations/en.json b/translations/en.json index 551749a49..d96083f0b 100644 --- a/translations/en.json +++ b/translations/en.json @@ -491,5 +491,6 @@ "System Monitor": "System Monitor", "Add content warnings for the following sites": "Add content warnings for the following sites", "Known Web Crawlers": "Known Web Crawlers", - "Add to the calendar": "Add to the calendar" + "Add to the calendar": "Add to the calendar", + "Content License": "Content License" } diff --git a/translations/es.json b/translations/es.json index d89b835ec..00a945f28 100644 --- a/translations/es.json +++ b/translations/es.json @@ -491,5 +491,6 @@ "System Monitor": "Monitor del sistema", "Add content warnings for the following sites": "Agregue advertencias de contenido para los siguientes sitios", "Known Web Crawlers": "Rastreadores web conocidos", - "Add to the calendar": "Agregar al calendario" + "Add to the calendar": "Agregar al calendario", + "Content License": "Licencia de contenido" } diff --git a/translations/fr.json b/translations/fr.json index 73982bb9e..0d082c4a9 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -491,5 +491,6 @@ "System Monitor": "Moniteur système", "Add content warnings for the following sites": "Ajouter des avertissements de contenu pour les sites suivants", "Known Web Crawlers": "Crawlers Web connus", - "Add to the calendar": "Ajouter au calendrier" + "Add to the calendar": "Ajouter au calendrier", + "Content License": "Licence de contenu" } diff --git a/translations/ga.json b/translations/ga.json index 8af1069ed..1d91c0471 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -491,5 +491,6 @@ "System Monitor": "Monatóir Córais", "Add content warnings for the following sites": "Cuir rabhaidh ábhair leis na suíomhanna seo a leanas", "Known Web Crawlers": "Crawlers Gréasáin Aitheanta", - "Add to the calendar": "Cuir leis an bhféilire" + "Add to the calendar": "Cuir leis an bhféilire", + "Content License": "Ceadúnas Ábhar" } diff --git a/translations/hi.json b/translations/hi.json index e044eb261..93a81c7e6 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -491,5 +491,6 @@ "System Monitor": "सिस्टम मॉनिटर", "Add content warnings for the following sites": "निम्नलिखित साइटों के लिए सामग्री चेतावनियाँ जोड़ें", "Known Web Crawlers": "ज्ञात वेब क्रॉलर", - "Add to the calendar": "कैलेंडर में जोड़ें" + "Add to the calendar": "कैलेंडर में जोड़ें", + "Content License": "सामग्री लाइसेंस" } diff --git a/translations/it.json b/translations/it.json index c847b5dc5..64319f34a 100644 --- a/translations/it.json +++ b/translations/it.json @@ -491,5 +491,6 @@ "System Monitor": "Monitor di sistema", "Add content warnings for the following sites": "Aggiungi avvisi sui contenuti per i seguenti siti", "Known Web Crawlers": "Crawler Web conosciuti", - "Add to the calendar": "Aggiungi al calendario" + "Add to the calendar": "Aggiungi al calendario", + "Content License": "Licenza sui contenuti" } diff --git a/translations/ja.json b/translations/ja.json index 17f939fbe..89b880f99 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -491,5 +491,6 @@ "System Monitor": "システムモニター", "Add content warnings for the following sites": "次のサイトのコンテンツ警告を追加します", "Known Web Crawlers": "既知のWebクローラー", - "Add to the calendar": "カレンダーに追加" + "Add to the calendar": "カレンダーに追加", + "Content License": "コンテンツライセンス" } diff --git a/translations/ku.json b/translations/ku.json index 36698735f..54edfdbb8 100644 --- a/translations/ku.json +++ b/translations/ku.json @@ -491,5 +491,6 @@ "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", "Known Web Crawlers": "Crawlerên Webê yên naskirî", - "Add to the calendar": "Di salnameyê de zêde bike" + "Add to the calendar": "Di salnameyê de zêde bike", + "Content License": "Naverok License de" } diff --git a/translations/oc.json b/translations/oc.json index dc898e1e4..8240c4a8e 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -487,5 +487,6 @@ "System Monitor": "System Monitor", "Add content warnings for the following sites": "Add content warnings for the following sites", "Known Web Crawlers": "Known Web Crawlers", - "Add to the calendar": "Add to the calendar" + "Add to the calendar": "Add to the calendar", + "Content License": "Content License" } diff --git a/translations/pt.json b/translations/pt.json index 936c7f095..958a40f6f 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -491,5 +491,6 @@ "System Monitor": "Monitor de Sistema", "Add content warnings for the following sites": "Adicione avisos de conteúdo para os seguintes sites", "Known Web Crawlers": "Rastreadores da Web conhecidos", - "Add to the calendar": "Adicionar ao calendário" + "Add to the calendar": "Adicionar ao calendário", + "Content License": "Licença de Conteúdo" } diff --git a/translations/ru.json b/translations/ru.json index bb92161d9..d59bf4869 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -491,5 +491,6 @@ "System Monitor": "Системный монитор", "Add content warnings for the following sites": "Добавить предупреждения о содержании для следующих сайтов", "Known Web Crawlers": "Известные веб-сканеры", - "Add to the calendar": "Добавить в календарь" + "Add to the calendar": "Добавить в календарь", + "Content License": "Лицензия на содержание" } diff --git a/translations/sw.json b/translations/sw.json index aace5f87e..d4a5ca713 100644 --- a/translations/sw.json +++ b/translations/sw.json @@ -491,5 +491,6 @@ "System Monitor": "Ufuatiliaji wa Mfumo", "Add content warnings for the following sites": "Ongeza maonyo ya yaliyomo kwa wavuti zifuatazo", "Known Web Crawlers": "Watambaji Wavuti Wanaojulikana", - "Add to the calendar": "Ongeza kwenye kalenda" + "Add to the calendar": "Ongeza kwenye kalenda", + "Content License": "Leseni ya Maudhui" } diff --git a/translations/zh.json b/translations/zh.json index bde6635db..a698fb5ce 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -491,5 +491,6 @@ "System Monitor": "系统监视器", "Add content warnings for the following sites": "为以下网站添加内容警告", "Known Web Crawlers": "已知的网络爬虫", - "Add to the calendar": "添加到日历" + "Add to the calendar": "添加到日历", + "Content License": "内容许可" } diff --git a/webapp_profile.py b/webapp_profile.py index 795168255..269851597 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -1286,6 +1286,10 @@ def _htmlEditProfileInstance(baseDir: str, translate: {}, getConfigParam(baseDir, 'instanceDescriptionShort') instanceTitle = \ getConfigParam(baseDir, 'instanceTitle') + contentLicenseUrl = \ + getConfigParam(baseDir, 'contentLicenseUrl') + if not contentLicenseUrl: + contentLicenseUrl = 'https://creativecommons.org/licenses/by/4.0' instanceStr = beginEditSection(translate['Instance Settings']) @@ -1301,6 +1305,10 @@ def _htmlEditProfileInstance(baseDir: str, translate: {}, editTextArea(translate['Instance Description'], 'instanceDescription', instanceDescription, 200, '', True) + instanceStr += \ + editTextField(translate['Content License'], + 'contentLicenseUrl', contentLicenseUrl) + instanceStr += '
\n' instanceStr += \ editTextField(translate['Custom post submit button text'], 'customSubmitText', customSubmitText)