node-karin 1.10.9 → 1.10.10

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # 更新日志
2
2
 
3
+ ## [1.10.10](https://github.com/KarinJS/Karin/compare/core-v1.10.9...core-v1.10.10) (2025-06-17)
4
+
5
+
6
+ ### 🐛 Bug Fixes
7
+
8
+ * 修正前端配置保存判断失败 ([f419144](https://github.com/KarinJS/Karin/commit/f41914408f7871695adbf2f9956265e45ad8bead))
9
+
3
10
  ## [1.10.9](https://github.com/KarinJS/Karin/compare/core-v1.10.8...core-v1.10.9) (2025-06-16)
4
11
 
5
12
 
package/dist/index.mjs CHANGED
@@ -20443,7 +20443,7 @@ var init_ping = __esm({
20443
20443
  };
20444
20444
  }
20445
20445
  });
20446
- var fileExists, getWebConfigPathFromPkg, getNpmPluginConfigPath, getLocalPluginConfigPath, getConfigPath, loadConfig, getWebConfig, normalizeAuthor, pluginGetConfig, pluginSaveConfig, pluginIsConfigExist;
20446
+ var fileExists, getWebConfigPathFromPkg, getNpmPluginConfigPath, getLocalPluginConfigPath, getConfigPath, loadConfig, getWebConfig, normalizeAuthor, pluginGetConfig, pluginSaveConfig, pluginIsConfigExist, getPluginType;
20447
20447
  var init_config4 = __esm({
20448
20448
  "src/server/plugins/config.ts"() {
20449
20449
  init_env2();
@@ -20533,13 +20533,13 @@ var init_config4 = __esm({
20533
20533
  }
20534
20534
  return null;
20535
20535
  };
20536
- getConfigPath = (options) => {
20536
+ getConfigPath = (type, name) => {
20537
20537
  try {
20538
- switch (options.type) {
20538
+ switch (type) {
20539
20539
  case "npm":
20540
- return getNpmPluginConfigPath(options.name);
20540
+ return getNpmPluginConfigPath(name);
20541
20541
  case "git":
20542
- return getLocalPluginConfigPath(options.name);
20542
+ return getLocalPluginConfigPath(name);
20543
20543
  default:
20544
20544
  return null;
20545
20545
  }
@@ -20560,7 +20560,7 @@ var init_config4 = __esm({
20560
20560
  if (!["git", "npm"].includes(type)) {
20561
20561
  return null;
20562
20562
  }
20563
- const webConfig = getConfigPath({ type, name: id });
20563
+ const webConfig = getConfigPath(type, id);
20564
20564
  if (!webConfig) {
20565
20565
  return null;
20566
20566
  }
@@ -20609,20 +20609,9 @@ var init_config4 = __esm({
20609
20609
  createServerErrorResponse(res, "\u53C2\u6570\u9519\u8BEF");
20610
20610
  return;
20611
20611
  }
20612
- const type = await (async () => {
20613
- const list3 = await getPlugins("all", false);
20614
- const npmName = `npm:${options.name}`;
20615
- const gitName = `git:${options.name}`;
20616
- const rootName = `root:${options.name}`;
20617
- for (const item of list3) {
20618
- if (item === npmName) return "npm";
20619
- if (item === gitName) return "git";
20620
- if (item === rootName) return "npm";
20621
- }
20622
- return "git";
20623
- })();
20624
- options.type = type;
20625
- const config3 = await getWebConfig(options.type, options.name, () => {
20612
+ const type = await getPluginType(options.name);
20613
+ if (!type) return createServerErrorResponse(res, "\u53C2\u6570\u9519\u8BEF");
20614
+ const config3 = await getWebConfig(type, options.name, () => {
20626
20615
  logger.error(`[plugin] \u63D2\u4EF6${options.name}\u7684web\u914D\u7F6E\u6587\u4EF6\u540D\u79F0\u4E0D\u6B63\u786E: \u9700\u8981\u4EE5 web.config \u547D\u540D`);
20627
20616
  createSuccessResponse(res, null);
20628
20617
  });
@@ -20654,22 +20643,40 @@ var init_config4 = __esm({
20654
20643
  createSuccessResponse(res, data);
20655
20644
  };
20656
20645
  pluginSaveConfig = async (req, res) => {
20657
- const options = req.body;
20658
- const configPath2 = getConfigPath(options);
20646
+ const { name, config: config3 } = req.body;
20647
+ const type = await getPluginType(name);
20648
+ if (!type) return createServerErrorResponse(res, "\u53C2\u6570\u9519\u8BEF");
20649
+ const configPath2 = getConfigPath(type, name);
20659
20650
  if (!configPath2) return createServerErrorResponse(res, "\u53C2\u6570\u9519\u8BEF");
20660
20651
  const { save: save2 } = await loadConfig(configPath2);
20661
20652
  if (typeof save2 !== "function") {
20662
20653
  return createServerErrorResponse(res, "\u8BE5\u63D2\u4EF6\u672A\u63D0\u4F9B\u9ED8\u8BA4\u7EC4\u4EF6\u4FDD\u5B58\u5B8C\u6210");
20663
20654
  }
20664
- const result = save2(options.config);
20655
+ const result = save2(config3);
20665
20656
  const response = util5.types.isPromise(result) ? await result : result;
20666
20657
  createSuccessResponse(res, response || { success: true, message: "\u6CA1\u6709\u8FD4\u56DE\u503C\u54E6 \u03C6(>\u03C9<*) " });
20667
20658
  };
20668
20659
  pluginIsConfigExist = async (req, res) => {
20669
- const options = req.body;
20670
- const configPath2 = getConfigPath(options);
20660
+ const name = req.body.name;
20661
+ const type = await getPluginType(name);
20662
+ if (!name || !type) {
20663
+ return createServerErrorResponse(res, "\u53C2\u6570\u9519\u8BEF");
20664
+ }
20665
+ const configPath2 = getConfigPath(type, name);
20671
20666
  createSuccessResponse(res, typeof configPath2 === "string");
20672
20667
  };
20668
+ getPluginType = async (name) => {
20669
+ const list2 = await getPlugins("all", false);
20670
+ const npmName = `npm:${name}`;
20671
+ const gitName = `git:${name}`;
20672
+ const rootName = `root:${name}`;
20673
+ for (const item of list2) {
20674
+ if (item === npmName) return "npm";
20675
+ if (item === gitName) return "git";
20676
+ if (item === rootName) return "npm";
20677
+ }
20678
+ return null;
20679
+ };
20673
20680
  }
20674
20681
  });
20675
20682
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-karin",
3
- "version": "1.10.9",
3
+ "version": "1.10.10",
4
4
  "description": "Lightweight, efficient, concise, and stable robot framework.",
5
5
  "keywords": [
6
6
  "node",