diff --git a/.gitignore b/.gitignore
index 9343a22..7018a64 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,4 @@
node_modules/
dist/shim-loader.js
investigation/
-test-vault/
-
+vaults/
diff --git a/scripts/patch-obsidian.js b/scripts/patch-obsidian.js
index 018bb9e..c4d8b8e 100644
--- a/scripts/patch-obsidian.js
+++ b/scripts/patch-obsidian.js
@@ -2,6 +2,7 @@
// Patches the extracted Obsidian asar for browser use:
// 1. Removes Content-Security-Policy meta tag
// 2. Injects shim-loader.js script (non-deferred, before all other scripts)
+// Patches both index.html and starter.html.
const fs = require("fs");
const path = require("path");
@@ -12,27 +13,29 @@ if (!asarDir) {
process.exit(1);
}
-const indexPath = path.join(asarDir, "index.html");
-if (!fs.existsSync(indexPath)) {
- console.error(`Not found: ${indexPath}`);
- process.exit(1);
+function patchHtml(filePath) {
+ if (!fs.existsSync(filePath)) {
+ console.warn(`[patch] Skipping (not found): ${filePath}`);
+ return;
+ }
+
+ let html = fs.readFileSync(filePath, "utf-8");
+
+ // Remove CSP meta tag
+ html = html.replace(
+ /\s*]*>\s*/g,
+ "\n",
+ );
+
+ // Inject shim-loader before the first \n' +
+ '\n' +
- '