From d39376c8cc991697c62c08dee128eb388e50e530 Mon Sep 17 00:00:00 2001 From: adams549659584 <13760614423@163.com> Date: Tue, 30 May 2023 01:30:07 +0800 Subject: [PATCH] fix: fix cloudflare home --- cloudflare/worker.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cloudflare/worker.js b/cloudflare/worker.js index 2ba5aee..e03d324 100644 --- a/cloudflare/worker.js +++ b/cloudflare/worker.js @@ -76,14 +76,18 @@ const getRandomIP = () => { * @returns */ const home = async (pathname) => { - let url = `https://raw.githubusercontent.com/adams549659584/go-proxy-bingai/master/cloudflare/index.html`; + const baseUrl = 'https://raw.githubusercontent.com/adams549659584/go-proxy-bingai/master/'; + let url; // if (pathname.startsWith('/github/')) { if (pathname.indexOf('/github/') === 0) { url = pathname.replace('/github/', 'https://raw.githubusercontent.com/adams549659584/go-proxy-bingai/master/'); + } else { + url = baseUrl + 'cloudflare/index.html'; } const res = await fetch(url); const newRes = new Response(res.body, res); if (pathname === '/') { + newRes.headers.delete('content-security-policy'); newRes.headers.set('content-type', 'text/html; charset=utf-8'); } return newRes;