replace /@

master
Bob Mottram 2019-08-24 10:07:05 +01:00
parent eaba779cc1
commit c94b348f8d
1 changed files with 11 additions and 6 deletions

View File

@ -487,6 +487,17 @@ class PubServer(BaseHTTPRequestHandler):
self.server.session= \ self.server.session= \
createSession(self.server.domain,self.server.port,self.server.useTor) createSession(self.server.domain,self.server.port,self.server.useTor)
# is this a html request?
htmlGET=False
if self.headers.get('Accept'):
if 'text/html' in self.headers['Accept']:
htmlGET=True
# replace https://domain/@nick with https://domain/users/nick
if htmlGET and '/@' in self.path and \
(self.path.startswith('http') or self.path.startswith('dat')):
self.path=self.path.replace('/@','/users/')
# treat shared inbox paths consistently # treat shared inbox paths consistently
if self.path=='/sharedInbox' or \ if self.path=='/sharedInbox' or \
self.path=='/users/inbox' or \ self.path=='/users/inbox' or \
@ -494,12 +505,6 @@ class PubServer(BaseHTTPRequestHandler):
self.path=='/users/'+self.server.domain: self.path=='/users/'+self.server.domain:
self.path='/inbox' self.path='/inbox'
# is this a html request?
htmlGET=False
if self.headers.get('Accept'):
if 'text/html' in self.headers['Accept']:
htmlGET=True
# Unfollow a person from the web interface by selecting Unfollow on the dropdown # Unfollow a person from the web interface by selecting Unfollow on the dropdown
if htmlGET and '/users/' in self.path and '?unfollow=' in self.path: if htmlGET and '/users/' in self.path and '?unfollow=' in self.path:
followStr=self.path.split('?unfollow=')[1] followStr=self.path.split('?unfollow=')[1]