mirror of https://gitlab.com/bashrc2/epicyon
Check for published value
parent
85645fb5e7
commit
182c529047
7
inbox.py
7
inbox.py
|
@ -1387,6 +1387,13 @@ def validPostContent(messageJson: {},maxMentions: int,maxEmoji: int) -> bool:
|
||||||
return True
|
return True
|
||||||
if not messageJson['object'].get('content'):
|
if not messageJson['object'].get('content'):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
if not messageJson['object'].get('published'):
|
||||||
|
return False
|
||||||
|
if 'T' not in messageJson['object']['published']:
|
||||||
|
return False
|
||||||
|
if 'Z' not in messageJson['object']['published']:
|
||||||
|
return False
|
||||||
# check for bad html
|
# check for bad html
|
||||||
invalidStrings=['<script>','<canvas>','<style>','</html>','</body>','<br>','<hr>']
|
invalidStrings=['<script>','<canvas>','<style>','</html>','</body>','<br>','<hr>']
|
||||||
for badStr in invalidStrings:
|
for badStr in invalidStrings:
|
||||||
|
|
|
@ -2444,16 +2444,18 @@ def individualPostAsHtml(recentPostsCache: {},maxRecentPosts: int, \
|
||||||
attachmentCtr+=1
|
attachmentCtr+=1
|
||||||
attachmentStr+='</div>'
|
attachmentStr+='</div>'
|
||||||
|
|
||||||
publishedStr=postJsonObject['object']['published']
|
publishedStr=''
|
||||||
if '.' not in publishedStr:
|
if postJsonObject['object'].get('published'):
|
||||||
if '+' not in publishedStr:
|
publishedStr=postJsonObject['object']['published']
|
||||||
datetimeObject = datetime.strptime(publishedStr,"%Y-%m-%dT%H:%M:%SZ")
|
if '.' not in publishedStr:
|
||||||
|
if '+' not in publishedStr:
|
||||||
|
datetimeObject = datetime.strptime(publishedStr,"%Y-%m-%dT%H:%M:%SZ")
|
||||||
|
else:
|
||||||
|
datetimeObject = datetime.strptime(publishedStr.split('+')[0]+'Z',"%Y-%m-%dT%H:%M:%SZ")
|
||||||
else:
|
else:
|
||||||
datetimeObject = datetime.strptime(publishedStr.split('+')[0]+'Z',"%Y-%m-%dT%H:%M:%SZ")
|
publishedStr=publishedStr.replace('T',' ').split('.')[0]
|
||||||
else:
|
datetimeObject = parse(publishedStr)
|
||||||
publishedStr=publishedStr.replace('T',' ').split('.')[0]
|
publishedStr=datetimeObject.strftime("%a %b %d, %H:%M")
|
||||||
datetimeObject = parse(publishedStr)
|
|
||||||
publishedStr=datetimeObject.strftime("%a %b %d, %H:%M")
|
|
||||||
footerStr='<span class="'+timeClass+'">'+publishedStr+'</span>\n'
|
footerStr='<span class="'+timeClass+'">'+publishedStr+'</span>\n'
|
||||||
|
|
||||||
# change the background color for DMs in inbox timeline
|
# change the background color for DMs in inbox timeline
|
||||||
|
|
Loading…
Reference in New Issue