Avoid clashing replies path

main2
Bob Mottram 2019-09-23 21:43:18 +01:00
parent 2a3c05c482
commit 534948b8fe
4 changed files with 16 additions and 16 deletions

View File

@ -1772,7 +1772,7 @@ class PubServer(BaseHTTPRequestHandler):
return
# get the replies for a given person
if self.path.endswith('/replies') or '/replies?page=' in self.path:
if self.path.endswith('/tlreplies') or '/tlreplies?page=' in self.path:
if '/users/' in self.path:
if authorized:
inboxRepliesFeed= \
@ -1781,11 +1781,11 @@ class PubServer(BaseHTTPRequestHandler):
self.server.port, \
self.path, \
self.server.httpPrefix, \
maxPostsInFeed, 'replies', \
maxPostsInFeed, 'tlreplies', \
True,self.server.ocapAlways)
if inboxRepliesFeed:
if self._requestHTTP():
nickname=self.path.replace('/users/','').replace('/replies','')
nickname=self.path.replace('/users/','').replace('/tlreplies','')
pageNumber=1
if '?page=' in nickname:
pageNumber=nickname.split('?page=')[1]
@ -1802,7 +1802,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.port, \
self.path+'?page=1', \
self.server.httpPrefix, \
maxPostsInFeed, 'replies', \
maxPostsInFeed, 'tlreplies', \
True,self.server.ocapAlways)
msg=htmlInboxReplies(self.server.translate, \
pageNumber,maxPostsInFeed, \
@ -1827,10 +1827,10 @@ class PubServer(BaseHTTPRequestHandler):
return
else:
if self.server.debug:
nickname=self.path.replace('/users/','').replace('/replies','')
nickname=self.path.replace('/users/','').replace('/tlreplies','')
print('DEBUG: '+nickname+ \
' was not authorized to access '+self.path)
if self.path!='/replies':
if self.path!='/tlreplies':
# not the replies inbox
if self.server.debug:
print('DEBUG: GET access to inbox is unauthorized')

View File

@ -401,7 +401,7 @@ def personBoxJson(baseDir: str,domain: str,port: int,path: str, \
"""Obtain the inbox/outbox/moderation feed for the given person
"""
if boxname!='inbox' and boxname!='dm' and \
boxname!='replies' and \
boxname!='tlreplies' and \
boxname!='outbox' and boxname!='moderation':
return None
@ -442,7 +442,7 @@ def personBoxJson(baseDir: str,domain: str,port: int,path: str, \
if boxname=='dm':
return createDMTimeline(baseDir,nickname,domain,port,httpPrefix, \
noOfItems,headerOnly,ocapAlways,pageNumber)
elif boxname=='replies':
elif boxname=='tlreplies':
return createRepliesTimeline(baseDir,nickname,domain,port,httpPrefix, \
noOfItems,headerOnly,ocapAlways,pageNumber)
elif boxname=='outbox':

View File

@ -1581,7 +1581,7 @@ def createDMTimeline(baseDir: str,nickname: str,domain: str,port: int,httpPrefix
def createRepliesTimeline(baseDir: str,nickname: str,domain: str,port: int,httpPrefix: str, \
itemsPerPage: int,headerOnly: bool,ocapAlways: bool,pageNumber=None) -> {}:
return createBoxBase(baseDir,'replies',nickname,domain,port,httpPrefix, \
return createBoxBase(baseDir,'tlreplies',nickname,domain,port,httpPrefix, \
itemsPerPage,headerOnly,True,ocapAlways,pageNumber)
def createOutbox(baseDir: str,nickname: str,domain: str,port: int,httpPrefix: str, \
@ -1708,10 +1708,10 @@ def createBoxBase(baseDir: str,boxname: str, \
"""
if boxname!='inbox' and boxname!='dm' and boxname!='outbox':
return None
if boxname!='dm' and boxname!='replies':
if boxname!='dm' and boxname!='tlreplies':
boxDir = createPersonDir(nickname,domain,baseDir,boxname)
else:
# extract DMs from the inbox
# extract DMs or replies from the inbox
boxDir = createPersonDir(nickname,domain,baseDir,'inbox')
sharedBoxDir=None
if boxname=='inbox':
@ -1852,7 +1852,7 @@ def createBoxBase(baseDir: str,boxname: str, \
if boxname=='dm':
if '#Public' in postStr or '/followers' in postStr:
isPost=False
elif boxname=='replies':
elif boxname=='tlreplies':
if boxActor not in postStr:
isPost=False
@ -1862,13 +1862,13 @@ def createBoxBase(baseDir: str,boxname: str, \
p = json.loads(postStr)
isTimelinePost=False
if (boxname!='dm' and boxname!='replies'):
if (boxname!='dm' and boxname!='tlreplies'):
isTimelinePost=True
else:
if boxname=='dm':
if isDM(p):
isTimelinePost=True
elif boxname=='replies':
elif boxname=='tlreplies':
if isDM(p) or isReply(p,boxActor):
isTimelinePost=True

View File

@ -2083,7 +2083,7 @@ def htmlTimeline(translate: {},pageNumber: int, \
inboxButton='buttonselected'
elif boxName=='dm':
dmButton='buttonselected'
elif boxName=='replies':
elif boxName=='tlreplies':
repliesButton='buttonselected'
elif boxName=='outbox':
sentButton='buttonselected'
@ -2217,7 +2217,7 @@ def htmlInboxReplies(translate: {},pageNumber: int,itemsPerPage: int, \
"""
return htmlTimeline(translate,pageNumber, \
itemsPerPage,session,baseDir,wfRequest,personCache, \
nickname,domain,port,inboxJson,'replies',allowDeletion, \
nickname,domain,port,inboxJson,'tlreplies',allowDeletion, \
httpPrefix,projectVersion,False)
def htmlModeration(translate: {},pageNumber: int,itemsPerPage: int, \