chore: update minio
This commit is contained in:
parent
a390e59448
commit
e78b66b752
@ -3,6 +3,7 @@ import type { RequestHandler } from "./$types";
|
|||||||
import { putObject } from "$lib/helpers/minio";
|
import { putObject } from "$lib/helpers/minio";
|
||||||
import { generateImage } from "$lib/helpers/stability";
|
import { generateImage } from "$lib/helpers/stability";
|
||||||
import sharp from "sharp";
|
import sharp from "sharp";
|
||||||
|
import { S3_BUCKET_NAME, S3_ENDPOINT_URL } from "$env/static/private";
|
||||||
|
|
||||||
|
|
||||||
async function compressImage(imageName: string, imageBuffer: Buffer) {
|
async function compressImage(imageName: string, imageBuffer: Buffer) {
|
||||||
@ -49,7 +50,7 @@ export const POST: RequestHandler = async ({ params, request }) => {
|
|||||||
throw new Error("Name too long");
|
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 })}`)
|
console.log(`[AI] Generating image for ${inputName} ${JSON.stringify({ hairType, hairColor, hairLength, skinColor, inputName })}`)
|
||||||
if (!hairType || !hairColor || !hairLength) {
|
if (!hairType || !hairColor || !hairLength) {
|
||||||
@ -82,6 +83,6 @@ export const POST: RequestHandler = async ({ params, request }) => {
|
|||||||
await compressImage(imageName, imageBuffer)
|
await compressImage(imageName, imageBuffer)
|
||||||
|
|
||||||
return json({
|
return json({
|
||||||
url: `https://s3-s24.max-richter.dev/silvester24/${imageName}`
|
url: `https://${S3_ENDPOINT_URL}/${S3_BUCKET_NAME}/${imageName}`
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import { putObject } from "$lib/helpers/minio";
|
|||||||
import { generateImage } from "$lib/helpers/stability";
|
import { generateImage } from "$lib/helpers/stability";
|
||||||
import sharp from "sharp";
|
import sharp from "sharp";
|
||||||
import * as pb from "$lib/helpers/pb"
|
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) {
|
async function compressImage(imageName: string, imageBuffer: Buffer) {
|
||||||
|
|
||||||
@ -82,10 +83,10 @@ export const GET: RequestHandler = async ({ params }) => {
|
|||||||
|
|
||||||
await compressImage(imageName, imageBuffer)
|
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({
|
return json({
|
||||||
url: `https://s3-s24.max-richter.dev/silvester24/${imageName}`
|
url: `https://${S3_ENDPOINT_URL}/${S3_BUCKET_NAME}/${imageName}`
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user