fix(backend): use public MinIO origin for browser uploads

This commit is contained in:
2026-04-17 10:45:00 +01:00
parent 14509aa7e4
commit e97a54ac8d
7 changed files with 127 additions and 41 deletions

View File

@@ -9,7 +9,9 @@ import {
ensureMinioBucket,
minioBucket,
minioClient,
minioPresignClient,
minioPresignedExpirySeconds,
minioPublicOrigin,
} from '../utils/minio';
const router = Router();
@@ -83,7 +85,7 @@ router.post('/upload-url', async (req, res) => {
}
const objectKey = buildObjectKey(authSession.user.id, parsed.data.fileName, parsed.data.prefix);
const uploadUrl = await minioClient.presignedPutObject(minioBucket, objectKey, minioPresignedExpirySeconds);
const uploadUrl = await minioPresignClient.presignedPutObject(minioBucket, objectKey, minioPresignedExpirySeconds);
const now = new Date();
const expiresAt = new Date(now.getTime() + minioPresignedExpirySeconds * 1000);
@@ -98,6 +100,7 @@ router.post('/upload-url', async (req, res) => {
minioEndpoint: process.env.MINIO_ENDPOINT ?? 'localhost',
minioPort: Number(process.env.MINIO_PORT ?? 9000),
minioUseSSL: (process.env.MINIO_USE_SSL ?? 'false').toLowerCase() === 'true',
minioPublicOrigin,
});
let persistedRecording;
@@ -183,7 +186,7 @@ router.get('/download-url', async (req, res) => {
await ensureMinioBucket();
const downloadUrl = await minioClient.presignedGetObject(
const downloadUrl = await minioPresignClient.presignedGetObject(
minioBucket,
parsed.data.objectKey,
minioPresignedExpirySeconds,