node-karin 1.8.8 → 1.8.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.
Files changed (29) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +95 -0
  3. package/dist/index.d.ts +17 -2
  4. package/dist/index.mjs +66 -49
  5. package/dist/web/assets/js/components-9RKTV4LX.js.br +0 -0
  6. package/dist/web/assets/js/entry-CzDSdA4M.js.br +0 -0
  7. package/dist/web/assets/js/hooks-D65eaS4p.js.br +0 -0
  8. package/dist/web/assets/js/page-404.tsx-BNti6Z2J.js +1 -0
  9. package/dist/web/assets/js/page-dashboard-BewrlGFW.js.br +0 -0
  10. package/dist/web/assets/js/page-loading.tsx-CJaYj8cR.js.br +0 -0
  11. package/dist/web/assets/js/page-login.tsx-DkO-XzeU.js.br +0 -0
  12. package/dist/web/assets/js/{utils-BewWhq0h.js → utils-DqFE1yN-.js} +1 -1
  13. package/dist/web/assets/js/vendor-heroui-WfpTlnyv.js.br +0 -0
  14. package/dist/web/assets/js/vendor-others-B6NXaB-r.js.br +0 -0
  15. package/dist/web/assets/js/vendor-react-Hg1DVPZt.js.br +0 -0
  16. package/dist/web/assets/js/vendor-visual-mzxhMYK3.js.br +0 -0
  17. package/dist/web/index.html +9 -9
  18. package/package.json +3 -2
  19. package/dist/web/assets/js/components-CLB7wkmN.js.br +0 -0
  20. package/dist/web/assets/js/entry-T2jwWprd.js.br +0 -0
  21. package/dist/web/assets/js/hooks-DGvDG8bg.js.br +0 -0
  22. package/dist/web/assets/js/page-404.tsx-rh3UIlox.js +0 -1
  23. package/dist/web/assets/js/page-dashboard-BIzbCQc5.js.br +0 -0
  24. package/dist/web/assets/js/page-loading.tsx-Cz1_t9kn.js.br +0 -0
  25. package/dist/web/assets/js/page-login.tsx-CU4MLQqo.js.br +0 -0
  26. package/dist/web/assets/js/vendor-heroui-DwwsJlXF.js.br +0 -0
  27. package/dist/web/assets/js/vendor-others-D7Rwl1O6.js.br +0 -0
  28. package/dist/web/assets/js/vendor-react-BDRVXu1f.js.br +0 -0
  29. package/dist/web/assets/js/vendor-visual-BMhnpZxY.js.br +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # 更新日志
2
2
 
