diff --git a/actions.js b/actions.js index 00792f0..dd51dd4 100644 --- a/actions.js +++ b/actions.js @@ -26,10 +26,11 @@ module.exports = { ProcessQA: ProcessQA }; -var recievedFile = "stats/recieved"; var staticFile = "public/data/static"; var manFile = "public/man.html"; var dataFile = "public/data.json"; +const versionFile = "public/version"; +const motdFile = "public/motd"; const qaFile = "public/qa"; var logger = require('./logger.js'); @@ -285,6 +286,13 @@ function ProcessIncomingRequest(data) { msg += ". Version: " + d.version; var color = logger.GetColor("green"); + try { + data.version = utils.ReadFile(versionFile); + data.motd = utils.ReadFile(motdFile); + } catch (e) { + Log("MOTD/Version writing/reading error!"); + } + if (data != undefined && d.data.length > 0){ utils.WriteBackup(); utils.WriteFile(JSON.stringify(data), dataFile); @@ -317,7 +325,6 @@ function ProcessIncomingRequest(data) { var newStatItems = Process(d, staticFile); - utils.AppendToFile(logger.GetDateString() + "\n" + d.data, recievedFile); PrintNewCount(d, newStatItems, staticFile); } } diff --git a/changedataversion.js b/changedataversion.js index e48cb0a..2b5052a 100644 --- a/changedataversion.js +++ b/changedataversion.js @@ -1,5 +1,6 @@ const utils = require('./utils.js'); const dataFile = "public/data.json"; +const versionFile = "public/version"; var p = GetParams(); if (p.length <= 0) { @@ -24,6 +25,7 @@ console.log("New version:"); console.log(parsed.version); utils.WriteFile(JSON.stringify(parsed), dataFile); +utils.WriteFile(parsed.version, versionFile); function GetParams() { return process.argv.splice(2); diff --git a/motd.js b/motd.js index a8f7d02..6a8bcc9 100644 --- a/motd.js +++ b/motd.js @@ -1,5 +1,7 @@ const utils = require('./utils.js'); const dataFile = "public/data.json"; +const versionFile = "public/version"; +const motdFile = "public/motd"; var p = GetParams(); if (p.length <= 0) { @@ -15,6 +17,8 @@ var parsed = JSON.parse(d); parsed.motd = param; utils.WriteFile(JSON.stringify(parsed), dataFile); +utils.WriteFile(parsed.motd, motdFile); + function GetParams() { return process.argv.splice(2); } diff --git a/public/man.html b/public/man.html index 119a03f..927a125 100644 --- a/public/man.html +++ b/public/man.html @@ -360,6 +360,12 @@ változtatni akarsz, akkor illik tudni
  • Nincs kiválasztva a megoldani kívánt tárgy a menüben.
  • +
  • + 7. Mi ez a ... ? +
    + img + +
  • Egyéb:
    -
    -

    Adat egyszerűsítés

    -
    -
    Másold be ide az egész txt-d, és ez kiszedi belőle az ugyanolyan kérdéseket, illetve ha - hibás részeket talál, akkor kikommenteli. Érdemes megnézni, hogy történt-e ilyen, keress rá a - kész szövegben a "#"-karakterre. Ezzel azért óvatosan, ez kipusztithatja a szobanövényed. - -
    Jogosultságok:
    GM_openInTab: help megnyitása új lapon, GM_xmlhttpRequest: online adatbázishoz. GM_getResourceText: a txt beolvasáshoz. Mást nem bír beolvasni, csak amit megadsz a @resouces @@ -411,85 +409,6 @@ consolra ki vannak írva, amit f12 megnyitásával tudsz előhozni (chrome/firef } document.getElementById("tex").value = "// @resource data file:///" + a; } - - function simplify() { - var splitData = document.getElementById("converter").value.split("\n"); - var result = []; - var jumped = 0; - var doubles = 0; - for (var i = 0; i < splitData.length; i += jumped) { - splitData[i] = splitData[i].trim(); - jumped = 0; - var currQuestion = { - q: splitData[i], - a: splitData[i + 1], - i: splitData[i + 2] - }; - - if (currQuestion.q != undefined && currQuestion.q[0] == "?" && currQuestion.a != undefined && - currQuestion.a[0] == "!") { - jumped += 2; - } - if (currQuestion.i != undefined && currQuestion.i[0] == ">" && jumped == 2) { - jumped++; - } else { - delete currQuestion.i; - } - if (jumped > 1) { - for (var j = 0; j < result.length; j++) { - if (result[j].q) { - if (result[j].q == currQuestion.q && result[j].a == currQuestion.a) { - if (result[j].i && currQuestion.i) { - if (result[j].i == currQuestion.i) { - break; - } - } else { - break; - } - } - } - } - if (j >= result.length) { - result.push(currQuestion); - } else { - doubles++; - } - } - if (currQuestion.q[0] == "+") { - result.push({ - n: currQuestion.q - }); - jumped++; - } else if (jumped < 1) { - var comment = currQuestion.q; - if (comment[0] != "#") { - comment = "#" + comment; - } - result.push({ - c: comment - }); - jumped++; - } - } - var textResult = ""; - for (var i = 0; i < result.length; i++) { - if (result[i].q != undefined && result[i].a != undefined) { - textResult += result[i].q + "\n"; - textResult += result[i].a + "\n"; - } - if (result[i].i != undefined) { - textResult += result[i].i + "\n"; - } - if (result[i].c != undefined) { - textResult += result[i].c + "\n"; - } - if (result[i].n != undefined) { - textResult += result[i].n + "\n"; - } - } - alert(doubles + " duplikáció eltávolítva, és hibás kérdések kikommentelve."); - document.getElementById("converter").value = textResult; - } diff --git a/server.js b/server.js index af860a8..d944aae 100644 --- a/server.js +++ b/server.js @@ -73,10 +73,6 @@ if (startHTTPS && utils.FileExists(privkeyFile) && utils.FileExists(fullchainFil const port = 8080; const httpsPort = 8443; -var highlights = ["public", "static", "manual", "isgetting", "postfeedback", - "postquestions" -]; - app.set('view engine', 'ejs'); app.use(function(req, res, next) { res.on('finish', function() { @@ -277,11 +273,7 @@ function Log(req, toFile, sc) { logEntry += sc + " "; logEntry += req.url; var color = logger.GetColor("green"); - for (var i = 0; i < highlights.length; i++) - if (req.url.toLowerCase().includes(highlights[i])) { - color = logger.GetColor("blue"); - break; - } + if (req.url.toLowerCase().includes("isadding")) color = logger.GetColor("yellow"); if (!toFile) {