Removed some public question stuff

This commit is contained in:
YourFriendlyNeighborhoodDealer 2018-12-09 17:51:01 +01:00
parent 1230d2c3de
commit 9a257868a1
3 changed files with 0 additions and 89 deletions

View file

@ -24,7 +24,6 @@ module.exports = {
}; };
var recievedFile = "stats/recieved"; var recievedFile = "stats/recieved";
var publicFile = "public/data/public";
var staticFile = "public/data/static"; var staticFile = "public/data/static";
var manFile = "public/man.html"; var manFile = "public/man.html";
@ -106,11 +105,9 @@ function ProcessIncomingRequest(data) {
Process(d, publicFile); Process(d, publicFile);
Process(d, staticFile); Process(d, staticFile);
}*/ }*/
var newPubItems = Process(d, publicFile);
var newStatItems = Process(d, staticFile); var newStatItems = Process(d, staticFile);
utils.AppendToFile(logger.GetDateString() + "\n" + d.data, recievedFile); utils.AppendToFile(logger.GetDateString() + "\n" + d.data, recievedFile);
PrintNewCount(d, newPubItems, publicFile);
PrintNewCount(d, newStatItems, staticFile); PrintNewCount(d, newStatItems, staticFile);
} }

View file

@ -33,7 +33,6 @@ var bodyParser = require('body-parser');
const recivedFiles = "public/recivedfiles"; const recivedFiles = "public/recivedfiles";
const motdFile = "public/motd"; const motdFile = "public/motd";
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";
const manFile = "public/man.html"; const manFile = "public/man.html";
@ -90,7 +89,6 @@ app.use(bodyParser.json({
app.get('/', function(req, res) { app.get('/', function(req, res) {
res.render('main', { res.render('main', {
pdata: utils.ReadFile(publicFile),
sdata: utils.ReadFile(staticFile) sdata: utils.ReadFile(staticFile)
}); });
res.end(); res.end();
@ -115,64 +113,6 @@ app.get('/static', function(req, res) {
res.end(); res.end();
}); });
app.post('/postquestions', function(req, res) {
var log = "Questions posted! ";
if (req.body.data_field == undefined) {
res.render('submitted', {
log: [],
msg: "Nincsen beküldött adat!"
});
log += "Sent data is undefined! ";
} else {
try {
utils.AppendToFile("\n" + logger.GetDateString() + "\n" + req.body.data_field, inputFile);
} catch (e) {
console.log(e);
}
var r = actions.CheckData(req.body.data_field);
if (r.count > 0) {
var c = utils.ReadFile(countFile);
if (parseInt(c) >= r.count) {
res.render('submitted', {
log: r.log,
msg: "Amit beküldtél kevesebb, vagy ugyanannyi kérdést tartalmaz! Az új kérdéseidet az eredeti végére másold! " +
"Új: " + r.count + " vs régi: " + c
});
log += "Sent data contains less questions: " + r.count + ", ";
} else {
res.render('submitted', {
log: r.log,
msg: "Sikeres frissítés! + " + (r.count - parseInt(c)) +
" új kérdés beküldve. néhány üzenet:"
});
utils.WriteFile(req.body.data_field, publicFile);
utils.WriteFile(r.count.toString(), countFile);
utils.WriteBackup();
log += "Wrote to file. ";
}
log += "Prev count : " + parseInt(c) + ", ";
} else {
res.render('submitted', {
log: r.log,
msg: "A fordító nem bírta értelmezni az elküldött adatokat! Ellenőrizd a kimenetet, és az elküldött adatokat."
});
log += "Could't parse data! ";
}
log += "NLOAD result: " + r.count;
}
logger.Log(log, logger.GetColor("blue"));
});
app.get('/postquestions', function(req, res) {
res.render('main', {
pdata: utils.ReadFile(publicFile),
sdata: utils.ReadFile(staticFile)
});
});
app.post('/postfeedback', function(req, res) { app.post('/postfeedback', function(req, res) {
res.redirect('back'); res.redirect('back');
newMessages += "\n" + req.body.message_field; newMessages += "\n" + req.body.message_field;
@ -182,7 +122,6 @@ app.post('/postfeedback', function(req, res) {
app.get('/postfeedback', function(req, res) { app.get('/postfeedback', function(req, res) {
res.render('main', { res.render('main', {
pdata: utils.ReadFile(publicFile),
sdata: utils.ReadFile(staticFile) sdata: utils.ReadFile(staticFile)
}); });
}); });

View file

@ -1,25 +0,0 @@
<html>
<body bgcolor="#212127">
<head>
<h2>
<%=msg%>
</h2>
</p>
<h3>
Log:
</h3>
Érdemes átnézni, lehetséges hibák vannak benne.
</p>
<%for(var i=0; i<log.length; i++) {%>
<%= log[i] %>
</br>
<%}%>
</br>
<a href="/"> Vissza </a>
</body>
</html>