Files
ReSendit/templates/admin.html
2026-03-20 14:23:11 +01:00

219 lines
8.4 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admin Console</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
<style>
* { border-radius: 0 !important; }
body { font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', monospace; background: #fff; color: #000; padding: 20px; }
.box { border: 3px solid #000; background: #fff; }
table { width: 100%; border-collapse: collapse; }
th { background: #000; color: #fff; text-align: left; padding: 10px; font-size: 12px; text-transform: uppercase; border: 1px solid #000; }
td { border: 1px solid #000; padding: 10px; font-size: 13px; font-weight: 500; }
tr:hover { background: #ffff00; }
/* Harsh Status Tags */
.status-tag { font-weight: 900; font-size: 11px; padding: 3px 6px; border: 2px solid #000; display: inline-block; text-transform: uppercase; }
.status-deleted { background: #000; color: #ff0000; }
.status-no { background: #eee; color: #666; }
.status-active { background: #00ff00; color: #000; }
.status-yes { background: #ff00ff; color: #fff; }
/* Chunky Buttons */
.btn-group { display: flex; gap: 5px; }
button, .button {
border: 2px solid #000;
background: #fff;
padding: 4px 10px;
cursor: pointer;
font-size: 11px;
font-weight: 900;
text-decoration: none;
text-transform: uppercase;
box-shadow: 3px 3px 0px #000;
}
button:hover, .button:hover { background: #000; color: #fff; box-shadow: none; transform: translate(2px, 2px); }
button:active { background: #ff0000; color: #fff; }
.nav-link { font-weight: 900; text-decoration: underline; text-transform: uppercase; font-size: 12px; }
.nav-link:hover { background: #000; color: #fff; }
/* --- CUSTOM MODAL STYLES --- */
#modal-overlay {
display: none;
position: fixed;
top: 0; left: 0; width: 100%; height: 100%;
background: rgba(255, 255, 255, 0.9);
backdrop-filter: blur(4px);
z-index: 1000;
align-items: center;
justify-content: center;
}
.modal-box {
border: 8px solid #000;
background: #fff;
padding: 30px;
max-width: 480px;
width: 90%;
box-shadow: 20px 20px 0px #000;
}
#modal-confirm-btn:hover {
background: #ff0000;
color: white;
animation: pulse 0.4s infinite;
}
@keyframes pulse {
0% { transform: scale(1); }
50% { transform: scale(1.03); }
100% { transform: scale(1); }
}
</style>
</head>
<body>
<div id="modal-overlay">
<div class="modal-box">
<h2 id="modal-title" class="text-4xl font-black uppercase tracking-tighter mb-4">CONFIRM_WIPE</h2>
<div id="modal-message" class="text-sm font-bold mb-8 border-l-8 border-black pl-4 py-2 italic bg-gray-50">
Awaiting system confirmation for permanent data erasure.
</div>
<div class="flex gap-4">
<button id="modal-confirm-btn" class="flex-1 py-4 text-xl border-4 border-black font-black uppercase bg-yellow-400">EXECUTE</button>
<button onclick="closeModal()" class="flex-1 py-4 text-xl border-4 border-black font-black uppercase hover:bg-black hover:text-white">ABORT</button>
</div>
</div>
</div>
<div class="max-w-7xl mx-auto">
<header class="mb-6 border-b-8 border-black pb-4 flex justify-between items-start">
<div>
<h1 class="text-4xl font-black uppercase tracking-tighter leading-none">System_Admin</h1>
</div>
<div class="flex flex-col items-end gap-2">
<a href="/" class="nav-link">← BACK_TO_UPLOADER</a>
<a href="/logout" class="nav-link text-red-600">LOGOUT_SESSION</a>
</div>
</header>
<div class="box overflow-x-auto">
<table>
<thead>
<tr>
<th>File_Identifier</th>
<th>Size</th>
<th>Timeline (In/Out)</th>
<th>Hits</th>
<th>Burn</th>
<th>Status</th>
<th>System_Actions</th>
</tr>
</thead>
<tbody>
{{if not .Files}}
<tr><td colspan="7" class="text-center py-10 font-bold uppercase italic">Zero files in buffer</td></tr>
{{end}}
{{range .Files}}
<tr>
<td class="font-bold">
<a href="/api/files/admin/download/{{.ID}}" target="_blank" class="underline hover:bg-black hover:text-white">{{.Filename}}</a>
</td>
<td class="whitespace-nowrap italic text-gray-600">{{humanSize .Size}}</td>
<td class="text-[11px] leading-tight">
<span class="block"><strong>CRT:</strong> {{.CreatedAt.Format "02/01/06 15:04"}}</span>
<span class="block text-red-600"><strong>EXP:</strong> {{.ExpiresAt.Format "02/01/06 15:04"}}</span>
</td>
<td class="text-center font-black text-lg">{{.DownloadCount}}</td>
<td>
{{if .DeleteAfterDownload}}
<span class="status-tag status-yes">YES</span>
{{else}}
<span class="status-tag status-no">NO</span>
{{end}}
</td>
<td>
{{if .Deleted}}
<span class="status-tag status-deleted">REMOVED</span>
{{else}}
<span class="status-tag status-active">LIVE</span>
{{end}}
</td>
<td>
<div class="btn-group">
{{if not .Deleted}}
<form action="/api/files/admin/delete/{{.ID}}" method="GET" onsubmit="return openConfirm(event, 'TERMINATE', 'Kill this file? It will be removed from active storage.')">
<button type="submit" style="background: #ffcccc;">Terminate</button>
</form>
{{end}}
<form action="/api/files/admin/delete/fr/{{.ID}}" method="GET" onsubmit="return openConfirm(event, 'FULL_WIPE', 'Wiping file and purging record? This is a permanent database scrub.')">
<button type="submit">Full_Wipe</button>
</form>
</div>
</td>
</tr>
{{end}}
</tbody>
</table>
</div>
<div class="mt-6 flex justify-between items-center border-t-8 border-black pt-4">
<div class="flex gap-4">
{{if gt .Page 1}}
<a href="?page={{sub .Page 1}}" class="button">Prev_Page</a>
{{end}}
{{if lt .Page .TotalPages}}
<a href="?page={{add .Page 1}}" class="button">Next_Page</a>
{{end}}
</div>
<footer class="text-right">
<div class="text-[12px] font-black uppercase">
Data_Density: {{len .Files}} records | Page: {{.Page}}/{{.TotalPages}}
</div>
</footer>
</div>
</div>
<script>
let currentForm = null;
function openConfirm(e, title, msg) {
e.preventDefault(); // Stop form from submitting immediately
currentForm = e.target;
document.getElementById('modal-title').innerText = title;
document.getElementById('modal-message').innerText = msg;
document.getElementById('modal-overlay').style.display = 'flex';
return false;
}
function closeModal() {
document.getElementById('modal-overlay').style.display = 'none';
currentForm = null;
}
document.getElementById('modal-confirm-btn').addEventListener('click', () => {
if (currentForm) {
currentForm.submit();
}
});
// Close if clicking outside the box
window.onclick = function(event) {
const overlay = document.getElementById('modal-overlay');
if (event.target == overlay) closeModal();
}
</script>
</body>
</html>