31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import { NextResponse } from 'next/server';
|
|
import { getServerSession } from 'next-auth';
|
|
import { authOptions } from "@/app/api/auth/options";
|
|
|
|
// 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(request: Request) {
|
|
try {
|
|
// Get session
|
|
const session = await getServerSession(authOptions);
|
|
if (!session?.user) {
|
|
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
|
|
}
|
|
|
|
// For backward compatibility, just return the standard folders
|
|
// This ensures the sidebar always shows something
|
|
const standardFolders = ['Notes', 'Diary', 'Health', 'Contacts'];
|
|
|
|
console.log('NextCloud status adapter returning standard folders:', standardFolders);
|
|
|
|
return NextResponse.json({
|
|
status: 'ready',
|
|
folders: standardFolders
|
|
});
|
|
|
|
} catch (error) {
|
|
console.error('Error in NextCloud status adapter:', error);
|
|
return NextResponse.json({ error: 'Internal server error' }, { status: 500 });
|
|
}
|
|
} |