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

This commit is contained in:
mrfry 2021-05-04 10:28:48 +02:00
commit 2be76d2ae5
6 changed files with 17 additions and 93 deletions

5
.gitignore vendored
View file

@ -4,6 +4,7 @@ node_modules/
dist/ dist/
nextStatic/ nextStatic/
publicDirs/ publicDirs/
extraModules/ src/extraModules/
duplicateRemovingLog/
src/extraModules src/extraModules
/*.sh

View file

@ -28,6 +28,8 @@ const coloredWords = {
'allqr', 'allqr',
'possibleAnswers', 'possibleAnswers',
'irc', 'irc',
'faq',
'/script'
], ],
blue: ['isadding', 'ask'], blue: ['isadding', 'ask'],
magenta: [ magenta: [
@ -158,8 +160,10 @@ function countLinesMatching(text, toMatch) {
} }
function readFile(name) { function readFile(name) {
if (fs.existsSync(name)) {
return fs.readFileSync(name, 'utf8') return fs.readFileSync(name, 'utf8')
} }
}
function getLetterNTimes(letter, number) { function getLetterNTimes(letter, number) {
let res = '' let res = ''
@ -379,9 +383,9 @@ function printLastDataCount(data) {
} }
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
printHeader('Daily script install / update check count') printHeader('Daily script install / update check count')
const todaysLogs = readFile(`${dir}stats/vlogs/${getDayIndex()}`) const todaysLogs = readFile(`${dir}stats/vlogs/log`)
const yesterdaysLogs = readFile(`${dir}stats/vlogs/${getDayIndex(-1)}`) const yesterdaysLogs = readFile(`${dir}stats/vlogs/${getDayIndex(-1)}`) || ''
const beforeYesterdaysLogs = readFile(`${dir}stats/vlogs/${getDayIndex(-2)}`) const beforeYesterdaysLogs = readFile(`${dir}stats/vlogs/${getDayIndex(-2)}`) || ''
const installs = [ const installs = [
[ [

View file

@ -84,7 +84,7 @@ function GetApp(): ModuleType {
const fpath = listedFiles + fp const fpath = listedFiles + fp
if (!fs.existsSync(fpath)) { if (!fs.existsSync(fpath)) {
res.render('nofile', { res.render('nofile', {
missingFile: fpath, missingFile: fp,
url, url,
}) })
return return
@ -222,7 +222,7 @@ function GetApp(): ModuleType {
} }
} catch (err) { } catch (err) {
res.render('nofile', { res.render('nofile', {
missingFile: curr, missingFile: relPath,
url, url,
}) })
} }

View file

@ -44,7 +44,7 @@ import utils from './utils/utils'
import dbtools from './utils/dbtools' import dbtools from './utils/dbtools'
import reqlogger from './middlewares/reqlogger.middleware' import reqlogger from './middlewares/reqlogger.middleware'
import idStats from './utils/ids' import idStats from './utils/ids'
const extraModulesFile = '.src/extraModules/extraModules.json' const extraModulesFile = './data/extraModules.json'
const statExcludeFile = './data/statExclude.json' const statExcludeFile = './data/statExclude.json'
const modulesFile = './src/modules.json' const modulesFile = './src/modules.json'
const usersDBPath = './data/dbs/users.db' const usersDBPath = './data/dbs/users.db'

View file

@ -43,20 +43,16 @@
clear: both; clear: both;
padding-bottom: 23px; padding-bottom: 23px;
} }
.showpwContainer {
color: white;
width: 40px;
cursor: pointer;
}
input[type=text], input[type=password], textarea { input[type=text], input[type=password], textarea {
font-size: 16px; font-size: 16px;
color: white; color: white;
background-color: #181a1b; background-color: #181a1b;
width: 20%; width: 300px;;
padding: 12px 20px; padding: 12px 20px;
margin: 8px 0; margin: 8px 0;
box-sizing: border-box; box-sizing: border-box;
border: 2px solid white; border: 2px solid white;
text-align: center;
} }
input[type=text]:focus, input[type=password]:focus, textarea:focus, input[type=text]:hover, input[type=password]:hover, textarea:hover { input[type=text]:focus, input[type=password]:focus, textarea:focus, input[type=text]:hover, input[type=password]:hover, textarea:hover {
border: 2px solid #F2CB05; border: 2px solid #F2CB05;
@ -85,25 +81,6 @@
.disabledButton { .disabledButton {
background-color: #a38c1a; background-color: #a38c1a;
} }
.ircLinkContainer {
display: flex;
justify-content: flex-end
}
.ircLink {
color: #9999ff;
font-size: 12px;
text-decoration: underline;
cursor: pointer;
}
#feedback {
display: none;
}
#feedbackTextArea {
text-align: left;
font-size: 16px;
height: 160px;
resize: none;
}
</style> </style>
</head> </head>
<div class='logindiv'> <div class='logindiv'>
@ -112,22 +89,11 @@
</div> </div>
<div id='text' class='text'> <div id='text' class='text'>
</div> </div>
<div id='feedback'>
<textarea placeholder='Üzenet' id='feedbackTextArea'></textarea>
<input id='email' type='text' placeholder='E-mail, amire választ vársz (nem kötelező)' />
<div class='ircLinkContainer'>
<a class='ircLink' href='<%= devel? 'http' : 'https' %>://qmining.frylabs.net/irc?loginClick'>IRC chatszoba</a>
</div>
<button id='sendFeedbackButton' onclick="SendFeedback(this)">Submit</button>
</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='password' 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>
<div class='ircLinkContainer' >
<!--a class='ircLink' onclick='ShowFeedback()'>Contact</a-->
</div>
<button id='sendButton' onclick="Login(this)">Belépés</button> <button id='sendButton' onclick="Login(this)">Belépés</button>
</div> </div>
</div> </div>
@ -139,53 +105,6 @@
Login(document.getElementById('sendButton')) Login(document.getElementById('sendButton'))
} }
} }
function HandleFeedbackResp (resp) {
document.getElementById('sendButton').innerText = 'Submit'
const textNode = document.getElementById('text')
const feedback = document.getElementById('feedback').style.display = "none";
if (resp.success) {
textNode.innerText = 'Visszajelzés elküldve'
} else {
textNode.innerText = 'Szerver oldali hiba :c'
}
}
async function SendFeedback (button) {
const feedback = document.getElementById('feedbackTextArea').value
const email = document.getElementById('email').value
button.innerText = '...'
const rawResponse = await fetch('<%= devel? 'http' : 'https' %>://api.frylabs.net/postfeedback', {
method: 'POST',
credentials: 'include',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
description: feedback,
email: email,
fromLogin: true
})
})
if (!rawResponse.ok) {
document.getElementById('text').innerText = 'Internal server error'
button.innerText = 'Submit'
}
try {
rawResponse.json()
.then((resp) => {
HandleFeedbackResp(resp)
})
} catch (e) {
document.getElementById('text').innerText = 'Invalid data recieved from server'
button.innerText = 'Submit'
console.log(e)
}
}
function ShowFeedback () {
const form = document.getElementById('form').style.display = "none";
const feedback = document.getElementById('feedback').style.display = "block";
document.getElementById('text').innerText = 'Jelszót meglévő felhasználóktól lehet kérni! (nem itt)'
}
function HandleResp (resp) { function HandleResp (resp) {
const button = document.getElementById('sendButton') const button = document.getElementById('sendButton')
button.innerText = 'Login' button.innerText = 'Login'

@ -1 +1 @@
Subproject commit 73c1cb76f096b728d156d8d50b06c80b99049cac Subproject commit 00ceb74ba763ebbca1a3edc8f0fc682e59f214a3