+
+
+{% endblock %}`;
+
+async function exists(path) {
+ try {
+ await access(path);
+ return true;
+ } catch {
+ return false;
+ }
+}
+
+let checked = 0;
+let patched = 0;
+
+for (const filePath of candidates) {
+ if (!(await exists(filePath))) {
+ continue;
+ }
+
+ checked += 1;
+
+ const source = await readFile(filePath, "utf8");
+
+ if (source.includes("noautocontinue")) {
+ continue;
+ }
+
+ if (!source.includes(oldBlock)) {
+ continue;
+ }
+
+ const updated = source.replace(oldBlock, newBlock);
+ await writeFile(filePath, updated, "utf8");
+ patched += 1;
+}
+
+if (checked === 0) {
+ console.log("[postinstall] No session login templates found");
+} else if (patched === 0) {
+ console.log("[postinstall] session login auto-continue already patched");
+} else {
+ console.log(`[postinstall] Patched session login auto-continue in ${patched} file(s)`);
+}
diff --git a/start.example.sh b/start.example.sh
index 6116fc41..20d7ca54 100644
--- a/start.example.sh
+++ b/start.example.sh
@@ -55,5 +55,6 @@ unset DEBUG
/usr/local/bin/node scripts/patch-frontend-serviceworker-file.mjs
/usr/local/bin/node scripts/patch-conversations-collection-guards.mjs
/usr/local/bin/node scripts/patch-indieauth-devmode-guard.mjs
+/usr/local/bin/node scripts/patch-session-login-autocontinue.mjs
exec /usr/local/bin/node node_modules/@indiekit/indiekit/bin/cli.js serve --config indiekit.config.mjs