import { NextRequest, NextResponse } from 'next/server' import { readFile } from 'node:fs/promises' import path from 'node:path' async function getConfig() { const configPath = path.join(process.cwd(), 'src', 'config', 'config.json') const content = await readFile(configPath, 'utf8') return JSON.parse(content) } export async function GET(req: NextRequest) { const config = await getConfig() const url = req.nextUrl.clone() url.pathname = '/' url.search = '' if (config.authString) { url.searchParams.set('auth', config.authString) } return NextResponse.redirect(url) }