fix(ui): fix version comparer

This commit is contained in:
Fu Diwei
2026-04-17 11:51:46 +08:00
committed by RHQYZ
parent 90d4a5f5d2
commit 85f214d73b
2 changed files with 6 additions and 3 deletions
+2 -2
View File
@@ -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,
+4 -1
View File
@@ -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'");