完善错误提示

This commit is contained in:
2025-05-09 09:36:23 +08:00
parent fbc6478496
commit 0665a4e13c
6 changed files with 74 additions and 55 deletions

View File

@@ -46,19 +46,19 @@ export async function GET(req: NextRequest) {
const separator = rSeparator.split(',').map(code => String.fromCharCode(parseInt(code))).join('')
switch (format) {
case 'json':
const body = JSON.stringify(params)
return NextResponse.json(body)
case 'text':
const text = result.data.map(item => {
const list = [item.host, item.port]
if (item.username && item.password) {
list.push(item.username)
list.push(item.password)
}
return list.join(separator)
}).join(breaker)
return new NextResponse(text)
case 'json':
const body = JSON.stringify(params)
return NextResponse.json(body)
case 'text':
const text = result.data.map(item => {
const list = [item.host, item.port]
if (item.username && item.password) {
list.push(item.username)
list.push(item.password)
}
return list.join(separator)
}).join(breaker)
return new NextResponse(text)
}
}
catch (error) {