From 6b47ad07ca673815463d056e64f1d1912a20a2fa Mon Sep 17 00:00:00 2001
From: Matthew Nickson <mnickson@sidingsmedia.com>
Date: Wed, 12 Oct 2022 22:03:05 +0100
Subject: [PATCH 01/14] [empty commit] pull request for #2126 remove hardcoded
 ping


From f3660a0cece42f1d76f23dfed082a96297d5c096 Mon Sep 17 00:00:00 2001
From: Joppe Koers <joppe@joppekoers.nl>
Date: Tue, 6 Dec 2022 18:43:28 +0100
Subject: [PATCH 02/14] Fix spelling in README

---
 README.md | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/README.md b/README.md
index 55a6ec50..90c8ad75 100644
--- a/README.md
+++ b/README.md
@@ -22,17 +22,17 @@ It is a temporary live demo, all data will be deleted after 10 minutes. Use the
 
 ## ⭐ Features
 
-* Monitoring uptime for HTTP(s) / TCP / HTTP(s) Keyword / Ping / DNS Record / Push / Steam Game Server / Docker Containers.
-* Fancy, Reactive, Fast UI/UX.
-* Notifications via Telegram, Discord, Gotify, Slack, Pushover, Email (SMTP), and [90+ notification services, click here for the full list](https://github.com/louislam/uptime-kuma/tree/master/src/components/notifications).
-* 20 second intervals.
+* Monitoring uptime for HTTP(s) / TCP / HTTP(s) Keyword / Ping / DNS Record / Push / Steam Game Server / Docker Containers
+* Fancy, Reactive, Fast UI/UX
+* Notifications via Telegram, Discord, Gotify, Slack, Pushover, Email (SMTP), and [90+ notification services, click here for the full list](https://github.com/louislam/uptime-kuma/tree/master/src/components/notifications)
+* 20 second intervals
 * [Multi Languages](https://github.com/louislam/uptime-kuma/tree/master/src/languages)
-* Multiple Status Pages
-* Map Status Page to Domain
-* Ping Chart
-* Certificate Info
-* Proxy Support
-* 2FA available
+* Multiple status pages
+* Map status pages to specific domains
+* Ping chart
+* Certificate info
+* Proxy support
+* 2FA support
 
 ## 🔧 How to Install
 
@@ -44,14 +44,14 @@ docker run -d --restart=always -p 3001:3001 -v uptime-kuma:/app/data --name upti
 
 ⚠️ Please use a **local volume** only. Other types such as NFS are not supported.
 
-Browse to http://localhost:3001 after starting.
+Kuma is now running on http://localhost:3001
 
 ### 💪🏻 Non-Docker
 
 Required Tools: 
 - [Node.js](https://nodejs.org/en/download/) >= 14
 - [Git](https://git-scm.com/downloads) 
-- [pm2](https://pm2.keymetrics.io/) - For run in background
+- [pm2](https://pm2.keymetrics.io/) - For running kuma in the background
 
 ```bash
 # Update your npm to the latest version
@@ -73,7 +73,7 @@ pm2 start server/server.js --name uptime-kuma
 
 
 ```
-Browse to http://localhost:3001 after starting.
+Kuma is now running on http://localhost:3001
 
 More useful PM2 Commands
 

From f8c7da7995528c453335a8f6814e81bdea8e17ac Mon Sep 17 00:00:00 2001
From: Joppe Koers <joppe@joppekoers.nl>
Date: Tue, 6 Dec 2022 18:44:16 +0100
Subject: [PATCH 03/14] Add docker-compose to README

---
 README.md | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/README.md b/README.md
index 90c8ad75..6d10cf2a 100644
--- a/README.md
+++ b/README.md
@@ -42,6 +42,20 @@ It is a temporary live demo, all data will be deleted after 10 minutes. Use the
 docker run -d --restart=always -p 3001:3001 -v uptime-kuma:/app/data --name uptime-kuma louislam/uptime-kuma:1
 ```
 
+### 🐳 Docker Compose
+```yaml
+version: "3"
+
+services:
+  uptime-kuma:
+    image: louislam/uptime-kuma:1
+    restart: always
+    ports:
+      - "3001:3001"
+    volumes:
+      - uptime-kuma:/app/data
+```
+
 ⚠️ Please use a **local volume** only. Other types such as NFS are not supported.
 
 Kuma is now running on http://localhost:3001

From 3ea67110538a60ed0cd316a38e4ec9bf5efa93ae Mon Sep 17 00:00:00 2001
From: Joppe Koers <joppe@joppekoers.nl>
Date: Thu, 15 Dec 2022 23:03:06 +0100
Subject: [PATCH 04/14] Remove docker compose again

---
 README.md | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/README.md b/README.md
index 6d10cf2a..90c8ad75 100644
--- a/README.md
+++ b/README.md
@@ -42,20 +42,6 @@ It is a temporary live demo, all data will be deleted after 10 minutes. Use the
 docker run -d --restart=always -p 3001:3001 -v uptime-kuma:/app/data --name uptime-kuma louislam/uptime-kuma:1
 ```
 
-### 🐳 Docker Compose
-```yaml
-version: "3"
-
-services:
-  uptime-kuma:
-    image: louislam/uptime-kuma:1
-    restart: always
-    ports:
-      - "3001:3001"
-    volumes:
-      - uptime-kuma:/app/data
-```
-
 ⚠️ Please use a **local volume** only. Other types such as NFS are not supported.
 
 Kuma is now running on http://localhost:3001

From 2d3fd738e4691dfc03d06be3cffae9e2f55aa00f Mon Sep 17 00:00:00 2001
From: Joppe Koers <joppe@joppekoers.nl>
Date: Tue, 3 Jan 2023 15:37:32 +0100
Subject: [PATCH 05/14] Fix small spelling mistake

---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 90c8ad75..9b810015 100644
--- a/README.md
+++ b/README.md
@@ -51,7 +51,7 @@ Kuma is now running on http://localhost:3001
 Required Tools: 
 - [Node.js](https://nodejs.org/en/download/) >= 14
 - [Git](https://git-scm.com/downloads) 
-- [pm2](https://pm2.keymetrics.io/) - For running kuma in the background
+- [pm2](https://pm2.keymetrics.io/) - For running Uptime Kuma in the background
 
 ```bash
 # Update your npm to the latest version

From 73835f3328224b498f231ef46f462ac538e22d3d Mon Sep 17 00:00:00 2001
From: Matthew Nickson <mnickson@sidingsmedia.com>
Date: Tue, 3 Jan 2023 20:03:36 +0000
Subject: [PATCH 06/14] Changed  from ping-lite to ping module

Signed-off-by: Matthew Nickson <mnickson@sidingsmedia.com>

#Fixes 2126
---
 package-lock.json     |  50 ++++++++++-
 package.json          |   1 +
 server/ping-lite.js   | 199 ------------------------------------------
 server/util-server.js |  31 +++----
 4 files changed, 62 insertions(+), 219 deletions(-)
 delete mode 100644 server/ping-lite.js

diff --git a/package-lock.json b/package-lock.json
index d8b67781..0e99be12 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
 {
     "name": "uptime-kuma",
-    "version": "1.19.0",
+    "version": "1.19.3",
     "lockfileVersion": 2,
     "requires": true,
     "packages": {
         "": {
             "name": "uptime-kuma",
-            "version": "1.19.0",
+            "version": "1.19.3",
             "license": "MIT",
             "dependencies": {
                 "@grpc/grpc-js": "~1.7.3",
@@ -48,6 +48,7 @@
                 "password-hash": "~1.2.2",
                 "pg": "~8.8.0",
                 "pg-connection-string": "~2.5.0",
+                "ping": "^0.4.2",
                 "prom-client": "~13.2.0",
                 "prometheus-api-metrics": "~3.2.1",
                 "protobufjs": "~7.1.1",
@@ -13241,6 +13242,18 @@
                 "node": ">=0.10.0"
             }
         },
+        "node_modules/ping": {
+            "version": "0.4.2",
+            "resolved": "https://registry.npmjs.org/ping/-/ping-0.4.2.tgz",
+            "integrity": "sha512-1uAw0bzHtrPbPo2s6no06oZAzY6KqKclEJR1JRZKIHKXKlPdrz9N0/1MPPB+BbrvMjN3Mk0pcod3bfLNZFRo9w==",
+            "dependencies": {
+                "q": "1.x",
+                "underscore": "^1.12.0"
+            },
+            "engines": {
+                "node": ">=4.0.0"
+            }
+        },
         "node_modules/pirates": {
             "version": "4.0.5",
             "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.5.tgz",
@@ -13631,6 +13644,15 @@
                 "node": ">=6"
             }
         },
+        "node_modules/q": {
+            "version": "1.5.1",
+            "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz",
+            "integrity": "sha512-kV/CThkXo6xyFEZUugw/+pIOywXcDbFYgSct5cT3gqlbkBE1SJdwy6UQoZvodiWF/ckQLZyDE/Bu1M6gVu5lVw==",
+            "engines": {
+                "node": ">=0.6.0",
+                "teleport": ">=0.2.0"
+            }
+        },
         "node_modules/qlobber": {
             "version": "5.0.3",
             "resolved": "https://registry.npmjs.org/qlobber/-/qlobber-5.0.3.tgz",
@@ -15854,6 +15876,11 @@
                 "url": "https://github.com/sponsors/ljharb"
             }
         },
+        "node_modules/underscore": {
+            "version": "1.13.6",
+            "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.6.tgz",
+            "integrity": "sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A=="
+        },
         "node_modules/unicode-canonical-property-names-ecmascript": {
             "version": "2.0.0",
             "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz",
@@ -26785,6 +26812,15 @@
             "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==",
             "dev": true
         },
+        "ping": {
+            "version": "0.4.2",
+            "resolved": "https://registry.npmjs.org/ping/-/ping-0.4.2.tgz",
+            "integrity": "sha512-1uAw0bzHtrPbPo2s6no06oZAzY6KqKclEJR1JRZKIHKXKlPdrz9N0/1MPPB+BbrvMjN3Mk0pcod3bfLNZFRo9w==",
+            "requires": {
+                "q": "1.x",
+                "underscore": "^1.12.0"
+            }
+        },
         "pirates": {
             "version": "4.0.5",
             "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.5.tgz",
@@ -27068,6 +27104,11 @@
             "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
             "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
         },
+        "q": {
+            "version": "1.5.1",
+            "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz",
+            "integrity": "sha512-kV/CThkXo6xyFEZUugw/+pIOywXcDbFYgSct5cT3gqlbkBE1SJdwy6UQoZvodiWF/ckQLZyDE/Bu1M6gVu5lVw=="
+        },
         "qlobber": {
             "version": "5.0.3",
             "resolved": "https://registry.npmjs.org/qlobber/-/qlobber-5.0.3.tgz",
@@ -28780,6 +28821,11 @@
                 "which-boxed-primitive": "^1.0.2"
             }
         },
+        "underscore": {
+            "version": "1.13.6",
+            "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.6.tgz",
+            "integrity": "sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A=="
+        },
         "unicode-canonical-property-names-ecmascript": {
             "version": "2.0.0",
             "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz",
diff --git a/package.json b/package.json
index c41b1701..f7ed288f 100644
--- a/package.json
+++ b/package.json
@@ -103,6 +103,7 @@
         "password-hash": "~1.2.2",
         "pg": "~8.8.0",
         "pg-connection-string": "~2.5.0",
+        "ping": "^0.4.2",
         "prom-client": "~13.2.0",
         "prometheus-api-metrics": "~3.2.1",
         "protobufjs": "~7.1.1",
diff --git a/server/ping-lite.js b/server/ping-lite.js
deleted file mode 100644
index 05dff31d..00000000
--- a/server/ping-lite.js
+++ /dev/null
@@ -1,199 +0,0 @@
-// https://github.com/ben-bradley/ping-lite/blob/master/ping-lite.js
-// Fixed on Windows
-const net = require("net");
-const spawn = require("child_process").spawn;
-const events = require("events");
-const fs = require("fs");
-const util = require("./util-server");
-
-module.exports = Ping;
-
-/**
- * Constructor for ping class
- * @param {string} host Host to ping
- * @param {object} [options] Options for the ping command
- * @param {array|string} [options.args] - Arguments to pass to the ping command
- */
-function Ping(host, options) {
-    if (!host) {
-        throw new Error("You must specify a host to ping!");
-    }
-
-    this._host = host;
-    this._options = options = (options || {});
-
-    events.EventEmitter.call(this);
-
-    const timeout = 10;
-
-    if (util.WIN) {
-        this._bin = "c:/windows/system32/ping.exe";
-        this._args = (options.args) ? options.args : [ "-n", "1", "-w", timeout * 1000, host ];
-        this._regmatch = /[><=]([0-9.]+?)ms/;
-
-    } else if (util.LIN) {
-        this._bin = "/bin/ping";
-
-        const defaultArgs = [ "-n", "-w", timeout, "-c", "1", host ];
-
-        if (net.isIPv6(host) || options.ipv6) {
-            defaultArgs.unshift("-6");
-        }
-
-        this._args = (options.args) ? options.args : defaultArgs;
-        this._regmatch = /=([0-9.]+?) ms/;
-
-    } else if (util.MAC) {
-
-        if (net.isIPv6(host) || options.ipv6) {
-            this._bin = "/sbin/ping6";
-        } else {
-            this._bin = "/sbin/ping";
-        }
-
-        this._args = (options.args) ? options.args : [ "-n", "-t", timeout, "-c", "1", host ];
-        this._regmatch = /=([0-9.]+?) ms/;
-
-    } else if (util.BSD) {
-        this._bin = "/sbin/ping";
-
-        const defaultArgs = [ "-n", "-t", timeout, "-c", "1", host ];
-
-        if (net.isIPv6(host) || options.ipv6) {
-            defaultArgs.unshift("-6");
-        }
-
-        this._args = (options.args) ? options.args : defaultArgs;
-        this._regmatch = /=([0-9.]+?) ms/;
-
-    } else {
-        throw new Error("Could not detect your ping binary.");
-    }
-
-    if (!fs.existsSync(this._bin)) {
-        throw new Error("Could not detect " + this._bin + " on your system");
-    }
-
-    this._i = 0;
-
-    return this;
-}
-
-Ping.prototype.__proto__ = events.EventEmitter.prototype;
-
-/**
- * Callback for send
- * @callback pingCB
- * @param {any} err Any error encountered
- * @param {number} ms Ping time in ms
- */
-
-/**
- * Send a ping
- * @param {pingCB} callback Callback to call with results
- */
-Ping.prototype.send = function (callback) {
-    let self = this;
-    callback = callback || function (err, ms) {
-        if (err) {
-            return self.emit("error", err);
-        }
-        return self.emit("result", ms);
-    };
-
-    let _ended;
-    let _exited;
-    let _errored;
-
-    this._ping = spawn(this._bin, this._args, { windowsHide: true }); // spawn the binary
-
-    this._ping.on("error", function (err) { // handle binary errors
-        _errored = true;
-        callback(err);
-    });
-
-    this._ping.stdout.on("data", function (data) { // log stdout
-        if (util.WIN) {
-            data = convertOutput(data);
-        }
-        this._stdout = (this._stdout || "") + data;
-    });
-
-    this._ping.stdout.on("end", function () {
-        _ended = true;
-        if (_exited && !_errored) {
-            onEnd.call(self._ping);
-        }
-    });
-
-    this._ping.stderr.on("data", function (data) { // log stderr
-        if (util.WIN) {
-            data = convertOutput(data);
-        }
-        this._stderr = (this._stderr || "") + data;
-    });
-
-    this._ping.on("exit", function (code) { // handle complete
-        _exited = true;
-        if (_ended && !_errored) {
-            onEnd.call(self._ping);
-        }
-    });
-
-    /**
-     * @param {Function} callback
-     *
-     * Generated by Trelent
-     */
-    function onEnd() {
-        let stdout = this.stdout._stdout;
-        let stderr = this.stderr._stderr;
-        let ms;
-
-        if (stderr) {
-            return callback(new Error(stderr));
-        }
-
-        if (!stdout) {
-            return callback(new Error("No stdout detected"));
-        }
-
-        ms = stdout.match(self._regmatch); // parse out the ##ms response
-        ms = (ms && ms[1]) ? Number(ms[1]) : ms;
-
-        callback(null, ms, stdout);
-    }
-};
-
-/**
- * Ping every interval
- * @param {pingCB} callback Callback to call with results
- */
-Ping.prototype.start = function (callback) {
-    let self = this;
-    this._i = setInterval(function () {
-        self.send(callback);
-    }, (self._options.interval || 5000));
-    self.send(callback);
-};
-
-/** Stop sending pings */
-Ping.prototype.stop = function () {
-    clearInterval(this._i);
-};
-
-/**
- * Try to convert to UTF-8 for Windows, as the ping's output on Windows is not UTF-8 and could be in other languages
- * Thank @pemassi
- * https://github.com/louislam/uptime-kuma/issues/570#issuecomment-941984094
- * @param {any} data
- * @returns {string}
- */
-function convertOutput(data) {
-    if (util.WIN) {
-        if (data) {
-            return util.convertToUTF8(data);
-        }
-    }
-    return data;
-}
diff --git a/server/util-server.js b/server/util-server.js
index ffd171b4..72662136 100644
--- a/server/util-server.js
+++ b/server/util-server.js
@@ -1,5 +1,5 @@
 const tcpp = require("tcp-ping");
-const Ping = require("./ping-lite");
+const ping = require("ping");
 const { R } = require("redbean-node");
 const { log, genSecret } = require("../src/util");
 const passwordHash = require("./password-hash");
@@ -26,13 +26,6 @@ const {
 } = require("node-radius-utils");
 const dayjs = require("dayjs");
 
-// From ping-lite
-exports.WIN = /^win/.test(process.platform);
-exports.LIN = /^linux/.test(process.platform);
-exports.MAC = /^darwin/.test(process.platform);
-exports.FBSD = /^freebsd/.test(process.platform);
-exports.BSD = /bsd$/.test(process.platform);
-
 /**
  * Init or reset JWT secret
  * @returns {Promise<Bean>}
@@ -105,18 +98,20 @@ exports.ping = async (hostname) => {
  */
 exports.pingAsync = function (hostname, ipv6 = false) {
     return new Promise((resolve, reject) => {
-        const ping = new Ping(hostname, {
-            ipv6
-        });
-
-        ping.send(function (err, ms, stdout) {
-            if (err) {
-                reject(err);
-            } else if (ms === null) {
-                reject(new Error(stdout));
+        ping.promise.probe(hostname, {
+            v6: ipv6,
+            min_reply: 3
+        }).then((res) => {
+            // If ping failed, it will set field to unknown
+            if (res.host === "unknown") {
+                reject(new Error("Name or service not known"));
+            } else if (res.time === "unknown") {
+                reject(new Error(res.output));
             } else {
-                resolve(Math.round(ms));
+                resolve(res.time);
             }
+        }).catch((err) => {
+            reject(err);
         });
     });
 };

From 69e1880cd30507143cfa4ec704d32eff3da4cb60 Mon Sep 17 00:00:00 2001
From: Matthew Nickson <mnickson@sidingsmedia.com>
Date: Wed, 4 Jan 2023 16:46:36 +0000
Subject: [PATCH 07/14] Added not active condition to prevent false error

Added a check to see if the host is alive. This prevents failiures when
the user specifies a hostname of `unknown`.

Signed-off-by: Matthew Nickson <mnickson@sidingsmedia.com>
---
 server/util-server.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server/util-server.js b/server/util-server.js
index 72662136..3549de80 100644
--- a/server/util-server.js
+++ b/server/util-server.js
@@ -103,7 +103,7 @@ exports.pingAsync = function (hostname, ipv6 = false) {
             min_reply: 3
         }).then((res) => {
             // If ping failed, it will set field to unknown
-            if (res.host === "unknown") {
+            if (!res.alive && res.host === "unknown") {
                 reject(new Error("Name or service not known"));
             } else if (res.time === "unknown") {
                 reject(new Error(res.output));

From 90a26682720a7a3fcc831d4fbce7deb69b5b24f2 Mon Sep 17 00:00:00 2001
From: Matthew Nickson <mnickson@sidingsmedia.com>
Date: Wed, 4 Jan 2023 17:32:27 +0000
Subject: [PATCH 08/14] Restructured condition + ensure data is UTF-8

Signed-off-by: Matthew Nickson <mnickson@sidingsmedia.com>
---
 server/util-server.js | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/server/util-server.js b/server/util-server.js
index 3549de80..3f55b3d7 100644
--- a/server/util-server.js
+++ b/server/util-server.js
@@ -103,12 +103,10 @@ exports.pingAsync = function (hostname, ipv6 = false) {
             min_reply: 3
         }).then((res) => {
             // If ping failed, it will set field to unknown
-            if (!res.alive && res.host === "unknown") {
-                reject(new Error("Name or service not known"));
-            } else if (res.time === "unknown") {
-                reject(new Error(res.output));
-            } else {
+            if (res.alive) {
                 resolve(res.time);
+            } else {
+                reject(new Error(exports.convertToUTF8(res.output)));
             }
         }).catch((err) => {
             reject(err);

From 4239cf4255b52b47c8788eba8ad1b20c61085e1d Mon Sep 17 00:00:00 2001
From: Louis Lam <louislam@users.noreply.github.com>
Date: Thu, 5 Jan 2023 17:11:37 +0800
Subject: [PATCH 09/14] Pin dependency of `ping`

---
 package-lock.json | 2 +-
 package.json      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index 0e99be12..6c09c89a 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -48,7 +48,7 @@
                 "password-hash": "~1.2.2",
                 "pg": "~8.8.0",
                 "pg-connection-string": "~2.5.0",
-                "ping": "^0.4.2",
+                "ping": "~0.4.2",
                 "prom-client": "~13.2.0",
                 "prometheus-api-metrics": "~3.2.1",
                 "protobufjs": "~7.1.1",
diff --git a/package.json b/package.json
index f7ed288f..7d48a929 100644
--- a/package.json
+++ b/package.json
@@ -103,7 +103,7 @@
         "password-hash": "~1.2.2",
         "pg": "~8.8.0",
         "pg-connection-string": "~2.5.0",
-        "ping": "^0.4.2",
+        "ping": "~0.4.2",
         "prom-client": "~13.2.0",
         "prometheus-api-metrics": "~3.2.1",
         "protobufjs": "~7.1.1",

From 494c53971c449a125bbd1f2cbfbad25b5035b024 Mon Sep 17 00:00:00 2001
From: Louis Lam <louislam@users.noreply.github.com>
Date: Thu, 5 Jan 2023 19:22:15 +0800
Subject: [PATCH 10/14] Convert to UTF8 on Windows only

---
 server/util-server.js | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/server/util-server.js b/server/util-server.js
index 3f55b3d7..99c9c932 100644
--- a/server/util-server.js
+++ b/server/util-server.js
@@ -26,6 +26,8 @@ const {
 } = require("node-radius-utils");
 const dayjs = require("dayjs");
 
+const isWindows = process.platform === /^win/.test(process.platform);
+
 /**
  * Init or reset JWT secret
  * @returns {Promise<Bean>}
@@ -106,7 +108,11 @@ exports.pingAsync = function (hostname, ipv6 = false) {
             if (res.alive) {
                 resolve(res.time);
             } else {
-                reject(new Error(exports.convertToUTF8(res.output)));
+                if (isWindows) {
+                    reject(new Error(exports.convertToUTF8(res.output)));
+                } else {
+                    reject(new Error(res.output));
+                }
             }
         }).catch((err) => {
             reject(err);

From 7d9235156872c290c309bc3c07cc8ee21df455fc Mon Sep 17 00:00:00 2001
From: Louis Lam <louislam@users.noreply.github.com>
Date: Thu, 5 Jan 2023 19:30:55 +0800
Subject: [PATCH 11/14] Match previous settings

---
 server/util-server.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/server/util-server.js b/server/util-server.js
index 99c9c932..6b9ed339 100644
--- a/server/util-server.js
+++ b/server/util-server.js
@@ -102,7 +102,8 @@ exports.pingAsync = function (hostname, ipv6 = false) {
     return new Promise((resolve, reject) => {
         ping.promise.probe(hostname, {
             v6: ipv6,
-            min_reply: 3
+            min_reply: 1,
+            timeout: 10000,
         }).then((res) => {
             // If ping failed, it will set field to unknown
             if (res.alive) {

From 4c5e2ea237fa485cfbcdee8d49a9d47a29bb500b Mon Sep 17 00:00:00 2001
From: Louis Lam <louislam@users.noreply.github.com>
Date: Thu, 5 Jan 2023 20:03:28 +0800
Subject: [PATCH 12/14] Update CONTRIBUTING.md

---
 CONTRIBUTING.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 12fd6ed4..a1a4a982 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -48,6 +48,7 @@ Here are some references:
 - UI/UX is not close to Uptime Kuma 
 - Existing logic is completely modified or deleted for no reason
 - A function that is completely out of scope
+- Convert existing code into other programming languages
 - Unnecessary large code changes (Hard to review, causes code conflicts to other pull requests)
 
 I will mark your pull request in the [milestones](https://github.com/louislam/uptime-kuma/milestones), if I am plan to review and merge it.

From 0b959514f880f8e9dc6953375961d05a86b8fe36 Mon Sep 17 00:00:00 2001
From: Louis Lam <louislam@users.noreply.github.com>
Date: Thu, 5 Jan 2023 20:38:37 +0800
Subject: [PATCH 13/14] Fix timeout

---
 server/util-server.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server/util-server.js b/server/util-server.js
index 6b9ed339..4a30017a 100644
--- a/server/util-server.js
+++ b/server/util-server.js
@@ -103,7 +103,7 @@ exports.pingAsync = function (hostname, ipv6 = false) {
         ping.promise.probe(hostname, {
             v6: ipv6,
             min_reply: 1,
-            timeout: 10000,
+            timeout: 10,
         }).then((res) => {
             // If ping failed, it will set field to unknown
             if (res.alive) {

From 4ebf5a5f0736f648b87db0bf0c2fcfe250258671 Mon Sep 17 00:00:00 2001
From: Louis Lam <louislam@users.noreply.github.com>
Date: Thu, 5 Jan 2023 21:03:28 +0800
Subject: [PATCH 14/14] Update README.md

---
 README.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 9b810015..1f26da8b 100644
--- a/README.md
+++ b/README.md
@@ -44,7 +44,7 @@ docker run -d --restart=always -p 3001:3001 -v uptime-kuma:/app/data --name upti
 
 ⚠️ Please use a **local volume** only. Other types such as NFS are not supported.
 
-Kuma is now running on http://localhost:3001
+Uptime Kuma is now running on http://localhost:3001
 
 ### 💪🏻 Non-Docker
 
@@ -73,7 +73,7 @@ pm2 start server/server.js --name uptime-kuma
 
 
 ```
-Kuma is now running on http://localhost:3001
+Uptime Kuma is now running on http://localhost:3001
 
 More useful PM2 Commands