@kotori-bot/kotori-plugin-webui 1.5.2 → 1.5.4

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/lib/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * @Package @kotori-bot/kotori-plugin-webui
3
- * @Version 1.5.1
3
+ * @Version 1.5.3
4
4
  * @Author Hotaru <me@hotaru.icu>
5
5
  * @Copyright 2024-2025 Hotaru. All rights reserved.
6
6
  * @License GPL-3.0
7
7
  * @Link https://github.com/kotorijs/kotori
8
- * @Date 2026/2/14 21:25:08
8
+ * @Date 2026/8/6 23:41:49
9
9
  */
10
10
  "use strict";
11
11
  var __create = Object.create;
@@ -59,12 +59,12 @@ function main(ctx, cfg) {
59
59
  if (!ctx.webui.checkToken(token)) return ws.close(1002);
60
60
  (0, import_ws.default)(ctx, ws);
61
61
  });
62
+ const app = ctx.server;
63
+ app.use(app.static((0, import_node_path.resolve)(__dirname, "../dist")));
64
+ app.use(app.json());
65
+ app.use(app.urlencoded({ extended: true }));
66
+ app.use("/", (0, import_routers.default)(ctx, app));
62
67
  });
63
- const app = ctx.server;
64
- app.use(app.static((0, import_node_path.resolve)(__dirname, "../dist")));
65
- app.use(app.json());
66
- app.use(app.urlencoded({ extended: true }));
67
- app.use("/", (0, import_routers.default)(ctx, app));
68
68
  ctx.load({
69
69
  // extends parent plugin's package name and share the same data files area
70
70
  name: require("../package.json").name,
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * @Package @kotori-bot/kotori-plugin-webui
3
- * @Version 1.5.1
3
+ * @Version 1.5.3
4
4
  * @Author Hotaru <me@hotaru.icu>
5
5
  * @Copyright 2024-2025 Hotaru. All rights reserved.
6
6
  * @License GPL-3.0
7
7
  * @Link https://github.com/kotorijs/kotori
8
- * @Date 2026/2/14 21:25:08
8
+ * @Date 2026/8/6 23:41:49
9
9
  */
10
10
  "use strict";
11
11
  var __defProp = Object.defineProperty;
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * @Package @kotori-bot/kotori-plugin-webui
3
- * @Version 1.5.1
3
+ * @Version 1.5.3
4
4
  * @Author Hotaru <me@hotaru.icu>
5
5
  * @Copyright 2024-2025 Hotaru. All rights reserved.
6
6
  * @License GPL-3.0
7
7
  * @Link https://github.com/kotorijs/kotori
8
- * @Date 2026/2/14 21:25:08
8
+ * @Date 2026/8/6 23:41:49
9
9
  */
10
10
  "use strict";
11
11
  var __defProp = Object.defineProperty;
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * @Package @kotori-bot/kotori-plugin-webui
3
- * @Version 1.5.1
3
+ * @Version 1.5.3
4
4
  * @Author Hotaru <me@hotaru.icu>
5
5
  * @Copyright 2024-2025 Hotaru. All rights reserved.
6
6
  * @License GPL-3.0
7
7
  * @Link https://github.com/kotorijs/kotori
8
- * @Date 2026/2/14 21:25:08
8
+ * @Date 2026/8/6 23:41:49
9
9
  */
10
10
  "use strict";
11
11
  var __defProp = Object.defineProperty;
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * @Package @kotori-bot/kotori-plugin-webui
3
- * @Version 1.5.1
3
+ * @Version 1.5.3
4
4
  * @Author Hotaru <me@hotaru.icu>
5
5
  * @Copyright 2024-2025 Hotaru. All rights reserved.
6
6
  * @License GPL-3.0
7
7
  * @Link https://github.com/kotorijs/kotori
8
- * @Date 2026/2/14 21:25:08
8
+ * @Date 2026/8/6 23:41:49
9
9
  */
10
10
  "use strict";
11
11
  var __defProp = Object.defineProperty;
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * @Package @kotori-bot/kotori-plugin-webui
3
- * @Version 1.5.1
3
+ * @Version 1.5.3
4
4
  * @Author Hotaru <me@hotaru.icu>
5
5
  * @Copyright 2024-2025 Hotaru. All rights reserved.
6
6
  * @License GPL-3.0
7
7
  * @Link https://github.com/kotorijs/kotori
8
- * @Date 2026/2/14 21:25:08
8
+ * @Date 2026/8/6 23:41:49
9
9
  */
10
10
  "use strict";
11
11
  var __defProp = Object.defineProperty;
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * @Package @kotori-bot/kotori-plugin-webui
3
- * @Version 1.5.1
3
+ * @Version 1.5.3
4
4
  * @Author Hotaru <me@hotaru.icu>
5
5
  * @Copyright 2024-2025 Hotaru. All rights reserved.
6
6
  * @License GPL-3.0
7
7
  * @Link https://github.com/kotorijs/kotori
8
- * @Date 2026/2/14 21:25:08
8
+ * @Date 2026/8/6 23:41:49
9
9
  */
10
10
  "use strict";
11
11
  var __create = Object.create;
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * @Package @kotori-bot/kotori-plugin-webui
3
- * @Version 1.5.1
3
+ * @Version 1.5.3
4
4
  * @Author Hotaru <me@hotaru.icu>
5
5
  * @Copyright 2024-2025 Hotaru. All rights reserved.
6
6
  * @License GPL-3.0
7
7
  * @Link https://github.com/kotorijs/kotori
8
- * @Date 2026/2/14 21:25:08
8
+ * @Date 2026/8/6 23:41:49
9
9
  */
10
10
  "use strict";
11
11
  var __create = Object.create;
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * @Package @kotori-bot/kotori-plugin-webui
3
- * @Version 1.5.1
3
+ * @Version 1.5.3
4
4
  * @Author Hotaru <me@hotaru.icu>
5
5
  * @Copyright 2024-2025 Hotaru. All rights reserved.
6
6
  * @License GPL-3.0
7
7
  * @Link https://github.com/kotorijs/kotori
8
- * @Date 2026/2/14 21:25:08
8
+ * @Date 2026/8/6 23:41:49
9
9
  */
10
10
  "use strict";
11
11
  var __create = Object.create;
@@ -142,38 +142,44 @@ class Webui extends import_kotori_bot.Service {
142
142
  }
143
143
  })
