From 9115362956fa2771f718d828191fe4d65bc9014d Mon Sep 17 00:00:00 2001 From: Siyuan Date: Mon, 10 Nov 2025 11:57:07 +0000 Subject: [PATCH] chore: make downgrade version configurable --- ui/src/components/FailSafeModeOverlay.tsx | 13 +++++++++---- ui/src/ui.config.ts | 2 ++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ui/src/components/FailSafeModeOverlay.tsx b/ui/src/components/FailSafeModeOverlay.tsx index 2a424c0c..2aff7412 100644 --- a/ui/src/components/FailSafeModeOverlay.tsx +++ b/ui/src/components/FailSafeModeOverlay.tsx @@ -10,9 +10,12 @@ import { useDeviceUiNavigation } from "@/hooks/useAppNavigation"; import { useVersion } from "@/hooks/useVersion"; import { useDeviceStore } from "@/hooks/stores"; import notifications from "@/notifications"; +import { DOWNGRADE_VERSION } from "@/ui.config"; import { GitHubIcon } from "./Icons"; + + interface FailSafeModeOverlayProps { reason: string; } @@ -86,7 +89,7 @@ export function FailSafeModeOverlay({ reason }: FailSafeModeOverlayProps) { const handleReportAndDownloadLogs = () => { setIsDownloadingLogs(true); - send("getFailSafeLogs", {}, (resp: JsonRpcResponse) => { + send("getFailSafeLogs", {}, async (resp: JsonRpcResponse) => { setIsDownloadingLogs(false); if ("error" in resp) { @@ -105,7 +108,9 @@ export function FailSafeModeOverlay({ reason }: FailSafeModeOverlayProps) { a.href = url; a.download = filename; document.body.appendChild(a); + await new Promise(resolve => setTimeout(resolve, 1000)); a.click(); + await new Promise(resolve => setTimeout(resolve, 1000)); document.body.removeChild(a); URL.revokeObjectURL(url); @@ -126,7 +131,7 @@ Please attach the recovery logs file that was downloaded to your computer: \`${filename}\` > [!NOTE] -> Please omit any sensitive information from the logs. +> Please remove any sensitive information from the logs. The reports are public and can be viewed by anyone. ## Additional Context [Please describe what you were doing when this occurred]`; @@ -141,7 +146,7 @@ Please attach the recovery logs file that was downloaded to your computer: }; const handleDowngrade = () => { - navigateTo("/settings/general/update?app=0.4.8"); + navigateTo(`/settings/general/update?app=${DOWNGRADE_VERSION}`); }; return ( @@ -192,7 +197,7 @@ Please attach the recovery logs file that was downloaded to your computer: size="SM" onClick={handleDowngrade} theme="light" - text="Downgrade to v0.4.8" + text={`Downgrade to v${DOWNGRADE_VERSION}`} disabled={!hasDownloadedLogs} /> diff --git a/ui/src/ui.config.ts b/ui/src/ui.config.ts index b76dd7c4..3cb3b58b 100644 --- a/ui/src/ui.config.ts +++ b/ui/src/ui.config.ts @@ -1,4 +1,6 @@ export const CLOUD_API = import.meta.env.VITE_CLOUD_API; +export const DOWNGRADE_VERSION = import.meta.env.VITE_DOWNGRADE_VERSION || "0.4.8"; + // In device mode, an empty string uses the current hostname (the JetKVM device's IP) as the API endpoint export const DEVICE_API = "";