feat: add default UA
parent
001eea274b
commit
ee2d23f151
|
|
@ -76,6 +76,6 @@ To contribute new features or customize your deployment furthermore, see [here](
|
||||||
- [x] Universal Webhook upgrade
|
- [x] Universal Webhook upgrade
|
||||||
- [ ] i18n...? (maybe)
|
- [ ] i18n...? (maybe)
|
||||||
- [ ] ICMP via proxy?
|
- [ ] ICMP via proxy?
|
||||||
- [ ] Add default UA
|
- [x] Add default UA
|
||||||
- [ ] Customizable footer
|
- [ ] Customizable footer
|
||||||
- [ ] New header logo
|
- [ ] New header logo
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,9 @@ export default function OverallStatus({
|
||||||
{upcomingMaintenances.length > 0 && (
|
{upcomingMaintenances.length > 0 && (
|
||||||
<>
|
<>
|
||||||
<Title mt="4px" style={{ textAlign: 'center', color: '#70778c' }} order={5}>
|
<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
|
<span
|
||||||
style={{ textDecoration: 'underline', cursor: 'pointer' }}
|
style={{ textDecoration: 'underline', cursor: 'pointer' }}
|
||||||
onClick={() => setExpandUpcoming(!expandUpcoming)}
|
onClick={() => setExpandUpcoming(!expandUpcoming)}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ const pageConfig: PageConfig = {
|
||||||
{ link: 'https://github.com/lyc8503', label: 'GitHub' },
|
{ link: 'https://github.com/lyc8503', label: 'GitHub' },
|
||||||
{ link: 'https://blog.lyc8503.net/', label: 'Blog' },
|
{ link: 'https://blog.lyc8503.net/', label: 'Blog' },
|
||||||
{ link: 'mailto:me@lyc8503.net', label: 'Email Me', highlight: true },
|
{ link: 'mailto:me@lyc8503.net', label: 'Email Me', highlight: true },
|
||||||
]
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
const workerConfig: WorkerConfig = {
|
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
|
// 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
|
// if not specified, notification will be sent immediately
|
||||||
gracePeriod: 5,
|
gracePeriod: 5,
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// You can define multiple maintenances here
|
// You can define multiple maintenances here
|
||||||
|
|
|
||||||
|
|
@ -225,8 +225,13 @@ const Worker = {
|
||||||
currentTimeSecond - currentIncident.start[0] <
|
currentTimeSecond - currentIncident.start[0] <
|
||||||
workerConfig.notification.gracePeriod * 60 + 30)
|
workerConfig.notification.gracePeriod * 60 + 30)
|
||||||
) {
|
) {
|
||||||
if (currentIncident.start[0] !== currentTimeSecond && workerConfig.notification?.skipErrorChangeNotification) {
|
if (
|
||||||
console.log('Skipping notification for following error reason change due to user config')
|
currentIncident.start[0] !== currentTimeSecond &&
|
||||||
|
workerConfig.notification?.skipErrorChangeNotification
|
||||||
|
) {
|
||||||
|
console.log(
|
||||||
|
'Skipping notification for following error reason change due to user config'
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
await formatAndNotify(
|
await formatAndNotify(
|
||||||
monitor,
|
monitor,
|
||||||
|
|
|
||||||
|
|
@ -280,9 +280,14 @@ export async function getStatus(
|
||||||
} else {
|
} else {
|
||||||
// HTTP endpoint monitor
|
// HTTP endpoint monitor
|
||||||
try {
|
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, {
|
const response = await fetchTimeout(monitor.target, monitor.timeout || 10000, {
|
||||||
method: monitor.method,
|
method: monitor.method,
|
||||||
headers: monitor.headers as any,
|
headers: headers,
|
||||||
body: monitor.body,
|
body: monitor.body,
|
||||||
cf: {
|
cf: {
|
||||||
cacheTtlByStatus: {
|
cacheTtlByStatus: {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue