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

View file

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

View file

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

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

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