import { useState, useRef, useEffect } from "react"; const PROXY_SERVICES = [ { name: "Ultraviolet", url: "https://uv.holyubofficial.net/", icon: "🌐" }, { name: "Holy Unblocker", url: "https://www.holyubofficial.net/", icon: "🔓" }, { name: "Interstellar", url: "https://interstellar.baby/", icon: "🚀" }, ]; const QUICK_LINKS = [ { name: "Google", url: "https://google.com", icon: "🔍" }, { name: "YouTube", url: "https://youtube.com", icon: "📺" }, { name: "Wikipedia", url: "https://wikipedia.org", icon: "📚" }, { name: "Reddit", url: "https://reddit.com", icon: "🗨️" }, { name: "Twitter", url: "https://twitter.com", icon: "🐦" }, { name: "GitHub", url: "https://github.com", icon: "💻" }, ]; export default function ProxyApp() { const [tab, setTab] = useState("home"); const [inputUrl, setInputUrl] = useState(""); const [activeProxy, setActiveProxy] = useState(PROXY_SERVICES[0]); const [iframeUrl, setIframeUrl] = useState(""); const [isLoading, setIsLoading] = useState(false); const [history, setHistory] = useState([]); const [theme, setTheme] = useState("dark"); const [cloakTitle, setCloakTitle] = useState("ZXS Lite"); const inputRef = useRef(null); const isDark = theme === "dark"; const colors = { bg: isDark ? "#0d1117" : "#f0f4f8", bgCard: isDark ? "#161b22" : "#ffffff", border: isDark ? "#30363d" : "#d1d9e0", text: isDark ? "#e6edf3" : "#1c2128", muted: isDark ? "#8b949e" : "#57606a", accent: "#3ac3ab", accentDark: "#12ae9a", }; const styles = { app: { display: "flex", flexDirection: "column", height: "100vh", background: colors.bg, color: colors.text, fontFamily: "'Segoe UI', Roboto, sans-serif", overflow: "hidden", }, header: { background: colors.bgCard, borderBottom: `1px solid ${colors.border}`, padding: "0.8rem 1.5rem", display: "flex", alignItems: "center", justifyContent: "space-between", gap: "1rem", flexShrink: 0, }, logo: { fontWeight: 700, fontSize: "1.2rem", color: colors.accent, whiteSpace: "nowrap", }, urlBar: { flex: 1, display: "flex", gap: "0.5rem", alignItems: "center", }, input: { flex: 1, background: colors.bg, border: `1px solid ${colors.border}`, borderRadius: "8px", color: colors.text, padding: "0.5rem 1rem", fontSize: "0.9rem", outline: "none", }, btnPrimary: { background: colors.accent, border: "none", color: "#fff", borderRadius: "8px", padding: "0.5rem 1rem", cursor: "pointer", fontWeight: 600, fontSize: "0.85rem", }, btnSecondary: { background: "transparent", border: `1px solid ${colors.border}`, color: colors.muted, borderRadius: "8px", padding: "0.5rem 0.8rem", cursor: "pointer", fontSize: "0.9rem", }, content: { flex: 1, overflow: "auto", }, nav: { display: "flex", justifyContent: "space-around", background: colors.bgCard, borderTop: `1px solid ${colors.border}`, padding: "0.3rem 0", flexShrink: 0, }, navBtn: (active) => ({ flex: 1, background: "none", border: "none", color: active ? colors.accent : colors.muted, fontSize: "0.75rem", padding: "0.5rem 0", cursor: "pointer", display: "flex", flexDirection: "column", alignItems: "center", gap: "2px", fontWeight: active ? 600 : 400, }), page: { padding: "1.5rem", maxWidth: "700px", margin: "0 auto", }, sectionTitle: { color: colors.accent, fontWeight: 600, fontSize: "0.9rem", marginBottom: "0.8rem", marginTop: "1.5rem", textTransform: "uppercase", letterSpacing: "0.05em", }, grid: { display: "grid", gridTemplateColumns: "repeat(auto-fill, minmax(120px, 1fr))", gap: "0.8rem", }, card: { background: colors.bgCard, border: `1px solid ${colors.border}`, borderRadius: "10px", padding: "1rem", textAlign: "center", cursor: "pointer", transition: "all 0.2s", }, proxyCard: (active) => ({ background: active ? `${colors.accent}20` : colors.bgCard, border: `1px solid ${active ? colors.accent : colors.border}`, borderRadius: "10px", padding: "0.8rem 1rem", cursor: "pointer", display: "flex", alignItems: "center", gap: "0.8rem", marginBottom: "0.5rem", }), settingRow: { display: "flex", alignItems: "center", justifyContent: "space-between", padding: "0.8rem 0", borderBottom: `1px solid ${colors.border}`, }, toggle: (active) => ({ width: "42px", height: "22px", borderRadius: "11px", background: active ? colors.accent : colors.border, position: "relative", cursor: "pointer", transition: "background 0.2s", border: "none", flexShrink: 0, }), toggleDot: (active) => ({ position: "absolute", top: "3px", left: active ? "23px" : "3px", width: "16px", height: "16px", borderRadius: "50%", background: "#fff", transition: "left 0.2s", }), historyItem: { display: "flex", alignItems: "center", gap: "0.8rem", padding: "0.7rem 0", borderBottom: `1px solid ${colors.border}`, cursor: "pointer", }, }; function navigate(url) { let finalUrl = url.trim(); if (!finalUrl) return; if (!/^https?:\/\//i.test(finalUrl)) { if (finalUrl.includes(".") && !finalUrl.includes(" ")) { finalUrl = "https://" + finalUrl; } else { finalUrl = `https://www.google.com/search?q=${encodeURIComponent(finalUrl)}`; } } const proxyUrl = activeProxy.url + "?url=" + encodeURIComponent(finalUrl); setIframeUrl(proxyUrl); setInputUrl(finalUrl); setHistory((h) => [{ url: finalUrl, time: new Date().toLocaleTimeString() }, ...h.slice(0, 19)]); setTab("browse"); setIsLoading(true); } function handleKey(e) { if (e.key === "Enter") navigate(inputUrl); } useEffect(() => { if (tab === "proxy" && inputRef.current) inputRef.current.focus(); }, [tab]); const NavIcon = ({ icon, label, page }) => ( ); const renderHome = () => (
🌊

ZXS Lite Proxy

Fast, lightweight, anonymous browsing

setInputUrl(e.target.value)} onKeyDown={handleKey} />
Quick Access
{QUICK_LINKS.map((l) => (
navigate(l.url)} onMouseEnter={(e) => { e.currentTarget.style.borderColor = colors.accent; e.currentTarget.style.transform = "translateY(-2px)"; }} onMouseLeave={(e) => { e.currentTarget.style.borderColor = colors.border; e.currentTarget.style.transform = "translateY(0)"; }} >
{l.icon}
{l.name}
))}
); const renderBrowse = () => (
{iframeUrl ? ( <> {isLoading && (
⏳ Loading...
)}