forked from indymedia/epicyon
Tidying
parent
d0884fa04d
commit
12e9bca0c4
24
announce.py
24
announce.py
|
@ -195,7 +195,7 @@ def updateAnnounceCollection(recentPostsCache: {}, \
|
||||||
pprint(postJsonObject)
|
pprint(postJsonObject)
|
||||||
saveJson(postJsonObject,postFilename)
|
saveJson(postJsonObject,postFilename)
|
||||||
|
|
||||||
def announcedByPerson(postJsonObject: {}, nickname: str,domain: str) -> bool:
|
def announcedByPerson(postJsonObject: {},nickname: str,domain: str) -> bool:
|
||||||
"""Returns True if the given post is announced by the given person
|
"""Returns True if the given post is announced by the given person
|
||||||
"""
|
"""
|
||||||
if not postJsonObject.get('object'):
|
if not postJsonObject.get('object'):
|
||||||
|
@ -212,9 +212,9 @@ def announcedByPerson(postJsonObject: {}, nickname: str,domain: str) -> bool:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def createAnnounce(session,baseDir: str,federationList: [], \
|
def createAnnounce(session,baseDir: str,federationList: [], \
|
||||||
nickname: str, domain: str, port: int, \
|
nickname: str,domain: str,port: int, \
|
||||||
toUrl: str, ccUrl: str, httpPrefix: str, \
|
toUrl: str,ccUrl: str,httpPrefix: str, \
|
||||||
objectUrl: str, saveToFile: bool, \
|
objectUrl: str,saveToFile: bool, \
|
||||||
clientToServer: bool, \
|
clientToServer: bool, \
|
||||||
sendThreads: [],postLog: [], \
|
sendThreads: [],postLog: [], \
|
||||||
personCache: {},cachedWebfingers: {}, \
|
personCache: {},cachedWebfingers: {}, \
|
||||||
|
@ -278,7 +278,7 @@ def createAnnounce(session,baseDir: str,federationList: [], \
|
||||||
return newAnnounce
|
return newAnnounce
|
||||||
|
|
||||||
def announcePublic(session,baseDir: str,federationList: [], \
|
def announcePublic(session,baseDir: str,federationList: [], \
|
||||||
nickname: str, domain: str, port: int, httpPrefix: str, \
|
nickname: str,domain: str,port: int,httpPrefix: str, \
|
||||||
objectUrl: str,clientToServer: bool, \
|
objectUrl: str,clientToServer: bool, \
|
||||||
sendThreads: [],postLog: [], \
|
sendThreads: [],postLog: [], \
|
||||||
personCache: {},cachedWebfingers: {}, \
|
personCache: {},cachedWebfingers: {}, \
|
||||||
|
@ -328,9 +328,9 @@ def repeatPost(session,baseDir: str,federationList: [], \
|
||||||
debug,projectVersion)
|
debug,projectVersion)
|
||||||
|
|
||||||
def undoAnnounce(session,baseDir: str,federationList: [], \
|
def undoAnnounce(session,baseDir: str,federationList: [], \
|
||||||
nickname: str, domain: str, port: int, \
|
nickname: str,domain: str,port: int, \
|
||||||
toUrl: str, ccUrl: str, httpPrefix: str, \
|
toUrl: str,ccUrl: str,httpPrefix: str, \
|
||||||
objectUrl: str, saveToFile: bool, \
|
objectUrl: str,saveToFile: bool, \
|
||||||
clientToServer: bool, \
|
clientToServer: bool, \
|
||||||
sendThreads: [],postLog: [], \
|
sendThreads: [],postLog: [], \
|
||||||
personCache: {},cachedWebfingers: {}, \
|
personCache: {},cachedWebfingers: {}, \
|
||||||
|
@ -390,7 +390,7 @@ def undoAnnounce(session,baseDir: str,federationList: [], \
|
||||||
return newUndoAnnounce
|
return newUndoAnnounce
|
||||||
|
|
||||||
def undoAnnouncePublic(session,baseDir: str,federationList: [], \
|
def undoAnnouncePublic(session,baseDir: str,federationList: [], \
|
||||||
nickname: str, domain: str, port: int, httpPrefix: str, \
|
nickname: str,domain: str,port: int,httpPrefix: str, \
|
||||||
objectUrl: str,clientToServer: bool, \
|
objectUrl: str,clientToServer: bool, \
|
||||||
sendThreads: [],postLog: [], \
|
sendThreads: [],postLog: [], \
|
||||||
personCache: {},cachedWebfingers: {}, \
|
personCache: {},cachedWebfingers: {}, \
|
||||||
|
@ -414,9 +414,9 @@ def undoAnnouncePublic(session,baseDir: str,federationList: [], \
|
||||||
debug)
|
debug)
|
||||||
|
|
||||||
def undoRepeatPost(session,baseDir: str,federationList: [], \
|
def undoRepeatPost(session,baseDir: str,federationList: [], \
|
||||||
nickname: str, domain: str, port: int, httpPrefix: str, \
|
nickname: str,domain: str,port: int,httpPrefix: str, \
|
||||||
announceNickname: str, announceDomain: str, \
|
announceNickname: str,announceDomain: str, \
|
||||||
announcePort: int, announceHttpsPrefix: str, \
|
announcePort: int,announceHttpsPrefix: str, \
|
||||||
announceStatusNumber: int,clientToServer: bool, \
|
announceStatusNumber: int,clientToServer: bool, \
|
||||||
sendThreads: [],postLog: [], \
|
sendThreads: [],postLog: [], \
|
||||||
personCache: {},cachedWebfingers: {}, \
|
personCache: {},cachedWebfingers: {}, \
|
||||||
|
|
10
auth.py
10
auth.py
|
@ -18,8 +18,8 @@ def hashPassword(password: str) -> str:
|
||||||
"""
|
"""
|
||||||
salt=hashlib.sha256(os.urandom(60)).hexdigest().encode('ascii')
|
salt=hashlib.sha256(os.urandom(60)).hexdigest().encode('ascii')
|
||||||
pwdhash=hashlib.pbkdf2_hmac('sha512', \
|
pwdhash=hashlib.pbkdf2_hmac('sha512', \
|
||||||
password.encode('utf-8'), \
|
password.encode('utf-8'), \
|
||||||
salt, 100000)
|
salt, 100000)
|
||||||
pwdhash=binascii.hexlify(pwdhash)
|
pwdhash=binascii.hexlify(pwdhash)
|
||||||
return (salt+pwdhash).decode('ascii')
|
return (salt+pwdhash).decode('ascii')
|
||||||
|
|
||||||
|
@ -29,9 +29,9 @@ def verifyPassword(storedPassword: str,providedPassword: str) -> bool:
|
||||||
salt=storedPassword[:64]
|
salt=storedPassword[:64]
|
||||||
storedPassword=storedPassword[64:]
|
storedPassword=storedPassword[64:]
|
||||||
pwdhash=hashlib.pbkdf2_hmac('sha512', \
|
pwdhash=hashlib.pbkdf2_hmac('sha512', \
|
||||||
providedPassword.encode('utf-8'), \
|
providedPassword.encode('utf-8'), \
|
||||||
salt.encode('ascii'), \
|
salt.encode('ascii'), \
|
||||||
100000)
|
100000)
|
||||||
pwdhash=binascii.hexlify(pwdhash).decode('ascii')
|
pwdhash=binascii.hexlify(pwdhash).decode('ascii')
|
||||||
return pwdhash==storedPassword
|
return pwdhash==storedPassword
|
||||||
|
|
||||||
|
|
|
@ -2217,7 +2217,7 @@ def addEmbeddedAudio(translate: {},content: str) -> str:
|
||||||
w=w[:-1]
|
w=w[:-1]
|
||||||
if not w.endswith(extension):
|
if not w.endswith(extension):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if not (w.startswith('http') or w.startswith('dat:') or \
|
if not (w.startswith('http') or w.startswith('dat:') or \
|
||||||
w.startswith('i2p:') or '/' in w):
|
w.startswith('i2p:') or '/' in w):
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue