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

@@ -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);
}