mioku-service-webui 4.0.4 → 4.0.5

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 (2) hide show
  1. package/package.json +1 -1
  2. package/system.ts +18 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mioku-service-webui",
3
- "version": "4.0.4",
3
+ "version": "4.0.5",
4
4
  "description": "Mioku WebUI 服务",
5
5
  "main": "index.ts",
6
6
  "type": "module",
package/system.ts CHANGED
@@ -2240,7 +2240,22 @@ export function updateMiokuConfig(config: Partial<MiokuConfig>): MiokuConfig {
2240
2240
  }
2241
2241
 
2242
2242
  export function getAvailablePlugins(): string[] {
2243
- const rootPkg = readRootPackageJson();
2244
- const miokiConfig = rootPkg?.mioki || {};
2245
- return Array.isArray(miokiConfig.plugins) ? miokiConfig.plugins : [];
2243
+ const modulesPath = NODE_MODULES_DIR;
2244
+ if (!fs.existsSync(modulesPath)) {
2245
+ // Fallback to config-based reading
2246
+ const rootPkg = readRootPackageJson();
2247
+ const miokiConfig = rootPkg?.mioki || {};
2248
+ return Array.isArray(miokiConfig.plugins) ? miokiConfig.plugins : [];
2249
+ }
2250
+
2251
+ const plugins: string[] = [];
2252
+ const entries = fs.readdirSync(modulesPath, { withFileTypes: true });
2253
+ for (const entry of entries) {
2254
+ if (!entry.name.startsWith("mioku-plugin-")) continue;
2255
+ const fullPath = path.join(modulesPath, entry.name);
2256
+ const stat = fs.lstatSync(fullPath);
2257
+ if (!stat.isDirectory() && !stat.isSymbolicLink()) continue;
2258
+ plugins.push(entry.name.replace(/^mioku-plugin-/, ""));
2259
+ }
2260
+ return plugins.sort((a, b) => a.localeCompare(b));
2246
2261
  }