From 56e1a6acd60bbff847873a6bd58cc3cfc109dd05 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 13 Oct 2020 14:03:52 +0100 Subject: [PATCH] Show news front page --- daemon.py | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/daemon.py b/daemon.py index cf505fc7..e7762833 100644 --- a/daemon.py +++ b/daemon.py @@ -9109,8 +9109,11 @@ class PubServer(BaseHTTPRequestHandler): 'GET busy time', 'permitted directory') - if self.path.startswith('/login') or \ - (self.path == '/' and not authorized): + # show the login screen + if (self.path.startswith('/login') or + (self.path == '/' and + not authorized and + not self.server.newsInstance)): # request basic auth msg = htmlLogin(self.server.translate, self.server.baseDir).encode('utf-8') @@ -9122,6 +9125,33 @@ class PubServer(BaseHTTPRequestHandler): 'login shown') return + # show the news front page + if self.path == '/' and \ + not authorized and \ + self.server.newsInstance: + if callingDomain.endswith('.onion') and \ + self.server.onionDomain: + self._logout_redirect('http://' + + self.server.onionDomain + + '/users/news', None, + callingDomain) + elif (callingDomain.endswith('.i2p') and + self.server.i2pDomain): + self._logout_redirect('http://' + + self.server.i2pDomain + + '/users/news', None, + callingDomain) + else: + self._logout_redirect(self.server.httpPrefix + + '://' + + self.server.domainFull + + '/users/news', + None, callingDomain) + self._benchmarkGETtimings(GETstartTime, GETtimings, + 'permitted directory', + 'news front page shown') + return + self._benchmarkGETtimings(GETstartTime, GETtimings, 'permitted directory', 'login shown done')