malp/assets/page.erb

193 lines
4.2 KiB
Plaintext

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><%= hostname %> status - MALP</title>
<style>
body {
background: #0f1117;
color: #e2e8f0;
font-family: 'Segoe UI', system-ui, sans-serif;
min-height: 100vh;
margin: 0;
padding: 2rem;
display: flex;
flex-direction: column;
align-items: center;
}
header {
width: 100%;
max-width: 400px;
text-align: center;
margin-bottom: 2rem;
padding-bottom: 1rem;
border-bottom: 1px solid #1e2433;
}
header h1 {
font-size: 1.4rem;
font-weight: 600;
letter-spacing: 0.05em;
color: #94a3b8;
text-transform: uppercase;
}
header h1 span { color: #e2e8f0; }
.card {
background: #161b27;
border-radius: 12px;
padding: 2rem;
border: 1px solid #1e2433;
width: 100%;
max-width: 400px;
box-sizing: border-box;
}
.card-title {
font-size: 0.8rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.06em;
color: #94a3b8;
margin-bottom: 1.5rem;
text-align: center;
}
.form-group {
margin-bottom: 1rem;
}
label {
display: block;
font-size: 0.75rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.05em;
color: #475569;
margin-bottom: 0.4rem;
}
input[type="text"],
input[type="password"] {
width: 100%;
box-sizing: border-box;
padding: 0.6rem 0.8rem;
background: #0f1117;
border: 1px solid #1e2433;
border-radius: 7px;
color: #e2e8f0;
font-family: inherit;
font-size: 0.9rem;
outline: none;
transition: border-color 0.2s;
}
input[type="text"]:focus,
input[type="password"]:focus {
border-color: #4ade80;
}
button {
width: 100%;
padding: 0.65rem;
margin-top: 0.5rem;
background: #14532d;
color: #4ade80;
border: none;
border-radius: 7px;
font-family: inherit;
font-size: 0.8rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.06em;
cursor: pointer;
transition: background 0.2s;
}
button:hover {
background: #166534;
}
.logout-form {
position: fixed;
top: 1rem;
right: 1rem;
}
.logout-btn {
width: auto;
padding: 0.4rem 0.8rem;
margin: 0;
background: #1e2433;
color: #94a3b8;
font-size: 0.75rem;
}
.logout-btn:hover {
background: #2a3040;
}
.spinner {
width: 24px;
height: 24px;
margin: 1rem auto;
border: 3px solid #1e2433;
border-top-color: #4ade80;
border-radius: 50%;
animation: spin 0.8s linear infinite;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
</style>
</head>
<body>
<% if authenticated %>
<form method="post" class="logout-form">
<input type="hidden" name="action" value="logout">
<button type="submit" class="logout-btn">Log Out</button>
</form>
<% end %>
<header>
<h1><span><%= hostname %></span> status - MALP</h1>
</header>
<% if authenticated %>
<div id="content"><div class="spinner"></div></div>
<script>
fetch("?content", { credentials: "same-origin" })
.then(function(response) {
if (response.ok) return response.text();
})
.then(function(html) {
if (html) document.getElementById("content").innerHTML = html;
});
</script>
<% end %>
<% unless authenticated %>
<div class="card">
<div class="card-title">Sign In</div>
<form method="post">
<div class="form-group">
<label for="username">Username</label>
<input type="text" id="username" name="username" autocomplete="username" required autofocus>
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" id="password" name="password" autocomplete="current-password" required>
</div>
<button type="submit">Log In</button>
</form>
</div>
<% end %>
</body>
</html>