update colorsceheme, allow anonymous 50mb uploads
This commit is contained in:
1 parent
95391d404b
commit
f7c0310c91
4 files changed
+210
-114
No files matched your search
@@ -3,8 +3,8 @@
|
||||
@tailwind utilities;
|
||||
|
||||
:root {
|
||||
--background: #313338;
|
||||
--foreground: #f2f3f5;
|
||||
--background: #282828;
|
||||
--foreground: #ebdbb2;
|
||||
}
|
||||
|
||||
* {
|
||||
@@ -19,8 +19,8 @@ body {
|
||||
}
|
||||
|
||||
::selection {
|
||||
background: rgba(88, 101, 242, 0.3);
|
||||
color: #f2f3f5;
|
||||
background: rgba(215, 153, 33, 0.3);
|
||||
color: #ebdbb2;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar {
|
||||
@@ -28,14 +28,14 @@ body {
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
background: #2b2d31;
|
||||
background: #1d2021;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
background: #504945;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb:hover {
|
||||
background: rgba(255, 255, 255, 0.18);
|
||||
background: #665c54;
|
||||
}
|
||||
+185
-99
@@ -11,10 +11,10 @@ import {
|
||||
} from "lucide-react";
|
||||
import { ChangeEvent, DragEvent, useCallback, useRef, useState } from "react";
|
||||
|
||||
type Status = "locked" | "unlocked" | "uploading" | "done";
|
||||
type Status = "idle" | "authenticated" | "uploading" | "done";
|
||||
|
||||
export default function Home() {
|
||||
const [status, setStatus] = useState<Status>("locked");
|
||||
const [status, setStatus] = useState<Status>("idle");
|
||||
const [password, setPassword] = useState("");
|
||||
const [passwordError, setPasswordError] = useState(false);
|
||||
const [isDragging, setIsDragging] = useState(false);
|
||||
@@ -25,6 +25,7 @@ export default function Home() {
|
||||
const [pendingFileName, setPendingFileName] = useState("");
|
||||
|
||||
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||
const preUploadStatus = useRef<"idle" | "authenticated">("idle");
|
||||
|
||||
// ── Auth ──────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -34,7 +35,7 @@ export default function Home() {
|
||||
const res = await fetch("/api/auth", { method: "POST", body });
|
||||
if (res.ok) {
|
||||
setPasswordError(false);
|
||||
setStatus("unlocked");
|
||||
setStatus("authenticated");
|
||||
} else {
|
||||
setPasswordError(true);
|
||||
}
|
||||
@@ -44,6 +45,8 @@ export default function Home() {
|
||||
|
||||
const uploadFile = useCallback(
|
||||
(file: File) => {
|
||||
preUploadStatus.current =
|
||||
status === "authenticated" ? "authenticated" : "idle";
|
||||
setStatus("uploading");
|
||||
setProgress(0);
|
||||
setResultUrl("");
|
||||
@@ -52,7 +55,9 @@ export default function Home() {
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append("file", file);
|
||||
formData.append("password", password);
|
||||
if (status === "authenticated") {
|
||||
formData.append("password", password);
|
||||
}
|
||||
|
||||
const xhr = new XMLHttpRequest();
|
||||
|
||||
@@ -81,19 +86,19 @@ export default function Home() {
|
||||
// ignore
|
||||
}
|
||||
setErrorMessage(detail);
|
||||
setStatus("unlocked");
|
||||
setStatus(preUploadStatus.current);
|
||||
}
|
||||
};
|
||||
|
||||
xhr.onerror = () => {
|
||||
setErrorMessage("Network error — could not reach the server.");
|
||||
setStatus("unlocked");
|
||||
setStatus(preUploadStatus.current);
|
||||
};
|
||||
|
||||
xhr.open("POST", "/api/upload");
|
||||
xhr.send(formData);
|
||||
},
|
||||
[password],
|
||||
[status, password],
|
||||
);
|
||||
|
||||
// ── Drag and drop ─────────────────────────────────────────────────────────
|
||||
@@ -101,7 +106,7 @@ export default function Home() {
|
||||
const handleDragOver = useCallback(
|
||||
(e: DragEvent<HTMLDivElement>) => {
|
||||
e.preventDefault();
|
||||
if (status === "locked" || status === "uploading") return;
|
||||
if (status === "uploading") return;
|
||||
setIsDragging(true);
|
||||
},
|
||||
[status],
|
||||
@@ -116,7 +121,7 @@ export default function Home() {
|
||||
(e: DragEvent<HTMLDivElement>) => {
|
||||
e.preventDefault();
|
||||
setIsDragging(false);
|
||||
if (status === "locked" || status === "uploading") return;
|
||||
if (status === "uploading") return;
|
||||
const file = e.dataTransfer.files[0];
|
||||
if (file) uploadFile(file);
|
||||
},
|
||||
@@ -142,16 +147,18 @@ export default function Home() {
|
||||
|
||||
// ── Helpers ───────────────────────────────────────────────────────────────
|
||||
|
||||
const isLocked = status === "locked";
|
||||
const isAuthenticated = status === "authenticated";
|
||||
const isUploading = status === "uploading";
|
||||
const isInteractable = status === "unlocked" || status === "done";
|
||||
const isInteractable = status !== "uploading";
|
||||
const limitLabel = isAuthenticated ? "250 MB" : "50 MB";
|
||||
|
||||
// ── Render ────────────────────────────────────────────────────────────────
|
||||
|
||||
return (
|
||||
<main
|
||||
className="min-h-screen bg-[#313338] flex flex-col items-center justify-center px-4 py-12"
|
||||
className="min-h-screen flex flex-col items-center justify-center px-4 py-12"
|
||||
style={{
|
||||
background: "#282828",
|
||||
paddingTop: "max(3rem, env(safe-area-inset-top))",
|
||||
paddingBottom: "max(3rem, env(safe-area-inset-bottom))",
|
||||
}}
|
||||
@@ -159,27 +166,65 @@ export default function Home() {
|
||||
<div className="w-full max-w-sm">
|
||||
{/* ── Header ─────────────────────────────────────────────────────── */}
|
||||
<div className="flex flex-col items-center text-center mb-8 gap-3">
|
||||
<div className="w-12 h-12 rounded-[14px] bg-[#2b2d31] border border-white/[0.06] flex items-center justify-center">
|
||||
<Upload className="w-5 h-5 text-[#f2f3f5]" strokeWidth={1.75} />
|
||||
<div
|
||||
className="w-12 h-12 rounded-[14px] flex items-center justify-center"
|
||||
style={{
|
||||
background: "#3c3836",
|
||||
border: "1px solid #504945",
|
||||
}}
|
||||
>
|
||||
<Upload
|
||||
className="w-5 h-5"
|
||||
style={{ color: "#d79921" }}
|
||||
strokeWidth={1.75}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<h1 className="text-[22px] font-semibold text-[#f2f3f5] tracking-tight leading-snug">
|
||||
File Host
|
||||
<h1
|
||||
className="text-[22px] font-semibold tracking-tight leading-snug"
|
||||
style={{ color: "#ebdbb2" }}
|
||||
>
|
||||
filehost
|
||||
</h1>
|
||||
<p className="text-[13px] text-[#b5bac1] mt-0.5">
|
||||
250 MB max · expires in 24 h
|
||||
<p className="text-[13px] mt-0.5" style={{ color: "#a89984" }}>
|
||||
{limitLabel} max · expires in 24 h
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* ── Card ───────────────────────────────────────────────────────── */}
|
||||
<div className="bg-[#2b2d31] rounded-2xl border border-white/[0.06] overflow-hidden">
|
||||
<div
|
||||
className="rounded-2xl overflow-hidden"
|
||||
style={{ background: "#32302f", border: "1px solid #504945" }}
|
||||
>
|
||||
{/* Auth row */}
|
||||
<div className="px-5 pt-5 pb-5 border-b border-white/[0.06]">
|
||||
{isLocked ? (
|
||||
<div
|
||||
className="px-5 pt-5 pb-5"
|
||||
style={{ borderBottom: "1px solid #504945" }}
|
||||
>
|
||||
{isAuthenticated ? (
|
||||
<div className="flex items-center gap-2.5 py-0.5">
|
||||
<div
|
||||
className="w-2 h-2 rounded-full shrink-0"
|
||||
style={{ background: "#b8bb26" }}
|
||||
/>
|
||||
<span
|
||||
className="text-[14px] font-medium"
|
||||
style={{ color: "#b8bb26" }}
|
||||
>
|
||||
Authenticated · 250 MB limit
|
||||
</span>
|
||||
</div>
|
||||
) : (
|
||||
<div className="flex flex-col gap-3">
|
||||
<label className="text-[13px] font-medium text-[#f2f3f5]">
|
||||
Password
|
||||
<label
|
||||
className="text-[13px] font-medium"
|
||||
style={{ color: "#a89984" }}
|
||||
>
|
||||
Password{" "}
|
||||
<span style={{ color: "#665c54" }} className="font-normal">
|
||||
— optional, unlocks 250 MB
|
||||
</span>
|
||||
</label>
|
||||
<input
|
||||
type="password"
|
||||
@@ -191,33 +236,44 @@ export default function Home() {
|
||||
onKeyDown={(e) => e.key === "Enter" && handleUnlock()}
|
||||
placeholder="Enter password"
|
||||
className={[
|
||||
"w-full h-11 px-3.5 rounded-xl text-[15px] text-[#f2f3f5]",
|
||||
"bg-[#1e1f22] placeholder:text-[#4e5058] outline-none",
|
||||
"w-full h-11 px-3.5 rounded-xl text-[15px] outline-none",
|
||||
"border transition-all duration-150",
|
||||
passwordError
|
||||
? "border-[#ed4245] ring-2 ring-[#ed4245]/15"
|
||||
: "border-transparent focus:border-[#5865f2]/50 focus:ring-2 focus:ring-[#5865f2]/15",
|
||||
passwordError ? "ring-2" : "",
|
||||
].join(" ")}
|
||||
style={{
|
||||
background: "#1d2021",
|
||||
color: "#ebdbb2",
|
||||
caretColor: "#d79921",
|
||||
borderColor: passwordError ? "#fb4934" : "#504945",
|
||||
boxShadow: passwordError
|
||||
? "0 0 0 2px rgba(251,73,52,0.2)"
|
||||
: undefined,
|
||||
}}
|
||||
onFocus={(e) => {
|
||||
if (!passwordError)
|
||||
(e.target as HTMLInputElement).style.borderColor =
|
||||
"#d79921";
|
||||
}}
|
||||
onBlur={(e) => {
|
||||
if (!passwordError)
|
||||
(e.target as HTMLInputElement).style.borderColor =
|
||||
"#504945";
|
||||
}}
|
||||
/>
|
||||
{passwordError && (
|
||||
<p className="text-[12px] text-[#ed4245] -mt-1">
|
||||
<p className="text-[12px] -mt-1" style={{ color: "#fb4934" }}>
|
||||
Incorrect password.
|
||||
</p>
|
||||
)}
|
||||
<button
|
||||
onClick={handleUnlock}
|
||||
className="w-full h-11 rounded-xl bg-[#5865f2] text-white text-[15px] font-medium tracking-tight transition-opacity active:opacity-75 select-none"
|
||||
className="w-full h-11 rounded-xl text-[15px] font-semibold tracking-tight transition-opacity active:opacity-75 select-none flex items-center justify-center gap-2"
|
||||
style={{ background: "#d79921", color: "#1d2021" }}
|
||||
>
|
||||
Unlock
|
||||
<Lock className="w-3.5 h-3.5" strokeWidth={2.5} />
|
||||
Unlock 250 MB
|
||||
</button>
|
||||
</div>
|
||||
) : (
|
||||
<div className="flex items-center gap-2.5 py-0.5">
|
||||
<div className="w-2 h-2 rounded-full bg-[#23a55a] shrink-0" />
|
||||
<span className="text-[14px] font-medium text-[#f2f3f5]">
|
||||
Unlocked
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -227,23 +283,36 @@ export default function Home() {
|
||||
/* ── Uploading ─────────────────────────────────────────────── */
|
||||
<div className="flex flex-col gap-3 py-1">
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="w-9 h-9 rounded-[10px] bg-[#1e1f22] flex items-center justify-center shrink-0">
|
||||
<div
|
||||
className="w-9 h-9 rounded-[10px] flex items-center justify-center shrink-0"
|
||||
style={{ background: "#3c3836" }}
|
||||
>
|
||||
<Upload
|
||||
className="w-4 h-4 text-[#b5bac1]"
|
||||
className="w-4 h-4"
|
||||
style={{ color: "#a89984" }}
|
||||
strokeWidth={1.75}
|
||||
/>
|
||||
</div>
|
||||
<p className="text-[14px] text-[#f2f3f5] font-medium truncate flex-1 min-w-0">
|
||||
<p
|
||||
className="text-[14px] font-medium truncate flex-1 min-w-0"
|
||||
style={{ color: "#ebdbb2" }}
|
||||
>
|
||||
{pendingFileName}
|
||||
</p>
|
||||
<span className="text-[13px] text-[#b5bac1] tabular-nums shrink-0 ml-2">
|
||||
<span
|
||||
className="text-[13px] tabular-nums shrink-0 ml-2"
|
||||
style={{ color: "#a89984" }}
|
||||
>
|
||||
{progress}%
|
||||
</span>
|
||||
</div>
|
||||
<div className="h-[3px] w-full rounded-full bg-[#1e1f22] overflow-hidden">
|
||||
<div
|
||||
className="h-[3px] w-full rounded-full overflow-hidden"
|
||||
style={{ background: "#3c3836" }}
|
||||
>
|
||||
<div
|
||||
className="h-full rounded-full bg-[#5865f2] transition-all duration-300 ease-out"
|
||||
style={{ width: `${progress}%` }}
|
||||
className="h-full rounded-full transition-all duration-300 ease-out"
|
||||
style={{ width: `${progress}%`, background: "#d79921" }}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -252,10 +321,14 @@ export default function Home() {
|
||||
<div className="flex flex-col gap-3">
|
||||
<div className="flex items-center gap-2">
|
||||
<CheckCircle2
|
||||
className="w-4 h-4 text-[#23a55a] shrink-0"
|
||||
className="w-4 h-4 shrink-0"
|
||||
style={{ color: "#b8bb26" }}
|
||||
strokeWidth={2}
|
||||
/>
|
||||
<span className="text-[14px] font-medium text-[#f2f3f5]">
|
||||
<span
|
||||
className="text-[14px] font-medium"
|
||||
style={{ color: "#ebdbb2" }}
|
||||
>
|
||||
Upload complete
|
||||
</span>
|
||||
</div>
|
||||
@@ -264,20 +337,31 @@ export default function Home() {
|
||||
readOnly
|
||||
value={resultUrl}
|
||||
onClick={(e) => (e.target as HTMLInputElement).select()}
|
||||
className="w-full h-10 px-3 rounded-xl bg-[#1e1f22] border border-transparent focus:border-white/[0.12] text-[12px] text-[#f2f3f5] font-mono outline-none cursor-text transition-colors"
|
||||
className="w-full h-10 px-3 rounded-xl text-[12px] font-mono outline-none cursor-text transition-colors"
|
||||
style={{
|
||||
background: "#1d2021",
|
||||
border: "1px solid #504945",
|
||||
color: "#d5c4a1",
|
||||
}}
|
||||
/>
|
||||
|
||||
<div className="flex gap-2">
|
||||
<button
|
||||
onClick={handleCopy}
|
||||
className={[
|
||||
"flex-1 h-11 rounded-xl text-[14px] font-medium",
|
||||
"flex items-center justify-center gap-1.5",
|
||||
"transition-all active:opacity-70 select-none",
|
||||
className="flex-1 h-11 rounded-xl text-[14px] font-medium flex items-center justify-center gap-1.5 transition-all active:opacity-70 select-none"
|
||||
style={
|
||||
copied
|
||||
? "bg-[#23a55a]/10 text-[#23a55a]"
|
||||
: "bg-[#1e1f22] text-[#f2f3f5]",
|
||||
].join(" ")}
|
||||
? {
|
||||
background: "rgba(184,187,38,0.12)",
|
||||
color: "#b8bb26",
|
||||
border: "1px solid rgba(184,187,38,0.25)",
|
||||
}
|
||||
: {
|
||||
background: "#3c3836",
|
||||
color: "#ebdbb2",
|
||||
border: "1px solid #504945",
|
||||
}
|
||||
}
|
||||
>
|
||||
<Copy className="w-3.5 h-3.5" strokeWidth={2} />
|
||||
{copied ? "Copied" : "Copy"}
|
||||
@@ -287,7 +371,8 @@ export default function Home() {
|
||||
href={resultUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="flex-1 h-11 rounded-xl bg-[#5865f2] text-white text-[14px] font-medium flex items-center justify-center gap-1.5 transition-opacity active:opacity-80 select-none"
|
||||
className="flex-1 h-11 rounded-xl text-[14px] font-semibold flex items-center justify-center gap-1.5 transition-opacity active:opacity-80 select-none"
|
||||
style={{ background: "#d79921", color: "#1d2021" }}
|
||||
>
|
||||
<ExternalLink className="w-3.5 h-3.5" strokeWidth={2} />
|
||||
Open
|
||||
@@ -298,9 +383,10 @@ export default function Home() {
|
||||
onClick={() => {
|
||||
setResultUrl("");
|
||||
setErrorMessage("");
|
||||
setStatus("unlocked");
|
||||
setStatus(isAuthenticated ? "authenticated" : "idle");
|
||||
}}
|
||||
className="flex items-center justify-center gap-1.5 text-[13px] text-[#80848e] transition-colors active:text-[#f2f3f5] select-none"
|
||||
className="flex items-center justify-center gap-1.5 text-[13px] transition-colors active:opacity-80 select-none"
|
||||
style={{ color: "#a89984" }}
|
||||
>
|
||||
<RotateCcw className="w-3 h-3" strokeWidth={2} />
|
||||
Upload another
|
||||
@@ -313,17 +399,14 @@ export default function Home() {
|
||||
onDragLeave={handleDragLeave}
|
||||
onDrop={handleDrop}
|
||||
onClick={() => isInteractable && fileInputRef.current?.click()}
|
||||
className={[
|
||||
"rounded-xl border-2 border-dashed",
|
||||
"flex flex-col items-center justify-center gap-2.5",
|
||||
"py-10 px-4 text-center",
|
||||
"transition-all duration-150 select-none",
|
||||
isLocked
|
||||
? "border-white/[0.06] cursor-not-allowed opacity-40"
|
||||
: isDragging
|
||||
? "border-[#5865f2]/40 bg-[#5865f2]/[0.04] cursor-copy"
|
||||
: "border-white/[0.08] cursor-pointer hover:border-white/[0.14] hover:bg-white/[0.02] active:bg-white/[0.03]",
|
||||
].join(" ")}
|
||||
className="rounded-xl border-2 border-dashed flex flex-col items-center justify-center gap-2.5 py-10 px-4 text-center transition-all duration-150 select-none"
|
||||
style={{
|
||||
borderColor: isDragging ? "#83a598" : "#504945",
|
||||
background: isDragging
|
||||
? "rgba(131,165,152,0.06)"
|
||||
: "transparent",
|
||||
cursor: isUploading ? "default" : "pointer",
|
||||
}}
|
||||
>
|
||||
<input
|
||||
ref={fileInputRef}
|
||||
@@ -332,53 +415,53 @@ export default function Home() {
|
||||
onChange={handleFileChange}
|
||||
/>
|
||||
<div
|
||||
className={[
|
||||
"w-10 h-10 rounded-[12px] flex items-center justify-center transition-colors",
|
||||
isDragging ? "bg-[#5865f2]/10" : "bg-[#1e1f22]",
|
||||
].join(" ")}
|
||||
className="w-10 h-10 rounded-[12px] flex items-center justify-center transition-colors"
|
||||
style={{
|
||||
background: isDragging
|
||||
? "rgba(131,165,152,0.12)"
|
||||
: "#3c3836",
|
||||
}}
|
||||
>
|
||||
<Upload
|
||||
className={[
|
||||
"w-4.5 h-4.5 transition-colors",
|
||||
isDragging ? "text-[#5865f2]" : "text-[#80848e]",
|
||||
].join(" ")}
|
||||
className="w-4.5 h-4.5 transition-colors"
|
||||
style={{ color: isDragging ? "#83a598" : "#7c6f64" }}
|
||||
strokeWidth={1.75}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<p
|
||||
className={[
|
||||
"text-[14px] font-medium transition-colors",
|
||||
isDragging
|
||||
? "text-[#5865f2]"
|
||||
: isLocked
|
||||
? "text-[#80848e]"
|
||||
: "text-[#f2f3f5]",
|
||||
].join(" ")}
|
||||
className="text-[14px] font-medium transition-colors"
|
||||
style={{ color: isDragging ? "#83a598" : "#ebdbb2" }}
|
||||
>
|
||||
{isLocked
|
||||
? "Enter password to unlock"
|
||||
: isDragging
|
||||
? "Drop to upload"
|
||||
: "Drop file or tap to browse"}
|
||||
{isDragging
|
||||
? "Drop to upload"
|
||||
: "Drop file or tap to browse"}
|
||||
</p>
|
||||
<p className="text-[12px] mt-1" style={{ color: "#7c6f64" }}>
|
||||
Any file type · up to {limitLabel}
|
||||
</p>
|
||||
{!isLocked && (
|
||||
<p className="text-[12px] text-[#80848e] mt-1">
|
||||
Any file type · up to 250 MB
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* ── Error ────────────────────────────────────────────────── */}
|
||||
{errorMessage && (
|
||||
<div className="flex items-start gap-2.5 px-3.5 py-3 rounded-xl bg-[#ed4245]/[0.08] border border-[#ed4245]/[0.15]">
|
||||
<div
|
||||
className="flex items-start gap-2.5 px-3.5 py-3 rounded-xl"
|
||||
style={{
|
||||
background: "rgba(251,73,52,0.08)",
|
||||
border: "1px solid rgba(251,73,52,0.2)",
|
||||
}}
|
||||
>
|
||||
<AlertCircle
|
||||
className="w-4 h-4 text-[#ed4245] shrink-0 mt-px"
|
||||
className="w-4 h-4 shrink-0 mt-px"
|
||||
style={{ color: "#fb4934" }}
|
||||
strokeWidth={2}
|
||||
/>
|
||||
<p className="text-[13px] text-[#ed4245] break-all leading-relaxed">
|
||||
<p
|
||||
className="text-[13px] break-all leading-relaxed"
|
||||
style={{ color: "#fb4934" }}
|
||||
>
|
||||
{errorMessage}
|
||||
</p>
|
||||
</div>
|
||||
@@ -387,7 +470,10 @@ export default function Home() {
|
||||
</div>
|
||||
|
||||
{/* ── Footer ─────────────────────────────────────────────────────── */}
|
||||
<p className="text-center text-[12px] text-[#80848e] mt-6">
|
||||
<p
|
||||
className="text-center text-[12px] mt-6"
|
||||
style={{ color: "#665c54" }}
|
||||
>
|
||||
Files are automatically deleted after 24 hours
|
||||
</p>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user