mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Added motd support, and minor logging improvements
This commit is contained in:
parent
02c513c090
commit
7284358121
3 changed files with 13 additions and 7 deletions
10
actions.js
10
actions.js
|
@ -45,16 +45,16 @@ function Process(d, file) {
|
||||||
var newRes = CheckData(newFile);
|
var newRes = CheckData(newFile);
|
||||||
var oldRes = CheckData(oldFile);
|
var oldRes = CheckData(oldFile);
|
||||||
|
|
||||||
if (newRes.count > 0)
|
|
||||||
logger.Log("[NLOD]:\t\tnew file result: " + newRes.count, logger.GetColor("blue"));
|
|
||||||
else
|
|
||||||
logger.Log("[NLOD]:\t\tnew file NLOD error, " + newRes.log, logger.GetColor("redbg"), true);
|
|
||||||
|
|
||||||
if (oldRes.count > 0)
|
if (oldRes.count > 0)
|
||||||
logger.Log("[NLOD]:\t\told public result: " + oldRes.count, logger.GetColor("blue"));
|
logger.Log("[NLOD]:\t\told public result: " + oldRes.count, logger.GetColor("blue"));
|
||||||
else
|
else
|
||||||
logger.Log("[NLOD]:\t\told public NLOD error, " + oldRes.log, logger.GetColor("redbg"), true);
|
logger.Log("[NLOD]:\t\told public NLOD error, " + oldRes.log, logger.GetColor("redbg"), true);
|
||||||
|
|
||||||
|
if (newRes.count > 0)
|
||||||
|
logger.Log("[NLOD]:\t\tnew file result: " + newRes.count, logger.GetColor("blue"));
|
||||||
|
else
|
||||||
|
logger.Log("[NLOD]:\t\tnew file NLOD error, " + newRes.log, logger.GetColor("redbg"), true);
|
||||||
|
|
||||||
utils.WriteFile(newFile, file);
|
utils.WriteFile(newFile, file);
|
||||||
logger.Log("[NLOD]:\t\tNew data written to: " + file);
|
logger.Log("[NLOD]:\t\tNew data written to: " + file);
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ var stat = require('./stat.js');
|
||||||
var bodyParser = require('body-parser');
|
var bodyParser = require('body-parser');
|
||||||
|
|
||||||
const recivedFiles = "public/recivedfiles";
|
const recivedFiles = "public/recivedfiles";
|
||||||
|
const motdFile = "public/motd";
|
||||||
const publicFile = "public/data/public";
|
const publicFile = "public/data/public";
|
||||||
const staticFile = "public/data/static";
|
const staticFile = "public/data/static";
|
||||||
const countFile = "public/data/count";
|
const countFile = "public/data/count";
|
||||||
|
@ -101,12 +102,16 @@ app.get('/manual', function(req, res) {
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/public', function(req, res) {
|
app.get('/public', function(req, res) {
|
||||||
res.write(utils.ReadFile(publicFile));
|
var response = '@' + utils.ReadFile(motdFile);
|
||||||
|
response += utils.ReadFile(publicFile);
|
||||||
|
res.write(response);
|
||||||
res.end();
|
res.end();
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/static', function(req, res) {
|
app.get('/static', function(req, res) {
|
||||||
res.write(utils.ReadFile(staticFile));
|
var response = '@' + utils.ReadFile(motdFile);
|
||||||
|
response += utils.ReadFile(staticFile);
|
||||||
|
res.write(response);
|
||||||
res.end();
|
res.end();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
1
todos
1
todos
|
@ -1,2 +1,3 @@
|
||||||
make init function that
|
make init function that
|
||||||
creates directory and file structure
|
creates directory and file structure
|
||||||
|
remove public questions
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue