diff --git a/ui/src/hooks/useVersionChecker.ts b/ui/src/hooks/useVersionChecker.ts index e737b6de9..c5573b506 100644 --- a/ui/src/hooks/useVersionChecker.ts +++ b/ui/src/hooks/useVersionChecker.ts @@ -90,11 +90,11 @@ const useVersionChecker = () => { if (releases[nIdx]) { localStorage.setItem(LOCAL_STORAGE_KEY, releases[nIdx].name); + return compareVersions(releases[nIdx].name, APP_VERSION) === 1; } else { localStorage.removeItem(LOCAL_STORAGE_KEY); + return false; } - - return !!releases[nIdx]; }, { manual: true, diff --git a/ui/vite.config.ts b/ui/vite.config.ts index 824ac9836..84f0d4c86 100644 --- a/ui/vite.config.ts +++ b/ui/vite.config.ts @@ -33,13 +33,16 @@ const preserveFilesPlugin = (filesToPreserve: string[]): Plugin => { }; }; -export default defineConfig(() => { +export default defineConfig(({ command }) => { let appVersion = undefined; try { const content = fs.readFileSync(path.resolve(__dirname, "../internal/app/app.go"), "utf-8"); const matches = content.match(/AppVersion\s+=\s+"(.+?)"/); if (matches) { appVersion = matches[1]; + if (command === "serve") { + appVersion += "-dev"; + } console.info("[certimate] AppVersion is " + appVersion); } else { throw new Error("AppVersion not found in '/internal/app/app.go'");