fix: post-2.0 audit bug fixes (404 route, worker logging, outpaint gate, pandoc path)

Surgical post-2.0 fixes: SPA 404 route, worker logging, outpaint gate, pandoc path resolution.
This commit is contained in:
SnapOtter
2026-06-19 18:46:52 +08:00
committed by GitHub
parent 9b64a96bcd
commit 2bd3e2302a
4 changed files with 14 additions and 4 deletions
+1 -1
View File
@@ -824,7 +824,7 @@ export function startWorkers(): void {
});
worker.on("error", (err) => {
console.error(`Worker error [${pool}]:`, err);
logger.error({ err, pool }, "Worker error");
});
workers.push(worker);
+4
View File
@@ -32,6 +32,9 @@ const EditorPage = lazy(() =>
import("./pages/editor-page").then((m) => ({ default: m.EditorPage })),
);
const ToolPage = lazy(() => import("./pages/tool-page").then((m) => ({ default: m.ToolPage })));
const NotFoundPage = lazy(() =>
import("./pages/not-found-page").then((m) => ({ default: m.NotFoundPage })),
);
class ErrorBoundary extends Component<
{ children: ReactNode },
@@ -239,6 +242,7 @@ export function App() {
<Route path="/editor" element={<EditorPage />} />
<Route path="/:modality/:toolId" element={<ToolPage />} />
<Route path="/" element={<HomePage />} />
<Route path="*" element={<NotFoundPage />} />
</Routes>
</Suspense>
</AuthGuard>
+1
View File
@@ -112,6 +112,7 @@ TOOL_BUNDLE_MAP = {
"face_landmarks": "face-detection",
"red_eye_removal": "face-detection",
"inpaint": "object-eraser-colorize",
"outpaint": "object-eraser-colorize",
"colorize": "object-eraser-colorize",
"upscale": "upscale-enhance",
"enhance_faces": "upscale-enhance",
+8 -3
View File
@@ -1,11 +1,16 @@
import { spawn, spawnSync } from "node:child_process";
/** Resolve the pandoc binary, honoring PANDOC_PATH for parity with the other doc-engine wrappers. */
function pandocBin(): string {
return process.env.PANDOC_PATH || "pandoc";
}
let cachedAvailable: boolean | null = null;
/** True when a pandoc binary is on PATH (gates local tests; the image installs it). */
export function pandocAvailable(): boolean {
if (cachedAvailable !== null) return cachedAvailable;
const r = spawnSync("pandoc", ["--version"], { stdio: "ignore" });
const r = spawnSync(pandocBin(), ["--version"], { stdio: "ignore" });
cachedAvailable = r.status === 0;
return cachedAvailable;
}
@@ -15,7 +20,7 @@ let cachedSelfContainedArgs: string[] | null = null;
function selfContainedArgs(): string[] {
if (cachedSelfContainedArgs !== null) return cachedSelfContainedArgs;
const r = spawnSync("pandoc", ["--version"], {
const r = spawnSync(pandocBin(), ["--version"], {
encoding: "utf8",
stdio: ["ignore", "pipe", "ignore"],
});
@@ -55,7 +60,7 @@ export function runPandoc(
args.push(...opts.extraArgs);
}
return new Promise<void>((resolvePromise, reject) => {
const child = spawn("pandoc", args, { stdio: ["ignore", "pipe", "pipe"] });
const child = spawn(pandocBin(), args, { stdio: ["ignore", "pipe", "pipe"] });
let err = "";
let settled = false;
const timer = setTimeout(() => {