Dough Git

commit

aaaa

commit
a0489aabe716fe96c77e312f267014f16c60b60d
author
Clove Twilight <[email protected]>
date
2026-09-17 03:31

diff --git a/package.json b/package.json
index ac50180..2c83b05 100644
--- a/package.json
+++ b/package.json
@@ -21,6 +21,7 @@
   },
   "devDependencies": {
     "@cloudflare/workers-types": "^5.20260916.1",
+    "@types/react": "^19.3.0",
     "typescript": "^7.0.2",
     "wrangler": "^4.132.0"
   }
diff --git a/src/lib/guards.tsx b/src/lib/guards.tsx
index f9fef7a..cf44355 100644
--- a/src/lib/guards.tsx
+++ b/src/lib/guards.tsx
@@ -8,8 +8,8 @@ import { createMiddleware } from "hono/factory";
 import { TTL, issuerOrigin, now, type AppContext, type AppEnv } from "../env";
 import { timingSafeEqualStr } from "./crypto";
 import { form, safeReturn } from "./http";
+import { ArrowLeft } from "pixelarticons/react";
 import { render } from "../views/layout";
-import { Icon } from "../views/ui";
 
 function wantsJson(c: AppContext): boolean {
   return (c.req.header("content-type") ?? "").includes("application/json");
@@ -55,7 +55,7 @@ export const requireAdmin = createMiddleware<AppEnv>(async (c, next) => {
         <p class="muted">Your account isn't in the admin group for this server.</p>
         <p>
           <a class="btn primary" href="/account">
-            <Icon name="arrow-left" />
+            <ArrowLeft class="icon" aria-hidden="true" />
             Back to your account
           </a>
         </p>
diff --git a/src/oidc/endpoints.tsx b/src/oidc/endpoints.tsx
index aeb8135..d5a6739 100644
--- a/src/oidc/endpoints.tsx
+++ b/src/oidc/endpoints.tsx
@@ -6,6 +6,7 @@
 
 import { Hono } from "hono";
 import { cors } from "hono/cors";
+import { Logout } from "pixelarticons/react";
 import { TTL, issuer, now, type AppContext, type AppEnv } from "../env";
 import { audit } from "../lib/audit";
 import { b64url, randomToken, sha256, sha256Hex, timingSafeEqualStr } from "../lib/crypto";
@@ -15,7 +16,7 @@ import { publicJwks } from "../data/keys";
 import { endSession } from "../data/sessions";
 import { getUser, groupsFor } from "../data/users";
 import { render } from "../views/layout";
-import { Csrf, Icon } from "../views/ui";
+import { Csrf } from "../views/ui";
 import {
   SUPPORTED_CLAIMS,
   SUPPORTED_SCOPES,
@@ -507,7 +508,7 @@ async function endSessionRequest(c: AppContext) {
           <input type="hidden" name="post_logout_redirect_uri" value={params.post_logout_redirect_uri ?? ""} />
           <input type="hidden" name="state" value={params.state ?? ""} />
           <button type="submit" class="primary wide">
-            <Icon name="logout" />
+            <Logout class="icon" aria-hidden="true" />
             Sign out
           </button>
         </form>
diff --git a/src/routes/account.tsx b/src/routes/account.tsx
index 7eb67bc..9416b8c 100644
--- a/src/routes/account.tsx
+++ b/src/routes/account.tsx
@@ -5,6 +5,7 @@
  */
 
 import { Hono } from "hono";
+import { Key, Save, Shield } from "pixelarticons/react";
 import { renderSVG } from "uqr";
 import type { RegistrationResponseJSON } from "@simplewebauthn/server";
 import { TTL, now, siteName, type AppContext, type AppEnv } from "../env";
@@ -35,7 +36,7 @@ import {
   type UserRow,
 } from "../data/users";
 import { render } from "../views/layout";
-import { Csrf, ErrorNote, Field, Flash, Icon, Section, date, describeAgent, relative } from "../views/ui";
+import { Csrf, ErrorNote, Field, Flash, Section, date, describeAgent, relative } from "../views/ui";
 
 export const account = new Hono<AppEnv>();
 
@@ -99,7 +100,10 @@ async function accountPage(c: AppContext, opts: { error?: string; status?: 400 }
           />
           <Field label="Picture URL" name="picture" type="url" value={user.picture} maxlength={2048} placeholder="https://…" />
           <div>
-            <button type="submit">Save profile</button>
+            <button type="submit">
+              <Save class="icon" aria-hidden="true" />
+              Save profile
+            </button>
           </div>
         </form>
       </Section>
@@ -137,7 +141,7 @@ async function accountPage(c: AppContext, opts: { error?: string; status?: 400 }
         <form id="passkey-add" class="inline-edit">
           <input type="text" name="name" placeholder="Name, e.g. Phone" maxlength={60} aria-label="New passkey name" />
           <button type="submit" class="primary">
-            <Icon name="key" />
+            <Key class="icon" aria-hidden="true" />
             Add a passkey
           </button>
         </form>
@@ -372,7 +376,7 @@ async function totpSetupPage(c: AppContext, error?: string) {
         <Csrf token={c.get("session")!.csrf} />
         <Field label="Code" name="code" required inputmode="numeric" autocomplete="one-time-code" maxlength={7} autofocus />
         <button type="submit" class="primary wide">
-          <Icon name="shield" />
+          <Shield class="icon" aria-hidden="true" />
           Turn on
         </button>
       </form>
diff --git a/src/routes/admin.tsx b/src/routes/admin.tsx
index fd73a16..8b763cd 100644
--- a/src/routes/admin.tsx
+++ b/src/routes/admin.tsx
@@ -6,6 +6,7 @@
 
 import { Hono } from "hono";
 import type { Child } from "hono/jsx";
+import { AppWindows, Link, Save, UserPlus, Users } from "pixelarticons/react";
 import { ADMIN_GROUP, issuer, type AppContext, type AppEnv } from "../env";
 import { audit, recentAudit } from "../lib/audit";
 import { form, formAll, lines } from "../lib/http";
@@ -51,7 +52,7 @@ import {
   setUserGroups,
 } from "../data/users";
 import { render } from "../views/layout";
-import { Csrf, ErrorNote, Field, Flash, Icon, Section, date, relative } from "../views/ui";
+import { Csrf, ErrorNote, Field, Flash, Section, date, relative } from "../views/ui";
 
 export const admin = new Hono<AppEnv>();
 
@@ -195,7 +196,7 @@ async function usersPage(c: AppContext, error?: string, values: Record<string, s
           </details>
           <div>
             <button type="submit" class="primary">
-              <Icon name="user-plus" />
+              <UserPlus class="icon" aria-hidden="true" />
               Create user
             </button>
           </div>
@@ -292,7 +293,10 @@ async function userPage(
             </label>
           </div>
           <div>
-            <button type="submit">Save profile</button>
+            <button type="submit">
+              <Save class="icon" aria-hidden="true" />
+              Save profile
+            </button>
           </div>
         </form>
       </Section>
@@ -302,7 +306,10 @@ async function userPage(
           <Csrf token={token} />
           <GroupChecks groups={allGroups} selected={groups} />
           <div>
-            <button type="submit">Save groups</button>
+            <button type="submit">
+              <Save class="icon" aria-hidden="true" />
+              Save groups
+            </button>
           </div>
         </form>
       </Section>
@@ -327,7 +334,7 @@ async function userPage(
             </select>
           </label>
           <button type="submit" class="primary">
-            <Icon name="link" />
+            <Link class="icon" aria-hidden="true" />
             {openLink ? "Replace link" : "Create link"}
           </button>
         </form>
@@ -540,7 +547,10 @@ async function groupsPage(c: AppContext, error?: string) {
                 <form method="post" action={`/admin/groups/${encodeURIComponent(g.name)}`} class="inline-edit">
                   <Csrf token={token} />
                   <input type="text" name="description" value={g.description} maxlength={200} placeholder="Description" aria-label={`Description of ${g.name}`} />
-                  <button type="submit" class="small">Save</button>
+                  <button type="submit" class="small">
+                    <Save class="icon" aria-hidden="true" />
+                    Save
+                  </button>
                 </form>
               </div>
               {g.name !== ADMIN_GROUP && (
@@ -562,7 +572,7 @@ async function groupsPage(c: AppContext, error?: string) {
           </div>
           <div>
             <button type="submit" class="primary">
-              <Icon name="users" />
+              <Users class="icon" aria-hidden="true" />
               Create group
             </button>
           </div>
@@ -734,7 +744,7 @@ async function clientsPage(c: AppContext, error?: string, raw: Record<string, st
           </details>
           <div>
             <button type="submit" class="primary">
-              <Icon name="app-windows" />
+              <AppWindows class="icon" aria-hidden="true" />
               Create application
             </button>
           </div>
@@ -827,7 +837,10 @@ async function clientPage(c: AppContext, id: string, opts: { error?: string; sec
             allowed={client.allowedGroups}
           />
           <div>
-            <button type="submit">Save</button>
+            <button type="submit">
+              <Save class="icon" aria-hidden="true" />
+              Save
+            </button>
           </div>
         </form>
       </Section>
diff --git a/src/routes/login.tsx b/src/routes/login.tsx
index 6ceb441..4b4b4ec 100644
--- a/src/routes/login.tsx
+++ b/src/routes/login.tsx
@@ -5,6 +5,7 @@
  */
 
 import { Hono } from "hono";
+import { Key, Login } from "pixelarticons/react";
 import type { AuthenticationResponseJSON } from "@simplewebauthn/server";
 import type { AppContext, AppEnv } from "../env";
 import { audit } from "../lib/audit";
@@ -26,7 +27,7 @@ import {
 } from "../data/sessions";
 import { claimTotpStep, countUsers, getUser, getUserByUsername, setPasswordHash } from "../data/users";
 import { render } from "../views/layout";
-import { ErrorNote, Field, Flash, Icon } from "../views/ui";
+import { ErrorNote, Field, Flash } from "../views/ui";
 
 const WINDOW = 15 * 60;
 const USER_LIMIT = 10;
@@ -61,7 +62,7 @@ function loginPage(c: AppContext, opts: LoginPageOptions) {
       <p class="notice error hidden" id="passkey-error" role="alert"></p>
 
       <button type="button" class="primary wide" id="passkey-signin">
-        <Icon name="key" />
+        <Key class="icon" aria-hidden="true" />
         Sign in with a passkey
       </button>
 
@@ -173,7 +174,7 @@ function totpPage(c: AppContext, error?: string) {
           autofocus
         />
         <button type="submit" class="primary wide">
-          <Icon name="login" />
+          <Login class="icon" aria-hidden="true" />
           Continue
         </button>
       </form>
@@ -271,7 +272,7 @@ login.get("/login/link/:token", async (c) => {
       )}
       <form method="post" action={`/login/link/${c.req.param("token")}`}>
         <button type="submit" class="primary wide">
-          <Icon name="login" />
+          <Login class="icon" aria-hidden="true" />
           Continue
         </button>
       </form>
diff --git a/src/routes/setup.tsx b/src/routes/setup.tsx
index f415fbf..a378cf0 100644
--- a/src/routes/setup.tsx
+++ b/src/routes/setup.tsx
@@ -5,6 +5,7 @@
  */
 
 import { Hono } from "hono";
+import { Login, UserPlus } from "pixelarticons/react";
 import type { AppContext, AppEnv } from "../env";
 import { audit } from "../lib/audit";
 import { timingSafeEqualStr } from "../lib/crypto";
@@ -14,7 +15,7 @@ import { cleanText, emailProblem, normaliseUsername, usernameProblem } from "../
 import { startSession } from "../data/sessions";
 import { countUsers, createFirstAdmin } from "../data/users";
 import { render } from "../views/layout";
-import { ErrorNote, Field, Icon } from "../views/ui";
+import { ErrorNote, Field } from "../views/ui";
 
 export const setup = new Hono<AppEnv>();
 
@@ -27,7 +28,7 @@ function closed(c: AppContext) {
       <p class="muted">This server already has accounts.</p>
       <p>
         <a class="btn primary" href="/login">
-          <Icon name="login" />
+          <Login class="icon" aria-hidden="true" />
           Sign in
         </a>
       </p>
@@ -64,7 +65,7 @@ function setupPage(c: AppContext, values: Record<string, string> = {}, error?: s
         <Field label="Display name" name="name" value={values.name} autocomplete="name" maxlength={100} />
         <Field label="Email" name="email" type="email" value={values.email} autocomplete="email" maxlength={254} />
         <button type="submit" class="primary wide">
-          <Icon name="user-plus" />
+          <UserPlus class="icon" aria-hidden="true" />
           Create admin account
         </button>
       </form>
diff --git a/src/types/pixelarticons-react.ts b/src/types/pixelarticons-react.ts
new file mode 100644
index 0000000..7d7ed13
--- /dev/null
+++ b/src/types/pixelarticons-react.ts
@@ -0,0 +1,25 @@
+/* src/types/pixelarticons-react.ts
+ * Copyright (c) 2026 Clove Nytrix Doughmination Twilight
+ * Licensed under the DASL-1.2 Licence.
+ * See LICENCE.md in the project root for full licence information.
+ *
+ * Type-checking stand-in for `pixelarticons/react`. Its real .d.ts types each
+ * icon as a React component; tsconfig.json points the "pixelarticons/react"
+ * specifier here instead so tsc checks against what these actually are at
+ * runtime under the `react` -> `hono/jsx` alias in wrangler.jsonc. Add a line
+ * here whenever a new icon from the package is imported.
+ */
+
+type Icon = (props: Record<string, unknown>) => any;
+
+export declare const AppWindows: Icon;
+export declare const ArrowLeft: Icon;
+export declare const Key: Icon;
+export declare const Link: Icon;
+export declare const Login: Icon;
+export declare const Logout: Icon;
+export declare const Save: Icon;
+export declare const Shield: Icon;
+export declare const User: Icon;
+export declare const UserPlus: Icon;
+export declare const Users: Icon;
diff --git a/src/views/icons.ts b/src/views/icons.ts
deleted file mode 100644
index 5bfe792..0000000
--- a/src/views/icons.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-/* src/views/icons.ts
- * Copyright (c) 2026 Clove Nytrix Doughmination Twilight
- * Licensed under the DASL-1.2 Licence.
- * See LICENCE.md in the project root for full licence information.
- *
- * Path data lifted from the `pixelarticons` package (MIT), trimmed to the
- * handful this app actually uses so it can ship as plain JSX with no runtime
- * dependency on the package or a font file.
- */
-
-export const ICONS = {
-  user: ["M9 2h6v2H9zm0 8h6v2H9zm6-6h2v6h-2zM7 4h2v6H7zM4 18h2v4H4zm14 0h2v4h-2zM8 14h8v2H8zm-2 2h2v2H6zm10 0h2v2h-2z"],
-  "user-plus": [
-    "M9 2h6v2H9zm0 8h6v2H9zm6-6h2v6h-2zM7 4h2v6H7zM4 18h2v4H4zm14 0h2v4h-2zM8 14h8v2H8zm-2 2h2v2H6z",
-    "M18 16h2v6h-2z",
-    "M16 18h6v2h-6z",
-  ],
-  users: [
-    "M5 2h6v2H5zm10 0h4v2h-4zM5 10h6v2H5zm10 0h4v2h-4zm4-6h2v6h-2zm-8 0h2v6h-2zM3 4h2v6H3zM0 18h2v4H0zm14 0h2v4h-2zm8 0h2v4h-2zM4 14h8v2H4zm12 0h4v2h-4zM2 16h2v2H2zm10 0h2v2h-2zm8 0h2v2h-2z",
-  ],
-  shield: ["M4 2h16v2H4zM2 4h2v10H2zm18 0h2v10h-2zM4 14h2v2H4zm2 2h2v2H6zm4 4h4v2h-4zm10-6h-2v2h2zm-2 2h-2v2h2zm-2 2h-2v2h2zm-6 0H8v2h2z"],
-  key: ["M11 18H3V16H11V18ZM23 15H21V18H17V16H19V13H21V11H11V8H13V9H23V15ZM3 16H1V8H3V16ZM17 16H15V15H13V16H11V13H17V16ZM9 14H5V10H9V14ZM11 8H3V6H11V8Z"],
-  link: ["M4 6h7v2H4zm0 10h7v2H4zM2 8h2v8H2zm18-2h-7v2h7zm0 10h-7v2h7zm2-8h-2v8h2zM7 11h10v2H7z"],
-  login: ["M2 11h14v2H2zm10-2h2v2h-2z", "M10 7h2v10h-2zm2 6h2v2h-2zM6 2h12v2H6zm0 18h12v2H6zM4 4h2v5H4zm0 11h2v5H4zM18 4h2v16h-2z"],
-  logout: ["M8 11h12v2H8zm8-2h2v2h-2z", "M14 7h2v10h-2zm2 6h2v2h-2zM6 2h12v2H6zm0 18h12v2H6zM4 4h2v16H4zm14 0h2v3h-2zm0 13h2v3h-2z"],
-  "arrow-left": ["M20 11v2H4v-2zM8 13v2H6v-2zm2 2v2H8v-2zm2 2v2h-2v-2zm-4-6V9H6v2z", "M10 15V7H8v8zm2 2V5h-2v12z"],
-  "app-windows": ["M4 3h16v2H4zm0 16h16v2H4zM2 5h2v14H2zm18 0h2v14h-2zM4 7h16v2H4zm8-2h2v2h-2zm4 0h2v2h-2z"],
-} as const;
-
-export type IconName = keyof typeof ICONS;
diff --git a/src/views/layout.tsx b/src/views/layout.tsx
index 342e34f..40f50f6 100644
--- a/src/views/layout.tsx
+++ b/src/views/layout.tsx
@@ -6,8 +6,8 @@
 
 import type { Child } from "hono/jsx";
 import type { ContentfulStatusCode } from "hono/utils/http-status";
+import { Logout, Shield, User } from "pixelarticons/react";
 import { siteName, type AppContext } from "../env";
-import { Icon } from "./ui";
 
 interface PageOptions {
   title: string;
@@ -43,19 +43,19 @@ export async function render(c: AppContext, opts: PageOptions, body: Child): Pro
           {user && (
             <nav>
               <a class="btn small" href="/account">
-                <Icon name="user" />
+                <User class="icon" aria-hidden="true" />
                 Account
               </a>
               {user.isAdmin && (
                 <a class="btn small" href="/admin">
-                  <Icon name="shield" />
+                  <Shield class="icon" aria-hidden="true" />
                   Admin
                 </a>
               )}
               <form method="post" action="/logout" class="inline">
                 <input type="hidden" name="_csrf" value={session?.csrf ?? ""} />
                 <button type="submit" class="small">
-                  <Icon name="logout" />
+                  <Logout class="icon" aria-hidden="true" />
                   Sign out
                 </button>
               </form>
diff --git a/src/views/ui.tsx b/src/views/ui.tsx
index 52de417..e4a8a9f 100644
--- a/src/views/ui.tsx
+++ b/src/views/ui.tsx
@@ -5,7 +5,6 @@
  */
 
 import type { Child } from "hono/jsx";
-import { ICONS, type IconName } from "./icons";
 
 // Flash messages travel as a fixed code in `?m=`, never as free text, so a
 // crafted link can't put words in this site's mouth.
@@ -54,24 +53,6 @@ export function ErrorNote(props: { error?: string | null | undefined }) {
   ) : null;
 }
 
-/** A pixelarticons glyph. Sizes with the surrounding font (see `.icon` in style.css). */
-export function Icon(props: { name: IconName; class?: string }) {
-  return (
-    <svg
-      xmlns="http://www.w3.org/2000/svg"
-      viewBox="0 0 24 24"
-      fill="currentColor"
-      class={props.class ? `icon ${props.class}` : "icon"}
-      aria-hidden="true"
-      focusable="false"
-    >
-      {ICONS[props.name].map((d) => (
-        <path d={d} />
-      ))}
-    </svg>
-  );
-}
-
 export function Csrf(props: { token: string }) {
   return <input type="hidden" name="_csrf" value={props.token} />;
 }
diff --git a/tsconfig.build.json b/tsconfig.build.json
new file mode 100644
index 0000000..66a3485
--- /dev/null
+++ b/tsconfig.build.json
@@ -0,0 +1,12 @@
+{
+  // Used by wrangler (see the top-level "tsconfig" field in wrangler.jsonc)
+  // to bundle the actual Worker. It must NOT carry the "paths" override from
+  // tsconfig.json: that's a type-checking-only stand-in for
+  // "pixelarticons/react", and esbuild (wrangler's bundler) honours tsconfig
+  // "paths" for real module resolution too, so leaving it in here would
+  // literally replace the icon package with the type stub at runtime.
+  "extends": "./tsconfig.json",
+  "compilerOptions": {
+    "paths": {}
+  }
+}
diff --git a/tsconfig.json b/tsconfig.json
index 194fdfe..0a768c1 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -10,6 +10,14 @@
     "jsx": "react-jsx",
     "jsxImportSource": "hono/jsx",
 
+    // pixelarticons/react's own .d.ts types its components against real React
+    // (SVGProps, React.JSX.Element). wrangler.jsonc aliases that package's
+    // `react` import to `hono/jsx` at runtime, so this repo actually gets
+    // hono/jsx elements back; this stub tells tsc that instead.
+    "paths": {
+      "pixelarticons/react": ["./src/types/pixelarticons-react.ts"]
+    },
+
     "allowImportingTsExtensions": true,
     "verbatimModuleSyntax": true,
     "resolveJsonModule": true,
diff --git a/wrangler.jsonc b/wrangler.jsonc
index b1448ae..cca2a3f 100644
--- a/wrangler.jsonc
+++ b/wrangler.jsonc
@@ -2,6 +2,7 @@
 	"$schema": "node_modules/wrangler/config-schema.json",
 	"name": "auth-server",
 	"main": "src/main.ts",
+	"tsconfig": "tsconfig.build.json",
 	"compatibility_date": "2026-09-01",
 	"compatibility_flags": [
 		"nodejs_compat"
@@ -17,6 +18,12 @@
 	"assets": {
 		"directory": "./public"
 	},
+	// pixelarticons/react components call React's createElement; this repo
+	// renders with hono/jsx instead, which ships a React-API-compatible
+	// createElement, so the icons work without pulling in real React.
+	"alias": {
+		"react": "hono/jsx"
+	},
 	"d1_databases": [
 		{
 			"binding": "DB",