Dingdsz commited on
Commit
8c8c45e
·
verified ·
1 Parent(s): b707059

Update server.mjs

Browse files
Files changed (1) hide show
  1. server.mjs +1 -18
server.mjs CHANGED
@@ -197,24 +197,7 @@ app.get('/proxy/:encodedUrl', async (req, res) => {
197
  }
198
  };
199
 
200
- //const response = await makeRequest();
201
-
202
- const makeRequest = async () => {
203
- try {
204
- return await axios({
205
- method: 'get',
206
- url: targetUrl,
207
- responseType: 'stream',
208
- timeout: config.timeout,
209
- headers: {
210
- 'User-Agent': config.userAgent,
211
- 'Referer': 'https://your-site.com', // 加 Referer,替换为您的站点(如 localhost:7860)
212
- 'Accept': 'image/*,*/*;q=0.8', // 模拟图片请求
213
- 'Accept-Language': 'en-US,en;q=0.9' // 加语言
214
- }
215
- });
216
- } catch (error) { /* ... */ }
217
- };
218
 
219
  // 转发响应头(过滤敏感头)
220
  const headers = { ...response.headers };
 
197
  }
198
  };
199
 
200
+ const response = await makeRequest();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
201
 
202
  // 转发响应头(过滤敏感头)
203
  const headers = { ...response.headers };