export default { async fetch(request, env) { const url = new URL(request.url); // Admin password (yahan apna password set karo) const ADMIN_PASSWORD = "mySecret123"; // Get all videos (JSON) if (url.pathname === "/videos") { let data = await env.VIDEOS.get("list"); return new Response(data || "[]", { headers: { "Content-Type": "application/json" } }); } // Add new video (Admin only) if (url.pathname === "/add" && request.method === "POST") { let { password, title, link } = await request.json(); if (password !== ADMIN_PASSWORD) { return new Response("Unauthorized", { status: 403 }); } let data = await env.VIDEOS.get("list"); let videos = data ? JSON.parse(data) : []; videos.push({ title, link }); await env.VIDEOS.put("list", JSON.stringify(videos)); return new Response(JSON.stringify({ success: true, videos }), { headers: { "Content-Type": "application/json" }, }); } // Admin Panel (password protected via form) if (url.pathname === "/admin") { return new Response(` Admin Panel

Admin Panel

`, { headers: { "Content-Type": "text/html" } }); } // Default User Page (shareable link) return new Response(` Best Cine Suavesito
Best Cine Suavesito
Loading...
`, { headers: { "Content-Type": "text/html" } }); } }