mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
A couple of comments
This commit is contained in:
@@ -4,8 +4,8 @@ const { v4: uuidv4 } = require('uuid');
|
||||
|
||||
var themesMap = {};
|
||||
|
||||
var theme = "olympus";
|
||||
router.get('/theme/*', function (req, res, next) {
|
||||
/* If this is the first time this session makes a request, create a uuid and save it to the map. Default theme is the olympus theme */
|
||||
if (!req.cookies.id) {
|
||||
const id = uuidv4();
|
||||
res.cookie('id', id, { httpOnly: true });
|
||||
@@ -13,13 +13,13 @@ router.get('/theme/*', function (req, res, next) {
|
||||
reqTheme = "olympus";
|
||||
}
|
||||
else {
|
||||
if (!(req.cookies.id in themesMap)) {
|
||||
/* If it is present, recover the session theme from the map */
|
||||
if (!(req.cookies.id in themesMap))
|
||||
themesMap[req.cookies.id] = "olympus";
|
||||
}
|
||||
reqTheme = themesMap[req.cookies.id];
|
||||
}
|
||||
|
||||
/* Yes, this in an easter egg! :D Feel free to ignore it, or activate the parrot theme to check what it does */
|
||||
/* Yes, this in an easter egg! :D Feel free to ignore it, or activate the parrot theme to check what it does. Why parrots? The story is a bit long, come to the Discord and ask :D */
|
||||
if (reqTheme === "parrot" && !req.url.includes(".css"))
|
||||
res.redirect('/themes/parrot/images/parrot.svg');
|
||||
else
|
||||
@@ -27,6 +27,7 @@ router.get('/theme/*', function (req, res, next) {
|
||||
});
|
||||
|
||||
router.put('/theme/:newTheme', function (req, res, next) {
|
||||
/* Add the theme to the map, if this session already has an id */
|
||||
const newTheme = req.params.newTheme;
|
||||
if (req.cookies.id) {
|
||||
themesMap[req.cookies.id] = newTheme;
|
||||
|
||||
Reference in New Issue
Block a user