From b410de1a7b738e77e9cb6c89b347585c2fbad8ff Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 13 Aug 2019 17:39:43 +0100 Subject: [PATCH] Blocking using actors --- daemon.py | 32 ++++++++++++++++++++++++++------ webinterface.py | 2 +- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/daemon.py b/daemon.py index bee03e79..9367cc30 100644 --- a/daemon.py +++ b/daemon.py @@ -2143,13 +2143,33 @@ class PubServer(BaseHTTPRequestHandler): if moderationButton=='unsuspend': unsuspendAccount(self.server.baseDir,nickname) if moderationButton=='block': - fullBlockDomain=moderationText.split('@')[1] - addGlobalBlock(self.server.baseDir, \ - nickname,fullBlockDomain) + fullBlockDomain=None + if moderationText.startswith('http') or \ + moderationText.startswith('dat'): + blockDomain,blockPort=getDomainFromActor(moderationText) + fullBlockDomain=blockDomain + if blockPort: + if blockPort!=80 and blockPort!=443: + fullBlockDomain=blockDomain+':'+str(blockPort) + if '@' in moderationText: + fullBlockDomain=moderationText.split('@')[1] + if fullBlockDomain: + addGlobalBlock(self.server.baseDir, \ + nickname,fullBlockDomain) if moderationButton=='unblock': - fullBlockDomain=moderationText.split('@')[1] - removeGlobalBlock(self.server.baseDir, \ - nickname,fullBlockDomain) + fullBlockDomain=None + if moderationText.startswith('http') or \ + moderationText.startswith('dat'): + blockDomain,blockPort=getDomainFromActor(moderationText) + fullBlockDomain=blockDomain + if blockPort: + if blockPort!=80 and blockPort!=443: + fullBlockDomain=blockDomain+':'+str(blockPort) + if '@' in moderationText: + fullBlockDomain=moderationText.split('@')[1] + if fullBlockDomain: + removeGlobalBlock(self.server.baseDir, \ + nickname,fullBlockDomain) if moderationButton=='remove': if '/statuses/' not in moderationText: removeAccount(self.server.baseDir, \ diff --git a/webinterface.py b/webinterface.py index 75042294..6c77caa7 100644 --- a/webinterface.py +++ b/webinterface.py @@ -1069,7 +1069,7 @@ def htmlTimeline(pageNumber: int,itemsPerPage: int,session,baseDir: str, \ tlStr+= \ '
' \ '
\n'+ \ - ' ' \ + ' ' \ ' ' \ ' ' \ ' ' \