mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-09-13 23:17:00 +08:00
Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
aec80b53d5 | ||
|
06852bbf0d | ||
|
056d957c1e | ||
|
e12225e595 | ||
|
1b6c587cc9 | ||
|
4a1db336df | ||
|
9e9c5cd1d2 | ||
|
1e689d99b4 | ||
|
14fffcf06b | ||
|
f32441e2f6 |
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "uptime-kuma",
|
"name": "uptime-kuma",
|
||||||
"version": "1.19.0",
|
"version": "1.19.2",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
"build-docker-nightly-amd64": "docker buildx build -f docker/dockerfile --platform linux/amd64 -t louislam/uptime-kuma:nightly-amd64 --target nightly . --push --progress plain",
|
"build-docker-nightly-amd64": "docker buildx build -f docker/dockerfile --platform linux/amd64 -t louislam/uptime-kuma:nightly-amd64 --target nightly . --push --progress plain",
|
||||||
"build-docker-pr-test": "docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64 -t louislam/uptime-kuma:pr-test --target pr-test . --push",
|
"build-docker-pr-test": "docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64 -t louislam/uptime-kuma:pr-test --target pr-test . --push",
|
||||||
"upload-artifacts": "docker buildx build -f docker/dockerfile --platform linux/amd64 -t louislam/uptime-kuma:upload-artifact --build-arg VERSION --build-arg GITHUB_TOKEN --target upload-artifact . --progress plain",
|
"upload-artifacts": "docker buildx build -f docker/dockerfile --platform linux/amd64 -t louislam/uptime-kuma:upload-artifact --build-arg VERSION --build-arg GITHUB_TOKEN --target upload-artifact . --progress plain",
|
||||||
"setup": "git checkout 1.19.0 && npm ci --production && npm run download-dist",
|
"setup": "git checkout 1.19.2 && npm ci --production && npm run download-dist",
|
||||||
"download-dist": "node extra/download-dist.js",
|
"download-dist": "node extra/download-dist.js",
|
||||||
"mark-as-nightly": "node extra/mark-as-nightly.js",
|
"mark-as-nightly": "node extra/mark-as-nightly.js",
|
||||||
"reset-password": "node extra/reset-password.js",
|
"reset-password": "node extra/reset-password.js",
|
||||||
|
@@ -275,9 +275,6 @@ class Monitor extends BeanModel {
|
|||||||
...(this.body ? { data: JSON.parse(this.body) } : {}),
|
...(this.body ? { data: JSON.parse(this.body) } : {}),
|
||||||
timeout: this.interval * 1000 * 0.8,
|
timeout: this.interval * 1000 * 0.8,
|
||||||
headers: {
|
headers: {
|
||||||
// Fix #2253
|
|
||||||
// Read more: https://stackoverflow.com/questions/1759956/curl-error-18-transfer-closed-with-outstanding-read-data-remaining
|
|
||||||
"Accept-Encoding": "gzip, deflate",
|
|
||||||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
|
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
|
||||||
"User-Agent": "Uptime-Kuma/" + version,
|
"User-Agent": "Uptime-Kuma/" + version,
|
||||||
...(this.headers ? JSON.parse(this.headers) : {}),
|
...(this.headers ? JSON.parse(this.headers) : {}),
|
||||||
@@ -310,20 +307,8 @@ class Monitor extends BeanModel {
|
|||||||
log.debug("monitor", `[${this.name}] Axios Options: ${JSON.stringify(options)}`);
|
log.debug("monitor", `[${this.name}] Axios Options: ${JSON.stringify(options)}`);
|
||||||
log.debug("monitor", `[${this.name}] Axios Request`);
|
log.debug("monitor", `[${this.name}] Axios Request`);
|
||||||
|
|
||||||
let res;
|
// Make Request
|
||||||
if (this.auth_method === "ntlm") {
|
let res = await this.makeAxiosRequest(options);
|
||||||
options.httpsAgent.keepAlive = true;
|
|
||||||
|
|
||||||
res = await httpNtlm(options, {
|
|
||||||
username: this.basic_auth_user,
|
|
||||||
password: this.basic_auth_pass,
|
|
||||||
domain: this.authDomain,
|
|
||||||
workstation: this.authWorkstation ? this.authWorkstation : undefined
|
|
||||||
});
|
|
||||||
|
|
||||||
} else {
|
|
||||||
res = await axios.request(options);
|
|
||||||
}
|
|
||||||
|
|
||||||
bean.msg = `${res.status} - ${res.statusText}`;
|
bean.msg = `${res.status} - ${res.statusText}`;
|
||||||
bean.ping = dayjs().valueOf() - startTime;
|
bean.ping = dayjs().valueOf() - startTime;
|
||||||
@@ -761,6 +746,40 @@ class Monitor extends BeanModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async makeAxiosRequest(options, finalCall = false) {
|
||||||
|
try {
|
||||||
|
let res;
|
||||||
|
if (this.auth_method === "ntlm") {
|
||||||
|
options.httpsAgent.keepAlive = true;
|
||||||
|
|
||||||
|
res = await httpNtlm(options, {
|
||||||
|
username: this.basic_auth_user,
|
||||||
|
password: this.basic_auth_pass,
|
||||||
|
domain: this.authDomain,
|
||||||
|
workstation: this.authWorkstation ? this.authWorkstation : undefined
|
||||||
|
});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
res = await axios.request(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
} catch (e) {
|
||||||
|
// Fix #2253
|
||||||
|
// Read more: https://stackoverflow.com/questions/1759956/curl-error-18-transfer-closed-with-outstanding-read-data-remaining
|
||||||
|
if (!finalCall && typeof e.message === "string" && e.message.includes("maxContentLength size of -1 exceeded")) {
|
||||||
|
log.debug("monitor", "makeAxiosRequest with gzip");
|
||||||
|
options.headers["Accept-Encoding"] = "gzip, deflate";
|
||||||
|
return this.makeAxiosRequest(options, true);
|
||||||
|
} else {
|
||||||
|
if (typeof e.message === "string" && e.message.includes("maxContentLength size of -1 exceeded")) {
|
||||||
|
e.message = "response timeout: incomplete response within a interval";
|
||||||
|
}
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Stop monitor */
|
/** Stop monitor */
|
||||||
stop() {
|
stop() {
|
||||||
clearTimeout(this.heartbeatInterval);
|
clearTimeout(this.heartbeatInterval);
|
||||||
@@ -1068,7 +1087,13 @@ class Monitor extends BeanModel {
|
|||||||
|
|
||||||
for (let notification of notificationList) {
|
for (let notification of notificationList) {
|
||||||
try {
|
try {
|
||||||
await Notification.send(JSON.parse(notification.config), msg, await monitor.toJSON(false), bean.toJSON());
|
// Prevent if the msg is undefined, notifications such as Discord cannot send out.
|
||||||
|
const heartbeatJSON = bean.toJSON();
|
||||||
|
if (!heartbeatJSON["msg"]) {
|
||||||
|
heartbeatJSON["msg"] = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
await Notification.send(JSON.parse(notification.config), msg, await monitor.toJSON(false), heartbeatJSON);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log.error("monitor", "Cannot send notification to " + notification.name);
|
log.error("monitor", "Cannot send notification to " + notification.name);
|
||||||
log.error("monitor", e);
|
log.error("monitor", e);
|
||||||
|
@@ -64,7 +64,7 @@ class Discord extends NotificationProvider {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Error",
|
name: "Error",
|
||||||
value: heartbeatJSON["msg"],
|
value: heartbeatJSON["msg"] == null ? "N/A" : heartbeatJSON["msg"],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}],
|
}],
|
||||||
|
@@ -186,7 +186,7 @@ export default {
|
|||||||
startOrEndWithOnly: "Commence uniquement par {0}",
|
startOrEndWithOnly: "Commence uniquement par {0}",
|
||||||
"No consecutive dashes": "Pas de double tirets",
|
"No consecutive dashes": "Pas de double tirets",
|
||||||
Next: "Continuer",
|
Next: "Continuer",
|
||||||
"Setup Proxy": "Configuer Proxy",
|
"Setup Proxy": "Configurer Proxy",
|
||||||
defaultNotificationName: "Ma notification {notification} numéro ({number})",
|
defaultNotificationName: "Ma notification {notification} numéro ({number})",
|
||||||
here: "ici",
|
here: "ici",
|
||||||
Required: "Requis",
|
Required: "Requis",
|
||||||
|
@@ -590,7 +590,7 @@ export default {
|
|||||||
for (let monitorID in this.lastHeartbeatList) {
|
for (let monitorID in this.lastHeartbeatList) {
|
||||||
let lastHeartBeat = this.lastHeartbeatList[monitorID];
|
let lastHeartBeat = this.lastHeartbeatList[monitorID];
|
||||||
|
|
||||||
if (this.monitorList[monitorID].maintenance) {
|
if (this.monitorList[monitorID] && this.monitorList[monitorID].maintenance) {
|
||||||
result[monitorID] = {
|
result[monitorID] = {
|
||||||
text: this.$t("statusMaintenance"),
|
text: this.$t("statusMaintenance"),
|
||||||
color: "maintenance",
|
color: "maintenance",
|
||||||
|
@@ -106,7 +106,13 @@ class Logger {
|
|||||||
}
|
}
|
||||||
module = module.toUpperCase();
|
module = module.toUpperCase();
|
||||||
level = level.toUpperCase();
|
level = level.toUpperCase();
|
||||||
const now = dayjs.tz(new Date()).format();
|
let now;
|
||||||
|
if (dayjs.tz) {
|
||||||
|
now = dayjs.tz(new Date()).format();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
now = dayjs().format();
|
||||||
|
}
|
||||||
const formattedMessage = (typeof msg === "string") ? `${now} [${module}] ${level}: ${msg}` : msg;
|
const formattedMessage = (typeof msg === "string") ? `${now} [${module}] ${level}: ${msg}` : msg;
|
||||||
if (level === "INFO") {
|
if (level === "INFO") {
|
||||||
console.info(formattedMessage);
|
console.info(formattedMessage);
|
||||||
|
@@ -122,7 +122,12 @@ class Logger {
|
|||||||
module = module.toUpperCase();
|
module = module.toUpperCase();
|
||||||
level = level.toUpperCase();
|
level = level.toUpperCase();
|
||||||
|
|
||||||
const now = dayjs.tz(new Date()).format();
|
let now;
|
||||||
|
if (dayjs.tz) {
|
||||||
|
now = dayjs.tz(new Date()).format();
|
||||||
|
} else {
|
||||||
|
now = dayjs().format();
|
||||||
|
}
|
||||||
const formattedMessage = (typeof msg === "string") ? `${now} [${module}] ${level}: ${msg}` : msg;
|
const formattedMessage = (typeof msg === "string") ? `${now} [${module}] ${level}: ${msg}` : msg;
|
||||||
|
|
||||||
if (level === "INFO") {
|
if (level === "INFO") {
|
||||||
|
Reference in New Issue
Block a user