From c94b348f8d942ac6e98fcdffd2bdec017216dee9 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 24 Aug 2019 10:07:05 +0100 Subject: [PATCH] replace /@ --- daemon.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/daemon.py b/daemon.py index 0ab32ff6d..a408aa94c 100644 --- a/daemon.py +++ b/daemon.py @@ -487,6 +487,17 @@ class PubServer(BaseHTTPRequestHandler): self.server.session= \ 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 if self.path=='/sharedInbox' or \ self.path=='/users/inbox' or \ @@ -494,12 +505,6 @@ class PubServer(BaseHTTPRequestHandler): self.path=='/users/'+self.server.domain: 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 if htmlGET and '/users/' in self.path and '?unfollow=' in self.path: followStr=self.path.split('?unfollow=')[1]