complete frontend - refact from vue

This commit is contained in:
2025-06-28 16:57:26 +08:00
parent 1e65c2d872
commit 1d41ad6ef1
9 changed files with 1772 additions and 96 deletions
-31
View File
@@ -1,31 +0,0 @@
import { NextRequest, NextResponse } from 'next/server'
import { prisma } from '@/lib/prisma'
import { withCors } from '@/lib/middleware'
async function handleGetVersion(req: NextRequest) {
try {
const latestVersion = await prisma.version.findFirst({
where: { isLatest: true }
})
if (!latestVersion) {
return NextResponse.json({ error: 'No version found' }, { status: 404 })
}
const protocol = req.headers.get('x-forwarded-proto') || 'http'
const host = req.headers.get('host')
const downloadUrl = `${protocol}://${host}/api/downloads/${latestVersion.fileId}`
return NextResponse.json({
version: latestVersion.version,
download_url: downloadUrl,
checksum: latestVersion.checksum
})
} catch (error) {
console.error('获取版本信息失败:', error)
return NextResponse.json({ error: '获取版本信息失败' }, { status: 500 })
}
}
export const GET = withCors(handleGetVersion)