mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Exit signal handling polish, login page info added
This commit is contained in:
parent
4f030ad27c
commit
88d487568c
6 changed files with 21 additions and 69 deletions
|
@ -7,7 +7,7 @@
|
|||
<style>
|
||||
|
||||
.center {
|
||||
width: 340px;
|
||||
width: 380px;
|
||||
height: 340px;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
|
@ -17,7 +17,7 @@
|
|||
margin: auto;
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
overflow: auto;
|
||||
overflow: none;
|
||||
|
||||
text-align: center;
|
||||
}
|
||||
|
@ -88,73 +88,26 @@
|
|||
Frylabs
|
||||
</div>
|
||||
<div id='text' class='text'>
|
||||
</div>
|
||||
<div id='feedback'>
|
||||
<textarea placeholder='Feedback' id='feedbackTextArea'></textarea>
|
||||
<div class='ircLinkContainer' >
|
||||
<a class='ircLink' href='https://qmining.frylabs.net/irc?loginClick'>IRC</a>
|
||||
</div>
|
||||
<button id='sendFeedbackButton' onclick="SendFeedback(this)">Submit</button>
|
||||
Ha régi felhasználó vagy akkori <a
|
||||
href='https://greasyfork.org/en/scripts/38999-moodle-elearning-kmooc-test-help')>frissítsd
|
||||
a scriptet 2.0.1.*-ra</a>, és automatikusan kapsz jelszót. Bármi nem megy: <a
|
||||
href='https://qmining.frylabs.net/irc?loginClick'>IRC</a>
|
||||
</div>
|
||||
<div id='form'>
|
||||
<div class='inputContainer'>
|
||||
<input type='password' id='pw' name='pw' autocomplete="off"/>
|
||||
<input type='text' id='pw' name='pw' autocomplete="off"/>
|
||||
<input type='hidden' id='cid' name='pw' autocomplete="off"/>
|
||||
</div>
|
||||
<div class='ircLinkContainer' >
|
||||
<a class='ircLink' onclick='ShowFeedback()'>Contact</a>
|
||||
<a class='ircLink' href='https://qmining.frylabs.net/irc?loginClick'>IRC</a>
|
||||
</div>
|
||||
<button id='sendButton' onclick="Login(this)">Submit</button>
|
||||
<button id='sendButton' onclick="Login(this)">Login</button>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script>
|
||||
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
|
||||
button.innerText = '...'
|
||||
const rawResponse = await fetch('https://api.frylabs.net/postfeedback', {
|
||||
method: 'POST',
|
||||
credentials: 'include',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
description: feedback,
|
||||
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";
|
||||
}
|
||||
function HandleResp (resp) {
|
||||
document.getElementById('sendButton').innerText = 'Submit'
|
||||
document.getElementById('sendButton').innerText = 'Login'
|
||||
const textNode = document.getElementById('text')
|
||||
if (resp.result === 'success') {
|
||||
location.reload()
|
||||
|
@ -173,12 +126,13 @@
|
|||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
pw: document.getElementById('pw').value
|
||||
pw: document.getElementById('pw').value,
|
||||
cid: document.getElementById('cid').value
|
||||
})
|
||||
})
|
||||
if (!rawResponse.ok) {
|
||||
document.getElementById('text').innerText = 'Internal server error'
|
||||
button.innerText = 'Submit'
|
||||
button.innerText = 'Login'
|
||||
}
|
||||
try {
|
||||
rawResponse.json()
|
||||
|
@ -187,7 +141,7 @@
|
|||
})
|
||||
} catch (e) {
|
||||
document.getElementById('text').innerText = 'Invalid data recieved from server'
|
||||
button.innerText = 'Submit'
|
||||
button.innerText = 'Login'
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue