diff --git a/posts.py b/posts.py index f9995bef3..a2bbba8dc 100644 --- a/posts.py +++ b/posts.py @@ -3393,10 +3393,10 @@ def downloadFollowersCollection(session, httpPrefix, } result = [] for pageCtr in range(noOfPages): + url = actor + '/followers?page=' + str(pageNumber + pageCtr) followersJson = \ - getJson(session, actor + '/followers?page=' + - str(pageNumber + pageCtr), - sessionHeaders, None, __version__, httpPrefix, None) + getJson(session, url, sessionHeaders, None, __version__, + httpPrefix, None) if followersJson: if followersJson.get('orderedItems'): result += followersJson['orderedItems'] diff --git a/translations/ar.json b/translations/ar.json index 658be63fe..a7118b656 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -351,5 +351,6 @@ "Peertube Instances": "مثيلات Peertube", "Show video previews for the following Peertube sites.": "إظهار معاينات الفيديو لمواقع Peertube التالية.", "Follows you": "يتبعك", - "Verify all signatures": "تحقق من جميع التوقيعات" + "Verify all signatures": "تحقق من جميع التوقيعات", + "Blocked followers": "المتابعون المحظورون" } diff --git a/translations/ca.json b/translations/ca.json index 06ea47e6d..1644b9298 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -351,5 +351,6 @@ "Peertube Instances": "Instàncies de Peertube", "Show video previews for the following Peertube sites.": "Mostra les previsualitzacions de vídeo dels següents llocs de Peertube.", "Follows you": "Et segueix", - "Verify all signatures": "Verifiqueu totes les signatures" + "Verify all signatures": "Verifiqueu totes les signatures", + "Blocked followers": "Seguidors bloquejats" } diff --git a/translations/cy.json b/translations/cy.json index a610b167a..8f5ed3655 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -351,5 +351,6 @@ "Peertube Instances": "Camau Peertube", "Show video previews for the following Peertube sites.": "Dangos rhagolygon fideo ar gyfer y safleoedd Peertube canlynol.", "Follows you": "Yn eich dilyn chi", - "Verify all signatures": "Gwirio pob llofnod" + "Verify all signatures": "Gwirio pob llofnod", + "Blocked followers": "Dilynwyr wedi'u blocio" } diff --git a/translations/de.json b/translations/de.json index cdf9aaefa..617f3fe30 100644 --- a/translations/de.json +++ b/translations/de.json @@ -351,5 +351,6 @@ "Peertube Instances": "Peertube-Instanzen", "Show video previews for the following Peertube sites.": "Zeigen Sie eine Videovorschau für die folgenden Peertube-Websites an.", "Follows you": "Folgt dir", - "Verify all signatures": "Überprüfen Sie alle Signaturen" + "Verify all signatures": "Überprüfen Sie alle Signaturen", + "Blocked followers": "Blockierte Follower" } diff --git a/translations/en.json b/translations/en.json index 40537ba17..5c881a9f5 100644 --- a/translations/en.json +++ b/translations/en.json @@ -351,5 +351,6 @@ "Peertube Instances": "Peertube Instances", "Show video previews for the following Peertube sites.": "Show video previews for the following Peertube sites.", "Follows you": "Follows you", - "Verify all signatures": "Verify all signatures" + "Verify all signatures": "Verify all signatures", + "Blocked followers": "Blocked followers" } diff --git a/translations/es.json b/translations/es.json index f63b2d4ea..ae2226f2b 100644 --- a/translations/es.json +++ b/translations/es.json @@ -351,5 +351,6 @@ "Peertube Instances": "Instancias de Peertube", "Show video previews for the following Peertube sites.": "Muestre vistas previas de video para los siguientes sitios de Peertube.", "Follows you": "Te sigue", - "Verify all signatures": "Verificar todas las firmas" + "Verify all signatures": "Verificar todas las firmas", + "Blocked followers": "Seguidores bloqueadas" } diff --git a/translations/fr.json b/translations/fr.json index 1ae6dc989..ee0f201b1 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -351,5 +351,6 @@ "Peertube Instances": "Instances Peertube", "Show video previews for the following Peertube sites.": "Afficher des aperçus vidéo pour les sites Peertube suivants.", "Follows you": "Vous suit", - "Verify all signatures": "Vérifier toutes les signatures" + "Verify all signatures": "Vérifier toutes les signatures", + "Blocked followers": "Abonnés bloqués" } diff --git a/translations/ga.json b/translations/ga.json index ef2f77fef..5f4910914 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -351,5 +351,6 @@ "Peertube Instances": "Imeachtaí Peertube", "Show video previews for the following Peertube sites.": "Taispeáin réamhamharcanna físe do na suíomhanna Peertube seo a leanas.", "Follows you": "Leanann tú", - "Verify all signatures": "Fíoraigh gach síniú" + "Verify all signatures": "Fíoraigh gach síniú", + "Blocked followers": "Leanúna blocáilte" } diff --git a/translations/hi.json b/translations/hi.json index 232cb54c2..833936d41 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -351,5 +351,6 @@ "Peertube Instances": "Peertube उदाहरण", "Show video previews for the following Peertube sites.": "निम्नलिखित Peertube साइटों के लिए वीडियो पूर्वावलोकन दिखाएं।", "Follows you": "आपका पीछा करता है", - "Verify all signatures": "सभी हस्ताक्षर सत्यापित करें" + "Verify all signatures": "सभी हस्ताक्षर सत्यापित करें", + "Blocked followers": "अवरुद्ध अनुयायियों" } diff --git a/translations/it.json b/translations/it.json index 1ad7efef6..738506da0 100644 --- a/translations/it.json +++ b/translations/it.json @@ -351,5 +351,6 @@ "Peertube Instances": "Istanze di Peertube", "Show video previews for the following Peertube sites.": "Mostra le anteprime dei video per i seguenti siti Peertube.", "Follows you": "Ti segue", - "Verify all signatures": "Verifica tutte le firme" + "Verify all signatures": "Verifica tutte le firme", + "Blocked followers": "Follower bloccati" } diff --git a/translations/ja.json b/translations/ja.json index 7606a7aff..435ad87e2 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -351,5 +351,6 @@ "Peertube Instances": "Peertubeインスタンス", "Show video previews for the following Peertube sites.": "次のPeertubeサイトのビデオプレビューを表示します。", "Follows you": "あなたについていきます", - "Verify all signatures": "すべての署名を確認する" + "Verify all signatures": "すべての署名を確認する", + "Blocked followers": "ブロックされたフォロワー" } diff --git a/translations/oc.json b/translations/oc.json index 07b9569c6..7daebb706 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -347,5 +347,6 @@ "Peertube Instances": "Peertube Instances", "Show video previews for the following Peertube sites.": "Show video previews for the following Peertube sites.", "Follows you": "Follows you", - "Verify all signatures": "Verify all signatures" + "Verify all signatures": "Verify all signatures", + "Blocked followers": "Blocked followers" } diff --git a/translations/pt.json b/translations/pt.json index 183b73d09..c18849d25 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -351,5 +351,6 @@ "Peertube Instances": "Instâncias Peertube", "Show video previews for the following Peertube sites.": "Mostrar visualizações de vídeo para os seguintes sites Peertube.", "Follows you": "Segue você", - "Verify all signatures": "Verifique todas as assinaturas" + "Verify all signatures": "Verifique todas as assinaturas", + "Blocked followers": "Seguidores bloqueados" } diff --git a/translations/ru.json b/translations/ru.json index 147a699a8..2380e6191 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -351,5 +351,6 @@ "Peertube Instances": "Экземпляры Peertube", "Show video previews for the following Peertube sites.": "Показать превью видео для следующих сайтов Peertube.", "Follows you": "Следует за вами", - "Verify all signatures": "Проверить все подписи" + "Verify all signatures": "Проверить все подписи", + "Blocked followers": "Заблокированные подписчики" } diff --git a/translations/zh.json b/translations/zh.json index 23a46718d..c6d5af6c9 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -351,5 +351,6 @@ "Peertube Instances": "Peertube实例", "Show video previews for the following Peertube sites.": "显示以下Peertube网站的视频预览。", "Follows you": "跟着你", - "Verify all signatures": "验证所有签名" + "Verify all signatures": "验证所有签名", + "Blocked followers": "被封锁的追随者" } diff --git a/webapp_moderation.py b/webapp_moderation.py index c18e5163d..34b2c631b 100644 --- a/webapp_moderation.py +++ b/webapp_moderation.py @@ -7,10 +7,12 @@ __email__ = "bob@freedombone.net" __status__ = "Production" import os +from utils import getFullDomain from utils import isEditor from utils import loadJson from utils import getNicknameFromActor from utils import getDomainFromActor +from posts import downloadFollowersCollection from posts import getPublicPostInfo from posts import isModerator from webapp_timeline import htmlTimeline @@ -19,6 +21,8 @@ from webapp_utils import getContentWarningButton from webapp_utils import htmlHeaderWithExternalStyle from webapp_utils import htmlFooter from blocking import isBlockedDomain +from blocking import isBlocked +from session import createSession def htmlModeration(cssCache: {}, defaultTimeline: str, @@ -76,25 +80,42 @@ def htmlAccountInfo(cssCache: {}, translate: {}, searchDomain, searchPort = getDomainFromActor(searchHandle) searchHandle = searchNickname + '@' + searchDomain + searchActor = \ + httpPrefix + '://' + searchDomain + '/users/' + searchNickname infoForm += \ '

' + \ - translate['Account Information'] + ': ' + searchHandle + '


' + translate['Account Information'] + ': ' + searchHandle + '
\n' - infoForm += translate[msgStr1] + '


' + infoForm += translate[msgStr1] + '

\n' proxyType = 'tor' if not os.path.isfile('/usr/bin/tor'): proxyType = None if domain.endswith('.i2p'): proxyType = None - domainDict = getPublicPostInfo(None, + + session = createSession(proxyType) + + domainDict = getPublicPostInfo(session, baseDir, searchNickname, searchDomain, proxyType, searchPort, httpPrefix, debug, __version__) - infoForm += '
' + + # get a list of any blocked followers + followersList = \ + downloadFollowersCollection(session, httpPrefix, searchActor, 1, 5) + blockedFollowers = [] + for followerActor in followersList: + followerNickname = getNicknameFromActor(followerActor) + followerDomain, followerPort = getDomainFromActor(followerActor) + followerDomainFull = getFullDomain(followerDomain, followerPort) + if isBlocked(baseDir, nickname, domain, + followerNickname, followerDomainFull): + blockedFollowers.append(followerActor) + + infoForm += '
\n' usersPath = '/users/' + nickname + '/accountinfo' ctr = 1 for postDomain, blockedPostUrls in domainDict.items(): @@ -122,7 +143,7 @@ def htmlAccountInfo(cssCache: {}, translate: {}, '?handle=' + searchHandle + '">' infoForm += ' ' + \ - blockedPostsHtml + blockedPostsHtml + '\n' else: infoForm += \ '' + \ translate['Block'] + '' - infoForm += '' - infoForm += '
' + infoForm += '\n' + infoForm += '
\n' + + infoForm += '
\n' + + if blockedFollowers: + blockedFollowers.sort() + infoForm += '
\n' + infoForm += '

' + translate['Blocked followers'] + '

\n' + for actor in blockedFollowers: + infoForm += '' + actor + '
\n' + infoForm += '
\n' - infoForm += '
' infoForm += htmlFooter() return infoForm