mioku-service-webui 4.4.2 → 4.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mioku-service-webui",
3
- "version": "4.4.2",
3
+ "version": "4.4.4",
4
4
  "description": "Mioku WebUI 服务",
5
5
  "main": "index.ts",
6
6
  "type": "module",
@@ -122,25 +122,38 @@ function resolveBackupFile(name: string): string {
122
122
  return fullPath;
123
123
  }
124
124
 
125
- async function pathSize(target: string): Promise<SizeResult> {
125
+ async function pathSize(
126
+ target: string,
127
+ visited: Set<string> = new Set(),
128
+ ): Promise<SizeResult> {
126
129
  let stat: fs.Stats;
127
130
  try {
128
- stat = await fs.promises.lstat(target);
131
+ stat = await fs.promises.stat(target);
129
132
  } catch {
130
133
  return { size: 0, files: 0, directories: 0 };
131
134
  }
132
135
 
133
- if (stat.isSymbolicLink()) {
134
- return { size: 0, files: 0, directories: 0 };
135
- }
136
-
137
136
  if (!stat.isDirectory()) {
138
137
  return { size: stat.size, files: 1, directories: 0 };
139
138
  }
140
139
 
140
+ // Follow symlinks to their real target. In a bun workspace, node_modules
141
+ // entries are symlinks into packages/* — skipping them reported 0B. Guard
142
+ // against cycles / repeated targets via realpath.
143
+ let real: string;
144
+ try {
145
+ real = await fs.promises.realpath(target);
146
+ } catch {
147
+ return { size: 0, files: 0, directories: 0 };
148
+ }
149
+ if (visited.has(real)) {
150
+ return { size: 0, files: 0, directories: 0 };
151
+ }
152
+ visited.add(real);
153
+
141
154
  const entries = await fs.promises.readdir(target).catch(() => []);
142
155
  const results = await Promise.all(
143
- entries.map((entry) => pathSize(path.join(target, entry))),
156
+ entries.map((entry) => pathSize(path.join(target, entry), visited)),
144
157
  );
145
158
  return results.reduce<SizeResult>(
146
159
  (total, item) => ({
package/routes/db.ts CHANGED
@@ -306,10 +306,10 @@ export function createServiceConfigRoutes() {
306
306
  return c.json({ ok: true, data: overview });
307
307
  });
308
308
 
309
- app.get("/:name/page", (c) => {
309
+ app.get("/:name/page", async (c) => {
310
310
  const name = c.req.param("name");
311
311
  const manifest = loadServiceConfigPage(name);
312
- const configs = getServiceConfigs(name);
312
+ const configs = await getServiceConfigs(name);
313
313
 
314
314
  if (!manifest) {
315
315
  return c.json({ ok: true, data: null });
@@ -329,16 +329,16 @@ export function createServiceConfigRoutes() {
329
329
  });
330
330
  });
331
331
 
332
- app.get("/:name", (c) => {
332
+ app.get("/:name", async (c) => {
333
333
  const name = c.req.param("name");
334
- return c.json({ ok: true, data: getServiceConfigs(name) });
334
+ return c.json({ ok: true, data: await getServiceConfigs(name) });
335
335
  });
336
336
 
337
337
  app.put("/:name/:config", async (c) => {
338
338
  const serviceName = c.req.param("name");
339
339
  const configName = c.req.param("config");
340
340
  const body = await c.req.json();
341
- updateServiceConfig(serviceName, configName, body);
341
+ await updateServiceConfig(serviceName, configName, body);
342
342
  return c.json({ ok: true });
343
343
  });
344
344
 
package/system.ts CHANGED
@@ -625,10 +625,10 @@ function readInstalledWebUIVersion(): string {
625
625
  }
626
626
  }
627
627
 
628
- // Fallback: read from mioku-webui package.json directly
629
- // mioku-webui is at repo root, which is ../../ from packages/mioku-service-webui
630
- // but since service runs from example/, we need example/../../mioku-webui
631
- const webuiProjectDir = path.join(process.cwd(), "..", "..", "mioku-webui");
628
+ // Fallback: read from mioku-webui package.json directly.
629
+ // The service runs from example/, so mioku-webui at the repo root is one
630
+ // level up — same resolution as resolveWebUIProjectDir().
631
+ const webuiProjectDir = resolveWebUIProjectDir();
632
632
  const webuiPkgPath = path.join(webuiProjectDir, "package.json");
633
633
  if (fs.existsSync(webuiPkgPath)) {
634
634
  const pkg = readPackageJson(webuiProjectDir);
@@ -1688,7 +1688,12 @@ async function fetchLatestMiokuUpdate(
1688
1688
  const job = (async () => {
1689
1689
  const cwd = process.cwd();
1690
1690
  const rootPkg = readRootPackageJson() || {};
1691
- const currentVersion = normalizeVersionSpec(rootPkg?.version || "unknown");
1691
+ // example/package.json has no version field; read the installed mioku
1692
+ // package so the current version matches what the dashboard reports.
1693
+ const miokuPkg = readMiokuPackageJson();
1694
+ const currentVersion = normalizeVersionSpec(
1695
+ miokuPkg?.version || rootPkg?.version || "unknown",
1696
+ );
1692
1697
 
1693
1698
  // Get latest version from npm registry
1694
1699
  let latestVersion = currentVersion;