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 () => { const fetchTimeDistribution = async () => {
try { try {
setLoadingDistribution(true); 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('获取时间分布数据失败'); if (!response.ok) throw new Error('获取时间分布数据失败');
const data = await response.json(); const data = await response.json();
setTimeDistribution(data.distribution); setTimeDistribution(data.distribution);
@ -157,7 +157,7 @@ export default function HostDetail() {
const fetchCredentials = async () => { const fetchCredentials = async () => {
try { try {
setLoadingCredentials(true); setLoadingCredentials(true);
const response = await fetch(`/api/hosts/${hostname}/credentials`); const response = await fetch(`/hosts/${hostname}/credentials`);
if (!response.ok) throw new Error('获取凭据数据失败'); if (!response.ok) throw new Error('获取凭据数据失败');
const data = await response.json(); const data = await response.json();
setCredentials(data); setCredentials(data);
@ -181,7 +181,7 @@ export default function HostDetail() {
setLoadingRecords(true); setLoadingRecords(true);
setShowDetailTimeline(true); setShowDetailTimeline(true);
const response = await fetch( 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('获取记录数据失败'); if (!response.ok) throw new Error('获取记录数据失败');
const data = await response.json(); const data = await response.json();
@ -517,7 +517,7 @@ export default function HostDetail() {
</button> </button>
<h1 className="text-3xl font-semibold text-gray-900 mt-2"> <h1 className="text-3xl font-semibold text-gray-900 mt-2">
{hostname} {decodeURI(hostname)}
</h1> </h1>
</div> </div>
{lastUpdate && ( {lastUpdate && (
@ -632,7 +632,7 @@ export default function HostDetail() {
style={{ aspectRatio: imageAspectRatio }} style={{ aspectRatio: imageAspectRatio }}
> >
<img <img
src={`/api/screenshots/${screenshot.fileId}`} src={`/screenshots/${screenshot.fileId}`}
alt={screenshot.monitorName} alt={screenshot.monitorName}
className="absolute top-0 left-0 w-full h-full object-contain shadow-sm hover:shadow-md transition-shadow" 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)} onLoad={(e) => onImageLoad(e, screenshot.fileId)}

View File

@ -19,7 +19,7 @@ export default function Home() {
const fetchHosts = async () => { const fetchHosts = async () => {
try { try {
setLoading(true); setLoading(true);
const response = await fetch('/api/hosts'); const response = await fetch('/hosts');
if (!response.ok) throw new Error('获取主机列表失败'); if (!response.ok) throw new Error('获取主机列表失败');
const data = await response.json(); const data = await response.json();
setHosts(data); setHosts(data);
@ -65,7 +65,7 @@ export default function Home() {
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<div> <div>
<h3 className="text-lg font-medium text-gray-900"> <h3 className="text-lg font-medium text-gray-900">
{host.hostname} {decodeURI(host.hostname)}
</h3> </h3>
<p className="mt-1 text-sm text-gray-500"> <p className="mt-1 text-sm text-gray-500">
: {formatDate(host.lastUpdate)} : {formatDate(host.lastUpdate)}

View File

@ -30,7 +30,7 @@ export default function UploadPage() {
// 获取当前版本信息 // 获取当前版本信息
const fetchCurrentVersion = useCallback(async () => { const fetchCurrentVersion = useCallback(async () => {
try { try {
const response = await fetch('/api/api/version') const response = await fetch('/api/version')
if (response.ok) { if (response.ok) {
const data: VersionInfo = await response.json() const data: VersionInfo = await response.json()
setCurrentVersion(data) setCurrentVersion(data)
@ -71,7 +71,7 @@ export default function UploadPage() {
formData.append('version', newVersion) formData.append('version', newVersion)
try { try {
const response = await fetch('/api/upload/version', { const response = await fetch('/upload/version', {
method: 'POST', method: 'POST',
body: formData body: formData
}) })

View File

@ -46,7 +46,7 @@ async function handleVersionUpload(req: NextRequest) {
const protocol = req.headers.get('x-forwarded-proto') || 'http' const protocol = req.headers.get('x-forwarded-proto') || 'http'
const host = req.headers.get('host') const host = req.headers.get('host')
const downloadUrl = `${protocol}://${host}/api/downloads/${storedFile.id}` const downloadUrl = `${protocol}://${host}/downloads/${storedFile.id}`
return NextResponse.json({ return NextResponse.json({
version, version,

View File

@ -14,7 +14,7 @@ async function handleGetVersion(req: NextRequest) {
const protocol = req.headers.get('x-forwarded-proto') || 'http' const protocol = req.headers.get('x-forwarded-proto') || 'http'
const host = req.headers.get('host') const host = req.headers.get('host')
const downloadUrl = `${protocol}://${host}/api/downloads/${latestVersion.fileId}` const downloadUrl = `${protocol}://${host}/downloads/${latestVersion.fileId}`
return NextResponse.json({ return NextResponse.json({
version: latestVersion.version, version: latestVersion.version,