x-undefined-2 commited on
Commit
201d0dc
·
verified ·
1 Parent(s): 6b58a08

Update index.ts

Browse files
Files changed (1) hide show
  1. index.ts +6 -2
index.ts CHANGED
@@ -17,9 +17,13 @@ async function handleRequest(event) {
17
  "Access-Control-Allow-Methods": "GET, POST, PUT, PATCH, DELETE, OPTIONS",
18
  "Access-Control-Allow-Headers": reqHeaders.get('Access-Control-Allow-Headers') || "Accept, Authorization, Cache-Control, Content-Type, DNT, If-Modified-Since, Keep-Alive, Origin, User-Agent, X-Requested-With, Token, x-access-token, Notion-Version"
19
  });
20
-
 
 
 
 
21
  //取域名第一个斜杠后的所有信息为代理链接
22
- let url = decodeURIComponent(url.substr(url.indexOf(10, '/') + 1));
23
  if(url === ""){
24
  url = "https://github.com/"
25
  }
 
17
  "Access-Control-Allow-Methods": "GET, POST, PUT, PATCH, DELETE, OPTIONS",
18
  "Access-Control-Allow-Headers": reqHeaders.get('Access-Control-Allow-Headers') || "Accept, Authorization, Cache-Control, Content-Type, DNT, If-Modified-Since, Keep-Alive, Origin, User-Agent, X-Requested-With, Token, x-access-token, Notion-Version"
19
  });
20
+ let url = request.url;
21
+ console.log(url);
22
+ if(url.indexOf(10, '/') == -1){
23
+ url = "https://x-undefined-2-proxy-server.hf.space/https://github.com/"
24
+ }
25
  //取域名第一个斜杠后的所有信息为代理链接
26
+ url = decodeURIComponent(url.substr(url.indexOf(10, '/') + 1));
27
  if(url === ""){
28
  url = "https://github.com/"
29
  }