2025-04-24 18:21:28 +03:00

136 lines
3.1 KiB
Plaintext

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admin Panel</title>
<style>
body {
font-family: 'Arial', sans-serif;
background-color: #1e1e1e;
color: #f1f1f1;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.container {
background-color: #2c2c2c;
border-radius: 15px;
padding: 40px 60px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
width: 100%;
max-width: 500px;
text-align: center;
}
h1 {
font-size: 36px;
color: #f1f1f1;
margin-bottom: 30px;
}
input {
width: 100%;
padding: 12px;
margin: 10px 0;
border-radius: 10px;
border: 1px solid #444;
background-color: #444;
color: #fff;
font-size: 16px;
}
input:focus {
outline: none;
border-color: #777;
}
button {
padding: 12px;
width: 100%;
background-color: #4caf50;
color: #fff;
border: none;
border-radius: 10px;
font-size: 16px;
cursor: pointer;
transition: background-color 0.3s;
}
button:hover {
background-color: #45a049;
}
.message {
font-size: 18px;
color: #ddd;
margin-top: 20px;
}
.message a {
color: #4caf50;
text-decoration: none;
}
.package-list {
margin-top: 20px;
text-align: left;
}
.package-item {
background-color: #333;
padding: 10px;
margin: 5px 0;
border-radius: 8px;
color: #fff;
}
.package-item strong {
color: #4caf50;
}
</style>
</head>
<body>
<div class="container">
<h1>Admin Panel</h1>
<% if (!packages) { %>
<% if (error) { %><p style="color:red;"><%= error %></p><% } %>
<form method="POST" action="/admin">
<input name="password" type="password" placeholder="Password" />
<button type="submit">Login</button>
</form>
<% } else { %>
<form method="POST" action="/update">
<input name="password" type="hidden" value="<%= process.env.ADMIN_PASSWORD %>">
<input name="id" placeholder="Tracking ID" required />
<input name="progress" type="number" placeholder="Progress %" required />
<input name="status" placeholder="Status" required />
<input name="eta" type="date" placeholder="ETA (optional)" />
<button type="submit">Update</button>
</form>
<h3>Packages</h3>
<div class="package-list">
<% packages.forEach(p => { %>
<div class="package-item">
<strong><%= p.id %></strong><br>
<% if (p.updates && p.updates.length > 0) { %>
<%= p.updates[p.updates.length - 1].status %> —
<%= p.updates[p.updates.length - 1].progress %>%<br>
<% } else { %>
<em>No updates yet</em><br>
<% } %>
ETA: <%= p.eta || 'Not set' %>
</div>
<% }) %>
</div>
<% } %>
</div>
</body>
</html>