diff --git a/config/vite.config.js b/config/vite.config.js
index c8bba853..84de961d 100644
--- a/config/vite.config.js
+++ b/config/vite.config.js
@@ -11,6 +11,9 @@ const viteCompressionFilter = /\.(js|mjs|json|css|html|svg)$/i;
// https://vitejs.dev/config/
export default defineConfig({
+ define: {
+ "FRONTEND_VERSION": JSON.stringify(process.env.npm_package_version),
+ },
plugins: [
vue(),
legacy({
diff --git a/src/components/settings/About.vue b/src/components/settings/About.vue
index a71e38af..3ef9e6d7 100644
--- a/src/components/settings/About.vue
+++ b/src/components/settings/About.vue
@@ -4,6 +4,11 @@
Uptime Kuma
{{ $t("Version") }}: {{ $root.info.version }}
+ {{ $t("Frontend Version") }}: {{ $root.frontendVersion }}
+
+
+ ⚠️ {{ $t("Frontend Version do not match backend version!") }}
+
@@ -46,6 +51,16 @@ export default {
}
.update-link {
- font-size: 0.9em;
+ font-size: 0.8em;
}
+
+.frontend-version {
+ font-size: 0.9em;
+ color: #cccccc;
+
+ .dark & {
+ color: #333333;
+ }
+}
+
diff --git a/src/mixins/socket.js b/src/mixins/socket.js
index 04785b2d..ed1620bf 100644
--- a/src/mixins/socket.js
+++ b/src/mixins/socket.js
@@ -601,6 +601,28 @@ export default {
return result;
},
+
+ /**
+ * Frontend Version
+ * It should be compiled to a static value while building the frontend.
+ * Please see ./config/vite.config.js, it is defined via vite.js
+ * @returns {string}
+ */
+ frontendVersion() {
+ // eslint-disable-next-line no-undef
+ return FRONTEND_VERSION;
+ },
+
+ /**
+ * Are both frontend and backend in the same version?
+ * @returns {boolean}
+ */
+ isFrontendBackendVersionMatched() {
+ if (!this.info.version) {
+ return true;
+ }
+ return this.info.version === this.frontendVersion;
+ }
},
watch: {