forked from indymedia/epicyon
Validate nicknames
parent
e500d32b15
commit
327ba62bbe
|
@ -26,8 +26,7 @@ def createPerson(baseDir: str,nickname: str,domain: str,port: int, \
|
||||||
httpPrefix: str, saveToFile: bool,password=None) -> (str,str,{},{}):
|
httpPrefix: str, saveToFile: bool,password=None) -> (str,str,{},{}):
|
||||||
"""Returns the private key, public key, actor and webfinger endpoint
|
"""Returns the private key, public key, actor and webfinger endpoint
|
||||||
"""
|
"""
|
||||||
reservedNames=['inbox','outbox','followers','following','sharedInbox','publicKey']
|
if not validNickname(nickname):
|
||||||
if nickname in reservedNames:
|
|
||||||
return None,None,None,None
|
return None,None,None,None
|
||||||
privateKeyPem,publicKeyPem=generateRSAKey()
|
privateKeyPem,publicKeyPem=generateRSAKey()
|
||||||
webfingerEndpoint= \
|
webfingerEndpoint= \
|
||||||
|
@ -120,11 +119,16 @@ def validNickname(nickname: str) -> bool:
|
||||||
for c in forbiddenChars:
|
for c in forbiddenChars:
|
||||||
if c in nickname:
|
if c in nickname:
|
||||||
return False
|
return False
|
||||||
|
reservedNames=['inbox','outbox','following','followers','sharedInbox']
|
||||||
|
if nickname in reservedNames:
|
||||||
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def personLookup(domain: str,path: str,baseDir: str) -> {}:
|
def personLookup(domain: str,path: str,baseDir: str) -> {}:
|
||||||
"""Lookup the person for an given nickname
|
"""Lookup the person for an given nickname
|
||||||
"""
|
"""
|
||||||
|
if path.endswith('#main-key'):
|
||||||
|
path=path.replace('#main-key','')
|
||||||
notPersonLookup=['/inbox','/outbox','/outboxarchive', \
|
notPersonLookup=['/inbox','/outbox','/outboxarchive', \
|
||||||
'/followers','/following','/featured', \
|
'/followers','/following','/featured', \
|
||||||
'.png','.jpg','.gif','.mpv']
|
'.png','.jpg','.gif','.mpv']
|
||||||
|
|
Loading…
Reference in New Issue