- Add /tools/video-mainpage page (main + brewing-page advertisement videos, date-gated, per-country, push to machine over ADB) + api/video-mainpage create/list/update proxies; sidebar entry "Main & Brewing Video" - Add catalog API proxies (catalog-create, catalog-list, catalog-banner, catalog-banner-image) - Sheet: overview/edit/add/priceslot/price updates, stores & services - Misc: adb, websocket/message handlers, crypto, recipe & brew tweaks Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
24 lines
811 B
TypeScript
24 lines
811 B
TypeScript
import { error } from '@sveltejs/kit';
|
|
import type { RequestHandler } from './$types';
|
|
import { env } from '$env/dynamic/public';
|
|
|
|
const GET_IMAGE = env.PUBLIC_GET_IMAGE;
|
|
|
|
// Server-side fetch of a banner image so the browser can read its bytes
|
|
// (to push to the machine via ADB) without hitting CORS on the image server.
|
|
export const GET: RequestHandler = async ({ url }) => {
|
|
const path = url.searchParams.get('path');
|
|
if (!path) throw error(400, 'Missing path');
|
|
|
|
const target = `${GET_IMAGE}/${path}`;
|
|
const res = await fetch(target);
|
|
if (!res.ok) throw error(res.status, 'Banner fetch failed');
|
|
|
|
const buf = await res.arrayBuffer();
|
|
return new Response(buf, {
|
|
headers: {
|
|
'content-type': res.headers.get('content-type') || 'application/octet-stream',
|
|
'cache-control': 'no-store'
|
|
}
|
|
});
|
|
};
|