forked from indymedia/epicyon
Tidying
parent
d352b27dd8
commit
c68b94f9b1
10
epicyon.py
10
epicyon.py
|
@ -1041,12 +1041,10 @@ if args.actor:
|
||||||
args.actor.startswith('http') or \
|
args.actor.startswith('http') or \
|
||||||
args.actor.startswith('dat'):
|
args.actor.startswith('dat'):
|
||||||
# format: https://domain/@nick
|
# format: https://domain/@nick
|
||||||
args.actor = args.actor.replace('https://', '')
|
prefixes = ('https://', 'http://', 'dat://', 'i2p://', 'gnunet://',
|
||||||
args.actor = args.actor.replace('http://', '')
|
'hyper://', 'gemini://', 'gopher://')
|
||||||
args.actor = args.actor.replace('gnunet://', '')
|
for prefix in prefixes:
|
||||||
args.actor = args.actor.replace('dat://', '')
|
args.actor = args.actor.replace(prefix, '')
|
||||||
args.actor = args.actor.replace('hyper://', '')
|
|
||||||
args.actor = args.actor.replace('i2p://', '')
|
|
||||||
args.actor = args.actor.replace('/@', '/users/')
|
args.actor = args.actor.replace('/@', '/users/')
|
||||||
if '/users/' not in args.actor and \
|
if '/users/' not in args.actor and \
|
||||||
'/channel/' not in args.actor and \
|
'/channel/' not in args.actor and \
|
||||||
|
|
|
@ -26,10 +26,11 @@ from utils import saveJson
|
||||||
def parseHandle(handle: str) -> (str, str):
|
def parseHandle(handle: str) -> (str, str):
|
||||||
if '.' not in handle:
|
if '.' not in handle:
|
||||||
return None, None
|
return None, None
|
||||||
handleStr = handle.replace('https://', '').replace('http://', '')
|
prefixes = ('https://', 'http://', 'dat://', 'i2p://', 'gnunet://',
|
||||||
handleStr = handleStr.replace('dat://', '').replace('hyper://', '')
|
'hyper://', 'gemini://', 'gopher://')
|
||||||
handleStr = handleStr.replace('i2p://', '')
|
handleStr = handle
|
||||||
handleStr = handleStr.replace('gnunet://', '')
|
for prefix in prefixes:
|
||||||
|
handleStr = handleStr.replace(prefix, '')
|
||||||
if '/@' in handle:
|
if '/@' in handle:
|
||||||
domain, nickname = handleStr.split('/@')
|
domain, nickname = handleStr.split('/@')
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -100,12 +100,14 @@ def getBlogAddress(actorJson: {}) -> str:
|
||||||
if propertyValue['type'] != 'PropertyValue':
|
if propertyValue['type'] != 'PropertyValue':
|
||||||
continue
|
continue
|
||||||
propertyValue['value'] = propertyValue['value'].strip()
|
propertyValue['value'] = propertyValue['value'].strip()
|
||||||
if not (propertyValue['value'].startswith('https://') or
|
prefixes = ('https://', 'http://', 'dat://', 'i2p://', 'gnunet://',
|
||||||
propertyValue['value'].startswith('http://') or
|
'hyper://', 'gemini://', 'gopher://')
|
||||||
propertyValue['value'].startswith('gnunet://') or
|
prefixFound = False
|
||||||
propertyValue['value'].startswith('dat://') or
|
for prefix in prefixes:
|
||||||
propertyValue['value'].startswith('hyper://') or
|
if propertyValue['value'].startswith(prefix):
|
||||||
propertyValue['value'].startswith('i2p://')):
|
prefixFound = True
|
||||||
|
break
|
||||||
|
if not prefixFound:
|
||||||
continue
|
continue
|
||||||
if '.' not in propertyValue['value']:
|
if '.' not in propertyValue['value']:
|
||||||
continue
|
continue
|
||||||
|
@ -137,12 +139,15 @@ def setBlogAddress(actorJson: {}, blogAddress: str) -> None:
|
||||||
if propertyFound:
|
if propertyFound:
|
||||||
actorJson['attachment'].remove(propertyFound)
|
actorJson['attachment'].remove(propertyFound)
|
||||||
|
|
||||||
if not (blogAddress.startswith('https://') or
|
prefixes = ('https://', 'http://', 'dat://', 'i2p://',
|
||||||
blogAddress.startswith('http://') or
|
'gnunet://', 'hyper://', 'gemini://',
|
||||||
blogAddress.startswith('gnunet://') or
|
'gopher://')
|
||||||
blogAddress.startswith('dat://') or
|
prefixFound = False
|
||||||
blogAddress.startswith('hyper://') or
|
for prefix in prefixes:
|
||||||
blogAddress.startswith('i2p://')):
|
if blogAddress.startswith(prefix):
|
||||||
|
prefixFound = True
|
||||||
|
break
|
||||||
|
if not prefixFound:
|
||||||
return
|
return
|
||||||
if '.' not in blogAddress:
|
if '.' not in blogAddress:
|
||||||
return
|
return
|
||||||
|
@ -4002,12 +4007,11 @@ def individualPostAsHtml(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
else:
|
else:
|
||||||
postDomain = \
|
postDomain = \
|
||||||
postJsonObject['object']['inReplyTo']
|
postJsonObject['object']['inReplyTo']
|
||||||
postDomain = postDomain.replace('https://', '')
|
prefixes = ('https://', 'http://', 'dat://', 'i2p://',
|
||||||
postDomain = postDomain.replace('http://', '')
|
'gnunet://', 'hyper://', 'gemini://',
|
||||||
postDomain = postDomain.replace('hyper://', '')
|
'gopher://')
|
||||||
postDomain = postDomain.replace('gnunet://', '')
|
for prefix in prefixes:
|
||||||
postDomain = postDomain.replace('dat://', '')
|
postDomain = postDomain.replace(prefix, '')
|
||||||
postDomain = postDomain.replace('i2p://', '')
|
|
||||||
if '/' in postDomain:
|
if '/' in postDomain:
|
||||||
postDomain = postDomain.split('/', 1)[0]
|
postDomain = postDomain.split('/', 1)[0]
|
||||||
if postDomain:
|
if postDomain:
|
||||||
|
|
Loading…
Reference in New Issue