mirror of https://gitlab.com/bashrc2/epicyon
Less verbose
parent
928412c34c
commit
a3be3c1803
|
@ -1333,8 +1333,9 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
return True
|
return True
|
||||||
elif self.path.endswith('/' + nickname):
|
elif self.path.endswith('/' + nickname):
|
||||||
return True
|
return True
|
||||||
print('AUTH: nickname ' + nickname +
|
if self.server.debug:
|
||||||
' was not found in path ' + self.path)
|
print('AUTH: nickname ' + nickname +
|
||||||
|
' was not found in path ' + self.path)
|
||||||
return False
|
return False
|
||||||
print('AUTH: epicyon cookie ' +
|
print('AUTH: epicyon cookie ' +
|
||||||
'authorization failed, header=' +
|
'authorization failed, header=' +
|
||||||
|
|
27
inbox.py
27
inbox.py
|
@ -395,9 +395,10 @@ def savePostToInboxQueue(baseDir: str, httpPrefix: str,
|
||||||
replyDomain, replyPort = \
|
replyDomain, replyPort = \
|
||||||
getDomainFromActor(inReplyTo)
|
getDomainFromActor(inReplyTo)
|
||||||
if isBlockedDomain(baseDir, replyDomain):
|
if isBlockedDomain(baseDir, replyDomain):
|
||||||
print('WARN: post contains reply from ' +
|
if debug:
|
||||||
str(actor) +
|
print('WARN: post contains reply from ' +
|
||||||
' to a blocked domain: ' + replyDomain)
|
str(actor) +
|
||||||
|
' to a blocked domain: ' + replyDomain)
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
replyNickname = \
|
replyNickname = \
|
||||||
|
@ -405,10 +406,11 @@ def savePostToInboxQueue(baseDir: str, httpPrefix: str,
|
||||||
if replyNickname and replyDomain:
|
if replyNickname and replyDomain:
|
||||||
if isBlocked(baseDir, nickname, domain,
|
if isBlocked(baseDir, nickname, domain,
|
||||||
replyNickname, replyDomain):
|
replyNickname, replyDomain):
|
||||||
print('WARN: post contains reply from ' +
|
if debug:
|
||||||
str(actor) +
|
print('WARN: post contains reply from ' +
|
||||||
' to a blocked account: ' +
|
str(actor) +
|
||||||
replyNickname + '@' + replyDomain)
|
' to a blocked account: ' +
|
||||||
|
replyNickname + '@' + replyDomain)
|
||||||
return None
|
return None
|
||||||
if postJsonObject['object'].get('content'):
|
if postJsonObject['object'].get('content'):
|
||||||
if isinstance(postJsonObject['object']['content'], str):
|
if isinstance(postJsonObject['object']['content'], str):
|
||||||
|
@ -1438,8 +1440,9 @@ def _receiveAnnounce(recentPostsCache: {},
|
||||||
__version__, httpPrefix,
|
__version__, httpPrefix,
|
||||||
domain, onionDomain)
|
domain, onionDomain)
|
||||||
if pubKey:
|
if pubKey:
|
||||||
print('DEBUG: public key obtained for announce: ' +
|
if debug:
|
||||||
lookupActor)
|
print('DEBUG: public key obtained for announce: ' +
|
||||||
|
lookupActor)
|
||||||
break
|
break
|
||||||
|
|
||||||
if debug:
|
if debug:
|
||||||
|
@ -1693,7 +1696,8 @@ def _validPostContent(baseDir: str, nickname: str, domain: str,
|
||||||
print('REJECT: reply to post which does not ' +
|
print('REJECT: reply to post which does not ' +
|
||||||
'allow comments: ' + originalPostId)
|
'allow comments: ' + originalPostId)
|
||||||
return False
|
return False
|
||||||
print('ACCEPT: post content is valid')
|
if debug:
|
||||||
|
print('ACCEPT: post content is valid')
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -1735,7 +1739,8 @@ def _obtainAvatarForReplyPost(session, baseDir: str, httpPrefix: str,
|
||||||
__version__, httpPrefix,
|
__version__, httpPrefix,
|
||||||
domain, onionDomain)
|
domain, onionDomain)
|
||||||
if pubKey:
|
if pubKey:
|
||||||
print('DEBUG: public key obtained for reply: ' + lookupActor)
|
if debug:
|
||||||
|
print('DEBUG: public key obtained for reply: ' + lookupActor)
|
||||||
break
|
break
|
||||||
|
|
||||||
if debug:
|
if debug:
|
||||||
|
|
|
@ -88,8 +88,9 @@ def getJson(session, url: str, headers: {}, params: {},
|
||||||
version='1.2.0', httpPrefix='https',
|
version='1.2.0', httpPrefix='https',
|
||||||
domain='testdomain', timeoutSec=20, quiet=False) -> {}:
|
domain='testdomain', timeoutSec=20, quiet=False) -> {}:
|
||||||
if not isinstance(url, str):
|
if not isinstance(url, str):
|
||||||
print('url: ' + str(url))
|
if not quiet:
|
||||||
print('ERROR: getJson failed, url should be a string')
|
print('url: ' + str(url))
|
||||||
|
print('ERROR: getJson failed, url should be a string')
|
||||||
return None
|
return None
|
||||||
sessionParams = {}
|
sessionParams = {}
|
||||||
sessionHeaders = {}
|
sessionHeaders = {}
|
||||||
|
|
Loading…
Reference in New Issue