forked from indymedia/epicyon
Preserve page numbers
parent
40feaae9c5
commit
320d489f4f
201
daemon.py
201
daemon.py
|
@ -587,18 +587,23 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
optionsStr=self.path.split('?options=')[1]
|
optionsStr=self.path.split('?options=')[1]
|
||||||
originPathStr=self.path.split('?options=')[0]
|
originPathStr=self.path.split('?options=')[0]
|
||||||
if ';' in optionsStr:
|
if ';' in optionsStr:
|
||||||
|
pageNumber=1
|
||||||
optionsList=optionsStr.split(';')
|
optionsList=optionsStr.split(';')
|
||||||
optionsActor=optionsList[0]
|
optionsActor=optionsList[0]
|
||||||
optionsProfileUrl=optionsList[1]
|
optionsPageNumber=optionsList[1]
|
||||||
|
optionsProfileUrl=optionsList[2]
|
||||||
|
if optionsPageNumber.isdigit():
|
||||||
|
pageNumber=int(optionsPageNumber)
|
||||||
optionsLink=None
|
optionsLink=None
|
||||||
if len(optionsList)>2:
|
if len(optionsList)>3:
|
||||||
optionsLink=optionsList[2]
|
optionsLink=optionsList[3]
|
||||||
msg=htmlPersonOptions(self.server.baseDir, \
|
msg=htmlPersonOptions(self.server.baseDir, \
|
||||||
self.server.domain, \
|
self.server.domain, \
|
||||||
originPathStr, \
|
originPathStr, \
|
||||||
optionsActor, \
|
optionsActor, \
|
||||||
optionsProfileUrl,
|
optionsProfileUrl, \
|
||||||
optionsLink).encode()
|
optionsLink, \
|
||||||
|
pageNumber).encode()
|
||||||
self._set_headers('text/html',len(msg),cookie)
|
self._set_headers('text/html',len(msg),cookie)
|
||||||
self.wfile.write(msg)
|
self.wfile.write(msg)
|
||||||
self.server.GETbusy=False
|
self.server.GETbusy=False
|
||||||
|
@ -945,13 +950,22 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
# announce/repeat from the web interface
|
# announce/repeat from the web interface
|
||||||
if htmlGET and '?repeat=' in self.path:
|
if htmlGET and '?repeat=' in self.path:
|
||||||
|
pageNumber=1
|
||||||
repeatUrl=self.path.split('?repeat=')[1]
|
repeatUrl=self.path.split('?repeat=')[1]
|
||||||
|
if '?' in repeatUrl:
|
||||||
|
repeatUrl=repeatUrl.split('?')[0]
|
||||||
|
if '?page=' in self.path:
|
||||||
|
pageNumberStr=self.path.split('?page=')[1]
|
||||||
|
if '?' in pageNumberStr:
|
||||||
|
pageNumberStr=pageNumberStr.split('?')[0]
|
||||||
|
if pageNumberStr.isdigit():
|
||||||
|
pageNumber=int(pageNumberStr)
|
||||||
actor=self.path.split('?repeat=')[0]
|
actor=self.path.split('?repeat=')[0]
|
||||||
self.postToNickname=getNicknameFromActor(actor)
|
self.postToNickname=getNicknameFromActor(actor)
|
||||||
if not self.postToNickname:
|
if not self.postToNickname:
|
||||||
print('WARN: unable to find nickname in '+actor)
|
print('WARN: unable to find nickname in '+actor)
|
||||||
self.server.GETbusy=False
|
self.server.GETbusy=False
|
||||||
self._redirect_headers(actor+'/inbox',cookie)
|
self._redirect_headers(actor+'/inbox?page='+str(pageNumber),cookie)
|
||||||
return
|
return
|
||||||
if not self.server.session:
|
if not self.server.session:
|
||||||
self.server.session= \
|
self.server.session= \
|
||||||
|
@ -974,18 +988,27 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
if announceJson:
|
if announceJson:
|
||||||
self._postToOutboxThread(announceJson)
|
self._postToOutboxThread(announceJson)
|
||||||
self.server.GETbusy=False
|
self.server.GETbusy=False
|
||||||
self._redirect_headers(actor+'/inbox',cookie)
|
self._redirect_headers(actor+'/inbox?page='+str(pageNumber),cookie)
|
||||||
return
|
return
|
||||||
|
|
||||||
# undo an announce/repeat from the web interface
|
# undo an announce/repeat from the web interface
|
||||||
if htmlGET and '?unrepeat=' in self.path:
|
if htmlGET and '?unrepeat=' in self.path:
|
||||||
|
pageNumber=1
|
||||||
repeatUrl=self.path.split('?unrepeat=')[1]
|
repeatUrl=self.path.split('?unrepeat=')[1]
|
||||||
|
if '?' in repeatUrl:
|
||||||
|
repeatUrl=repeatUrl.split('?')[0]
|
||||||
|
if '?page=' in self.path:
|
||||||
|
pageNumberStr=self.path.split('?page=')[1]
|
||||||
|
if '?' in pageNumberStr:
|
||||||
|
pageNumberStr=pageNumberStr.split('?')[0]
|
||||||
|
if pageNumberStr.isdigit():
|
||||||
|
pageNumber=int(pageNumberStr)
|
||||||
actor=self.path.split('?unrepeat=')[0]
|
actor=self.path.split('?unrepeat=')[0]
|
||||||
self.postToNickname=getNicknameFromActor(actor)
|
self.postToNickname=getNicknameFromActor(actor)
|
||||||
if not self.postToNickname:
|
if not self.postToNickname:
|
||||||
print('WARN: unable to find nickname in '+actor)
|
print('WARN: unable to find nickname in '+actor)
|
||||||
self.server.GETbusy=False
|
self.server.GETbusy=False
|
||||||
self._redirect_headers(actor+'/inbox',cookie)
|
self._redirect_headers(actor+'/inbox?page='+str(pageNumber),cookie)
|
||||||
return
|
return
|
||||||
if not self.server.session:
|
if not self.server.session:
|
||||||
self.server.session= \
|
self.server.session= \
|
||||||
|
@ -1007,7 +1030,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
}
|
}
|
||||||
self._postToOutboxThread(newUndoAnnounce)
|
self._postToOutboxThread(newUndoAnnounce)
|
||||||
self.server.GETbusy=False
|
self.server.GETbusy=False
|
||||||
self._redirect_headers(actor+'/inbox',cookie)
|
self._redirect_headers(actor+'/inbox?page='+str(pageNumber),cookie)
|
||||||
return
|
return
|
||||||
|
|
||||||
# send a follow request approval from the web interface
|
# send a follow request approval from the web interface
|
||||||
|
@ -1051,13 +1074,23 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
# like from the web interface icon
|
# like from the web interface icon
|
||||||
if htmlGET and '?like=' in self.path and '/statuses/' in self.path:
|
if htmlGET and '?like=' in self.path and '/statuses/' in self.path:
|
||||||
|
pageNumber=1
|
||||||
likeUrl=self.path.split('?like=')[1]
|
likeUrl=self.path.split('?like=')[1]
|
||||||
|
if '?' in likeUrl:
|
||||||
|
likeUrl=likeUrl.split('?')[0]
|
||||||
actor=self.path.split('?like=')[0]
|
actor=self.path.split('?like=')[0]
|
||||||
|
if '?page=' in self.path:
|
||||||
|
pageNumberStr=self.path.split('?page=')[1]
|
||||||
|
if '?' in pageNumberStr:
|
||||||
|
pageNumberStr=pageNumberStr.split('?')[0]
|
||||||
|
if pageNumberStr.isdigit():
|
||||||
|
pageNumber=int(pageNumberStr)
|
||||||
|
|
||||||
self.postToNickname=getNicknameFromActor(actor)
|
self.postToNickname=getNicknameFromActor(actor)
|
||||||
if not self.postToNickname:
|
if not self.postToNickname:
|
||||||
print('WARN: unable to find nickname in '+actor)
|
print('WARN: unable to find nickname in '+actor)
|
||||||
self.server.GETbusy=False
|
self.server.GETbusy=False
|
||||||
self._redirect_headers(actor+'/inbox',cookie)
|
self._redirect_headers(actor+'/inbox?page='+str(pageNumber),cookie)
|
||||||
return
|
return
|
||||||
if not self.server.session:
|
if not self.server.session:
|
||||||
self.server.session= \
|
self.server.session= \
|
||||||
|
@ -1072,18 +1105,27 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
}
|
}
|
||||||
self._postToOutboxThread(likeJson)
|
self._postToOutboxThread(likeJson)
|
||||||
self.server.GETbusy=False
|
self.server.GETbusy=False
|
||||||
self._redirect_headers(actor+'/inbox',cookie)
|
self._redirect_headers(actor+'/inbox?page='+str(pageNumber),cookie)
|
||||||
return
|
return
|
||||||
|
|
||||||
# undo a like from the web interface icon
|
# undo a like from the web interface icon
|
||||||
if htmlGET and '?unlike=' in self.path and '/statuses/' in self.path:
|
if htmlGET and '?unlike=' in self.path and '/statuses/' in self.path:
|
||||||
|
pageNumber=1
|
||||||
likeUrl=self.path.split('?unlike=')[1]
|
likeUrl=self.path.split('?unlike=')[1]
|
||||||
|
if '?' in likeUrl:
|
||||||
|
likeUrl=likeUrl.split('?')[0]
|
||||||
|
if '?page=' in self.path:
|
||||||
|
pageNumberStr=self.path.split('?page=')[1]
|
||||||
|
if '?' in pageNumberStr:
|
||||||
|
pageNumberStr=pageNumberStr.split('?')[0]
|
||||||
|
if pageNumberStr.isdigit():
|
||||||
|
pageNumber=int(pageNumberStr)
|
||||||
actor=self.path.split('?unlike=')[0]
|
actor=self.path.split('?unlike=')[0]
|
||||||
self.postToNickname=getNicknameFromActor(actor)
|
self.postToNickname=getNicknameFromActor(actor)
|
||||||
if not self.postToNickname:
|
if not self.postToNickname:
|
||||||
print('WARN: unable to find nickname in '+actor)
|
print('WARN: unable to find nickname in '+actor)
|
||||||
self.server.GETbusy=False
|
self.server.GETbusy=False
|
||||||
self._redirect_headers(actor+'/inbox',cookie)
|
self._redirect_headers(actor+'/inbox?page='+str(pageNumber),cookie)
|
||||||
return
|
return
|
||||||
if not self.server.session:
|
if not self.server.session:
|
||||||
self.server.session= \
|
self.server.session= \
|
||||||
|
@ -1102,12 +1144,21 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
}
|
}
|
||||||
self._postToOutboxThread(undoLikeJson)
|
self._postToOutboxThread(undoLikeJson)
|
||||||
self.server.GETbusy=False
|
self.server.GETbusy=False
|
||||||
self._redirect_headers(actor+'/inbox',cookie)
|
self._redirect_headers(actor+'/inbox?page='+str(pageNumber),cookie)
|
||||||
return
|
return
|
||||||
|
|
||||||
# delete a post from the web interface icon
|
# delete a post from the web interface icon
|
||||||
if htmlGET and '?delete=' in self.path:
|
if htmlGET and '?delete=' in self.path:
|
||||||
|
pageNumber=1
|
||||||
|
if '?page=' in self.path:
|
||||||
|
pageNumberStr=self.path.split('?page=')[1]
|
||||||
|
if '?' in pageNumberStr:
|
||||||
|
pageNumberStr=pageNumberStr.split('?')[0]
|
||||||
|
if pageNumberStr.isdigit():
|
||||||
|
pageNumber=int(pageNumberStr)
|
||||||
deleteUrl=self.path.split('?delete=')[1]
|
deleteUrl=self.path.split('?delete=')[1]
|
||||||
|
if '?' in deleteUrl:
|
||||||
|
deleteUrl=deleteUrl.split('?')[0]
|
||||||
actor=self.server.httpPrefix+'://'+self.server.domainFull+self.path.split('?delete=')[0]
|
actor=self.server.httpPrefix+'://'+self.server.domainFull+self.path.split('?delete=')[0]
|
||||||
if self.server.allowDeletion or \
|
if self.server.allowDeletion or \
|
||||||
deleteUrl.startswith(actor):
|
deleteUrl.startswith(actor):
|
||||||
|
@ -1131,7 +1182,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.useTor)
|
self.server.useTor)
|
||||||
|
|
||||||
deleteStr= \
|
deleteStr= \
|
||||||
htmlDeletePost(self.server.session,self.server.baseDir, \
|
htmlDeletePost(pageNumber, \
|
||||||
|
self.server.session,self.server.baseDir, \
|
||||||
deleteUrl,self.server.httpPrefix, \
|
deleteUrl,self.server.httpPrefix, \
|
||||||
__version__,self.server.cachedWebfingers, \
|
__version__,self.server.cachedWebfingers, \
|
||||||
self.server.personCache)
|
self.server.personCache)
|
||||||
|
@ -1148,6 +1200,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
inReplyToUrl=None
|
inReplyToUrl=None
|
||||||
replyWithDM=False
|
replyWithDM=False
|
||||||
replyToList=[]
|
replyToList=[]
|
||||||
|
replyPageNumber=1
|
||||||
shareDescription=None
|
shareDescription=None
|
||||||
if htmlGET:
|
if htmlGET:
|
||||||
# public reply
|
# public reply
|
||||||
|
@ -1158,6 +1211,10 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
for m in mentionsList:
|
for m in mentionsList:
|
||||||
if m.startswith('mention='):
|
if m.startswith('mention='):
|
||||||
replyToList.append(m.replace('mention=',''))
|
replyToList.append(m.replace('mention=',''))
|
||||||
|
if m.startswith('page='):
|
||||||
|
replyPageStr=m.replace('page=','')
|
||||||
|
if replyPageStr.isdigit():
|
||||||
|
replyPageNumber=int(replyPageStr)
|
||||||
inReplyToUrl=mentionsList[0]
|
inReplyToUrl=mentionsList[0]
|
||||||
self.path=self.path.split('?replyto=')[0]+'/newpost'
|
self.path=self.path.split('?replyto=')[0]+'/newpost'
|
||||||
if self.server.debug:
|
if self.server.debug:
|
||||||
|
@ -1171,6 +1228,10 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
for m in mentionsList:
|
for m in mentionsList:
|
||||||
if m.startswith('mention='):
|
if m.startswith('mention='):
|
||||||
replyToList.append(m.replace('mention=',''))
|
replyToList.append(m.replace('mention=',''))
|
||||||
|
if m.startswith('page='):
|
||||||
|
replyPageStr=m.replace('page=','')
|
||||||
|
if replyPageStr.isdigit():
|
||||||
|
replyPageNumber=int(replyPageStr)
|
||||||
inReplyToUrl=mentionsList[0]
|
inReplyToUrl=mentionsList[0]
|
||||||
self.path=self.path.split('?replyfollowers=')[0]+'/newfollowers'
|
self.path=self.path.split('?replyfollowers=')[0]+'/newfollowers'
|
||||||
if self.server.debug:
|
if self.server.debug:
|
||||||
|
@ -1184,6 +1245,10 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
for m in mentionsList:
|
for m in mentionsList:
|
||||||
if m.startswith('mention='):
|
if m.startswith('mention='):
|
||||||
replyToList.append(m.replace('mention=',''))
|
replyToList.append(m.replace('mention=',''))
|
||||||
|
if m.startswith('page='):
|
||||||
|
replyPageStr=m.replace('page=','')
|
||||||
|
if replyPageStr.isdigit():
|
||||||
|
replyPageNumber=int(replyPageStr)
|
||||||
inReplyToUrl=mentionsList[0]
|
inReplyToUrl=mentionsList[0]
|
||||||
if inReplyToUrl.startswith('sharedesc:'):
|
if inReplyToUrl.startswith('sharedesc:'):
|
||||||
shareDescription=inReplyToUrl.replace('sharedesc:','').replace('%20',' ').replace('%40','@').replace('%3A',':').replace('%23','#')
|
shareDescription=inReplyToUrl.replace('sharedesc:','').replace('%20',' ').replace('%40','@').replace('%3A',':').replace('%23','#')
|
||||||
|
@ -1207,7 +1272,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.path.endswith('/newdm') or \
|
self.path.endswith('/newdm') or \
|
||||||
self.path.endswith('/newreport') or \
|
self.path.endswith('/newreport') or \
|
||||||
self.path.endswith('/newshare')):
|
self.path.endswith('/newshare')):
|
||||||
msg=htmlNewPost(self.server.baseDir,self.path,inReplyToUrl,replyToList,shareDescription).encode()
|
msg=htmlNewPost(self.server.baseDir,self.path,inReplyToUrl,replyToList,shareDescription,replyPageNumber).encode()
|
||||||
self._set_headers('text/html',len(msg),cookie)
|
self._set_headers('text/html',len(msg),cookie)
|
||||||
self.wfile.write(msg)
|
self.wfile.write(msg)
|
||||||
self.server.GETbusy=False
|
self.server.GETbusy=False
|
||||||
|
@ -1896,11 +1961,12 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
def do_HEAD(self):
|
def do_HEAD(self):
|
||||||
self._set_headers('application/json',0,None)
|
self._set_headers('application/json',0,None)
|
||||||
|
|
||||||
def _receiveNewPost(self,authorized: bool,postType: str) -> int:
|
def _receiveNewPost(self,authorized: bool,postType: str) -> (int,int):
|
||||||
# 0 = this is not a new post
|
# 0 = this is not a new post
|
||||||
# 1 = new post success
|
# 1 = new post success
|
||||||
# -1 = new post failed
|
# -1 = new post failed
|
||||||
# 2 = new post canceled
|
# 2 = new post canceled
|
||||||
|
pageNumber=1
|
||||||
if authorized and '/users/' in self.path and self.path.endswith('?'+postType):
|
if authorized and '/users/' in self.path and self.path.endswith('?'+postType):
|
||||||
if ' boundary=' in self.headers['Content-type']:
|
if ' boundary=' in self.headers['Content-type']:
|
||||||
nickname=None
|
nickname=None
|
||||||
|
@ -1908,11 +1974,11 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
if '/' in nicknameStr:
|
if '/' in nicknameStr:
|
||||||
nickname=nicknameStr.split('/')[0]
|
nickname=nicknameStr.split('/')[0]
|
||||||
else:
|
else:
|
||||||
return -1
|
return -1,pageNumber
|
||||||
length = int(self.headers['Content-length'])
|
length = int(self.headers['Content-length'])
|
||||||
if length>self.server.maxPostLength:
|
if length>self.server.maxPostLength:
|
||||||
print('POST size too large')
|
print('POST size too large')
|
||||||
return -1
|
return -1,pageNumber
|
||||||
|
|
||||||
boundary=self.headers['Content-type'].split('boundary=')[1]
|
boundary=self.headers['Content-type'].split('boundary=')[1]
|
||||||
if ';' in boundary:
|
if ';' in boundary:
|
||||||
|
@ -1992,14 +2058,19 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
else:
|
else:
|
||||||
filename=None
|
filename=None
|
||||||
|
|
||||||
|
# get the page number to return to
|
||||||
|
if fields.get('pageNumber'):
|
||||||
|
if fields['pageNumber'].isdigit():
|
||||||
|
pageNumber=int(fields['pageNumber'])
|
||||||
|
|
||||||
# send the post
|
# send the post
|
||||||
if not fields.get('message'):
|
if not fields.get('message'):
|
||||||
return -1
|
return -1,pageNumber
|
||||||
if fields.get('submitPost'):
|
if fields.get('submitPost'):
|
||||||
if fields['submitPost']!='Submit':
|
if fields['submitPost']!='Submit':
|
||||||
return -1
|
return -1,pageNumber
|
||||||
else:
|
else:
|
||||||
return 2
|
return 2,pageNumber
|
||||||
|
|
||||||
if not fields.get('imageDescription'):
|
if not fields.get('imageDescription'):
|
||||||
fields['imageDescription']=None
|
fields['imageDescription']=None
|
||||||
|
@ -2026,9 +2097,9 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
messageJson, \
|
messageJson, \
|
||||||
self.server.maxReplies, \
|
self.server.maxReplies, \
|
||||||
self.server.debug)
|
self.server.debug)
|
||||||
return 1
|
return 1,pageNumber
|
||||||
else:
|
else:
|
||||||
return -1
|
return -1,pageNumber
|
||||||
|
|
||||||
if postType=='newunlisted':
|
if postType=='newunlisted':
|
||||||
messageJson= \
|
messageJson= \
|
||||||
|
@ -2048,9 +2119,9 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
messageJson, \
|
messageJson, \
|
||||||
self.server.maxReplies, \
|
self.server.maxReplies, \
|
||||||
self.server.debug)
|
self.server.debug)
|
||||||
return 1
|
return 1,pageNumber
|
||||||
else:
|
else:
|
||||||
return -1
|
return -1,pageNumber
|
||||||
|
|
||||||
if postType=='newfollowers':
|
if postType=='newfollowers':
|
||||||
messageJson= \
|
messageJson= \
|
||||||
|
@ -2070,9 +2141,9 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
messageJson, \
|
messageJson, \
|
||||||
self.server.maxReplies, \
|
self.server.maxReplies, \
|
||||||
self.server.debug)
|
self.server.debug)
|
||||||
return 1
|
return 1,pageNumber
|
||||||
else:
|
else:
|
||||||
return -1
|
return -1,pageNumber
|
||||||
|
|
||||||
if postType=='newdm':
|
if postType=='newdm':
|
||||||
messageJson=None
|
messageJson=None
|
||||||
|
@ -2099,14 +2170,14 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
messageJson, \
|
messageJson, \
|
||||||
self.server.maxReplies, \
|
self.server.maxReplies, \
|
||||||
self.server.debug)
|
self.server.debug)
|
||||||
return 1
|
return 1,pageNumber
|
||||||
else:
|
else:
|
||||||
return -1
|
return -1,pageNumber
|
||||||
|
|
||||||
if postType=='newreport':
|
if postType=='newreport':
|
||||||
if attachmentMediaType:
|
if attachmentMediaType:
|
||||||
if attachmentMediaType!='image':
|
if attachmentMediaType!='image':
|
||||||
return -1
|
return -1,pageNumber
|
||||||
# So as to be sure that this only goes to moderators
|
# So as to be sure that this only goes to moderators
|
||||||
# and not accounts being reported we disable any
|
# and not accounts being reported we disable any
|
||||||
# included fediverse addresses by replacing '@' with '-at-'
|
# included fediverse addresses by replacing '@' with '-at-'
|
||||||
|
@ -2123,22 +2194,22 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
if messageJson:
|
if messageJson:
|
||||||
self.postToNickname=nickname
|
self.postToNickname=nickname
|
||||||
if self._postToOutbox(messageJson,__version__):
|
if self._postToOutbox(messageJson,__version__):
|
||||||
return 1
|
return 1,pageNumber
|
||||||
else:
|
else:
|
||||||
return -1
|
return -1,pageNumber
|
||||||
|
|
||||||
if postType=='newshare':
|
if postType=='newshare':
|
||||||
if not fields.get('itemType'):
|
if not fields.get('itemType'):
|
||||||
return -1
|
return -1,pageNumber
|
||||||
if not fields.get('category'):
|
if not fields.get('category'):
|
||||||
return -1
|
return -1,pageNumber
|
||||||
if not fields.get('location'):
|
if not fields.get('location'):
|
||||||
return -1
|
return -1,pageNumber
|
||||||
if not fields.get('duration'):
|
if not fields.get('duration'):
|
||||||
return -1
|
return -1,pageNumber
|
||||||
if attachmentMediaType:
|
if attachmentMediaType:
|
||||||
if attachmentMediaType!='image':
|
if attachmentMediaType!='image':
|
||||||
return -1
|
return -1,pageNumber
|
||||||
addShare(self.server.baseDir, \
|
addShare(self.server.baseDir, \
|
||||||
self.server.httpPrefix, \
|
self.server.httpPrefix, \
|
||||||
nickname, \
|
nickname, \
|
||||||
|
@ -2155,10 +2226,10 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
if os.path.isfile(filename):
|
if os.path.isfile(filename):
|
||||||
os.remove(filename)
|
os.remove(filename)
|
||||||
self.postToNickname=nickname
|
self.postToNickname=nickname
|
||||||
return 1
|
return 1,pageNumber
|
||||||
return -1
|
return -1,pageNumber
|
||||||
else:
|
else:
|
||||||
return 0
|
return 0,pageNumber
|
||||||
|
|
||||||
def do_POST(self):
|
def do_POST(self):
|
||||||
if not self.server.session:
|
if not self.server.session:
|
||||||
|
@ -2759,6 +2830,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
# removes a post
|
# removes a post
|
||||||
if authorized and self.path.endswith('/rmpost'):
|
if authorized and self.path.endswith('/rmpost'):
|
||||||
|
pageNumber=1
|
||||||
originPathStr=self.path.split('/rmpost')[0]
|
originPathStr=self.path.split('/rmpost')[0]
|
||||||
length = int(self.headers['Content-length'])
|
length = int(self.headers['Content-length'])
|
||||||
removePostConfirmParams=self.rfile.read(length).decode('utf-8')
|
removePostConfirmParams=self.rfile.read(length).decode('utf-8')
|
||||||
|
@ -2767,6 +2839,12 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
removeMessageId=removePostConfirmParams.split('messageId=')[1]
|
removeMessageId=removePostConfirmParams.split('messageId=')[1]
|
||||||
if '&' in removeMessageId:
|
if '&' in removeMessageId:
|
||||||
removeMessageId=removeMessageId.split('&')[0]
|
removeMessageId=removeMessageId.split('&')[0]
|
||||||
|
if 'pageNumber=' in removePostConfirmParams:
|
||||||
|
pageNumberStr=removePostConfirmParams.split('pageNumber=')[1]
|
||||||
|
if '&' in pageNumberStr:
|
||||||
|
pageNumberStr=pageNumberStr.split('&')[0]
|
||||||
|
if pageNumberStr.isdigit():
|
||||||
|
pageNumber=int(pageNumberStr)
|
||||||
if '/statuses/' in removeMessageId:
|
if '/statuses/' in removeMessageId:
|
||||||
removePostActor=removeMessageId.split('/statuses/')[0]
|
removePostActor=removeMessageId.split('/statuses/')[0]
|
||||||
if originPathStr in removePostActor:
|
if originPathStr in removePostActor:
|
||||||
|
@ -2782,8 +2860,11 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
pprint(deleteJson)
|
pprint(deleteJson)
|
||||||
self.postToNickname=getNicknameFromActor(removePostActor)
|
self.postToNickname=getNicknameFromActor(removePostActor)
|
||||||
if self.postToNickname:
|
if self.postToNickname:
|
||||||
self._postToOutboxThread(deleteJson)
|
self._postToOutboxThread(deleteJson)
|
||||||
self._redirect_headers(originPathStr+'/outbox',cookie)
|
if pageNumber==1:
|
||||||
|
self._redirect_headers(originPathStr+'/outbox',cookie)
|
||||||
|
else:
|
||||||
|
self._redirect_headers(originPathStr+'/outbox?page='+str(pageNumber),cookie)
|
||||||
self.server.POSTbusy=False
|
self.server.POSTbusy=False
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -2953,6 +3034,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
# an option was chosen from person options screen
|
# an option was chosen from person options screen
|
||||||
# view/follow/block/report
|
# view/follow/block/report
|
||||||
if authorized and self.path.endswith('/personoptions'):
|
if authorized and self.path.endswith('/personoptions'):
|
||||||
|
pageNumber=1
|
||||||
originPathStr=self.path.split('/personoptions')[0]
|
originPathStr=self.path.split('/personoptions')[0]
|
||||||
chooserNickname=getNicknameFromActor(originPathStr)
|
chooserNickname=getNicknameFromActor(originPathStr)
|
||||||
if not chooserNickname:
|
if not chooserNickname:
|
||||||
|
@ -2962,6 +3044,13 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
return
|
return
|
||||||
length = int(self.headers['Content-length'])
|
length = int(self.headers['Content-length'])
|
||||||
optionsConfirmParams=self.rfile.read(length).decode('utf-8').replace('%3A',':').replace('%2F','/')
|
optionsConfirmParams=self.rfile.read(length).decode('utf-8').replace('%3A',':').replace('%2F','/')
|
||||||
|
# page number to return to
|
||||||
|
if 'pageNumber=' in optionsConfirmParams:
|
||||||
|
pageNumberStr=optionsConfirmParams.split('pageNumber=')[1]
|
||||||
|
if '&' in pageNumberStr:
|
||||||
|
pageNumberStr=pageNumberStr.split('&')[0]
|
||||||
|
if pageNumberStr.isdigit():
|
||||||
|
pageNumber=int(pageNumberStr)
|
||||||
# actor for the person
|
# actor for the person
|
||||||
optionsActor=optionsConfirmParams.split('actor=')[1]
|
optionsActor=optionsConfirmParams.split('actor=')[1]
|
||||||
if '&' in optionsActor:
|
if '&' in optionsActor:
|
||||||
|
@ -3034,7 +3123,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
if self.server.debug:
|
if self.server.debug:
|
||||||
print('Sending DM to '+optionsActor)
|
print('Sending DM to '+optionsActor)
|
||||||
reportPath=self.path.replace('/personoptions','')+'/newdm'
|
reportPath=self.path.replace('/personoptions','')+'/newdm'
|
||||||
msg=htmlNewPost(self.server.baseDir,reportPath,None,[optionsActor],None).encode()
|
msg=htmlNewPost(self.server.baseDir,reportPath,None,[optionsActor],None,pageNumber).encode()
|
||||||
self._set_headers('text/html',len(msg),cookie)
|
self._set_headers('text/html',len(msg),cookie)
|
||||||
self.wfile.write(msg)
|
self.wfile.write(msg)
|
||||||
self.server.POSTbusy=False
|
self.server.POSTbusy=False
|
||||||
|
@ -3043,7 +3132,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
if self.server.debug:
|
if self.server.debug:
|
||||||
print('Reporting '+optionsActor)
|
print('Reporting '+optionsActor)
|
||||||
reportPath=self.path.replace('/personoptions','')+'/newreport'
|
reportPath=self.path.replace('/personoptions','')+'/newreport'
|
||||||
msg=htmlNewPost(self.server.baseDir,reportPath,None,[],postUrl).encode()
|
msg=htmlNewPost(self.server.baseDir,reportPath,None,[],postUrl,pageNumber).encode()
|
||||||
self._set_headers('text/html',len(msg),cookie)
|
self._set_headers('text/html',len(msg),cookie)
|
||||||
self.wfile.write(msg)
|
self.wfile.write(msg)
|
||||||
self.server.POSTbusy=False
|
self.server.POSTbusy=False
|
||||||
|
@ -3053,52 +3142,52 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.POSTbusy=False
|
self.server.POSTbusy=False
|
||||||
return
|
return
|
||||||
|
|
||||||
postState=self._receiveNewPost(authorized,'newpost')
|
postState,pageNumber=self._receiveNewPost(authorized,'newpost')
|
||||||
if postState!=0:
|
if postState!=0:
|
||||||
nickname=self.path.split('/users/')[1]
|
nickname=self.path.split('/users/')[1]
|
||||||
if '/' in nickname:
|
if '/' in nickname:
|
||||||
nickname=nickname.split('/')[0]
|
nickname=nickname.split('/')[0]
|
||||||
self._redirect_headers('/users/'+nickname+'/inbox',cookie)
|
self._redirect_headers('/users/'+nickname+'/inbox?page='+str(pageNumber),cookie)
|
||||||
self.server.POSTbusy=False
|
self.server.POSTbusy=False
|
||||||
return
|
return
|
||||||
postState=self._receiveNewPost(authorized,'newunlisted')
|
postState,pageNumber=self._receiveNewPost(authorized,'newunlisted')
|
||||||
if postState!=0:
|
if postState!=0:
|
||||||
nickname=self.path.split('/users/')[1]
|
nickname=self.path.split('/users/')[1]
|
||||||
if '/' in nickname:
|
if '/' in nickname:
|
||||||
nickname=nickname.split('/')[0]
|
nickname=nickname.split('/')[0]
|
||||||
self._redirect_headers('/users/'+nickname+'/inbox',cookie)
|
self._redirect_headers('/users/'+nickname+'/inbox?page='+str(pageNumber),cookie)
|
||||||
self.server.POSTbusy=False
|
self.server.POSTbusy=False
|
||||||
return
|
return
|
||||||
postState=self._receiveNewPost(authorized,'newfollowers')
|
postState,pageNumber=self._receiveNewPost(authorized,'newfollowers')
|
||||||
if postState!=0:
|
if postState!=0:
|
||||||
nickname=self.path.split('/users/')[1]
|
nickname=self.path.split('/users/')[1]
|
||||||
if '/' in nickname:
|
if '/' in nickname:
|
||||||
nickname=nickname.split('/')[0]
|
nickname=nickname.split('/')[0]
|
||||||
self._redirect_headers('/users/'+nickname+'/inbox',cookie)
|
self._redirect_headers('/users/'+nickname+'/inbox?page='+str(pageNumber),cookie)
|
||||||
self.server.POSTbusy=False
|
self.server.POSTbusy=False
|
||||||
return
|
return
|
||||||
postState=self._receiveNewPost(authorized,'newdm')
|
postState,pageNumber=self._receiveNewPost(authorized,'newdm')
|
||||||
if postState!=0:
|
if postState!=0:
|
||||||
nickname=self.path.split('/users/')[1]
|
nickname=self.path.split('/users/')[1]
|
||||||
if '/' in nickname:
|
if '/' in nickname:
|
||||||
nickname=nickname.split('/')[0]
|
nickname=nickname.split('/')[0]
|
||||||
self._redirect_headers('/users/'+nickname+'/inbox',cookie)
|
self._redirect_headers('/users/'+nickname+'/inbox?page='+str(pageNumber),cookie)
|
||||||
self.server.POSTbusy=False
|
self.server.POSTbusy=False
|
||||||
return
|
return
|
||||||
postState=self._receiveNewPost(authorized,'newreport')
|
postState,pageNumber=self._receiveNewPost(authorized,'newreport')
|
||||||
if postState!=0:
|
if postState!=0:
|
||||||
nickname=self.path.split('/users/')[1]
|
nickname=self.path.split('/users/')[1]
|
||||||
if '/' in nickname:
|
if '/' in nickname:
|
||||||
nickname=nickname.split('/')[0]
|
nickname=nickname.split('/')[0]
|
||||||
self._redirect_headers('/users/'+nickname+'/inbox',cookie)
|
self._redirect_headers('/users/'+nickname+'/inbox?page='+str(pageNumber),cookie)
|
||||||
self.server.POSTbusy=False
|
self.server.POSTbusy=False
|
||||||
return
|
return
|
||||||
postState=self._receiveNewPost(authorized,'newshare')
|
postState,pageNumber=self._receiveNewPost(authorized,'newshare')
|
||||||
if postState!=0:
|
if postState!=0:
|
||||||
nickname=self.path.split('/users/')[1]
|
nickname=self.path.split('/users/')[1]
|
||||||
if '/' in nickname:
|
if '/' in nickname:
|
||||||
nickname=nickname.split('/')[0]
|
nickname=nickname.split('/')[0]
|
||||||
self._redirect_headers('/users/'+nickname+'/shares',cookie)
|
self._redirect_headers('/users/'+nickname+'/shares?page='+str(pageNumber),cookie)
|
||||||
self.server.POSTbusy=False
|
self.server.POSTbusy=False
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -272,7 +272,7 @@ def htmlHashtagSearch(baseDir: str,hashtag: str,pageNumber: int,postsPerPage: in
|
||||||
index-=1
|
index-=1
|
||||||
continue
|
continue
|
||||||
hashtagSearchForm+= \
|
hashtagSearchForm+= \
|
||||||
individualPostAsHtml(baseDir,session,wfRequest,personCache, \
|
individualPostAsHtml(None,baseDir,session,wfRequest,personCache, \
|
||||||
nickname,domain,port,postJsonObject, \
|
nickname,domain,port,postJsonObject, \
|
||||||
None,True,False, \
|
None,True,False, \
|
||||||
httpPrefix,projectVersion, \
|
httpPrefix,projectVersion, \
|
||||||
|
@ -680,7 +680,7 @@ def htmlSuspended(baseDir: str) -> str:
|
||||||
suspendedForm+=htmlFooter()
|
suspendedForm+=htmlFooter()
|
||||||
return suspendedForm
|
return suspendedForm
|
||||||
|
|
||||||
def htmlNewPost(baseDir: str,path: str,inReplyTo: str,mentions: [],reportUrl: str) -> str:
|
def htmlNewPost(baseDir: str,path: str,inReplyTo: str,mentions: [],reportUrl: str,pageNumber: int) -> str:
|
||||||
"""New post screen
|
"""New post screen
|
||||||
"""
|
"""
|
||||||
replyStr=''
|
replyStr=''
|
||||||
|
@ -814,7 +814,7 @@ def htmlNewPost(baseDir: str,path: str,inReplyTo: str,mentions: [],reportUrl: st
|
||||||
mentionsStr='Re: '+reportUrl+'\n\n'+mentionsStr
|
mentionsStr='Re: '+reportUrl+'\n\n'+mentionsStr
|
||||||
|
|
||||||
newPostForm+= \
|
newPostForm+= \
|
||||||
'<form enctype="multipart/form-data" method="POST" action="'+path+'?'+endpoint+'">' \
|
'<form enctype="multipart/form-data" method="POST" action="'+path+'?'+endpoint+'?page='+str(pageNumber)+'">' \
|
||||||
' <div class="vertical-center">' \
|
' <div class="vertical-center">' \
|
||||||
' <label for="nickname"><b>'+newPostText+'</b></label>' \
|
' <label for="nickname"><b>'+newPostText+'</b></label>' \
|
||||||
' <div class="container">' \
|
' <div class="container">' \
|
||||||
|
@ -903,7 +903,7 @@ def htmlProfilePosts(baseDir: str,httpPrefix: str, \
|
||||||
break
|
break
|
||||||
for item in outboxFeed['orderedItems']:
|
for item in outboxFeed['orderedItems']:
|
||||||
if item['type']=='Create' or item['type']=='Announce':
|
if item['type']=='Create' or item['type']=='Announce':
|
||||||
postStr=individualPostAsHtml(baseDir,session,wfRequest,personCache, \
|
postStr=individualPostAsHtml(None,baseDir,session,wfRequest,personCache, \
|
||||||
nickname,domain,port,item,None,True,False, \
|
nickname,domain,port,item,None,True,False, \
|
||||||
httpPrefix,projectVersion, \
|
httpPrefix,projectVersion, \
|
||||||
False,False,False,True)
|
False,False,False,True)
|
||||||
|
@ -1354,7 +1354,7 @@ def followerApprovalActive(baseDir: str,nickname: str,domain: str) -> bool:
|
||||||
manuallyApprovesFollowers=actorJson['manuallyApprovesFollowers']
|
manuallyApprovesFollowers=actorJson['manuallyApprovesFollowers']
|
||||||
return manuallyApprovesFollowers
|
return manuallyApprovesFollowers
|
||||||
|
|
||||||
def individualPostAsHtml(baseDir: str, \
|
def individualPostAsHtml(pageNumber: int,baseDir: str, \
|
||||||
session,wfRequest: {},personCache: {}, \
|
session,wfRequest: {},personCache: {}, \
|
||||||
nickname: str,domain: str,port: int, \
|
nickname: str,domain: str,port: int, \
|
||||||
postJsonObject: {}, \
|
postJsonObject: {}, \
|
||||||
|
@ -1594,7 +1594,7 @@ def individualPostAsHtml(baseDir: str, \
|
||||||
if showAvatarDropdown and fullDomain+'/users/'+nickname not in postJsonObject['actor']:
|
if showAvatarDropdown and fullDomain+'/users/'+nickname not in postJsonObject['actor']:
|
||||||
avatarImageInPost= \
|
avatarImageInPost= \
|
||||||
' <div class="timeline-avatar">' \
|
' <div class="timeline-avatar">' \
|
||||||
' <a href="/users/'+nickname+'?options='+postJsonObject['actor']+';'+avatarUrl+messageIdStr+'">' \
|
' <a href="/users/'+nickname+'?options='+postJsonObject['actor']+';'+str(pageNumber)+';'+avatarUrl+messageIdStr+'">' \
|
||||||
' <img title="Show options for this person" src="'+avatarUrl+'" '+avatarPosition+'/></a>' \
|
' <img title="Show options for this person" src="'+avatarUrl+'" '+avatarPosition+'/></a>' \
|
||||||
' </div>'
|
' </div>'
|
||||||
|
|
||||||
|
@ -1621,7 +1621,7 @@ def individualPostAsHtml(baseDir: str, \
|
||||||
announceLink='unrepeat'
|
announceLink='unrepeat'
|
||||||
announceTitle='Undo the repeat this post'
|
announceTitle='Undo the repeat this post'
|
||||||
announceStr= \
|
announceStr= \
|
||||||
'<a href="/users/'+nickname+'?'+announceLink+'='+postJsonObject['object']['id']+'" title="'+announceTitle+'">' \
|
'<a href="/users/'+nickname+'?'+announceLink+'='+postJsonObject['object']['id']+'?page='+str(pageNumber)+'" title="'+announceTitle+'">' \
|
||||||
'<img src="/icons/'+announceIcon+'"/></a>'
|
'<img src="/icons/'+announceIcon+'"/></a>'
|
||||||
|
|
||||||
likeStr=''
|
likeStr=''
|
||||||
|
@ -1634,7 +1634,7 @@ def individualPostAsHtml(baseDir: str, \
|
||||||
likeLink='unlike'
|
likeLink='unlike'
|
||||||
likeTitle='Undo the like of this post'
|
likeTitle='Undo the like of this post'
|
||||||
likeStr= \
|
likeStr= \
|
||||||
'<a href="/users/'+nickname+'?'+likeLink+'='+postJsonObject['object']['id']+'" title="'+likeTitle+'">' \
|
'<a href="/users/'+nickname+'?'+likeLink+'='+postJsonObject['object']['id']+'?page='+str(pageNumber)+'" title="'+likeTitle+'">' \
|
||||||
'<img src="/icons/'+likeIcon+'"/></a>'
|
'<img src="/icons/'+likeIcon+'"/></a>'
|
||||||
|
|
||||||
deleteStr=''
|
deleteStr=''
|
||||||
|
@ -1643,7 +1643,7 @@ def individualPostAsHtml(baseDir: str, \
|
||||||
postJsonObject['object']['id'].startswith(postJsonObject['actor'])):
|
postJsonObject['object']['id'].startswith(postJsonObject['actor'])):
|
||||||
if '/users/'+nickname+'/' in postJsonObject['object']['id']:
|
if '/users/'+nickname+'/' in postJsonObject['object']['id']:
|
||||||
deleteStr= \
|
deleteStr= \
|
||||||
'<a href="/users/'+nickname+'?delete='+postJsonObject['object']['id']+'" title="Delete this post">' \
|
'<a href="/users/'+nickname+'?delete='+postJsonObject['object']['id']+'?page='+str(pageNumber)+'" title="Delete this post">' \
|
||||||
'<img src="/icons/delete.png"/></a>'
|
'<img src="/icons/delete.png"/></a>'
|
||||||
|
|
||||||
# change the background color for DMs in inbox timeline
|
# change the background color for DMs in inbox timeline
|
||||||
|
@ -1663,6 +1663,7 @@ def individualPostAsHtml(baseDir: str, \
|
||||||
replyToLink+='?mention='+actorUrl
|
replyToLink+='?mention='+actorUrl
|
||||||
if len(replyToLink)>500:
|
if len(replyToLink)>500:
|
||||||
break
|
break
|
||||||
|
replyToLink+='?page='+str(pageNumber)
|
||||||
|
|
||||||
footerStr='<div class="'+containerClassIcons+'">'
|
footerStr='<div class="'+containerClassIcons+'">'
|
||||||
if not isModerationPost and showRepeatIcon:
|
if not isModerationPost and showRepeatIcon:
|
||||||
|
@ -1808,7 +1809,8 @@ def htmlTimeline(pageNumber: int,itemsPerPage: int,session,baseDir: str, \
|
||||||
if item['type']=='Create' or item['type']=='Announce':
|
if item['type']=='Create' or item['type']=='Announce':
|
||||||
itemCtr+=1
|
itemCtr+=1
|
||||||
avatarUrl=getPersonAvatarUrl(baseDir,item['actor'],personCache)
|
avatarUrl=getPersonAvatarUrl(baseDir,item['actor'],personCache)
|
||||||
tlStr+=individualPostAsHtml(baseDir,session,wfRequest,personCache, \
|
tlStr+=individualPostAsHtml(pageNumber, \
|
||||||
|
baseDir,session,wfRequest,personCache, \
|
||||||
nickname,domain,port,item,avatarUrl,True, \
|
nickname,domain,port,item,avatarUrl,True, \
|
||||||
allowDeletion, \
|
allowDeletion, \
|
||||||
httpPrefix,projectVersion, \
|
httpPrefix,projectVersion, \
|
||||||
|
@ -1878,7 +1880,7 @@ def htmlIndividualPost(baseDir: str,session,wfRequest: {},personCache: {}, \
|
||||||
"""
|
"""
|
||||||
postStr='<script>'+contentWarningScript()+'</script>'
|
postStr='<script>'+contentWarningScript()+'</script>'
|
||||||
postStr+= \
|
postStr+= \
|
||||||
individualPostAsHtml(baseDir,session,wfRequest,personCache, \
|
individualPostAsHtml(None,baseDir,session,wfRequest,personCache, \
|
||||||
nickname,domain,port,postJsonObject,None,True,False, \
|
nickname,domain,port,postJsonObject,None,True,False, \
|
||||||
httpPrefix,projectVersion,False,False,False,False)
|
httpPrefix,projectVersion,False,False,False,False)
|
||||||
messageId=postJsonObject['id'].replace('/activity','')
|
messageId=postJsonObject['id'].replace('/activity','')
|
||||||
|
@ -1891,7 +1893,8 @@ def htmlIndividualPost(baseDir: str,session,wfRequest: {},personCache: {}, \
|
||||||
with open(postFilename, 'r') as fp:
|
with open(postFilename, 'r') as fp:
|
||||||
postJsonObject=commentjson.load(fp)
|
postJsonObject=commentjson.load(fp)
|
||||||
postStr= \
|
postStr= \
|
||||||
individualPostAsHtml(baseDir,session,wfRequest,personCache, \
|
individualPostAsHtml(None, \
|
||||||
|
baseDir,session,wfRequest,personCache, \
|
||||||
nickname,domain,port,postJsonObject, \
|
nickname,domain,port,postJsonObject, \
|
||||||
None,True,False, \
|
None,True,False, \
|
||||||
httpPrefix,projectVersion, \
|
httpPrefix,projectVersion, \
|
||||||
|
@ -1909,7 +1912,8 @@ def htmlIndividualPost(baseDir: str,session,wfRequest: {},personCache: {}, \
|
||||||
# add items to the html output
|
# add items to the html output
|
||||||
for item in repliesJson['orderedItems']:
|
for item in repliesJson['orderedItems']:
|
||||||
postStr+= \
|
postStr+= \
|
||||||
individualPostAsHtml(baseDir,session,wfRequest,personCache, \
|
individualPostAsHtml(None, \
|
||||||
|
baseDir,session,wfRequest,personCache, \
|
||||||
nickname,domain,port,item,None,True,False, \
|
nickname,domain,port,item,None,True,False, \
|
||||||
httpPrefix,projectVersion,False,False,False,False)
|
httpPrefix,projectVersion,False,False,False,False)
|
||||||
return htmlHeader()+postStr+htmlFooter()
|
return htmlHeader()+postStr+htmlFooter()
|
||||||
|
@ -1922,7 +1926,7 @@ def htmlPostReplies(baseDir: str,session,wfRequest: {},personCache: {}, \
|
||||||
repliesStr=''
|
repliesStr=''
|
||||||
if repliesJson.get('orderedItems'):
|
if repliesJson.get('orderedItems'):
|
||||||
for item in repliesJson['orderedItems']:
|
for item in repliesJson['orderedItems']:
|
||||||
repliesStr+=individualPostAsHtml(baseDir,session,wfRequest,personCache, \
|
repliesStr+=individualPostAsHtml(None,baseDir,session,wfRequest,personCache, \
|
||||||
nickname,domain,port,item,None,True,False, \
|
nickname,domain,port,item,None,True,False, \
|
||||||
httpPrefix,projectVersion,False,False,False,False)
|
httpPrefix,projectVersion,False,False,False,False)
|
||||||
|
|
||||||
|
@ -1974,7 +1978,8 @@ def htmlRemoveSharedItem(baseDir: str,actor: str,shareName: str) -> str:
|
||||||
sharesStr+=htmlFooter()
|
sharesStr+=htmlFooter()
|
||||||
return sharesStr
|
return sharesStr
|
||||||
|
|
||||||
def htmlDeletePost(session,baseDir: str,messageId: str, \
|
def htmlDeletePost(pageNumber: int, \
|
||||||
|
session,baseDir: str,messageId: str, \
|
||||||
httpPrefix: str,projectVersion: str, \
|
httpPrefix: str,projectVersion: str, \
|
||||||
wfRequest: {},personCache: {}) -> str:
|
wfRequest: {},personCache: {}) -> str:
|
||||||
"""Shows a screen asking to confirm the deletion of a post
|
"""Shows a screen asking to confirm the deletion of a post
|
||||||
|
@ -1994,7 +1999,8 @@ def htmlDeletePost(session,baseDir: str,messageId: str, \
|
||||||
|
|
||||||
if os.path.isfile(baseDir+'/img/delete-background.png'):
|
if os.path.isfile(baseDir+'/img/delete-background.png'):
|
||||||
if not os.path.isfile(baseDir+'/accounts/delete-background.png'):
|
if not os.path.isfile(baseDir+'/accounts/delete-background.png'):
|
||||||
copyfile(baseDir+'/img/delete-background.png',baseDir+'/accounts/delete-background.png')
|
copyfile(baseDir+'/img/delete-background.png', \
|
||||||
|
baseDir+'/accounts/delete-background.png')
|
||||||
|
|
||||||
deletePostStr=None
|
deletePostStr=None
|
||||||
with open(baseDir+'/epicyon-profile.css', 'r') as cssFile:
|
with open(baseDir+'/epicyon-profile.css', 'r') as cssFile:
|
||||||
|
@ -2002,13 +2008,14 @@ def htmlDeletePost(session,baseDir: str,messageId: str, \
|
||||||
deletePostStr=htmlHeader(profileStyle)
|
deletePostStr=htmlHeader(profileStyle)
|
||||||
deletePostStr+='<script>'+contentWarningScript()+'</script>'
|
deletePostStr+='<script>'+contentWarningScript()+'</script>'
|
||||||
deletePostStr+= \
|
deletePostStr+= \
|
||||||
individualPostAsHtml(baseDir,session,wfRequest,personCache, \
|
individualPostAsHtml(pageNumber,baseDir,session,wfRequest,personCache, \
|
||||||
nickname,domain,port,postJsonObject,None,True,False, \
|
nickname,domain,port,postJsonObject,None,True,False, \
|
||||||
httpPrefix,projectVersion,False,False,False,False)
|
httpPrefix,projectVersion,False,False,False,False)
|
||||||
deletePostStr+='<center>'
|
deletePostStr+='<center>'
|
||||||
deletePostStr+=' <p class="followText">Delete this post?</p>'
|
deletePostStr+=' <p class="followText">Delete this post?</p>'
|
||||||
deletePostStr+= \
|
deletePostStr+= \
|
||||||
' <form method="POST" action="'+actor+'/rmpost">' \
|
' <form method="POST" action="'+actor+'/rmpost">' \
|
||||||
|
' <input type="hidden" name="pageNumber" value="'+str(pageNumber)+'">' \
|
||||||
' <input type="hidden" name="messageId" value="'+messageId+'">' \
|
' <input type="hidden" name="messageId" value="'+messageId+'">' \
|
||||||
' <button type="submit" class="button" name="submitYes">Yes</button>' \
|
' <button type="submit" class="button" name="submitYes">Yes</button>' \
|
||||||
' <a href="'+actor+'/inbox'+'"><button class="button">No</button></a>' \
|
' <a href="'+actor+'/inbox'+'"><button class="button">No</button></a>' \
|
||||||
|
@ -2077,7 +2084,7 @@ def htmlUnfollowConfirm(baseDir: str,originPathStr: str,followActor: str,followP
|
||||||
followStr+=htmlFooter()
|
followStr+=htmlFooter()
|
||||||
return followStr
|
return followStr
|
||||||
|
|
||||||
def htmlPersonOptions(baseDir: str,domain: str,originPathStr: str,optionsActor: str,optionsProfileUrl: str,optionsLink: str) -> str:
|
def htmlPersonOptions(baseDir: str,domain: str,originPathStr: str,optionsActor: str,optionsProfileUrl: str,optionsLink: str,pageNumber: int) -> str:
|
||||||
"""Show options for a person: view/follow/block/report
|
"""Show options for a person: view/follow/block/report
|
||||||
"""
|
"""
|
||||||
optionsDomain,optionsPort=getDomainFromActor(optionsActor)
|
optionsDomain,optionsPort=getDomainFromActor(optionsActor)
|
||||||
|
@ -2120,6 +2127,7 @@ def htmlPersonOptions(baseDir: str,domain: str,originPathStr: str,optionsActor:
|
||||||
optionsStr+=' <p class="optionsText">Options for @'+getNicknameFromActor(optionsActor)+'@'+optionsDomain+'</p>'
|
optionsStr+=' <p class="optionsText">Options for @'+getNicknameFromActor(optionsActor)+'@'+optionsDomain+'</p>'
|
||||||
optionsStr+= \
|
optionsStr+= \
|
||||||
' <form method="POST" action="'+originPathStr+'/personoptions">' \
|
' <form method="POST" action="'+originPathStr+'/personoptions">' \
|
||||||
|
' <input type="hidden" name="pageNumber" value="'+str(pageNumber)+'">' \
|
||||||
' <input type="hidden" name="actor" value="'+optionsActor+'">' \
|
' <input type="hidden" name="actor" value="'+optionsActor+'">' \
|
||||||
' <input type="hidden" name="avatarUrl" value="'+optionsProfileUrl+'">'+ \
|
' <input type="hidden" name="avatarUrl" value="'+optionsProfileUrl+'">'+ \
|
||||||
optionsLinkStr+ \
|
optionsLinkStr+ \
|
||||||
|
@ -2381,7 +2389,7 @@ def htmlProfileAfterSearch(baseDir: str,path: str,httpPrefix: str, \
|
||||||
if not item.get('object'):
|
if not item.get('object'):
|
||||||
continue
|
continue
|
||||||
profileStr+= \
|
profileStr+= \
|
||||||
individualPostAsHtml(baseDir, \
|
individualPostAsHtml(None,baseDir, \
|
||||||
session,wfRequest,personCache, \
|
session,wfRequest,personCache, \
|
||||||
nickname,domain,port, \
|
nickname,domain,port, \
|
||||||
item,avatarUrl,False,False, \
|
item,avatarUrl,False,False, \
|
||||||
|
|
Loading…
Reference in New Issue