diff --git a/components/DetailBar.tsx b/components/DetailBar.tsx
index 110a2d8..a0c37c7 100644
--- a/components/DetailBar.tsx
+++ b/components/DetailBar.tsx
@@ -1,5 +1,6 @@
import { MonitorState, MonitorTarget } from "@/uptime.types";
-import { Tooltip } from "@mantine/core";
+import { Box, Tooltip } from "@mantine/core";
+import { useEffect, useRef } from "react";
export default function DetailBar({ monitor, state }: { monitor: MonitorTarget, state: MonitorState }) {
@@ -22,14 +23,24 @@ export default function DetailBar({ monitor, state }: { monitor: MonitorTarget,
uptimePercentBars.push(
-
+
)
}
return (
-
- {uptimePercentBars}
-
+ <>
+
+ {uptimePercentBars}
+
+
+ {/*
+ {uptimePercentBars.slice(-60)}
+
+
+
+ {uptimePercentBars.slice(-30)}
+ */}
+ >
)
}
\ No newline at end of file
diff --git a/components/Header.tsx b/components/Header.tsx
index 1b7f208..921bd82 100644
--- a/components/Header.tsx
+++ b/components/Header.tsx
@@ -1,31 +1,23 @@
-import { useState } from 'react';
import { Container, Group, Text } from '@mantine/core';
import classes from '@/styles/Header.module.css';
+import config from '@/uptime.config';
-const links = [
- { link: '/about', label: 'Features' },
- { link: '/pricing', label: 'Pricing' },
- { link: '/learn', label: 'Learn' },
- { link: '/community', label: 'Community' },
-];
export default function Header() {
- const [active, setActive] = useState(links[0].link);
- const items = links.map((link) => (
- {
- event.preventDefault();
- setActive(link.link);
- }}
- >
- {link.label}
-
- ));
+ const linkToElement = (link: { label: string; link: string; highlight?: boolean; }) => {
+ return (
+
+ {link.label}
+
+ )
+ }
return (
@@ -36,10 +28,16 @@ export default function Header() {
UptimeFlare
-
- {items}
+
+
+ {config.page.links.map(linkToElement)}
+
+
+ {config.page.links.filter(link => link.highlight).map(linkToElement)}
+
+
);
-}
\ No newline at end of file
+}
diff --git a/components/MonitorDetail.tsx b/components/MonitorDetail.tsx
index 10ea832..70bbf62 100644
--- a/components/MonitorDetail.tsx
+++ b/components/MonitorDetail.tsx
@@ -27,7 +27,7 @@ export default function MonitorDetail({ monitor, state }: { monitor: MonitorTarg
>
)
- const statusIcon = state.incident[monitor.id].slice(-1)[0].end === undefined ? :
+ const statusIcon = state.incident[monitor.id].slice(-1)[0].end === undefined ? :
let totalTime = Date.now() / 1000 - state.incident[monitor.id][0].start[0]
let downTime = 0
@@ -42,7 +42,7 @@ export default function MonitorDetail({ monitor, state }: { monitor: MonitorTarg
return (
<>
- {statusIcon} {monitor.name}
+ {statusIcon} {monitor.name}
Overall: {uptimePercent}%
diff --git a/components/MonitorList.tsx b/components/MonitorList.tsx
index dd16a00..3a38b7e 100644
--- a/components/MonitorList.tsx
+++ b/components/MonitorList.tsx
@@ -6,7 +6,7 @@ export default function MonitorList({ config, state }: { config: any, state: Mon
return (
-
+
{config.monitors.map((monitor: MonitorTarget) => (
diff --git a/pages/index.tsx b/pages/index.tsx
index cbbf16e..855eb03 100644
--- a/pages/index.tsx
+++ b/pages/index.tsx
@@ -7,7 +7,7 @@ import config from '@/uptime.config'
import OverallStatus from '@/components/OverallStatus'
import Header from '@/components/Header'
import MonitorList from '@/components/MonitorList'
-import { Center, Text } from '@mantine/core'
+import { Center, Divider, Text } from '@mantine/core'
export const runtime = 'experimental-edge'
const inter = Inter({ subsets: ['latin'] })
@@ -39,6 +39,14 @@ export default function Home({ state }: { state: MonitorState }) {
)
}
+
+
+
+
+ Open-source monitoring and status page powered by Uptimeflare and Cloudflare, made with ❤ by lyc8503.
+
+
+
>
)
diff --git a/uptime.config.ts b/uptime.config.ts
index e7f050b..e17fbfc 100644
--- a/uptime.config.ts
+++ b/uptime.config.ts
@@ -4,7 +4,12 @@ const config = {
dateLocale: "zh-CN",
timezone: "Asia/Shanghai",
page: {
- title: "lyc8503's Status Page"
+ title: "lyc8503's Status Page",
+ links: [
+ { link: 'https://github.com/lyc8503', label: 'GitHub' },
+ { link: 'https://blog.lyc8503.site/', label: 'Blog' },
+ { link: 'mailto:me@lyc8503.site', label: 'Email Me', highlight: true }
+ ]
},
callback: async (statusChangeMsg: string) => {
await fetch('https://server.lyc8503.site/wepush?key=wepushkey&msg=' + statusChangeMsg)
diff --git a/worker/src/index.ts b/worker/src/index.ts
index 00154b2..2d69fd2 100644
--- a/worker/src/index.ts
+++ b/worker/src/index.ts
@@ -24,14 +24,12 @@ async function getStatus(monitor: MonitorTarget): Promise<{ ping: number; up: bo
const [hostname, port] = monitor.target.split(":")
// Write "PING\n"
- const socket = connect({ hostname: hostname, port: Number(port) })
- const reader = socket.readable.getReader()
+ const socket = connect({ hostname: hostname, port: Number(port) })
const writer = socket.writable.getWriter()
await writer.write(new TextEncoder().encode("PING\n"))
- await reader.read() // This now works as a workaround for https://github.com/cloudflare/workerd/issues/1305
- await socket.close()
+ // Can't do this: await socket.close()
- // TODO: should throw an error here but it doesn't?
+ // https://github.com/cloudflare/workerd/issues/1305
await socket.closed
console.log(`${monitor.name} connected to ${monitor.target}`)