feat: add default UA

pull/161/head
lyc8503 2025-11-06 01:02:29 +08:00
parent 001eea274b
commit ee2d23f151
5 changed files with 19 additions and 7 deletions

View File

@ -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

View File

@ -99,7 +99,9 @@ export default function OverallStatus({
{upcomingMaintenances.length > 0 && (
<>
<Title mt="4px" style={{ textAlign: 'center', color: '#70778c' }} order={5}>
{`${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)}

View File

@ -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

View File

@ -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,

View File

@ -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: {