forked from indymedia/epicyon
Tidying
parent
5a8757d8b0
commit
2941b9df33
|
@ -1957,7 +1957,6 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
actorStr=self.path.replace('/searchhandle','')
|
||||
length = int(self.headers['Content-length'])
|
||||
searchParams=self.rfile.read(length).decode('utf-8')
|
||||
#print('******************searchParams '+searchParams)
|
||||
if 'searchtext=' in searchParams:
|
||||
searchStr=searchParams.split('searchtext=')[1]
|
||||
if '&' in searchStr:
|
||||
|
|
18
utils.py
18
utils.py
|
@ -238,3 +238,21 @@ def noOfAccounts(baseDir: str) -> bool:
|
|||
if not account.startswith('inbox'):
|
||||
accountCtr+=1
|
||||
return accountCtr
|
||||
|
||||
def isPublicPost(postJsonObject: {}) -> bool:
|
||||
"""Returns true if the given post is public
|
||||
"""
|
||||
if not postJsonObject.get('type'):
|
||||
return False
|
||||
if postJsonObject['type']!='Create':
|
||||
return False
|
||||
if not postJsonObject.get('object'):
|
||||
return False
|
||||
if not isinstance(postJsonObject['object'], dict):
|
||||
return False
|
||||
if not postJsonObject['object'].get('to'):
|
||||
return False
|
||||
for recipient in postJsonObject['object']['to']:
|
||||
if recipient.endswith('#Public'):
|
||||
return True
|
||||
return False
|
||||
|
|
|
@ -18,6 +18,7 @@ from utils import getNicknameFromActor
|
|||
from utils import getDomainFromActor
|
||||
from utils import locatePost
|
||||
from utils import noOfAccounts
|
||||
from utils import isPublicPost
|
||||
from follow import isFollowingActor
|
||||
from webfinger import webfingerHandle
|
||||
from posts import getPersonBox
|
||||
|
@ -79,31 +80,13 @@ def htmlHashtagSearch(baseDir: str,hashtag: str,pageNumber: int,postsPerPage: in
|
|||
continue
|
||||
with open(postFilename, 'r') as fp:
|
||||
postJsonObject=commentjson.load(fp)
|
||||
if not postJsonObject.get('type'):
|
||||
if not isPublicPost(postJsonObject):
|
||||
index-=1
|
||||
continue
|
||||
if postJsonObject['type']!='Create':
|
||||
index-=1
|
||||
continue
|
||||
if not postJsonObject.get('object'):
|
||||
index-=1
|
||||
continue
|
||||
if not isinstance(postJsonObject['object'], dict):
|
||||
index-=1
|
||||
continue
|
||||
if not postJsonObject['object'].get('to'):
|
||||
index-=1
|
||||
continue
|
||||
isPublic=False
|
||||
for recipient in postJsonObject['object']['to']:
|
||||
if recipient.endswith('#Public'):
|
||||
isPublic=True
|
||||
break
|
||||
if isPublic:
|
||||
hashtagSearchForm+= \
|
||||
individualPostAsHtml(baseDir,session,wfRequest,personCache, \
|
||||
nickname,domain,port,postJsonObject, \
|
||||
None,True,False,False)
|
||||
hashtagSearchForm+= \
|
||||
individualPostAsHtml(baseDir,session,wfRequest,personCache, \
|
||||
nickname,domain,port,postJsonObject, \
|
||||
None,True,False,False)
|
||||
index-=1
|
||||
|
||||
if endIndex>0:
|
||||
|
|
Loading…
Reference in New Issue