From 8ca6b77e4dcf3b01eb2e3862cfbcca8e7b066eda Mon Sep 17 00:00:00 2001 From: abearxiong Date: Wed, 25 Feb 2026 18:31:35 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E4=BF=9D=E6=8C=81?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E7=A9=BA=E9=97=B4=E5=AD=98=E6=B4=BB=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=EF=BC=8C=E7=A7=BB=E9=99=A4wsUrl=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E5=B9=B6=E5=9C=A8createLiveData=E4=B8=AD=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- agent/routes/workspace/keep.ts | 2 +- package.json | 2 +- src/workspace/keep-file-live.ts | 9 +++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/agent/routes/workspace/keep.ts b/agent/routes/workspace/keep.ts index 009334e..797df80 100644 --- a/agent/routes/workspace/keep.ts +++ b/agent/routes/workspace/keep.ts @@ -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 }; diff --git a/package.json b/package.json index 32df798..51cee99 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kevisual/cnb", - "version": "0.0.30", + "version": "0.0.31", "description": "", "main": "index.js", "scripts": { diff --git a/src/workspace/keep-file-live.ts b/src/workspace/keep-file-live.ts index 95bf286..f544b33 100644 --- a/src/workspace/keep-file-live.ts +++ b/src/workspace/keep-file-live.ts @@ -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 }; @@ -125,8 +126,8 @@ export class KeepAliveManager { static add(data: KeepAliveData) { 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); }