Show news front page

main
Bob Mottram 2020-10-13 14:03:52 +01:00
parent a3b1d1b23f
commit 56e1a6acd6
1 changed files with 32 additions and 2 deletions

View File

@ -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')