fix version handling
This commit is contained in:
parent
1e2971cea0
commit
168024ea4f
7 changed files with 34 additions and 4 deletions
|
|
@ -33,7 +33,7 @@ RUN chmod +x /app/scripts/entrypoint.sh
|
|||
|
||||
ENV PORT=8080
|
||||
ENV VAULT_ROOT=/vaults
|
||||
ENV OBSIDIAN_VERSION=1.8.9
|
||||
ENV OBSIDIAN_VERSION=1.12.4
|
||||
ENV OBSIDIAN_ASSETS_PATH=/app/obsidian-app
|
||||
|
||||
EXPOSE 8080
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ router.get("/info", (req, res) => {
|
|||
name: vaultId,
|
||||
path: vaultPath,
|
||||
platform: process.platform,
|
||||
version: "0.1.0",
|
||||
version: config.obsidianVersion,
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ const listeners = new Map();
|
|||
|
||||
const syncHandlers = {
|
||||
vault: () => window.__vaultConfig || { id: "default-vault", path: "/" },
|
||||
version: () => "1.8.9",
|
||||
version: () => window.__obsidianVersion || "0.0.0",
|
||||
"is-dev": () => false,
|
||||
"file-url": () =>
|
||||
"/vault-files/" + encodeURIComponent(window.__currentVaultId || "") + "/",
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ export const appShim = {
|
|||
},
|
||||
|
||||
getVersion() {
|
||||
return "1.8.9";
|
||||
return window.__obsidianVersion || "0.0.0";
|
||||
},
|
||||
|
||||
getName() {
|
||||
|
|
|
|||
|
|
@ -25,6 +25,17 @@ export const remoteShim = {
|
|||
screen: screenShim,
|
||||
nativeImage: nativeImageShim,
|
||||
Notification: notificationShim,
|
||||
safeStorage: {
|
||||
isEncryptionAvailable() {
|
||||
return false;
|
||||
},
|
||||
encryptString(plainText) {
|
||||
return Buffer.from(plainText);
|
||||
},
|
||||
decryptString(encrypted) {
|
||||
return encrypted.toString();
|
||||
},
|
||||
},
|
||||
|
||||
getCurrentWindow() {
|
||||
return windowShim._current();
|
||||
|
|
|
|||
|
|
@ -141,11 +141,16 @@ window.__currentVaultId = _urlParams.get("vault") || "";
|
|||
if (xhr.status === 200) {
|
||||
const info = JSON.parse(xhr.responseText);
|
||||
window.__currentVaultId = info.id;
|
||||
window.__obsidianVersion = info.version || "0.0.0";
|
||||
window.__vaultConfig = {
|
||||
id: info.id,
|
||||
path: "/",
|
||||
};
|
||||
console.log("[obsidian-bridge] Vault:", window.__vaultConfig);
|
||||
console.log(
|
||||
"[obsidian-bridge] Obsidian version:",
|
||||
window.__obsidianVersion,
|
||||
);
|
||||
} else {
|
||||
console.warn("[obsidian-bridge] No vault found, will show manager");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue