mirror of https://gitlab.com/bashrc2/epicyon
Tidying
parent
136949752f
commit
d352b27dd8
12
inbox.py
12
inbox.py
|
@ -1359,14 +1359,12 @@ def receiveAnnounce(recentPostsCache: {},
|
|||
messageJson['type'])
|
||||
return False
|
||||
|
||||
prefixes = ('https://', 'http://', 'dat://', 'i2p://', 'gnunet://',
|
||||
'hyper://', 'gemini://', 'gopher://')
|
||||
# is the domain of the announce actor blocked?
|
||||
objectDomain = \
|
||||
messageJson['object'].replace('https://', '')
|
||||
objectDomain = objectDomain.replace('http://', '')
|
||||
objectDomain = objectDomain.replace('i2p://', '')
|
||||
objectDomain = objectDomain.replace('gnunet://', '')
|
||||
objectDomain = objectDomain.replace('dat://', '')
|
||||
objectDomain = objectDomain.replace('hyper://', '')
|
||||
objectDomain = messageJson['object']
|
||||
for prefix in prefixes:
|
||||
objectDomain = objectDomain.replace(prefix, '')
|
||||
if '/' in objectDomain:
|
||||
objectDomain = objectDomain.split('/')[0]
|
||||
if isBlockedDomain(baseDir, objectDomain):
|
||||
|
|
30
utils.py
30
utils.py
|
@ -228,30 +228,28 @@ def getDomainFromActor(actor: str) -> (str, int):
|
|||
"""Returns the domain name from an actor url
|
||||
"""
|
||||
port = None
|
||||
prefixes = ('https://', 'http://', 'dat://', 'i2p://', 'gnunet://',
|
||||
'hyper://', 'gemini://', 'gopher://')
|
||||
if '/profile/' in actor:
|
||||
domain = actor.split('/profile/')[0].replace('https://', '')
|
||||
domain = domain.replace('http://', '').replace('i2p://', '')
|
||||
domain = domain.replace('dat://', '').replace('hyper://', '')
|
||||
domain = domain.replace('gnunet://', '')
|
||||
domain = actor.split('/profile/')[0]
|
||||
for prefix in prefixes:
|
||||
domain = domain.replace(prefix, '')
|
||||
else:
|
||||
if '/channel/' in actor:
|
||||
domain = actor.split('/channel/')[0].replace('https://', '')
|
||||
domain = domain.replace('http://', '').replace('i2p://', '')
|
||||
domain = domain.replace('dat://', '').replace('hyper://', '')
|
||||
domain = domain.replace('gnunet://', '')
|
||||
domain = actor.split('/channel/')[0]
|
||||
for prefix in prefixes:
|
||||
domain = domain.replace(prefix, '')
|
||||
else:
|
||||
if '/users/' not in actor:
|
||||
domain = actor.replace('https://', '').replace('http://', '')
|
||||
domain = domain.replace('i2p://', '')
|
||||
domain = domain.replace('dat://', '').replace('hyper://', '')
|
||||
domain = domain.replace('gnunet://', '')
|
||||
domain = actor
|
||||
for prefix in prefixes:
|
||||
domain = domain.replace(prefix, '')
|
||||
if '/' in actor:
|
||||
domain = domain.split('/')[0]
|
||||
else:
|
||||
domain = actor.split('/users/')[0].replace('https://', '')
|
||||
domain = domain.replace('http://', '').replace('i2p://', '')
|
||||
domain = domain.replace('dat://', '').replace('hyper://', '')
|
||||
domain = domain.replace('gnunet://', '')
|
||||
domain = actor.split('/users/')[0]
|
||||
for prefix in prefixes:
|
||||
domain = domain.replace(prefix, '')
|
||||
if ':' in domain:
|
||||
portStr = domain.split(':')[1]
|
||||
if not portStr.isdigit():
|
||||
|
|
Loading…
Reference in New Issue