mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
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:
@@ -824,7 +824,7 @@ export function startWorkers(): void {
|
|||||||
});
|
});
|
||||||
|
|
||||||
worker.on("error", (err) => {
|
worker.on("error", (err) => {
|
||||||
console.error(`Worker error [${pool}]:`, err);
|
logger.error({ err, pool }, "Worker error");
|
||||||
});
|
});
|
||||||
|
|
||||||
workers.push(worker);
|
workers.push(worker);
|
||||||
|
|||||||
@@ -32,6 +32,9 @@ const EditorPage = lazy(() =>
|
|||||||
import("./pages/editor-page").then((m) => ({ default: m.EditorPage })),
|
import("./pages/editor-page").then((m) => ({ default: m.EditorPage })),
|
||||||
);
|
);
|
||||||
const ToolPage = lazy(() => import("./pages/tool-page").then((m) => ({ default: m.ToolPage })));
|
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<
|
class ErrorBoundary extends Component<
|
||||||
{ children: ReactNode },
|
{ children: ReactNode },
|
||||||
@@ -239,6 +242,7 @@ export function App() {
|
|||||||
<Route path="/editor" element={<EditorPage />} />
|
<Route path="/editor" element={<EditorPage />} />
|
||||||
<Route path="/:modality/:toolId" element={<ToolPage />} />
|
<Route path="/:modality/:toolId" element={<ToolPage />} />
|
||||||
<Route path="/" element={<HomePage />} />
|
<Route path="/" element={<HomePage />} />
|
||||||
|
<Route path="*" element={<NotFoundPage />} />
|
||||||
</Routes>
|
</Routes>
|
||||||
</Suspense>
|
</Suspense>
|
||||||
</AuthGuard>
|
</AuthGuard>
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ TOOL_BUNDLE_MAP = {
|
|||||||
"face_landmarks": "face-detection",
|
"face_landmarks": "face-detection",
|
||||||
"red_eye_removal": "face-detection",
|
"red_eye_removal": "face-detection",
|
||||||
"inpaint": "object-eraser-colorize",
|
"inpaint": "object-eraser-colorize",
|
||||||
|
"outpaint": "object-eraser-colorize",
|
||||||
"colorize": "object-eraser-colorize",
|
"colorize": "object-eraser-colorize",
|
||||||
"upscale": "upscale-enhance",
|
"upscale": "upscale-enhance",
|
||||||
"enhance_faces": "upscale-enhance",
|
"enhance_faces": "upscale-enhance",
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
import { spawn, spawnSync } from "node:child_process";
|
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;
|
let cachedAvailable: boolean | null = null;
|
||||||
|
|
||||||
/** True when a pandoc binary is on PATH (gates local tests; the image installs it). */
|
/** True when a pandoc binary is on PATH (gates local tests; the image installs it). */
|
||||||
export function pandocAvailable(): boolean {
|
export function pandocAvailable(): boolean {
|
||||||
if (cachedAvailable !== null) return cachedAvailable;
|
if (cachedAvailable !== null) return cachedAvailable;
|
||||||
const r = spawnSync("pandoc", ["--version"], { stdio: "ignore" });
|
const r = spawnSync(pandocBin(), ["--version"], { stdio: "ignore" });
|
||||||
cachedAvailable = r.status === 0;
|
cachedAvailable = r.status === 0;
|
||||||
return cachedAvailable;
|
return cachedAvailable;
|
||||||
}
|
}
|
||||||
@@ -15,7 +20,7 @@ let cachedSelfContainedArgs: string[] | null = null;
|
|||||||
|
|
||||||
function selfContainedArgs(): string[] {
|
function selfContainedArgs(): string[] {
|
||||||
if (cachedSelfContainedArgs !== null) return cachedSelfContainedArgs;
|
if (cachedSelfContainedArgs !== null) return cachedSelfContainedArgs;
|
||||||
const r = spawnSync("pandoc", ["--version"], {
|
const r = spawnSync(pandocBin(), ["--version"], {
|
||||||
encoding: "utf8",
|
encoding: "utf8",
|
||||||
stdio: ["ignore", "pipe", "ignore"],
|
stdio: ["ignore", "pipe", "ignore"],
|
||||||
});
|
});
|
||||||
@@ -55,7 +60,7 @@ export function runPandoc(
|
|||||||
args.push(...opts.extraArgs);
|
args.push(...opts.extraArgs);
|
||||||
}
|
}
|
||||||
return new Promise<void>((resolvePromise, reject) => {
|
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 err = "";
|
||||||
let settled = false;
|
let settled = false;
|
||||||
const timer = setTimeout(() => {
|
const timer = setTimeout(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user