144
144
  );
145
- this.ctx.on("on_message", (session) => f((botStats, botStatsToday) => {
146
- if (session.api.adapter.identity in botStats) {
147
- botStats[session.api.adapter.identity].receivedMsg += 1;
148
- } else {
149
- botStats[session.api.adapter.identity] = {
150
- ...session.api.adapter.status,
151
- createTime: new Date(session.api.adapter.status.createTime).getTime(),
152
- lastMsgTime: session.api.adapter.status.lastMsgTime ? new Date(session.api.adapter.status.lastMsgTime).getTime() : null
153
- };
154
- }
155
- if (session.api.adapter.identity in botStatsToday) {
156
- botStatsToday[session.api.adapter.identity].receivedMsg += 1;
157
- } else if (!botStatsToday[session.api.adapter.identity]) {
158
- botStatsToday[session.api.adapter.identity] = { sentMsg: 0, receivedMsg: 1, offlineTimes: 0 };
159
- }
160
- }));
161
- this.ctx.on("status", async (data) => f((botStats, botStatsToday) => {
162
- if (data.adapter.identity in botStats) {
163
- botStats[data.adapter.identity].offlineTimes += 1;
164
- } else {
165
- botStats[data.adapter.identity] = {
166
- ...data.adapter.status,
167
- createTime: new Date(data.adapter.status.createTime).getTime(),
168
- lastMsgTime: data.adapter.status.lastMsgTime ? new Date(data.adapter.status.lastMsgTime).getTime() : null
169
- };
170
- }
171
- if (data.adapter.identity in botStatsToday) {
172
- botStatsToday[data.adapter.identity].offlineTimes += 1;
173
- } else if (!botStatsToday[data.adapter.identity]) {
174
- botStatsToday[data.adapter.identity] = { sentMsg: 0, receivedMsg: 0, offlineTimes: 1 };
175
- }
176
- }));
145
+ this.ctx.on(
146
+ "on_message",
147
+ (session) => f((botStats, botStatsToday) => {
148
+ if (session.api.adapter.identity in botStats) {
149
+ botStats[session.api.adapter.identity].receivedMsg += 1;
150
+ } else {
151
+ botStats[session.api.adapter.identity] = {
152
+ ...session.api.adapter.status,
153
+ createTime: new Date(session.api.adapter.status.createTime).getTime(),
154
+ lastMsgTime: session.api.adapter.status.lastMsgTime ? new Date(session.api.adapter.status.lastMsgTime).getTime() : null
155
+ };
156
+ }
157
+ if (session.api.adapter.identity in botStatsToday) {
158
+ botStatsToday[session.api.adapter.identity].receivedMsg += 1;
159
+ } else if (!botStatsToday[session.api.adapter.identity]) {
160
+ botStatsToday[session.api.adapter.identity] = { sentMsg: 0, receivedMsg: 1, offlineTimes: 0 };
161
+ }
162
+ })
163
+ );
164
+ this.ctx.on(
165
+ "status",
166
+ async (data) => f((botStats, botStatsToday) => {
167
+ if (data.adapter.identity in botStats) {
168
+ botStats[data.adapter.identity].offlineTimes += 1;
169
+ } else {
170
+ botStats[data.adapter.identity] = {
171
+ ...data.adapter.status,
172
+ createTime: new Date(data.adapter.status.createTime).getTime(),
173
+ lastMsgTime: data.adapter.status.lastMsgTime ? new Date(data.adapter.status.lastMsgTime).getTime() : null
174
+ };
175
+ }
176
+ if (data.adapter.identity in botStatsToday) {
177
+ botStatsToday[data.adapter.identity].offlineTimes += 1;
178
+ } else if (!botStatsToday[data.adapter.identity]) {
179
+ botStatsToday[data.adapter.identity] = { sentMsg: 0, receivedMsg: 0, offlineTimes: 1 };
180
+ }
181
+ })
182
+ );
177
183
  }
