Merge branch 'master' of gitlab.com:MrFry/mrfrys-node-server

This commit is contained in:
mrfry 2021-06-01 09:36:19 +02:00
commit e8ec2ef43e
6 changed files with 501 additions and 1039 deletions

1430
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -4,11 +4,16 @@
const cols = process.stdout.columns
// const rows = process.stdout.rows
const maxStatLength = Math.floor(cols / 4)
const statNameSpacing = 5
const colWidth = 40
const maxStatLength = colWidth // Math.floor(cols / 4)
const statNameSpacing = 4
const beforeRowSpace = 13
const rowsToPrint = Math.floor(cols / (colWidth + statNameSpacing + beforeRowSpace / 3 + 5)) || 1
const coloredWords = {
red: ['lred', 'thanks'],
red: [
'lred',
'thanks'
],
cyan: [
'getveteranpw',
'pwrequest',
@ -27,25 +32,31 @@ const coloredWords = {
'ranklist',
'allqr',
'possibleAnswers',
'irc',
'faq',
'/script',
'listUserDir',
'forumEntries',
'contacts.json',
'patreon',
'donate',
'userfiles'
],
blue: ['isadding', 'ask', 'newUserDir', 'updateQuestion', 'uploadUserFile'],
magenta: [
'addPost',
'tiszai',
'install',
'discord',
'postfeedback',
blue: [
'isadding',
'react',
'ask',
'newUserDir',
'updateQuestion',
'uploadUserFile',
'votetodo',
'registerscript',
'quickvote',
'install',
],
magenta: [
'addPost',
'comment',
'react'
'postfeedback',
'quickvote',
],
}
const filterFromDailyStats = [
@ -64,7 +75,11 @@ const filterFromDailyStats = [
'.git',
'apple-touch-icon',
'/.env',
'/userFiles/'
'/userFiles/',
'.min.js',
'.xml',
'.aspx',
'/questionDbs/',
]
// -----------------------------------------------------------------
@ -177,10 +192,13 @@ function getLetterNTimes(letter, number) {
return res
}
function pCols(cols, rowTitles, colorNames, firstRowColor, showDiff) {
function pCols(cols, rowTitles, colorNames, firstRowColor) {
// console.log(cols)
let maxLength = 0
cols.forEach((col) => {
cols.reverse().forEach((col, i) => {
if (i >= rowsToPrint) {
return
}
if (col.length > maxLength) {
maxLength = col.length
}
@ -190,16 +208,17 @@ function pCols(cols, rowTitles, colorNames, firstRowColor, showDiff) {
for (let i = 0; i < maxLength; i++) {
const row = []
const lastItems = []
cols
.forEach((val) => {
.forEach((val, colIndex) => {
if (colIndex >= rowsToPrint) {
return
}
if (!val[i]) {
row.push(getLetterNTimes(' ', maxStatLength + 5))
row.push(getLetterNTimes(' ', maxStatLength + statNameSpacing + 2))
return
}
lastItems.push(val[i])
const keyName = val[i].name || val[i]
let slicedName = keyName.slice(0, maxStatLength)
@ -228,7 +247,7 @@ function pCols(cols, rowTitles, colorNames, firstRowColor, showDiff) {
}
let ammount = val[i].val ? val[i].val.toString() : ''
while (ammount.length < 4) {
while (ammount.length < 5) {
ammount = ammount + ' '
}
@ -261,15 +280,6 @@ function pCols(cols, rowTitles, colorNames, firstRowColor, showDiff) {
res = currRowTitle + row.join(getLetterNTimes(' ', statNameSpacing))
}
// SHOW DIFF ---------------------------------------------------
if (showDiff && i !== 0) {
let diff =
lastItems[lastItems.length - 1] - lastItems[lastItems.length - 2]
if (diff > 0) {
diff = '+' + diff.toString()
}
res += C('blue') + diff + C()
}
console.log(res)
}
}
@ -373,20 +383,20 @@ pCols(
[
'Today',
preProcessUIdTestSolving(clientIdTestSolving[getDayIndex()]),
preProcessUIdTestSolving(clientIdTestSolving[getDayIndex()], 2),
preProcessUIdTestSolving(clientIdTestSolving[getDayIndex()], 5),
],
[
'Yesterday',
preProcessUIdTestSolving(clientIdTestSolving[getDayIndex(-1)]),
preProcessUIdTestSolving(clientIdTestSolving[getDayIndex(-1)], 2),
preProcessUIdTestSolving(clientIdTestSolving[getDayIndex(-1)], 5),
],
[
'Before Yesterday',
preProcessUIdTestSolving(clientIdTestSolving[getDayIndex(-2)]),
preProcessUIdTestSolving(clientIdTestSolving[getDayIndex(-2)], 2),
preProcessUIdTestSolving(clientIdTestSolving[getDayIndex(-2)], 5),
],
],
['', 'All', 'More than 2'],
['', 'All', 'More than 5'],
false,
'green'
)
@ -409,7 +419,7 @@ function printLastDataCount(data) {
res[i].push(dataCount.questionCount.toString())
})
pCols(res, ['', 'Users', 'Subjects', 'Questions'], false, 'green', true)
pCols(res, ['', 'Users', 'Subjects', 'Questions'], false, 'green')
}
// ------------------------------------------------------------------------------
printHeader('Daily script install / update check count')

View file

@ -44,25 +44,5 @@
"frylabs.net",
"www.frylabs.net"
]
},
"sio": {
"path": "./modules/sio/sio.js",
"publicdirs": [
"publicDirs/sioPublic/"
],
"name": "sio",
"urls": [
"sio.frylabs.net"
]
},
"stuff": {
"path": "./modules/stuff/stuff.js",
"publicdirs": [
"publicDirs/stuffPublic/"
],
"name": "stuff",
"urls": [
"stuff.frylabs.net"
]
}
}

View file

@ -47,7 +47,7 @@
font-size: 16px;
color: white;
background-color: #181a1b;
width: 300px;;
width: 360px;;
padding: 12px 20px;
margin: 8px 0;
box-sizing: border-box;
@ -91,7 +91,7 @@
</div>
<div id='form'>
<div class='inputContainer'>
<input type='password' placeholder='Jelszó' onkeyup="PWKeyUp(this)" type='text' id='pw' name='pw' autocomplete="off" autofocus/>
<input type='text' placeholder='Jelszó' onkeyup="PWKeyUp(this)" type='text' id='pw' name='pw' autocomplete="off" autofocus/>
<input type='hidden' id='cid' name='pw' autocomplete="off"/>
</div>
<button id='sendButton' onclick="Login(this)">Belépés</button>
@ -130,7 +130,7 @@
'Content-Type': 'application/json'
},
body: JSON.stringify({
pw: document.getElementById('pw').value,
pw: document.getElementById('pw').value.trim(),
cid: document.getElementById('cid').value
})
})

@ -1 +1 @@
Subproject commit 27211c7bc83e0e930fabc430ffb5615b52523106
Subproject commit d06e9900445ca8af4ee354244b056f24bb76bc0c

@ -1 +1 @@
Subproject commit 602e16046e6600a405ae68814c11349fde745244
Subproject commit ae9a168ada577d65a71ac27ef3959624ed3e71da