- File Size${escapeHtml(sizeDisplay)}
- File Type${escapeHtml(formatDisplay)}
- Share Date${escapeHtml(dateDisplay)} ${sharedByHTML}
export async function onRequest(context) { // URL থেকে ফাইলের ID নেওয়া const fileId = context.params.id; const requestUrl = new URL(context.request.url); // 🔥 তোমার বর্তমান Worker এর URL এখানে দাও const WORKER_API_URL = "https://seed.toxhost.workers.dev"; // 🔥 pdlink resolver worker (server-name based /api/{servername}/{id}) const PD_WORKER_URL = "https://pd.toxhost.workers.dev"; // ========================================== // 🛠️ Small helpers // ========================================== function isValid(val) { return val && val !== "Failed" && val !== "Disabled" && val !== "null" && val !== "Processing" && (typeof val !== "string" || val.trim() !== "") && (typeof val !== "string" || !val.startsWith("Failed")); } function escapeHtml(str) { if (str === null || str === undefined) return ""; return String(str) .replace(/&/g, "&") .replace(//g, ">") .replace(/"/g, """) .replace(/'/g, "'"); } // 📏 Bytes -> KB/MB/GB/TB auto formatter function formatBytes(bytes, decimals = 2) { bytes = parseInt(bytes); if (!bytes || isNaN(bytes) || bytes <= 0) return "Unknown"; const k = 1024; const dm = decimals < 0 ? 0 : decimals; const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; const i = Math.floor(Math.log(bytes) / Math.log(k)); return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`; } if (!fileId || fileId.trim() === "") { return new Response("
Missing file ID.
", { status: 404, headers: { "Content-Type": "text/html" } }); } try { // ========================================== // ১. সার্ভার সাইড থেকে Worker-এ POST রিকোয়েস্ট করা // ========================================== const apiResponse = await fetch(`${WORKER_API_URL}/?id=${encodeURIComponent(fileId)}&action=download`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ id: fileId, action: 'download' }) }); let resJson; try { resJson = await apiResponse.json(); } catch (e) { return new Response("The file you are looking for does not exist or has been removed.
", { status: 404, headers: { "Content-Type": "text/html" } } ); } const fileData = resJson.data; // 🔄 /d/ এর জায়গায় /file/ const shareLink = `${requestUrl.origin}/file/${encodeURIComponent(fileId)}`; // ========================================== // 🎛️ ON/OFF SWITCHES — এখান থেকে যেকোনো সার্ভার true/false করে // enable/disable করা যাবে। false করলে বাটন একদম দেখাবে না। // ========================================== const SERVER_TOGGLES = { hubcloud: true, fsl: true, server10gbps: true, gofile: true, pixeldrain: true, vikingfile: true, buzzheavier: true, telegram: true, voe: true, streamhg: true, abyss: true }; // ========================================== // ৩. GCloud/HubCloud বাটন ও লিংক // ========================================== let gcloudUrl = null; if (isValid(fileData.gcloud_url) && /^https?:\/\//i.test(String(fileData.gcloud_url).trim())) { gcloudUrl = fileData.gcloud_url; } let gcloudHTML = ""; if (gcloudUrl && SERVER_TOGGLES.hubcloud) { gcloudHTML = ` Download [HubCloud]\n`; } let topCopyLink = gcloudUrl ? gcloudUrl : shareLink; // ========================================== // 🔴 FSL & 10Gbps Servers // ========================================== let fsl10GbpsHTML = ""; if (SERVER_TOGGLES.fsl) { fsl10GbpsHTML += ` Download [FSL Server]\n`; } if (SERVER_TOGGLES.server10gbps) { fsl10GbpsHTML += ` Download [Server : 10Gbps]\n`; fsl10GbpsHTML += `Experience the magic of TOXcloud where files effortlessly find their way into your downloads!
TOXcloud Means File will get Downloaded by anyhow (:Note: Always Use Updated Chrome Browser With Cookies Enabled .| Refresh this Page & click Download again if you get any error. ! Resume is Supported-Enjoy :)
If you're getting any error please report at @Telegram Group with Share Link And Screenshot (:
${escapeHtml(shareLink)}
${escapeHtml(error.message)}
`, { status: 500, headers: { "Content-Type": "text/html" } }); } }