add code generation on frontend

This commit is contained in:
2025-05-30 08:19:32 +02:00
parent 7413733eb0
commit 4b8099481c
2 changed files with 80 additions and 7 deletions

View File

@@ -0,0 +1,28 @@
import { json } from '@sveltejs/kit';
import { client } from '$lib/minio';
import { Readable } from 'stream';
import { Buffer } from 'buffer';
/** @type {import('./$types').RequestHandler} */
export async function GET({ params }) {
const prefix = params.vorgang ? `${params.vorgang}` : '';
const code_name = '__perm__';
const obj_path = `${prefix}/${code_name}`;
let result = null;
try {
result = await client.getObject('tatort', obj_path);
} catch (error) {
if (error.name == 'S3Error') {
result = null;
}
}
if (result != null) {
return new Response(result, { status: 200 });
} else {
return new Response(null, { status: 404 });
}
}