aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVosjedev <vosje@vosjedev.net>2025-11-12 17:01:47 +0100
committerVosjedev <vosje@vosjedev.net>2025-11-12 17:01:47 +0100
commit520038f61516e6e10835c7f70511d2f21898cfe0 (patch)
treeff949176a3f5339f2d9803f2a707ef8576f8321a
parent1e7bdf2fc47c1e7554b0703626318c8841ee7d16 (diff)
downloadacit-520038f61516e6e10835c7f70511d2f21898cfe0.tar.gz
acit-520038f61516e6e10835c7f70511d2f21898cfe0.tar.bz2
acit-520038f61516e6e10835c7f70511d2f21898cfe0.tar.xz
add /secure/ section, don't list threads and refresh trackers anymore
-rw-r--r--src/acit/__init__.py17
-rw-r--r--src/acit/web.py29
2 files changed, 35 insertions, 11 deletions
diff --git a/src/acit/__init__.py b/src/acit/__init__.py
index ac96935..b41abe5 100644
--- a/src/acit/__init__.py
+++ b/src/acit/__init__.py
@@ -3,7 +3,7 @@ from os import getenv
import cherrypy
-from .web import Server
+from .web import Server, SecureServer
from .imapplugin import ImapPlugin
from .db import DBPoolManager
@@ -25,11 +25,24 @@ def run():
server=Server(dbpool=db,site=site,imap=imap)
+
+ secureserver=SecureServer(server)
+
+ securepath=getenv("ACIT_SECURE_PATH","/secure/")
+ if not securepath.startswith('/'):
+ securepath='/'+securepath
+
+ cherrypy.tree.mount(secureserver,securepath,{
+ '/':{
+ 'tools.sessions.on':True,
+ }
+ })
+
cherrypy.quickstart(server,'/',{
'global':{
'server.socket_host':'0.0.0.0',
'tools.proxy.on':True if getenv("ACIT_BEHIND_PROXY") else False
- }
+ },
})
diff --git a/src/acit/web.py b/src/acit/web.py
index 0410f24..a0b6a8e 100644
--- a/src/acit/web.py
+++ b/src/acit/web.py
@@ -38,15 +38,14 @@ class Server():
@cherrypy.expose
- def index(self,quote="nothing"):
- import threading
- self.site.update_trackers()
- cherrypy.log("Listing threads:")
- for thread in threading.enumerate():
- cherrypy.log(repr(thread))
- cherrypy.log("Threads holding an IMAP connection:")
- for thread in self.imap.mbpool.holding_threads:
- cherrypy.log(repr(thread))
+ def index(self):
+ #import threading
+ #cherrypy.log("Listing threads:")
+ #for thread in threading.enumerate():
+ # cherrypy.log(repr(thread))
+ #cherrypy.log("Threads holding an IMAP connection:")
+ #for thread in self.imap.mbpool.holding_threads:
+ # cherrypy.log(repr(thread))
from os import getenv
raise cherrypy.HTTPRedirect(getenv("ACIT_HOME_REDIRECT","about:blank"),303)
@@ -70,3 +69,15 @@ class Server():
return page
+class SecureServer():
+ def __init__(self,server:Server):
+ self.site=server.site
+ self.dbpool=server.dbpool
+ self.imap=server.imap
+
+ @cherrypy.expose
+ def index(self):
+ return "Secure."
+ #raise cherrypy.HTTPRedirect("/",303)
+
+