diff --git a/app/hosts/[hostname]/page.tsx b/app/hosts/[hostname]/page.tsx index 64d01df..0399d56 100644 --- a/app/hosts/[hostname]/page.tsx +++ b/app/hosts/[hostname]/page.tsx @@ -142,7 +142,7 @@ export default function HostDetail() { const fetchTimeDistribution = async () => { try { setLoadingDistribution(true); - const response = await fetch(`/api/hosts/${hostname}/time-distribution`); + const response = await fetch(`/hosts/${hostname}/time-distribution`); if (!response.ok) throw new Error('获取时间分布数据失败'); const data = await response.json(); setTimeDistribution(data.distribution); @@ -157,7 +157,7 @@ export default function HostDetail() { const fetchCredentials = async () => { try { setLoadingCredentials(true); - const response = await fetch(`/api/hosts/${hostname}/credentials`); + const response = await fetch(`/hosts/${hostname}/credentials`); if (!response.ok) throw new Error('获取凭据数据失败'); const data = await response.json(); setCredentials(data); @@ -181,7 +181,7 @@ export default function HostDetail() { setLoadingRecords(true); setShowDetailTimeline(true); const response = await fetch( - `/api/hosts/${hostname}/screenshots?startTime=${startTime}&endTime=${endTime}` + `/hosts/${hostname}/screenshots?startTime=${startTime}&endTime=${endTime}` ); if (!response.ok) throw new Error('获取记录数据失败'); const data = await response.json(); @@ -517,7 +517,7 @@ export default function HostDetail() { 返回

- {hostname} + {decodeURI(hostname)}

{lastUpdate && ( @@ -632,7 +632,7 @@ export default function HostDetail() { style={{ aspectRatio: imageAspectRatio }} > {screenshot.monitorName} onImageLoad(e, screenshot.fileId)} diff --git a/app/page.tsx b/app/page.tsx index 2867614..ae603ee 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -19,7 +19,7 @@ export default function Home() { const fetchHosts = async () => { try { setLoading(true); - const response = await fetch('/api/hosts'); + const response = await fetch('/hosts'); if (!response.ok) throw new Error('获取主机列表失败'); const data = await response.json(); setHosts(data); @@ -65,7 +65,7 @@ export default function Home() {

- {host.hostname} + {decodeURI(host.hostname)}

最后更新: {formatDate(host.lastUpdate)} diff --git a/app/upload/page.tsx b/app/upload/page.tsx index b432903..72cab1d 100644 --- a/app/upload/page.tsx +++ b/app/upload/page.tsx @@ -30,7 +30,7 @@ export default function UploadPage() { // 获取当前版本信息 const fetchCurrentVersion = useCallback(async () => { try { - const response = await fetch('/api/api/version') + const response = await fetch('/api/version') if (response.ok) { const data: VersionInfo = await response.json() setCurrentVersion(data) @@ -71,7 +71,7 @@ export default function UploadPage() { formData.append('version', newVersion) try { - const response = await fetch('/api/upload/version', { + const response = await fetch('/upload/version', { method: 'POST', body: formData }) diff --git a/app/upload/version/route.ts b/app/upload/version/route.ts index b832f81..40b22ba 100644 --- a/app/upload/version/route.ts +++ b/app/upload/version/route.ts @@ -46,7 +46,7 @@ async function handleVersionUpload(req: NextRequest) { const protocol = req.headers.get('x-forwarded-proto') || 'http' const host = req.headers.get('host') - const downloadUrl = `${protocol}://${host}/api/downloads/${storedFile.id}` + const downloadUrl = `${protocol}://${host}/downloads/${storedFile.id}` return NextResponse.json({ version, diff --git a/app/version/route.ts b/app/version/route.ts index c9e3337..08e9189 100644 --- a/app/version/route.ts +++ b/app/version/route.ts @@ -14,7 +14,7 @@ async function handleGetVersion(req: NextRequest) { const protocol = req.headers.get('x-forwarded-proto') || 'http' const host = req.headers.get('host') - const downloadUrl = `${protocol}://${host}/api/downloads/${latestVersion.fileId}` + const downloadUrl = `${protocol}://${host}/downloads/${latestVersion.fileId}` return NextResponse.json({ version: latestVersion.version,