From ffff693aa227394b4a3e7ab463bc27a13c23bf00 Mon Sep 17 00:00:00 2001
From: Ivan Mahonin <bh@icystar.com>
Date: Jul 15 2024 08:56:39 +0000
Subject: error page


---

diff --git a/server.py b/server.py
index 1b06502..6552ea9 100755
--- a/server.py
+++ b/server.py
@@ -35,7 +35,12 @@ class Server(http.server.BaseHTTPRequestHandler):
         self.send_response(int(code))
         self.send_header("Content-type", "text/html")
         self.end_headers()
-        self.write(str(code) + " " + str(message));
+        tplErrorpage.write(self, {
+            "host": config.externalHost,
+            "prefix": config.prefix,
+            "code": int(code),
+            "message": str(message),
+            "waiting": False });
 
     def writeJpeg(self, path):
         if not path.endswith(".jpg") or not os.path.isfile(path):
@@ -149,10 +154,11 @@ class Server(http.server.BaseHTTPRequestHandler):
 
 
 def loadTemplates():
-    global tplStartpage, tplJoinpage, tplPlayerpage
+    global tplStartpage, tplJoinpage, tplPlayerpage, tplErrorpage
     tplStartpage = template.TplLoader.load("tpl/startpage.tpl")
     tplJoinpage = template.TplLoader.load("tpl/joinpage.tpl")
     tplPlayerpage = template.TplLoader.load("tpl/playerpage.tpl")
+    tplErrorpage = template.TplLoader.load("tpl/errorpage.tpl")
 
 
 
diff --git a/tpl/errorpage.tpl b/tpl/errorpage.tpl
new file mode 100644
index 0000000..ca80601
--- /dev/null
+++ b/tpl/errorpage.tpl
@@ -0,0 +1,8 @@
+{include:header.tpl}
+<div id="mainform">
+<h1>Error {:code}</h1>
+<p>{:message}</p>
+</div>
+<hr />
+<div id="logo"><a href="{:prefix}">back to start page</a></div>
+{include:footer.tpl}