diff --git a/daemon.py b/daemon.py index b9ea77887..aa4b55576 100644 --- a/daemon.py +++ b/daemon.py @@ -5084,8 +5084,7 @@ class PubServer(BaseHTTPRequestHandler): actorChanged = True # grayscale theme - if path.startswith('/users/' + - adminNickname + '/') or \ + if path.startswith('/users/' + adminNickname + '/') or \ isArtist(baseDir, nickname): grayscale = False if fields.get('grayscale'): @@ -5181,15 +5180,34 @@ class PubServer(BaseHTTPRequestHandler): if os.path.isfile(allowedInstancesFilename): os.remove(allowedInstancesFilename) - # save peertube instances list - peertubeInstancesFile = \ - baseDir + '/accounts/peertube.txt' - if fields.get('ptInstances'): - adminNickname = \ - getConfigParam(baseDir, 'admin') - if adminNickname and \ - path.startswith('/users/' + - adminNickname + '/'): + # save blocked user agents + # This is admin lebel and global to the instance + if path.startswith('/users/' + adminNickname + '/'): + userAgentsBlocked = [] + if fields.get('userAgentsBlockedStr'): + userAgentsBlockedStr = \ + fields['userAgentsBlockedStr'] + userAgentsBlockedList = \ + userAgentsBlockedStr.split('\n') + for ua in userAgentsBlockedList: + if ua in userAgentsBlocked: + continue + userAgentsBlocked.append(ua.strip()) + if str(self.server.userAgentsBlocked) != \ + str(userAgentsBlocked): + self.server.userAgentsBlocked = userAgentsBlocked + userAgentsBlockedStr = '' + for ua in userAgentsBlocked: + if userAgentsBlockedStr: + userAgentsBlockedStr += ',' + userAgentsBlockedStr += ua + setConfigParam(baseDir, 'userAgentsBlocked', + userAgentsBlockedStr) + + # save peertube instances list + peertubeInstancesFile = \ + baseDir + '/accounts/peertube.txt' + if fields.get('ptInstances'): self.server.peertubeInstances.clear() with open(peertubeInstancesFile, 'w+') as aFile: aFile.write(fields['ptInstances']) @@ -5203,10 +5221,10 @@ class PubServer(BaseHTTPRequestHandler): if url in self.server.peertubeInstances: continue self.server.peertubeInstances.append(url) - else: - if os.path.isfile(peertubeInstancesFile): - os.remove(peertubeInstancesFile) - self.server.peertubeInstances.clear() + else: + if os.path.isfile(peertubeInstancesFile): + os.remove(peertubeInstancesFile) + self.server.peertubeInstances.clear() # save git project names list gitProjectsFilename = \ @@ -10328,7 +10346,9 @@ class PubServer(BaseHTTPRequestHandler): self.server.themeName, peertubeInstances, self.server.textModeBanner, - city, accessKeys).encode('utf-8') + city, + self.server.userAgentsBlocked, + accessKeys).encode('utf-8') if msg: msglen = len(msg) self._set_headers('text/html', msglen, diff --git a/theme/debian/icons/calendar.png b/theme/debian/icons/calendar.png index 6d5789c3a..609425aa8 100644 Binary files a/theme/debian/icons/calendar.png and b/theme/debian/icons/calendar.png differ diff --git a/theme/debian/icons/calendar_notify.png b/theme/debian/icons/calendar_notify.png index 635f715b0..477fd0d2b 100644 Binary files a/theme/debian/icons/calendar_notify.png and b/theme/debian/icons/calendar_notify.png differ diff --git a/theme/debian/icons/newswire.png b/theme/debian/icons/newswire.png index f3521130d..8837c95ac 100644 Binary files a/theme/debian/icons/newswire.png and b/theme/debian/icons/newswire.png differ diff --git a/theme/debian/icons/scope_event.png b/theme/debian/icons/scope_event.png index 6d5789c3a..2759541d5 100644 Binary files a/theme/debian/icons/scope_event.png and b/theme/debian/icons/scope_event.png differ diff --git a/theme/default/icons/calendar.png b/theme/default/icons/calendar.png index 3afe1353a..0562fbbf0 100644 Binary files a/theme/default/icons/calendar.png and b/theme/default/icons/calendar.png differ diff --git a/theme/default/icons/calendar_notify.png b/theme/default/icons/calendar_notify.png index f118a83d9..24f1ccc73 100644 Binary files a/theme/default/icons/calendar_notify.png and b/theme/default/icons/calendar_notify.png differ diff --git a/theme/default/icons/newswire.png b/theme/default/icons/newswire.png index 61b0570eb..8837c95ac 100644 Binary files a/theme/default/icons/newswire.png and b/theme/default/icons/newswire.png differ diff --git a/theme/default/icons/scope_event.png b/theme/default/icons/scope_event.png index 3afe1353a..2759541d5 100644 Binary files a/theme/default/icons/scope_event.png and b/theme/default/icons/scope_event.png differ diff --git a/theme/henge/icons/calendar.png b/theme/henge/icons/calendar.png index eb21b795f..653cf84f4 100644 Binary files a/theme/henge/icons/calendar.png and b/theme/henge/icons/calendar.png differ diff --git a/theme/henge/icons/calendar_notify.png b/theme/henge/icons/calendar_notify.png index a8bb393b4..b056a8a85 100644 Binary files a/theme/henge/icons/calendar_notify.png and b/theme/henge/icons/calendar_notify.png differ diff --git a/theme/henge/icons/scope_event.png b/theme/henge/icons/scope_event.png index eb21b795f..d1b40beba 100644 Binary files a/theme/henge/icons/scope_event.png and b/theme/henge/icons/scope_event.png differ diff --git a/theme/light/icons/calendar.png b/theme/light/icons/calendar.png index 3d4eadcc2..8dfb24295 100644 Binary files a/theme/light/icons/calendar.png and b/theme/light/icons/calendar.png differ diff --git a/theme/light/icons/calendar_notify.png b/theme/light/icons/calendar_notify.png index 8887b3caa..16bf5e79c 100644 Binary files a/theme/light/icons/calendar_notify.png and b/theme/light/icons/calendar_notify.png differ diff --git a/theme/light/icons/newswire.png b/theme/light/icons/newswire.png index 99a3ad1a3..07210f589 100644 Binary files a/theme/light/icons/newswire.png and b/theme/light/icons/newswire.png differ diff --git a/theme/purple/icons/calendar.png b/theme/purple/icons/calendar.png index 3b3009d4f..5e73cb386 100644 Binary files a/theme/purple/icons/calendar.png and b/theme/purple/icons/calendar.png differ diff --git a/theme/purple/icons/calendar_notify.png b/theme/purple/icons/calendar_notify.png index cae61fe67..60d2f30ab 100644 Binary files a/theme/purple/icons/calendar_notify.png and b/theme/purple/icons/calendar_notify.png differ diff --git a/theme/purple/icons/newswire.png b/theme/purple/icons/newswire.png index 542a4f4c8..b71236642 100644 Binary files a/theme/purple/icons/newswire.png and b/theme/purple/icons/newswire.png differ diff --git a/theme/purple/icons/scope_event.png b/theme/purple/icons/scope_event.png index 3b3009d4f..77903ff15 100644 Binary files a/theme/purple/icons/scope_event.png and b/theme/purple/icons/scope_event.png differ diff --git a/theme/rc3/icons/calendar.png b/theme/rc3/icons/calendar.png index 9513e2aaa..d39f7c09e 100644 Binary files a/theme/rc3/icons/calendar.png and b/theme/rc3/icons/calendar.png differ diff --git a/theme/rc3/icons/calendar_notify.png b/theme/rc3/icons/calendar_notify.png index 0bfafad34..01a74849d 100644 Binary files a/theme/rc3/icons/calendar_notify.png and b/theme/rc3/icons/calendar_notify.png differ diff --git a/theme/rc3/icons/scope_event.png b/theme/rc3/icons/scope_event.png index 0b22d9560..c3b5f7e03 100644 Binary files a/theme/rc3/icons/scope_event.png and b/theme/rc3/icons/scope_event.png differ diff --git a/theme/starlight/icons/calendar.png b/theme/starlight/icons/calendar.png index cf9071585..ef0d413b2 100644 Binary files a/theme/starlight/icons/calendar.png and b/theme/starlight/icons/calendar.png differ diff --git a/theme/starlight/icons/calendar_notify.png b/theme/starlight/icons/calendar_notify.png index c704054d0..66191625e 100644 Binary files a/theme/starlight/icons/calendar_notify.png and b/theme/starlight/icons/calendar_notify.png differ diff --git a/theme/starlight/icons/scope_event.png b/theme/starlight/icons/scope_event.png index cf9071585..6860f310f 100644 Binary files a/theme/starlight/icons/scope_event.png and b/theme/starlight/icons/scope_event.png differ diff --git a/theme/zen/icons/calendar.png b/theme/zen/icons/calendar.png index 5a5e687d9..b9020884c 100644 Binary files a/theme/zen/icons/calendar.png and b/theme/zen/icons/calendar.png differ diff --git a/theme/zen/icons/calendar_notify.png b/theme/zen/icons/calendar_notify.png index 8fe306838..edf76fe06 100644 Binary files a/theme/zen/icons/calendar_notify.png and b/theme/zen/icons/calendar_notify.png differ diff --git a/theme/zen/icons/scope_event.png b/theme/zen/icons/scope_event.png index 7c597d200..6aa5323b4 100644 Binary files a/theme/zen/icons/scope_event.png and b/theme/zen/icons/scope_event.png differ diff --git a/translations/ar.json b/translations/ar.json index 9cae33396..270d3b503 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -448,5 +448,6 @@ "Graphic Design": "التصميم الجرافيكي", "Import Theme": "استيراد الموضوع", "Export Theme": "موضوع التصدير", - "Custom post submit button text": "عرف نشر إرسال نص زر" + "Custom post submit button text": "عرف نشر إرسال نص زر", + "Blocked User Agents": "عوامل المستخدم المحظورة" } diff --git a/translations/ca.json b/translations/ca.json index 9b7ec31d3..b445702f3 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -448,5 +448,6 @@ "Graphic Design": "Disseny gràfic", "Import Theme": "Importació temàtica", "Export Theme": "Tema d'exportació", - "Custom post submit button text": "Text de botó d'enviament de publicacions personalitzades" + "Custom post submit button text": "Text de botó d'enviament de publicacions personalitzades", + "Blocked User Agents": "Agents d'usuari bloquejats" } diff --git a/translations/cy.json b/translations/cy.json index dd289760d..680fa4c72 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -448,5 +448,6 @@ "Graphic Design": "Dylunio Graffig", "Import Theme": "Thema Mewnforio", "Export Theme": "Thema Allforio", - "Custom post submit button text": "Testun Post Post Post" + "Custom post submit button text": "Testun Post Post Post", + "Blocked User Agents": "Asiantau defnyddwyr wedi'u blocio" } diff --git a/translations/de.json b/translations/de.json index fd4ad86bb..2ec7c24b6 100644 --- a/translations/de.json +++ b/translations/de.json @@ -448,5 +448,6 @@ "Graphic Design": "Grafikdesign", "Import Theme": "Theme importieren", "Export Theme": "Theme exportieren", - "Custom post submit button text": "Benutzerdefinierte Post-Senden Schaltfläche Text" + "Custom post submit button text": "Benutzerdefinierte Post-Senden Schaltfläche Text", + "Blocked User Agents": "Blockierte Benutzeragenten" } diff --git a/translations/en.json b/translations/en.json index a076ae7b5..25dd4a83a 100644 --- a/translations/en.json +++ b/translations/en.json @@ -448,5 +448,6 @@ "Graphic Design": "Graphic Design", "Import Theme": "Import Theme", "Export Theme": "Export Theme", - "Custom post submit button text": "Custom post submit button text" + "Custom post submit button text": "Custom post submit button text", + "Blocked User Agents": "Blocked User Agents" } diff --git a/translations/es.json b/translations/es.json index fa727def8..1502da0e3 100644 --- a/translations/es.json +++ b/translations/es.json @@ -448,5 +448,6 @@ "Graphic Design": "Diseño gráfico", "Import Theme": "Tema de importación", "Export Theme": "Tema de exportación", - "Custom post submit button text": "POST POST PERSONALIZADO Botón Texto" + "Custom post submit button text": "POST POST PERSONALIZADO Botón Texto", + "Blocked User Agents": "Agentes de usuario bloqueados" } diff --git a/translations/fr.json b/translations/fr.json index 898a108db..57d4d369a 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -448,5 +448,6 @@ "Graphic Design": "Conception graphique", "Import Theme": "Import thème", "Export Theme": "Thème d'exportation", - "Custom post submit button text": "Texte de bouton d'envoi postal personnalisé" + "Custom post submit button text": "Texte de bouton d'envoi postal personnalisé", + "Blocked User Agents": "Agents d'utilisateur bloqués" } diff --git a/translations/ga.json b/translations/ga.json index 4b5cabc0b..ea04687fe 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -448,5 +448,6 @@ "Graphic Design": "Dearadh grafach", "Import Theme": "Téama Iompórtáil", "Export Theme": "Téama Easpórtála", - "Custom post submit button text": "Post saincheaptha Cuir isteach an cnaipe Téacs" + "Custom post submit button text": "Post saincheaptha Cuir isteach an cnaipe Téacs", + "Blocked User Agents": "Gníomhairí úsáideora blocáilte" } diff --git a/translations/hi.json b/translations/hi.json index b02de9fec..00ea6df4d 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -448,5 +448,6 @@ "Graphic Design": "ग्राफ़िक डिज़ाइन", "Import Theme": "आयात विषय", "Export Theme": "निर्यात विषय", - "Custom post submit button text": "कस्टम पोस्ट सबमिट बटन टेक्स्ट" + "Custom post submit button text": "कस्टम पोस्ट सबमिट बटन टेक्स्ट", + "Blocked User Agents": "अवरुद्ध उपयोगकर्ता एजेंट" } diff --git a/translations/it.json b/translations/it.json index 00271b324..12994e2ea 100644 --- a/translations/it.json +++ b/translations/it.json @@ -448,5 +448,6 @@ "Graphic Design": "Graphic design", "Import Theme": "Tema dell'importazione", "Export Theme": "Esportare tema", - "Custom post submit button text": "Pulsante di invio del post personalizzato" + "Custom post submit button text": "Pulsante di invio del post personalizzato", + "Blocked User Agents": "Agenti utente bloccati" } diff --git a/translations/ja.json b/translations/ja.json index 211b11d31..fdb96a967 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -448,5 +448,6 @@ "Graphic Design": "グラフィックデザイン", "Import Theme": "輸入テーマ", "Export Theme": "テーマをエクスポートします", - "Custom post submit button text": "カスタムポスト送信ボタンテキスト" + "Custom post submit button text": "カスタムポスト送信ボタンテキスト", + "Blocked User Agents": "ブロックされたユーザーエージェント" } diff --git a/translations/ku.json b/translations/ku.json index fe44eabcc..cf71e2f19 100644 --- a/translations/ku.json +++ b/translations/ku.json @@ -448,5 +448,6 @@ "Graphic Design": "Sêwirana grafîkî", "Import Theme": "Mijara Import", "Export Theme": "Mijara Export", - "Custom post submit button text": "Nivîsa bişkojka paşîn a paşîn" + "Custom post submit button text": "Nivîsa bişkojka paşîn a paşîn", + "Blocked User Agents": "Karmendên bikarhêner asteng kirin" } diff --git a/translations/oc.json b/translations/oc.json index 771d1d201..7c2df85d6 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -444,5 +444,6 @@ "Graphic Design": "Graphic Design", "Import Theme": "Import Theme", "Export Theme": "Export Theme", - "Custom post submit button text": "Custom post submit button text" + "Custom post submit button text": "Custom post submit button text", + "Blocked User Agents": "Blocked User Agents" } diff --git a/translations/pt.json b/translations/pt.json index 3014a750d..d7d303d1f 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -448,5 +448,6 @@ "Graphic Design": "Design gráfico", "Import Theme": "Importar tema", "Export Theme": "Exportar tema", - "Custom post submit button text": "Texto de botão de envio de post personalizado" + "Custom post submit button text": "Texto de botão de envio de post personalizado", + "Blocked User Agents": "Agentes de usuário bloqueados" } diff --git a/translations/ru.json b/translations/ru.json index 08d7e65ed..cfee8a392 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -448,5 +448,6 @@ "Graphic Design": "Графический дизайн", "Import Theme": "Импортировать тему", "Export Theme": "Экспортная тема", - "Custom post submit button text": "Пользовательский пост Отправить кнопку текста" + "Custom post submit button text": "Пользовательский пост Отправить кнопку текста", + "Blocked User Agents": "Заблокированные пользовательские агенты" } diff --git a/translations/sw.json b/translations/sw.json index dc97f9b15..0ac58b643 100644 --- a/translations/sw.json +++ b/translations/sw.json @@ -448,5 +448,6 @@ "Graphic Design": "Graphic design", "Import Theme": "Ingiza mandhari", "Export Theme": "Tuma mandhari", - "Custom post submit button text": "Ujumbe wa Desturi Wasilisha Nakala ya kifungo" + "Custom post submit button text": "Ujumbe wa Desturi Wasilisha Nakala ya kifungo", + "Blocked User Agents": "Wakala wa watumiaji waliozuiwa" } diff --git a/translations/zh.json b/translations/zh.json index 4098fe972..07b9e10c1 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -448,5 +448,6 @@ "Graphic Design": "平面设计", "Import Theme": "进口主题", "Export Theme": "出口主题", - "Custom post submit button text": "自定义发布提交按钮文本" + "Custom post submit button text": "自定义发布提交按钮文本", + "Blocked User Agents": "阻止用户代理商" } diff --git a/webapp_profile.py b/webapp_profile.py index 3ffcfdca9..eced71548 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -1414,7 +1414,7 @@ def _htmlEditProfileGitProjects(baseDir: str, nickname: str, domain: str, def _htmlEditProfileFiltering(baseDir: str, nickname: str, domain: str, - translate: {}) -> str: + userAgentsBlocked: str, translate: {}) -> str: """Filtering and blocking section of edit profile screen """ filterStr = '' @@ -1581,6 +1581,19 @@ def _htmlEditProfileFiltering(baseDir: str, nickname: str, domain: str, 'style="height:200px" spellcheck="false">' + \ allowedInstancesStr + '\n' + userAgentsBlockedStr = '' + for ua in userAgentsBlocked: + if userAgentsBlockedStr: + userAgentsBlockedStr += '\n' + userAgentsBlockedStr += ua + editProfileForm += \ + '
\n' + editProfileForm += \ + ' \n' + editProfileForm += ' \n' return editProfileForm @@ -1880,6 +1893,7 @@ def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str, defaultTimeline: str, theme: str, peertubeInstances: [], textModeBanner: str, city: str, + userAgentsBlocked: str, accessKeys: {}) -> str: """Shows the edit profile screen """ @@ -2056,7 +2070,8 @@ def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str, # Filtering and blocking section editProfileForm += \ - _htmlEditProfileFiltering(baseDir, nickname, domain, translate) + _htmlEditProfileFiltering(baseDir, nickname, domain, + userAgentsBlocked, translate) # git projects section editProfileForm += \