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 return
# get the replies for a given person # 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 '/users/' in self.path:
if authorized: if authorized:
inboxRepliesFeed= \ inboxRepliesFeed= \
@ -1781,11 +1781,11 @@ class PubServer(BaseHTTPRequestHandler):
self.server.port, \ self.server.port, \
self.path, \ self.path, \
self.server.httpPrefix, \ self.server.httpPrefix, \
maxPostsInFeed, 'replies', \ maxPostsInFeed, 'tlreplies', \
True,self.server.ocapAlways) True,self.server.ocapAlways)
if inboxRepliesFeed: if inboxRepliesFeed:
if self._requestHTTP(): if self._requestHTTP():
nickname=self.path.replace('/users/','').replace('/replies','') nickname=self.path.replace('/users/','').replace('/tlreplies','')
pageNumber=1 pageNumber=1
if '?page=' in nickname: if '?page=' in nickname:
pageNumber=nickname.split('?page=')[1] pageNumber=nickname.split('?page=')[1]
@ -1802,7 +1802,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.port, \ self.server.port, \
self.path+'?page=1', \ self.path+'?page=1', \
self.server.httpPrefix, \ self.server.httpPrefix, \
maxPostsInFeed, 'replies', \ maxPostsInFeed, 'tlreplies', \
True,self.server.ocapAlways) True,self.server.ocapAlways)
msg=htmlInboxReplies(self.server.translate, \ msg=htmlInboxReplies(self.server.translate, \
pageNumber,maxPostsInFeed, \ pageNumber,maxPostsInFeed, \
@ -1827,10 +1827,10 @@ class PubServer(BaseHTTPRequestHandler):
return return
else: else:
if self.server.debug: if self.server.debug:
nickname=self.path.replace('/users/','').replace('/replies','') nickname=self.path.replace('/users/','').replace('/tlreplies','')
print('DEBUG: '+nickname+ \ print('DEBUG: '+nickname+ \
' was not authorized to access '+self.path) ' was not authorized to access '+self.path)
if self.path!='/replies': if self.path!='/tlreplies':
# not the replies inbox # not the replies inbox
if self.server.debug: if self.server.debug:
print('DEBUG: GET access to inbox is unauthorized') 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 """Obtain the inbox/outbox/moderation feed for the given person
""" """
if boxname!='inbox' and boxname!='dm' and \ if boxname!='inbox' and boxname!='dm' and \
boxname!='replies' and \ boxname!='tlreplies' and \
boxname!='outbox' and boxname!='moderation': boxname!='outbox' and boxname!='moderation':
return None return None
@ -442,7 +442,7 @@ def personBoxJson(baseDir: str,domain: str,port: int,path: str, \
if boxname=='dm': if boxname=='dm':
return createDMTimeline(baseDir,nickname,domain,port,httpPrefix, \ return createDMTimeline(baseDir,nickname,domain,port,httpPrefix, \
noOfItems,headerOnly,ocapAlways,pageNumber) noOfItems,headerOnly,ocapAlways,pageNumber)
elif boxname=='replies': elif boxname=='tlreplies':
return createRepliesTimeline(baseDir,nickname,domain,port,httpPrefix, \ return createRepliesTimeline(baseDir,nickname,domain,port,httpPrefix, \
noOfItems,headerOnly,ocapAlways,pageNumber) noOfItems,headerOnly,ocapAlways,pageNumber)
elif boxname=='outbox': 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, \ def createRepliesTimeline(baseDir: str,nickname: str,domain: str,port: int,httpPrefix: str, \
itemsPerPage: int,headerOnly: bool,ocapAlways: bool,pageNumber=None) -> {}: 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) itemsPerPage,headerOnly,True,ocapAlways,pageNumber)
def createOutbox(baseDir: str,nickname: str,domain: str,port: int,httpPrefix: str, \ 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': if boxname!='inbox' and boxname!='dm' and boxname!='outbox':
return None return None
if boxname!='dm' and boxname!='replies': if boxname!='dm' and boxname!='tlreplies':
boxDir = createPersonDir(nickname,domain,baseDir,boxname) boxDir = createPersonDir(nickname,domain,baseDir,boxname)
else: else:
# extract DMs from the inbox # extract DMs or replies from the inbox
boxDir = createPersonDir(nickname,domain,baseDir,'inbox') boxDir = createPersonDir(nickname,domain,baseDir,'inbox')
sharedBoxDir=None sharedBoxDir=None
if boxname=='inbox': if boxname=='inbox':
@ -1852,7 +1852,7 @@ def createBoxBase(baseDir: str,boxname: str, \
if boxname=='dm': if boxname=='dm':
if '#Public' in postStr or '/followers' in postStr: if '#Public' in postStr or '/followers' in postStr:
isPost=False isPost=False
elif boxname=='replies': elif boxname=='tlreplies':
if boxActor not in postStr: if boxActor not in postStr:
isPost=False isPost=False
@ -1862,13 +1862,13 @@ def createBoxBase(baseDir: str,boxname: str, \
p = json.loads(postStr) p = json.loads(postStr)
isTimelinePost=False isTimelinePost=False
if (boxname!='dm' and boxname!='replies'): if (boxname!='dm' and boxname!='tlreplies'):
isTimelinePost=True isTimelinePost=True
else: else:
if boxname=='dm': if boxname=='dm':
if isDM(p): if isDM(p):
isTimelinePost=True isTimelinePost=True
elif boxname=='replies': elif boxname=='tlreplies':
if isDM(p) or isReply(p,boxActor): if isDM(p) or isReply(p,boxActor):
isTimelinePost=True isTimelinePost=True

View File

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