Remove likes,shares,replies and bookmarks for unauthorized requests on individual posts

main
Bob Mottram 2019-11-25 11:04:27 +00:00
parent a5651335f6
commit c9e5a24826
2 changed files with 17 additions and 1 deletions

View File

@ -2113,6 +2113,22 @@ class PubServer(BaseHTTPRequestHandler):
if not authorized: if not authorized:
if postJsonObject.get('likes'): if postJsonObject.get('likes'):
postJsonObject['likes']={'items': []} postJsonObject['likes']={'items': []}
if postJsonObject.get('shares'):
postJsonObject['shares']={}
if postJsonObject.get('replies'):
postJsonObject['replies']={}
if postJsonObject.get('bookmarks'):
postJsonObject['bookmarks']={}
if postJsonObject.get('object'):
if isinstance(postJsonObject['object'], dict):
if postJsonObject['object'].get('likes'):
postJsonObject['object']['likes']={'items': []}
if postJsonObject['object'].get('shares'):
postJsonObject['object']['shares']={}
if postJsonObject['object'].get('replies'):
postJsonObject['object']['replies']={}
if postJsonObject['object'].get('bookmarks'):
postJsonObject['object']['bookmarks']={}
if self._requestHTTP(): if self._requestHTTP():
msg= \ msg= \
htmlIndividualPost(self.server.recentPostsCache, \ htmlIndividualPost(self.server.recentPostsCache, \

View File

@ -2227,7 +2227,7 @@ def createBoxIndexed(recentPostsCache: {}, \
if p.get('object'): if p.get('object'):
if isinstance(p['object'], dict): if isinstance(p['object'], dict):
if p['object'].get('likes'): if p['object'].get('likes'):
p['likes']={} p['likes']={'items': []}
if p['object'].get('replies'): if p['object'].get('replies'):
p['replies']={} p['replies']={}
if p['object'].get('shares'): if p['object'].get('shares'):