iata added, todo fix location
This commit is contained in:
1 parent
1d431a649f
commit
aef4dedabe
5 files changed
+67
-45
No files matched your search
@@ -2,30 +2,35 @@
|
||||
Another **serverless (and free!)** uptime monitoring & status page on Cloudflare Workers with more advanced features and nice UI.
|
||||
|
||||
## ⭐Features
|
||||
|
||||
- **Opensource** & Easy to deploy (in 10 minutes without local tools) & Free
|
||||
- Up to 50 **2-minute** interval check on free plan (Up to unlimited 1-min on paid Workers plan)
|
||||
|
||||
#### Monitoring
|
||||
- Up to 50 **2-minute** interval check on free plan (Up to unlimited 1-min check on paid Workers plan)
|
||||
- Monitoring for **HTTP/HTTPS/TCP port**
|
||||
- Show 90-day uptime history and uptime percentage
|
||||
- Show all incident history & detailed timeline
|
||||
- **Interactive ping(response time) chart** for all type of monitors
|
||||
- Up to 90-day uptime history and uptime percentage
|
||||
- Custom request method & headers & body for HTTP(s)
|
||||
- Custom status code & keyword check for HTTP(s)
|
||||
- Email Notifications & Customizable Webhook
|
||||
- Customizable status page
|
||||
- use your own domain with CNAME
|
||||
|
||||
TODO:
|
||||
- SSL?
|
||||
- Slack / Telegram
|
||||
#### Status page
|
||||
- **Interactive ping(response time) chart** for all type of monitors
|
||||
- Responsive UI & Follow system theme
|
||||
- Customizable status page
|
||||
- Use your own domain with CNAME
|
||||
|
||||
## Demo
|
||||
My status page (Online demo):
|
||||
My status page (Online demo): https://uptimeflare.pages.dev/
|
||||
|
||||
Some screenshots:
|
||||
Some screenshots: TODO
|
||||
|
||||
## Quickstart
|
||||
|
||||
|
||||
## More documentation
|
||||
|
||||
|
||||
## TODOs
|
||||
- SSL?
|
||||
- Slack / Telegram
|
||||
- Incident timeline
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
import { MonitorState, MonitorTarget } from "@/uptime.types";
|
||||
import { Tooltip } from "@mantine/core";
|
||||
|
||||
|
||||
export default function DetailBar({ monitor, state }: { monitor: MonitorTarget, state: MonitorState }) {
|
||||
// const day = new Date()
|
||||
// day.setHours(0, 0, 0, 0)
|
||||
// const dayStart = day.getTime()
|
||||
|
||||
const overlapLen = (x1: number, x2: number, y1: number, y2: number) => {
|
||||
return Math.max(0, Math.min(x2, y2) - Math.max(x1, y1) + 1)
|
||||
}
|
||||
|
||||
const uptimePercentBars = []
|
||||
|
||||
for (let i = 89; i > 0; i--) {
|
||||
|
||||
let dayDownTime = 0
|
||||
let dayTotalTime = 0
|
||||
|
||||
// if (state.incident[monitor.id][0].end)
|
||||
|
||||
uptimePercentBars.push(
|
||||
<Tooltip key={i} label="Tooltip">
|
||||
<div style={{ height: '20px', width: '0.8%', background: 'green', borderRadius: '2px', marginLeft: '0.155%', marginRight: '0.155%' }}/>
|
||||
</Tooltip>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<div style={{ display: 'flex', flexWrap: 'nowrap', marginTop: '10px', marginBottom: '5px' }}>
|
||||
{uptimePercentBars}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
|
||||
import { Text, Tooltip } from "@mantine/core"
|
||||
import { MonitorState, MonitorTarget } from "@/uptime.types";
|
||||
import { IconAlertCircle, IconCircleCheck } from "@tabler/icons-react";
|
||||
import DetailChart from "./DetailChart";
|
||||
import NoSsr from "./NoSsr";
|
||||
import { Text } from "@mantine/core"
|
||||
import { MonitorState, MonitorTarget } from "@/uptime.types"
|
||||
import { IconAlertCircle, IconCircleCheck } from "@tabler/icons-react"
|
||||
import DetailChart from "./DetailChart"
|
||||
import DetailBar from "./DetailBar"
|
||||
|
||||
function getColor(percent: number | string, darker: boolean): string {
|
||||
percent = Number(percent)
|
||||
@@ -18,7 +18,6 @@ function getColor(percent: number | string, darker: boolean): string {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export default function MonitorDetail({ monitor, state }: { monitor: MonitorTarget, state: MonitorState }) {
|
||||
|
||||
if (!state.latency[monitor.id]) return (
|
||||
@@ -40,26 +39,6 @@ export default function MonitorDetail({ monitor, state }: { monitor: MonitorTarg
|
||||
console.log(downTime)
|
||||
const uptimePercent = ((totalTime - downTime) / totalTime * 100).toPrecision(4)
|
||||
|
||||
const uptimePercentBars = []
|
||||
|
||||
// const day = new Date()
|
||||
// day.setHours(0, 0, 0, 0)
|
||||
// const dayStart = day.getTime()
|
||||
|
||||
for (let i = 0; i < 90; i++) {
|
||||
|
||||
let dayDownTime = 0
|
||||
let dayTotalTime = 0
|
||||
|
||||
// if (state.incident[monitor.id][0].end)
|
||||
|
||||
uptimePercentBars.push(
|
||||
<Tooltip key={i} label="Tooltip">
|
||||
<div style={{ height: '20px', width: '0.8%', background: 'green', borderRadius: '2px', marginLeft: '0.155%', marginRight: '0.155%' }}/>
|
||||
</Tooltip>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
@@ -67,10 +46,7 @@ export default function MonitorDetail({ monitor, state }: { monitor: MonitorTarg
|
||||
<Text mt='sm' fw={700} style={{ display: 'inline', color: getColor(uptimePercent, true) }}>Overall: {uptimePercent}%</Text>
|
||||
</div>
|
||||
|
||||
<div style={{ display: 'flex', flexWrap: 'nowrap', marginTop: '10px', marginBottom: '5px' }}>
|
||||
{uptimePercentBars}
|
||||
</div>
|
||||
|
||||
<DetailBar monitor={monitor} state={state} />
|
||||
<DetailChart monitor={monitor} state={state} />
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
const map = JSON.parse('{"AAA": "French Polynesia/Tuamotu-Gambier", "AAE": "Algeria/Annaba", "AAL": "Denmark/Nordjylland", "AAM": "South Africa", "AAN": "United Arab Emirates/Abu Dhabi", "AAQ": "Russia/Krasnodarskiy Kray", "AAR": "Denmark/Midtjylland", "AAT": "China/Xinjiang", "AAX": "Brazil/Minas Gerais", "AAY": "Yemen/Hadramawt", "ABA": "Russian Federation/Khakasiya", "ABC": "Spain/Castilla-la Mancha", "ABD": "Iran/Khuzestan", "ABE": "United States/Pennsylvania", "ABI": "United States/Texas", "ABJ": "Ivory Coast/Abidjan", "ABK": "Ethiopia/Ogaden", "ABL": "United States/Alaska", "ABM": "Australia/Queensland", "ABQ": "United States/New Mexico", "ABR": "United States/South Dakota", "ABS": "Egypt/Aswan", "ABT": "Saudi Arabia/Al Baha", "ABV": "Nigeria/Abuja Capital Territory", "ABX": "Australia/New South Wales", "ABY": "United States/Georgia", "ABZ": "United Kingdom/Scotland", "ACA": "Mexico/Guerrero", "ACC": "Ghana/Greater Accra", "ACE": "Spain/Canary Islands", "ACH": "Switzerland/Canton of St. Gallen", "ACI": "United Kingdom/Channel Islands", "ACK": "United States/Massachusetts", "ACP": "Iran", "ACS": "Russia/Krasnoyarskiy Kray", "ACT": "United States/Texas", "ACV": "United States/California", "ACX": "China/Guizhou", "ACY": "United States/New Jersey", "ACZ": "Iran/Sistan va Baluchestan", "ADA": "Turkey/Adana", "ADB": "Turkey/\\u0130zmir", "ADD": "Ethiopia/Debub Shewa", "ADE": "Yemen/`Adan", "ADF": "Turkey/Ad\\u0131yaman", "ADJ": "Jordan/\'Amman", "ADK": "United States/Alaska", "ADL": "Australia/South Australia", "ADQ": "United States/Alaska", "ADU": "Iran/Ardabil", "ADX": "United Kingdom/Scotland", "ADZ": "Colombia/San Andres y Providencia", "AEH": "Chad/Ouaddai", "AEP": "Argentina/Ciudad de Buenos Aires", "AER": "Russia/Krasnodarskiy Kray", "AES": "Norway/More og Romsdal", "AET": "United States/Alaska", "AEX": "United States/Louisiana", "AEY": "Iceland/Akureyri", "AFA": "Argentina/Mendoza", "AFL": "Brazil/Mato Grosso", "AFS": "Uzbekistan/Nawoiy", "AFT": "Solomon Islands/Malaita", "AFZ": "Iran/Khorasan", "AGA": "Morocco/Agadir", "AGF": "France/Aquitaine", "AGH": "Sweden/Skane", "AGL": "Papua New Guinea/Northern", "AGM": "Greenland/Ostgronland", "AGN": "United States/Alaska", "AGP": "Spain/Andalucia", "AGR": "India/Uttar Pradesh", "AGS": "United States/Georgia", "AGT": "Paraguay/Alto Paran\\u00e1", "AGU": "Mexico/Aguascalientes", "AGV": "Venezuela/Portuguesa", "AGX": "India/Lakshadweep", "AHB": "Saudi Arabia/Asir", "AHC": "United States/California", "AHE": "French Polynesia/Tuamotu-Gambier", "AHO": "Italy/Sardinia", "AHS": "Honduras/Gracias a Dios", "AHU": "Morocco/Al Hoceima", "AIA": "United States/Nebraska", "AIN": "United States/Alaska", "AIT": "Cook Islands/Aitutaki", "AIU": "Cook Islands/Atiu", "AJA": "France/Corsica", "AJF": "Saudi Arabia/Al Jawf", "AJI": "Turkey/A\\u011fr\\u0131", "AJL": "India/Mizoram", "AJN": "Comoros/Anjouan", "AJR": "Sweden/Norrbotten", "AJU": "Brazil/Sergipe", "AKA": "China/Shaanxi", "AKB": "United States/Alaska", "AKF": "Libya/Al Kufrah", "AKI": "United States/Alaska", "AKJ": "Japan/Hokkaido Prefecture", "AKK": "United States/Alaska", "AKL": "New Zealand/Auckland", "AKN": "United States/Alaska", "AKP": "United States/Alaska", "AKS": "South Africa/Free State", "AKU": "China/Xinjiang", "AKV": "Canada/Quebec", "AKX": "Kazakhstan/Aqtobe", "AKY": "Myanmar/Rakhine State", "ALA": "Kazakhstan/Almaty", "ALB": "United States/New York", "ALC": "Spain/Valencia", "ALF": "Norway/Finnmark Fylke", "ALG": "Algeria/Alger", "ALH": "Australia/Western Australia", "ALM": "United States/New Mexico", "ALO": "United States/Iowa", "ALP": "Syria/H\'alab", "ALS": "United States/Colorado", "ALW": "United States/Washington", "ALY": "Egypt/Al Iskandariyah", "ALZ": "United States/Alaska", "AMA": "United States/Texas", "AMD": "India/Gujarat", "AMH": "Ethiopia/Gamo Gofa", "AMI": "Indonesia/Nusa Tenggara Barat", "AMM": "Jordan/\'Amman", "AMQ": "Indonesia/Maluku", "AMS": "Netherlands/North Holland", "AMV": "Russia/Nenetskiy Avtonomnyy Okrug", "AMY": "Madagascar/Fianarantsoa", "ANC": "United States/Alaska", "ANE": "France/Pays de la Loire", "ANF": "Chile/Antofagasta", "ANG": "France/Poitou-Charentes", "ANI": "United States/Alaska", "ANM": "Madagascar", "ANR": "Belgium/Antwerp", "ANU": "Antigua and Barbuda/Saint George", "ANV": "United States/Alaska", "ANX": "Norway/Nordland Fylke", "AOC": "Germany/Thuringia", "AOE": "Turkey/Eski\\u015fehir", "AOI": "Italy/Marche", "AOJ": "Japan/Aomori Prefecture", "AOK": "Greece/Notio Aigaio", "AOO": "United States/Pennsylvania", "AOR": "Malaysia/Kedah", "AOS": "United States/Alaska", "APA": "United States/Colorado", "APF": "United States/Florida", "APK": "French Polynesia", "APL": "Mozambique/Nampula", "APN": "United States/Michigan", "APO": "Colombia/Antioquia", "APW": "Samoa/A`ana", "AQG": "China/Anhui", "AQI": "Saudi Arabia", "AQJ": "Jordan/Al `Aqabah", "AQP": "Peru/Arequipa", "ARC": "United States/Alaska", "ARD": "Indonesia", "ARH": "Russia/Arkhangelrskaya Oblast", "ARI": "ChiLine truncated
|
||||
|
||||
function iataToCountry(iataCode: string): string {
|
||||
return map[iataCode] || ('Unknown IATA: ' + iataCode)
|
||||
}
|
||||
|
||||
export { iataToCountry }
|
||||
+1
-3
@@ -2,10 +2,8 @@ async function getWorkerLocation() {
|
||||
const res = await fetch('https://cloudflare.com/cdn-cgi/trace')
|
||||
const text = await res.text()
|
||||
|
||||
const loc = /^loc=(.*)$/m.exec(text)?.[1]
|
||||
const colo = /^colo=(.*)$/m.exec(text)?.[1]
|
||||
|
||||
return loc + '/' + colo
|
||||
return colo
|
||||
}
|
||||
|
||||
const fetchTimeout = (url: string, ms: number, { signal, ...options }: RequestInit<RequestInitCfProperties> | undefined = {}): Promise<Response> => {
|
||||
|
||||
Reference in new issue
Block a user