fix page api url; fix url encode; fix memory > int32 change it to big int

This commit is contained in:
root 2025-06-28 19:03:08 +08:00
parent ff89a81775
commit a1265e5155
5 changed files with 11 additions and 11 deletions

View File

@ -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() {
</button>
<h1 className="text-3xl font-semibold text-gray-900 mt-2">
{hostname}
{decodeURI(hostname)}
</h1>
</div>
{lastUpdate && (
@ -632,7 +632,7 @@ export default function HostDetail() {
style={{ aspectRatio: imageAspectRatio }}
>
<img
src={`/api/screenshots/${screenshot.fileId}`}
src={`/screenshots/${screenshot.fileId}`}
alt={screenshot.monitorName}
className="absolute top-0 left-0 w-full h-full object-contain shadow-sm hover:shadow-md transition-shadow"
onLoad={(e) => onImageLoad(e, screenshot.fileId)}

View File

@ -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() {
<div className="flex items-center justify-between">
<div>
<h3 className="text-lg font-medium text-gray-900">
{host.hostname}
{decodeURI(host.hostname)}
</h3>
<p className="mt-1 text-sm text-gray-500">
: {formatDate(host.lastUpdate)}

View File

@ -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
})

View File

@ -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,

View File

@ -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,