authoravatarclover caruso<git@paperclover.net>2026-10-19 02:12:08-07:00
committeravatarclover caruso<git@paperclover.net>2026-10-29 20:51:40-07:00
log9ba8d6f075418544599b1d633061024bc343088a
treec24d9ad86c1628ab749344d5ed2b5a4434d9e825
parent57b1c450e19e70424b38b959cccd575e625b5bfe
signature Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU

chore: i forgot


23 files changed, 151 insertions(+), 108 deletions(-)

framework/font.ts+2-1
...@@ -4,8 +4,9 @@...@@ -4,8 +4,9 @@
4 * none of them. the build keeps what was found, so nothing is fetched twice.4 * none of them. the build keeps what was found, so nothing is fetched twice.
5 */5 */
6export async function fetchFont(b: incremental.Build, name: string, sources: readonly string[]) {6export async function fetchFont(b: incremental.Build, name: string, sources: readonly string[]) {
7 using _ = b.start(`fetch ${name}`);7 using node = b.start(`fetch ${name}`);
8 for (const source of sources) {8 for (const source of sources) {
9 using _ = node.start(`try ${source}`);
9 if (source.startsWith("https://")) {10 if (source.startsWith("https://")) {
10 const response = await fetch(source).catch(() => null);11 const response = await fetch(source).catch(() => null);
11 if (response?.ok) return new Uint8Array(await response.arrayBuffer());12 if (response?.ok) return new Uint8Array(await response.arrayBuffer());
framework/lib/sitegen.ts+1-4
...@@ -45,14 +45,11 @@ export type FontVars = Record<string, FontVariableAxis>;...@@ -45,14 +45,11 @@ export type FontVars = Record<string, FontVariableAxis>;
45export type FontVariableAxis = number | [min: number, max: number];45export type FontVariableAxis = number | [min: number, max: number];
46export type FontRange = string | number | { start: number; end: number };46export type FontRange = string | number | { start: number; end: number };
4747
48// TODO: self-host plausible for extra privacy. i am in a rush as i write this
49// TODO: properly locate this constant in `site.ts`
50//
51// I have this so I can see if the blog is actually seen by people. And for48// I have this so I can see if the blog is actually seen by people. And for
52// understanding where paperclover.net gets its load for. When I need to scale49// understanding where paperclover.net gets its load for. When I need to scale
53// large enough, analytics will determine the location of the second web50// large enough, analytics will determine the location of the second web
54// hosting node.51// hosting node.
55export const analytics = `<script async src="https://plausible.io/js/pa-Ajv81BZMkpbEE4QFznyoS.js"></script>52export const analytics = `<script async src="https://plausible.paperclover.net/js/pa-GuSR8GegXbBWz72PEzlTR.js"></script>
56<script>window.plausible=window.plausible||function(){(plausible.q=plausible.q||[]).push(arguments)},plausible.init=plausible.init||function(i){plausible.o=i||{}};plausible.init()</script> `;53<script>window.plausible=window.plausible||function(){(plausible.q=plausible.q||[]).push(arguments)},plausible.init=plausible.init||function(i){plausible.o=i||{}};plausible.init()</script> `;
5754
58export function wrapDocument({55export function wrapDocument({
lib/subprocess.ts+16-11
...@@ -248,17 +248,7 @@ interface ProcessLookup {...@@ -248,17 +248,7 @@ interface ProcessLookup {
248 command: string;248 command: string;
249}249}
250250
251/**251/** opens a file in the logically configured text/code editor */
252 * open a file in the text editor that is already in front of the user, at a
253 * line and column, a port of vite's `launch-editor`.
254 *
255 * `file` is a path, a path with `:line:column` appended, or a `file://` url.
256 * resolves once the editor process exits, which is immediate for the editors
257 * that hand the file to a window already open.
258 *
259 * what happens to a path that does not exist is up to the editor; most open an
260 * empty buffer for it.
261 */
262export async function launchEditor(file: string, options: EditorOptions = {}): Promise<void> {252export async function launchEditor(file: string, options: EditorOptions = {}): Promise<void> {
263 const { fileName, line: fileLine, column: fileColumn } = parsePosition(file);253 const { fileName, line: fileLine, column: fileColumn } = parsePosition(file);
264 const line = options.line ?? fileLine;254 const line = options.line ?? fileLine;
...@@ -304,6 +294,21 @@ export async function launchEditor(file: string, options: EditorOptions = {}): P...@@ -304,6 +294,21 @@ export async function launchEditor(file: string, options: EditorOptions = {}): P
304 }294 }
305}295}
306296
297/** opens a url in the default browser */
298export async function launchBrowser(url: string) {
299 switch (process.platform) {
300 case "darwin":
301 await execute(["open", url]);
302 break;
303 case "win32":
304 await execute(["cmd.exe", "/c", "start", "\"\"", url]);
305 break;
306 default:
307 await execute(["xdg-open", url]);
308 break;
309 }
310}
311
307export interface EditorOptions {312export interface EditorOptions {
308 /**313 /**
309 * the editor to run, as a shell command so that arguments may be included.314 * the editor to run, as a shell command so that arguments may be included.
src/bin/deploy.ts+4-21
...@@ -20,9 +20,7 @@ export async function main(graph: incremental.Graph) {...@@ -20,9 +20,7 @@ export async function main(graph: incremental.Graph) {
20 await downloadDb.main().catch((error) => console.warn("building with the local databases:", error));20 await downloadDb.main().catch((error) => console.warn("building with the local databases:", error));
2121
22 // any error stops the deploy, including the ones a build can still be served with22 // any error stops the deploy, including the ones a build can still be served with
23 await graph.incrementalBuild({ progress, buildAndWriteOutput });23 await graph.incrementalBuild({ progress, buildAndWriteOutput: (b) => buildAndWriteOutput(b, "local build") });
24 // the cache is copied as one file
25 graph.db.sql.exec("pragma wal_checkpoint(truncate);");
2624
27 await rsync.spawn({25 await rsync.spawn({
28 cwd,26 cwd,
...@@ -31,6 +29,7 @@ export async function main(graph: incremental.Graph) {...@@ -31,6 +29,7 @@ export async function main(graph: incremental.Graph) {
31 "-r",29 "-r",
32 "--delete",30 "--delete",
33 "--exclude=node_modules",31 "--exclude=node_modules",
32 "cspell.json",
34 "run.js",33 "run.js",
35 "package.json",34 "package.json",
36 "package-lock.json",35 "package-lock.json",
...@@ -41,29 +40,13 @@ export async function main(graph: incremental.Graph) {...@@ -41,29 +40,13 @@ export async function main(graph: incremental.Graph) {
41 ],40 ],
42 progress: progress.start("copy site files"),41 progress: progress.start("copy site files"),
43 });42 });
44 await rsync.spawn({
45 cwd,
46 args: [
47 "-a",
48 ".clover/incremental.db",
49 `${remote}:~/paperclover.net/.clover/incremental.db.next`,
50 ],
51 progress: progress.start("copy build cache"),
52 });
53 await subprocess.spawn([43 await subprocess.spawn([
54 "ssh",44 "ssh",
45 "-t",
55 remote,46 remote,
56 "cd paperclover.net && "47 "cd paperclover.net && "
57 + `PATH=${node}:$PATH npm i && `48 + `PATH=${node}:$PATH npm i && `
58 + "pm2 stop site && "49 + node + "/node run trigger-live-rebuild http://localhost:10000"
59 // the server leaves a write-ahead log beside the cache it had open, which is not this cache's
60 + "rm -f .clover/incremental.db-wal .clover/incremental.db-shm && "
61 + "mv .clover/incremental.db.next .clover/incremental.db && "
62 // started again with this checkout's command. secrets are in the server's `.env`
63 + "pm2 delete site && "
64 + `pm2 start run.js --name site --interpreter ${node}/node --kill-timeout 5000 `
65 + `--node-args="--env-file=.env --experimental-vm-modules --no-warnings" -- --prod && `
66 + "pm2 save",
67 ], { stdin: "inherit" }).wait();50 ], { stdin: "inherit" }).wait();
68}51}
6952
src/bin/download-db.ts+16-16
...@@ -5,22 +5,22 @@ const site = "https://paperclover.net";...@@ -5,22 +5,22 @@ const site = "https://paperclover.net";
5const token = process.env.CLOVER_SOT_KEY ?? null;5const token = process.env.CLOVER_SOT_KEY ?? null;
66
7export async function main() {7export async function main() {
8 for (const name of ["cache.sqlite", "questions.sqlite"]) {8 // for (const name of ["cache.sqlite", "questions.sqlite"]) {
9 using node = progress.start(`download ${name}`, { units: "bytes" });9 // using node = progress.start(`download ${name}`, { units: "bytes" });
10 const response = await fetch(`${site}/db/${name}`, { headers: token ? { Authorization: token } : {} });10 // const response = await fetch(`${site}/db/${name}`, { headers: token ? { Authorization: token } : {} });
11 if (!response.ok || !response.body) {11 // if (!response.ok || !response.body) {
12 throw new Error(`${site}/db/${name} responded ${response.status} ${response.statusText}`);12 // throw new Error(`${site}/db/${name} responded ${response.status} ${response.statusText}`);
13 }13 // }
14 node.total = Number(response.headers.get("Content-Length"));14 // node.total = Number(response.headers.get("Content-Length"));
15 await getDatabase(name).restore(response.body.pipeThrough(15 // await getDatabase(name).restore(response.body.pipeThrough(
16 new TransformStream({16 // new TransformStream({
17 transform(chunk, controller) {17 // transform(chunk, controller) {
18 node.value += chunk.byteLength;18 // node.value += chunk.byteLength;
19 controller.enqueue(chunk);19 // controller.enqueue(chunk);
20 },20 // },
21 }),21 // }),
22 ));22 // ));
23 }23 // }
24}24}
2525
26import { getDatabase } from "#sitegen/drizzle";26import { getDatabase } from "#sitegen/drizzle";
src/bin/trigger-live-rebuild.ts created+10
...@@ -0,0 +1,10 @@
1export async function main() {
2 const response = await fetch("http://localhost:10000/.sitegen/rebuild");
3 if (!response.ok) throw new Error(response.statusText);
4 using node = progress.start("remote build");
5 using remoteNode = progress.decodeByteStream(UNWRAP(response.body), node);
6 await remoteNode.once("end");
7}
8
9import { UNWRAP } from "@clo/lib/assert";
10import * as progress from "@clo/lib/progress";
src/blog/tags/blog-layout.marko+1-1
...@@ -52,7 +52,7 @@ export interface Context {...@@ -52,7 +52,7 @@ export interface Context {
5252
53<main>53<main>
54 <header>54 <header>
55 <a href="/">${t.return}</a>55 <a href="/">[${t.return}]</a>
56 <h1 style={ "max-width": "30ch" }>${title}</h1>56 <h1 style={ "max-width": "30ch" }>${title}</h1>
57 <p class="description"><em>${description}</em></p>57 <p class="description"><em>${description}</em></p>
5858
src/cspell.ts+1
...@@ -18,6 +18,7 @@ export async function spellCheck(uri: string, text: string, settings: ts.DeepRea...@@ -18,6 +18,7 @@ export async function spellCheck(uri: string, text: string, settings: ts.DeepRea
18 for (const errors of result.dictionaryErrors?.values() ?? []) {18 for (const errors of result.dictionaryErrors?.values() ?? []) {
19 for (const error of errors) throw error;19 for (const error of errors) throw error;
20 }20 }
21 // meowd
21 if (!result.checked) throw new Error(`CSpell did not check ${uri}.`);22 if (!result.checked) throw new Error(`CSpell did not check ${uri}.`);
22 const { settingsUsed } = result;23 const { settingsUsed } = result;
23 const issues = result.issues.filter((issue) => {24 const issues = result.issues.filter((issue) => {
src/databases.test.ts+1-1
...@@ -10,7 +10,7 @@ const dir = vi.hoisted(() => {...@@ -10,7 +10,7 @@ const dir = vi.hoisted(() => {
10 return dir;10 return dir;
11});11});
12afterAll(() => fs.rmSync(dir, { recursive: true, force: true }));12afterAll(() => fs.rmSync(dir, { recursive: true, force: true }));
1313//
14for (const path of ["/2025/song.mp3", "/2025/.date", "/_unlisted/font.ttf", "/friends/2025/photo.jpg"]) {14for (const path of ["/2025/song.mp3", "/2025/.date", "/_unlisted/font.ttf", "/friends/2025/photo.jpg"]) {
15 const file = mediaFiles.createFile({15 const file = mediaFiles.createFile({
16 path,16 path,
src/file-viewer/tags/media-panel.marko+3-1
...@@ -128,7 +128,9 @@ static const cotyledonEndingFile = "/2024/for everyone";...@@ -128,7 +128,9 @@ static const cotyledonEndingFile = "/2024/for everyone";
128 <ContainerDiv kind="text">128 <ContainerDiv kind="text">
129 <view-text129 <view-text
130 ...{ file }130 ...{ file }
131 siblings=mediaFiles.getPublicChildren(UNWRAP(mediaFiles.getParent(file)))131 siblings=mediaFiles.getPublicChildren(
132 UNWRAP(mediaFiles.getParent(file)),
133 )
132 />134 />
133 </ContainerDiv>135 </ContainerDiv>
134 </else>136 </else>
src/global.css+6-4
...@@ -128,15 +128,17 @@ a:where([href]:not(.custom)) {...@@ -128,15 +128,17 @@ a:where([href]:not(.custom)) {
128 margin: -0.2em -0.3em;128 margin: -0.2em -0.3em;
129 padding: 0.2em 0.3em;129 padding: 0.2em 0.3em;
130 border-radius: 4px;130 border-radius: 4px;
131 text-decoration: underline;
132 text-decoration-color: var(--primary);
133 text-decoration-color: rgb(from var(--primary) r g b / 0.45);
134 text-decoration-thickness: 1.5px;
135 text-underline-offset: 1.5px;
131 &:hover {136 &:hover {
132 text-decoration: underline;
133 /* font-weight: 600; */
134 color: var(--primary);137 color: var(--primary);
135 color: lch(from var(--primary) calc(l) calc(c + 30) h);138 color: lch(from var(--primary) calc(l) calc(c + 30) h);
139 text-decoration-color: lch(from var(--primary) calc(l) calc(c + 30) h);
136 }140 }
137 &:active {141 &:active {
138 text-decoration: underline;
139 /* font-weight: 600; */
140 text-decoration: none;142 text-decoration: none;
141 color: black;143 color: black;
142 background-color: var(--primary);144 background-color: var(--primary);
src/pages/dream.mdo+10-8
...@@ -10,14 +10,16 @@ meta:...@@ -10,14 +10,16 @@ meta:
10# my life's dream10# my life's dream
1111
12if i could make art (music and videos) full time, forever, i would take that12if i could make art (music and videos) full time, forever, i would take that
13life in a heartbeat, never looking back. this has happened once in may 2025 for13life in a heartbeat, never looking back. with a world confused on the meaning, i
14a month (an interlude between jobs). i called this **ART MONTH**, and it was the14decided that *this*, dedicating to the arts, would be *the* meaning of my life.
15best month of my life. i want to do it again, for longer: **ART DECADE**. or if it was possible, **ART15this choice was set at around age 15. so far, i've had one time where i could,
16FOREVER**. the desire has been in me since age 16 or so. i don't want to work in16without worry, execute on this dream full time, in may 2025 for a month. i
17the music industry, and i don't want to be contingent on my music being17called this **ART MONTH**, and it was the best month of my life. i want to do it
18profitable. i want to make my art, the way i envision it.18again, for longer: **ART DECADE**. or if it was possible, **ART FOREVER**. i
1919don't want to work in the music industry, and i don't want to be contingent on
20currently, i have a stupid tech job, which i am exceptionally good at. too good20my music being profitable. i want to make my art, the way i envision it, alone.
21
22currently, my time is taken by a tech job, which i am exceptionally good at. too good
21at it maybe. my knowledge and experience was built from doing crazy things in23at it maybe. my knowledge and experience was built from doing crazy things in
22school and is the reason my colleagues rely on me for accurate technical advice.24school and is the reason my colleagues rely on me for accurate technical advice.
23i'm the one to attempt and succeed with large, technically intricate projects.25i'm the one to attempt and succeed with large, technically intricate projects.
src/pages/in-the-summer.marko+1-1
...@@ -8,7 +8,7 @@ export const theme = {...@@ -8,7 +8,7 @@ export const theme = {
8import "./in-the-summer.css";8import "./in-the-summer.css";
99
10<main style={ "max-width": "110ch" }>10<main style={ "max-width": "110ch" }>
11 <nav><a href="/">back to home</a></nav>11 <nav><a href="/">[back to the home page]</a></nav>
12 <div.contain>12 <div.contain>
13 <header>13 <header>
14 <h1>in the summer</h1>14 <h1>in the summer</h1>
src/pages/index.css+17-10
...@@ -5,22 +5,33 @@ main {...@@ -5,22 +5,33 @@ main {
5 justify-content: center;5 justify-content: center;
6 align-items: center;6 align-items: center;
7 min-height: 100vh;7 min-height: 100vh;
8
8 & > div {9 & > div {
9 width: 450px;10 width: 450px;
10 margin: auto;11 margin: auto;
11 }12 }
12}13}
13h1 {14h1 {
14 margin: -0.5rem 0 3rem 0;15 margin: 0;
15 font-size: 5rem;16 font-size: 4rem;
16 font-weight: 400;17 font-weight: 100;
18 color: #430e8a;
19 text-decoration: underline;
20 text-decoration-color: #430e8a44;
21 text-decoration-style: wavy;
22 text-underline-offset: 8px;
17}23}
18h2 {24h2 {
19 font-size: 1.15rem;25 font-size: 1.15rem;
20 text-decoration: underline;26 background-color: #003a;
21 color: #000e;27 outline: 4px solid #003c;
28 padding: 2px 4px;
29 width: max-content;
30 color: #fff;
31 margin-top: 32px;
32 margin-bottom: 8px;
22}33}
23p, h2 {34p {
24 margin: 0.75rem 0rem;35 margin: 0.75rem 0rem;
25}36}
26.section-list {37.section-list {
...@@ -44,10 +55,6 @@ p, h2 {...@@ -44,10 +55,6 @@ p, h2 {
44.link-list a {55.link-list a {
45 white-space: nowrap;56 white-space: nowrap;
46}57}
47hr {
48 width: 100%;
49 border: 1px solid #000b;
50}
51.cite {58.cite {
52 color: inherit;59 color: inherit;
53 text-decoration-line: underline;60 text-decoration-line: underline;
src/pages/index.marko+8-6
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1import type { Meta } from "#meta";1import type { Meta } from "#meta";
2import "./index.css";2import "./index.css";
33
4export const theme = { bg: "#fff", fg: "#666" };4export const theme = { bg: "#fff0fb", fg: "#558", primary: "#7947c9" };
5export const meta = {5export const meta = {
6 title: "paper clover",6 title: "paper clover",
7 description:7 description:
...@@ -15,10 +15,11 @@ export const meta = {...@@ -15,10 +15,11 @@ export const meta = {
15};15};
16<main>16<main>
17 <div>17 <div>
18 <h2>about</h2>18 <h1>paper clover</h1>
19 <p>19 <p>
20 i am a girl that is adorable and20 i am a girl that is adorable and
21 <a class="custom cite" href="https://en.wikipedia.org/wiki/Life">alive</a>.21 <a class="custom cite" href="https://en.wikipedia.org/wiki/Life">alive</a>.
22 this is my art museum. there will be new art "soon"...
22 </p>23 </p>
23 <h2>art</h2>24 <h2>art</h2>
24 <ul class="section-list">25 <ul class="section-list">
...@@ -44,20 +45,21 @@ export const meta = {...@@ -44,20 +45,21 @@ export const meta = {
44 <h2>things</h2>45 <h2>things</h2>
45 <ul class="section-list">46 <ul class="section-list">
46 <li><a href="/q+a">questions and answers</a></li>47 <li><a href="/q+a">questions and answers</a></li>
47 // <li><a href="/log">recent activity</a></li>
48 <li><a href="/file">file browser</a></li>48 <li><a href="/file">file browser</a></li>
49 <li><a href="https://shale.paperclover.net/clo">my software</a></li>
50 <li><a href="/dream">my life's dream</a></li>49 <li><a href="/dream">my life's dream</a></li>
51 <li><a href="/subscribe">mailing list</a></li>50 <li><a href="/subscribe">mailing list</a></li>
52 </ul>51 </ul>
53 <h2>links</h2>52 <h2>links</h2>
54 <nav>53 <nav>
55 <ul class="link-list">54 <ul class="link-list">
56 <li><a href="mailto:hello@paperclover.net">email me</a></li>55 <li><a href="mailto:hello@paperclover.net">email</a></li>
57 <li><a href="/rss.xml">rss</a></li>56 <li><a href="/rss.xml">rss</a></li>
57 <li><a href="https://shale.paperclover.net">git</a></li>
58 <li><a href="https://ko-fi.com/paper_clover">donate</a></li>58 <li><a href="https://ko-fi.com/paper_clover">donate</a></li>
59 </ul>59 </ul>
60 </nav>60 </nav>
61 <h1>paper clover</h1>61
62 <p>website run by clover caruso. alive since '04.</p>
63 // <p>was run by clover caruso. alive from '04 to '??.</p>
62 </div>64 </div>
63</main>65</main>
src/paperclover.net.ts+39-6
...@@ -8,7 +8,7 @@ const globalCss = "src/global.css";...@@ -8,7 +8,7 @@ const globalCss = "src/global.css";
8const toRel = (str: string) => path.relative(root, str).replaceAll("\\", "/");8const toRel = (str: string) => path.relative(root, str).replaceAll("\\", "/");
99
10export async function main(graph: incremental.Graph) {10export async function main(graph: incremental.Graph) {
11 if (process.argv.includes("--once")) {11 if (process.argv.includes("--build")) {
12 await graph.incrementalBuild({ buildAndWriteOutput });12 await graph.incrementalBuild({ buildAndWriteOutput });
13 return;13 return;
14 }14 }
...@@ -19,6 +19,11 @@ export async function main(graph: incremental.Graph) {...@@ -19,6 +19,11 @@ export async function main(graph: incremental.Graph) {
19 buildAndWriteOutput,19 buildAndWriteOutput,
20 watchFilesystem: !process.argv.includes("--prod"),20 watchFilesystem: !process.argv.includes("--prod"),
21 });21 });
22
23 if (!process.argv.includes("--no-open") && !process.argv.includes("--prod")) {
24 // subprocess.launchBrowser(server.url);
25 }
26
22 // requests in flight finish before the process leaves27 // requests in flight finish before the process leaves
23 const stop = () => void server.close().then(() => process.exit(0));28 const stop = () => void server.close().then(() => process.exit(0));
24 process.on("SIGINT", stop);29 process.on("SIGINT", stop);
...@@ -31,8 +36,14 @@ export async function main(graph: incremental.Graph) {...@@ -31,8 +36,14 @@ export async function main(graph: incremental.Graph) {
31type Respond = (request: Request) => Response | Promise<Response>;36type Respond = (request: Request) => Response | Promise<Response>;
3237
33/** hand a build to the code that serves it, loaded by the graph so that it reloads with its code */38/** hand a build to the code that serves it, loaded by the graph so that it reloads with its code */
34async function loadBackend({ graph, progress }: incremental.Server<Output>, output: Output): Promise<Respond> {39async function loadBackend(
35 using _ = progress.start("load backend");40 server: incremental.Server<Output>,
41 output: Output,
42 progressOverride?: progress.Ref,
43): Promise<Respond> {
44 const { graph } = server;
45 const graphNode = progressOverride ?? server.progress;
46 using _ = graphNode.start("load backend");
36 const sitegen = await graph.import<typeof import("../framework/lib/sitegen.ts")>("framework/lib/sitegen.ts");47 const sitegen = await graph.import<typeof import("../framework/lib/sitegen.ts")>("framework/lib/sitegen.ts");
37 sitegen.setGraph(graph);48 sitegen.setGraph(graph);
38 const assets = await graph.import<typeof import("../framework/lib/assets.ts")>("framework/lib/assets.ts");49 const assets = await graph.import<typeof import("../framework/lib/assets.ts")>("framework/lib/assets.ts");
...@@ -45,7 +56,27 @@ async function loadBackend({ graph, progress }: incremental.Server<Output>, outp...@@ -45,7 +56,27 @@ async function loadBackend({ graph, progress }: incremental.Server<Output>, outp
45 view.load(output, modules);56 view.load(output, modules);
4657
47 const backend = await graph.import<{ default: { fetch: Respond } }>("src/backend.ts");58 const backend = await graph.import<{ default: { fetch: Respond } }>("src/backend.ts");
48 return backend.default.fetch;59 return (req) => {
60 // deployments
61 if (
62 new URL(req.url).pathname === "/.sitegen/rebuild"
63 && !req.headers.has("x-forwarded-for")
64 ) {
65 const root = new progress.Root();
66 graph.incrementalBuild({ buildAndWriteOutput, progress: root })
67 .then((output) => loadBackend(server, output, root))
68 .then((backend) => {
69 server.setHandler(backend);
70 root.end();
71 })
72 .catch((e) => root.error(e));
73 return new Response(progress.encodeByteStream(root), {
74 headers: { "Content-Type": progress.contentType },
75 });
76 }
77
78 return backend.default.fetch(req);
79 };
49}80}
5081
51export interface Output {82export interface Output {
...@@ -66,8 +97,8 @@ export interface Asset {...@@ -66,8 +97,8 @@ export interface Asset {
66 headers: Record<string, string>;97 headers: Record<string, string>;
67}98}
6899
69export async function buildAndWriteOutput(ref: incremental.Ref): Promise<Output> {100export async function buildAndWriteOutput(ref: incremental.Ref, title = "sitegen!"): Promise<Output> {
70 using incr = ref.start("sitegen!");101 using incr = ref.start(title);
71 await checkSpelling(incr);102 await checkSpelling(incr);
72103
73 const site = await incr.step(async (b) => {104 const site = await incr.step(async (b) => {
...@@ -416,6 +447,8 @@ import * as exception from "@clo/lib/exception";...@@ -416,6 +447,8 @@ import * as exception from "@clo/lib/exception";
416import * as incremental from "@clo/lib/incremental";447import * as incremental from "@clo/lib/incremental";
417import * as meta from "@clo/lib/meta";448import * as meta from "@clo/lib/meta";
418import * as mime from "@clo/lib/mime";449import * as mime from "@clo/lib/mime";
450import * as progress from "@clo/lib/progress";
451import * as subprocess from "@clo/lib/subprocess";
419import type * as ts from "@clo/lib/ts";452import type * as ts from "@clo/lib/ts";
420import * as crypto from "node:crypto";453import * as crypto from "node:crypto";
421import path from "node:path";454import path from "node:path";
src/q+a/backend.ts+1-3
...@@ -5,9 +5,7 @@ export const app = new Hono();...@@ -5,9 +5,7 @@ export const app = new Hono();
55
6// Main page6// Main page
7app.get("/q+a", async (c) => {7app.get("/q+a", async (c) => {
8 if (hasAdminToken(c)) {8 if (hasAdminToken(c)) return serveAsset(c, "/admin/q+a", 200);
9 return serveAsset(c, "/admin/q+a", 200);
10 }
11 return serveAsset(c, "/q+a", 200);9 return serveAsset(c, "/q+a", 200);
12});10});
1311
src/q+a/pages/q+a.marko+1-1
...@@ -11,7 +11,7 @@ export const meta: Metadata = {...@@ -11,7 +11,7 @@ export const meta: Metadata = {
11<const/{ admin = false }=input>11<const/{ admin = false }=input>
12<const/answered=questions.getAll()>12<const/answered=questions.getAll()>
1313
14<question-layout>14<question-layout back={ href: "/", title: "the home page" }>
15 <if=!admin>15 <if=!admin>
16 <question-form/>16 <question-form/>
17 </if>17 </if>
src/q+a/questions.css+1-7
...@@ -181,11 +181,6 @@...@@ -181,11 +181,6 @@
181 form .email {181 form .email {
182 display: none;182 display: none;
183 }183 }
184 form .robot {
185 margin-top: 0.5rem;
186 align-self: flex-start;
187 cursor: pointer;
188 }
189 textarea {184 textarea {
190 width: 100%;185 width: 100%;
191 max-width: calc(60ch);186 max-width: calc(60ch);
...@@ -203,8 +198,7 @@...@@ -203,8 +198,7 @@
203 }198 }
204 }199 }
205 &:not(:placeholder-shown) ~ .disabled-button,200 &:not(:placeholder-shown) ~ .disabled-button,
206 &:placeholder-shown ~ button,201 &:placeholder-shown ~ button {
207 &:placeholder-shown ~ .robot {
208 display: none;202 display: none;
209 }203 }
210 }204 }
src/q+a/tags/question-form.marko-4
...@@ -7,10 +7,6 @@...@@ -7,10 +7,6 @@
7 maxlength="10000"7 maxlength="10000"
8 />8 />
9 <div aria-hidden class="title">ask a question</div>9 <div aria-hidden class="title">ask a question</div>
10 <label class="robot">
11 <input type="checkbox" name="robot" />
12 i am a robot
13 </label>
14 <input10 <input
15 class="email"11 class="email"
16 type="text"12 type="text"
src/q+a/tags/question-layout.marko+7-1
...@@ -1,7 +1,14 @@...@@ -1,7 +1,14 @@
1import "../questions.css";1import "../questions.css";
2client import "./header.client.ts";2client import "./header.client.ts";
33
4export interface Input {
5 back?: { href: string; title: string };
6}
7
4<main class="qa">8<main class="qa">
9 <if=input.back>
10 <p><a href=input.back.href>[back to ${input.back.title}]</a></p>
11 </if>
5 <if=!input.minimal>12 <if=!input.minimal>
6 <h1>13 <h1>
7 <span class="a" style="color:var(--a);--s:#19607d">answers</span>14 <span class="a" style="color:var(--a);--s:#19607d">answers</span>
...@@ -17,4 +24,3 @@ export const theme = {...@@ -17,4 +24,3 @@ export const theme = {
17 bg: "#1a1b1c",24 bg: "#1a1b1c",
18 primary: "#f5a9b8",25 primary: "#f5a9b8",
19};26};
20
src/site.ts+1-1
...@@ -20,7 +20,7 @@ export const meta = {...@@ -20,7 +20,7 @@ export const meta = {
20};20};
2121
22// Font subsets reduce bandwidth and protect against proprietary font theft.22// Font subsets reduce bandwidth and protect against proprietary font theft.
23const fontRoot = path.join(nasRoot, "Documents/Font");23const fontRoot = path.join(nasRoot, "Asset/Font");
24const ascii = { start: 0x20, end: 0x7E };24const ascii = { start: 0x20, end: 0x7E };
25const nonAscii: sg.FontRange[] = [25const nonAscii: sg.FontRange[] = [
26 { start: 0xC0, end: 0xFF },26 { start: 0xC0, end: 0xFF },
src/tags/photo-grid.css+4
...@@ -27,4 +27,8 @@ photo-grid + blockquote {...@@ -27,4 +27,8 @@ photo-grid + blockquote {
27 border: none;27 border: none;
28 background-color: var(--primary);28 background-color: var(--primary);
29 color: black;29 color: black;
30
31 a:not(.custom) {
32 --primary: var(--fg);
33 }
30}34}