mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-02 19:46:26 -04:00
Merge remote-tracking branch 'origin/master' into postgres
# Conflicts: # package-lock.json # package.json
This commit is contained in:
commit
88afd662db
68 changed files with 5361 additions and 8709 deletions
|
@ -16,12 +16,7 @@ const { demoMode } = require("../config");
|
|||
const version = require("../../package.json").version;
|
||||
const apicache = require("../modules/apicache");
|
||||
const { UptimeKumaServer } = require("../uptime-kuma-server");
|
||||
|
||||
const axiosCachedDnsResolve = require("esm-wallaby")(module)("axios-cached-dns-resolve");
|
||||
|
||||
// create an axios client instance with the cached DNS resolve interceptor
|
||||
const axiosClient = axios.create();
|
||||
axiosCachedDnsResolve.registerInterceptor(axiosClient);
|
||||
const { CacheableDnsHttpAgent } = require("../cacheable-dns-http-agent");
|
||||
|
||||
/**
|
||||
* status:
|
||||
|
@ -40,7 +35,13 @@ class Monitor extends BeanModel {
|
|||
let obj = {
|
||||
id: this.id,
|
||||
name: this.name,
|
||||
sendUrl: this.sendUrl,
|
||||
};
|
||||
|
||||
if (this.sendUrl) {
|
||||
obj.url = this.url;
|
||||
}
|
||||
|
||||
if (showTags) {
|
||||
obj.tags = await this.getTags();
|
||||
}
|
||||
|
@ -287,7 +288,7 @@ class Monitor extends BeanModel {
|
|||
});
|
||||
|
||||
} else {
|
||||
res = await axiosClient.request(options);
|
||||
res = await axios.request(options);
|
||||
}
|
||||
|
||||
bean.msg = `${res.status} - ${res.statusText}`;
|
||||
|
@ -434,16 +435,19 @@ class Monitor extends BeanModel {
|
|||
throw new Error("Steam API Key not found");
|
||||
}
|
||||
|
||||
let res = await axiosClient.get(steamApiUrl, {
|
||||
let res = await axios.get(steamApiUrl, {
|
||||
timeout: this.interval * 1000 * 0.8,
|
||||
headers: {
|
||||
"Accept": "*/*",
|
||||
"User-Agent": "Uptime-Kuma/" + version,
|
||||
},
|
||||
httpsAgent: new https.Agent({
|
||||
httpsAgent: CacheableDnsHttpAgent.getHttpsAgent({
|
||||
maxCachedSessions: 0, // Use Custom agent to disable session reuse (https://github.com/nodejs/node/issues/3940)
|
||||
rejectUnauthorized: !this.getIgnoreTls(),
|
||||
}),
|
||||
httpAgent: CacheableDnsHttpAgent.getHttpAgent({
|
||||
maxCachedSessions: 0,
|
||||
}),
|
||||
maxRedirects: this.maxredirects,
|
||||
validateStatus: (status) => {
|
||||
return checkStatusCode(status, this.getAcceptedStatuscodes());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue