This commit is contained in:
alma 2025-05-04 13:51:14 +02:00
parent 148b3e2395
commit e5a2e63994
2 changed files with 13 additions and 3 deletions

6
.env
View File

@ -12,6 +12,12 @@ KEYCLOAK_ADMIN_PASSWORD=PW5jfqX00m
DOLIBARR_API_URL=https://mediations.slm-lab.net/api/index.php/
DOLIBARR_API_KEY=2znq976PzZz1q2JSe9DG2A3hmbNMGIh8
# MinIO S3 configuration
MINIO_S3_UPLOAD_BUCKET_URL="https://dome-api.slm-lab.net/"
MINIO_AWS_REGION="eu-east-1"
MINIO_AWS_S3_UPLOAD_BUCKET_NAME="pages"
NEXTCLOUD_URL=https://espace.slm-lab.net
NEXTCLOUD_CLIENT_ID=espace.slm-lab.net
NEXTCLOUD_CLIENT_SECRET=YHLVMGpu0nGRaP7gMDpSjRr1ia6HiSr1

View File

@ -5,7 +5,7 @@ import { authOptions } from '@/app/api/auth/[...nextauth]/route';
// This file serves as an adapter to redirect requests from the old NextCloud
// status endpoint to the new MinIO S3 status endpoint
export async function GET() {
export async function GET(request: Request) {
try {
// Get session
const session = await getServerSession(authOptions);
@ -13,10 +13,14 @@ export async function GET() {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
// Get the base URL from the request
const { protocol, host } = new URL(request.url);
const baseUrl = `${protocol}//${host}`;
// Forward the request to the new endpoint
const response = await fetch('/api/storage/status', {
const response = await fetch(`${baseUrl}/api/storage/status`, {
headers: {
'Cookie': session ? 'next-auth.session-token=' + (session as any).accessToken : ''
'Cookie': request.headers.get('cookie') || ''
}
});