blob: 609d70501d01bcb8bc67f3fb225c9d79564ee873 (
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
|
const cmn = require("../$common.js");
const fs = require("fs");
const bodyParser = require("body-parser");
let moddir = null;
module.exports=function(app,io,_moddir){
moddir = _moddir;
let config, accounts;
try {
accounts = require("./accounts.json");
} catch (e) {
console.error(e);
return false;
}
app.post("/up_log/log", bodyParser.json(), cmn.authgen(accounts), (req,res) => {
if (typeof req.body.machine != "string") {
return res.sendStatus(400);
}
const machine = req.body.machine.replace(/[^a-zA-Z0-9._-]/g, "");
fs.appendFileSync(moddir + "/log.txt", new Date().toISOString() + " machine=" + machine + "\n");
res.status(200).end();
});
};
|