diff --git a/package.json b/package.json index a23044f..73d0c94 100644 --- a/package.json +++ b/package.json @@ -18,9 +18,7 @@ } }, "scripts": { - "test": "tsx test/**/*.ts", "dev": "bun run --watch --hot src/index.ts", - "dev:inspect": "bun run --watch --hot --inspect src/index.ts", "cmd": "bun run src/run.ts ", "prebuild": "rimraf dist && rimraf pack-dist", "build": "NODE_ENV=production bun bun.config.mjs", @@ -28,14 +26,15 @@ "deploy": "rsync -avz --delete ./pack-dist/ light:/root/kevisual/assistant-app/apps/root/code-center", "deploy:envision": "rsync -avz --delete ./pack-dist/ envision:~/kevisual/assistant-app/apps/root/code-center", "clean": "rm -rf dist", - "reload": "ssh light pm2 restart code-center", - "reload:envision": "ssh envision pm2 restart code-center", + "reload": "ssh light pm2 restart root/code-center", + "reload:envision": "ssh envision pm2 restart root/code-center", "pub:me": "npm run build && npm run deploy && npm run reload", "pub:envision": "npm run build && npm run deploy:envision && npm run reload:envision", "start": "pm2 start dist/app.js --name code-center", "client:start": "pm2 start apps/code-center/dist/app.js --name code-center", "ssl": "ssh -L 5432:localhost:5432 light", "ssl:redis": "ssh -L 6379:localhost:6379 light", + "ssl:minio": "ssh -L 9000:localhost:9000 light", "pub": "envision pack -p -u -c" }, "keywords": [], @@ -109,5 +108,5 @@ "sqlite3" ] }, - "packageManager": "pnpm@10.23.0" + "packageManager": "pnpm@10.24.0" } \ No newline at end of file diff --git a/src/routes-simple/page-proxy.ts b/src/routes-simple/page-proxy.ts index a36b5f1..2ef5bef 100644 --- a/src/routes-simple/page-proxy.ts +++ b/src/routes-simple/page-proxy.ts @@ -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) { diff --git a/src/routes/micro-app/module/manager.ts b/src/routes/micro-app/module/manager.ts index 7571184..2f4de7f 100644 --- a/src/routes/micro-app/module/manager.ts +++ b/src/routes/micro-app/module/manager.ts @@ -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)); diff --git a/test/db/query-table.test.ts b/test/db/query-table.test.ts deleted file mode 100644 index f34b21c..0000000 --- a/test/db/query-table.test.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { QueryTypes } from 'sequelize'; -import { sequelize } from '../../src/modules/index.ts'; -import test from 'tape'; -// tsx test/db/query-table.test.ts -const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); -test('connection table', async (t) => { - try { - const auth = await sequelize.authenticate(); - console.log('connect success'); - } catch (error) { - console.error('connect error', error); - } -}); -test('QueryTableModel:init', async (t) => { - try { - const tablesCount: any = await sequelize.query("SELECT COUNT(*) AS table_count FROM information_schema.tables WHERE table_schema = 'public';", { - type: QueryTypes.SELECT, - logging: false, - }); - if (!tablesCount[0]) { - console.error('未查询到表数量'); - return; - } - - console.log('数据库中的表数量:', tablesCount[0].table_count); - await sleep(2000); - } catch (error) { - console.error('查询表数量时出错:', error); - } -});