feat: 更新保持工作空间存活功能,移除wsUrl参数并在createLiveData中生成

This commit is contained in:
2026-02-25 18:31:35 +08:00
parent d3286e2766
commit 8ca6b77e4d
3 changed files with 7 additions and 6 deletions

View File

@@ -40,7 +40,7 @@ app.route({
console.log(`启动保持工作空间 ${wsUrl} 存活的任务`);
const config: KeepAliveData = createLiveData({ wsUrl, cookie, repo, pipelineId });
const config: KeepAliveData = createLiveData({ cookie, repo, pipelineId });
addKeepAliveData(config);
ctx.body = { content: `已启动保持工作空间 ${wsUrl} 存活的任务`, data: config };

View File

@@ -1,6 +1,6 @@
{
"name": "@kevisual/cnb",
"version": "0.0.30",
"version": "0.0.31",
"description": "",
"main": "index.js",
"scripts": {

View File

@@ -104,9 +104,10 @@ export function removeKeepAliveData(repo: string, pipelineId: string): KeepAlive
}
}
export const createLiveData = (data: { wsUrl: string, cookie: string, repo: string, pipelineId: string }): KeepAliveData => {
const { wsUrl, cookie, repo, pipelineId } = data;
export const createLiveData = (data: { cookie: string, repo: string, pipelineId: string }): KeepAliveData => {
const { cookie, repo, pipelineId } = data;
const createdTime = Date.now();
const wsUrl = `wss://${pipelineId}.cnb.space:443?skipWebSocketFrames=false`;
const pm2Name = `${repo}__${pipelineId}`.replace(/\//g, '__');
const filePath = path.join(os.homedir(), '.cnb', `${pm2Name}.json`);
const _newData = { wss: wsUrl, wsUrl, cookie, repo, pipelineId, createdTime, filePath, pm2Name };
@@ -126,7 +127,7 @@ export class KeepAliveManager {
return addKeepAliveData(data);
}
static createLiveData(data: { wsUrl: string, cookie: string, repo: string, pipelineId: string }): KeepAliveData {
static createLiveData(data: { cookie: string, repo: string, pipelineId: string }): KeepAliveData {
return createLiveData(data);
}