Spaces:
Paused
Paused
Update index.ts
Browse files
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 |
-
|
| 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 |
}
|