feat(group): edit group

This commit is contained in:
2026-03-09 15:03:18 +08:00
parent e7670c7cef
commit fe46a422b4
6 changed files with 87 additions and 91 deletions

View File

@@ -119,44 +119,52 @@ export async function POST(req: any) {
},
})
} else if (!notJson) {
const data = await res.json()
try {
const data = await (res.headers
.get("Content-Type")
?.includes("application/json")
? res.json()
: res.text())
if (isLogin) {
const header = await headers()
let clientIP =
header.get("x-forwarded-for")?.split(",")[0] ||
req?.socket?.remoteAddress
// ip v6地址
if (clientIP.startsWith("::")) {
clientIP = clientIP.slice(7)
if (isLogin) {
const header = await headers()
let clientIP =
header.get("x-forwarded-for")?.split(",")[0] ||
req?.socket?.remoteAddress
// ip v6地址
if (clientIP.startsWith("::")) {
clientIP = clientIP.slice(7)
}
const newData = await handleLoginData({
clientIP: clientIP,
fingerprint: body.fingerprint,
data,
})
return new NextResponse(JSON.stringify(newData), {
headers: {
"Content-Type": "application/json",
},
})
}
const newData = await handleLoginData({
clientIP: clientIP,
fingerprint: body.fingerprint,
data,
})
return new NextResponse(JSON.stringify(newData), {
if (isRefresh) {
const newData = await handleRefreshToken({
userData,
data,
})
return new NextResponse(JSON.stringify(newData), {
headers: {
"Content-Type": "application/json",
},
})
}
return new NextResponse(JSON.stringify(data), {
headers: {
"Content-Type": "application/json",
},
})
} catch (err) {
return NextResponse.json({ error: err }, { status: 500 })
}
if (isRefresh) {
const newData = await handleRefreshToken({
userData,
data,
})
return new NextResponse(JSON.stringify(newData), {
headers: {
"Content-Type": "application/json",
},
})
}
return new NextResponse(JSON.stringify(data), {
headers: {
"Content-Type": "application/json",
},
})
} else {
return res
}