From be1104d0fc55f4875706e1f24ce46c51761f6464 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 31 Jul 2019 20:37:29 +0100 Subject: [PATCH] Remove spaces from search strings --- daemon.py | 4 ++-- webinterface.py | 22 ++++++++++++++++------ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/daemon.py b/daemon.py index 991c9e340..f8b1af6bd 100644 --- a/daemon.py +++ b/daemon.py @@ -664,8 +664,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.debug) if announceJson: self._postToOutbox(announceJson) - self._redirect_headers(actor+'/inbox',cookie) self.server.GETbusy=False + self._redirect_headers(actor+'/inbox',cookie) return inReplyTo=None @@ -1514,7 +1514,7 @@ class PubServer(BaseHTTPRequestHandler): searchStr=searchParams.split('searchtext=')[1] if '&' in searchStr: searchStr=searchStr.split('&')[0] - searchStr=searchStr.replace('+',' ').replace('%40','@') + searchStr=searchStr.replace('+',' ').replace('%40','@').strip() if '@' in searchStr: print('Search: '+searchStr) nickname=getNicknameFromActor(self.path) diff --git a/webinterface.py b/webinterface.py index f043925d4..0aac9c998 100644 --- a/webinterface.py +++ b/webinterface.py @@ -518,8 +518,9 @@ def individualPostAsHtml(baseDir: str, \ avatarUrl=postJsonObject['actor']+'/avatar.png' fullDomain=domain - if port!=80 and port!=443: - fullDomain=domain+':'+str(port) + if port: + if port!=80 and port!=443: + fullDomain=domain+':'+str(port) if fullDomain not in postJsonObject['actor']: inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl2,preferredName = \ @@ -555,14 +556,23 @@ def individualPostAsHtml(baseDir: str, \ datetimeObject = datetime.strptime(publishedStr,"%Y-%m-%dT%H:%M:%SZ") publishedStr=datetimeObject.strftime("%a %b %d, %H:%M") footerStr=''+publishedStr+'\n' + + # don't allow announce/repeat of your own posts + announceStr='' + likeStr='' + if fullDomain+'/users/'+nickname not in postJsonObject['actor']: + announceStr= \ + '' \ + '' + likeStr= \ + '' \ + '' + if showIcons: footerStr='
' footerStr+='' footerStr+='' - footerStr+='' - footerStr+='' - footerStr+='' - footerStr+='' + footerStr+=announceStr+likeStr footerStr+=''+publishedStr+'' footerStr+='
'