fix version handling

This commit is contained in:
Nystik
2026-03-12 22:46:53 +01:00
parent 1e2971cea0
commit 168024ea4f
7 changed files with 34 additions and 4 deletions

View File

@@ -64,4 +64,18 @@ module.exports = {
obsidianAssetsPath:
process.env.OBSIDIAN_ASSETS_PATH ||
path.join(__dirname, "..", "investigation", "obsidian.asar.unpacked"),
get obsidianVersion() {
const assetsPath =
process.env.OBSIDIAN_ASSETS_PATH ||
path.join(__dirname, "..", "investigation", "obsidian.asar.unpacked");
try {
const pkg = JSON.parse(
fs.readFileSync(path.join(assetsPath, "package.json"), "utf-8"),
);
return pkg.version || "0.0.0";
} catch {
return "0.0.0";
}
},
};

View File

@@ -28,7 +28,7 @@ router.get("/info", (req, res) => {
name: vaultId,
path: vaultPath,
platform: process.platform,
version: "0.1.0",
version: config.obsidianVersion,
});
});