fix(proxy): wire games root into asset routes
This commit is contained in:
@@ -5,7 +5,7 @@ import { createRequire } from 'module';
|
||||
import { traceRequestSchema, type TraceResult } from '@tts/shared';
|
||||
import { offsetShape, parseSvgShape } from './svgShape.js';
|
||||
import { resolveAsset } from './resolveAsset.js';
|
||||
import type { Bindings } from '../env.js';
|
||||
import { GAMES_ROOT } from '../config.js';
|
||||
|
||||
// vtracer is a CommonJS package; load it via require so the wasm initializes
|
||||
// with the correct `__dirname`.
|
||||
@@ -19,7 +19,7 @@ const vtracer = require('@visioncortex/vtracer') as {
|
||||
): string;
|
||||
};
|
||||
|
||||
const app = new Hono<{ Bindings: Bindings }>();
|
||||
const app = new Hono();
|
||||
|
||||
/**
|
||||
* Trace an image into a vector shape and return it BSON-encoded.
|
||||
@@ -43,7 +43,7 @@ app.get('/', async (c) => {
|
||||
|
||||
// Resolve the image: a relative path is a local game asset under GAMES_ROOT;
|
||||
// otherwise it must be an http(s) URL.
|
||||
const resolved = await resolveAsset(url, c.env?.GAMES_ROOT);
|
||||
const resolved = await resolveAsset(url, GAMES_ROOT);
|
||||
if (!resolved.ok) {
|
||||
return c.json({ error: 'Invalid or missing image url' }, 400);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user