Also show blocked following on account info

merge-requests/30/head
Bob Mottram 2021-01-11 10:08:05 +00:00
parent a19a318f9f
commit 80587cf83b
18 changed files with 108 additions and 25 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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"
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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"
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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 += '<div class="accountInfoDomains">\n'
usersPath = '/users/' + nickname + '/accountinfo'
ctr = 1
@ -156,10 +170,32 @@ def htmlAccountInfo(cssCache: {}, translate: {},
infoForm += '</div>\n'
if blockedFollowing:
blockedFollowing.sort()
infoForm += '<div class="accountInfoDomains">\n'
infoForm += '<h1>' + translate['Blocked following'] + '</h1>\n'
infoForm += \
'<p>' + \
translate['Receives posts from the following accounts'] + \
'</p>\n'
for actor in blockedFollowing:
followingNickname = getNicknameFromActor(actor)
followingDomain, followingPort = getDomainFromActor(actor)
followingDomainFull = \
getFullDomain(followingDomain, followingPort)
infoForm += '<a href="' + actor + '">' + \
followingNickname + '@' + followingDomainFull + \
'</a><br><br>\n'
infoForm += '</div>\n'
if blockedFollowers:
blockedFollowers.sort()
infoForm += '<div class="accountInfoDomains">\n'
infoForm += '<h1>' + translate['Blocked followers'] + '</h1>\n'
infoForm += \
'<p>' + \
translate['Sends out posts to the following accounts'] + \
'</p>\n'
for actor in blockedFollowers:
followerNickname = getNicknameFromActor(actor)
followerDomain, followerPort = getDomainFromActor(actor)