做适配
This commit is contained in:
		@@ -255,7 +255,10 @@ export const downloadUserAppFiles = async (user: string, app: string, data: type
 | 
			
		||||
    };
 | 
			
		||||
  }
 | 
			
		||||
  if (data.type === 'oss') {
 | 
			
		||||
    const serverPath = 'https://' + resources + '/';
 | 
			
		||||
    let serverPath = 'https://' + resources + '/';
 | 
			
		||||
    if(resources.includes('localhost')) {
 | 
			
		||||
      serverPath = 'http://' + resources + '/';
 | 
			
		||||
    }
 | 
			
		||||
    // server download file
 | 
			
		||||
    for (let i = 0; i < files.length; i++) {
 | 
			
		||||
      const file = files[i];
 | 
			
		||||
 
 | 
			
		||||
@@ -24,13 +24,18 @@ export const handleRequest = async (req: http.IncomingMessage, res: http.ServerR
 | 
			
		||||
    res.write('proxy no favicon.ico\n');
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
  if (req.url.startsWith('/api/router')) {
 | 
			
		||||
  if (req.url.startsWith('/api/proxy')) {
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
  if (req.url.startsWith('/api')) {
 | 
			
		||||
    // 代理到 http://codeflow.xiongxiao.me/api
 | 
			
		||||
    const _u = new URL(req.url, `http://${api.host}`);
 | 
			
		||||
    // 设置代理请求的目标 URL 和请求头
 | 
			
		||||
    let header: any = {};
 | 
			
		||||
    if (req.headers?.['Authroization']) {
 | 
			
		||||
      header.Authorization = req.headers?.['Authroization'];
 | 
			
		||||
    if (req.headers?.['Authorization']) {
 | 
			
		||||
      header.authorization = req.headers['Authorization'];
 | 
			
		||||
    } else if(req.headers?.['authorization']) {
 | 
			
		||||
      header.authorization = req.headers['authorization'];
 | 
			
		||||
    }
 | 
			
		||||
    if (req.headers?.['Content-Type']) {
 | 
			
		||||
      header['Content-Type'] = req.headers?.['Content-Type'];
 | 
			
		||||
@@ -64,9 +69,6 @@ export const handleRequest = async (req: http.IncomingMessage, res: http.ServerR
 | 
			
		||||
    req.pipe(proxyReq, { end: true });
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
  if (req.url.startsWith('/api/proxy')) {
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
  if (req.url.startsWith('/api')) {
 | 
			
		||||
    res.end('not catch api');
 | 
			
		||||
    return;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user