upload unique links + default upload page + login
This commit is contained in:
131
frontend/invite.html
Normal file
131
frontend/invite.html
Normal file
@@ -0,0 +1,131 @@
|
||||
<!doctype html>
|
||||
<html lang="en" xml:lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Immich Drop Uploader (Invite)</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<script>
|
||||
tailwind.config = { darkMode: 'class' };
|
||||
</script>
|
||||
<style> body { transition: background-color .2s ease, color .2s ease; } </style>
|
||||
<meta name="robots" content="noindex, nofollow" />
|
||||
<meta http-equiv="Cache-Control" content="no-store" />
|
||||
<meta http-equiv="Pragma" content="no-cache" />
|
||||
</head>
|
||||
<body class="min-h-screen bg-gray-50 text-gray-900 dark:bg-gray-900 dark:text-gray-100">
|
||||
<div class="mx-auto max-w-4xl p-6 space-y-6">
|
||||
<div id="topBanner" class="hidden rounded-2xl border border-green-200 bg-green-50 p-3 text-green-700 text-center dark:bg-green-900 dark:border-green-700 dark:text-green-300"></div>
|
||||
|
||||
<header class="flex items-center justify-between">
|
||||
<h1 class="text-2xl font-semibold tracking-tight">Immich Drop Uploader</h1>
|
||||
<div class="flex items-center gap-2">
|
||||
<a id="linkHome" href="/" class="hidden rounded-xl border px-3 py-1 text-sm dark:border-gray-600">Home</a>
|
||||
<button id="btnTheme" class="rounded-xl border px-3 py-1 text-sm dark:border-gray-600" title="Toggle dark mode">
|
||||
<svg id="iconLight" class="w-4 h-4 hidden" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M10 2a1 1 0 011 1v1a1 1 0 11-2 0V3a1 1 0 011-1zm4 8a4 4 0 11-8 0 4 4 0 018 0zm-.464 4.95l.707.707a1 1 0 001.414-1.414l-.707-.707a1 1 0 00-1.414 1.414zm2.12-10.607a1 1 0 010 1.414l-.706.707a1 1 0 11-1.414-1.414l.707-.707a1 1 0 011.414 0zM17 11a1 1 0 100-2h-1a1 1 0 100 2h1zm-7 4a1 1 0 011 1v1a1 1 0 11-2 0v-1a1 1 0 011-1zM5.05 6.464A1 1 0 106.465 5.05l-.708-.707a1 1 0 00-1.414 1.414l.707.707zm1.414 8.486l-.707.707a1 1 0 01-1.414-1.414l.707-.707a1 1 0 011.414 1.414z" clip-rule="evenodd"/>
|
||||
</svg>
|
||||
<svg id="iconDark" class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path d="M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z"/>
|
||||
</svg>
|
||||
</button>
|
||||
<button id="btnPing" class="rounded-xl border px-3 py-1 text-sm dark:border-gray-600">Test connection</button>
|
||||
<span id="pingStatus" class="ml-2 text-sm text-gray-500 dark:text-gray-400"></span>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- Link information -->
|
||||
<section id="linkInfo" class="rounded-2xl border bg-white dark:bg-gray-800 dark:border-gray-700 p-4 text-sm">
|
||||
<div class="flex flex-col md:flex-row md:items-center md:justify-between gap-2">
|
||||
<div>
|
||||
<div><b>Status:</b> <span id="liStatus">Loading…</span></div>
|
||||
<div><b>Album:</b> <span id="liAlbum">—</span></div>
|
||||
</div>
|
||||
<div class="grid grid-cols-2 gap-x-6 gap-y-1">
|
||||
<div><b>Type:</b> <span id="liType">—</span></div>
|
||||
<div><b>Uses left:</b> <span id="liUses">—</span></div>
|
||||
<div><b>Expires:</b> <span id="liExpires">—</span></div>
|
||||
<div><b>Claimed:</b> <span id="liClaimed">—</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Dropzone and queue copied from index.html -->
|
||||
<section id="dropzone" class="rounded-2xl border-2 border-dashed p-10 text-center bg-white dark:bg-gray-800 dark:border-gray-600">
|
||||
<div class="mx-auto h-12 w-12 opacity-70">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M12 16V8m0 0l-3 3m3-3 3 3M4 16a4 4 0 0 0 4 4h8a4 4 0 0 0 4-4v-1a1 1 0 1 0-2 0v1a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2v-1a1 1 0 1 0-2 0v1z"/></svg>
|
||||
</div>
|
||||
<p class="mt-3 font-medium">Drop images or videos here</p>
|
||||
<p class="text-sm text-gray-600 dark:text-gray-400">...or</p>
|
||||
<div class="mt-3 relative inline-block">
|
||||
<label class="rounded-2xl bg-black text-white dark:bg-white dark:text-black px-4 py-2 hover:opacity-90 cursor-pointer select-none">
|
||||
Choose files
|
||||
<input id="fileInput" type="file" multiple accept="image/*,video/*" class="absolute inset-0 opacity-0 cursor-pointer" />
|
||||
</label>
|
||||
</div>
|
||||
<div class="mt-4 text-sm text-gray-500 dark:text-gray-400">
|
||||
Files will be uploaded to the selected album for this invite.
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="summary" class="rounded-2xl border bg-white p-4 shadow-sm dark:bg-gray-800 dark:border-gray-700">
|
||||
<div class="flex items-center justify-between text-sm">
|
||||
<div class="flex gap-4">
|
||||
<span>Queued/Processing: <b id="countQueued">0</b></span>
|
||||
<span>Uploading: <b id="countUploading">0</b></span>
|
||||
<span>Done: <b id="countDone">0</b></span>
|
||||
<span>Duplicates: <b id="countDup">0</b></span>
|
||||
<span>Errors: <b id="countErr">0</b></span>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="items" class="space-y-3"></section>
|
||||
<footer class="pt-4 pb-10 text-center text-xs text-gray-500 dark:text-gray-400">
|
||||
Invite upload page
|
||||
</footer>
|
||||
</div>
|
||||
<script src="/static/header.js"></script>
|
||||
<script src="/static/app.js"></script>
|
||||
</body>
|
||||
<script>
|
||||
// Hide ping and theme controls if referenced by app.js
|
||||
// Standardized header includes ping + theme; no-op guards in app.js
|
||||
// Populate link info section
|
||||
(async function(){
|
||||
try {
|
||||
const parts = (location.pathname || '').split('/').filter(Boolean);
|
||||
const token = parts[1];
|
||||
const r = await fetch(`/api/invite/${token}`);
|
||||
const j = await r.json();
|
||||
const fmt = (s)=> s ? new Date(s).toLocaleString() : '—';
|
||||
document.getElementById('liAlbum').textContent = j.albumName || j.albumId || '—';
|
||||
document.getElementById('liType').textContent = j.oneTime ? 'One-time' : (j.maxUses < 0 ? 'Indefinite' : `Up to ${j.maxUses} uses`);
|
||||
document.getElementById('liUses').textContent = (typeof j.remaining==='number') ? String(j.remaining) : '—';
|
||||
document.getElementById('liExpires').textContent = j.expiresAt ? fmt(j.expiresAt) : 'No expiry';
|
||||
document.getElementById('liClaimed').textContent = j.claimed ? 'Yes' : 'No';
|
||||
document.getElementById('liStatus').textContent = j.active ? 'Active' : 'Inactive';
|
||||
if (!j.active) {
|
||||
// Disable dropzone
|
||||
const dz = document.getElementById('dropzone');
|
||||
const fi = document.getElementById('fileInput');
|
||||
dz.classList.add('opacity-50');
|
||||
fi.disabled = true;
|
||||
const items = document.getElementById('items');
|
||||
items.innerHTML = '<div class="text-sm text-gray-500">This link is not active.</div>';
|
||||
}
|
||||
} catch {}
|
||||
})();
|
||||
// Hook theme/ping
|
||||
(function(){
|
||||
const btnTheme = document.getElementById('btnTheme');
|
||||
const btnPing = document.getElementById('btnPing');
|
||||
const pingStatus = document.getElementById('pingStatus');
|
||||
if (btnTheme) btnTheme.onclick = ()=>{ const isDark = document.documentElement.classList.toggle('dark'); try{ localStorage.setItem('theme', isDark ? 'dark':'light'); }catch{}; const isDarkNow = document.documentElement.classList.contains('dark'); try{ document.getElementById('iconLight').classList.toggle('hidden', !isDarkNow); document.getElementById('iconDark').classList.toggle('hidden', isDarkNow);}catch{} };
|
||||
if (btnPing) btnPing.onclick = async ()=>{
|
||||
pingStatus.textContent = 'checking…';
|
||||
try { const r = await fetch('/api/ping', { method:'POST' }); const j = await r.json(); pingStatus.textContent = j.ok ? 'Connected' : 'No connection'; pingStatus.className = 'ml-2 text-sm ' + (j.ok ? 'text-green-600' : 'text-red-600'); if(j.ok){ let text = `Connected to Immich at ${j.base_url}`; if(j.album_name) text += ` | Uploading to album: "${j.album_name}"`; showBanner(text, 'ok'); } } catch { pingStatus.textContent = 'No connection'; pingStatus.className='ml-2 text-sm text-red-600'; }
|
||||
};
|
||||
})();
|
||||
</script>
|
||||
</html>
|
||||
Reference in New Issue
Block a user