feat(oort): add secure share links, media preview/code editor, static site hosting, event webhooks, batch ops, category filters, and storage breakdown donut chart

This commit is contained in:
2026-10-14 15:32:57 +05:30
parent 817b506ca3
commit 1d8a836e50
4 changed files with 2263 additions and 115 deletions
+358
View File
@@ -0,0 +1,358 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{if .FileName}}{{.FileName}} — Cosmos Oort Share{{else}}Cosmos Oort Share{{end}}</title>
<link rel="icon" href='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><circle cx="16" cy="16" r="6" fill="%23eef3f8"/><ellipse cx="16" cy="16" rx="14" ry="5.5" fill="none" stroke="%238fd9ff" stroke-width="1.5" transform="rotate(-24 16 16)"/></svg>'>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Space+Grotesk:wght@400;500;600;700&display=swap" rel="stylesheet">
<style>
:root {
--bg: #030712;
--card-bg: rgba(15, 23, 42, 0.75);
--border: rgba(148, 163, 184, 0.15);
--border-glow: rgba(56, 189, 248, 0.3);
--accent: #38bdf8;
--accent-glow: rgba(56, 189, 248, 0.2);
--text: #f8fafc;
--text-muted: #94a3b8;
--text-dim: #64748b;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
background-color: var(--bg);
color: var(--text);
font-family: 'Space Grotesk', sans-serif;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 24px;
overflow-x: hidden;
position: relative;
}
#stars {
position: fixed;
inset: 0;
pointer-events: none;
z-index: 0;
}
.nebula {
position: fixed;
width: 600px;
height: 600px;
border-radius: 50%;
background: radial-gradient(circle, rgba(56, 189, 248, 0.08) 0%, rgba(99, 102, 241, 0.05) 40%, transparent 70%);
filter: blur(60px);
pointer-events: none;
z-index: 0;
}
.share-card {
position: relative;
z-index: 10;
width: 100%;
max-width: 480px;
background: var(--card-bg);
border: 1px solid var(--border);
backdrop-filter: blur(20px);
border-radius: 20px;
padding: 36px 32px;
box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 40px rgba(56, 189, 248, 0.08);
animation: floatUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes floatUp {
from { opacity: 0; transform: translateY(20px); }
to { opacity: 1; transform: translateY(0); }
}
.brand {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 28px;
}
.brand-icon {
width: 36px;
height: 36px;
background: rgba(56, 189, 248, 0.1);
border: 1px solid rgba(56, 189, 248, 0.3);
border-radius: 10px;
display: flex;
align-items: center;
justify-content: center;
}
.brand-name {
font-weight: 700;
font-size: 16px;
letter-spacing: 0.08em;
color: #fff;
}
.brand-pill {
font-family: 'JetBrains Mono', monospace;
font-size: 10px;
padding: 2px 8px;
border-radius: 999px;
background: rgba(56, 189, 248, 0.12);
color: var(--accent);
border: 1px solid rgba(56, 189, 248, 0.25);
}
.file-box {
background: rgba(0, 0, 0, 0.3);
border: 1px solid var(--border);
border-radius: 14px;
padding: 20px;
margin-bottom: 24px;
display: flex;
align-items: center;
gap: 16px;
}
.file-icon {
width: 48px;
height: 48px;
border-radius: 12px;
background: rgba(99, 102, 241, 0.15);
border: 1px solid rgba(99, 102, 241, 0.3);
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
color: #818cf8;
}
.file-details {
min-width: 0;
flex: 1;
}
.file-name {
font-size: 15px;
font-weight: 600;
color: #fff;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
margin-bottom: 4px;
}
.file-meta {
font-family: 'JetBrains Mono', monospace;
font-size: 12px;
color: var(--text-muted);
display: flex;
gap: 12px;
}
.meta-item {
display: flex;
align-items: center;
gap: 4px;
}
.stats-row {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 12px;
margin-bottom: 24px;
}
.stat-pill {
background: rgba(255, 255, 255, 0.03);
border: 1px solid rgba(255, 255, 255, 0.06);
padding: 12px;
border-radius: 10px;
}
.stat-label {
font-size: 11px;
color: var(--text-dim);
text-transform: uppercase;
letter-spacing: 0.08em;
margin-bottom: 4px;
}
.stat-val {
font-family: 'JetBrains Mono', monospace;
font-size: 13px;
font-weight: 500;
color: var(--text);
}
.btn-download {
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
width: 100%;
padding: 14px 20px;
background: linear-gradient(135deg, #38bdf8 0%, #6366f1 100%);
color: #fff;
text-decoration: none;
border: none;
border-radius: 12px;
font-weight: 600;
font-size: 15px;
cursor: pointer;
transition: all 0.2s ease;
box-shadow: 0 4px 20px rgba(56, 189, 248, 0.25);
}
.btn-download:hover {
transform: translateY(-2px);
box-shadow: 0 8px 30px rgba(56, 189, 248, 0.4);
}
.input-pass {
width: 100%;
padding: 13px 16px;
background: rgba(0, 0, 0, 0.35);
border: 1px solid var(--border);
border-radius: 10px;
color: #fff;
font-family: inherit;
font-size: 14px;
outline: none;
margin-bottom: 16px;
transition: border-color 0.2s;
}
.input-pass:focus {
border-color: var(--accent);
box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}
.error-msg {
background: rgba(239, 68, 68, 0.1);
border: 1px solid rgba(239, 68, 68, 0.3);
color: #f87171;
padding: 10px 14px;
border-radius: 8px;
font-size: 13px;
margin-bottom: 16px;
}
.footer {
position: relative;
z-index: 10;
margin-top: 24px;
font-size: 12px;
color: var(--text-dim);
text-align: center;
}
</style>
</head>
<body>
<div class="nebula"></div>
<canvas id="stars"></canvas>
<div class="share-card">
<div class="brand">
<div class="brand-icon">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#38bdf8" stroke-width="2">
<circle cx="12" cy="12" r="10"/>
<line x1="2" y1="12" x2="22" y2="12"/>
<path d="M12 2a15.3 15.3 0 014 10 15.3 15.3 0 01-4 10 15.3 15.3 0 01-4-10 15.3 15.3 0 014-10z"/>
</svg>
</div>
<div>
<div class="brand-name">COSMOS OORT</div>
</div>
<span class="brand-pill">SECURE SHARE</span>
</div>
{{if .Error}}
<div class="error-msg">{{.Error}}</div>
{{end}}
{{if .Expired}}
<div style="text-align:center; padding: 24px 0;">
<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="#f87171" stroke-width="1.5" style="margin-bottom:12px">
<circle cx="12" cy="12" r="10"/>
<line x1="12" y1="8" x2="12" y2="12"/>
<line x1="12" y1="16" x2="12.01" y2="16"/>
</svg>
<h2 style="font-size:18px; margin-bottom:8px; color:#fff">Share Link Inactive</h2>
<p style="font-size:13px; color:var(--text-muted)">This link has expired, exceeded its download quota, or has been revoked by the owner.</p>
</div>
{{else}}
<div class="file-box">
<div class="file-icon">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"/>
<polyline points="14 2 14 8 20 8"/>
<line x1="12" y1="18" x2="12" y2="12"/>
<line x1="9" y1="15" x2="15" y2="15"/>
</svg>
</div>
<div class="file-details">
<div class="file-name" title="{{.FileName}}">{{.FileName}}</div>
<div class="file-meta">
<span class="meta-item">{{.FileSize}}</span>
{{if .ContentType}}<span class="meta-item">• {{.ContentType}}</span>{{end}}
</div>
</div>
</div>
<div class="stats-row">
<div class="stat-pill">
<div class="stat-label">Expires In</div>
<div class="stat-val" style="color:#38bdf8">{{.ExpiresIn}}</div>
</div>
<div class="stat-pill">
<div class="stat-label">Downloads</div>
<div class="stat-val">{{.DownloadsRemaining}}</div>
</div>
</div>
{{if .RequiresPassword}}
<form method="POST" action="/s/{{.Token}}">
<div style="font-size:13px; color:var(--text-muted); margin-bottom:8px">This file is password-protected. Enter password to unlock:</div>
<input type="password" name="password" class="input-pass" placeholder="Enter file passphrase" required autofocus />
<button type="submit" class="btn-download">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="3" y="11" width="18" height="11" rx="2" ry="2"/>
<path d="M7 11V7a5 5 0 0110 0v4"/>
</svg>
Unlock &amp; Download
</button>
</form>
{{else}}
<a href="{{.DownloadURL}}" class="btn-download">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"/>
<polyline points="7 10 12 15 17 10"/>
<line x1="12" y1="15" x2="12" y2="3"/>
</svg>
Download File
</a>
{{end}}
{{end}}
</div>
<div class="footer">
Powered by <strong>Cosmos Oort</strong> · Sovereign Cloud Workstation
</div>
<script>
// Particle canvas background
const canvas = document.getElementById('stars');
const ctx = canvas.getContext('2d');
let W, H, stars = [];
function resize() {
W = canvas.width = window.innerWidth;
H = canvas.height = window.innerHeight;
stars = Array.from({length: 60}, () => ({
x: Math.random() * W,
y: Math.random() * H,
r: Math.random() * 1.5 + 0.5,
alpha: Math.random() * 0.8 + 0.2,
speed: Math.random() * 0.02 + 0.005
}));
}
window.addEventListener('resize', resize);
resize();
function anim() {
ctx.clearRect(0, 0, W, H);
stars.forEach(s => {
s.alpha += s.speed;
if(s.alpha > 1 || s.alpha < 0.2) s.speed = -s.speed;
ctx.fillStyle = `rgba(255, 255, 255, ${s.alpha})`;
ctx.beginPath();
ctx.arc(s.x, s.y, s.r, 0, Math.PI * 2);
ctx.fill();
});
requestAnimationFrame(anim);
}
anim();
</script>
</body>
</html>