Files
drop.i2p/templates/admin.html
2025-06-24 16:22:48 -05:00

149 lines
8.1 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 Dashboard - I2P Secure Share</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/tailwind.css') }}">
<link rel="icon" href="{{ url_for('static', filename='favicon.ico') }}" type="image/x-icon">
<style>
body { background-color: #1a202c; color: #cbd5e0; }
.content-container { background-color: #2d3748; border: 1px solid #4a5568; }
.btn { background-color: #4299e1; transition: background-color 0.3s ease; }
.btn:hover { background-color: #3182ce; }
.btn-danger { background-color: #e53e3e; }
.btn-danger:hover { background-color: #c53030; }
input { background-color: #4a5568; border: 1px solid #718096; }
table { width: 100%; border-collapse: collapse; }
th, td { border: 1px solid #4a5568; padding: 0.75rem; text-align: left; }
th { background-color: #1a202c; }
tr:nth-child(even) { background-color: #2d3748; }
.alert-error { background-color: #e53e3e; }
.announcement-bar { background-color: #2563eb; border-bottom: 1px solid #1e3a8a; }
</style>
</head>
<body class="font-sans">
{% if announcement_enabled and announcement_message %}
<div id="announcement-bar" class="announcement-bar text-white text-center p-2 relative shadow-lg">
<span>{{ announcement_message }}</span>
<button id="close-announcement" class="absolute top-0 right-0 mt-2 mr-4 text-white hover:text-gray-200 text-2xl leading-none">&times;</button>
</div>
{% endif %}
<div class="flex items-center justify-center min-h-screen py-8">
<a href="/" class="inline-block mb-4">
<img src="/static/images/stormycloud.svg" alt="StormyCloud Logo" style="width:350px; max-width:100%;" class="mx-auto"/>
</a>
<h1 class="text-4xl font-bold text-white">Admin Dashboard</h1>
</header>
<main class="content-container rounded-lg p-8 shadow-lg">
{% if auth_success %}
<h2 class="text-2xl font-semibold text-white mb-6">Active Images</h2>
{% if images %}
<div class="overflow-x-auto">
<table>
<thead>
<tr>
<th>Filename</th>
<th>Expires On (UTC)</th>
<th>Time Left</th>
<th>Action</th>
</tr>
</thead>
<tbody>
{% for image in images %}
<tr>
<td class="font-mono text-sm break-all">{{ image[0] }}</td>
<td class="font-mono text-sm">{{ image[1] }}</td>
<td class="font-mono text-sm">{{ image[2] }}</td>
<td>
<form action="{{ url_for('delete_image', filename=image[0]) }}" method="POST" onsubmit="return confirm('Are you sure you want to delete this image?');">
<button type="submit" class="btn-danger text-white font-bold py-1 px-3 rounded text-sm">Delete</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<p class="text-gray-400">No active images.</p>
{% endif %}
<h2 class="text-2xl font-semibold text-white mt-12 mb-6">Active Pastes</h2>
{% if pastes %}
<div class="overflow-x-auto">
<table>
<thead>
<tr>
<th>ID</th>
<th>Language</th>
<th>Expires On (UTC)</th>
<th>Time Left</th>
<th>Action</th>
</tr>
</thead>
<tbody>
{% for paste in pastes %}
<tr>
<td class="font-mono text-sm break-all">{{ paste[0] }}</td>
<td class="font-mono text-sm">{{ paste[1] }}</td>
<td class="font-mono text-sm">{{ paste[2] }}</td>
<td class="font-mono text-sm">{{ paste[3] }}</td>
<td>
<form action="{{ url_for('delete_paste', paste_id=paste[0]) }}" method="POST" onsubmit="return confirm('Are you sure you want to delete this paste?');">
<button type="submit" class="btn-danger text-white font-bold py-1 px-3 rounded text-sm">Delete</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<p class="text-gray-400">No active pastes.</p>
{% endif %}
{% else %}
<h2 class="text-2xl font-semibold text-white mb-6">Admin Login</h2>
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
<div class="mb-4">
{% for category, message in messages %}
<div class="alert-{{ category }} text-white p-3 rounded-md shadow-lg" role="alert">
{{ message }}
</div>
{% endfor %}
</div>
{% endif %}
{% endwith %}
<form method="POST" action="{{ url_for('admin_dashboard') }}">
<div class="mb-6">
<label for="password" class="block text-gray-300 text-sm font-bold mb-2">Password:</label>
<input type="password" name="password" id="password" class="w-full p-2 rounded-md text-white focus:outline-none focus:ring-2 focus:ring-blue-500" required>
</div>
<div><button type="submit" class="btn w-full text-white font-bold py-3 px-5 rounded-md focus:shadow-outline">Login</button></div>
</form>
{% endif %}
<div class="text-center mt-8 border-t border-gray-700 pt-6">
<a href="{{ url_for('index') }}" class="text-blue-400 hover:text-blue-300">Back to Homepage</a>
</div>
</main>
<footer class="text-center text-gray-500 mt-16 border-t border-gray-700 pt-8 pb-8">
<a href="http://stormycloud.i2p" class="hover:text-gray-400">StormyCloud</a>
</footer>
</div>
</div>
<script>
const announcementBar = document.getElementById('announcement-bar');
const closeButton = document.getElementById('close-announcement');
if (closeButton) {
closeButton.addEventListener('click', () => {
announcementBar.style.display = 'none';
});
}
</script>
</body>
</html>