update
This commit is contained in:
@@ -18,9 +18,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "tsx test/**/*.ts",
|
|
||||||
"dev": "bun run --watch --hot src/index.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 ",
|
"cmd": "bun run src/run.ts ",
|
||||||
"prebuild": "rimraf dist && rimraf pack-dist",
|
"prebuild": "rimraf dist && rimraf pack-dist",
|
||||||
"build": "NODE_ENV=production bun bun.config.mjs",
|
"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": "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",
|
"deploy:envision": "rsync -avz --delete ./pack-dist/ envision:~/kevisual/assistant-app/apps/root/code-center",
|
||||||
"clean": "rm -rf dist",
|
"clean": "rm -rf dist",
|
||||||
"reload": "ssh light pm2 restart code-center",
|
"reload": "ssh light pm2 restart root/code-center",
|
||||||
"reload:envision": "ssh envision pm2 restart code-center",
|
"reload:envision": "ssh envision pm2 restart root/code-center",
|
||||||
"pub:me": "npm run build && npm run deploy && npm run reload",
|
"pub:me": "npm run build && npm run deploy && npm run reload",
|
||||||
"pub:envision": "npm run build && npm run deploy:envision && npm run reload:envision",
|
"pub:envision": "npm run build && npm run deploy:envision && npm run reload:envision",
|
||||||
"start": "pm2 start dist/app.js --name code-center",
|
"start": "pm2 start dist/app.js --name code-center",
|
||||||
"client:start": "pm2 start apps/code-center/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": "ssh -L 5432:localhost:5432 light",
|
||||||
"ssl:redis": "ssh -L 6379:localhost:6379 light",
|
"ssl:redis": "ssh -L 6379:localhost:6379 light",
|
||||||
|
"ssl:minio": "ssh -L 9000:localhost:9000 light",
|
||||||
"pub": "envision pack -p -u -c"
|
"pub": "envision pack -p -u -c"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
@@ -109,5 +108,5 @@
|
|||||||
"sqlite3"
|
"sqlite3"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"packageManager": "pnpm@10.23.0"
|
"packageManager": "pnpm@10.24.0"
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,7 @@ import { getDNS, isIpv4OrIpv6, isLocalhost } from '../modules/fm-manager/index.t
|
|||||||
import http from 'node:http';
|
import http from 'node:http';
|
||||||
import https from 'node:https';
|
import https from 'node:https';
|
||||||
import { UserApp } from '../modules/user-app/index.ts';
|
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 path from 'node:path';
|
||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import { getContentType } from '../modules/fm-manager/index.ts';
|
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
|
// 提取req的headers中的非HOST的header
|
||||||
const headers = Object.keys(req.headers).filter((item) => item && item.toLowerCase() !== 'host');
|
const headers = Object.keys(req.headers).filter((item) => item && item.toLowerCase() !== 'host');
|
||||||
const host = req.headers['host'];
|
const host = req.headers['host'];
|
||||||
logger.info('proxy host', host);
|
logger.debug('proxy host', host);
|
||||||
logger.info('headers', headers);
|
logger.debug('headers', headers);
|
||||||
|
|
||||||
headers.forEach((item) => {
|
headers.forEach((item) => {
|
||||||
header[item] = req.headers[item];
|
header[item] = req.headers[item];
|
||||||
@@ -96,7 +96,7 @@ export const handleRequest = async (req: http.IncomingMessage, res: http.ServerR
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
options.port = _u.port;
|
options.port = _u.port;
|
||||||
}
|
}
|
||||||
logger.info('proxy options', options);
|
logger.debug('proxy options', options);
|
||||||
const isHttps = _u.protocol === 'https:';
|
const isHttps = _u.protocol === 'https:';
|
||||||
const protocol = isHttps ? https : http;
|
const protocol = isHttps ? https : http;
|
||||||
if (isHttps) {
|
if (isHttps) {
|
||||||
|
|||||||
@@ -23,18 +23,19 @@ export const installAppFromKey = async (key: string) => {
|
|||||||
if (fileIsExist(readmeFile)) {
|
if (fileIsExist(readmeFile)) {
|
||||||
readmeDesc = fs.readFileSync(readmeFile, 'utf-8');
|
readmeDesc = fs.readFileSync(readmeFile, 'utf-8');
|
||||||
}
|
}
|
||||||
|
const { type = 'system-app', entry = '', engine = undefined, pm2Options = {}, ...rest } = app;
|
||||||
let showAppInfo = {
|
let showAppInfo = {
|
||||||
key,
|
key,
|
||||||
status: 'inactive' as const,
|
status: 'inactive' as const,
|
||||||
type: app?.type || 'system-app',
|
type,
|
||||||
description: readmeDesc || '',
|
description: readmeDesc || '',
|
||||||
version,
|
version,
|
||||||
//
|
entry,
|
||||||
entry: app?.entry || '',
|
|
||||||
path: directory,
|
path: directory,
|
||||||
engine: app?.engine,
|
engine,
|
||||||
pm2Options: app?.pm2Options || {},
|
pm2Options,
|
||||||
origin: app,
|
origin: app,
|
||||||
|
...rest,
|
||||||
};
|
};
|
||||||
app.key = key;
|
app.key = key;
|
||||||
fs.writeFileSync(pkgs, JSON.stringify(pkg, null, 2));
|
fs.writeFileSync(pkgs, JSON.stringify(pkg, null, 2));
|
||||||
|
|||||||
@@ -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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user