Added "test" user checking, unathorized http return code

This commit is contained in:
MrFry 2020-05-10 21:28:10 +02:00
parent 1b078f88b0
commit 2beef493ba
5 changed files with 27 additions and 5 deletions

View file

@ -38,7 +38,7 @@ const minMatchAmmountToAdd = 90 // FIXME: test this value
const writeAfter = 1 // write after # of adds FIXME: set reasonable save rate
var currWrites = 0
function ProcessIncomingRequest (recievedData, qdb, infos) {
function ProcessIncomingRequest (recievedData, qdb, infos, dryRun) {
logger.DebugLog('Processing incoming request', 'actions', 1)
if (recievedData === undefined) {
logger.Log('\tRecieved data is undefined!', logger.GetColor('redbg'))
@ -108,7 +108,7 @@ function ProcessIncomingRequest (recievedData, qdb, infos) {
currWrites++
logger.DebugLog('currWrites for data.json: ' + currWrites, 'actions', 1)
if (currWrites >= writeAfter) {
if (currWrites >= writeAfter && !dryRun) {
currWrites = 0
try {
qdb.version = infos.version
@ -120,6 +120,8 @@ function ProcessIncomingRequest (recievedData, qdb, infos) {
logger.DebugLog('Writing data.json', 'actions', 1)
utils.WriteFile(JSON.stringify(qdb), dataFile)
logger.Log('\tData file written', color)
} else if (dryRun) {
logger.Log('\tDry run')
}
} else {
msg += `No new data ( ${allQLength} )`