node-karin 1.8.8 → 1.8.9

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/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";
@@ -12169,6 +12170,10 @@ declare const timeout: () => number;
12169
12170
  */
12170
12171
  declare const webSocketServerToken: () => string;
12171
12172
 
12173
+ /**
12174
+ * 读取config.json 不走缓存
12175
+ */
12176
+ declare const readConfig: (dir: string) => Config;
12172
12177
  /**
12173
12178
  * @public 公开Api
12174
12179
  * @description 获取配置 `config.json`
@@ -12358,6 +12363,7 @@ declare const index_pkg: typeof pkg;
12358
12363
  declare const index_pm2: typeof pm2;
12359
12364
  declare const index_port: typeof port;
12360
12365
  declare const index_privates: typeof privates;
12366
+ declare const index_readConfig: typeof readConfig;
12361
12367
  declare const index_setConfig: typeof setConfig;
12362
12368
  declare const index_setEnv: typeof setEnv;
12363
12369
  declare const index_setYaml: typeof setYaml;
@@ -12366,7 +12372,7 @@ declare const index_updateLevel: typeof updateLevel;
12366
12372
  declare const index_webSocketServerToken: typeof webSocketServerToken;
12367
12373
  declare const index_writeEnv: typeof writeEnv;
12368
12374
  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 };
12375
+ 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, index_readConfig as readConfig, 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
12376
  }
12371
12377
 
12372
12378
  /**
package/dist/index.mjs CHANGED
@@ -11175,9 +11175,9 @@ var init_restart = __esm({
11175
11175
  if (error) return { status: "failed", data: error };
11176
11176
  process.exit();
11177
11177
  };
11178
- restartDirect = async () => {
11178
+ restartDirect = async (isPm2 = false) => {
11179
11179
  logger.mark("\u6536\u5230\u91CD\u542F\u8BF7\u6C42\uFF0C\u6B63\u5728\u91CD\u542F...");
11180
- if (process?.send) {
11180
+ if (!isPm2 && process?.send) {
11181
11181
  process.send(JSON.stringify({
11182
11182
  type: "restart",
11183
11183
  port: process.env.HTTP_PORT,
@@ -11193,10 +11193,8 @@ var init_restart = __esm({
11193
11193
  if (process.env.RUNTIME === "tsx") {
11194
11194
  throw new Error("tsx \u4E0D\u652F\u6301\u91CD\u542F");
11195
11195
  }
11196
- if (process?.send) {
11197
- process.send("restart");
11198
- logger.mark("\u53D1\u9001\u91CD\u542F\u4FE1\u53F7\u6210\u529F");
11199
- }
11196
+ const { error } = await exec("npx karin pm2");
11197
+ if (error) throw error;
11200
11198
  };
11201
11199
  }
11202
11200
  });
@@ -16114,6 +16112,7 @@ __export(config_exports, {
16114
16112
  pm2: () => pm2,
16115
16113
  port: () => port,
16116
16114
  privates: () => privates,
16115
+ readConfig: () => readConfig,
16117
16116
  redis: () => redis,
16118
16117
  render: () => render2,
16119
16118
  setConfig: () => setConfig,
@@ -16627,7 +16626,7 @@ var init_adapter = __esm({
16627
16626
  });
16628
16627
 
16629
16628
  // src/utils/config/file/config.ts
16630
- var cache7, initConfig, config2, master, admin, config_default;
16629
+ var cache7, initConfig, readConfig, config2, master, admin, config_default;
16631
16630
  var init_config2 = __esm({
16632
16631
  "src/utils/config/file/config.ts"() {
16633
16632
  init_tools();
@@ -16647,6 +16646,12 @@ var init_config2 = __esm({
16647
16646
  listeners.emit(`${FILE_CHANGE}:${name}`, options);
16648
16647
  }, { type: "json" });
16649
16648
  };
16649
+ readConfig = (dir2) => {
16650
+ const name = "config.json";
16651
+ const file = `${dir2}/${name}`;
16652
+ const data = requireFileSync(file, { type: "json" });
16653
+ return formatObject(data);
16654
+ };
16650
16655
  config2 = () => cache7;
16651
16656
  master = () => config2().master;
16652
16657
  admin = () => config2().admin;
@@ -19995,12 +20000,13 @@ var init_refresh = __esm({
19995
20000
  var getConfig, saveConfig;
19996
20001
  var init_config3 = __esm({
19997
20002
  "src/server/config/index.ts"() {
20003
+ init_root();
19998
20004
  init_response();
19999
20005
  init_config();
20000
20006
  getConfig = async (req, res) => {
20001
20007
  const { type } = req.body;
20002
20008
  if (type === "config") {
20003
- const cfg = config2();
20009
+ const cfg = readConfig(karinPathConfig);
20004
20010
  return createSuccessResponse(res, cfg);
20005
20011
  }
20006
20012
  if (type === "adapter") {
@@ -20473,9 +20479,10 @@ var init_manage = __esm({
20473
20479
  "src/server/system/manage.ts"() {
20474
20480
  init_restart();
20475
20481
  init_response();
20476
- restartRouter = async (_req, res) => {
20482
+ restartRouter = async (req, res) => {
20483
+ const { isPm2 } = req.body;
20477
20484
  createSuccessResponse(res, null, "\u91CD\u542F\u6307\u4EE4\u53D1\u9001\u6210\u529F");
20478
- restartDirect();
20485
+ restartDirect(isPm2 ?? false);
20479
20486
  };
20480
20487
  exitRouter = async (_req, res) => {
20481
20488
  logger.mark("\u6536\u5230\u9000\u51FA\u8BF7\u6C42\uFF0C\u6B63\u5728\u9000\u51FA...");
@@ -0,0 +1 @@
1
+ import{j as t}from"./vendor-react-BDRVXu1f.js";import{P as r}from"./components-D6OCw7kO.js";import"./vendor-others-D7Rwl1O6.js";import"./vendor-editor-B8hjWfkw.js";import"./vendor-ui-utils-5rYIvRjL.js";import"./vendor-heroui-96DnnqOT.js";import"./page-dashboard-BX_VXjx6.js";import"./hooks-BoS7DPVe.js";import"./utils-DSlRvNHw.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};
@@ -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-BDRVXu1f.js";import{a5 as g}from"./components-D6OCw7kO.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-BP2jjfVR.js"></script>
18
18
  <link rel="modulepreload" crossorigin href="/web/assets/js/vendor-editor-B8hjWfkw.js">
19
19
  <link rel="modulepreload" crossorigin href="/web/assets/js/vendor-others-D7Rwl1O6.js">
20
20
  <link rel="modulepreload" crossorigin href="/web/assets/js/vendor-ui-utils-5rYIvRjL.js">
21
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">
22
+ <link rel="modulepreload" crossorigin href="/web/assets/js/vendor-heroui-96DnnqOT.js">
23
+ <link rel="modulepreload" crossorigin href="/web/assets/js/hooks-BoS7DPVe.js">
24
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">
25
+ <link rel="modulepreload" crossorigin href="/web/assets/js/components-D6OCw7kO.js">
26
+ <link rel="modulepreload" crossorigin href="/web/assets/js/utils-DSlRvNHw.js">
27
+ <link rel="modulepreload" crossorigin href="/web/assets/js/page-dashboard-BX_VXjx6.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.9",
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",
@@ -189,4 +190,4 @@
189
190
  "registry": "https://registry.npmjs.org"
190
191
  },
191
192
  "time": "2025-05-03T19:55:55.123Z"
192
- }
193
+ }
@@ -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};