From ba16c7e5cb3a001a898f0a837a0a1487fa69c78e Mon Sep 17 00:00:00 2001 From: Michelle Rodriguez Date: Fri, 6 Dec 2024 16:35:43 +0800 Subject: [PATCH] feat: check update for ui (#57) * feat: check update for ui * chore: use fetch --------- Co-authored-by: Zephyruso <176294927+Zephyruso@users.noreply.github.com> --- src/api/index.ts | 8 ++++++++ src/views/SettingsPage.vue | 27 +++++++++++++++++++++------ 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/src/api/index.ts b/src/api/index.ts index 3b4d2b8a..0bd0cd46 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -11,6 +11,7 @@ axios.interceptors.request.use((config) => { activeBackend.value?.host + ':' + activeBackend.value?.port + config.headers['Authorization'] = 'Bearer ' + activeBackend.value?.password return config }) @@ -156,3 +157,10 @@ export const fetchMemoryAPI = () => { export const fetchTrafficAPI = () => { return createWebSocket('traffic') } + +export const fetchIsUIUpdateAvailable = async () => { + const response = await fetch('https://api.github.com/repos/Zephyruso/zashboard/releases/latest') + const { tag_name } = await response.json() + + return tag_name !== `v${zashboardVersion.value}` +} diff --git a/src/views/SettingsPage.vue b/src/views/SettingsPage.vue index 323a4768..13dd5bac 100644 --- a/src/views/SettingsPage.vue +++ b/src/views/SettingsPage.vue @@ -2,11 +2,20 @@
@@ -228,6 +237,7 @@