mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Added keybinding menu and server side profiles
This commit is contained in:
@@ -7,12 +7,27 @@ module.exports = function (configLocation) {
|
||||
if (fs.existsSync(configLocation)) {
|
||||
let rawdata = fs.readFileSync(configLocation, "utf-8");
|
||||
const config = JSON.parse(rawdata);
|
||||
res.send(JSON.stringify({...config.frontend, ...(config.audio ?? {}) }));
|
||||
res.send(JSON.stringify({frontend:{...config.frontend}, audio:{...(config.audio ?? {})}, profiles: {...(config.profiles ?? {})} }));
|
||||
res.end()
|
||||
} else {
|
||||
res.sendStatus(404);
|
||||
}
|
||||
});
|
||||
|
||||
router.put('/profile/:profileName', function (req, res, next) {
|
||||
if (fs.existsSync(configLocation)) {
|
||||
let rawdata = fs.readFileSync(configLocation, "utf-8");
|
||||
const config = JSON.parse(rawdata);
|
||||
if (config.profiles === undefined)
|
||||
config.profiles = {}
|
||||
config.profiles[req.params.profileName] = req.body;
|
||||
fs.writeFileSync(configLocation, JSON.stringify(config, null, 2), "utf-8");
|
||||
res.end()
|
||||
} else {
|
||||
res.sendStatus(404);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return router;
|
||||
}
|
||||
Reference in New Issue
Block a user