package updates, server stats script update

This commit is contained in:
mrfry 2021-11-22 20:14:45 +01:00
parent c13035a8df
commit 1a646db611
5 changed files with 83 additions and 69 deletions

36
package-lock.json generated
View file

@ -1444,9 +1444,9 @@
} }
}, },
"node_modules/ansi-regex": { "node_modules/ansi-regex": {
"version": "5.0.0", "version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": ">=8" "node": ">=8"
@ -7656,9 +7656,9 @@
} }
}, },
"node_modules/tar": { "node_modules/tar": {
"version": "6.1.0", "version": "6.1.11",
"resolved": "https://registry.npmjs.org/tar/-/tar-6.1.0.tgz", "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz",
"integrity": "sha512-DUCttfhsnLCjwoDoFcI+B2iJgYa93vBnDUATYEeRx6sntCTdN01VnqsIuTlALXla/LWooNg0yEGeB+Y8WdFxGA==", "integrity": "sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==",
"dependencies": { "dependencies": {
"chownr": "^2.0.0", "chownr": "^2.0.0",
"fs-minipass": "^2.0.0", "fs-minipass": "^2.0.0",
@ -7758,9 +7758,9 @@
"dev": true "dev": true
}, },
"node_modules/tmpl": { "node_modules/tmpl": {
"version": "1.0.4", "version": "1.0.5",
"resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz",
"integrity": "sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE=", "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==",
"dev": true "dev": true
}, },
"node_modules/to-fast-properties": { "node_modules/to-fast-properties": {
@ -9644,9 +9644,9 @@
} }
}, },
"ansi-regex": { "ansi-regex": {
"version": "5.0.0", "version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true "dev": true
}, },
"ansi-styles": { "ansi-styles": {
@ -14473,9 +14473,9 @@
} }
}, },
"tar": { "tar": {
"version": "6.1.0", "version": "6.1.11",
"resolved": "https://registry.npmjs.org/tar/-/tar-6.1.0.tgz", "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz",
"integrity": "sha512-DUCttfhsnLCjwoDoFcI+B2iJgYa93vBnDUATYEeRx6sntCTdN01VnqsIuTlALXla/LWooNg0yEGeB+Y8WdFxGA==", "integrity": "sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==",
"requires": { "requires": {
"chownr": "^2.0.0", "chownr": "^2.0.0",
"fs-minipass": "^2.0.0", "fs-minipass": "^2.0.0",
@ -14561,9 +14561,9 @@
"dev": true "dev": true
}, },
"tmpl": { "tmpl": {
"version": "1.0.4", "version": "1.0.5",
"resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz",
"integrity": "sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE=", "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==",
"dev": true "dev": true
}, },
"to-fast-properties": { "to-fast-properties": {

View file

@ -83,19 +83,29 @@ const filterFromDailyStats = [
const fs = require('fs') // eslint-disable-line const fs = require('fs') // eslint-disable-line
const dir = process.argv[2] const dir = process.argv[2]
const startDay = !isNaN(parseInt(process.argv[3])) && parseInt(process.argv[3]) > 0 ? 0 : parseInt(process.argv[3])
if (!dir) { if (!dir) {
console.log('No params') console.log('No params')
process.exit() process.exit()
} }
function getDayIndex(offset) { function getDayIndex(offset) {
let os = offset
if (!offset) { if (!offset) {
offset = 0 os = 0
}
if (!isNaN(startDay)) {
if (!offset) {
os = startDay
} else {
os = startDay + offset
}
} }
const date = new Date() const date = new Date()
if (offset) { if (os) {
date.setDate(date.getDate() + offset) date.setDate(date.getDate() + os)
} }
return ( return (
date.getFullYear() + date.getFullYear() +
@ -172,7 +182,11 @@ function countLinesMatching(text, toMatch) {
} }
function getDayName(day) { function getDayName(day) {
switch (day) { let d = day
if (!isNaN(startDay)) {
d += startDay
}
switch (d) {
case 0: case 0:
case undefined: case undefined:
return 'Today' return 'Today'
@ -181,7 +195,9 @@ function getDayName(day) {
case -2: case -2:
return 'Before yesterday' return 'Before yesterday'
default: default:
return `Day ${day.toString()}` const now = new Date()
now.setDate(now.getDate() + d);
return now.toDateString()
} }
} }
@ -252,7 +268,7 @@ function pCols(cols, rowTitles, colorNames, firstRowColor) {
slicedName = slicedName + sep slicedName = slicedName + sep
} }
let ammount = val[i].val ? val[i].val.toString() : '' let ammount = val[i].val ? val[i].val.toLocaleString() : ''
while (ammount.length < 5) { while (ammount.length < 5) {
ammount = ammount + ' ' ammount = ammount + ' '
} }
@ -432,9 +448,9 @@ try {
return [getDayName(-x)] return [getDayName(-x)]
}) })
data.forEach((dataCount, i) => { data.forEach((dataCount, i) => {
res[i].push(dataCount.userCount.toString()) res[i].push(dataCount.userCount.toLocaleString())
res[i].push(dataCount.subjectCount.toString()) res[i].push(dataCount.subjectCount.toLocaleString())
res[i].push(dataCount.questionCount.toString()) res[i].push(dataCount.questionCount.toLocaleString())
}) })
pCols(res, ['', 'Users', 'Subjects', 'Questions'], false, 'green') pCols(res, ['', 'Users', 'Subjects', 'Questions'], false, 'green')
@ -456,8 +472,8 @@ try {
} }
return [ return [
getDayName(day), getDayName(day),
countLinesMatching(log, '?install').toString(), countLinesMatching(log, '?install').toLocaleString(),
countLinesMatching(log, '?up').toString(), countLinesMatching(log, '?up').toLocaleString(),
] ]
} }

View file

@ -1,41 +1,39 @@
<html> <html>
<body bgcolor="#212127">
<body bgcolor="#212127">
<head> <head>
<title>FryLabs.net</title> <title>frylabs.net</title>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=0.8" /> <meta name="viewport" content="width=device-width, initial-scale=0.8" />
<style> <style>
body { body {
font: normal 14px Verdana; margin: 0px;
color: #999999; height: 100%;
font: bold 0.75vw Verdana;
color: #999;
display: flex;
justify-content: center;
align-items: center;
user-select: none;
} }
td { h2 {
vertical-align: top color: #99f;
}
a {
color: #9999ff;
text-decoration: none; text-decoration: none;
} }
</style> </style>
</head> </head>
</p>
<h2> <h2>
<a> <pre> /$$$$$$$$ /$$ /$$ /$$
<pre> | $$_____/ | $$ | $$ | $$
____ __ __ | $$ /$$$$$$ /$$ /$$| $$ /$$$$$$ | $$$$$$$ /$$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$
/ __/_____ __ / /__ _/ / ___ | $$$$$ /$$__ $$| $$ | $$| $$ |____ $$| $$__ $$ /$$_____/ | $$__ $$ /$$__ $$|_ $$_/
/ _// __/ // / / / _ `/ _ \(_-< | $$__/| $$ \__/| $$ | $$| $$ /$$$$$$$| $$ \ $$| $$$$$$ | $$ \ $$| $$$$$$$$ | $$
/_/ /_/ \_, / /_/\_,_/_.__/___/ | $$ | $$ | $$ | $$| $$ /$$__ $$| $$ | $$ \____ $$ | $$ | $$| $$_____/ | $$ /$$
/___/ | $$ | $$ | $$$$$$$| $$| $$$$$$$| $$$$$$$/ /$$$$$$$//$$| $$ | $$| $$$$$$$ | $$$$/
</pre> |__/ |__/ \____ $$|__/ \_______/|_______/ |_______/|__/|__/ |__/ \_______/ \___/
</a> /$$ | $$
| $$$$$$/
\______/</pre>
</h2> </h2>
</body> </body>
</html> </html>

@ -1 +1 @@
Subproject commit 27211c7bc83e0e930fabc430ffb5615b52523106 Subproject commit 50cb6d323769371ebf9cd6ce4f477ef5fbbe9c80

@ -1 +1 @@
Subproject commit 2b491e6bec6eee78400e3e042418def12df3243f Subproject commit c92615e32366b106f64e3145ddc706bddd42915b