From 1f4900b143251a60e806abb98d4eb7a72fc76ce6 Mon Sep 17 00:00:00 2001 From: lyc8503 Date: Tue, 17 Oct 2023 01:11:28 +0800 Subject: [PATCH] disable fetch cache --- README.md | 41 +----------------------------------- components/MonitorDetail.tsx | 8 +++++++ uptime.config.ts | 10 +++++++++ worker/src/index.ts | 7 +++++- 4 files changed, 25 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index a75ac52..3be19ec 100644 --- a/README.md +++ b/README.md @@ -1,40 +1 @@ -This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). - -## Getting Started - -First, run the development server: - -```bash -npm run dev -# or -yarn dev -# or -pnpm dev -# or -bun dev -``` - -Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. - -You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file. - -[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`. - -The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages. - -This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font. - -## Learn More - -To learn more about Next.js, take a look at the following resources: - -- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. -- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. - -You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! - -## Deploy on Vercel - -The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. - -Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. +## UptimeFlare diff --git a/components/MonitorDetail.tsx b/components/MonitorDetail.tsx index 0b21c06..4ce876a 100644 --- a/components/MonitorDetail.tsx +++ b/components/MonitorDetail.tsx @@ -82,9 +82,17 @@ export default function MonitorDetail({ monitor, state }: { monitor: MonitorTarg } } + const uptimePercentBars = [] + for (let i = 0; i < 90; i++) { + uptimePercentBars.push(
) + } + return ( <> {statusIcon} {monitor.name} + {/*
+ {uptimePercentBars} +
*/}
diff --git a/uptime.config.ts b/uptime.config.ts index 0ef7021..be3d62d 100644 --- a/uptime.config.ts +++ b/uptime.config.ts @@ -55,6 +55,16 @@ const config = { target: 'https://server.lyc8503.site', timeout: 10000 }, + { + id: 'homelab', + name: 'HomeLab', + method: 'GET', + target: 'https://lyc8503.cn4.quickconnect.cn/webstation/hello.txt', + timeout: 10000, + headers: { + "Cookie": "type=tunnel;" + } + }, { id: 'broken-test', name: 'Ping 1.1.1.1', diff --git a/worker/src/index.ts b/worker/src/index.ts index 8d2b6de..4aa8a93 100644 --- a/worker/src/index.ts +++ b/worker/src/index.ts @@ -50,7 +50,12 @@ async function getStatus(monitor: MonitorTarget): Promise<{ ping: number; up: bo const response = await fetchTimeout(monitor.target, monitor.timeout || 10000, { method: monitor.method, headers: monitor.headers, - body: monitor.body + body: monitor.body, + cf: { + cacheTtlByStatus: { + '100-599': -1 // Don't cache any status code, from https://developers.cloudflare.com/workers/runtime-apis/request/#requestinitcfproperties + } + } }) console.log(`${monitor.name} responded with ${response.status}`)