Merge branch 'master' of https://git.jappel.io/jappel/scoreboard-js
Konflikt in scoreboard/controllers/cli.js zugunsten der Remote-Version aufgeloest: openBrowser()/killBrowser() bleiben erhalten, da routes/admin.js sie verwendet. Der lokale Testcode wurde verworfen (er rief zudem das child_process-Modul faelschlich als Funktion auf). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
commit
c4325ae8ac
19 changed files with 546 additions and 78 deletions
|
|
@ -4,6 +4,9 @@ const io = require('../controllers/socketio');
|
|||
|
||||
const timer = require('../controllers/timer');
|
||||
const score = require('../controllers/score');
|
||||
const cli = require('../controllers/cli');
|
||||
const db = require('../controllers/db');
|
||||
const etc = require('../controllers/etc');
|
||||
|
||||
// ######################################################################################################################################################
|
||||
// General endpoints
|
||||
|
|
@ -17,12 +20,37 @@ router.get('/refreshMonitor', function(req, res, next) {
|
|||
res.send(); // send empty response
|
||||
});
|
||||
|
||||
// Express router endpoint to do cli stuff
|
||||
router.get('/cli', function(req, res, next) {
|
||||
// Express router endpoint to open browser
|
||||
router.get('/openBrowser', function(req, res, next) {
|
||||
cli.openBrowser();
|
||||
res.status(200); // Set http status code to 200 (success)
|
||||
res.send(); // send empty response
|
||||
});
|
||||
|
||||
// Express router endpoint to kill browser
|
||||
router.get('/killBrowser', function(req, res, next) {
|
||||
cli.killBrowser();
|
||||
res.status(200); // Set http status code to 200 (success)
|
||||
res.send(); // send empty response
|
||||
});
|
||||
|
||||
// ######################################################################################################################################################
|
||||
// Etc endpoints
|
||||
// ######################################################################################################################################################
|
||||
|
||||
// Express router endpoint to toggle splashscreen
|
||||
router.get('/etcToggleSplashscreen', function(req, res, next) {
|
||||
etc.toggleSplashScreen(); // Toggles splashscreen
|
||||
res.status(200); // Set http status code to 200 (success)
|
||||
res.json(etc.getValues()); // Answer with important values
|
||||
});
|
||||
|
||||
// Express router endpoint to get important etc values
|
||||
router.get('/etcGetValues', function(req, res, next) {
|
||||
res.status(200); // Set http status code to 200 (success)
|
||||
res.json(etc.getValues()); // Answer with important values
|
||||
});
|
||||
|
||||
// ######################################################################################################################################################
|
||||
// Timerendpoints
|
||||
// ######################################################################################################################################################
|
||||
|
|
@ -106,6 +134,13 @@ router.get('/scoreToggleSideswitch', function(req, res, next) {
|
|||
res.json(score.getValues());
|
||||
});
|
||||
|
||||
// Express router endpoint to toggle reference mirrored attribute
|
||||
router.get('/scoreToggleReferenceMirrored', function(req, res, next) {
|
||||
score.toggleReferenceMirrored();
|
||||
res.status(200);
|
||||
res.json(score.getValues());
|
||||
});
|
||||
|
||||
// Express router endpoint to get important score values
|
||||
router.get('/scoreGetValues', function(req, res, next) {
|
||||
res.json(score.getValues()); // Respond with important values for frontend
|
||||
|
|
@ -125,6 +160,27 @@ router.post('/scoreConfigTeams', function(req, res, next) {
|
|||
res.json(score.getValues());
|
||||
});
|
||||
|
||||
// ######################################################################################################################################################
|
||||
// DB endpoints
|
||||
// ######################################################################################################################################################
|
||||
|
||||
// Express router endpoint to get important values for db contents
|
||||
router.get('/dbGetValues', function(req, res, next) {
|
||||
res.json(db.getValues()); // Respond with important values for frontend
|
||||
});
|
||||
|
||||
// Express router endpoint to add a team to the team database
|
||||
router.post('/dbAddTeam', function(req, res, next) {
|
||||
db.addTeam(req.body.teamName); // Add teamname to DB
|
||||
res.json(db.getValues()); // Respond with all important values to update the frontend
|
||||
});
|
||||
|
||||
// Express router endpoint to delete a team from the team database
|
||||
router.post('/dbDeleteTeam', function(req, res, next) {
|
||||
db.deleteTeam(req.body.teamName); // Add teamname to DB
|
||||
res.json(db.getValues()); // Respond with all important values to update the frontend
|
||||
});
|
||||
|
||||
/* GET home page. */
|
||||
router.get('/', function(req, res, next) {
|
||||
res.render('admin');
|
||||
|
|
|
|||
|
|
@ -2,14 +2,19 @@ var express = require('express');
|
|||
var router = express.Router();
|
||||
let io = require('../controllers/socketio');
|
||||
|
||||
const score = require("../controllers/score");
|
||||
const score = require('../controllers/score');
|
||||
const etc = require('../controllers/etc');
|
||||
|
||||
/* GET home page. */
|
||||
router.get('/', function(req, res, next) {
|
||||
if (score.getEnabled()) { // If scoreboard is enabled
|
||||
res.render('indexScore', {}); // Render the site with scoreboard
|
||||
} else { // If scoreboard is not enabled
|
||||
res.render('index', {}); // Render the site without scoreboard
|
||||
if(etc.getSplashscreen()) { // If splashscreen is enabled
|
||||
res.render('splashscreen', {}); // Render splashscreen
|
||||
} else {
|
||||
if (score.getEnabled()) { // If scoreboard is enabled
|
||||
res.render('indexScore', {}); // Render the site with scoreboard
|
||||
} else { // If scoreboard is not enabled
|
||||
res.render('index', {}); // Render the site without scoreboard
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue