mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-03 12:06:04 -04:00
Set default ua for axios: Uptime-Kuma/version
instead of axios/version
This commit is contained in:
parent
e11aad2d60
commit
bbaba29222
3 changed files with 8 additions and 4 deletions
|
@ -12,6 +12,7 @@ const { Settings } = require("./settings");
|
|||
const dayjs = require("dayjs");
|
||||
const childProcess = require("child_process");
|
||||
const path = require("path");
|
||||
const axios = require("axios");
|
||||
// DO NOT IMPORT HERE IF THE MODULES USED `UptimeKumaServer.getInstance()`, put at the bottom of this file instead.
|
||||
|
||||
/**
|
||||
|
@ -83,6 +84,9 @@ class UptimeKumaServer {
|
|||
const sslCert = args["ssl-cert"] || process.env.UPTIME_KUMA_SSL_CERT || process.env.SSL_CERT || undefined;
|
||||
const sslKeyPassphrase = args["ssl-key-passphrase"] || process.env.UPTIME_KUMA_SSL_KEY_PASSPHRASE || process.env.SSL_KEY_PASSPHRASE || undefined;
|
||||
|
||||
// Set axios default user-agent to Uptime-Kuma/version
|
||||
axios.defaults.headers.common["User-Agent"] = this.getUserAgent();
|
||||
|
||||
log.debug("server", "Creating express and socket.io instance");
|
||||
this.app = express();
|
||||
if (sslKey && sslCert) {
|
||||
|
@ -411,6 +415,10 @@ class UptimeKumaServer {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
getUserAgent() {
|
||||
return "Uptime-Kuma/" + require("../package.json").version
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue