diff --git a/db/knex_migrations/2025-10-15-0001-add-monitor-response-config.js b/db/knex_migrations/2025-10-15-0001-add-monitor-response-config.js index d1f4ccf09..390139795 100644 --- a/db/knex_migrations/2025-10-15-0001-add-monitor-response-config.js +++ b/db/knex_migrations/2025-10-15-0001-add-monitor-response-config.js @@ -2,7 +2,7 @@ exports.up = function (knex) { return knex.schema.alterTable("monitor", function (table) { table.boolean("save_response").notNullable().defaultTo(false); table.boolean("save_error_response").notNullable().defaultTo(true); - table.integer("response_max_length").notNullable().defaultTo(10240); // Default 10KB + table.integer("response_max_length").notNullable().defaultTo(1024); // Default 1KB }); }; diff --git a/server/model/heartbeat.js b/server/model/heartbeat.js index 19dbd4a6a..3b2c75a25 100644 --- a/server/model/heartbeat.js +++ b/server/model/heartbeat.js @@ -1,7 +1,7 @@ const { BeanModel } = require("redbean-node/dist/bean-model"); const zlib = require("node:zlib"); const { promisify } = require("node:util"); -const gunzip = promisify(zlib.gunzip); +const brotliDecompress = promisify(zlib.brotliDecompress); /** * status: @@ -73,8 +73,8 @@ class Heartbeat extends BeanModel { } try { - // Offload gzip decode from main event loop to libuv thread pool - return (await gunzip(Buffer.from(response, "base64"))).toString("utf8"); + // Offload brotli decode from main event loop to libuv thread pool + return (await brotliDecompress(Buffer.from(response, "base64"))).toString("utf8"); } catch (error) { return response; } diff --git a/server/model/monitor.js b/server/model/monitor.js index 50fdb2a2e..01d655f23 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -60,7 +60,7 @@ const https = require("https"); const http = require("http"); const zlib = require("node:zlib"); const { promisify } = require("node:util"); -const gzip = promisify(zlib.gzip); +const brotliCompress = promisify(zlib.brotliCompress); const DomainExpiry = require("./domain_expiry"); const rootCertificates = rootCertificatesFingerprints(); @@ -1174,8 +1174,8 @@ class Monitor extends BeanModel { responseData = responseData.substring(0, maxSize) + "... (truncated)"; } - // Offload gzip compression from main event loop to libuv thread pool - bean.response = (await gzip(Buffer.from(responseData, "utf8"))).toString("base64"); + // Offload brotli compression from main event loop to libuv thread pool + bean.response = (await brotliCompress(Buffer.from(responseData, "utf8"))).toString("base64"); } /** diff --git a/server/notification-providers/slack.js b/server/notification-providers/slack.js index 2321fdd6e..bb5a834e0 100644 --- a/server/notification-providers/slack.js +++ b/server/notification-providers/slack.js @@ -90,6 +90,20 @@ class Slack extends NotificationProvider { }, }); + // Optional context line for monitor group path (excluding monitor name) + const groupPath = monitorJSON?.path?.length > 1 ? monitorJSON.path.slice(0, -1).join(" / ") : ""; + if (groupPath) { + blocks.push({ + type: "context", + elements: [ + { + type: "mrkdwn", + text: `_${groupPath}_`, + }, + ], + }); + } + // the body block, containing the details blocks.push({ type: "section", @@ -142,7 +156,7 @@ class Slack extends NotificationProvider { const baseURL = await setting("primaryBaseURL"); - const title = "Uptime Kuma Alert"; + const title = monitorJSON?.name || "Uptime Kuma Alert"; let data = { text: msg, channel: notification.slackchannel, diff --git a/src/lang/en.json b/src/lang/en.json index e68cc6be9..342e8267e 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -104,7 +104,7 @@ "saveErrorResponseForNotifications": "Save HTTP Error Response for Notifications", "saveResponseDescription": "Stores the HTTP response and makes it available to notification templates as {templateVariable}", "responseMaxLength": "Response Max Length (bytes)", - "responseMaxLengthDescription": "Maximum size of response data to store. Set to 0 for unlimited. Larger responses will be truncated. Default: 10240 (10KB)", + "responseMaxLengthDescription": "Maximum size of response data to store. Set to 0 for unlimited. Larger responses will be truncated. Default: 1024 (1KB)", "Accepted Status Codes": "Accepted Status Codes", "Push URL": "Push URL", "needPushEvery": "You should call this URL every {0} seconds.", diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue index b3d09d1b4..ec0676514 100644 --- a/src/pages/EditMonitor.vue +++ b/src/pages/EditMonitor.vue @@ -2269,7 +2269,7 @@ const monitorDefaults = { accepted_statuscodes: ["200-299"], saveResponse: false, saveErrorResponse: true, - responseMaxLength: 10240, + responseMaxLength: 1024, dns_resolve_type: "A", dns_resolve_server: "1.1.1.1", docker_container: "", diff --git a/src/util.js b/src/util.js index 373ffdc71..df90a740c 100644 --- a/src/util.js +++ b/src/util.js @@ -43,7 +43,7 @@ exports.PING_COUNT_DEFAULT = 1; exports.PING_PER_REQUEST_TIMEOUT_MIN = 1; exports.PING_PER_REQUEST_TIMEOUT_MAX = 60; exports.PING_PER_REQUEST_TIMEOUT_DEFAULT = 2; -exports.RESPONSE_BODY_LENGTH_DEFAULT = 1024 * 10; +exports.RESPONSE_BODY_LENGTH_DEFAULT = 1024; exports.RESPONSE_BODY_LENGTH_MAX = 1024 * 1024; exports.CONSOLE_STYLE_Reset = "\x1b[0m"; exports.CONSOLE_STYLE_Bright = "\x1b[1m"; diff --git a/src/util.ts b/src/util.ts index 1cd86f6e9..c68017341 100644 --- a/src/util.ts +++ b/src/util.ts @@ -70,7 +70,7 @@ export const PING_PER_REQUEST_TIMEOUT_DEFAULT = 2; * Response body length cutoff used by default (10kb) * (measured in bytes) */ -export const RESPONSE_BODY_LENGTH_DEFAULT = 1024 * 10; +export const RESPONSE_BODY_LENGTH_DEFAULT = 1024; /** * Maximum allowed response body length to store (1mb) * (measured in bytes)