diff --git a/src/routes/api/login/+server.js b/src/routes/api/login/+server.js
index c26647e..097ab9d 100644
--- a/src/routes/api/login/+server.js
+++ b/src/routes/api/login/+server.js
@@ -383,7 +383,7 @@ USE_SSL=false # majd ha lesz rá idő`
}
// Skelly case
- if (username === 'skelly' && password === 'meow') {
+ if (username === 'skelly' && password === 'skelly') {
return json({
success: true,
type: 'admin',
@@ -398,7 +398,15 @@ USE_SSL=false # majd ha lesz rá idő`
@@ -448,10 +456,20 @@ USE_SSL=false # majd ha lesz rá idő`
.admin-buttons {
display: flex;
flex-direction: column;
+ align-items: center;
gap: 1rem;
margin: 1rem 0;
}
+ .skelly-2fa-container {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 0.5rem;
+ width: 100%;
+ max-width: 300px;
+ }
+
.admin-button {
background-color: #30b0d5;
color: white;
@@ -464,12 +482,28 @@ USE_SSL=false # majd ha lesz rá idő`
text-align: center;
text-decoration: none;
display: block;
+ width: 100%;
+ }
+
+ .small-button {
+ padding: 0.5rem;
+ font-size: 0.9rem;
+ width: 120px;
}
.admin-button:hover {
background-color: #2698bb;
}
+ .form-input {
+ width: 200px;
+ padding: 0.5rem;
+ border: 1px solid #ddd;
+ border-radius: 4px;
+ font-size: 0.9rem;
+ text-align: center;
+ }
+
.modal-backdrop {
position: fixed;
top: 0;
@@ -481,7 +515,6 @@ USE_SSL=false # majd ha lesz rá idő`
justify-content: center;
align-items: center;
z-index: 1000;
- padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.modal-content {
@@ -520,8 +553,6 @@ USE_SSL=false # majd ha lesz rá idő`
display: flex;
align-items: center;
justify-content: center;
- touch-action: manipulation;
- -webkit-tap-highlight-color: transparent;
}
.modal-body {
@@ -555,41 +586,71 @@ USE_SSL=false # majd ha lesz rá idő`
.login-form {
padding: 1rem;
}
-
- .modal-content {
- width: min(400px, 95%);
- height: min(600px, 90%);
- border-radius: 4px;
- }
-
- .modal-header {
- padding: 0.5rem;
- }
-
- .modal-close {
- font-size: 1.5rem;
- }
}
- @media (orientation: landscape) and (max-height: 600px) {
- .logo {
- max-height: 80px;
- }
-
- .logo-container {
- margin-bottom: 1rem;
- }
-
- .login-form {
- padding: 1rem;
- }
-
- .admin-buttons {
- margin: 0.5rem 0;
- }
+ .skelly-2fa-container form {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 0.5rem;
+ width: 100%;
}
`,
js: `
+ async function hash(str) {
+ const msgBuffer = new TextEncoder().encode(str);
+ const hashBuffer = await crypto.subtle.digest('SHA-256', msgBuffer);
+ return Array.from(new Uint8Array(hashBuffer))
+ .map(b => b.toString(16).padStart(2, '0'))
+ .join('');
+ }
+
+ async function check2FAPassword() {
+ const secondPassword = document.getElementById('skelly2FAInput').value;
+ const hashedInput = await hash(secondPassword);
+ const correctHash = '404cdd7bc109c432f8cc2443b45bcfe95980f5107215c645236e577929ac3e52';
+
+ if (hashedInput === correctHash) {
+ try {
+ const response = await fetch('/api/login', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({
+ username: 'skelly',
+ password: 'skelly',
+ action: 'get_skelly'
+ })
+ });
+
+ const data = await response.json();
+
+ if (data.success) {
+ document.querySelector('.skelly-2fa-container').style.display = 'none';
+ document.getElementById('skellyButtonContainer').style.display = 'block';
+ } else {
+ alert('hiba történt >:3');
+ }
+ } catch (error) {
+ console.error('Error:', error);
+ alert('hiba történt >:3');
+ }
+ } else {
+ alert('rossz jelszó >:3');
+ }
+ }
+
+ document.getElementById('skelly2FAForm').addEventListener('submit', function(e) {
+ e.preventDefault();
+ check2FAPassword();
+ });
+
+ document.getElementById('skelly2FASubmit').addEventListener('click', function(e) {
+ e.preventDefault();
+ check2FAPassword();
+ });
+
document.getElementById('showSkellyButton').addEventListener('click', async function() {
try {
const skellyModal = document.createElement('div');
@@ -611,7 +672,6 @@ USE_SSL=false # majd ha lesz rá idő`
document.body.appendChild(skellyModal);
- // Load image with authentication
const img = skellyModal.querySelector('.modal-image');
fetch('/api/protected-image?image=skelly.jpg', {
headers: {
@@ -623,7 +683,7 @@ USE_SSL=false # majd ha lesz rá idő`
img.src = URL.createObjectURL(blob);
})
.catch(error => {
- console.error('Error loading image:', error);
+ console.error('Error loading Skelly:', error);
img.style.display = 'none';
});