3
+ ## [1.8.10](https://github.com/KarinJS/Karin/compare/core-v1.8.9...core-v1.8.10) (2025-05-08)
4
+
5
+
6
+ ### 🐛 Bug Fixes
7
+
8
+ * close [#408](https://github.com/KarinJS/Karin/issues/408) ([#409](https://github.com/KarinJS/Karin/issues/409)) ([8c78b4a](https://github.com/KarinJS/Karin/commit/8c78b4a753a791248ab752e2a8426ff82eb467d5))
9
+
10
+ ## [1.8.9](https://github.com/KarinJS/Karin/compare/core-v1.8.8...core-v1.8.9) (2025-05-07)
11
+
12
+
13
+ ### 🐛 Bug Fixes
14
+
15
+ * 修复`web-config`读取的是缓存 ([#405](https://github.com/KarinJS/Karin/issues/405)) ([3335cef](https://github.com/KarinJS/Karin/commit/3335cefc70b811e11084f4cee1a87c8602ae6838))
16
+
3
17
  ## [1.8.8](https://github.com/KarinJS/Karin/compare/core-v1.8.7...core-v1.8.8) (2025-05-07)
4
18
 
5
19
 
package/README.md ADDED
@@ -0,0 +1,95 @@
1
+ ![karin](https://socialify.git.ci/karinjs/karin/image?description=1&font=Bitter&forks=1&issues=1&language=1&logo=https%3A%2F%2Favatars.githubusercontent.com%2Fu%2F162426977%3Fs%3D200%26v%3D4&name=1&owner=1&pulls=1&stargazers=1&theme=Auto)
2
+
3
+ ## 项目介绍
4
+
5
+ `karin`(卡琳)是一款灵活、现代、极易扩展的 Node.js 插件化应用框架,专为开发者打造,助你轻松构建属于自己的高效工具链和自动化服务。
6
+
7
+ ✨ **主要特性**:
8
+ - 插件化架构,支持热插拔,生态丰富
9
+ - 一行命令即可初始化项目,快速上手
10
+ - 丰富的 Web UI(基于 React + HeroUI),颜值与功能并存
11
+ - 支持多种自动化场景、任务调度、依赖管理
12
+ - 轻松集成第三方服务,打造属于你的"数字助理"
13
+ - 社区活跃,持续更新,文档完善
14
+
15
+ > 🦄 让开发变得像魔法一样有趣!
16
+
17
+ ## 🚀 稳定长期维护
18
+
19
+ 自 `1.8.0` 版本起,Karin 已进入**稳定长期维护阶段**。我们承诺持续修复 bug、优化体验,并欢迎社区力量共同完善生态。
20
+
21
+ ## 快速开始
22
+
23
+ [📚 查看最新文档](https://karin.fun/)
24
+
25
+ 一键初始化:`pnpm create karin`
26
+
27
+ > 当前文档可能存在滞后性,欢迎加入交流群(967068507)一起玩耍、提建议!
28
+
29
+ ## 温馨提示
30
+
31
+ > Karin 现已稳定,放心食用!遇到问题欢迎提 Issue 或加群讨论,我们会持续优化。
32
+
33
+ ## 文档站说明
34
+
35
+ 我们提供多个文档站点供您访问,解决可能出现的访问困难:
36
+
37
+ - **主文档站**: [https://karin.fun](https://karin.fun) (基于 GitHub Pages)
38
+ - **镜像站点**:
39
+ - 憨憨镜像: [https://karin.hanhanz.top](https://karin.hanhanz.top) (**推荐访问**)
40
+ - Vercel 镜像: [https://docs.karin.fun](https://docs.karin.fun) (**推荐访问**)
41
+ - Deno 镜像: [https://karin.deno.dev](https://karin.deno.dev) (**推荐访问**)
42
+
43
+ > 💡 主文档站托管在 GitHub 上,如访问不畅,推荐使用 Deno 镜像站
44
+
45
+ ## 鸣谢
46
+
47
+ - webui: [bietiaop](https://github.com/bietiaop)
48
+ - docs: [ikenxuan](https://github.com/ikenxuan)
49
+ - name: [fuqiuluo](https://github.com/fuqiuluo)
50
+
51
+ > 🧙‍♂️ 感谢三位大佬的魔法加持!
52
+
53
+ ### 贡献者
54
+
55
+ > 🌟 星光闪烁,你们的智慧如同璀璨的夜空。感谢所有为 **Karin** 做出贡献的人!
56
+
57
+ [![贡献者](https://contributors-img.web.app/image?repo=KarinJS/Karin)](https://github.com/KarinJS/Karin/graphs/contributors)
58
+
59
+ ![Alt](https://repobeats.axiom.co/api/embed/aaaa2759c8885691443a4d80e5753f975d4f250e.svg "Repobeats analytics image")
60
+
61
+ ---
62
+
63
+ 🎉 **加入我们,让 Karin 成为你开发路上的贴心伙伴!**
64
+
65
+ ## 常见问题
66
+
67
+ - 文档没看懂?[点我提问](https://github.com/KarinJS/Karin/issues) 或加群 967068507
68
+ - 插件不会写?欢迎参考[插件开发文档](https://karin.fun/plugins/)
69
+ - 遇到 bug?大胆提 Issue,我们超快响应!
70
+
71
+ ## 如何参与贡献(PR)
72
+
73
+ 1. Fork 本仓库,创建你的分支
74
+ 2. 提交你的更改,附上简要说明
75
+ 3. 发起 Pull Request,耐心等待 Review
76
+ 4. 你的名字将出现在贡献者列表,收获一份开源荣誉!
77
+
78
+ > 💡 欢迎任何形式的贡献,无论是代码、文档、建议还是灵感!
79
+
80
+ ## Issue 指南
81
+
82
+ - 提交前请先搜索是否有类似问题
83
+ - 尽量提供详细的复现步骤、环境信息和截图
84
+ - 标题简明扼要,正文描述清晰
85
+ - 遇到安全相关问题请私信维护者
86
+
87
+ ## 开源协议
88
+
89
+ 本项目基于 [MIT License](./LICENSE) 开源,欢迎自由使用、修改和分发。
90
+
91
+ > 📢 记得给个 Star 支持我们,你的支持是我们最大的动力!
92
+
93
+ ## 更新日志
94
+
95
+ 我们定期发布更新,查看 [CHANGELOG](https://github.com/KarinJS/Karin/releases) 了解最新变化。
package/dist/index.d.ts CHANGED
@@ -11347,8 +11347,9 @@ declare const restart: (selfId: string, contact: Contact, messageId: string, isF
11347
11347
  }>;
11348
11348
  /**
11349
11349
  * 直接重启
11350
+ * @param isPm2 - 是否为pm2重启 默认false
11350
11351
  */
11351
- declare const restartDirect: () => Promise<void>;
11352
+ declare const restartDirect: (isPm2?: boolean) => Promise<void>;
11352
11353
 
11353
11354
  /** fileToUrl Handler键 */
11354
11355
  declare const fileToUrlHandlerKey = "fileToUrl";
@@ -12274,6 +12275,12 @@ declare const getGroupCfg: (groupId: string, selfId: string) => Groups[number];
12274
12275
  * @param selfId 机器人ID
12275
12276
  */
12276
12277
  declare const getGuildCfg: (guildId: string, channelId: string, selfId: string) => Groups[number];
12278
+ /**
12279
+ * @web 获取配置文件 不走缓存
12280
+ * @param dir 配置文件根目录
12281
+ * @returns 配置文件数据
12282
+ */
12283
+ declare const getGroupsFileData: (dir: string) => Record<string, GroupsObjectValue>;
12277
12284
 
12278
12285
  /**
12279
12286
  * @public 公开Api
@@ -12295,6 +12302,12 @@ declare const getFriendCfg: (userId: string, selfId: string) => PrivatesObjectVa
12295
12302
  * @param selfId 机器人ID
12296
12303
  */
12297
12304
  declare const getDirectCfg: (userId: string, selfId: string) => PrivatesObjectValue;
12305
+ /**
12306
+ * @web 获取配置文件 不走缓存
12307
+ * @param dir 配置文件根目录
12308
+ * @returns 配置文件数据
12309
+ */
12310
+ declare const getPrivatesFileData: (dir: string) => Record<string, PrivatesObjectValue>;
12298
12311
 
12299
12312
  /**
12300
12313
  * @public 公开Api
@@ -12345,7 +12358,9 @@ declare const index_getDirectCfg: typeof getDirectCfg;
12345
12358
  declare const index_getEnv: typeof getEnv;
12346
12359
  declare const index_getFriendCfg: typeof getFriendCfg;
12347
12360
  declare const index_getGroupCfg: typeof getGroupCfg;
12361
+ declare const index_getGroupsFileData: typeof getGroupsFileData;
12348
12362
  declare const index_getGuildCfg: typeof getGuildCfg;
12363
+ declare const index_getPrivatesFileData: typeof getPrivatesFileData;
12349
12364
  declare const index_getRenderCfg: typeof getRenderCfg;
12350
12365
  declare const index_getYaml: typeof getYaml;
12351
12366
  declare const index_groups: typeof groups;
@@ -12366,7 +12381,7 @@ declare const index_updateLevel: typeof updateLevel;
12366
12381
  declare const index_webSocketServerToken: typeof webSocketServerToken;
12367
12382
  declare const index_writeEnv: typeof writeEnv;
12368
12383
  declare namespace index {
12369
- export { index_adapter as adapter, index_admin as admin, index_authKey as authKey, index_clearCache as clearCache, index_clearFiles as clearFiles, index_config as config, index_createCount as createCount, index_defaultConfig as defaultConfig, index_env as env, index_ffmpegPath as ffmpegPath, index_ffplayPath as ffplayPath, index_ffprobePath as ffprobePath, index_formatArray as formatArray, index_formatObject as formatObject, index_getCacheCfg as getCacheCfg, index_getDirectCfg as getDirectCfg, index_getEnv as getEnv, index_getFriendCfg as getFriendCfg, index_getGroupCfg as getGroupCfg, index_getGuildCfg as getGuildCfg, index_getRenderCfg as getRenderCfg, index_getYaml as getYaml, index_groups as groups, index_host as host, index_initConfigCache as initConfigCache, index_initPm2 as initPm2, index_master as master, index_mergeDegAndCfg as mergeDegAndCfg, index_pkg as pkg, index_pm2 as pm2, index_port as port, index_privates as privates, redis$1 as redis, render$1 as render, index_setConfig as setConfig, index_setEnv as setEnv, index_setYaml as setYaml, index_timeout as timeout, index_updateLevel as updateLevel, index_webSocketServerToken as webSocketServerToken, index_writeEnv as writeEnv };
12384
+ export { index_adapter as adapter, index_admin as admin, index_authKey as authKey, index_clearCache as clearCache, index_clearFiles as clearFiles, index_config as config, index_createCount as createCount, index_defaultConfig as defaultConfig, index_env as env, index_ffmpegPath as ffmpegPath, index_ffplayPath as ffplayPath, index_ffprobePath as ffprobePath, index_formatArray as formatArray, index_formatObject as formatObject, index_getCacheCfg as getCacheCfg, index_getDirectCfg as getDirectCfg, index_getEnv as getEnv, index_getFriendCfg as getFriendCfg, index_getGroupCfg as getGroupCfg, index_getGroupsFileData as getGroupsFileData, index_getGuildCfg as getGuildCfg, index_getPrivatesFileData as getPrivatesFileData, index_getRenderCfg as getRenderCfg, index_getYaml as getYaml, index_groups as groups, index_host as host, index_initConfigCache as initConfigCache, index_initPm2 as initPm2, index_master as master, index_mergeDegAndCfg as mergeDegAndCfg, index_pkg as pkg, index_pm2 as pm2, index_port as port, index_privates as privates, redis$1 as redis, render$1 as render, index_setConfig as setConfig, index_setEnv as setEnv, index_setYaml as setYaml, index_timeout as timeout, index_updateLevel as updateLevel, index_webSocketServerToken as webSocketServerToken, index_writeEnv as writeEnv };
12370
12385
  }
12371
12386
 
12372
12387
  /**
package/dist/index.mjs CHANGED
@@ -4648,7 +4648,7 @@ var init_handler = __esm({
4648
4648
  init_lock();
4649
4649
  init_internal();
4650
4650
  init_common();
4651
- log2 = (userId, text2) => logger.debug(`[\u6D88\u606F\u8FC7\u6EE4][${userId}] ${text2}`);
4651
+ log2 = (logText, text2) => logger.debug(`[\u6D88\u606F\u8FC7\u6EE4]${logText} ${text2}`);
4652
4652
  initMsg = (ctx3) => {
4653
4653
  const { msg, raw: raw2 } = createRawMessage(ctx3.elements);
4654
4654
  ctx3.msg = msg;
@@ -4719,27 +4719,28 @@ var init_handler = __esm({
4719
4719
  return true;
4720
4720
  };
4721
4721
  privateFilterEvent = (ctx3, config3, friend, cd) => {
4722
+ const runLog = (text2) => log2(ctx3.logText, `${text2}: ${ctx3.eventId}`);
4722
4723
  if (ctx3.isFriend) {
4723
4724
  if (!config3?.friend?.enable) {
4724
- log2(ctx3.userId, `\u5F53\u524D\u597D\u53CB\u4E8B\u4EF6\u672A\u542F\u7528: ${ctx3.eventId}`);
4725
+ runLog("\u5F53\u524D\u597D\u53CB\u4E8B\u4EF6\u672A\u542F\u7528");
4725
4726
  return false;
4726
4727
  }
4727
4728
  } else {
4728
4729
  if (!config3?.directs?.enable) {
4729
- log2(ctx3.userId, `\u5F53\u524D\u9891\u9053\u79C1\u4FE1\u4E8B\u4EF6\u672A\u542F\u7528: ${ctx3.eventId}`);
4730
+ runLog("\u5F53\u524D\u9891\u9053\u79C1\u4FE1\u4E8B\u4EF6\u672A\u542F\u7528");
4730
4731
  return false;
4731
4732
  }
4732
4733
  }
4733
4734
  if (!cd) {
4734
- log2(ctx3.userId, `\u5F53\u524D\u5904\u4E8ECD\u4E2D: ${ctx3.eventId}`);
4735
+ runLog("\u5F53\u524D\u5904\u4E8ECD\u4E2D");
4735
4736
  return false;
4736
4737
  }
4737
4738
  if (config3?.user?.enable_list?.length && !config3?.user?.enable_list.includes(ctx3.userId)) {
4738
- log2(ctx3.userId, `\u7528\u6237\u672A\u5904\u4E8E\u767D\u540D\u5355: ${ctx3.eventId}`);
4739
+ runLog("\u7528\u6237\u672A\u5904\u4E8E\u767D\u540D\u5355");
4739
4740
  return false;
4740
4741
  }
4741
4742
  if (config3?.user?.disable_list?.length && config3?.user?.disable_list.includes(ctx3.userId)) {
4742
- log2(ctx3.userId, `\u7528\u6237\u5904\u4E8E\u9ED1\u540D\u5355: ${ctx3.eventId}`);
4743
+ runLog("\u7528\u6237\u5904\u4E8E\u9ED1\u540D\u5355");
4743
4744
  return false;
4744
4745
  }
4745
4746
  if (ctx3.event !== "message") {
@@ -4749,28 +4750,28 @@ var init_handler = __esm({
4749
4750
  0: () => true,
4750
4751
  2: () => {
4751
4752
  if (!ctx3.isAdmin && !ctx3.isMaster) {
4752
- log2(ctx3.userId, `\u5F53\u524D\u4EC5\u5141\u8BB8\u7BA1\u7406\u5458\u4F7F\u7528: ${ctx3.messageId}`);
4753
+ runLog("\u5F53\u524D\u4EC5\u5141\u8BB8\u7BA1\u7406\u5458\u4F7F\u7528");
4753
4754
  return false;
4754
4755
  }
4755
4756
  return true;
4756
4757
  },
4757
4758
  3: () => {
4758
4759
  if (!ctx3.alias) {
4759
- log2(ctx3.userId, `\u5F53\u524D\u4EC5\u5141\u8BB8Bot\u522B\u540D\u89E6\u53D1\u4F7F\u7528: ${ctx3.messageId}`);
4760
+ runLog("\u5F53\u524D\u4EC5\u5141\u8BB8Bot\u522B\u540D\u89E6\u53D1\u4F7F\u7528");
4760
4761
  return false;
4761
4762
  }
4762
4763
  return true;
4763
4764
  },
4764
4765
  5: () => {
4765
4766
  if (!ctx3.isAdmin && !ctx3.isMaster && !ctx3.alias && !ctx3.atBot) {
4766
- log2(ctx3.userId, `\u5F53\u524D\u4EC5\u5141\u8BB8@\u6216\u522B\u540D\u89E6\u53D1(\u7BA1\u7406\u5458\u4F8B\u5916): ${ctx3.messageId}`);
4767
+ runLog("\u5F53\u524D\u4EC5\u5141\u8BB8@\u6216\u522B\u540D\u89E6\u53D1(\u7BA1\u7406\u5458\u4F8B\u5916)");
4767
4768
  return false;
4768
4769
  }
4769
4770
  return true;
4770
4771
  },
4771
4772
  6: () => {
4772
4773
  if (!ctx3.isMaster) {
4773
- log2(ctx3.userId, `\u5F53\u524D\u4EC5\u5141\u8BB8\u4E3B\u4EBA\u4F7F\u7528: ${ctx3.messageId}`);
4774
+ runLog("\u5F53\u524D\u4EC5\u5141\u8BB8\u4E3B\u4EBA\u4F7F\u7528");
4774
4775
  return false;
4775
4776
  }
4776
4777
  return true;
@@ -4781,74 +4782,75 @@ var init_handler = __esm({
4781
4782
  return mode();
4782
4783
  };
4783
4784
  groupFilterEvent = (ctx3, config3, group, cd) => {
4785
+ const runLog = (text2) => log2(ctx3.logText, `${text2}: ${ctx3.eventId}`);
4784
4786
  if (ctx3.isGroup) {
4785
4787
  if (!config3?.group?.enable) {
4786
- log2(ctx3.groupId, `\u5F53\u524D\u7FA4\u4E8B\u4EF6\u672A\u542F\u7528: ${ctx3.eventId}`);
4788
+ runLog("\u5F53\u524D\u7FA4\u4E8B\u4EF6\u672A\u542F\u7528");
4787
4789
  return false;
4788
4790
  }
4789
4791
  } else if (ctx3.isGuild) {
4790
4792
  if (!config3?.guilds?.enable) {
4791
- log2(ctx3.guildId, `\u5F53\u524D\u9891\u9053\u4E8B\u4EF6\u672A\u542F\u7528: ${ctx3.eventId}`);
4793
+ runLog("\u5F53\u524D\u9891\u9053\u4E8B\u4EF6\u672A\u542F\u7528");
4792
4794
  return false;
4793
4795
  }
4794
4796
  }
4795
4797
  if (!cd) {
4796
- log2(ctx3.userId, `\u5F53\u524D\u5904\u4E8ECD\u4E2D: ${ctx3.eventId}`);
4798
+ runLog("\u5F53\u524D\u5904\u4E8ECD\u4E2D");
4797
4799
  return false;
4798
4800
  }
4799
4801
  if (config3?.user?.enable_list?.length) {
4800
4802
  if (!config3?.user?.enable_list.includes(ctx3.userId)) {
4801
- log2(ctx3.userId, `\u7528\u6237\u672A\u5904\u4E8E\u767D\u540D\u5355: ${ctx3.eventId}`);
4803
+ runLog("\u7528\u6237\u672A\u5904\u4E8E\u767D\u540D\u5355");
4802
4804
  return false;
4803
4805
  }
4804
4806
  }
4805
4807
  if (config3?.user?.disable_list?.length) {
4806
4808
  if (config3?.user?.disable_list.includes(ctx3.userId)) {
4807
- log2(ctx3.userId, `\u7528\u6237\u5904\u4E8E\u9ED1\u540D\u5355: ${ctx3.eventId}`);
4809
+ runLog("\u7528\u6237\u5904\u4E8E\u9ED1\u540D\u5355");
4808
4810
  return false;
4809
4811
  }
4810
4812
  }
4811
4813
  if (ctx3.isGroup) {
4812
4814
  if (config3?.group?.enable_list?.length && !config3?.group?.enable_list.includes(ctx3.groupId)) {
4813
- log2(ctx3.groupId, `\u7FA4\u672A\u5904\u4E8E\u767D\u540D\u5355: ${ctx3.eventId}`);
4815
+ runLog("\u7FA4\u672A\u5904\u4E8E\u767D\u540D\u5355");
4814
4816
  return false;
4815
4817
  }
4816
4818
  if (config3?.group?.disable_list?.length && config3?.group?.disable_list.includes(ctx3.groupId)) {
4817
- log2(ctx3.groupId, `\u7FA4\u5904\u4E8E\u9ED1\u540D\u5355: ${ctx3.eventId}`);
4819
+ runLog("\u7FA4\u5904\u4E8E\u9ED1\u540D\u5355");
4818
4820
  return false;
4819
4821
  }
4820
4822
  if (group.member_enable?.length && !group.member_enable.includes(ctx3.userId)) {
4821
- log2(ctx3.userId, `\u7528\u6237\u672A\u5904\u4E8E\u7FA4\u6210\u5458\u767D\u540D\u5355: ${ctx3.eventId}`);
4823
+ runLog("\u7528\u6237\u672A\u5904\u4E8E\u7FA4\u6210\u5458\u767D\u540D\u5355");
4822
4824
  return false;
4823
4825
  }
4824
4826
  if (group.member_disable?.length && group.member_disable.includes(ctx3.userId)) {
4825
- log2(ctx3.userId, `\u7528\u6237\u5904\u4E8E\u7FA4\u6210\u5458\u9ED1\u540D\u5355: ${ctx3.eventId}`);
4827
+ runLog("\u7528\u6237\u5904\u4E8E\u7FA4\u6210\u5458\u9ED1\u540D\u5355");
4826
4828
  return false;
4827
4829
  }
4828
4830
  }
4829
4831
  if (ctx3.isGuild) {
4830
4832
  if (config3?.guilds?.enable_list?.length && !config3?.guilds?.enable_list.includes(ctx3.guildId)) {
4831
- log2(ctx3.guildId, `\u9891\u9053\u672A\u5904\u4E8E\u767D\u540D\u5355: ${ctx3.eventId}`);
4833
+ runLog("\u9891\u9053\u672A\u5904\u4E8E\u767D\u540D\u5355");
4832
4834
  return false;
4833
4835
  }
4834
4836
  if (config3?.guilds?.disable_list?.length && config3?.guilds?.disable_list.includes(ctx3.guildId)) {
4835
- log2(ctx3.guildId, `\u9891\u9053\u5904\u4E8E\u9ED1\u540D\u5355: ${ctx3.eventId}`);
4837
+ runLog("\u9891\u9053\u5904\u4E8E\u9ED1\u540D\u5355");
4836
4838
  return false;
4837
4839
  }
4838
4840
  if (config3?.channels?.enable_list?.length && !config3?.channels?.enable_list.includes(ctx3.channelId)) {
4839
- log2(ctx3.channelId, `\u5B50\u9891\u9053\u672A\u5904\u4E8E\u767D\u540D\u5355: ${ctx3.eventId}`);
4841
+ runLog("\u5B50\u9891\u9053\u672A\u5904\u4E8E\u767D\u540D\u5355");
4840
4842
  return false;
4841
4843
  }
4842
4844
  if (config3?.channels?.disable_list?.length && config3?.channels?.disable_list.includes(ctx3.channelId)) {
4843
- log2(ctx3.channelId, `\u5B50\u9891\u9053\u5904\u4E8E\u9ED1\u540D\u5355: ${ctx3.eventId}`);
4845
+ runLog("\u5B50\u9891\u9053\u5904\u4E8E\u9ED1\u540D\u5355");
4844
4846
  return false;
4845
4847
  }
4846
4848
  if (group.member_enable?.length && !group.member_enable.includes(ctx3.userId)) {
4847
- log2(ctx3.userId, `\u7528\u6237\u672A\u5904\u4E8E\u9891\u9053\u6210\u5458\u767D\u540D\u5355: ${ctx3.eventId}`);
4849
+ runLog("\u7528\u6237\u672A\u5904\u4E8E\u9891\u9053\u6210\u5458\u767D\u540D\u5355");
4848
4850
  return false;
4849
4851
  }
4850
4852
  if (group.member_disable?.length && group.member_disable.includes(ctx3.userId)) {
4851
- log2(ctx3.userId, `\u7528\u6237\u5904\u4E8E\u9891\u9053\u6210\u5458\u9ED1\u540D\u5355: ${ctx3.eventId}`);
4853
+ runLog("\u7528\u6237\u5904\u4E8E\u9891\u9053\u6210\u5458\u9ED1\u540D\u5355");
4852
4854
  return false;
4853
4855
  }
4854
4856
  }
@@ -4859,42 +4861,42 @@ var init_handler = __esm({
4859
4861
  0: () => true,
4860
4862
  1: () => {
4861
4863
  if (!ctx3.atBot) {
4862
- log2(ctx3.userId, `\u5F53\u524D\u54CD\u5E94\u6A21\u5F0F\u4EC5\u5141\u8BB8@\u673A\u5668\u4EBA\u4F7F\u7528: ${ctx3.messageId}`);
4864
+ runLog("\u5F53\u524D\u54CD\u5E94\u6A21\u5F0F\u4EC5\u5141\u8BB8@\u673A\u5668\u4EBA\u4F7F\u7528");
4863
4865
  return false;
4864
4866
  }
4865
4867
  return true;
4866
4868
  },
4867
4869
  2: () => {
4868
4870
  if (!ctx3.isAdmin && !ctx3.isMaster) {
4869
- log2(ctx3.userId, `\u5F53\u524D\u4EC5\u5141\u8BB8\u7BA1\u7406\u5458\u4F7F\u7528: ${ctx3.messageId}`);
4871
+ runLog("\u5F53\u524D\u4EC5\u5141\u8BB8\u7BA1\u7406\u5458\u4F7F\u7528");
4870
4872
  return false;
4871
4873
  }
4872
4874
  return true;
4873
4875
  },
4874
4876
  3: () => {
4875
4877
  if (!ctx3.alias) {
4876
- log2(ctx3.userId, `\u5F53\u524D\u4EC5\u5141\u8BB8Bot\u522B\u540D\u89E6\u53D1\u4F7F\u7528: ${ctx3.messageId}`);
4878
+ runLog("\u5F53\u524D\u4EC5\u5141\u8BB8Bot\u522B\u540D\u89E6\u53D1\u4F7F\u7528");
4877
4879
  return false;
4878
4880
  }
4879
4881
  return true;
4880
4882
  },
4881
4883
  4: () => {
4882
4884
  if (!ctx3.alias && !ctx3.atBot) {
4883
- log2(ctx3.userId, `\u5F53\u524D\u4EC5\u5141\u8BB8Bot\u522B\u540D\u6216@\u673A\u5668\u4EBA\u89E6\u53D1\u4F7F\u7528: ${ctx3.messageId}`);
4885
+ runLog("\u5F53\u524D\u4EC5\u5141\u8BB8Bot\u522B\u540D\u6216@\u673A\u5668\u4EBA\u89E6\u53D1\u4F7F\u7528");
4884
4886
  return false;
4885
4887
  }
4886
4888
  return true;
4887
4889
  },
4888
4890
  5: () => {
4889
4891
  if (!ctx3.isAdmin && !ctx3.isMaster && !ctx3.alias && !ctx3.atBot) {
4890
- log2(ctx3.userId, `\u5F53\u524D\u4EC5\u5141\u8BB8@\u6216\u522B\u540D\u89E6\u53D1(\u7BA1\u7406\u5458\u4F8B\u5916): ${ctx3.messageId}`);
4892
+ runLog("\u5F53\u524D\u4EC5\u5141\u8BB8@\u6216\u522B\u540D\u89E6\u53D1(\u7BA1\u7406\u5458\u4F8B\u5916)");
4891
4893
  return false;
4892
4894
  }
4893
4895
  return true;
4894
4896
  },
4895
4897
  6: () => {
4896
4898
  if (!ctx3.isMaster) {
4897
- log2(ctx3.userId, `\u5F53\u524D\u4EC5\u5141\u8BB8\u4E3B\u4EBA\u4F7F\u7528: ${ctx3.messageId}`);
4899
+ runLog("\u5F53\u524D\u4EC5\u5141\u8BB8\u4E3B\u4EBA\u4F7F\u7528");
4898
4900
  return false;
4899
4901
  }
4900
4902
  return true;
@@ -4906,30 +4908,31 @@ var init_handler = __esm({
4906
4908
  };
4907
4909
  groupPrint = (ctx3, config3) => {
4908
4910
  if (config3?.group?.log_enable_list?.length && !config3?.group?.log_enable_list.includes(ctx3.groupId)) {
4909
- log2(ctx3.groupId, `\u7FA4\u672A\u5904\u4E8E\u767D\u540D\u5355: ${ctx3.eventId}`);
4911
+ log2(ctx3.logText, `\u7FA4\u672A\u5904\u4E8E\u767D\u540D\u5355: ${ctx3.eventId}`);
4910
4912
  return false;
4911
4913
  }
4912
4914
  if (config3?.group?.log_disable_list?.length && config3?.group?.log_disable_list.includes(ctx3.groupId)) {
4913
- log2(ctx3.groupId, `\u7FA4\u5904\u4E8E\u9ED1\u540D\u5355: ${ctx3.eventId}`);
4915
+ log2(ctx3.logText, `\u7FA4\u5904\u4E8E\u9ED1\u540D\u5355: ${ctx3.eventId}`);
4914
4916
  return false;
4915
4917
  }
4916
4918
  return true;
4917
4919
  };
4918
4920
  guildPrint = (ctx3, config3) => {
4921
+ const runLog = (text2) => log2(ctx3.logText, `${text2}: ${ctx3.eventId}`);
4919
4922
  if (config3?.guilds?.log_enable_list?.length && !config3?.guilds?.log_enable_list.includes(ctx3.guildId)) {
4920
- log2(ctx3.guildId, `\u9891\u9053\u65E5\u5FD7\u672A\u5904\u4E8E\u767D\u540D\u5355: ${ctx3.eventId}`);
4923
+ runLog("\u9891\u9053\u65E5\u5FD7\u672A\u5904\u4E8E\u767D\u540D\u5355");
4921
4924
  return false;
4922
4925
  }
4923
4926
  if (config3?.guilds?.log_disable_list?.length && config3?.guilds?.log_disable_list.includes(ctx3.guildId)) {
4924
- log2(ctx3.guildId, `\u9891\u9053\u65E5\u5FD7\u5904\u4E8E\u9ED1\u540D\u5355: ${ctx3.eventId}`);
4927
+ runLog("\u9891\u9053\u65E5\u5FD7\u5904\u4E8E\u9ED1\u540D\u5355");
4925
4928
  return false;
4926
4929
  }
4927
4930
  if (config3?.channels?.log_enable_list?.length && !config3?.channels?.log_enable_list.includes(ctx3.channelId)) {
4928
- log2(ctx3.channelId, `\u5B50\u9891\u9053\u65E5\u5FD7\u672A\u5904\u4E8E\u767D\u540D\u5355: ${ctx3.eventId}`);
4931
+ runLog("\u5B50\u9891\u9053\u65E5\u5FD7\u672A\u5904\u4E8E\u767D\u540D\u5355");
4929
4932
  return false;
4930
4933
  }
4931
4934
  if (config3?.channels?.log_disable_list?.length && config3?.channels?.log_disable_list.includes(ctx3.channelId)) {
4932
- log2(ctx3.channelId, `\u5B50\u9891\u9053\u65E5\u5FD7\u5904\u4E8E\u9ED1\u540D\u5355: ${ctx3.eventId}`);
4935
+ runLog("\u5B50\u9891\u9053\u65E5\u5FD7\u5904\u4E8E\u9ED1\u540D\u5355");
4933
4936
  return false;
4934
4937
  }
4935
4938
  return true;
@@ -11175,9 +11178,9 @@ var init_restart = __esm({
11175
11178
  if (error) return { status: "failed", data: error };
11176
11179
  process.exit();
11177
11180
  };
11178
- restartDirect = async () => {
11181
+ restartDirect = async (isPm2 = false) => {
11179
11182
  logger.mark("\u6536\u5230\u91CD\u542F\u8BF7\u6C42\uFF0C\u6B63\u5728\u91CD\u542F...");
11180
- if (process?.send) {
11183
+ if (!isPm2 && process?.send) {
11181
11184
  process.send(JSON.stringify({
11182
11185
  type: "restart",
11183
11186
  port: process.env.HTTP_PORT,
@@ -11193,10 +11196,8 @@ var init_restart = __esm({
11193
11196
  if (process.env.RUNTIME === "tsx") {
11194
11197
  throw new Error("tsx \u4E0D\u652F\u6301\u91CD\u542F");
11195
11198
  }
11196
- if (process?.send) {
11197
- process.send("restart");
11198
- logger.mark("\u53D1\u9001\u91CD\u542F\u4FE1\u53F7\u6210\u529F");
11199
- }
11199
+ const { error } = await exec("npx karin pm2");
11200
+ if (error) throw error;
11200
11201
  };
11201
11202
  }
11202
11203
  });
@@ -16101,7 +16102,9 @@ __export(config_exports, {
16101
16102
  getEnv: () => getEnv,
16102
16103
  getFriendCfg: () => getFriendCfg,
16103
16104
  getGroupCfg: () => getGroupCfg,
16105
+ getGroupsFileData: () => getGroupsFileData,
16104
16106
  getGuildCfg: () => getGuildCfg,
16107
+ getPrivatesFileData: () => getPrivatesFileData,
16105
16108
  getRenderCfg: () => getRenderCfg,
16106
16109
  getYaml: () => getYaml,
16107
16110
  groups: () => groups,
@@ -16653,7 +16656,7 @@ var init_config2 = __esm({
16653
16656
  config_default = initConfig;
16654
16657
  }
16655
16658
  });
16656
- var count, cache8, getCfg, isOld, migrate, format2, initGroups, groups, getGroupCfg, getGuildCfg, groups_default;
16659
+ var count, cache8, getCfg, isOld, migrate, format2, initGroups, groups, getGroupCfg, getGuildCfg, getGroupsFileData, groups_default;
16657
16660
  var init_groups4 = __esm({
16658
16661
  "src/utils/config/file/groups.ts"() {
16659
16662
  init_watch();
@@ -16720,10 +16723,16 @@ var init_groups4 = __esm({
16720
16723
  ];
16721
16724
  return getCfg(keys);
16722
16725
  };
16726
+ getGroupsFileData = (dir2) => {
16727
+ const name = "groups.json";
16728
+ const file = `${dir2}/${name}`;
16729
+ const data = requireFileSync(file, { type: "json" });
16730
+ return isOld(data) ? migrate(file, data) : format2(data);
16731
+ };
16723
16732
  groups_default = initGroups;
16724
16733
  }
16725
16734
  });
16726
- var count2, cache9, getCfg2, isOld2, migrate2, format3, initPrivates, privates, getFriendCfg, getDirectCfg, privates_default;
16735
+ var count2, cache9, getCfg2, isOld2, migrate2, format3, initPrivates, privates, getFriendCfg, getDirectCfg, getPrivatesFileData, privates_default;
16727
16736
  var init_privates = __esm({
16728
16737
  "src/utils/config/file/privates.ts"() {
16729
16738
  init_watch();
@@ -16778,6 +16787,12 @@ var init_privates = __esm({
16778
16787
  const keys = [`Bot:${selfId}:${userId}`, `Bot:${selfId}`, userId, "default"];
16779
16788
  return getCfg2(keys);
16780
16789
  };
16790
+ getPrivatesFileData = (dir2) => {
16791
+ const name = "privates.json";
16792
+ const file = `${dir2}/${name}`;
16793
+ const data = requireFileSync(file, { type: "json" });
16794
+ return isOld2(data) ? migrate2(file, data) : format3(data);
16795
+ };
16781
16796
  privates_default = initPrivates;
16782
16797
  }
16783
16798
  });
@@ -19995,6 +20010,7 @@ var init_refresh = __esm({
19995
20010
  var getConfig, saveConfig;
19996
20011
  var init_config3 = __esm({
19997
20012
  "src/server/config/index.ts"() {
20013
+ init_root();
19998
20014
  init_response();
19999
20015
  init_config();
20000
20016
  getConfig = async (req, res) => {
@@ -20008,11 +20024,11 @@ var init_config3 = __esm({
20008
20024
  return createSuccessResponse(res, cfg);
20009
20025
  }
20010
20026
  if (type === "groups") {
20011
- const cfg = groups();
20027
+ const cfg = getGroupsFileData(karinPathConfig);
20012
20028
  return createSuccessResponse(res, cfg);
20013
20029
  }
20014
20030
  if (type === "privates") {
20015
- const cfg = privates();
20031
+ const cfg = getPrivatesFileData(karinPathConfig);
20016
20032
  return createSuccessResponse(res, cfg);
20017
20033
  }
20018
20034
  if (type === "render") {
@@ -20473,9 +20489,10 @@ var init_manage = __esm({
20473
20489
  "src/server/system/manage.ts"() {
20474
20490
  init_restart();
20475
20491
  init_response();
20476
- restartRouter = async (_req, res) => {
20492
+ restartRouter = async (req, res) => {
20493
+ const { isPm2 } = req.body;
20477
20494
  createSuccessResponse(res, null, "\u91CD\u542F\u6307\u4EE4\u53D1\u9001\u6210\u529F");
20478
- restartDirect();
20495
+ restartDirect(isPm2 ?? false);
20479
20496
  };
20480
20497
  exitRouter = async (_req, res) => {
20481
20498
  logger.mark("\u6536\u5230\u9000\u51FA\u8BF7\u6C42\uFF0C\u6B63\u5728\u9000\u51FA...");
@@ -0,0 +1 @@
1
+ import{j as t}from"./vendor-react-Hg1DVPZt.js";import{P as r}from"./components-9RKTV4LX.js";import"./vendor-others-B6NXaB-r.js";import"./vendor-editor-B8hjWfkw.js";import"./vendor-ui-utils-5rYIvRjL.js";import"./vendor-heroui-WfpTlnyv.js";import"./page-dashboard-BewrlGFW.js";import"./hooks-D65eaS4p.js";import"./utils-DqFE1yN-.js";import"./vendor-visual-mzxhMYK3.js";const x=()=>t.jsx("div",{className:"min-h-screen flex items-center justify-center",children:t.jsx(r,{})});export{x as default};
@@ -1,2 +1,2 @@
1
- import{V as p}from"./vendor-react-BDRVXu1f.js";import{a5 as g}from"./components-CLB7wkmN.js";const k=async(t,n,e,r)=>{const{setIsLogModalOpen:i,setTaskId:c,setTaskLogs:o,setTaskName:f}=n;f("更新插件");const a=["开始创建更新任务...",`options: ${JSON.stringify(t)}`];o(a);try{const s=await g(t);if(s.success&&s.taskId)c(s.taskId),o([...a,`
1
+ import{V as p}from"./vendor-react-Hg1DVPZt.js";import{a5 as g}from"./components-9RKTV4LX.js";const k=async(t,n,e,r)=>{const{setIsLogModalOpen:i,setTaskId:c,setTaskLogs:o,setTaskName:f}=n;f("更新插件");const a=["开始创建更新任务...",`options: ${JSON.stringify(t)}`];o(a);try{const s=await g(t);if(s.success&&s.taskId)c(s.taskId),o([...a,`
2
2
  任务创建成功!`,`任务ID: ${s.taskId}`,"正在连接任务执行日志..."]),i(!0),typeof e=="function"&&e(),typeof r=="function"&&r();else throw new Error(s.message||"未知错误")}catch(s){console.error("更新失败:",s),p.error(`更新失败: ${s.message}`)}};export{k as c};
@@ -14,17 +14,17 @@
14
14
  content="viewport-fit=cover, width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"
15
15
  name="viewport" />
16
16
  <link href="/web/assets/ico/favicon-BoqZd694.ico" rel="icon" />
17
- <script type="module" crossorigin src="/web/assets/js/entry-T2jwWprd.js"></script>
17
+ <script type="module" crossorigin src="/web/assets/js/entry-CzDSdA4M.js"></script>
18
18
  <link rel="modulepreload" crossorigin href="/web/assets/js/vendor-editor-B8hjWfkw.js">
19
- <link rel="modulepreload" crossorigin href="/web/assets/js/vendor-others-D7Rwl1O6.js">
19
+ <link rel="modulepreload" crossorigin href="/web/assets/js/vendor-others-B6NXaB-r.js">
20
20
  <link rel="modulepreload" crossorigin href="/web/assets/js/vendor-ui-utils-5rYIvRjL.js">
21
- <link rel="modulepreload" crossorigin href="/web/assets/js/vendor-react-BDRVXu1f.js">
22
- <link rel="modulepreload" crossorigin href="/web/assets/js/vendor-heroui-DwwsJlXF.js">
23
- <link rel="modulepreload" crossorigin href="/web/assets/js/hooks-DGvDG8bg.js">
24
- <link rel="modulepreload" crossorigin href="/web/assets/js/vendor-visual-BMhnpZxY.js">
25
- <link rel="modulepreload" crossorigin href="/web/assets/js/components-CLB7wkmN.js">
26
- <link rel="modulepreload" crossorigin href="/web/assets/js/utils-BewWhq0h.js">
27
- <link rel="modulepreload" crossorigin href="/web/assets/js/page-dashboard-BIzbCQc5.js">
21
+ <link rel="modulepreload" crossorigin href="/web/assets/js/vendor-react-Hg1DVPZt.js">
22
+ <link rel="modulepreload" crossorigin href="/web/assets/js/vendor-heroui-WfpTlnyv.js">
23
+ <link rel="modulepreload" crossorigin href="/web/assets/js/hooks-D65eaS4p.js">
24
+ <link rel="modulepreload" crossorigin href="/web/assets/js/vendor-visual-mzxhMYK3.js">
25
+ <link rel="modulepreload" crossorigin href="/web/assets/js/components-9RKTV4LX.js">
26
+ <link rel="modulepreload" crossorigin href="/web/assets/js/utils-DqFE1yN-.js">
27
+ <link rel="modulepreload" crossorigin href="/web/assets/js/page-dashboard-BewrlGFW.js">
28
28
  <link rel="stylesheet" crossorigin href="/web/assets/css/vendor-editor-CFbL2ovg.css">
29
29
  <link rel="stylesheet" crossorigin href="/web/assets/css/vendor-others-ZgkIHsf0.css">
30
30
  <link rel="stylesheet" crossorigin href="/web/assets/css/components-ep7vm38G.css">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-karin",
3
- "version": "1.8.8",
3
+ "version": "1.8.10",
4
4
  "description": "Lightweight, efficient, concise, and stable robot framework.",
5
5
  "keywords": [
6
6
  "node",
@@ -155,7 +155,8 @@
155
155
  "pr": "node cli/pr.js all",
156
156
  "pub": "npm publish --access public",
157
157
  "pub-beta": "npm publish --access public --tag beta",
158
- "sort": "sort-package-json && sort-json tsconfig.json"
158
+ "sort": "sort-package-json && sort-json tsconfig.json",
159
+ "sync": "curl -X PUT \"https://registry-direct.npmmirror.com/-/package/node-karin/syncs\""
159
160
  },
160
161
  "dependencies": {
161
162
  "art-template": "npm:@karinjs/art-template@1.1.0",
@@ -1 +0,0 @@
1
- import{j as t}from"./vendor-react-BDRVXu1f.js";import{P as r}from"./components-CLB7wkmN.js";import"./vendor-others-D7Rwl1O6.js";import"./vendor-editor-B8hjWfkw.js";import"./vendor-ui-utils-5rYIvRjL.js";import"./vendor-heroui-DwwsJlXF.js";import"./page-dashboard-BIzbCQc5.js";import"./hooks-DGvDG8bg.js";import"./utils-BewWhq0h.js";import"./vendor-visual-BMhnpZxY.js";const x=()=>t.jsx("div",{className:"min-h-screen flex items-center justify-center",children:t.jsx(r,{})});export{x as default};