commit
Add Windows update and jpcl install locks
- Windows lock (stage 10-11, 20%): fake update screen that stalls and jumps to 100%, reveals "Wait... this is Linux", saves the stage and reloads the page - jpcl lock (stage 12-13, always after the reboot): boot log with an install prompt; accepts uv add/pip install/tool install jpcl and deno add/install/i npm:jpcl-lang, laughs at pip, npm, pnpm and bun, and corrects wrong package names and the missing npm: prefix - Locks can ask for a reload instead of an in-page continue Co-Authored-By: Sandrone <[email protected]>
diff --git a/index.html b/index.html
index 669edb8..a70bd7c 100644
--- a/index.html
+++ b/index.html
@@ -138,5 +138,50 @@
</details>
</div>
</div>
+
+ <div class="lock lock-windows">
+ <div id="windows-updating">
+ <div class="spinner" aria-hidden="true"></div>
+ <p>Working on updates</p>
+ <p id="windows-progress" role="status">0% complete</p>
+ <p>Don't turn off your computer.</p>
+ </div>
+
+ <div id="windows-linux" hidden>
+ <p class="windows-linux-title" role="alert">Wait… this is Linux.</p>
+ <p>Rebooting…</p>
+ </div>
+ </div>
+
+ <div class="lock lock-jpcl">
+ <pre class="boot-log" role="alert">[ OK ] Started redirect service
+[ OK ] Mounted /dev/dough
+[FAIL] Failed to load module jpcl
+error: jpcl not found. Install it to finish booting.</pre>
+
+ <form class="install-form" id="jpcl-form">
+ <label for="jpcl-command">Install command</label>
+
+ <div class="install-row">
+ <span aria-hidden="true">$</span>
+ <input
+ id="jpcl-command"
+ type="text"
+ autocomplete="off"
+ autocapitalize="off"
+ autocorrect="off"
+ spellcheck="false"
+ >
+ <button type="submit">Run</button>
+ </div>
+ </form>
+
+ <p class="lock-status" id="jpcl-status" role="status"></p>
+
+ <details class="hint">
+ <summary>Hint</summary>
+ <p>Python: uv add jpcl · Node: deno add npm:jpcl-lang</p>
+ </details>
+ </div>
</body>
</html>
diff --git a/redirect.js b/redirect.js
index 9328722..ddcbc97 100644
--- a/redirect.js
+++ b/redirect.js
@@ -41,6 +41,33 @@ const bootDevices = [
const targetDevice = "Redirect Drive";
+const windowsUpdate = {
+ tickMs: 500,
+ stallChance: 0.4,
+ maxStepPercent: 12,
+ rebootDelayMs: 3000,
+};
+
+const laughedAtTools = [
+ "pip",
+ "pip3",
+ "bun",
+ "npm",
+ "pnpm",
+];
+
+const laughLines = [
+ "HAHAHAHA. {tool}? Adorable. uv and Deno are better.",
+ "{tool}? In this decade? Use uv or Deno.",
+ "Pfft. {tool}. uv and Deno are faster, use one of those.",
+ "Imagine still using {tool}. uv and Deno exist.",
+];
+
+// Options (like --dev) may sit between the subcommand and the package
+const uvInstall = /^uv (?:add|pip install|tool install)(?: -\S+)* (\S+)$/;
+
+const denoInstall = /^deno (?:add|install|i)(?: -\S+)* (\S+)$/;
+
const decoyCount = 6;
const konamiCode = [
@@ -436,6 +463,120 @@ function biosLock(onSolved) {
}
}
+function windowsLock(onSolved) {
+ const progress = document.getElementById("windows-progress");
+ const updating = document.getElementById("windows-updating");
+ const linux = document.getElementById("windows-linux");
+ let percent = 0;
+
+ const timer = setInterval(() => {
+ if (Math.random() > windowsUpdate.stallChance) {
+ const step = 1 + Math.floor(Math.random() * windowsUpdate.maxStepPercent);
+ percent = Math.min(100, percent + step);
+ }
+
+ progress.textContent = `${percent}% complete`;
+
+ if (percent < 100) {
+ return;
+ }
+
+ clearInterval(timer);
+ updating.hidden = true;
+ linux.hidden = false;
+
+ setTimeout(
+ () => onSolved({ reload: true }),
+ windowsUpdate.rebootDelayMs,
+ );
+ }, windowsUpdate.tickMs);
+}
+
+function judgeInstall(rawCommand) {
+ const command = rawCommand.trim().toLowerCase().replace(/\s+/g, " ");
+ const tool = command.split(" ")[0];
+
+ if (!command) {
+ return { message: "Type an install command." };
+ }
+
+ if (tool === "sudo") {
+ return { message: "No sudo. Never sudo a package manager." };
+ }
+
+ if (laughedAtTools.includes(tool) || /^python3? -m pip\b/.test(command)) {
+ const shownTool = tool.startsWith("python") ? "pip" : tool;
+ return { message: pickRandom(laughLines).replace("{tool}", shownTool) };
+ }
+
+ const uvPackage = command.match(uvInstall)?.[1];
+
+ if (uvPackage) {
+ if (/^jpcl(?:[=<>~!]=\S+)?$/.test(uvPackage)) {
+ return {
+ solved: true,
+ message: "Installed jpcl. Booting…",
+ };
+ }
+
+ if (uvPackage.startsWith("jpcl-lang")) {
+ return { message: "jpcl-lang is the Node package. Python's is jpcl." };
+ }
+
+ return { message: `No package named ${uvPackage}. Python's is jpcl.` };
+ }
+
+ const denoPackage = command.match(denoInstall)?.[1];
+
+ if (denoPackage) {
+ if (/^npm:jpcl-lang(?:@\S+)?$/.test(denoPackage)) {
+ return {
+ solved: true,
+ message: "Installed jpcl-lang. Booting…",
+ };
+ }
+
+ if (denoPackage.startsWith("jpcl-lang")) {
+ return { message: "Deno needs the npm: prefix: npm:jpcl-lang" };
+ }
+
+ if (/^npm:jpcl(?:@\S+)?$/.test(denoPackage)) {
+ return { message: "jpcl is the Python package. Node's is jpcl-lang." };
+ }
+
+ return { message: `No package named ${denoPackage}. Node's is npm:jpcl-lang.` };
+ }
+
+ if (tool === "uv" || tool === "deno") {
+ return { message: `Right tool, wrong command. Install the package with ${tool}.` };
+ }
+
+ return { message: `${tool}: command not found. Use uv or Deno.` };
+}
+
+function jpclLock(onSolved) {
+ const form = document.getElementById("jpcl-form");
+ const input = document.getElementById("jpcl-command");
+ const status = document.getElementById("jpcl-status");
+ const listeners = new AbortController();
+
+ form.addEventListener(
+ "submit",
+ (event) => {
+ event.preventDefault();
+
+ const verdict = judgeInstall(input.value);
+ status.textContent = verdict.message;
+
+ if (verdict.solved) {
+ listeners.abort();
+ setTimeout(onSolved, 800);
+ }
+ },
+ { signal: listeners.signal },
+ );
+}
+
const locks = [
{
name: "konami",
@@ -462,6 +603,17 @@ const locks = [
chance: 0.2,
run: biosLock,
},
+ {
+ name: "windows",
+ chance: 0.2,
+ run: windowsLock,
+ },
+ {
+ // Always follows the Windows "reboot"
+ name: "jpcl",
+ chance: 1,
+ run: jpclLock,
+ },
];
// Roll this stage's chance to jam, then show its lock or redirect
@@ -478,9 +630,14 @@ function visit() {
if (lock && stage % 2 === 1) {
document.body.dataset.lock = lock.name;
- lock.run(() => {
+ lock.run((options) => {
writeStage(stage + 1);
- visit();
+
+ if (options?.reload) {
+ location.reload();
+ } else {
+ visit();
+ }
});
} else {
delete document.body.dataset.lock;
diff --git a/style.css b/style.css
index 12e02bd..b7afc9b 100644
--- a/style.css
+++ b/style.css
@@ -83,14 +83,16 @@ body[data-lock] .working-only {
body[data-lock="konami"] .lock-konami,
body[data-lock="power"] .lock-power,
body[data-lock="captcha"] .lock-captcha,
-body[data-lock="overheat"] .lock-overheat {
+body[data-lock="overheat"] .lock-overheat,
+body[data-lock="jpcl"] .lock-jpcl {
display: grid;
justify-items: center;
gap: 1rem;
}
body[data-lock="captcha"] .spinner,
-body[data-lock="overheat"] .spinner {
+body[data-lock="overheat"] .spinner,
+body[data-lock="jpcl"] .spinner {
animation-play-state: paused;
}
@@ -309,6 +311,100 @@ body[data-lock="bios"] .lock-bios {
text-align: left;
}
+/* Fake update screen also takes over everything, fixed colours */
+.lock-windows {
+ position: fixed;
+ inset: 0;
+ max-width: none;
+ padding: 16px;
+ place-content: center;
+ justify-items: center;
+ background: #0063b1;
+ color: #ffffff;
+ font-family: "Segoe UI", system-ui, sans-serif;
+ font-size: 1.25rem;
+}
+
+body[data-lock="windows"] .lock-windows {
+ display: grid;
+}
+
+.lock-windows > div {
+ display: grid;
+ justify-items: center;
+ gap: 0.75rem;
+}
+
+.lock-windows > div[hidden] {
+ display: none;
+}
+
+.lock-windows .spinner {
+ border-color: rgb(255 255 255 / 0.3);
+ border-top-color: #ffffff;
+ animation-play-state: running;
+}
+
+.windows-linux-title {
+ font-size: 2rem;
+ font-weight: 700;
+}
+
+.boot-log {
+ width: min(32rem, 100%);
+ margin: 0;
+ padding: 1rem;
+ box-sizing: border-box;
+ border-radius: 0.5rem;
+ background: #111111;
+ color: #d4d4d4;
+ font-family: ui-monospace, "Courier New", monospace;
+ font-size: 0.85rem;
+ white-space: pre-wrap;
+}
+
+.install-form {
+ display: grid;
+ gap: 0.5rem;
+ width: min(32rem, 100%);
+}
+
+.install-row {
+ display: flex;
+ align-items: center;
+ gap: 0.5rem;
+ font-family: ui-monospace, "Courier New", monospace;
+}
+
+.install-row input {
+ flex: 1;
+ min-width: 0;
+ min-height: 2.75rem;
+ padding: 0 0.75rem;
+ border: 2px solid var(--accent);
+ border-radius: 0.5rem;
+ background: var(--track);
+ color: var(--text);
+ font: inherit;
+}
+
+.install-row input:focus-visible {
+ outline: 3px solid var(--accent);
+ outline-offset: 2px;
+}
+
+.install-row button {
+ min-height: 2.75rem;
+ padding: 0 1rem;
+ border: 2px solid var(--accent);
+ border-radius: 0.5rem;
+ background: var(--accent);
+ color: var(--background);
+ font: inherit;
+ font-weight: 600;
+ cursor: pointer;
+}
+
.hint summary {
color: var(--accent);
cursor: pointer;