mioku-service-webui 4.4.2 → 4.4.3
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 +1 -1
- package/routes/data-management.ts +20 -7
- package/system.ts +10 -5
package/package.json
CHANGED
|
@@ -122,25 +122,38 @@ function resolveBackupFile(name: string): string {
|
|
|
122
122
|
return fullPath;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
async function pathSize(
|
|
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.
|
|
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/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
|
|
630
|
-
//
|
|
631
|
-
const webuiProjectDir =
|
|
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
|
-
|
|
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;
|