diff --git a/epicyon.py b/epicyon.py index eae3b83c1..47c85c493 100644 --- a/epicyon.py +++ b/epicyon.py @@ -15,7 +15,7 @@ from person import deactivateAccount from skills import setSkillLevel from roles import setRole from webfinger import webfingerHandle -from posts import downloadFollowersCollection +from posts import downloadFollowCollection from posts import getPublicPostDomains from posts import getPublicPostDomainsBlocked from posts import sendBlockViaServer @@ -1578,7 +1578,8 @@ if args.followers: } followersList = \ - downloadFollowersCollection(session, httpPrefix, personUrl, 1, 3) + downloadFollowCollection('followers', session, + httpPrefix, personUrl, 1, 3) if followersList: for actor in followersList: print(actor) diff --git a/posts.py b/posts.py index 10fa3e316..c775ce784 100644 --- a/posts.py +++ b/posts.py @@ -3376,11 +3376,12 @@ def getPublicPostDomains(session, baseDir: str, nickname: str, domain: str, return postDomains -def downloadFollowersCollection(session, httpPrefix, - actor: str, pageNumber=1, - noOfPages=1) -> []: - """Returns a list of followers for the given actor - by downloading the json for their followers collection +def downloadFollowCollection(followType: str, + session, httpPrefix, + actor: str, pageNumber=1, + noOfPages=1) -> []: + """Returns a list of following/followers for the given actor + by downloading the json for their following/followers collection """ prof = 'https://www.w3.org/ns/activitystreams' if '/channel/' not in actor or '/accounts/' not in actor: @@ -3393,7 +3394,7 @@ def downloadFollowersCollection(session, httpPrefix, } result = [] for pageCtr in range(noOfPages): - url = actor + '/followers?page=' + str(pageNumber + pageCtr) + url = actor + '/' + followType + '?page=' + str(pageNumber + pageCtr) followersJson = \ getJson(session, url, sessionHeaders, None, __version__, httpPrefix, None) diff --git a/translations/ar.json b/translations/ar.json index a7118b656..910b893ff 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -352,5 +352,8 @@ "Show video previews for the following Peertube sites.": "إظهار معاينات الفيديو لمواقع Peertube التالية.", "Follows you": "يتبعك", "Verify all signatures": "تحقق من جميع التوقيعات", - "Blocked followers": "المتابعون المحظورون" + "Blocked followers": "المتابعون المحظورون", + "Blocked following": "", + "Receives posts from the following accounts": "", + "Sends out posts to the following accounts": "" } diff --git a/translations/ca.json b/translations/ca.json index 1644b9298..223325d3a 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -352,5 +352,8 @@ "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", - "Blocked followers": "Seguidors bloquejats" + "Blocked followers": "Seguidors bloquejats", + "Blocked following": "", + "Receives posts from the following accounts": "", + "Sends out posts to the following accounts": "" } diff --git a/translations/cy.json b/translations/cy.json index 8f5ed3655..8a286a9a8 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -352,5 +352,8 @@ "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", - "Blocked followers": "Dilynwyr wedi'u blocio" + "Blocked followers": "Dilynwyr wedi'u blocio", + "Blocked following": "", + "Receives posts from the following accounts": "", + "Sends out posts to the following accounts": "" } diff --git a/translations/de.json b/translations/de.json index 617f3fe30..4c3043758 100644 --- a/translations/de.json +++ b/translations/de.json @@ -352,5 +352,8 @@ "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", - "Blocked followers": "Blockierte Follower" + "Blocked followers": "Blockierte Follower", + "Blocked following": "", + "Receives posts from the following accounts": "", + "Sends out posts to the following accounts": "" } diff --git a/translations/en.json b/translations/en.json index 5c881a9f5..07c7fd653 100644 --- a/translations/en.json +++ b/translations/en.json @@ -352,5 +352,8 @@ "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", - "Blocked followers": "Blocked followers" + "Blocked followers": "Blocked followers", + "Blocked following": "Blocked following", + "Receives posts from the following accounts": "Receives posts from the following accounts", + "Sends out posts to the following accounts": "Sends out posts to the following accounts" } diff --git a/translations/es.json b/translations/es.json index ae2226f2b..104c3dad4 100644 --- a/translations/es.json +++ b/translations/es.json @@ -352,5 +352,8 @@ "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", - "Blocked followers": "Seguidores bloqueadas" + "Blocked followers": "Seguidores bloqueadas", + "Blocked following": "", + "Receives posts from the following accounts": "", + "Sends out posts to the following accounts": "" } diff --git a/translations/fr.json b/translations/fr.json index ee0f201b1..46de63b12 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -352,5 +352,8 @@ "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", - "Blocked followers": "Abonnés bloqués" + "Blocked followers": "Abonnés bloqués", + "Blocked following": "", + "Receives posts from the following accounts": "", + "Sends out posts to the following accounts": "" } diff --git a/translations/ga.json b/translations/ga.json index 5f4910914..916f045f1 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -352,5 +352,8 @@ "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ú", - "Blocked followers": "Leanúna blocáilte" + "Blocked followers": "Leanúna blocáilte", + "Blocked following": "", + "Receives posts from the following accounts": "", + "Sends out posts to the following accounts": "" } diff --git a/translations/hi.json b/translations/hi.json index 833936d41..4d423fea3 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -352,5 +352,8 @@ "Show video previews for the following Peertube sites.": "निम्नलिखित Peertube साइटों के लिए वीडियो पूर्वावलोकन दिखाएं।", "Follows you": "आपका पीछा करता है", "Verify all signatures": "सभी हस्ताक्षर सत्यापित करें", - "Blocked followers": "अवरुद्ध अनुयायियों" + "Blocked followers": "अवरुद्ध अनुयायियों", + "Blocked following": "", + "Receives posts from the following accounts": "", + "Sends out posts to the following accounts": "" } diff --git a/translations/it.json b/translations/it.json index 738506da0..2b5c6cd0f 100644 --- a/translations/it.json +++ b/translations/it.json @@ -352,5 +352,8 @@ "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", - "Blocked followers": "Follower bloccati" + "Blocked followers": "Follower bloccati", + "Blocked following": "", + "Receives posts from the following accounts": "", + "Sends out posts to the following accounts": "" } diff --git a/translations/ja.json b/translations/ja.json index 435ad87e2..ecefa5da1 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -352,5 +352,8 @@ "Show video previews for the following Peertube sites.": "次のPeertubeサイトのビデオプレビューを表示します。", "Follows you": "あなたについていきます", "Verify all signatures": "すべての署名を確認する", - "Blocked followers": "ブロックされたフォロワー" + "Blocked followers": "ブロックされたフォロワー", + "Blocked following": "", + "Receives posts from the following accounts": "", + "Sends out posts to the following accounts": "" } diff --git a/translations/oc.json b/translations/oc.json index 7daebb706..87b99583a 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -348,5 +348,8 @@ "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", - "Blocked followers": "Blocked followers" + "Blocked followers": "Blocked followers", + "Blocked following": "Blocked following", + "Receives posts from the following accounts": "Receives posts from the following accounts", + "Sends out posts to the following accounts": "Sends out posts to the following accounts" } diff --git a/translations/pt.json b/translations/pt.json index c18849d25..9e1506482 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -352,5 +352,8 @@ "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", - "Blocked followers": "Seguidores bloqueados" + "Blocked followers": "Seguidores bloqueados", + "Blocked following": "", + "Receives posts from the following accounts": "", + "Sends out posts to the following accounts": "" } diff --git a/translations/ru.json b/translations/ru.json index 2380e6191..ded92510f 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -352,5 +352,8 @@ "Show video previews for the following Peertube sites.": "Показать превью видео для следующих сайтов Peertube.", "Follows you": "Следует за вами", "Verify all signatures": "Проверить все подписи", - "Blocked followers": "Заблокированные подписчики" + "Blocked followers": "Заблокированные подписчики", + "Blocked following": "", + "Receives posts from the following accounts": "", + "Sends out posts to the following accounts": "" } diff --git a/translations/zh.json b/translations/zh.json index c6d5af6c9..4dbfb6dcc 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -352,5 +352,8 @@ "Show video previews for the following Peertube sites.": "显示以下Peertube网站的视频预览。", "Follows you": "跟着你", "Verify all signatures": "验证所有签名", - "Blocked followers": "被封锁的追随者" + "Blocked followers": "被封锁的追随者", + "Blocked following": "", + "Receives posts from the following accounts": "", + "Sends out posts to the following accounts": "" } diff --git a/webapp_moderation.py b/webapp_moderation.py index 12c72f8f2..f3d17db09 100644 --- a/webapp_moderation.py +++ b/webapp_moderation.py @@ -12,7 +12,7 @@ from utils import isEditor from utils import loadJson from utils import getNicknameFromActor from utils import getDomainFromActor -from posts import downloadFollowersCollection +from posts import downloadFollowCollection from posts import getPublicPostInfo from posts import isModerator from webapp_timeline import htmlTimeline @@ -105,7 +105,8 @@ def htmlAccountInfo(cssCache: {}, translate: {}, # get a list of any blocked followers followersList = \ - downloadFollowersCollection(session, httpPrefix, searchActor, 1, 5) + downloadFollowCollection('followers', session, + httpPrefix, searchActor, 1, 5) blockedFollowers = [] for followerActor in followersList: followerNickname = getNicknameFromActor(followerActor) @@ -115,6 +116,19 @@ def htmlAccountInfo(cssCache: {}, translate: {}, followerNickname, followerDomainFull): blockedFollowers.append(followerActor) + # get a list of any blocked following + followingList = \ + downloadFollowCollection('following', session, + httpPrefix, searchActor, 1, 5) + blockedFollowing = [] + for followingActor in followingList: + followingNickname = getNicknameFromActor(followingActor) + followingDomain, followingPort = getDomainFromActor(followingActor) + followingDomainFull = getFullDomain(followingDomain, followingPort) + if isBlocked(baseDir, nickname, domain, + followingNickname, followingDomainFull): + blockedFollowing.append(followingActor) + infoForm += '
\n' usersPath = '/users/' + nickname + '/accountinfo' ctr = 1 @@ -156,10 +170,32 @@ def htmlAccountInfo(cssCache: {}, translate: {}, infoForm += '
\n' + if blockedFollowing: + blockedFollowing.sort() + infoForm += '
\n' + infoForm += '

' + translate['Blocked following'] + '

\n' + infoForm += \ + '

' + \ + translate['Receives posts from the following accounts'] + \ + '

\n' + for actor in blockedFollowing: + followingNickname = getNicknameFromActor(actor) + followingDomain, followingPort = getDomainFromActor(actor) + followingDomainFull = \ + getFullDomain(followingDomain, followingPort) + infoForm += '' + \ + followingNickname + '@' + followingDomainFull + \ + '

\n' + infoForm += '
\n' + if blockedFollowers: blockedFollowers.sort() infoForm += '
\n' infoForm += '

' + translate['Blocked followers'] + '

\n' + infoForm += \ + '

' + \ + translate['Sends out posts to the following accounts'] + \ + '

\n' for actor in blockedFollowers: followerNickname = getNicknameFromActor(actor) followerDomain, followerPort = getDomainFromActor(actor)