diff --git a/daemon.py b/daemon.py index f84f3636..aebba89a 100644 --- a/daemon.py +++ b/daemon.py @@ -1057,7 +1057,7 @@ class PubServer(BaseHTTPRequestHandler): self.path.endswith('/newdm') or \ self.path.endswith('/newreport') or \ 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.wfile.write(msg) self.server.GETbusy=False @@ -2606,10 +2606,21 @@ class PubServer(BaseHTTPRequestHandler): chooserNickname=getNicknameFromActor(originPathStr) length = int(self.headers['Content-length']) optionsConfirmParams=self.rfile.read(length).decode('utf-8').replace('%3A',':').replace('%2F','/') + # actor for the person optionsActor=optionsConfirmParams.split('actor=')[1] - optionsAvatarUrl=optionsConfirmParams.split('avatarUrl=')[1] if '&' in optionsActor: 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) optionsDomain,optionsPort=getDomainFromActor(optionsActor) optionsDomainFull=optionsDomain @@ -2661,7 +2672,7 @@ class PubServer(BaseHTTPRequestHandler): if '&submitReport=' in optionsConfirmParams: if self.server.debug: 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.wfile.write(msg) self.server.POSTbusy=False diff --git a/webinterface.py b/webinterface.py index 09ab6f83..23e72be5 100644 --- a/webinterface.py +++ b/webinterface.py @@ -541,16 +541,9 @@ def htmlSuspended(baseDir: str) -> str: suspendedForm+=htmlFooter() 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 """ - 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='' if not path.endswith('/newshare'): if not path.endswith('/newreport'):