This commit is contained in:
2025-11-28 03:36:38 +08:00
parent 727304009d
commit 39fab83b3d
4 changed files with 14 additions and 44 deletions

View File

@@ -2,7 +2,7 @@ import { getDNS, isIpv4OrIpv6, isLocalhost } from '../modules/fm-manager/index.t
import http from 'node:http';
import https from 'node:https';
import { UserApp } from '../modules/user-app/index.ts';
import { config, fileStore } from '../modules/config.ts';
import { myConfig as config, fileStore } from '../modules/config.ts';
import path from 'node:path';
import fs from 'node:fs';
import { getContentType } from '../modules/fm-manager/index.ts';
@@ -78,8 +78,8 @@ export const handleRequest = async (req: http.IncomingMessage, res: http.ServerR
// 提取req的headers中的非HOST的header
const headers = Object.keys(req.headers).filter((item) => item && item.toLowerCase() !== 'host');
const host = req.headers['host'];
logger.info('proxy host', host);
logger.info('headers', headers);
logger.debug('proxy host', host);
logger.debug('headers', headers);
headers.forEach((item) => {
header[item] = req.headers[item];
@@ -96,7 +96,7 @@ export const handleRequest = async (req: http.IncomingMessage, res: http.ServerR
// @ts-ignore
options.port = _u.port;
}
logger.info('proxy options', options);
logger.debug('proxy options', options);
const isHttps = _u.protocol === 'https:';
const protocol = isHttps ? https : http;
if (isHttps) {

View File

@@ -23,18 +23,19 @@ export const installAppFromKey = async (key: string) => {
if (fileIsExist(readmeFile)) {
readmeDesc = fs.readFileSync(readmeFile, 'utf-8');
}
const { type = 'system-app', entry = '', engine = undefined, pm2Options = {}, ...rest } = app;
let showAppInfo = {
key,
status: 'inactive' as const,
type: app?.type || 'system-app',
type,
description: readmeDesc || '',
version,
//
entry: app?.entry || '',
entry,
path: directory,
engine: app?.engine,
pm2Options: app?.pm2Options || {},
engine,
pm2Options,
origin: app,
...rest,
};
app.key = key;
fs.writeFileSync(pkgs, JSON.stringify(pkg, null, 2));