Files
overlord/Overlord-Server/public/file-share.html
T
2026-04-08 10:33:22 -05:00

174 lines
10 KiB
HTML

<!doctype html>
<html lang="en" class="dark">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>File Share - Overlord</title>
<link rel="icon" type="image/x-icon" href="/assets/favicon.ico" />
<link rel="stylesheet" href="/assets/tailwind.css" />
<link rel="stylesheet" href="/assets/main.css" />
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css"
crossorigin="anonymous"
referrerpolicy="no-referrer"
/>
<script src="/assets/toast.js"></script>
<script src="/assets/ripple.js"></script>
</head>
<body class="min-h-screen bg-slate-950 text-slate-100">
<header id="top-nav"></header>
<main class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
<div class="flex items-center justify-between mb-6">
<h1 class="text-2xl font-bold text-slate-100">
<i class="fa-solid fa-share-nodes text-rose-400 mr-2"></i>File Share
</h1>
</div>
<!-- Upload Section (hidden until user info loaded) -->
<div id="upload-section" class="hidden mb-8">
<div class="bg-slate-900/60 border border-slate-800 rounded-xl p-6">
<h2 class="text-lg font-semibold text-slate-200 mb-4">
<i class="fa-solid fa-cloud-arrow-up text-teal-400 mr-2"></i>Upload File
</h2>
<form id="upload-form" class="space-y-4">
<div>
<label class="block text-sm font-medium text-slate-300 mb-1">File</label>
<input type="file" id="upload-file" required
class="block w-full text-sm text-slate-300 file:mr-4 file:py-2 file:px-4 file:rounded-lg file:border-0 file:text-sm file:font-medium file:bg-slate-800 file:text-slate-200 hover:file:bg-slate-700 cursor-pointer" />
</div>
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
<div>
<div class="flex items-center gap-1.5 mb-1">
<label class="block text-sm font-medium text-slate-300">Password (optional)</label>
<button type="button" id="password-info-btn"
class="inline-flex items-center justify-center w-5 h-5 rounded-full bg-slate-700 hover:bg-slate-600 text-slate-400 hover:text-slate-200 text-xs transition-colors"
title="How to download with a password">
<i class="fa-solid fa-question"></i>
</button>
</div>
<input type="password" id="upload-password" placeholder="Leave empty for no password"
class="w-full px-3 py-2 bg-slate-800 border border-slate-700 rounded-lg text-slate-200 text-sm focus:outline-none focus:ring-2 focus:ring-rose-500/50" />
<div id="password-info-panel" class="hidden mt-2 p-3 bg-slate-800/80 border border-slate-700 rounded-lg text-xs text-slate-400">
<p class="mb-1.5 text-slate-300 font-medium">Downloading password-protected files:</p>
<p class="mb-1">Use the <code class="px-1 py-0.5 bg-slate-900 rounded text-rose-300">X-Download-Password</code> header:</p>
<pre class="mt-1 mb-2 p-2 bg-slate-900 rounded text-emerald-300 overflow-x-auto select-all">curl -H "X-Download-Password: yourpass" https://host/api/file-share/&lt;id&gt;/download -o file.ext</pre>
<p class="mb-1">Or pass it as a query parameter:</p>
<pre class="mt-1 p-2 bg-slate-900 rounded text-emerald-300 overflow-x-auto select-all">curl "https://host/api/file-share/&lt;id&gt;/download?password=yourpass" -o file.ext</pre>
</div>
</div>
<div>
<label class="block text-sm font-medium text-slate-300 mb-1">Max Downloads</label>
<div class="flex items-center gap-2">
<input type="number" id="upload-max-downloads" min="1" placeholder="Unlimited"
class="flex-1 px-3 py-2 bg-slate-800 border border-slate-700 rounded-lg text-slate-200 text-sm focus:outline-none focus:ring-2 focus:ring-rose-500/50" />
<label class="flex items-center gap-1.5 text-sm text-slate-400 whitespace-nowrap">
<input type="checkbox" id="upload-infinite" checked
class="w-4 h-4 rounded accent-rose-500" />
<span>∞</span>
</label>
</div>
</div>
<div>
<label class="block text-sm font-medium text-slate-300 mb-1">Expiry Date (optional)</label>
<input type="datetime-local" id="upload-expiry"
class="w-full px-3 py-2 bg-slate-800 border border-slate-700 rounded-lg text-slate-200 text-sm focus:outline-none focus:ring-2 focus:ring-rose-500/50" />
</div>
</div>
<div>
<label class="block text-sm font-medium text-slate-300 mb-1">Description (optional)</label>
<input type="text" id="upload-description" placeholder="Short note about this file"
class="w-full px-3 py-2 bg-slate-800 border border-slate-700 rounded-lg text-slate-200 text-sm focus:outline-none focus:ring-2 focus:ring-rose-500/50" />
</div>
<button type="submit" id="upload-btn"
class="inline-flex items-center gap-2 px-5 py-2.5 rounded-lg bg-rose-600 hover:bg-rose-500 text-white font-medium text-sm transition-colors">
<i class="fa-solid fa-upload"></i> Upload
</button>
</form>
</div>
</div>
<!-- File List -->
<div class="bg-slate-900/60 border border-slate-800 rounded-xl overflow-hidden">
<div class="overflow-x-auto">
<table class="w-full text-sm">
<thead>
<tr class="border-b border-slate-800 bg-slate-900/80">
<th class="px-6 py-3 text-left text-xs font-medium text-slate-400 uppercase tracking-wider">File</th>
<th class="px-6 py-3 text-left text-xs font-medium text-slate-400 uppercase tracking-wider">Size</th>
<th class="px-6 py-3 text-left text-xs font-medium text-slate-400 uppercase tracking-wider">Uploader</th>
<th class="px-6 py-3 text-left text-xs font-medium text-slate-400 uppercase tracking-wider">Downloads</th>
<th class="px-6 py-3 text-left text-xs font-medium text-slate-400 uppercase tracking-wider">Status</th>
<th class="px-6 py-3 text-left text-xs font-medium text-slate-400 uppercase tracking-wider">Uploaded</th>
<th class="px-6 py-3 text-right text-xs font-medium text-slate-400 uppercase tracking-wider">Actions</th>
</tr>
</thead>
<tbody id="file-list" class="divide-y divide-slate-800">
<tr>
<td colspan="7" class="px-6 py-12 text-center text-slate-500">
<i class="fa-solid fa-spinner fa-spin mr-2"></i>Loading...
</td>
</tr>
</tbody>
</table>
</div>
</div>
</main>
<!-- Edit Modal -->
<div id="edit-modal" class="hidden fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm">
<div class="bg-slate-900 border border-slate-700 rounded-2xl shadow-2xl w-full max-w-md mx-4 p-6">
<h3 class="text-lg font-semibold text-slate-100 mb-4">
<i class="fa-solid fa-pen-to-square text-rose-400 mr-2"></i>Edit File Settings
</h3>
<input type="hidden" id="edit-file-id" />
<div class="space-y-4">
<div>
<label class="block text-sm font-medium text-slate-300 mb-1">Password</label>
<input type="password" id="edit-password" placeholder="Leave empty to remove password"
class="w-full px-3 py-2 bg-slate-800 border border-slate-700 rounded-lg text-slate-200 text-sm focus:outline-none focus:ring-2 focus:ring-rose-500/50" />
<p class="text-xs text-slate-500 mt-1">Enter new password or leave blank to remove</p>
</div>
<div>
<label class="block text-sm font-medium text-slate-300 mb-1">Max Downloads</label>
<div class="flex items-center gap-2">
<input type="number" id="edit-max-downloads" min="1" placeholder="Unlimited"
class="flex-1 px-3 py-2 bg-slate-800 border border-slate-700 rounded-lg text-slate-200 text-sm focus:outline-none focus:ring-2 focus:ring-rose-500/50" />
<label class="flex items-center gap-1.5 text-sm text-slate-400 whitespace-nowrap">
<input type="checkbox" id="edit-infinite"
class="w-4 h-4 rounded accent-rose-500" />
<span>∞</span>
</label>
</div>
</div>
<div>
<label class="block text-sm font-medium text-slate-300 mb-1">Expiry Date</label>
<input type="datetime-local" id="edit-expiry"
class="w-full px-3 py-2 bg-slate-800 border border-slate-700 rounded-lg text-slate-200 text-sm focus:outline-none focus:ring-2 focus:ring-rose-500/50" />
<p class="text-xs text-slate-500 mt-1">Clear to remove expiry</p>
</div>
<div>
<label class="block text-sm font-medium text-slate-300 mb-1">Description</label>
<input type="text" id="edit-description"
class="w-full px-3 py-2 bg-slate-800 border border-slate-700 rounded-lg text-slate-200 text-sm focus:outline-none focus:ring-2 focus:ring-rose-500/50" />
</div>
</div>
<div class="flex justify-end gap-3 mt-6">
<button id="edit-cancel"
class="px-4 py-2 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 text-sm transition-colors">
Cancel
</button>
<button id="edit-save"
class="px-4 py-2 rounded-lg bg-rose-600 hover:bg-rose-500 text-white text-sm font-medium transition-colors">
Save Changes
</button>
</div>
</div>
</div>
<script src="/assets/nav.js" type="module"></script>
<script src="/assets/file-share.js" type="module"></script>
</body>
</html>