mirror of
https://github.com/Nystik-gh/ignis.git
synced 2026-06-17 04:35:53 +00:00
fix first launch vault issue
This commit is contained in:
@@ -10,6 +10,13 @@ const vaultRoot =
|
||||
? path.dirname(process.env.VAULT_PATH)
|
||||
: path.join(__dirname, "..", "vaults"));
|
||||
|
||||
// Ensure vault root exists
|
||||
try {
|
||||
fs.mkdirSync(vaultRoot, { recursive: true });
|
||||
} catch (e) {
|
||||
console.error("[config] Failed to create VAULT_ROOT:", vaultRoot, e.message);
|
||||
}
|
||||
|
||||
function discoverVaults() {
|
||||
const vaults = {};
|
||||
try {
|
||||
@@ -22,6 +29,17 @@ function discoverVaults() {
|
||||
} catch (e) {
|
||||
console.error("[config] Failed to read VAULT_ROOT:", vaultRoot, e.message);
|
||||
}
|
||||
// Create a default vault if none exist
|
||||
if (Object.keys(vaults).length === 0) {
|
||||
const defaultPath = path.join(vaultRoot, "My Vault");
|
||||
try {
|
||||
fs.mkdirSync(path.join(defaultPath, ".obsidian"), { recursive: true });
|
||||
vaults["My Vault"] = defaultPath;
|
||||
console.log("[config] Created default vault: My Vault");
|
||||
} catch (e) {
|
||||
console.error("[config] Failed to create default vault:", e.message);
|
||||
}
|
||||
}
|
||||
return vaults;
|
||||
}
|
||||
|
||||
|
||||
@@ -146,6 +146,8 @@ window.__currentVaultId = _urlParams.get("vault") || "";
|
||||
path: "/",
|
||||
};
|
||||
console.log("[obsidian-bridge] Vault:", window.__vaultConfig);
|
||||
} else {
|
||||
console.warn("[obsidian-bridge] No vault found, will show manager");
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("[obsidian-bridge] Failed to fetch vault config:", e);
|
||||
|
||||
Reference in New Issue
Block a user