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[]) {...@@ -19,7 +19,10 @@ export async function buildFonts(p: progress.Ref, fonts: sg.Font[]) {
19 ]);19 ]);
20 }20 }
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 );
23 function getArgs(vars: sg.FontVars) {26 function getArgs(vars: sg.FontVars) {
24 return Object.entries(vars).map((x) => {27 return Object.entries(vars).map((x) => {
25 const lower = x[0].toLowerCase();28 const lower = x[0].toLowerCase();
...@@ -42,7 +45,7 @@ export async function buildFonts(p: progress.Ref, fonts: sg.Font[]) {...@@ -42,7 +45,7 @@ export async function buildFonts(p: progress.Ref, fonts: sg.Font[]) {
42 const args = getArgs(vars);45 const args = getArgs(vars);
43 const hash = getHash(input, args);46 const hash = getHash(input, args);
44 const outfile = path.join(temp, `${hash}${path.extname(input)}`);47 const outfile = path.join(temp, `${hash}${path.extname(input)}`);
45 await instances.get(outfile, async () => {48 await instances.getOrRun(outfile, async () => {
46 await fs.rm(outfile, { force: true });49 await fs.rm(outfile, { force: true });
47 await subprocess.exec(path.join(bin, "fonttools"), [50 await subprocess.exec(path.join(bin, "fonttools"), [
48 "varLib.instancer",51 "varLib.instancer",
...@@ -212,3 +215,4 @@ import * as crypto from "node:crypto";...@@ -212,3 +215,4 @@ import * as crypto from "node:crypto";
212import * as async from "lib/async.ts";215import * as async from "lib/async.ts";
213import * as error from "lib/error.ts";216import * as error from "lib/error.ts";
214import * as progress from "../lib/log/progress.ts";217import * 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[] {...@@ -88,11 +88,11 @@ export function capture(trimStart = 2): Frame[] {
88export function format(error: Error, colors = false): string {88export function format(error: Error, colors = false): string {
89 const { name, message, stack: _, ...payload } = error;89 const { name, message, stack: _, ...payload } = error;
9090
91 const headingLine = (colors ? ansi.fgRed : "") +91 let out = (colors ? ansi.fgRed : "") +
92 (name && name !== "Error" ? `[${name}] ` : "") +92 (name && name !== "Error" ? `[${name}] ` : "") +
93 message + (colors ? ansi.fgReset : "") + "\n";93 message + (colors ? ansi.fgReset : "") + "\n";
9494
95 const payloadLines = Object.entries(payload)95 out += Object.entries(payload)
96 .map(([k, v]) =>96 .map(([k, v]) =>
97 " " + k +97 " " + k +
98 (colors ? ansi.style(ansi.dim, ":") : ":") +98 (colors ? ansi.style(ansi.dim, ":") : ":") +
...@@ -111,11 +111,16 @@ export function format(error: Error, colors = false): string {...@@ -111,11 +111,16 @@ export function format(error: Error, colors = false): string {
111 ].includes(frame.fn ?? "")111 ].includes(frame.fn ?? "")
112 );112 );
113 }113 }
114 if (error instanceof AggregateError) {
115 for (const err of error.errors) {
116 out += format(err, true);
117 }
118 }
114 if (frames.length) {119 if (frames.length) {
115 frameLines = frames.map((frame) => formatFrame(frame, colors)).join("\n");120 out += frames.map((frame) => formatFrame(frame, colors)).join("\n");
116 }121 }
117122
118 return headingLine + payloadLines + frameLines + "\n";123 return out + "\n";
119}124}
120125
121/** format a single stack trace frame. see `format` for more details. */126/** 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() {...@@ -376,12 +376,9 @@ export async function main() {
376 cwd: process.cwd(),376 cwd: process.cwd(),
377 });377 });
378 await rsync.spawn({378 await rsync.spawn({
379 cwd: Path.resolve(import.meta.dirname).parent!.toString(),
380 args: [379 args: [
381 "-a",380 MediaFile.db.file,
382 "--progress",381 "clo@paperclover.net:paperclover.net/.clover/cache.sqlite",
383 "clo@paperclover.net:~/paperclover.net/.clover/questions.sqlite",
384 ".clover/",
385 ],382 ],
386 progress: progress.start("Uploading database (web node)"),383 progress: progress.start("Uploading database (web node)"),
387 });384 });
...@@ -398,7 +395,6 @@ export async function main() {...@@ -398,7 +395,6 @@ export async function main() {
398 );395 );
399 }396 }
400 } else console.warn("Missing SOT token");397 } else console.warn("Missing SOT token");
401 // TODO: signal to web node(s)
402398
403 console.info(399 console.info(
404 "Updated file viewer index in \x1b[1m" +400 "Updated file viewer index in \x1b[1m" +
...@@ -601,7 +597,7 @@ const procImageSubsets: Process = {...@@ -601,7 +597,7 @@ const procImageSubsets: Process = {
601 },597 },
602};598};
603599
604const videoArgsCache = new async.OnceMap2(transcodeRules.getVideoInputArgs);600const videoArgsCache = new async.OnceMap(transcodeRules.getVideoInputArgs);
605601
606const qualityMap: Record<string, string> = {602const qualityMap: Record<string, string> = {
607 u: "ultra-high",603 u: "ultra-high",
src/file-viewer/models/derived.ts+1-1
...@@ -201,4 +201,4 @@ import * as fs from "node:fs";...@@ -201,4 +201,4 @@ import * as fs from "node:fs";
201import * as crypto from "node:crypto";201import * as crypto from "node:crypto";
202import * as queue from "lib/queue.ts";202import * as queue from "lib/queue.ts";
203import * as progress from "lib/log/progress.ts";203import * 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) {...@@ -75,7 +75,7 @@ export async function spawn(options: SpawnOptions) {
75 ? `${currentFile.slice(0, 3)}..${currentFile.slice(-15)}`75 ? `${currentFile.slice(0, 3)}..${currentFile.slice(-15)}`
76 : currentFile;76 : currentFile;
77 node.text = `${title} - ${fileName}${77 node.text = `${title} - ${fileName}${
78 extras.length > 0 ? `( ${extras})` : ""78 extras.length > 0 ? ` (${extras})` : ""
79 }`;79 }`;
80 } else result satisfies never;80 } else result satisfies never;
81 };81 };