blob: 6f3baf6023fcc3c5c00761434697ed0fea083f2c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
"use strict";
const config = require("../server/js/config");
function settings(req, res)
{
res.render('settings', {showSearchBar: true, config: config.loadedConfig});
};
function save(req, res)
{
let newConfig = {
'settings': {
'nsfw_content': ((req.body.nsfw === "on") ? true : false),
'port': ((!isNaN(parseInt(req.body.port))) ? parseInt(req.body.port) : undefined),
'tor': {
'host': ((req.body.torHost) ? req.body.torHost : undefined),
'port': ((!isNaN(parseInt(req.body.torPort))) ? parseInt(req.body.torPort) : undefined)
}
}
};
config.createConfig(newConfig);
config.loadConfig();
res.redirect('/');
};
module.exports = {settings, save};
|