FIX: fix bug about checking version
This commit is contained in:
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user