Show blocked followers in account info

merge-requests/8/head
Bob Mottram 2021-01-10 23:06:38 +00:00
parent de94fdc1f1
commit 926f387b93
17 changed files with 73 additions and 28 deletions

View File

@ -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']

View File

@ -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": "المتابعون المحظورون"
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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": "अवरुद्ध अनुयायियों"
}

View File

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

View File

@ -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": "ブロックされたフォロワー"
}

View File

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

View File

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

View File

@ -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": "Заблокированные подписчики"
}

View File

@ -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": "被封锁的追随者"
}

View File

@ -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 += \
'<center><h1><a href="/users/' + nickname + '/moderation">' + \
translate['Account Information'] + ':</a> <a href="' + \
httpPrefix + '://' + searchDomain + '/users/' + searchNickname + \
'">' + searchHandle + '</a></h1><br>'
translate['Account Information'] + ':</a> <a href="' + searchActor + \
'">' + searchHandle + '</a></h1><br>\n'
infoForm += translate[msgStr1] + '</center><br><br>'
infoForm += translate[msgStr1] + '</center><br><br>\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 += '<div class="accountInfoDomains">'
# 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 += '<div class="accountInfoDomains">\n'
usersPath = '/users/' + nickname + '/accountinfo'
ctr = 1
for postDomain, blockedPostUrls in domainDict.items():
@ -122,7 +143,7 @@ def htmlAccountInfo(cssCache: {}, translate: {},
'?handle=' + searchHandle + '">'
infoForm += '<button class="buttonhighlighted"><span>' + \
translate['Unblock'] + '</span></button></a> ' + \
blockedPostsHtml
blockedPostsHtml + '\n'
else:
infoForm += \
'<a href="' + usersPath + '?blockdomain=' + postDomain + \
@ -130,10 +151,19 @@ def htmlAccountInfo(cssCache: {}, translate: {},
if postDomain != domain:
infoForm += '<button class="button"><span>' + \
translate['Block'] + '</span></button>'
infoForm += '</a>'
infoForm += '<br>'
infoForm += '</a>\n'
infoForm += '<br>\n'
infoForm += '</div>\n'
if blockedFollowers:
blockedFollowers.sort()
infoForm += '<div class="accountInfoDomains">\n'
infoForm += '<h1>' + translate['Blocked followers'] + '</h1>\n'
for actor in blockedFollowers:
infoForm += '<a href="' + actor + '">' + actor + '</a><br>\n'
infoForm += '</div>\n'
infoForm += '</div>'
infoForm += htmlFooter()
return infoForm