From 291e5b0cc2d5f1c510775e8e17d6b78659e56f24 Mon Sep 17 00:00:00 2001
From: memdmp <memdmp@estrogen.zone>
Date: Thu, 27 Feb 2025 16:51:14 +0100
Subject: feat: new canary, move to /~mem/ on estrogen.zone

---
 src/routes/+page.svelte | 141 ++++++++++++++++++++++++------------------------
 1 file changed, 72 insertions(+), 69 deletions(-)

(limited to 'src/routes/+page.svelte')

diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index d96dda2..7bbd52c 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -13,11 +13,12 @@
  */
  -->
 <script lang="ts">
-  import logo from "./boot-logo.png";
-  import "./anim.css";
-  import { architecture, hostname, tty, versions } from "./distro-info";
-  import { login, ttyLines, type RenderBlock, type TTYText } from "./shared";
-  import { onDestroy, onMount } from "svelte";
+  import logo from './boot-logo.png';
+  import './anim.css';
+  import { architecture, hostname, tty, versions } from './distro-info';
+  import { login, ttyLines, type RenderBlock, type TTYText } from './shared';
+  import { onDestroy, onMount } from 'svelte';
+  import { base } from '$app/paths';
 
   const initTagLine = `line flex flex-row flex-wrap gap-3 justify-between`;
 
@@ -36,8 +37,8 @@
     skipAnimation?: boolean;
   } = $props();
   onMount(() => {
-    if (skipAnimation && location.pathname !== "/skip-animation")
-      history.replaceState({}, "", "/skip-animation");
+    if (skipAnimation && location.pathname !== base + '/skip-animation')
+      history.replaceState({}, '', base + '/skip-animation');
   });
 
   let isScripted = $state(false);
