add view page
This commit is contained in:
132
templates/complete.html
Normal file
132
templates/complete.html
Normal file
@@ -0,0 +1,132 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Send.it - File Ready</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
|
||||
|
||||
<style>
|
||||
/* No-design brutalist style */
|
||||
* {
|
||||
border-radius: 0 !important;
|
||||
transition: none !important;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
background: #fff;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.box {
|
||||
border: 2px solid #000;
|
||||
padding: 20px;
|
||||
background: #fff;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.input-text {
|
||||
border: 1px solid #000;
|
||||
padding: 4px 8px;
|
||||
background: #fff;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
button {
|
||||
border: 2px solid #000;
|
||||
background: #eee;
|
||||
padding: 4px 12px;
|
||||
font-weight: bold;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background: #ccc;
|
||||
}
|
||||
|
||||
button:active {
|
||||
background: #000;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body class="min-h-screen flex items-center justify-center p-4">
|
||||
|
||||
<div class="w-full max-w-[493px] flex flex-col items-center">
|
||||
|
||||
<img src="/static/logo.png" alt="Send.it logo" style="width:50%;" class="mb-2 border-black">
|
||||
|
||||
<div class="box">
|
||||
|
||||
<header class="mb-6 border-b-2 border-black pb-2 text-center">
|
||||
<h1 class="text-xl font-bold uppercase">FILE READY</h1>
|
||||
</header>
|
||||
|
||||
<div class="space-y-4">
|
||||
|
||||
<div class="bg-black text-white p-2 text-xs font-bold">
|
||||
UPLOAD COMPLETE
|
||||
</div>
|
||||
|
||||
<!-- <!– File info –>-->
|
||||
<!-- <div class="text-[10px] uppercase font-bold">-->
|
||||
<!-- example_file.png (2.4 MB)-->
|
||||
<!-- </div>-->
|
||||
|
||||
<!-- Download -->
|
||||
<div>
|
||||
<label class="text-[10px] font-bold block">DOWNLOAD LINK</label>
|
||||
<div class="flex">
|
||||
<input id="res-url" readonly class="input-text text-sm">
|
||||
<button onclick="copy('res-url')" class="border-l-0">COPY</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Delete -->
|
||||
<div>
|
||||
<label class="text-[10px] font-bold block">DELETION LINK (PRIVATE)</label>
|
||||
<div class="flex">
|
||||
<input id="res-del" readonly class="input-text text-sm text-red-600">
|
||||
<button onclick="copy('res-del')" class="border-l-0">COPY</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Actions -->
|
||||
<div class="pt-4 flex justify-between">
|
||||
<a href="/" class="text-xs underline">NEW UPLOAD</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="mt-1 text-[10px] uppercase font-bold text-gray-400">
|
||||
A service by Brammie15
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function copy(id) {
|
||||
const el = document.getElementById(id);
|
||||
el.select();
|
||||
el.setSelectionRange(0, 99999); // mobile support
|
||||
document.execCommand('copy');
|
||||
}
|
||||
|
||||
const downloadKey = "{{.DownloadID}}";
|
||||
const deleteKey = "{{.DeleteID}}";
|
||||
|
||||
const base = window.location.origin;
|
||||
|
||||
document.getElementById("res-url").value = `${base}/api/files/view/${downloadKey}`;
|
||||
document.getElementById("res-del").value = `${base}/api/files/delete/${deleteKey}`;
|
||||
</script>
|
||||
|
||||
<a href="/admin" class="fixed bottom-1 right-1 text-[10px] underline">SUDO</a>
|
||||
<a href="/static/TOS.txt" class="fixed bottom-1 left-1 text-[10px] underline">TOS</a>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -301,21 +301,15 @@
|
||||
const data = JSON.parse(xhr.responseText);
|
||||
if (data.error) throw new Error(data.error);
|
||||
|
||||
document.getElementById('upload-ui').classList.add('hidden');
|
||||
document.getElementById('success-ui').classList.remove('hidden');
|
||||
// Redirect using view key
|
||||
window.location.href = "/f/" + data.view_key;
|
||||
|
||||
const dlUrl = window.location.origin + "/api/files/download/" + data.id;
|
||||
const delUrl = window.location.origin + "/api/files/delete/" + data.deletion_id;
|
||||
|
||||
document.getElementById('res-url').value = dlUrl;
|
||||
document.getElementById('res-del').value = delUrl;
|
||||
} catch (err) {
|
||||
console.error("JSON Parse Error. Server sent:", xhr.responseText);
|
||||
alert("Server returned an invalid response");
|
||||
console.error("Invalid response:", xhr.responseText);
|
||||
alert("Server error");
|
||||
}
|
||||
} else {
|
||||
console.error("Server Error:", xhr.status, xhr.responseText);
|
||||
alert(`Upload failed with status ${xhr.status}. Check console.`);
|
||||
alert("Upload failed");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user