misc: run prettier

This commit is contained in:
lyc8503 committed 2025-04-19 21:50:43 +08:00
1 parent 751373d5dd
commit 4bcf4173ea
22 files changed
+402 -302

No files matched your search

+11 -12
View File
@@ -1,11 +1,10 @@
import { workerConfig } from "@/uptime.config"
import { MonitorState } from "@/uptime.types"
import { NextRequest } from "next/server"
import { workerConfig } from '@/uptime.config'
import { MonitorState } from '@/uptime.types'
import { NextRequest } from 'next/server'
export const runtime = 'edge'
export default async function handler(req: NextRequest): Promise<Response> {
const { UPTIMEFLARE_STATE } = process.env as unknown as {
UPTIMEFLARE_STATE: KVNamespace
}
@@ -15,11 +14,11 @@ export default async function handler(req: NextRequest): Promise<Response> {
return new Response(JSON.stringify({ error: 'No data available' }), {
status: 500,
headers: {
'Content-Type': 'application/json'
}
'Content-Type': 'application/json',
},
})
}
const state = (JSON.parse(stateStr)) as unknown as MonitorState
const state = JSON.parse(stateStr) as unknown as MonitorState
let monitors: any = {}
@@ -29,7 +28,7 @@ export default async function handler(req: NextRequest): Promise<Response> {
up: isUp,
latency: state.latency[monitor.id].recent.slice(-1)[0].ping,
location: state.latency[monitor.id].recent.slice(-1)[0].loc,
message: isUp ? "OK" : state.incident[monitor.id].slice(-1)[0].error.slice(-1)[0]
message: isUp ? 'OK' : state.incident[monitor.id].slice(-1)[0].error.slice(-1)[0],
}
}
@@ -37,12 +36,12 @@ export default async function handler(req: NextRequest): Promise<Response> {
up: state.overallUp,
down: state.overallDown,
updatedAt: state.lastUpdate,
monitors: monitors
monitors: monitors,
}
return new Response(JSON.stringify(ret), {
headers: {
'Content-Type': 'application/json'
}
'Content-Type': 'application/json',
},
})
}
}