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 cols = process.stdout.columns
// const rows = process.stdout.rows // 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 statNameSpacing = 4
const beforeRowSpace = 13 const beforeRowSpace = 13
const rowsToPrint = Math.floor(cols / (colWidth + statNameSpacing + beforeRowSpace / 3 + 5)) || 1
const coloredWords = { const coloredWords = {
red: ['lred', 'thanks'], red: [
'lred',
'thanks'
],
cyan: [ cyan: [
'getveteranpw', 'getveteranpw',
'pwrequest', 'pwrequest',
@ -27,25 +32,31 @@ const coloredWords = {
'ranklist', 'ranklist',
'allqr', 'allqr',
'possibleAnswers', 'possibleAnswers',
'irc',
'faq', 'faq',
'/script', '/script',
'listUserDir', 'listUserDir',
'forumEntries', 'forumEntries',
'contacts.json', 'contacts.json',
'patreon',
'donate',
'userfiles'
], ],
blue: ['isadding', 'ask', 'newUserDir', 'updateQuestion', 'uploadUserFile'], blue: [
magenta: [ 'isadding',
'addPost', 'react',
'tiszai', 'ask',
'install', 'newUserDir',
'discord', 'updateQuestion',
'postfeedback', 'uploadUserFile',
'votetodo', 'votetodo',
'registerscript', 'registerscript',
'quickvote', 'install',
],
magenta: [
'addPost',
'comment', 'comment',
'react' 'postfeedback',
'quickvote',
], ],
} }
const filterFromDailyStats = [ const filterFromDailyStats = [
@ -68,6 +79,7 @@ const filterFromDailyStats = [
'.min.js', '.min.js',
'.xml', '.xml',
'.aspx', '.aspx',
'/questionDbs/',
] ]
// ----------------------------------------------------------------- // -----------------------------------------------------------------
@ -180,10 +192,13 @@ function getLetterNTimes(letter, number) {
return res return res
} }
function pCols(cols, rowTitles, colorNames, firstRowColor, showDiff) { function pCols(cols, rowTitles, colorNames, firstRowColor) {
// console.log(cols) // console.log(cols)
let maxLength = 0 let maxLength = 0
cols.forEach((col) => { cols.reverse().forEach((col, i) => {
if (i >= rowsToPrint) {
return
}
if (col.length > maxLength) { if (col.length > maxLength) {
maxLength = col.length maxLength = col.length
} }
@ -193,16 +208,17 @@ function pCols(cols, rowTitles, colorNames, firstRowColor, showDiff) {
for (let i = 0; i < maxLength; i++) { for (let i = 0; i < maxLength; i++) {
const row = [] const row = []
const lastItems = []
cols cols
.forEach((val) => { .forEach((val, colIndex) => {
if (colIndex >= rowsToPrint) {
return
}
if (!val[i]) { if (!val[i]) {
row.push(getLetterNTimes(' ', maxStatLength + statNameSpacing + 2)) row.push(getLetterNTimes(' ', maxStatLength + statNameSpacing + 2))
return return
} }
lastItems.push(val[i])
const keyName = val[i].name || val[i] const keyName = val[i].name || val[i]
let slicedName = keyName.slice(0, maxStatLength) let slicedName = keyName.slice(0, maxStatLength)
@ -264,15 +280,6 @@ function pCols(cols, rowTitles, colorNames, firstRowColor, showDiff) {
res = currRowTitle + row.join(getLetterNTimes(' ', statNameSpacing)) res = currRowTitle + row.join(getLetterNTimes(' ', statNameSpacing))
} }
// SHOW DIFF --------------------------------------------------- // 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) console.log(res)
} }
} }
@ -412,7 +419,7 @@ function printLastDataCount(data) {
res[i].push(dataCount.questionCount.toString()) 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') printHeader('Daily script install / update check count')

View file

@ -44,25 +44,5 @@
"frylabs.net", "frylabs.net",
"www.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; font-size: 16px;
color: white; color: white;
background-color: #181a1b; background-color: #181a1b;
width: 300px;; width: 360px;;
padding: 12px 20px; padding: 12px 20px;
margin: 8px 0; margin: 8px 0;
box-sizing: border-box; box-sizing: border-box;
@ -91,7 +91,7 @@
</div> </div>
<div id='form'> <div id='form'>
<div class='inputContainer'> <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"/> <input type='hidden' id='cid' name='pw' autocomplete="off"/>
</div> </div>
<button id='sendButton' onclick="Login(this)">Belépés</button> <button id='sendButton' onclick="Login(this)">Belépés</button>
@ -130,7 +130,7 @@
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
body: JSON.stringify({ body: JSON.stringify({
pw: document.getElementById('pw').value, pw: document.getElementById('pw').value.trim(),
cid: document.getElementById('cid').value cid: document.getElementById('cid').value
}) })
}) })

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

@ -1 +1 @@
Subproject commit 602e16046e6600a405ae68814c11349fde745244 Subproject commit 3a67f2a1aa8903c534719d62ddaa69701448be9a