Skip to content
Snippets Groups Projects
Commit 272f004f authored by James Arcus's avatar James Arcus
Browse files

Create UWA Esports door pages, files and endpoints

parent 011b9e8a
No related merge requests found
......@@ -35,6 +35,7 @@ client.on('connect', () => {
let doors = {
'ucc-door': new DoorInfo(),
'unisfa-door': new DoorInfo(),
'uwaes-door': new DoorInfo(),
};
const update_door_state = (door, state) => {
......@@ -146,6 +147,15 @@ const server = http.createServer((req, res) => {
return send_file(res, 200, fname, 'text/html');
}
if (req.url === '/uwaes') {
if (doors['uwaes-door'].state === null) {
return send_file(res, 500, './pages/uwaes_door_unavail.html', 'text/html');
}
const fname = doors['uwaes-door'].state ? './pages/uwaes_door_open.html' : './pages/uwaes_door_closed.html';
return send_file(res, 200, fname, 'text/html');
}
if (req.url === '/state/ucc') {
if (doors['ucc-door'].state === null) {
return send_json(res, 500, null);
......@@ -162,6 +172,14 @@ const server = http.createServer((req, res) => {
return send_json(res, 200, doors['unisfa-door'].state);
}
if (req.url === '/state/uwaes') {
if (doors['uwaes-door'].state === null) {
return send_json(res, 500, null);
}
return send_json(res, 200, doors['uwaes-door'].state);
}
if (req.url === '/opener/ucc') {
if (doors['ucc-door'].opener === null) {
return send_json(res, 500, null);
......@@ -186,6 +204,14 @@ const server = http.createServer((req, res) => {
return send_file(res, 200, './static/door_unisfa_closed.jpg', 'image/jpeg');
}
if (req.url === '/static/door_uwaes_open.jpg') {
return send_file(res, 200, './static/door_uwaes_open.jpg', 'image/jpeg');
}
if (req.url === '/static/door_uwaes_closed.jpg') {
return send_file(res, 200, './static/door_uwaes_closed.jpg', 'image/jpeg');
}
if (req.url === '/static/style.css') {
return send_file(res, 200, './static/style.css', 'text/css');
}
......
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>UWA Esports Door Status</title>
<link rel="stylesheet" href="/static/style.css">
</head>
<body>
<p><a href="#light">lightmode</a> <a href="#dark">darkmode</a></p>
<h1>UWA Esports Door Status</h1>
<p>The door is currently closed.</p>
<img
src="/static/door_uwaes_closed.jpg"
width="756"
height="1008"
alt="Who is it that lies in wait behind the door?"
title="Who is it that lies in wait behind the door?"
>
<script src="/static/darkmode.js"></script>
</body>
</html>
<!-- vim: set ts=2 sts=2 sw=2 et: -->
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>UWA Esports Door Status</title>
<link rel="stylesheet" href="/static/style.css">
</head>
<body>
<p><a href="#light">lightmode</a> <a href="#dark">darkmode</a></p>
<h1>UWA Esports Door Status</h1>
<p>The door is currently open!</p>
<img
src="/static/door_uwaes_open.jpg"
width="756"
height="1008"
alt="It is he, wearer of many hats. Beware!"
title="It is he, wearer of many hats. Beware!"
>
<script src="/static/darkmode.js"></script>
</body>
</html>
<!-- vim: set ts=2 sts=2 sw=2 et: -->
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>UWA Esports Door Status</title>
<link rel="stylesheet" href="/static/style.css">
</head>
<body>
<p><a href="#light">lightmode</a> <a href="#dark">darkmode</a></p>
<h1>UWA Esports Door Status</h1>
<p>The door sensor is currently unavailable. Sorry :-(</p>
<script src="/static/darkmode.js"></script>
</body>
</html>
<!-- vim: set ts=2 sts=2 sw=2 et: -->
static/door_uwaes_closed.jpg

65.7 KiB

static/door_uwaes_open.jpg

69.8 KiB

0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment