From a0838734ebb56e62507067af54711e638385b3af Mon Sep 17 00:00:00 2001 From: qq_41923622 Date: Fri, 21 Feb 2025 09:40:00 +0800 Subject: [PATCH] Fri Feb 21 09:40:00 CST 2025 inscode --- index.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 224a88e..5d9f979 100644 --- a/index.js +++ b/index.js @@ -50,7 +50,7 @@ let url= "https://h5.hunlihu.com"+proxyUrl; options.headers['Content-Length'] = Buffer.byteLength(encodedData); axios.post(url, encodedData, { headers:options.headers }) .then(response => { - console.log('请求成功,响应数据:', response.data); + console.log('请求成功,响应数据:', req,response.data); resolve(response.data) }).catch((err)=>{ reject(err) @@ -75,7 +75,8 @@ const subdirectoryMappings = { 'h5hunlihu': 'https://h5.hunlihu.com', }; // 创建HTTP服务器 -const server = http.createServer((req, res) => { +const server = http.createServer(async(req, res) => { + if(new RegExp(`^\/shunlihu\/`).test(req.url)){ // proxyRes.headers = @@ -107,7 +108,9 @@ const server = http.createServer((req, res) => { res.setHeader('Access-Control-Allow-Credentials', 'true'); https://h5.hunlihu.com/vashow/ly/door/door/init?0.9173087912286308 if(/\/vashow\/ly\/door\/door\/init/.test(req.url)){ - getProxyInfoData(req, res,req.url.replace(/^\/shunlihu/, '')) + let proxyData = await getProxyInfoData(req, res,req.url.replace(/^\/shunlihu/, '')) + res.writeHead(200, { 'Content-Type': 'text/html;charset=utf-8' }); + res.end(proxyData); }else{ proxy.options.target=subdirectoryMappings.h5hunlihu; req.headers['origin'] = subdirectoryMappings.shunlihu; -- GitLab