authorgravatar for git@paperclover.netclover caruso <git@paperclover.net> 2025-10-06 21:45:15-07:00
committergravatar for git@paperclover.netclover caruso <git@paperclover.net> 2025-10-14 02:40:48-07:00
log10eaddedc5136acd4d7f8ac8276c4c8e90905703
tree84f8d1ea7f67c1546469363d02936d6336c22a43
parentf813b9c7cef18191915ed92fb4564d8faeda0175
signature Commit is signed but in an unrecognized format.

fix(site): revive scan3 after breaking it in the lib patches


5 files changed, 20 insertions(+), 15 deletions(-)

framework/font.ts+6-2
......@@ -19,7 +19,10 @@ export async function buildFonts(p: progress.Ref, fonts: sg.Font[]) {
1919 ]);
2020 }
2121
22 const instances = new async.OnceMap<void>();
22 const instances = new async.OnceMap(
23 (_: string, x: () => Promise<void>) => x(),
24 (x) => x[0],
25 );
2326 function getArgs(vars: sg.FontVars) {
2427 return Object.entries(vars).map((x) => {
2528 const lower = x[0].toLowerCase();
......@@ -42,7 +45,7 @@ export async function buildFonts(p: progress.Ref, fonts: sg.Font[]) {
4245 const args = getArgs(vars);
4346 const hash = getHash(input, args);
4447 const outfile = path.join(temp, `${hash}${path.extname(input)}`);
45 await instances.get(outfile, async () => {
48 await instances.getOrRun(outfile, async () => {
4649 await fs.rm(outfile, { force: true });
4750 await subprocess.exec(path.join(bin, "fonttools"), [
4851 "varLib.instancer",
......@@ -212,3 +215,4 @@ import * as crypto from "node:crypto";
212215import * as async from "lib/async.ts";
213216import * as error from "lib/error.ts";
214217import * as progress from "../lib/log/progress.ts";
218import { ASSERT } from "lib/assert.ts";
lib/log/stack.ts+9-4
......@@ -88,11 +88,11 @@ export function capture(trimStart = 2): Frame[] {
8888export function format(error: Error, colors = false): string {
8989 const { name, message, stack: _, ...payload } = error;
9090
91 const headingLine = (colors ? ansi.fgRed : "") +
91 let out = (colors ? ansi.fgRed : "") +
9292 (name && name !== "Error" ? `[${name}] ` : "") +
9393 message + (colors ? ansi.fgReset : "") + "\n";
9494
95 const payloadLines = Object.entries(payload)
95 out += Object.entries(payload)
9696 .map(([k, v]) =>
9797 " " + k +
9898 (colors ? ansi.style(ansi.dim, ":") : ":") +
......@@ -111,11 +111,16 @@ export function format(error: Error, colors = false): string {
111111 ].includes(frame.fn ?? "")
112112 );
113113 }
114 if (error instanceof AggregateError) {
115 for (const err of error.errors) {
116 out += format(err, true);
117 }
118 }
114119 if (frames.length) {
115 frameLines = frames.map((frame) => formatFrame(frame, colors)).join("\n");
120 out += frames.map((frame) => formatFrame(frame, colors)).join("\n");
116121 }
117122
118 return headingLine + payloadLines + frameLines + "\n";
123 return out + "\n";
119124}
120125
121126/** format a single stack trace frame. see `format` for more details. */
src/file-viewer/bin/scan3.ts+3-7
......@@ -376,12 +376,9 @@ export async function main() {
376376 cwd: process.cwd(),
377377 });
378378 await rsync.spawn({
379 cwd: Path.resolve(import.meta.dirname).parent!.toString(),
380379 args: [
381 "-a",
382 "--progress",
383 "clo@paperclover.net:~/paperclover.net/.clover/questions.sqlite",
384 ".clover/",
380 MediaFile.db.file,
381 "clo@paperclover.net:paperclover.net/.clover/cache.sqlite",
385382 ],
386383 progress: progress.start("Uploading database (web node)"),
387384 });
......@@ -398,7 +395,6 @@ export async function main() {
398395 );
399396 }
400397 } else console.warn("Missing SOT token");
401 // TODO: signal to web node(s)
402398
403399 console.info(
404400 "Updated file viewer index in \x1b[1m" +
......@@ -601,7 +597,7 @@ const procImageSubsets: Process = {
601597 },
602598};
603599
604const videoArgsCache = new async.OnceMap2(transcodeRules.getVideoInputArgs);
600const videoArgsCache = new async.OnceMap(transcodeRules.getVideoInputArgs);
605601
606602const qualityMap: Record<string, string> = {
607603 u: "ultra-high",
src/file-viewer/models/derived.ts+1-1
......@@ -201,4 +201,4 @@ import * as fs from "node:fs";
201201import * as crypto from "node:crypto";
202202import * as queue from "lib/queue.ts";
203203import * as progress from "lib/log/progress.ts";
204import { derivedFileRoot } from "../paths.ts";
204import { ASSERT } from "lib/assert.ts";
src/file-viewer/rsync.ts+1-1
......@@ -75,7 +75,7 @@ export async function spawn(options: SpawnOptions) {
7575 ? `${currentFile.slice(0, 3)}..${currentFile.slice(-15)}`
7676 : currentFile;
7777 node.text = `${title} - ${fileName}${
78 extras.length > 0 ? `( ${extras})` : ""
78 extras.length > 0 ? ` (${extras})` : ""
7979 }`;
8080 } else result satisfies never;
8181 };