mioku-service-webui 4.11.0 → 4.11.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mioku-service-webui",
3
- "version": "4.11.0",
3
+ "version": "4.11.1",
4
4
  "description": "Mioku WebUI 服务",
5
5
  "main": "index.ts",
6
6
  "type": "module",
package/routes/config.ts CHANGED
@@ -23,7 +23,6 @@ export function createConfigRoutes() {
23
23
  logger.info(`[webui-action] config.mioku.update`, {
24
24
  owners: body?.owners?.length,
25
25
  admins: body?.admins?.length,
26
- onebotInstances: body?.onebotInstances?.length,
27
26
  plugins: body?.plugins?.length,
28
27
  coreConfigured: Boolean(body?.core),
29
28
  });
package/system.ts CHANGED
@@ -75,15 +75,6 @@ function normalizeRepositoryUrl(repository: any): string {
75
75
  return url.replace(/\.git$/, "");
76
76
  }
77
77
 
78
- export interface OneBotInstanceConfig {
79
- protocol?: string;
80
- host?: string;
81
- port?: number;
82
- token?: string;
83
- reconnect?: boolean;
84
- [key: string]: unknown;
85
- }
86
-
87
78
  const SYSTEM_PLUGIN_NAMES = new Set(["chat", "help"]);
88
79
  const SYSTEM_SERVICE_NAMES = new Set(["ai", "config", "help", "screenshot"]);
89
80
  const CORE_CONFIG_PATH = path.join(
@@ -2431,7 +2422,6 @@ export interface MiokuConfig {
2431
2422
  owners: string[];
2432
2423
  admins: string[];
2433
2424
  plugins: string[];
2434
- onebotInstances: OneBotInstanceConfig[];
2435
2425
  core: CoreSystemConfig;
2436
2426
  }
2437
2427
 
@@ -2439,33 +2429,6 @@ function toStringArray(input: unknown): string[] {
2439
2429
  return Array.isArray(input) ? input.map((v) => String(v)) : [];
2440
2430
  }
2441
2431
 
2442
- function normalizeOneBotInstances(input: unknown): OneBotInstanceConfig[] {
2443
- if (!Array.isArray(input)) return [];
2444
- return input
2445
- .filter((item) => item && typeof item === "object")
2446
- .map((item: any) => ({
2447
- ...item,
2448
- protocol: item.protocol === "wss" ? "wss" : "ws",
2449
- host: typeof item.host === "string" && item.host ? item.host : "localhost",
2450
- port:
2451
- typeof item.port === "number" && Number.isFinite(item.port)
2452
- ? item.port
2453
- : 3001,
2454
- token: typeof item.token === "string" ? item.token : "",
2455
- reconnect: item.reconnect !== false,
2456
- }));
2457
- }
2458
-
2459
- function getOneBotInstancesFromPkg(miokuConfig: any): OneBotInstanceConfig[] {
2460
- const adapters =
2461
- miokuConfig && typeof miokuConfig === "object" ? miokuConfig.adapters : null;
2462
- const onebotv11 =
2463
- adapters && typeof adapters === "object" ? adapters.onebotv11 : null;
2464
- const instances =
2465
- onebotv11 && typeof onebotv11 === "object" ? onebotv11.instances : null;
2466
- return normalizeOneBotInstances(instances);
2467
- }
2468
-
2469
2432
  export function getMiokuConfig(): MiokuConfig {
2470
2433
  const rootPkg = readRootPackageJsonSafe();
2471
2434
  const miokuConfig =
@@ -2477,7 +2440,6 @@ export function getMiokuConfig(): MiokuConfig {
2477
2440
  owners: toStringArray(miokuConfig.owners),
2478
2441
  admins: toStringArray(miokuConfig.admins),
2479
2442
  plugins: toStringArray(miokuConfig.plugins),
2480
- onebotInstances: getOneBotInstancesFromPkg(miokuConfig),
2481
2443
  core: getCoreSystemConfig(),
2482
2444
  };
2483
2445
  }
@@ -2494,12 +2456,10 @@ export function updateMiokuConfig(config: Partial<MiokuConfig>): MiokuConfig {
2494
2456
  plugins: Array.isArray(config.plugins)
2495
2457
  ? config.plugins.map((v) => String(v))
2496
2458
  : current.plugins,
2497
- onebotInstances: Array.isArray(config.onebotInstances)
2498
- ? normalizeOneBotInstances(config.onebotInstances)
2499
- : current.onebotInstances,
2500
2459
  core: config.core ? updateCoreSystemConfig(config.core) : current.core,
2501
2460
  };
2502
2461
 
2462
+ // 适配器配置(mioku.adapters)由适配器配置页维护,这里不再改写
2503
2463
  const rootPkg = readRootPackageJson();
2504
2464
  const miokuConfig =
2505
2465
  typeof rootPkg.mioku === "object" && rootPkg.mioku !== null
@@ -2510,17 +2470,6 @@ export function updateMiokuConfig(config: Partial<MiokuConfig>): MiokuConfig {
2510
2470
  miokuConfig.admins = updated.admins;
2511
2471
  miokuConfig.plugins = updated.plugins;
2512
2472
 
2513
- const adapters =
2514
- typeof miokuConfig.adapters === "object" && miokuConfig.adapters !== null
2515
- ? miokuConfig.adapters
2516
- : {};
2517
- const onebotv11 =
2518
- typeof adapters.onebotv11 === "object" && adapters.onebotv11 !== null
2519
- ? adapters.onebotv11
2520
- : {};
2521
- adapters.onebotv11 = { ...onebotv11, instances: updated.onebotInstances };
2522
- miokuConfig.adapters = adapters;
2523
-
2524
2473
  rootPkg.mioku = miokuConfig;
2525
2474
  writeRootPackageJson(rootPkg);
2526
2475