mirror of https://gitlab.com/bashrc2/epicyon
Check string types
parent
0118168173
commit
c8b39b0449
|
@ -733,10 +733,6 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.send_header('Host', callingDomain)
|
self.send_header('Host', callingDomain)
|
||||||
self.send_header('InstanceID', self.server.instanceId)
|
self.send_header('InstanceID', self.server.instanceId)
|
||||||
self.send_header('Content-Length', '0')
|
self.send_header('Content-Length', '0')
|
||||||
# self.send_header('X-Robots-Tag',
|
|
||||||
# 'noindex, nofollow, noarchive, nosnippet')
|
|
||||||
# self.send_header('Cache-Control', 'public')
|
|
||||||
# self.send_header('Referrer-Policy', 'origin')
|
|
||||||
self.end_headers()
|
self.end_headers()
|
||||||
|
|
||||||
def _httpReturnCode(self, httpCode: int, httpDescription: str,
|
def _httpReturnCode(self, httpCode: int, httpDescription: str,
|
||||||
|
@ -756,10 +752,6 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.send_header('Content-Type', 'text/html; charset=utf-8')
|
self.send_header('Content-Type', 'text/html; charset=utf-8')
|
||||||
msgLenStr = str(len(msg))
|
msgLenStr = str(len(msg))
|
||||||
self.send_header('Content-Length', msgLenStr)
|
self.send_header('Content-Length', msgLenStr)
|
||||||
# self.send_header('X-Robots-Tag',
|
|
||||||
# 'noindex, nofollow, noarchive, nosnippet')
|
|
||||||
# self.send_header('Cache-Control', 'public')
|
|
||||||
# self.send_header('Referrer-Policy', 'origin')
|
|
||||||
self.end_headers()
|
self.end_headers()
|
||||||
if not self._write(msg):
|
if not self._write(msg):
|
||||||
print('Error when showing ' + str(httpCode))
|
print('Error when showing ' + str(httpCode))
|
||||||
|
|
|
@ -692,29 +692,40 @@ def _readLocalBoxPost(session, nickname: str, domain: str,
|
||||||
if hasObjectDict(postJsonObject2):
|
if hasObjectDict(postJsonObject2):
|
||||||
if postJsonObject2['object'].get('attributedTo') and \
|
if postJsonObject2['object'].get('attributedTo') and \
|
||||||
postJsonObject2['object'].get('content'):
|
postJsonObject2['object'].get('content'):
|
||||||
actor = postJsonObject2['object']['attributedTo']
|
attributedTo = postJsonObject2['object']['attributedTo']
|
||||||
nameStr += ' ' + translate['announces'] + ' ' + \
|
content = postJsonObject2['object']['content']
|
||||||
getNicknameFromActor(actor)
|
if isinstance(attributedTo, str) and \
|
||||||
sayStr = nameStr
|
isinstance(content, str):
|
||||||
_sayCommand(sayStr, sayStr, screenreader,
|
actor = attributedTo
|
||||||
systemLanguage, espeak)
|
nameStr += ' ' + translate['announces'] + ' ' + \
|
||||||
print('')
|
getNicknameFromActor(actor)
|
||||||
if screenreader:
|
sayStr = nameStr
|
||||||
time.sleep(2)
|
_sayCommand(sayStr, sayStr, screenreader,
|
||||||
content = \
|
systemLanguage, espeak)
|
||||||
_textOnlyContent(postJsonObject2['object']['content'])
|
print('')
|
||||||
content += _getImageDescription(postJsonObject2)
|
if screenreader:
|
||||||
messageStr, detectedLinks = \
|
time.sleep(2)
|
||||||
speakableText(baseDir, content, translate)
|
content = \
|
||||||
sayStr = content
|
_textOnlyContent(content)
|
||||||
_sayCommand(sayStr, messageStr, screenreader,
|
content += _getImageDescription(postJsonObject2)
|
||||||
systemLanguage, espeak)
|
messageStr, detectedLinks = \
|
||||||
return postJsonObject2
|
speakableText(baseDir, content, translate)
|
||||||
|
sayStr = content
|
||||||
|
_sayCommand(sayStr, messageStr, screenreader,
|
||||||
|
systemLanguage, espeak)
|
||||||
|
return postJsonObject2
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
actor = postJsonObject['object']['attributedTo']
|
attributedTo = postJsonObject['object']['attributedTo']
|
||||||
|
if not attributedTo:
|
||||||
|
return {}
|
||||||
|
content = postJsonObject['object']['content']
|
||||||
|
if not isinstance(attributedTo, str) or \
|
||||||
|
not isinstance(content, str):
|
||||||
|
return {}
|
||||||
|
actor = attributedTo
|
||||||
nameStr = getNicknameFromActor(actor)
|
nameStr = getNicknameFromActor(actor)
|
||||||
content = _textOnlyContent(postJsonObject['object']['content'])
|
content = _textOnlyContent(content)
|
||||||
content += _getImageDescription(postJsonObject)
|
content += _getImageDescription(postJsonObject)
|
||||||
|
|
||||||
if isPGPEncrypted(content):
|
if isPGPEncrypted(content):
|
||||||
|
|
Loading…
Reference in New Issue