131 lines
4.6 KiB
Plaintext
131 lines
4.6 KiB
Plaintext
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<title data-text="title">Asteroid Radio - Login</title>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<link rel="icon" type="image/x-icon" href="/asteroid/static/favicon.ico">
|
|
<link rel="icon" type="image/png" sizes="32x32" href="/asteroid/static/favicon-32x32.png">
|
|
<link rel="icon" type="image/png" sizes="16x16" href="/asteroid/static/favicon-16x16.png">
|
|
<link rel="stylesheet" type="text/css" href="/static/asteroid.css">
|
|
<script>
|
|
// Load content via AJAX to prevent audio interruption
|
|
function loadInFrame(link) {
|
|
const url = link.href;
|
|
console.log('Loading via AJAX:', url);
|
|
|
|
// Clear all intervals to prevent old page scripts from running
|
|
const highestId = window.setTimeout(() => {}, 0);
|
|
for (let i = 0; i < highestId; i++) {
|
|
window.clearInterval(i);
|
|
window.clearTimeout(i);
|
|
}
|
|
|
|
fetch(url)
|
|
.then(response => response.text())
|
|
.then(html => {
|
|
document.open();
|
|
document.write(html);
|
|
document.close();
|
|
|
|
// Execute scripts in the new content
|
|
const scripts = document.querySelectorAll('script');
|
|
scripts.forEach(oldScript => {
|
|
const newScript = document.createElement('script');
|
|
if (oldScript.src) {
|
|
newScript.src = oldScript.src;
|
|
} else {
|
|
newScript.textContent = oldScript.textContent;
|
|
}
|
|
oldScript.parentNode.replaceChild(newScript, oldScript);
|
|
});
|
|
|
|
// Re-initialize spectrum analyzer after navigation
|
|
if (window.initializeSpectrumAnalyzer) {
|
|
setTimeout(() => window.initializeSpectrumAnalyzer(), 100);
|
|
}
|
|
|
|
if (window.history && window.history.pushState) {
|
|
window.history.pushState({}, '', url);
|
|
}
|
|
})
|
|
.catch(error => {
|
|
console.error('Failed to load content:', error);
|
|
return true;
|
|
});
|
|
|
|
return false;
|
|
}
|
|
|
|
// Handle form submission via AJAX
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
const form = document.querySelector('form');
|
|
if (form) {
|
|
form.addEventListener('submit', function(e) {
|
|
e.preventDefault();
|
|
|
|
const formData = new FormData(form);
|
|
console.log('Submitting login via AJAX');
|
|
|
|
fetch(form.action, {
|
|
method: 'POST',
|
|
body: formData,
|
|
redirect: 'follow' // Follow redirects automatically
|
|
})
|
|
.then(response => {
|
|
console.log('Login response URL:', response.url);
|
|
return response.text();
|
|
})
|
|
.then(html => {
|
|
// Replace document content with response
|
|
document.open();
|
|
document.write(html);
|
|
document.close();
|
|
})
|
|
.catch(error => {
|
|
console.error('Login submission failed:', error);
|
|
});
|
|
});
|
|
}
|
|
});
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<header>
|
|
<h1 style="display: flex; align-items: center; justify-content: center; gap: 15px;">
|
|
<img src="/asteroid/static/asteroid.png" alt="Asteroid" style="height: 50px; width: auto;">
|
|
<span>ASTEROID RADIO - LOGIN</span>
|
|
</h1>
|
|
<nav class="nav">
|
|
<a href="/asteroid/content" target="content-frame" onclick="return loadInFrame(this)">Home</a>
|
|
<a href="/asteroid/status-content" target="content-frame" onclick="return loadInFrame(this)">Status</a>
|
|
<a href="/asteroid/register-content" target="content-frame" onclick="return loadInFrame(this)">Register</a>
|
|
</nav>
|
|
</header>
|
|
|
|
<div class="auth-container">
|
|
<div class="auth-form">
|
|
<h2>System Access</h2>
|
|
<div class="message error" lquery="(attr :style display-error)" style="display: none;">
|
|
<span data-text="error-message" lquery="(text error-message)">Invalid username or password</span>
|
|
</div>
|
|
<form method="post" action="/asteroid/login-content">
|
|
<div class="form-group">
|
|
<label>Username:</label>
|
|
<input type="text" name="username" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Password:</label>
|
|
<input type="password" name="password" required>
|
|
</div>
|
|
<div class="form-actions">
|
|
<button type="submit" class="btn btn-primary" style="width: 100%;">LOGIN</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|