@kevisual/cnb 0.0.36 → 0.0.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36,7 +36,7 @@ app.route({
36
36
  cloudreve: uri.replace('{{port}}', '5212'),
37
37
  filebrowser: uri.replace('{{port}}', '8081'),
38
38
  // newapi: uri.replace('{{port}}', '8080'),
39
- vscode: useKey('CNB_VSCODE_PROXY_URI') as string || '',
39
+ vscode: useKey('CNB_VSCODE_WEB_URL') as string || '',
40
40
  codeServer: uri.replace('{{port}}', '10000'),
41
41
  gitea: uri.replace('{{port}}', '3000'),
42
42
  calibre: uri.replace('{{port}}', '8083'),
@@ -30,21 +30,20 @@ app.route({
30
30
  ctx.throw(401, 'CNB_COOKIE 环境变量无效或已过期,请重新登录获取新的cookie');
31
31
  }
32
32
  const res = await cnb.workspace.getWorkspaceCookie(repo, pipelineId);
33
- let wsUrl = `wss://${pipelineId}.cnb.space:443?skipWebSocketFrames=false`;
34
- let cookie = '';
35
- if (res.code === 200) {
36
- cookie = res.data.value;
37
- console.log(`启动保持工作空间 ${wsUrl} 存活的任务`);
38
- } else {
39
- ctx.throw(500, `获取工作空间访问cookie失败: ${res.message}`);
33
+ if (res.code !== 200 || !res.data?.cookie) {
34
+ ctx.throw(500, `获取工作空间 Cookie 失败: ${res.message}`);
40
35
  }
41
36
 
42
- console.log(`启动保持工作空间 ${wsUrl} 存活的任务`);
37
+ // 添加保活数据
38
+ const liveData = createLiveData({
39
+ repo,
40
+ pipelineId,
41
+ cookie: res.data.cookie
42
+ });
43
+ addKeepAliveData(liveData);
44
+ console.log('已添加 keep-alive 数据');
43
45
 
44
- const config: KeepAliveData = createLiveData({ cookie, repo, pipelineId });
45
- addKeepAliveData(config);
46
-
47
- ctx.body = { content: `已启动保持工作空间 ${wsUrl} 存活的任务`, data: config };
46
+ ctx.body = { content: `已启动保持工作空间 ${repo}/${pipelineId} 存活的任务`, data: liveData };
48
47
  }).addTo(app);
49
48
 
50
49
  // 停止保持工作空间存活技能
package/dist/cli.js CHANGED
@@ -36379,18 +36379,17 @@ app.route({
36379
36379
  ctx.throw(401, "CNB_COOKIE 环境变量无效或已过期,请重新登录获取新的cookie");
36380
36380
  }
36381
36381
  const res = await cnb.workspace.getWorkspaceCookie(repo2, pipelineId);
36382
- let wsUrl = `wss://${pipelineId}.cnb.space:443?skipWebSocketFrames=false`;
36383
- let cookie = "";
36384
- if (res.code === 200) {
36385
- cookie = res.data.value;
36386
- console.log(`启动保持工作空间 ${wsUrl} 存活的任务`);
36387
- } else {
36388
- ctx.throw(500, `获取工作空间访问cookie失败: ${res.message}`);
36382
+ if (res.code !== 200 || !res.data?.cookie) {
36383
+ ctx.throw(500, `获取工作空间 Cookie 失败: ${res.message}`);
36389
36384
  }
36390
- console.log(`启动保持工作空间 ${wsUrl} 存活的任务`);
36391
- const config4 = createLiveData({ cookie, repo: repo2, pipelineId });
36392
- addKeepAliveData(config4);
36393
- ctx.body = { content: `已启动保持工作空间 ${wsUrl} 存活的任务`, data: config4 };
36385
+ const liveData = createLiveData({
36386
+ repo: repo2,
36387
+ pipelineId,
36388
+ cookie: res.data.cookie
36389
+ });
36390
+ addKeepAliveData(liveData);
36391
+ console.log("已添加 keep-alive 数据");
36392
+ ctx.body = { content: `已启动保持工作空间 ${repo2}/${pipelineId} 存活的任务`, data: liveData };
36394
36393
  }).addTo(app);
36395
36394
  app.route({
36396
36395
  path: "cnb",
@@ -57686,7 +57685,7 @@ app.route({
57686
57685
  homeassistant: uri.replace("{{port}}", "8123"),
57687
57686
  cloudreve: uri.replace("{{port}}", "5212"),
57688
57687
  filebrowser: uri.replace("{{port}}", "8081"),
57689
- vscode: useKey("CNB_VSCODE_PROXY_URI") || "",
57688
+ vscode: useKey("CNB_VSCODE_WEB_URL") || "",
57690
57689
  codeServer: uri.replace("{{port}}", "10000"),
57691
57690
  gitea: uri.replace("{{port}}", "3000"),
57692
57691
  calibre: uri.replace("{{port}}", "8083"),
package/dist/opencode.js CHANGED
@@ -34284,18 +34284,17 @@ app.route({
34284
34284
  ctx.throw(401, "CNB_COOKIE 环境变量无效或已过期,请重新登录获取新的cookie");
34285
34285
  }
34286
34286
  const res = await cnb.workspace.getWorkspaceCookie(repo2, pipelineId);
34287
- let wsUrl = `wss://${pipelineId}.cnb.space:443?skipWebSocketFrames=false`;
34288
- let cookie = "";
34289
- if (res.code === 200) {
34290
- cookie = res.data.value;
34291
- console.log(`启动保持工作空间 ${wsUrl} 存活的任务`);
34292
- } else {
34293
- ctx.throw(500, `获取工作空间访问cookie失败: ${res.message}`);
34287
+ if (res.code !== 200 || !res.data?.cookie) {
34288
+ ctx.throw(500, `获取工作空间 Cookie 失败: ${res.message}`);
34294
34289
  }
34295
- console.log(`启动保持工作空间 ${wsUrl} 存活的任务`);
34296
- const config4 = createLiveData({ cookie, repo: repo2, pipelineId });
34297
- addKeepAliveData(config4);
34298
- ctx.body = { content: `已启动保持工作空间 ${wsUrl} 存活的任务`, data: config4 };
34290
+ const liveData = createLiveData({
34291
+ repo: repo2,
34292
+ pipelineId,
34293
+ cookie: res.data.cookie
34294
+ });
34295
+ addKeepAliveData(liveData);
34296
+ console.log("已添加 keep-alive 数据");
34297
+ ctx.body = { content: `已启动保持工作空间 ${repo2}/${pipelineId} 存活的任务`, data: liveData };
34299
34298
  }).addTo(app);
34300
34299
  app.route({
34301
34300
  path: "cnb",
@@ -55591,7 +55590,7 @@ app.route({
55591
55590
  homeassistant: uri.replace("{{port}}", "8123"),
55592
55591
  cloudreve: uri.replace("{{port}}", "5212"),
55593
55592
  filebrowser: uri.replace("{{port}}", "8081"),
55594
- vscode: useKey("CNB_VSCODE_PROXY_URI") || "",
55593
+ vscode: useKey("CNB_VSCODE_WEB_URL") || "",
55595
55594
  codeServer: uri.replace("{{port}}", "10000"),
55596
55595
  gitea: uri.replace("{{port}}", "3000"),
55597
55596
  calibre: uri.replace("{{port}}", "8083"),
package/dist/routes.js CHANGED
@@ -34284,18 +34284,17 @@ app.route({
34284
34284
  ctx.throw(401, "CNB_COOKIE 环境变量无效或已过期,请重新登录获取新的cookie");
34285
34285
  }
34286
34286
  const res = await cnb.workspace.getWorkspaceCookie(repo2, pipelineId);
34287
- let wsUrl = `wss://${pipelineId}.cnb.space:443?skipWebSocketFrames=false`;
34288
- let cookie = "";
34289
- if (res.code === 200) {
34290
- cookie = res.data.value;
34291
- console.log(`启动保持工作空间 ${wsUrl} 存活的任务`);
34292
- } else {
34293
- ctx.throw(500, `获取工作空间访问cookie失败: ${res.message}`);
34287
+ if (res.code !== 200 || !res.data?.cookie) {
34288
+ ctx.throw(500, `获取工作空间 Cookie 失败: ${res.message}`);
34294
34289
  }
34295
- console.log(`启动保持工作空间 ${wsUrl} 存活的任务`);
34296
- const config4 = createLiveData({ cookie, repo: repo2, pipelineId });
34297
- addKeepAliveData(config4);
34298
- ctx.body = { content: `已启动保持工作空间 ${wsUrl} 存活的任务`, data: config4 };
34290
+ const liveData = createLiveData({
34291
+ repo: repo2,
34292
+ pipelineId,
34293
+ cookie: res.data.cookie
34294
+ });
34295
+ addKeepAliveData(liveData);
34296
+ console.log("已添加 keep-alive 数据");
34297
+ ctx.body = { content: `已启动保持工作空间 ${repo2}/${pipelineId} 存活的任务`, data: liveData };
34299
34298
  }).addTo(app);
34300
34299
  app.route({
34301
34300
  path: "cnb",
@@ -55591,7 +55590,7 @@ app.route({
55591
55590
  homeassistant: uri.replace("{{port}}", "8123"),
55592
55591
  cloudreve: uri.replace("{{port}}", "5212"),
55593
55592
  filebrowser: uri.replace("{{port}}", "8081"),
55594
- vscode: useKey("CNB_VSCODE_PROXY_URI") || "",
55593
+ vscode: useKey("CNB_VSCODE_WEB_URL") || "",
55595
55594
  codeServer: uri.replace("{{port}}", "10000"),
55596
55595
  gitea: uri.replace("{{port}}", "3000"),
55597
55596
  calibre: uri.replace("{{port}}", "8083"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kevisual/cnb",
3
- "version": "0.0.36",
3
+ "version": "0.0.37",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {