diff --git a/starpilot/system/the_galaxy/assets/mobile/js/api.js b/starpilot/system/the_galaxy/assets/mobile/js/api.js index 871e243086..be5e5e6934 100644 --- a/starpilot/system/the_galaxy/assets/mobile/js/api.js +++ b/starpilot/system/the_galaxy/assets/mobile/js/api.js @@ -225,7 +225,12 @@ export const api = { restoreToggles(data) { return request("/api/toggles/restore", { method: "POST", data }) }, resetTogglesDefault() { return request("/api/toggles/reset_default", { method: "POST" }) }, - getUpdateBranches() { return request("/api/update/branches") }, + getUpdateBranches() { + return request("/api/update/branches", { cache: "no-store" }).then((data) => { + if (!Array.isArray(data?.branches)) throw new Error(data?.error || "Update branch list unavailable.") + return data + }) + }, getUpdateBranch() { return request("/api/update/branch") }, setUpdateBranch(branch) { return request("/api/update/branch", { method: "POST", data: { branch } }) }, getUpdateVersions(branch, { page = 1, head = "", signal } = {}) { @@ -235,7 +240,12 @@ export const api = { }, installUpdateVersion(branch, commit) { return request("/api/update/version", { method: "POST", data: { branch, commit, confirmed: true } }) }, updateFast() { return request("/api/update/fast", { method: "POST" }) }, - getUpdateFastStatus() { return request("/api/update/fast/status") }, + getUpdateFastStatus() { + return request("/api/update/fast/status", { cache: "no-store" }).then((data) => { + if (!data || typeof data !== "object" || typeof data.running !== "boolean") throw new Error(data?.error || "Update status unavailable.") + return data + }) + }, updateRecover() { return request("/api/update/recover", { method: "POST" }) }, updateRollback() { return request("/api/update/rollback", { method: "POST" }) }, factoryReset() { return request("/api/update/factory_reset", { method: "POST" }) }, diff --git a/starpilot/system/the_galaxy/assets/mobile/js/views/SystemTools.js b/starpilot/system/the_galaxy/assets/mobile/js/views/SystemTools.js index 68330e958c..881c1439d7 100644 --- a/starpilot/system/the_galaxy/assets/mobile/js/views/SystemTools.js +++ b/starpilot/system/the_galaxy/assets/mobile/js/views/SystemTools.js @@ -16,6 +16,8 @@ function toPercent(value) { return Math.max(0, Math.min(100, n)) } +const CORE_UPDATE_BRANCHES = ["StarPilot", "Dom"] + export const SystemTools = { name: "SystemTools", components: { GalaxySection, GxNotice, GalaxySelect, VersionHistoryPicker }, @@ -35,6 +37,8 @@ export const SystemTools = { versionNotice: "", versionGeneration: 0, branchLoading: true, + branchListFallback: false, + branchListError: "", otherBranchesOpen: false, branchBusy: false, @@ -102,15 +106,33 @@ export const SystemTools = { async loadBranches() { try { const data = await api.getUpdateBranches() - this.branches = Array.isArray(data?.branches) ? data.branches : [] - this.currentBranch = data?.currentBranch || "" + const branches = [...new Set(data.branches.map(branch => String(branch || "").trim()).filter(Boolean))] + if (!branches.length) throw new Error("No update branches were returned.") + this.branches = branches + this.currentBranch = String(data?.currentBranch || "").trim() + this.branchListFallback = false + this.branchListError = "" if (!this.targetBranch) { this.targetBranch = this.currentBranch this.otherBranchesOpen = !!this.targetBranch && !["StarPilot", "Dom"].includes(this.targetBranch) } this.isOnroad = !!data?.isOnroad } catch (e) { - showSnackbar("Failed to load update info.", "error") + this.branchListError = e?.message || "Update branch list unavailable." + try { + if (!this.fastStatus) await this.loadFastStatus({ throwOnError: true }) + } catch (statusError) { + this.fastStatus = null + } + const current = String(this.fastStatus?.branch || this.currentBranch || "").trim() + this.currentBranch = current + this.branches = [...new Set([current, ...CORE_UPDATE_BRANCHES].filter(Boolean))] + this.branchListFallback = true + if (!this.targetBranch) { + this.targetBranch = current || "Dom" + this.otherBranchesOpen = !!this.targetBranch && !CORE_UPDATE_BRANCHES.includes(this.targetBranch) + } + showSnackbar("Could not refresh the full branch list. Standard branches are still available.", "error") } finally { this.branchLoading = false } @@ -534,8 +556,8 @@ export const SystemTools = { - - + +
@@ -547,7 +569,7 @@ export const SystemTools = {
-

No branch list available. Reload when connected to check available branches.

+

The full branch list is temporarily unavailable. Standard branches are shown; selecting a version still verifies it with the device.