178
184
  setVerifyHash(username, password) {
179
185
  const salt = generateToken();
@@ -373,14 +379,14 @@ class Webui extends import_kotori_bot.Service {
373
379
  }
374
380
  configGlobalUpdate(data) {
375
381
  for (const key in data) {
376
- if (key in this.ctx.config.global)
377
- this.ctx.config.global[key] = data[key];
382
+ if (key in this.ctx.config.global) this.ctx.config.global[key] = data[key];
378
383
  }
379
384
  }
380
385
  async configCommandsGet(name) {
381
- const CommandSettings = Object.entries(await this.ctx.db.get("command_settings")).map(
382
- ([name2, data]) => ({ name: name2, data })
383
- );
386
+ const CommandSettings = Object.entries(await this.ctx.db.get("command_settings")).map(([name2, data]) => ({
387
+ name: name2,
388
+ data
389
+ }));
384
390
  if (!name) return CommandSettings;
385
391
  return CommandSettings.find(({ name: targetName }) => name === targetName);
386
392
  }
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * @Package @kotori-bot/kotori-plugin-webui
3
- * @Version 1.5.1
3
+ * @Version 1.5.3
4
4
  * @Author Hotaru <me@hotaru.icu>
5
5
  * @Copyright 2024-2025 Hotaru. All rights reserved.
6
6
  * @License GPL-3.0
7
7
  * @Link https://github.com/kotorijs/kotori
8
- * @Date 2026/2/14 21:25:08
8
+ * @Date 2026/8/6 23:41:49
9
9
  */
10
10
  "use strict";
11
11
  var __defProp = Object.defineProperty;
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * @Package @kotori-bot/kotori-plugin-webui
3
- * @Version 1.5.1
3
+ * @Version 1.5.3
4
4
  * @Author Hotaru <me@hotaru.icu>
5
5
  * @Copyright 2024-2025 Hotaru. All rights reserved.
6
6
  * @License GPL-3.0
7
7
  * @Link https://github.com/kotorijs/kotori
8
- * @Date 2026/2/14 21:25:08
8
+ * @Date 2026/8/6 23:41:49
9
9
  */
10
10
  "use strict";
11
11
  var __defProp = Object.defineProperty;
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * @Package @kotori-bot/kotori-plugin-webui
3
- * @Version 1.5.1
3
+ * @Version 1.5.3
4
4
  * @Author Hotaru <me@hotaru.icu>
5
5
  * @Copyright 2024-2025 Hotaru. All rights reserved.
6
6
  * @License GPL-3.0
7
7
  * @Link https://github.com/kotorijs/kotori
8
- * @Date 2026/2/14 21:25:08
8
+ * @Date 2026/8/6 23:41:49
9
9
  */
10
10
  "use strict";
11
11
  var __create = Object.create;
@@ -1,5 +1,5 @@
1
1
  import '../types';
2
- import { type LoggerData, type Context } from 'kotori-bot';
2
+ import { type Context, type LoggerData } from 'kotori-bot';
3
3
  export default function (ctx: Context): {
4
4
  new (): {
5
5
  handle(data: LoggerData): void;
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * @Package @kotori-bot/kotori-plugin-webui
3
- * @Version 1.5.1
3
+ * @Version 1.5.3
4
4
  * @Author Hotaru <me@hotaru.icu>
5
5
  * @Copyright 2024-2025 Hotaru. All rights reserved.
6
6
  * @License GPL-3.0
7
7
  * @Link https://github.com/kotorijs/kotori
8
- * @Date 2026/2/14 21:25:08
8
+ * @Date 2026/8/6 23:41:49
9
9
  */
10
10
  "use strict";
11
11
  var __defProp = Object.defineProperty;
package/lib/ws/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * @Package @kotori-bot/kotori-plugin-webui
3
- * @Version 1.5.1
3
+ * @Version 1.5.3
4
4
  * @Author Hotaru <me@hotaru.icu>
5
5
  * @Copyright 2024-2025 Hotaru. All rights reserved.
6
6
  * @License GPL-3.0
7
7
  * @Link https://github.com/kotorijs/kotori
8
- * @Date 2026/2/14 21:25:08
8
+ * @Date 2026/8/6 23:41:49
9
9
  */
10
10
  "use strict";
11
11
  var __defProp = Object.defineProperty;
@@ -1,11 +1,11 @@
1
- {
2
- "webui.descr.webui": "View Webui status",
3
- "webui.option.webui": "Reset Webui account data",
4
- "webui.msg.webui.reset": "Webui account data has been reset",
5
- "webui.msg.webui.error": "Webui command only supports use in the console environment",
6
- "webui.msg.webui.prompt.user": "Please enter the Webui username:",
7
- "webui.msg.webui.prompt.pwd": "Please enter the Webui password:",
8
- "webui.msg.webui.success": "Configuration successful! Please enter the command again to view the running status",
9
- "webui.msg.webui": "Webui service has started! Running on port: {0}",
10
- "webui.msg.webui.uninitialized": "Webui account and password are not set. Please enter the {0}webui command to initialize"
11
- }
1
+ {
2
+ "webui.descr.webui": "View Webui status",
3
+ "webui.option.webui": "Reset Webui account data",
4
+ "webui.msg.webui.reset": "Webui account data has been reset",
5
+ "webui.msg.webui.error": "Webui command only supports use in the console environment",
6
+ "webui.msg.webui.prompt.user": "Please enter the Webui username:",
7
+ "webui.msg.webui.prompt.pwd": "Please enter the Webui password:",
8
+ "webui.msg.webui.success": "Configuration successful! Please enter the command again to view the running status",
9
+ "webui.msg.webui": "Webui service has started! Running on port: {0}",
10
+ "webui.msg.webui.uninitialized": "Webui account and password are not set. Please enter the {0}webui command to initialize"
11
+ }
@@ -1,11 +1,11 @@
1
- {
2
- "webui.descr.webui": "Webuiのステータスを表示",
3
- "webui.option.webui": "Webuiアカウントデータをリセット",
4
- "webui.msg.webui.reset": "Webuiアカウントデータがリセットされました",
5
- "webui.msg.webui.error": "Webuiコマンドはコンソール環境でのみ使用できます",
6
- "webui.msg.webui.prompt.user": "Webuiのユーザー名を入力してください:",
7
- "webui.msg.webui.prompt.pwd": "Webuiのパスワードを入力してください:",
8
- "webui.msg.webui.success": "設定に成功しました!もう一度コマンドを入力して稼働状況を表示してください",
9
- "webui.msg.webui": "Webuiサービスが開始されました!ポート{0}で実行中",
10
- "webui.msg.webui.uninitialized": "Webuiアカウントとパスワードが設定されていません。{0}webuiコマンドを入力して初期化してください"
11
- }
1
+ {
2
+ "webui.descr.webui": "Webuiのステータスを表示",
3
+ "webui.option.webui": "Webuiアカウントデータをリセット",
4
+ "webui.msg.webui.reset": "Webuiアカウントデータがリセットされました",
5
+ "webui.msg.webui.error": "Webuiコマンドはコンソール環境でのみ使用できます",
6
+ "webui.msg.webui.prompt.user": "Webuiのユーザー名を入力してください:",
7
+ "webui.msg.webui.prompt.pwd": "Webuiのパスワードを入力してください:",
8
+ "webui.msg.webui.success": "設定に成功しました!もう一度コマンドを入力して稼働状況を表示してください",
9
+ "webui.msg.webui": "Webuiサービスが開始されました!ポート{0}で実行中",
10
+ "webui.msg.webui.uninitialized": "Webuiアカウントとパスワードが設定されていません。{0}webuiコマンドを入力して初期化してください"
11
+ }
@@ -1,11 +1,11 @@
1
- {
2
- "webui.descr.webui": "查看 Webui 状态",
3
- "webui.option.webui": "重置 Webui 账户数据",
4
- "webui.msg.webui.reset": "Webui 账户数据已重置",
5
- "webui.msg.webui.error": "Webui 指令仅支持在控制台环境下使用",
6
- "webui.msg.webui.prompt.user": "请输入 Webui 用户名:",
7
- "webui.msg.webui.prompt.pwd": "请输入 Webui 密码:",
8
- "webui.msg.webui.success": "配置成功!请再次输入指令以查看运行状态",
9
- "webui.msg.webui": "Webui 服务已启动!运行端口:{0}",
10
- "webui.msg.webui.uninitialized": "当前未设置 Webui 账号与密码,请输入 {0}webui 指令以进行初始化"
11
- }
1
+ {
2
+ "webui.descr.webui": "查看 Webui 状态",
3
+ "webui.option.webui": "重置 Webui 账户数据",
4
+ "webui.msg.webui.reset": "Webui 账户数据已重置",
5
+ "webui.msg.webui.error": "Webui 指令仅支持在控制台环境下使用",
6
+ "webui.msg.webui.prompt.user": "请输入 Webui 用户名:",
7
+ "webui.msg.webui.prompt.pwd": "请输入 Webui 密码:",
8
+ "webui.msg.webui.success": "配置成功!请再次输入指令以查看运行状态",
9
+ "webui.msg.webui": "Webui 服务已启动!运行端口:{0}",
10
+ "webui.msg.webui.uninitialized": "当前未设置 Webui 账号与密码,请输入 {0}webui 指令以进行初始化"
11
+ }
@@ -1,11 +1,11 @@
1
- {
2
- "webui.descr.webui": "查看 Webui 狀態",
3
- "webui.option.webui": "重置 Webui 賬戶數據",
4
- "webui.msg.webui.reset": "Webui 賬戶數據已重置",
5
- "webui.msg.webui.error": "Webui 指令僅支持在控制台環境下使用",
6
- "webui.msg.webui.prompt.user": "請輸入 Webui 用戶名:",
7
- "webui.msg.webui.prompt.pwd": "請輸入 Webui 密碼:",
8
- "webui.msg.webui.success": "配置成功!請再次輸入指令以查看運行狀態",
9
- "webui.msg.webui": "Webui 服務已啓動!運行端口:{0}",
10
- "webui.msg.webui.uninitialized": "當前未設置 Webui 賬號與密碼,請輸入 {0}webui 指令以進行初始化"
11
- }
1
+ {
2
+ "webui.descr.webui": "查看 Webui 狀態",
3
+ "webui.option.webui": "重置 Webui 賬戶數據",
4
+ "webui.msg.webui.reset": "Webui 賬戶數據已重置",
5
+ "webui.msg.webui.error": "Webui 指令僅支持在控制台環境下使用",
6
+ "webui.msg.webui.prompt.user": "請輸入 Webui 用戶名:",
7
+ "webui.msg.webui.prompt.pwd": "請輸入 Webui 密碼:",
8
+ "webui.msg.webui.success": "配置成功!請再次輸入指令以查看運行狀態",
9
+ "webui.msg.webui": "Webui 服務已啓動!運行端口:{0}",
10
+ "webui.msg.webui.uninitialized": "當前未設置 Webui 賬號與密碼,請輸入 {0}webui 指令以進行初始化"
11
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kotori-bot/kotori-plugin-webui",
3
- "version": "1.5.2",
3
+ "version": "1.5.4",
4
4
  "description": "webui plugin",
5
5
  "main": "lib/index.js",
6
6
  "keywords": [