minor fixes

pull/10/head
lyc8503 2024-03-18 15:44:26 +08:00
parent 4963a4815a
commit 8b17cb840b
2 changed files with 10 additions and 7 deletions

View File

@ -5,7 +5,7 @@ A more advanced, serverless, and free uptime monitoring & status page solution,
## ⭐Features ## ⭐Features
- Open-source, easy to deploy (in under 10 minutes, no local tools required), and free - Open-source, easy to deploy (in under 10 minutes, no local tools required), and free
- Monitoring capabilities - Monitoring capabilities
- Up to 50 checks at 2-minute intervals - Up to 50 checks at 1-minute intervals
- Geo-specific checks from over [310 cities](https://www.cloudflare.com/network/) worldwide - Geo-specific checks from over [310 cities](https://www.cloudflare.com/network/) worldwide
- Support for HTTP/HTTPS/TCP port monitoring - Support for HTTP/HTTPS/TCP port monitoring
- Up to 90-day uptime history and uptime percentage tracking - Up to 90-day uptime history and uptime percentage tracking
@ -38,5 +38,5 @@ Please refer to [Quickstart](https://github.com/lyc8503/UptimeFlare/wiki/Quickst
- [x] [Bark](https://bark.day.app) example - [x] [Bark](https://bark.day.app) example
- [ ] Slack example - [ ] Slack example
- [ ] Incident timeline - [ ] Incident timeline
- [ ] Email notification via Cloudflare Email Workers - [x] ~~Email notification via Cloudflare Email Workers~~
- [x] Specify region for monitors - [x] Specify region for monitors

View File

@ -10,8 +10,8 @@ const pageConfig = {
} }
const workerConfig = { const workerConfig = {
// Write KV at most every 10 minutes unless the status changed. // Write KV at most every 3 minutes unless the status changed.
kvWriteCooldownMinutes: 10, kvWriteCooldownMinutes: 3,
// Define all your monitors here // Define all your monitors here
monitors: [ monitors: [
// Example HTTP Monitor // Example HTTP Monitor
@ -66,6 +66,10 @@ const workerConfig = {
timeNow: number, timeNow: number,
reason: string reason: string
) => { ) => {
// This callback will be called when there's a status change for any monitor
// Write any Typescript code here
// By default, this sends Bark and Telegram notification on every status change if you setup Env correctly.
await notify(env, monitor, isUp, timeIncidentStart, timeNow, reason) await notify(env, monitor, isUp, timeIncidentStart, timeNow, reason)
}, },
onIncident: async ( onIncident: async (
@ -76,7 +80,7 @@ const workerConfig = {
timeNow: number, timeNow: number,
reason: string reason: string
) => { ) => {
// This callback will be called EVERY 2 MINTUES if there's an on-going incident for any monitor // This callback will be called EVERY 1 MINTUE if there's an on-going incident for any monitor
// Write any Typescript code here // Write any Typescript code here
}, },
}, },
@ -156,8 +160,7 @@ export async function notifyTelegram(env: Env, monitor: any, operational: boolea
if (!response.ok) { if (!response.ok) {
console.error( console.error(
`Failed to send Telegram notification "${text}", ${response.status} ${ `Failed to send Telegram notification "${text}", ${response.status} ${response.statusText
response.statusText
} ${await response.text()}`, } ${await response.text()}`,
); );
} }