From fbb7636a3be99910841f8cb16a11936d13b13fac Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 31 Jul 2019 14:51:10 +0100 Subject: [PATCH] Reply to post --- daemon.py | 8 +++++++- webinterface.py | 18 ++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/daemon.py b/daemon.py index ac28fd97..42dfa3bd 100644 --- a/daemon.py +++ b/daemon.py @@ -640,6 +640,11 @@ class PubServer(BaseHTTPRequestHandler): self.server.GETbusy=False return + inReplyTo=None + if authorized and '?replyto=' in self.path: + inReplyTo=self.path.split('?replyto=')[1] + self.path=self.path.split('?replyto=')[0]+'/newpost' + if '/users/' in self.path and \ (self.path.endswith('/newpost') or \ self.path.endswith('/newunlisted') or \ @@ -647,7 +652,7 @@ class PubServer(BaseHTTPRequestHandler): self.path.endswith('/newdm') or \ self.path.endswith('/newshare')): self._set_headers('text/html',cookie) - self.wfile.write(htmlNewPost(self.server.baseDir,self.path).encode()) + self.wfile.write(htmlNewPost(self.server.baseDir,self.path,inReplyTo).encode()) self.server.GETbusy=False return @@ -883,6 +888,7 @@ class PubServer(BaseHTTPRequestHandler): if 'text/html' in self.headers['Accept']: self._set_headers('text/html',cookie) self.wfile.write(htmlIndividualPost( \ + self.server.baseDir, \ self.server.session, \ self.server.cachedWebfingers,self.server.personCache, \ nickname,self.server.domain,self.server.port, \ diff --git a/webinterface.py b/webinterface.py index 12b00b17..10c4d783 100644 --- a/webinterface.py +++ b/webinterface.py @@ -81,9 +81,14 @@ def htmlLogin(baseDir: str) -> str: loginForm+=htmlFooter() return loginForm -def htmlNewPost(baseDir: str,path: str) -> str: +def htmlNewPost(baseDir: str,path: str,inReplyTo: str) -> str: + replyStr='' if not path.endswith('/newshare'): - newPostText='

Enter your post text below.

' + if not inReplyTo: + newPostText='

Enter your post text below.

' + else: + newPostText='

Enter your reply to this post below.

' + replyStr='' else: newPostText='

Enter the details for your shared item below.

' @@ -146,7 +151,8 @@ def htmlNewPost(baseDir: str,path: str) -> str: ' ' \ ' ' \ ' ' \ - ' ' \ + ' '+ \ + replyStr+ \ ' ' \ '' \ ' ' \ @@ -546,11 +552,11 @@ def individualPostAsHtml(baseDir: str, \ footerStr=''+publishedStr+'\n' if showIcons: footerStr='
' - footerStr+='' + footerStr+='' footerStr+='' - footerStr+='' + footerStr+='' footerStr+='' - footerStr+='' + footerStr+='' footerStr+='' footerStr+=''+publishedStr+'' footerStr+='
'