Onboarding: rely on https cookie redirect, remove DietPi mentions

This commit is contained in:
Aaron
2025-12-13 14:13:51 -05:00
parent 357453eed4
commit 471e242427

View File

@@ -21,7 +21,7 @@
<div class="badges"> <div class="badges">
<span class="badge"><span class="dot"></span> Local-only traffic</span> <span class="badge"><span class="dot"></span> Local-only traffic</span>
<span class="badge"><span class="dot"></span> Works for Pi-Kit & DietPi dashboards</span> <span class="badge"><span class="dot"></span> Covers the Pi-Kit dashboard</span>
<span class="badge"><span class="dot"></span> HTTPS ready once trusted</span> <span class="badge"><span class="dot"></span> HTTPS ready once trusted</span>
</div> </div>
@@ -35,7 +35,7 @@
<section class="steps"> <section class="steps">
<h3>Why switch to HTTPS?</h3> <h3>Why switch to HTTPS?</h3>
<ul> <ul>
<li>Encrypts traffic on your LAN so no one can snoop your Pi-Kit or DietPi dashboards.</li> <li>Encrypts traffic on your LAN so no one can snoop your Pi-Kit dashboard.</li>
<li>Stops mixed-content / “not secure” browser warnings.</li> <li>Stops mixed-content / “not secure” browser warnings.</li>
<li>Needed for some browser features (clipboard, notifications, service workers).</li> <li>Needed for some browser features (clipboard, notifications, service workers).</li>
</ul> </ul>
@@ -52,7 +52,7 @@
<section class="steps"> <section class="steps">
<h3>Install the Pi-Kit CA (recommended, one-time)</h3> <h3>Install the Pi-Kit CA (recommended, one-time)</h3>
<p>This removes future warnings for both Pi-Kit and DietPi dashboards.</p> <p>This removes future warnings for the Pi-Kit dashboard.</p>
<details> <details>
<summary>Windows</summary> <summary>Windows</summary>
<p>Run <strong>mmc</strong> → Add/Remove Snap-in → Certificates (Computer) → Trusted Root CAs → Import <em>pikit-ca.crt</em>.</p> <p>Run <strong>mmc</strong> → Add/Remove Snap-in → Certificates (Computer) → Trusted Root CAs → Import <em>pikit-ca.crt</em>.</p>
@@ -89,18 +89,7 @@
<script> <script>
(function () { (function () {
const target = `https://${location.hostname}`; const target = `https://${location.hostname}`;
const log = (m) => console.log("[pikit onboarding]", m); const hasCookie = document.cookie.includes("pikit_https_ok=1");
async function probe() {
try {
await fetch(`${target}/api/status`, { mode: "no-cors", cache: "no-store" });
log("HTTPS reachable, redirecting");
document.cookie = "pikit_https_ok=1; Path=/; Max-Age=2592000; SameSite=Lax";
window.location = target;
} catch (e) {
log("HTTPS probe failed; staying on onboarding page");
}
}
document.getElementById("continueBtn").addEventListener("click", () => { document.getElementById("continueBtn").addEventListener("click", () => {
window.location = target; window.location = target;
@@ -144,7 +133,9 @@
}); });
}); });
probe(); if (hasCookie) {
window.location = target;
}
})(); })();
</script> </script>
</body> </body>