forked from indymedia/epicyon
Combine
parent
ed39eb1ac6
commit
ffa28e81f8
|
@ -97,11 +97,10 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
if self._webfinger():
|
||||
return
|
||||
# get outbox feed for a person
|
||||
outboxHeader,outboxFeed=personOutboxJson(thisDomain,self.path,useHttps,maxPostsInFeed)
|
||||
if outboxHeader and outboxFeed:
|
||||
outboxFeed=personOutboxJson(thisDomain,self.path,useHttps,maxPostsInFeed)
|
||||
if outboxFeed:
|
||||
self._set_headers('application/json')
|
||||
outboxFeedList=[outboxHeader,outboxFeed]
|
||||
self.wfile.write(json.dumps(outboxFeedList).encode('utf-8'))
|
||||
self.wfile.write(json.dumps(outboxFeed).encode('utf-8'))
|
||||
return
|
||||
# look up a person
|
||||
getPerson = personLookup(thisDomain,self.path)
|
||||
|
|
|
@ -39,9 +39,7 @@ setPreferredUsername(username,domain,'badger')
|
|||
setBio(username,domain,'Some personal info')
|
||||
#createPublicPost(username, domain, https, "G'day world!", False, True, None, None, 'Not suitable for Vogons')
|
||||
#archivePosts(username,domain,4)
|
||||
#outboxHeader,outboxJson=createOutbox(username,domain,https,3,None)
|
||||
#pprint(outboxHeader)
|
||||
#print('\n')
|
||||
#outboxJson=createOutbox(username,domain,https,3,None)
|
||||
#pprint(outboxJson)
|
||||
|
||||
runDaemon(domain,port,federationList,useTor)
|
||||
|
|
|
@ -160,7 +160,7 @@ def personLookup(domain: str,path: str) -> {}:
|
|||
personJson=commentjson.load(fp)
|
||||
return personJson
|
||||
|
||||
def personOutboxJson(domain: str,path: str,https: bool,noOfItems: int) -> ({},{}):
|
||||
def personOutboxJson(domain: str,path: str,https: bool,noOfItems: int) -> []:
|
||||
"""Obtain the outbox feed for the given person
|
||||
"""
|
||||
if not path.endswith('/outbox'):
|
||||
|
|
4
posts.py
4
posts.py
|
@ -259,7 +259,7 @@ def createPublicPost(username: str, domain: str, https: bool, content: str, foll
|
|||
commentjson.dump(newPost, fp, indent=4, sort_keys=False)
|
||||
return newPost
|
||||
|
||||
def createOutbox(username: str,domain: str,https: bool,noOfItems: int,startMessageId=None) -> ({},{}):
|
||||
def createOutbox(username: str,domain: str,https: bool,noOfItems: int,startMessageId=None) -> []:
|
||||
"""Constructs the outbox feed
|
||||
"""
|
||||
prefix='https'
|
||||
|
@ -333,7 +333,7 @@ def createOutbox(username: str,domain: str,https: bool,noOfItems: int,startMessa
|
|||
break
|
||||
except Exception as e:
|
||||
print(e)
|
||||
return outboxHeader,outboxItems
|
||||
return [outboxHeader,outboxItems]
|
||||
|
||||
def archivePosts(username: str,domain: str,maxPostsInOutbox=256) -> None:
|
||||
"""Retain a maximum number of posts within the outbox
|
||||
|
|
Loading…
Reference in New Issue