@@ -53,7 +54,7 @@
   <span class="text-[{colour}]">*</span>
 {/snippet}
 {#snippet okTagLeft()}
-  {@render tagLeft("#51f051")}
+  {@render tagLeft('#51f051')}
 {/snippet}
 {#snippet tagRight(innerText: string, innerColour: string)}
   <span class="text-[#5f5fff]">[</span>
@@ -61,7 +62,7 @@
   <span class="text-[#5f5fff]">]</span>
 {/snippet}
 {#snippet okTagRight()}
-  {@render tagRight("ok", "#51f051")}
+  {@render tagRight('ok', '#51f051')}
 {/snippet}
 {#snippet okLine(text: string, classes?: string, rightClass?: string)}
   <div class="{initTagLine}{classes ? ' ' + classes : ''}">
@@ -90,28 +91,30 @@
         ? ` underline`
         : ' no-underline'} inline"
     >{#if section.raw}{@html section.value}{:else}{#each section.value
-        .split("\n")
+        .split('\n')
         .map( (l, i, a) => (i === a.length - 1 ? [0, l] : [1, l]), ) as [nl, l]}{l}{#if nl}<br
           />{/if}{/each}{/if}</span
   >
 {/snippet}
 {#snippet ttyTextMiddleRenderer(
   section: RenderBlock,
-  line: TTYText & { kind: "text" },
+  line: TTYText & { kind: 'text' },
 )}
   {#if section.url}
-    {#if typeof section.url === "string"}
-      {#if section.url.startsWith("newtab:")}
+    {#if typeof section.url === 'string'}
+      {#if section.url.startsWith('newtab:')}
+        {@const url = section.url.substring(7)}
         <a
-          href={section.url.substring(7)}
+          href={url.startsWith('/') ? base + url : url}
           target="_blank"
           rel="noopener noreferrer"
           class="no-underline text-inherit"
           download={section.dl}>{@render ttyTextInnerRenderer(section)}</a
         >
-      {:else if section.url.startsWith("currenttab:")}
+      {:else if section.url.startsWith('currenttab:')}
+        {@const url = section.url.substring(11)}
         <a
-          href={section.url.substring(11)}
+          href={url.startsWith('/') ? base + url : url}
           class="no-underline text-inherit"
           download={section.dl}>{@render ttyTextInnerRenderer(section)}</a
         >
@@ -121,9 +124,9 @@
     {:else}
       <span
         onclick={() =>
-          typeof section.url !== "function" ? void 0 : section.url(line)}
+          typeof section.url !== 'function' ? void 0 : section.url(line)}
         onkeypress={() =>
-          typeof section.url !== "function" ? void 0 : section.url(line)}
+          typeof section.url !== 'function' ? void 0 : section.url(line)}
         role="link"
         tabindex="0">{@render ttyTextInnerRenderer(section)}</span
       >
@@ -133,9 +136,9 @@
   {/if}
 {/snippet}
 {#snippet ttyText(line: TTYText)}
-  {#if line.kind === "text"}
-    {#if (line.renderrestriction ?? "everywhere") === "everywhere" || line.renderrestriction === "noscript" || (line.renderrestriction === "js-only" && isScripted)}
-      {#if line.renderrestriction === "noscript"}
+  {#if line.kind === 'text'}
+    {#if (line.renderrestriction ?? 'everywhere') === 'everywhere' || line.renderrestriction === 'noscript' || (line.renderrestriction === 'js-only' && isScripted)}
+      {#if line.renderrestriction === 'noscript'}
         <noscript class="inline-block max-w-[100%] {line.classes.join(' ')}"
           >{#each line.value as v}{@render ttyTextMiddleRenderer(
               v,
@@ -155,7 +158,7 @@
 {/snippet}
 
 <div class="hidden">
-  {#each ["inline-block", "block", "flex", "inline-flex", "max-w-full", "font-thin", "font-extralight", "font-light", "font-normal", "font-medium", "font-semibold", "font-bold", "font-extrabold", "font-black"] as c}
+  {#each ['inline-block', 'block', 'flex', 'inline-flex', 'max-w-full', 'font-thin', 'font-extralight', 'font-light', 'font-normal', 'font-medium', 'font-semibold', 'font-bold', 'font-extrabold', 'font-black'] as c}
     <span class={c}></span>
   {/each}
 </div>
@@ -257,51 +260,51 @@
         >
       </div>
       <div class="line">&ZeroWidthSpace;</div>
-      {@render okLine("/proc/ is already mounted")}
-      {@render okLine("Mounting /run ...")}
-      {@render okLine("/run/openrc: creating directory")}
-      {@render okLine("/run/lock: creating directory", "openrc-boot-step-1")}
-      {@render okLine("/run/lock: correcting owner", "openrc-boot-step-1")}
-      {@render okLine("Caching service dependencies ...", "openrc-boot-step-1")}
-      {@render okLine("Remounting devtmpfs on /dev ...", "openrc-boot-step-2")}
-      {@render okLine("Mounting /dev/mqueue ...", "openrc-boot-step-3")}
-      {@render okLine("Mounting security filesystem ...", "openrc-boot-step-4")}
-      {@render okLine("Mounting debug filesystem ...", "openrc-boot-step-5")}
+      {@render okLine('/proc/ is already mounted')}
+      {@render okLine('Mounting /run ...')}
+      {@render okLine('/run/openrc: creating directory')}
+      {@render okLine('/run/lock: creating directory', 'openrc-boot-step-1')}
+      {@render okLine('/run/lock: correcting owner', 'openrc-boot-step-1')}
+      {@render okLine('Caching service dependencies ...', 'openrc-boot-step-1')}
+      {@render okLine('Remounting devtmpfs on /dev ...', 'openrc-boot-step-2')}
+      {@render okLine('Mounting /dev/mqueue ...', 'openrc-boot-step-3')}
+      {@render okLine('Mounting security filesystem ...', 'openrc-boot-step-4')}
+      {@render okLine('Mounting debug filesystem ...', 'openrc-boot-step-5')}
       {@render okLine(
-        "Mounting persistent storage (pstore) filesystem ...",
-        "openrc-boot-step-5",
+        'Mounting persistent storage (pstore) filesystem ...',
+        'openrc-boot-step-5',
       )}
-      {@render okLine("Mounting efivarfs filesystem ...", "openrc-boot-step-5")}
-      {@render okLine("Starting busybox mdev ...", "openrc-boot-step-6")}
-      {@render okLine("Scanning hardware for mdev ...", "openrc-boot-step-6")}
-      {@render okLine("Loading hardware drivers ...", "openrc-boot-step-7")}
-      {@render okLine("Loading modules ...", "openrc-boot-step-8")}
+      {@render okLine('Mounting efivarfs filesystem ...', 'openrc-boot-step-5')}
+      {@render okLine('Starting busybox mdev ...', 'openrc-boot-step-6')}
+      {@render okLine('Scanning hardware for mdev ...', 'openrc-boot-step-6')}
+      {@render okLine('Loading hardware drivers ...', 'openrc-boot-step-7')}
+      {@render okLine('Loading modules ...', 'openrc-boot-step-8')}
       {@render okLine(
-        "Setting system clock using the hardware clock [UTC] ...",
-        "openrc-boot-step-9",
+        'Setting system clock using the hardware clock [UTC] ...',
+        'openrc-boot-step-9',
       )}
-      {@render okLine("Checking local filesystems ...", "openrc-boot-step-10")}
+      {@render okLine('Checking local filesystems ...', 'openrc-boot-step-10')}
       <div class="line openrc-boot-step-11">
         /dev/mapper/bepis: clean, {fsckFileCount}/{fsckTotalCount} files, {blocksCount}/{blocksTotal}
         blocks
       </div>
       {@render okLine(
-        "Remounting root filesystem read/write ...",
-        "openrc-boot-step-12",
+        'Remounting root filesystem read/write ...',
+        'openrc-boot-step-12',
       )}
-      {@render okLine("Remounting filesystems ...", "openrc-boot-step-13")}
-      {@render okLine("Activating swap devices ...", "openrc-boot-step-14")}
-      {@render okLine("Mounting local filesystems ...", "openrc-boot-step-15")}
+      {@render okLine('Remounting filesystems ...', 'openrc-boot-step-13')}
+      {@render okLine('Activating swap devices ...', 'openrc-boot-step-14')}
+      {@render okLine('Mounting local filesystems ...', 'openrc-boot-step-15')}
       {@render okLine(
-        "Configuring kernel parameters ...",
-        "openrc-boot-step-16",
+        'Configuring kernel parameters ...',
+        'openrc-boot-step-16',
       )}
-      {@render okLine("Creating user login records ...", "openrc-boot-step-17")}
-      {@render okLine("Setting hostname ...", "openrc-boot-step-18")}
-      {@render okLine("Setting keymap ...", "openrc-boot-step-19")}
-      {@render okLine("Starting networking ...", "openrc-boot-step-20")}
-      {@render okLine("\xa0\xa0lo ...", "openrc-boot-step-21")}
-      {@render okLine("\xa0\xa0eth0 ...", "openrc-boot-step-22")}
+      {@render okLine('Creating user login records ...', 'openrc-boot-step-17')}
+      {@render okLine('Setting hostname ...', 'openrc-boot-step-18')}
+      {@render okLine('Setting keymap ...', 'openrc-boot-step-19')}
+      {@render okLine('Starting networking ...', 'openrc-boot-step-20')}
+      {@render okLine('\xa0\xa0lo ...', 'openrc-boot-step-21')}
+      {@render okLine('\xa0\xa0eth0 ...', 'openrc-boot-step-22')}
       <div class="line openrc-boot-step-22">udhcpd: started</div>
       <div class="line openrc-boot-step-23">udhcpd: broadcasting discover</div>
       <!-- TODO: configurable subnet uwu -->
@@ -314,21 +317,21 @@
         lease time 3600
       </div>
       {@render okLine(
-        "Seeding random number generator ...",
-        "openrc-boot-step-26",
+        'Seeding random number generator ...',
+        'openrc-boot-step-26',
       )}
       {@render okLine(
-        "Seeding 256 bits without crediting",
-        "openrc-boot-step-26",
+        'Seeding 256 bits without crediting',
+        'openrc-boot-step-26',
       )}
       {@render okLine(
-        "Saving 256 bits of creditable seed for next boot",
-        "openrc-boot-step-26",
+        'Saving 256 bits of creditable seed for next boot',
+        'openrc-boot-step-26',
       )}
-      {@render okLine("Starting logbookd ...", "openrc-boot-step-27")}
-      {@render okLine("Starting busybox acpid ...", "openrc-boot-step-28")}
-      {@render okLine("Starting busybox crond ...", "openrc-boot-step-29")}
-      {@render okLine("Starting busybox ntpd ...", "openrc-boot-step-29")}
+      {@render okLine('Starting logbookd ...', 'openrc-boot-step-27')}
+      {@render okLine('Starting busybox acpid ...', 'openrc-boot-step-28')}
+      {@render okLine('Starting busybox crond ...', 'openrc-boot-step-29')}
+      {@render okLine('Starting busybox ntpd ...', 'openrc-boot-step-29')}
       <div class="line openrc-boot-step-30">&ZeroWidthSpace;</div>
       <div class="line openrc-boot-step-30">
         Welcome to Alpine Linux {versions.alpine
@@ -341,7 +344,7 @@
       <div class="line openrc-boot-step-30">
         {hostname} login:&nbsp;<span class="openrc-username"
           >{#each login.username
-            .split("")
+            .split('')
             .map((v, i) => [v, i] as const) as [char, idx]}<span
               class="openrc-username-char openrc-username-char-{idx} inline-block"
               >{char}</span
@@ -364,16 +367,16 @@
         </span>
       </div>
       <div class="line ttylines-openrc font-mono text-[#070505] flex flex-col">
-        {#each ttyLines.filter(((maxidx) => (_, i) => i < (maxidx === -1 ? Infinity : maxidx))(ttyLines.findIndex((v) => v.kind === "clear"))) as line}
+        {#each ttyLines.filter(((maxidx) => (_, i) => i < (maxidx === -1 ? Infinity : maxidx))(ttyLines.findIndex((v) => v.kind === 'clear'))) as line}
           {@render ttyText(line)}
         {/each}
       </div>
     </div>
   </div>
-  {#if ttyLines.find((v) => v.kind === "clear")}
+  {#if ttyLines.find((v) => v.kind === 'clear')}
     {#each ttyLines
       .map((v, i) => [v, i] as const)
-      .filter(([v]) => v.kind === "clear")
+      .filter(([v]) => v.kind === 'clear')
       .map((v, i, a) => [v[1], a[i + 1]?.[1], i]) as [idx, nextIdx, clearIdx]}
       <div
         id="tty-{clearIdx}"
-- 
cgit v1.2.3

