hocai-connect 0.12.0 → 0.13.0

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.
Files changed (2) hide show
  1. package/dist/cli.js +12 -2
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -39734,7 +39734,7 @@ var TOOLS = {
39734
39734
  ],
39735
39735
  WORK: ["Read", "Write", "Edit", "Glob", "Grep"]
39736
39736
  };
39737
- var VERSION = "0.12.0";
39737
+ var VERSION = "0.13.0";
39738
39738
  function claudeArgs(job, o, port) {
39739
39739
  const mcp = {
39740
39740
  mcpServers: {
@@ -39768,6 +39768,7 @@ function claudeArgs(job, o, port) {
39768
39768
  function buildHttpServer(o) {
39769
39769
  const spawn2 = o.spawn ?? import_node_child_process2.spawn;
39770
39770
  const dangChay = /* @__PURE__ */ new Set();
39771
+ const thuMucDaChon = /* @__PURE__ */ new Set();
39771
39772
  const json3 = (res, code, body) => {
39772
39773
  if (!res.headersSent) res.writeHead(code, { "content-type": "application/json" });
39773
39774
  res.end(JSON.stringify(body));
@@ -39882,6 +39883,12 @@ function buildHttpServer(o) {
39882
39883
  json3(res, 400, { error: "Th\u01B0 m\u1EE5c kh\xF4ng h\u1EE3p l\u1EC7" });
39883
39884
  return;
39884
39885
  }
39886
+ if (!thuMucDaChon.has(d)) {
39887
+ json3(res, 403, {
39888
+ error: "H\xE3y b\u1EA5m ch\u1ECDn th\u01B0 m\u1EE5c tr\u01B0\u1EDBc \u2014 m\xE1y ch\u1EC9 ch\u1EA1y trong th\u01B0 m\u1EE5c b\u1EA1n t\u1EF1 ch\u1ECDn."
39889
+ });
39890
+ return;
39891
+ }
39885
39892
  dir = d;
39886
39893
  }
39887
39894
  if (dangChay.has(dir)) {
@@ -39947,7 +39954,10 @@ function buildHttpServer(o) {
39947
39954
  return;
39948
39955
  }
39949
39956
  const mo = o.chooseFolder ?? chooseFolder;
39950
- void mo().then((dir) => json3(res, 200, { dir })).catch((e) => json3(res, 500, { error: e.message }));
39957
+ void mo().then((dir) => {
39958
+ if (dir) thuMucDaChon.add(dir);
39959
+ json3(res, 200, { dir });
39960
+ }).catch((e) => json3(res, 500, { error: e.message }));
39951
39961
  return;
39952
39962
  }
39953
39963
  if (path === "/jobs") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hocai-connect",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "Nối Claude trên máy học viên vào hocAI, và chạy việc AI ngay tại đó",
5
5
  "bin": {
6
6
  "hocai-connect": "bin.js"