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}