FIX: fix bug about checking version

This commit is contained in:
2025-07-26 22:07:28 +07:00
parent 461dfd93ba
commit fb1cd82434
5 changed files with 107 additions and 96 deletions

View File

@@ -3,18 +3,17 @@ import useSettingStore from "@/stores/settingStore";
import { FSService, GitService } from "@bindings/firefly-launcher/internal";
import { toast } from "react-toastify";
export async function CheckUpdateProxy(proxyPath: string, proxyVersion: string) : Promise<{isUpdate: boolean, version: string}> {
let isUpdateProxy = false
let version = ""
const [proxyOk, proxyNewVersion, proxyError] = await GitService.GetLatestProxyVersion()
const proxyExists = await FSService.FileExists(proxyPath)
if (proxyOk && proxyNewVersion && proxyNewVersion !== proxyVersion || !proxyExists) {
isUpdateProxy = true
version = proxyNewVersion
} else if (!proxyOk) {
toast.error("Proxy error: " + proxyError)
export async function CheckUpdateProxy(proxyPath: string, proxyVersion: string) : Promise<{isUpdate: boolean, isExists: boolean, version: string}> {
const [ok, latestVersion, error] = await GitService.GetLatestProxyVersion()
const isExists = await FSService.FileExists(proxyPath)
if (!ok) {
toast.error("Proxy error: " + error)
return { isUpdate: false, isExists, version: "" }
}
return { isUpdate: isUpdateProxy, version: version }
const isUpdate = latestVersion !== proxyVersion
return { isUpdate, isExists, version: latestVersion }
}
export async function UpdateProxy(proxyVersion: string) : Promise<void> {