From cd211a6be7c5d4eb0f90055f6ad164b7467de40b Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Fri, 15 Oct 2021 18:36:40 +0800 Subject: [PATCH] [http options] fine tune --- server/model/monitor.js | 4 ++ server/util-server.js | 2 +- src/languages/en.js | 2 - src/pages/EditMonitor.vue | 90 +++++++++++++++++++++------------------ 4 files changed, 53 insertions(+), 45 deletions(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index 85c07cb71..6ec97372c 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -180,6 +180,10 @@ class Monitor extends BeanModel { debug("Cert Info Query Time: " + (dayjs().valueOf() - certInfoStartTime) + "ms"); } + if (process.env.UPTIME_KUMA_LOG_RESPONSE_BODY_MONITOR_ID == this.id) { + console.log(res.data); + } + if (this.type === "http") { bean.status = UP; } else { diff --git a/server/util-server.js b/server/util-server.js index a65af74a4..7fd613ceb 100644 --- a/server/util-server.js +++ b/server/util-server.js @@ -327,7 +327,7 @@ exports.startUnitTest = async () => { */ exports.convertToUTF8 = (body) => { const guessEncoding = chardet.detect(body); - debug("Guess Encoding: " + guessEncoding); + //debug("Guess Encoding: " + guessEncoding); const str = iconv.decode(body, guessEncoding); return str.toString(); }; diff --git a/src/languages/en.js b/src/languages/en.js index fac34a370..aef14c81e 100644 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -288,6 +288,4 @@ export default { PushUrl: "Push URL", HeadersInvalidFormat: "The request headers are not valid JSON: ", BodyInvalidFormat: "The request body is not valid JSON: ", - BodyPlaceholder: "{\n\t\"id\": 124357,\n\t\"username\": \"admin\",\n\t\"password\": \"myAdminPassword\"\n}", - HeadersPlaceholder: "{\n\t\"Authorization\": \"Bearer abc123\",\n\t\"Content-Type\": \"application/json\"\n}", }; diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue index 374c14e76..f88614415 100644 --- a/src/pages/EditMonitor.vue +++ b/src/pages/EditMonitor.vue @@ -44,46 +44,6 @@ - -
- - -
- - -
- - -
- - -
- - -
-
@@ -235,6 +195,7 @@
+

{{ $t("Notifications") }}

{{ $t("Not available, please setup.") }} @@ -254,6 +215,51 @@ + + +

@@ -328,11 +334,11 @@ export default { }, bodyPlaceholder() { - return this.decodeHtml(this.$t("BodyPlaceholder")); + return this.decodeHtml("{\n\t\"id\": 124357,\n\t\"username\": \"admin\",\n\t\"password\": \"myAdminPassword\"\n}"); }, headersPlaceholder() { - return this.decodeHtml(this.$t("HeadersPlaceholder")); + return this.decodeHtml("{\n\t\"Authorization\": \"Bearer abc123\",\n\t\"Content-Type\": \"application/json\"\n}"); } },