hocai-connect 0.11.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 +29 -6
  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.11.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)) {
@@ -39927,7 +39934,13 @@ function buildHttpServer(o) {
39927
39934
  res.writeHead(204).end();
39928
39935
  return;
39929
39936
  }
39930
- json3(res, 200, { ten: "hocai-connect", phienBan: VERSION, user: o.me() });
39937
+ const me = o.me();
39938
+ const hoi = new URL(req.url ?? "/", "http://x").searchParams.get("user");
39939
+ json3(res, 200, {
39940
+ ten: "hocai-connect",
39941
+ phienBan: VERSION,
39942
+ user: me ? { ten: me.ten, ...hoi ? { khop: hoi === me.id } : {} } : me
39943
+ });
39931
39944
  return;
39932
39945
  }
39933
39946
  if (path === "/choose-folder") {
@@ -39941,7 +39954,10 @@ function buildHttpServer(o) {
39941
39954
  return;
39942
39955
  }
39943
39956
  const mo = o.chooseFolder ?? chooseFolder;
39944
- 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 }));
39945
39961
  return;
39946
39962
  }
39947
39963
  if (path === "/jobs") {
@@ -40249,9 +40265,16 @@ function defaultOrigins(env) {
40249
40265
  "https://camerasrent.com",
40250
40266
  "https://www.camerasrent.com",
40251
40267
  // Giữ lại cho tới khi không còn helper nào trỏ vào đây nữa.
40252
- "http://103.154.62.225:8090",
40253
- "http://localhost:5173",
40254
- "http://localhost:5174"
40268
+ "http://103.154.62.225:8090"
40269
+ // KHÔNG có localhost ở đây, và đây là chốt chứ không phải thiếu sót.
40270
+ //
40271
+ // 5173 là cổng MẶC ĐỊNH của Vite. Gói này chạy trên máy học viên, mà họ
40272
+ // đang học lập trình — bất kỳ dự án Vite nào họ mở cũng thành một gốc hợp
40273
+ // lệ, và trang đó chiếm được cầu nối trên máy họ.
40274
+ //
40275
+ // Người phát triển hocAI đặt `HOCAI_WEB_ORIGINS` là xong (xem script
40276
+ // `dev:mcp:http`). Học viên thì không có cách nào gỡ một gốc đã nướng sẵn
40277
+ // vào gói.
40255
40278
  ];
40256
40279
  }
40257
40280
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hocai-connect",
3
- "version": "0.11.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"