adding hostname to stats, changed data backup directory

This commit is contained in:
MrFry 2020-04-25 08:45:20 +02:00
parent 7020c10626
commit 6ce52d00d9
5 changed files with 6 additions and 6 deletions

View file

@ -32,7 +32,7 @@ module.exports = function (options) {
logger.LogReq(req, true, res.statusCode) logger.LogReq(req, true, res.statusCode)
if (toLog) { logger.LogReq(req) } if (toLog) { logger.LogReq(req) }
if (res.statusCode !== 404) { logger.LogStat(req.url, ip) } if (res.statusCode !== 404) { logger.LogStat(req.url, ip, hostname) }
}) })
next() next()
} }

View file

@ -541,7 +541,7 @@ function GetApp () {
utils.AppendToFile(utils.GetDateString() + '\n' + JSON.stringify(user) + '\n' + JSON.stringify(editedQuestions) + '\n\n', dataEditsLog) utils.AppendToFile(utils.GetDateString() + '\n' + JSON.stringify(user) + '\n' + JSON.stringify(editedQuestions) + '\n\n', dataEditsLog)
// making backup // making backup
utils.CopyFile('./' + dataFile, `./public/backs/data_before_${user.name}_${utils.GetDateString().replace(/ /g, '_')}`) utils.CopyFile('./' + dataFile, `./qminingPublic/backs/data_before_${user.name}_${utils.GetDateString().replace(/ /g, '_')}`) // TODO: rewrite to dinamyc public!!!
logger.Log('Backup made') logger.Log('Backup made')
// writing data // writing data
utils.WriteFile(JSON.stringify(newData), dataFile) utils.WriteFile(JSON.stringify(newData), dataFile)

@ -1 +1 @@
Subproject commit 25b9f72093c490a11580320b152f8eef21d63da2 Subproject commit 6bc51fb3878564012ce7af1a75b7fa049ab5f3c5

@ -1 +1 @@
Subproject commit 2c815c8d20b6c25a4214d6118760d993f2287f36 Subproject commit f8d4bf2a414d2973582c08bfa8b8b8f19389b2e9

View file

@ -191,7 +191,7 @@ function Load () {
setNoLogReadInterval() setNoLogReadInterval()
} }
function LogStat (url, ip) { function LogStat (url, ip, hostname) {
let nolog = noLogips.some((x) => { let nolog = noLogips.some((x) => {
return x.includes(ip) return x.includes(ip)
}) })
@ -199,7 +199,7 @@ function LogStat (url, ip) {
return return
} }
url = url.split('?')[0] url = hostname + url.split('?')[0]
Inc(url) Inc(url)
AddVisitStat(url) AddVisitStat(url)
Save() Save()