mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Added logging to accesible folder, and made all questions page more readable
This commit is contained in:
parent
ccc7f31e3a
commit
59640eaddf
16 changed files with 149 additions and 15 deletions
20
server.js
Executable file → Normal file
20
server.js
Executable file → Normal file
|
@ -45,6 +45,8 @@ const inputFile = "stats/inputs";
|
|||
const msgFile = "stats/msgs";
|
||||
const logFile = "stats/logs";
|
||||
|
||||
const allLogFile = "/nlogs/log";
|
||||
|
||||
// https://certbot.eff.org/
|
||||
const privkeyFile = "/etc/letsencrypt/live/questionmining.tk/privkey.pem";
|
||||
const fullchainFile = "/etc/letsencrypt/live/questionmining.tk/fullchain.pem";
|
||||
|
@ -134,17 +136,14 @@ app.get('/static', function(req, res) {
|
|||
});
|
||||
|
||||
app.get('/legacy', function(req, res) {
|
||||
// TODO: make this ejs
|
||||
var f = utils.ReadFile(dataFile);
|
||||
var r = '<html><body bgcolor="#212127"><head><meta charset="UTF-8">';
|
||||
r += '<style>body { font: normal 14px Verdana; color: #999999;}</style>';
|
||||
var d = actions.LoadJSON(f).toString().split("\n");
|
||||
for (var i = 0; i < d.length; i++)
|
||||
r += d[i] + "</br>";
|
||||
r += '</head></body></html>';
|
||||
|
||||
res.write(r);
|
||||
res.end();
|
||||
var f = utils.ReadFile(dataFile);
|
||||
var d = actions.LoadJSON(f);
|
||||
var raw = d.toString().split("\n");
|
||||
|
||||
res.render('alldata', {
|
||||
data: d
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/postfeedback', function(req, res) {
|
||||
|
@ -276,6 +275,7 @@ function Log(req, toFile, sc) {
|
|||
.body) + "\n";
|
||||
|
||||
utils.AppendToFile(defLogs, logFile);
|
||||
utils.AppendToFile(defLogs, allLogFile);
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue