From 446b5fa9e45237924199363059e6ce20792835d5 Mon Sep 17 00:00:00 2001
From: Nelson Chan
Date: Sat, 1 Apr 2023 23:54:27 +0800
Subject: [PATCH 1/2] UI: Support more monitor types in URL field
---
src/pages/Details.vue | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/src/pages/Details.vue b/src/pages/Details.vue
index dd7df977..cf65ea17 100644
--- a/src/pages/Details.vue
+++ b/src/pages/Details.vue
@@ -18,6 +18,21 @@
{{ $t("Last Result") }}: {{ monitor.dns_last_result }}
+ Docker container: {{ monitor.docker_container }}
+ Gamedig - {{ monitor.game }}: {{ monitor.hostname }}:{{ monitor.port }}
+ gRPC - {{ monitor.grpcUrl }}
+
+ {{ $t("Keyword") }}: {{ monitor.keyword }}
+
+ {{ monitor.databaseConnectionString }}
+ MQTT: {{ monitor.hostname }}:{{ monitor.port }}/{{ monitor.mqttTopic }}
+ {{ monitor.databaseConnectionString }}
+ {{ monitor.databaseConnectionString }}
+ Push: {{ pushURL }}
+ Radius: {{ monitor.hostname }}
+ {{ monitor.databaseConnectionString }}
+ SQL Server: {{ monitor.databaseConnectionString }}
+ Steam Game Server: {{ monitor.hostname }}:{{ monitor.port }}
@@ -290,6 +305,10 @@ export default {
const endIndex = startIndex + this.perPage;
return this.heartBeatList.slice(startIndex, endIndex);
},
+
+ pushURL() {
+ return this.$root.baseURL + "/api/push/" + this.monitor.pushToken + "?status=up&msg=OK&ping=";
+ },
},
mounted() {
From 83a59bd984d5eabadaa90b884b7b48a0a00a5352 Mon Sep 17 00:00:00 2001
From: Nelson Chan
Date: Wed, 19 Apr 2023 03:20:35 +0800
Subject: [PATCH 2/2] Fix: Add password filtering
---
package-lock.json | 88 +++++++++++++++++++++++++++++++++++--------
package.json | 3 +-
src/pages/Details.vue | 31 +++++++++++----
3 files changed, 98 insertions(+), 24 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 8614de0b..71f8196f 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -64,7 +64,8 @@
"socks-proxy-agent": "6.1.1",
"tar": "~6.1.11",
"tcp-ping": "~0.1.1",
- "thirty-two": "~1.0.2"
+ "thirty-two": "~1.0.2",
+ "whatwg-url": "^12.0.1"
},
"devDependencies": {
"@actions/github": "~5.0.1",
@@ -7522,6 +7523,32 @@
"node": ">=10"
}
},
+ "node_modules/data-urls/node_modules/tr46": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/tr46/-/tr46-2.1.0.tgz",
+ "integrity": "sha512-15Ih7phfcdP5YxqiB+iDtLoaTz4Nd35+IiAv0kQ5FNKHzXgdWqPoTIqEDDJmXceQt4JZk6lVPT8lnDlPpGDppw==",
+ "dev": true,
+ "dependencies": {
+ "punycode": "^2.1.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/data-urls/node_modules/whatwg-url": {
+ "version": "8.7.0",
+ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-8.7.0.tgz",
+ "integrity": "sha512-gAojqb/m9Q8a5IV96E3fHJM70AzCkgt4uXYX2O7EmuyOnLrViCQlsEBmF9UQIu3/aeAIp2U17rtbpZWNntQqdg==",
+ "dev": true,
+ "dependencies": {
+ "lodash": "^4.7.0",
+ "tr46": "^2.1.0",
+ "webidl-conversions": "^6.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
"node_modules/date-fns": {
"version": "2.30.0",
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz",
@@ -13040,6 +13067,18 @@
"node": ">=6"
}
},
+ "node_modules/jsdom/node_modules/tr46": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/tr46/-/tr46-2.1.0.tgz",
+ "integrity": "sha512-15Ih7phfcdP5YxqiB+iDtLoaTz4Nd35+IiAv0kQ5FNKHzXgdWqPoTIqEDDJmXceQt4JZk6lVPT8lnDlPpGDppw==",
+ "dev": true,
+ "dependencies": {
+ "punycode": "^2.1.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/jsdom/node_modules/universalify": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz",
@@ -13049,6 +13088,20 @@
"node": ">= 4.0.0"
}
},
+ "node_modules/jsdom/node_modules/whatwg-url": {
+ "version": "8.7.0",
+ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-8.7.0.tgz",
+ "integrity": "sha512-gAojqb/m9Q8a5IV96E3fHJM70AzCkgt4uXYX2O7EmuyOnLrViCQlsEBmF9UQIu3/aeAIp2U17rtbpZWNntQqdg==",
+ "dev": true,
+ "dependencies": {
+ "lodash": "^4.7.0",
+ "tr46": "^2.1.0",
+ "webidl-conversions": "^6.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
"node_modules/jsesc": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.0.2.tgz",
@@ -17681,15 +17734,14 @@
}
},
"node_modules/tr46": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/tr46/-/tr46-2.1.0.tgz",
- "integrity": "sha512-15Ih7phfcdP5YxqiB+iDtLoaTz4Nd35+IiAv0kQ5FNKHzXgdWqPoTIqEDDJmXceQt4JZk6lVPT8lnDlPpGDppw==",
- "dev": true,
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/tr46/-/tr46-4.1.1.tgz",
+ "integrity": "sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==",
"dependencies": {
- "punycode": "^2.1.1"
+ "punycode": "^2.3.0"
},
"engines": {
- "node": ">=8"
+ "node": ">=14"
}
},
"node_modules/tree-kill": {
@@ -18598,17 +18650,23 @@
"dev": true
},
"node_modules/whatwg-url": {
- "version": "8.7.0",
- "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-8.7.0.tgz",
- "integrity": "sha512-gAojqb/m9Q8a5IV96E3fHJM70AzCkgt4uXYX2O7EmuyOnLrViCQlsEBmF9UQIu3/aeAIp2U17rtbpZWNntQqdg==",
- "dev": true,
+ "version": "12.0.1",
+ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-12.0.1.tgz",
+ "integrity": "sha512-Ed/LrqB8EPlGxjS+TrsXcpUond1mhccS3pchLhzSgPCnTimUCKj3IZE75pAs5m6heB2U2TMerKFUXheyHY+VDQ==",
"dependencies": {
- "lodash": "^4.7.0",
- "tr46": "^2.1.0",
- "webidl-conversions": "^6.1.0"
+ "tr46": "^4.1.1",
+ "webidl-conversions": "^7.0.0"
},
"engines": {
- "node": ">=10"
+ "node": ">=14"
+ }
+ },
+ "node_modules/whatwg-url/node_modules/webidl-conversions": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
+ "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==",
+ "engines": {
+ "node": ">=12"
}
},
"node_modules/which": {
diff --git a/package.json b/package.json
index ed777868..98bbfb8b 100644
--- a/package.json
+++ b/package.json
@@ -123,7 +123,8 @@
"socks-proxy-agent": "6.1.1",
"tar": "~6.1.11",
"tcp-ping": "~0.1.1",
- "thirty-two": "~1.0.2"
+ "thirty-two": "~1.0.2",
+ "whatwg-url": "^12.0.1"
},
"devDependencies": {
"@actions/github": "~5.0.1",
diff --git a/src/pages/Details.vue b/src/pages/Details.vue
index cf65ea17..f361e69e 100644
--- a/src/pages/Details.vue
+++ b/src/pages/Details.vue
@@ -7,7 +7,7 @@
- {{ monitor.url }}
+ {{ filterPassword(monitor.url) }}
TCP Port {{ monitor.hostname }}:{{ monitor.port }}
Ping: {{ monitor.hostname }}
@@ -20,18 +20,18 @@
Docker container: {{ monitor.docker_container }}
Gamedig - {{ monitor.game }}: {{ monitor.hostname }}:{{ monitor.port }}
- gRPC - {{ monitor.grpcUrl }}
+ gRPC - {{ filterPassword(monitor.grpcUrl) }}
{{ $t("Keyword") }}: {{ monitor.keyword }}
- {{ monitor.databaseConnectionString }}
+ {{ filterPassword(monitor.databaseConnectionString) }}
MQTT: {{ monitor.hostname }}:{{ monitor.port }}/{{ monitor.mqttTopic }}
- {{ monitor.databaseConnectionString }}
- {{ monitor.databaseConnectionString }}
+ {{ filterPassword(monitor.databaseConnectionString) }}
+ {{ filterPassword(monitor.databaseConnectionString) }}
Push: {{ pushURL }}
- Radius: {{ monitor.hostname }}
- {{ monitor.databaseConnectionString }}
- SQL Server: {{ monitor.databaseConnectionString }}
+ Radius: {{ filterPassword(monitor.hostname) }}
+ {{ filterPassword(monitor.databaseConnectionString) }}
+ SQL Server: {{ filterPassword(monitor.databaseConnectionString) }}
Steam Game Server: {{ monitor.hostname }}:{{ monitor.port }}
@@ -208,6 +208,7 @@ import Pagination from "v-pagination-3";
const PingChart = defineAsyncComponent(() => import("../components/PingChart.vue"));
import Tag from "../components/Tag.vue";
import CertificateInfo from "../components/CertificateInfo.vue";
+import { URL } from "whatwg-url";
export default {
components: {
@@ -401,6 +402,20 @@ export default {
return this.$t(translationPrefix + "Ping");
},
+
+ /** Filter and hide password in URL for display */
+ filterPassword(urlString) {
+ try {
+ let parsedUrl = new URL(urlString);
+ if (parsedUrl.password !== "") {
+ parsedUrl.password = "******";
+ }
+ return parsedUrl.toString();
+ } catch (e) {
+ // Handle SQL Server
+ return urlString.replaceAll(/Password=(.+);/ig, "Password=******;");
+ }
+ }
},
};