Skip to content

Commit d39376c

Browse files
fix: fix cloudflare home
1 parent db188a6 commit d39376c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cloudflare/worker.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,18 @@ const getRandomIP = () => {
7676
* @returns
7777
*/
7878
const home = async (pathname) => {
79-
let url = `https://raw.githubusercontent.com/adams549659584/go-proxy-bingai/master/cloudflare/index.html`;
79+
const baseUrl = 'https://raw.githubusercontent.com/adams549659584/go-proxy-bingai/master/';
80+
let url;
8081
// if (pathname.startsWith('/github/')) {
8182
if (pathname.indexOf('/github/') === 0) {
8283
url = pathname.replace('/github/', 'https://raw.githubusercontent.com/adams549659584/go-proxy-bingai/master/');
84+
} else {
85+
url = baseUrl + 'cloudflare/index.html';
8386
}
8487
const res = await fetch(url);
8588
const newRes = new Response(res.body, res);
8689
if (pathname === '/') {
90+
newRes.headers.delete('content-security-policy');
8791
newRes.headers.set('content-type', 'text/html; charset=utf-8');
8892
}
8993
return newRes;

0 commit comments

Comments
 (0)