19 lines
693 B
TypeScript
19 lines
693 B
TypeScript
import { error } from '@sveltejs/kit';
|
|
import type { RequestHandler } from './$types';
|
|
import { getPresentationPreviewImage } from '#lib/server/live.js';
|
|
|
|
export const GET: RequestHandler = async ({ params }) => {
|
|
const image = await getPresentationPreviewImage(params.token);
|
|
if (!image) error(404, 'Vorschaubild nicht verfügbar');
|
|
return new Response(new Uint8Array(image.data), {
|
|
headers: {
|
|
'Content-Type': image.mimeType,
|
|
'Content-Length': String(image.data.byteLength),
|
|
'Cache-Control': 'private, max-age=300',
|
|
'X-Content-Type-Options': 'nosniff',
|
|
'Cross-Origin-Resource-Policy': 'same-origin',
|
|
'Content-Security-Policy': "default-src 'none'; sandbox"
|
|
}
|
|
});
|
|
};
|