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/
nextStatic/
publicDirs/
extraModules/
src/extraModules/
duplicateRemovingLog/
src/extraModules
/*.sh

View file

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

View file

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

View file

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

View file

@ -43,20 +43,16 @@
clear: both;
padding-bottom: 23px;
}
.showpwContainer {
color: white;
width: 40px;
cursor: pointer;
}
input[type=text], input[type=password], textarea {
font-size: 16px;
color: white;
background-color: #181a1b;
width: 20%;
width: 300px;;
padding: 12px 20px;
margin: 8px 0;
box-sizing: border-box;
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 {
border: 2px solid #F2CB05;
@ -85,25 +81,6 @@
.disabledButton {
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>
</head>
<div class='logindiv'>
@ -112,22 +89,11 @@
</div>
<div id='text' class='text'>
</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 class='inputContainer'>
<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"/>
</div>
<div class='ircLinkContainer' >
<!--a class='ircLink' onclick='ShowFeedback()'>Contact</a-->
</div>
<button id='sendButton' onclick="Login(this)">Belépés</button>
</div>
</div>
@ -139,53 +105,6 @@
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) {
const button = document.getElementById('sendButton')
button.innerText = 'Login'

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