From e78b66b752d8e36d4215eb367f77a877dcab86dd Mon Sep 17 00:00:00 2001 From: Max Richter Date: Sun, 26 Jan 2025 19:05:31 +0100 Subject: [PATCH] chore: update minio --- src/routes/api/ai/image/[name]/+server.ts | 5 +++-- src/routes/api/ai/recover/[id]/+server.ts | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/routes/api/ai/image/[name]/+server.ts b/src/routes/api/ai/image/[name]/+server.ts index 09e2fc9..045cf8b 100644 --- a/src/routes/api/ai/image/[name]/+server.ts +++ b/src/routes/api/ai/image/[name]/+server.ts @@ -3,6 +3,7 @@ import type { RequestHandler } from "./$types"; import { putObject } from "$lib/helpers/minio"; import { generateImage } from "$lib/helpers/stability"; import sharp from "sharp"; +import { S3_BUCKET_NAME, S3_ENDPOINT_URL } from "$env/static/private"; async function compressImage(imageName: string, imageBuffer: Buffer) { @@ -49,7 +50,7 @@ export const POST: RequestHandler = async ({ params, request }) => { throw new Error("Name too long"); } - const { hairType, hairColor, hairLength, skinColor, name } = await request.json(); + const { hairType, hairColor, hairLength, skinColor } = await request.json(); console.log(`[AI] Generating image for ${inputName} ${JSON.stringify({ hairType, hairColor, hairLength, skinColor, inputName })}`) if (!hairType || !hairColor || !hairLength) { @@ -82,6 +83,6 @@ export const POST: RequestHandler = async ({ params, request }) => { await compressImage(imageName, imageBuffer) return json({ - url: `https://s3-s24.max-richter.dev/silvester24/${imageName}` + url: `https://${S3_ENDPOINT_URL}/${S3_BUCKET_NAME}/${imageName}` }) } diff --git a/src/routes/api/ai/recover/[id]/+server.ts b/src/routes/api/ai/recover/[id]/+server.ts index 9cfd1cb..b79f50d 100644 --- a/src/routes/api/ai/recover/[id]/+server.ts +++ b/src/routes/api/ai/recover/[id]/+server.ts @@ -4,6 +4,7 @@ import { putObject } from "$lib/helpers/minio"; import { generateImage } from "$lib/helpers/stability"; import sharp from "sharp"; import * as pb from "$lib/helpers/pb" +import { S3_BUCKET_NAME, S3_ENDPOINT_URL } from "$env/static/private"; async function compressImage(imageName: string, imageBuffer: Buffer) { @@ -82,10 +83,10 @@ export const GET: RequestHandler = async ({ params }) => { await compressImage(imageName, imageBuffer) - await pb.setInvitePortrait(inputId, `https://s3-s24.max-richter.dev/silvester24/${imageName}`); + await pb.setInvitePortrait(inputId, `https://${S3_ENDPOINT_URL}/${S3_BUCKET_NAME}/${imageName}`); return json({ - url: `https://s3-s24.max-richter.dev/silvester24/${imageName}` + url: `https://${S3_ENDPOINT_URL}/${S3_BUCKET_NAME}/${imageName}` }) }