📄 Tệp code
body/html toàn cục, position: fixed ở vỏ ngoài hay comment //.
.html của trang Studio về máy người dùng.Ctrl+U, Ctrl+S, F12, Ctrl+Shift+I) và khóa chuột phải ngoài vùng soạn thảo để bảo vệ bản quyền code của anh.
xkiro-proxy.khoathegioi.workers.dev) đã gắn 1 bộ nhớ KV tên là VAULT_KV (hoặc POPUP_VAULT), anh chỉ cần thêm nhánh /vault nhỏ gọn dưới đây vào đầu hàm fetch(request, env) là mọi thiết bị vào link sẽ tự động dùng chung Tủ mẫu:
// Dán thêm đoạn này vào đầu hàm async fetch(request, env) trong Cloudflare Worker của anh:
const url = new URL(request.url);
const kv = env.VAULT_KV || env.POPUP_VAULT || env.KV;
if (url.pathname.endsWith("/vault") && kv) {
const cors = { "Access-Control-Allow-Origin": "*", "Access-Control-Allow-Methods": "GET,POST,OPTIONS", "Access-Control-Allow-Headers": "Content-Type,Authorization", "Content-Type": "application/json" };
if (request.method === "OPTIONS") return new Response(null, { headers: cors });
if (request.method === "GET") return new Response((await kv.get("shared_vault_v10")) || "[]", { headers: cors });
if (request.method === "POST") { const body = await request.text(); await kv.put("shared_vault_v10", body); return new Response('{"ok":true}', { headers: cors }); }
}