Remove spaces from search strings

master
Bob Mottram 2019-07-31 20:37:29 +01:00
parent 173670f472
commit be1104d0fc
2 changed files with 18 additions and 8 deletions

View File

@ -664,8 +664,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.debug) self.server.debug)
if announceJson: if announceJson:
self._postToOutbox(announceJson) self._postToOutbox(announceJson)
self._redirect_headers(actor+'/inbox',cookie)
self.server.GETbusy=False self.server.GETbusy=False
self._redirect_headers(actor+'/inbox',cookie)
return return
inReplyTo=None inReplyTo=None
@ -1514,7 +1514,7 @@ class PubServer(BaseHTTPRequestHandler):
searchStr=searchParams.split('searchtext=')[1] searchStr=searchParams.split('searchtext=')[1]
if '&' in searchStr: if '&' in searchStr:
searchStr=searchStr.split('&')[0] searchStr=searchStr.split('&')[0]
searchStr=searchStr.replace('+',' ').replace('%40','@') searchStr=searchStr.replace('+',' ').replace('%40','@').strip()
if '@' in searchStr: if '@' in searchStr:
print('Search: '+searchStr) print('Search: '+searchStr)
nickname=getNicknameFromActor(self.path) nickname=getNicknameFromActor(self.path)

View File

@ -518,6 +518,7 @@ def individualPostAsHtml(baseDir: str, \
avatarUrl=postJsonObject['actor']+'/avatar.png' avatarUrl=postJsonObject['actor']+'/avatar.png'
fullDomain=domain fullDomain=domain
if port:
if port!=80 and port!=443: if port!=80 and port!=443:
fullDomain=domain+':'+str(port) fullDomain=domain+':'+str(port)
@ -555,14 +556,23 @@ def individualPostAsHtml(baseDir: str, \
datetimeObject = datetime.strptime(publishedStr,"%Y-%m-%dT%H:%M:%SZ") datetimeObject = datetime.strptime(publishedStr,"%Y-%m-%dT%H:%M:%SZ")
publishedStr=datetimeObject.strftime("%a %b %d, %H:%M") publishedStr=datetimeObject.strftime("%a %b %d, %H:%M")
footerStr='<span class="'+timeClass+'">'+publishedStr+'</span>\n' footerStr='<span class="'+timeClass+'">'+publishedStr+'</span>\n'
# don't allow announce/repeat of your own posts
announceStr=''
likeStr=''
if fullDomain+'/users/'+nickname not in postJsonObject['actor']:
announceStr= \
'<a href="/users/'+nickname+'?repeat='+postJsonObject['object']['id']+'" title="Repeat this post">' \
'<img src="/icons/repeat_inactive.png"/></a>'
likeStr= \
'<a href="/users/'+nickname+'?like='+postJsonObject['object']['id']+'" title="Like this post">' \
'<img src="/icons/like_inactive.png"/></a>'
if showIcons: if showIcons:
footerStr='<div class="'+containerClassIcons+'">' footerStr='<div class="'+containerClassIcons+'">'
footerStr+='<a href="/users/'+nickname+'?replyto='+postJsonObject['object']['id']+'" title="Reply to this post">' footerStr+='<a href="/users/'+nickname+'?replyto='+postJsonObject['object']['id']+'" title="Reply to this post">'
footerStr+='<img src="/icons/reply.png"/></a>' footerStr+='<img src="/icons/reply.png"/></a>'
footerStr+='<a href="/users/'+nickname+'?repeat='+postJsonObject['object']['id']+'" title="Repeat this post">' footerStr+=announceStr+likeStr
footerStr+='<img src="/icons/repeat_inactive.png"/></a>'
footerStr+='<a href="/users/'+nickname+'?like='+postJsonObject['object']['id']+'" title="Like this post">'
footerStr+='<img src="/icons/like_inactive.png"/></a>'
footerStr+='<span class="'+timeClass+'">'+publishedStr+'</span>' footerStr+='<span class="'+timeClass+'">'+publishedStr+'</span>'
footerStr+='</div>' footerStr+='</div>'