diff --git a/README.md b/README.md index aaf5358..921bc9b 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,6 @@ To contribute new features or customize your deployment furthermore, see [here]( - [x] Universal Webhook upgrade - [ ] i18n...? (maybe) - [ ] ICMP via proxy? -- [ ] Add default UA +- [x] Add default UA - [ ] Customizable footer - [ ] New header logo diff --git a/components/OverallStatus.tsx b/components/OverallStatus.tsx index 5212291..08ec053 100644 --- a/components/OverallStatus.tsx +++ b/components/OverallStatus.tsx @@ -99,7 +99,9 @@ export default function OverallStatus({ {upcomingMaintenances.length > 0 && ( <> - {`${upcomingMaintenances.length} upcoming ${upcomingMaintenances.length === 1 ? 'maintenance' : 'maintenances'}`}{' '} + {`${upcomingMaintenances.length} upcoming ${ + upcomingMaintenances.length === 1 ? 'maintenance' : 'maintenances' + }`}{' '} <span style={{ textDecoration: 'underline', cursor: 'pointer' }} onClick={() => setExpandUpcoming(!expandUpcoming)} diff --git a/uptime.config.ts b/uptime.config.ts index 85d7701..cf80328 100644 --- a/uptime.config.ts +++ b/uptime.config.ts @@ -13,7 +13,7 @@ const pageConfig: PageConfig = { { link: 'https://github.com/lyc8503', label: 'GitHub' }, { link: 'https://blog.lyc8503.net/', label: 'Blog' }, { link: 'mailto:me@lyc8503.net', label: 'Email Me', highlight: true }, - ] + ], } const workerConfig: WorkerConfig = { @@ -102,7 +102,7 @@ const workerConfig: WorkerConfig = { // notification will be sent only if the monitor is down for N continuous checks after the initial failure // if not specified, notification will be sent immediately gracePeriod: 5, - } + }, } // You can define multiple maintenances here diff --git a/worker/src/index.ts b/worker/src/index.ts index 9e2d741..9791593 100644 --- a/worker/src/index.ts +++ b/worker/src/index.ts @@ -225,8 +225,13 @@ const Worker = { currentTimeSecond - currentIncident.start[0] < workerConfig.notification.gracePeriod * 60 + 30) ) { - if (currentIncident.start[0] !== currentTimeSecond && workerConfig.notification?.skipErrorChangeNotification) { - console.log('Skipping notification for following error reason change due to user config') + if ( + currentIncident.start[0] !== currentTimeSecond && + workerConfig.notification?.skipErrorChangeNotification + ) { + console.log( + 'Skipping notification for following error reason change due to user config' + ) } else { await formatAndNotify( monitor, diff --git a/worker/src/monitor.ts b/worker/src/monitor.ts index 339439f..4b69f24 100644 --- a/worker/src/monitor.ts +++ b/worker/src/monitor.ts @@ -280,9 +280,14 @@ export async function getStatus( } else { // HTTP endpoint monitor try { + let headers = new Headers(monitor.headers as any) + if (!headers.has('user-agent')) { + headers.set('user-agent', 'UptimeFlare/1.0 (+https://github.com/lyc8503/UptimeFlare)') + } + const response = await fetchTimeout(monitor.target, monitor.timeout || 10000, { method: monitor.method, - headers: monitor.headers as any, + headers: headers, body: monitor.body, cf: { cacheTtlByStatus: {