Link to post being reported

master
Bob Mottram 2019-08-25 10:41:57 +01:00
parent e1d45bb1c4
commit f7fd622340
2 changed files with 15 additions and 11 deletions

View File

@ -1057,7 +1057,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).encode() msg=htmlNewPost(self.server.baseDir,self.path,inReplyToUrl,replyToList,None).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
@ -2606,10 +2606,21 @@ class PubServer(BaseHTTPRequestHandler):
chooserNickname=getNicknameFromActor(originPathStr) chooserNickname=getNicknameFromActor(originPathStr)
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','/')
# actor for the person
optionsActor=optionsConfirmParams.split('actor=')[1] optionsActor=optionsConfirmParams.split('actor=')[1]
optionsAvatarUrl=optionsConfirmParams.split('avatarUrl=')[1]
if '&' in optionsActor: if '&' in optionsActor:
optionsActor=optionsActor.split('&')[0] optionsActor=optionsActor.split('&')[0]
# url of the avatar
optionsAvatarUrl=optionsConfirmParams.split('avatarUrl=')[1]
if '&' in optionsAvatarUrl:
optionsAvatarUrl=optionsAvatarUrl.split('&')[0]
# link to a post, which can then be included in reports
postUrl=None
if 'postUrl' in optionsConfirmParams:
postUrl=optionsConfirmParams.split('postUrl=')[1]
if '&' in postUrl:
postUrl=postUrl.split('&')[0]
optionsNickname=getNicknameFromActor(optionsActor) optionsNickname=getNicknameFromActor(optionsActor)
optionsDomain,optionsPort=getDomainFromActor(optionsActor) optionsDomain,optionsPort=getDomainFromActor(optionsActor)
optionsDomainFull=optionsDomain optionsDomainFull=optionsDomain
@ -2661,7 +2672,7 @@ class PubServer(BaseHTTPRequestHandler):
if '&submitReport=' in optionsConfirmParams: if '&submitReport=' in optionsConfirmParams:
if self.server.debug: if self.server.debug:
print('Reporting '+optionsActor) print('Reporting '+optionsActor)
msg=htmlNewPost(self.server.baseDir,self.path,None,[]).encode() msg=htmlNewPost(self.server.baseDir,self.path,None,[],reportUrl).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

View File

@ -541,16 +541,9 @@ def htmlSuspended(baseDir: str) -> str:
suspendedForm+=htmlFooter() suspendedForm+=htmlFooter()
return suspendedForm return suspendedForm
def htmlNewPost(baseDir: str,path: str,inReplyTo: str,mentions: []) -> str: def htmlNewPost(baseDir: str,path: str,inReplyTo: str,mentions: [],reportUrl: str) -> str:
"""New post screen """New post screen
""" """
reportUrl=None
if '/newreport?' in path:
if '?url=' in path:
reportUrl=path.split('?url=')[1]
if ';' in reportUrl:
reportUrl=reportUrl.split(';')[0]
path=path.split('/newreport?')[0]+'/newreport'
replyStr='' replyStr=''
if not path.endswith('/newshare'): if not path.endswith('/newshare'):
if not path.endswith('/newreport'): if not path.endswith('/newreport'):