Adjustable Bg color
This commit is contained in:
parent
cbf949e7b1
commit
1b4336c4d9
@ -6,13 +6,16 @@ beerpong tournament at a scoutparty
|
|||||||
|
|
||||||
This thing is based on Express with handlebars, socketio, bootstrap and some other fun
|
This thing is based on Express with handlebars, socketio, bootstrap and some other fun
|
||||||
|
|
||||||
|
|
||||||
Install it with `npm install`
|
Install it with `npm install`
|
||||||
|
|
||||||
Run it with `npm start`
|
Run it with `npm start`
|
||||||
|
|
||||||
Develop on it with `npm run mon`
|
Develop on it with `npm run mon`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
This app is intended to be simple, the initial loaing of the state is done using the handlebar templates, after that actions and state changes are performed using websocket requests, no forther reloads are required as long as you are not changing between the main 2 views.
|
This app is intended to be simple, the initial loaing of the state is done using the handlebar templates, after that actions and state changes are performed using websocket requests, no forther reloads are required as long as you are not changing between the main 2 views.
|
||||||
|
|
||||||
|
TODO:
|
||||||
|
|
||||||
|
- We need a randomize teams feature
|
||||||
|
- Bessere Kontrolle be namechange
|
||||||
|
- nicht immer das ganze feld klearen nach nem namechange
|
||||||
|
@ -11,6 +11,10 @@
|
|||||||
{
|
{
|
||||||
"param": "tbdLabel",
|
"param": "tbdLabel",
|
||||||
"value": "/dev/tty.usbmodemFD121"
|
"value": "/dev/tty.usbmodemFD121"
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
"param": "backgroundColor",
|
||||||
|
"value": "#3357c7"
|
||||||
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -1,46 +1,68 @@
|
|||||||
let express = require('express');
|
let express = require("express");
|
||||||
let router = express.Router();
|
let router = express.Router();
|
||||||
let passwd = 'insecure';
|
let passwd = "insecure";
|
||||||
|
|
||||||
let low = require('lowdb'),
|
let low = require("lowdb"),
|
||||||
config = low('config.json');
|
config = low("config.json");
|
||||||
|
|
||||||
let tbdLabel = config.get('mainConfig').chain().find({ param: 'tbdLabel' }).value()['value'];
|
let tbdLabel = config
|
||||||
let byeLabel = config.get('mainConfig').chain().find({ param: 'byeLabel' }).value()['value'];
|
.get("mainConfig")
|
||||||
|
.chain()
|
||||||
|
.find({ param: "tbdLabel" })
|
||||||
|
.value()["value"];
|
||||||
|
let byeLabel = config
|
||||||
|
.get("mainConfig")
|
||||||
|
.chain()
|
||||||
|
.find({ param: "byeLabel" })
|
||||||
|
.value()["value"];
|
||||||
|
|
||||||
|
let bgcolor = config
|
||||||
|
.get("mainConfig")
|
||||||
|
.chain()
|
||||||
|
.find({ param: "backgroundColor" })
|
||||||
|
.value()["value"];
|
||||||
|
|
||||||
/* GET home page. */
|
/* GET home page. */
|
||||||
router.get('/', function(req, res, next) {
|
router.get("/", function(req, res, next) {
|
||||||
res.render('index', { mainHeader: '🍺🍺🍺 Aktueller Spielstand 🍺🍺🍺🍺', TBD:tbdLabel, NoTeam:byeLabel });
|
res.render("index", {
|
||||||
|
mainHeader: "🎮🕹🍺 SUPER SMASH BROS TURNIER 🎮🕹🍺",
|
||||||
|
TBD: tbdLabel,
|
||||||
|
NoTeam: byeLabel,
|
||||||
|
bgcolor: bgcolor
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get('/login', function(req, res, next) {
|
router.get("/login", function(req, res, next) {
|
||||||
console.log(req.session.passwd);
|
console.log(req.session.passwd);
|
||||||
console.log(req.session);
|
console.log(req.session);
|
||||||
if(req.session.passwd=='insecure'){
|
if (req.session.passwd == "insecure") {
|
||||||
res.redirect('/admin');
|
res.redirect("/admin");
|
||||||
} else {
|
} else {
|
||||||
res.render('login', { mainHeader: 'Please Login' });
|
res.render("login", { mainHeader: "Please Login" });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
router.post('/login', function(req, res, next) {
|
router.post("/login", function(req, res, next) {
|
||||||
if(req.body.passwd=='insecure'){
|
if (req.body.passwd == "insecure") {
|
||||||
req.session.passwd='insecure';
|
req.session.passwd = "insecure";
|
||||||
console.log('set');
|
console.log("set");
|
||||||
res.end('done')
|
res.end("done");
|
||||||
} else {
|
} else {
|
||||||
res.end('invalid')
|
res.end("invalid");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get('/admin', function(req, res, next) {
|
router.get("/admin", function(req, res, next) {
|
||||||
console.log(req.session.passwd);
|
console.log(req.session.passwd);
|
||||||
console.log(req.session);
|
console.log(req.session);
|
||||||
if(req.session.passwd=='insecure'){
|
if (req.session.passwd == "insecure") {
|
||||||
res.render('admin', { mainHeader: 'Admin Interface', TBD:tbdLabel, NoTeam:byeLabel });
|
res.render("admin", {
|
||||||
|
mainHeader: "Admin Interface",
|
||||||
|
TBD: tbdLabel,
|
||||||
|
NoTeam: byeLabel
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
res.redirect('/login');
|
res.redirect("/login");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>Spielstand</title>
|
<title>Spielstand</title>
|
||||||
@ -14,7 +15,8 @@
|
|||||||
|
|
||||||
<script type='text/javascript' src='/js/front_client.js'></script>
|
<script type='text/javascript' src='/js/front_client.js'></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
|
||||||
|
<body style="background-color: {{bgcolor}};">
|
||||||
<h1>{{mainHeader}}</h1>
|
<h1>{{mainHeader}}</h1>
|
||||||
|
|
||||||
<div class="main-content">
|
<div class="main-content">
|
||||||
@ -26,4 +28,5 @@
|
|||||||
<input id="TBD" type="hidden" value='{{TBD}}'>
|
<input id="TBD" type="hidden" value='{{TBD}}'>
|
||||||
<input id="NoT" type="hidden" value='{{NoTeam}}'>
|
<input id="NoT" type="hidden" value='{{NoTeam}}'>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user