feat: publish privacy policy page
This commit is contained in:
@@ -22,6 +22,7 @@ USERS = {
|
||||
|
||||
TASKS_FILE = os.path.join(os.path.dirname(__file__), "COURSE_TASKS.json")
|
||||
HTML_FILE = os.path.join(os.path.dirname(__file__), "index.html")
|
||||
PRIVACY_FILE = os.path.join(os.path.dirname(__file__), "privacy.html")
|
||||
SANDBOX = LinuxSandbox()
|
||||
|
||||
|
||||
@@ -94,7 +95,7 @@ class LinuxLearningHandler(http.server.BaseHTTPRequestHandler):
|
||||
parsed = urllib.parse.urlparse(self.path)
|
||||
path = parsed.path
|
||||
|
||||
if path not in ["/", "/api/login", "/api/logout", "/api/course", "/api/health"]:
|
||||
if path not in ["/", "/privacy", "/privacy.html", "/api/login", "/api/logout", "/api/course", "/api/health"]:
|
||||
auth_header = self.headers.get("Authorization", "")
|
||||
token = self.headers.get("X-Token", "")
|
||||
if not self.check_auth(auth_header, token) and "xiaoxiaoluohao.indevs.in" in self.headers.get("Host", ""):
|
||||
@@ -105,6 +106,10 @@ class LinuxLearningHandler(http.server.BaseHTTPRequestHandler):
|
||||
self.send_file(HTML_FILE, "text/html; charset=utf-8")
|
||||
return
|
||||
|
||||
if path in {"/privacy", "/privacy.html"}:
|
||||
self.send_file(PRIVACY_FILE, "text/html; charset=utf-8")
|
||||
return
|
||||
|
||||
if path == "/api/health":
|
||||
self.send_json({"ok": True, "cwd": SANDBOX.cwd, "user": SANDBOX.user, "modules": len(COURSE.get("modules", []))})
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user