feat: 更新版本号和依赖项,重构keepAliveFilePath路径以支持新的目录结构

This commit is contained in:
2026-02-28 04:15:06 +08:00
parent 8a6bb9bbe9
commit 5043392939
3 changed files with 23 additions and 23 deletions

View File

@@ -16,8 +16,8 @@ export type KeepAliveData = {
type KeepAliveCache = {
data: KeepAliveData[];
}
const keepAliveFilePath = path.join(os.homedir(), '.cnb/keepAliveCache.json');
const baseDir = path.join(os.homedir(), '.cnb', 'live');
const keepAliveFilePath = path.join(baseDir, 'keepAliveCache.json');
export const runLive = (filePath: string, pm2Name: string) => {
// 使用 npx 运行命令
@@ -109,7 +109,7 @@ export const createLiveData = (data: { cookie: string, repo: string, pipelineId:
const createdTime = Date.now();
const wsUrl = `wss://${pipelineId}.cnb.space:443?skipWebSocketFrames=false`;
const pm2Name = `keep_${repo}__${pipelineId}`.replace(/\//g, '__');
const filePath = path.join(os.homedir(), '.cnb', `${pm2Name}.json`);
const filePath = path.join(baseDir, `${pm2Name}.json`);
const _newData = { wss: wsUrl, wsUrl, cookie, repo, pipelineId, createdTime, filePath, pm2Name };
if (!fs.existsSync(path.dirname(filePath))) {
fs.mkdirSync(path.dirname(filePath), { recursive: true });