auth fixes

This commit is contained in:
mrfry 2021-05-29 22:13:46 +02:00
parent 5fff6b9bba
commit e4af391d04
5 changed files with 39 additions and 52 deletions

View file

@ -4,11 +4,16 @@
const cols = process.stdout.columns
// const rows = process.stdout.rows
const maxStatLength = Math.floor(cols / 4)
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 = [
@ -68,6 +79,7 @@ const filterFromDailyStats = [
'.min.js',
'.xml',
'.aspx',
'/questionDbs/',
]
// -----------------------------------------------------------------
@ -180,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
}
@ -193,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 + statNameSpacing + 2))
return
}
lastItems.push(val[i])
const keyName = val[i].name || val[i]
let slicedName = keyName.slice(0, maxStatLength)
@ -264,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)
}
}
@ -412,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')