mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Removed some public question stuff
This commit is contained in:
parent
1230d2c3de
commit
9a257868a1
3 changed files with 0 additions and 89 deletions
|
@ -24,7 +24,6 @@ module.exports = {
|
|||
};
|
||||
|
||||
var recievedFile = "stats/recieved";
|
||||
var publicFile = "public/data/public";
|
||||
var staticFile = "public/data/static";
|
||||
var manFile = "public/man.html";
|
||||
|
||||
|
@ -106,11 +105,9 @@ function ProcessIncomingRequest(data) {
|
|||
Process(d, publicFile);
|
||||
Process(d, staticFile);
|
||||
}*/
|
||||
var newPubItems = Process(d, publicFile);
|
||||
var newStatItems = Process(d, staticFile);
|
||||
|
||||
utils.AppendToFile(logger.GetDateString() + "\n" + d.data, recievedFile);
|
||||
PrintNewCount(d, newPubItems, publicFile);
|
||||
PrintNewCount(d, newStatItems, staticFile);
|
||||
}
|
||||
|
||||
|
|
61
server.js
61
server.js
|
@ -33,7 +33,6 @@ var bodyParser = require('body-parser');
|
|||
|
||||
const recivedFiles = "public/recivedfiles";
|
||||
const motdFile = "public/motd";
|
||||
const publicFile = "public/data/public";
|
||||
const staticFile = "public/data/static";
|
||||
const countFile = "public/data/count";
|
||||
const manFile = "public/man.html";
|
||||
|
@ -90,7 +89,6 @@ app.use(bodyParser.json({
|
|||
|
||||
app.get('/', function(req, res) {
|
||||
res.render('main', {
|
||||
pdata: utils.ReadFile(publicFile),
|
||||
sdata: utils.ReadFile(staticFile)
|
||||
});
|
||||
res.end();
|
||||
|
@ -115,64 +113,6 @@ app.get('/static', function(req, res) {
|
|||
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) {
|
||||
res.redirect('back');
|
||||
newMessages += "\n" + req.body.message_field;
|
||||
|
@ -182,7 +122,6 @@ app.post('/postfeedback', function(req, res) {
|
|||
|
||||
app.get('/postfeedback', function(req, res) {
|
||||
res.render('main', {
|
||||
pdata: utils.ReadFile(publicFile),
|
||||
sdata: utils.ReadFile(staticFile)
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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>
|
Loading…
Add table
Add a link
Reference in a new issue