diff --git a/package-lock.json b/package-lock.json
index f09bb3766..3ceb1ff95 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "uptime-kuma",
- "version": "1.2.0",
+ "version": "1.3.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "uptime-kuma",
- "version": "1.2.0",
+ "version": "1.3.0",
"license": "MIT",
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.36",
@@ -22,6 +22,7 @@
"chart.js": "^3.5.0",
"chartjs-adapter-dayjs": "^1.0.0",
"command-exists": "^1.2.9",
+ "compare-versions": "^3.6.0",
"dayjs": "^1.10.6",
"express": "^4.17.1",
"express-basic-auth": "^1.2.0",
@@ -2430,6 +2431,11 @@
"node": ">= 6"
}
},
+ "node_modules/compare-versions": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-3.6.0.tgz",
+ "integrity": "sha512-W6Af2Iw1z4CB7q4uU4hv646dW9GQuBM+YpC0UvUCWSD8w90SJjp+ujJuXaEMtAXBtSqGfMPuFOVn4/+FlaqfBA=="
+ },
"node_modules/component-emitter": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz",
@@ -10971,6 +10977,11 @@
"resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz",
"integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA=="
},
+ "compare-versions": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-3.6.0.tgz",
+ "integrity": "sha512-W6Af2Iw1z4CB7q4uU4hv646dW9GQuBM+YpC0UvUCWSD8w90SJjp+ujJuXaEMtAXBtSqGfMPuFOVn4/+FlaqfBA=="
+ },
"component-emitter": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz",
diff --git a/package.json b/package.json
index 5d05590f6..aa4b88d53 100644
--- a/package.json
+++ b/package.json
@@ -45,6 +45,7 @@
"chart.js": "^3.5.0",
"chartjs-adapter-dayjs": "^1.0.0",
"command-exists": "^1.2.9",
+ "compare-versions": "^3.6.0",
"dayjs": "^1.10.6",
"express": "^4.17.1",
"express-basic-auth": "^1.2.0",
diff --git a/server/check-version.js b/server/check-version.js
new file mode 100644
index 000000000..2de68b167
--- /dev/null
+++ b/server/check-version.js
@@ -0,0 +1,44 @@
+const { setSetting } = require("./util-server");
+const axios = require("axios");
+const { isDev } = require("../src/util");
+
+exports.version = require("../package.json").version;
+exports.latestVersion = null;
+
+let interval;
+
+exports.startInterval = () => {
+ let check = async () => {
+ try {
+ const res = await axios.get("https://raw.githubusercontent.com/louislam/uptime-kuma/master/package.json");
+
+ if (typeof res.data === "string") {
+ res.data = JSON.parse(res.data);
+ }
+
+ // For debug
+ if (process.env.TEST_CHECK_VERSION === "1") {
+ res.data.version = "1000.0.0"
+ }
+
+ exports.latestVersion = res.data.version;
+ console.log("Latest Version: " + exports.latestVersion);
+ } catch (_) { }
+
+ };
+
+ check();
+ interval = setTimeout(check, 3600 * 48);
+};
+
+exports.enableCheckUpdate = async (value) => {
+ await setSetting("checkUpdate", value);
+
+ clearInterval(interval);
+
+ if (value) {
+ exports.startInterval();
+ }
+};
+
+exports.socket = null;
diff --git a/server/server.js b/server/server.js
index 89d2f4351..7c4441187 100644
--- a/server/server.js
+++ b/server/server.js
@@ -39,16 +39,14 @@ const passwordHash = require("./password-hash");
const args = require("args-parser")(process.argv);
-const version = require("../package.json").version;
+const checkVersion = require("./check-version");
+console.info("Version: " + checkVersion.version);
// If host is omitted, the server will accept connections on the unspecified IPv6 address (::) when IPv6 is available and the unspecified IPv4 address (0.0.0.0) otherwise.
// Dual-stack support for (::)
const hostname = process.env.HOST || args.host;
-
const port = parseInt(process.env.PORT || args.port || 3001);
-console.info("Version: " + version)
-
console.log("Creating express and socket.io instance")
const app = express();
const server = http.createServer(app);
@@ -119,7 +117,8 @@ let indexHTML = fs.readFileSync("./dist/index.html").toString();
io.on("connection", async (socket) => {
socket.emit("info", {
- version,
+ version: checkVersion.version,
+ latestVersion: checkVersion.latestVersion,
})
totalClient++;
@@ -584,6 +583,7 @@ let indexHTML = fs.readFileSync("./dist/index.html").toString();
console.log(`Listening on ${port}`);
}
startMonitors();
+ checkVersion.startInterval();
});
})();
diff --git a/src/assets/app.scss b/src/assets/app.scss
index 2dbddd3df..f043d785b 100644
--- a/src/assets/app.scss
+++ b/src/assets/app.scss
@@ -72,7 +72,13 @@ h2 {
}
}
+.btn-info {
+ color: white;
+ &:hover, &:active, &:focus, &.active {
+ color: white;
+ }
+}
// Dark Theme override here
.dark {
@@ -99,6 +105,10 @@ h2 {
.table,
.nav-link {
color: $dark-font-color;
+
+ &.btn-info {
+ color: white;
+ }
}
.form-control,
diff --git a/src/icon.js b/src/icon.js
index d8ea36d61..960fa8c18 100644
--- a/src/icon.js
+++ b/src/icon.js
@@ -1,10 +1,10 @@
import { library } from "@fortawesome/fontawesome-svg-core"
-import { faCog, faEdit, faList, faPause, faPlay, faPlus, faTachometerAlt, faTrash } from "@fortawesome/free-solid-svg-icons"
+import { faCog, faEdit, faPlus, faPause, faPlay, faTachometerAlt, faTrash, faList, faArrowAltCircleUp } from "@fortawesome/free-solid-svg-icons"
//import { fa } from '@fortawesome/free-regular-svg-icons'
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"
// Add Free Font Awesome Icons here
// https://fontawesome.com/v5.15/icons?d=gallery&p=2&s=solid&m=free
-library.add(faCog, faTachometerAlt, faEdit, faPlus, faPause, faPlay, faTrash, faList)
+library.add(faCog, faEdit, faPlus, faPause, faPlay, faTachometerAlt, faTrash, faList, faArrowAltCircleUp);
export { FontAwesomeIcon }
diff --git a/src/layouts/Layout.vue b/src/layouts/Layout.vue
index f5f2c6ec2..905286e4b 100644
--- a/src/layouts/Layout.vue
+++ b/src/layouts/Layout.vue
@@ -13,6 +13,10 @@
Uptime Kuma
+
+