fix(packaging): guard externally managed updates
This commit is contained in:
1 parent
f6cadb1eb2
commit
f728210050
7 files changed
+24
-11
No files matched your search
@@ -100,14 +100,14 @@ export default function AboutDialog({ open, onClose }: AboutDialogProps) {
|
||||
}
|
||||
|
||||
const runtimeLabel =
|
||||
packageManagerDisplay ??
|
||||
(supportInfo.runtime === "portable" ? t("about.portable") : t("about.installed"));
|
||||
supportInfo.runtime === "portable" ? t("about.portable") : t("about.installed");
|
||||
const text = [
|
||||
"NyaTerm Support Information",
|
||||
`Version: ${appVersion}`,
|
||||
`Operating System: ${supportInfo.os}`,
|
||||
`Application Architecture: ${supportInfo.architecture}`,
|
||||
`Runtime: ${runtimeLabel}`,
|
||||
...(packageManagerDisplay ? [`Package Manager: ${packageManagerDisplay}`] : []),
|
||||
...(conptyDisplay ? [`Local Terminal ConPTY: ${conptyDisplay}`] : []),
|
||||
].join("\n");
|
||||
try {
|
||||
@@ -128,8 +128,9 @@ export default function AboutDialog({ open, onClose }: AboutDialogProps) {
|
||||
const architectureDisplay =
|
||||
supportInfo?.architecture ?? (supportInfoFailed ? t("about.unknown") : t("common.loading"));
|
||||
const runtimeDisplay = supportInfo
|
||||
? packageManagerDisplay ??
|
||||
(supportInfo.runtime === "portable" ? t("about.portable") : t("about.installed"))
|
||||
? supportInfo.runtime === "portable"
|
||||
? t("about.portable")
|
||||
: t("about.installed")
|
||||
: supportInfoFailed
|
||||
? t("about.unknown")
|
||||
: t("common.loading");
|
||||
@@ -139,6 +140,7 @@ export default function AboutDialog({ open, onClose }: AboutDialogProps) {
|
||||
[t("about.operatingSystem"), osDisplay],
|
||||
[t("about.architecture"), architectureDisplay],
|
||||
[t("about.runtime"), runtimeDisplay],
|
||||
...(packageManagerDisplay ? [[t("about.packageManager"), packageManagerDisplay]] : []),
|
||||
...(conptyDisplay ? [[t("about.conpty"), conptyDisplay]] : []),
|
||||
];
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ function MarkdownContent({ content }: { content: string }) {
|
||||
|
||||
export default function UpdateDialog({ open, onClose, onUpdateFound }: UpdateDialogProps) {
|
||||
const { t } = useTranslation();
|
||||
const { runtimeInfo } = useApp();
|
||||
const { runtimeInfo, runtimeInfoLoaded } = useApp();
|
||||
const [status, setStatus] = useState<UpdateStatus>("checking");
|
||||
const [progress, setProgress] = useState<UpdateProgress>({ downloaded: 0, total: 0 });
|
||||
const [error, setError] = useState<string>("");
|
||||
@@ -158,7 +158,7 @@ export default function UpdateDialog({ open, onClose, onUpdateFound }: UpdateDia
|
||||
onUpdateFoundRef.current = onUpdateFound;
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) return;
|
||||
if (!open || !runtimeInfoLoaded || runtimeInfo.packageManager) return;
|
||||
|
||||
getVersion()
|
||||
.then(setCurrentVersion)
|
||||
@@ -191,10 +191,10 @@ export default function UpdateDialog({ open, onClose, onUpdateFound }: UpdateDia
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, [open, runtimeInfo.portable]);
|
||||
}, [open, runtimeInfo.packageManager, runtimeInfo.portable, runtimeInfoLoaded]);
|
||||
|
||||
const handleUpdate = useCallback(async () => {
|
||||
if (isUpdating.current) return;
|
||||
if (isUpdating.current || runtimeInfo.packageManager) return;
|
||||
isUpdating.current = true;
|
||||
setStatus("downloading");
|
||||
setError("");
|
||||
@@ -209,7 +209,7 @@ export default function UpdateDialog({ open, onClose, onUpdateFound }: UpdateDia
|
||||
setStatus("error");
|
||||
isUpdating.current = false;
|
||||
}
|
||||
}, [runtimeInfo.portable]);
|
||||
}, [runtimeInfo.packageManager, runtimeInfo.portable]);
|
||||
|
||||
const handleRelaunch = useCallback(async () => {
|
||||
try {
|
||||
|
||||
@@ -756,7 +756,14 @@ export default function Header({
|
||||
}: HeaderProps) {
|
||||
const [appWindow] = useState(() => getCurrentWindow());
|
||||
const { themeName, setTheme, themeNames, terminalThemeName, setTerminalTheme } = useTheme();
|
||||
const { updateAppSettings, updateUi, appSettings, tabs, runtimeInfo } = useApp();
|
||||
const {
|
||||
updateAppSettings,
|
||||
updateUi,
|
||||
appSettings,
|
||||
tabs,
|
||||
runtimeInfo,
|
||||
runtimeInfoLoaded,
|
||||
} = useApp();
|
||||
const [showImportDialog, setShowImportDialog] = useState(false);
|
||||
const [isMaximized, setIsMaximized] = useState(false);
|
||||
const [showCloseConfirm, setShowCloseConfirm] = useState(false);
|
||||
@@ -1242,7 +1249,7 @@ export default function Header({
|
||||
icon: "menu_book",
|
||||
action: () => openUrl(`${packageJson.docspage}`),
|
||||
},
|
||||
...(runtimeInfo.packageManager
|
||||
...(!runtimeInfoLoaded || runtimeInfo.packageManager
|
||||
? []
|
||||
: [
|
||||
{
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
"installed": "Installed",
|
||||
"issues": "Issues",
|
||||
"operatingSystem": "Operating system",
|
||||
"packageManager": "Package manager",
|
||||
"portable": "Portable",
|
||||
"runtime": "Runtime",
|
||||
"supportInfo": "Support information",
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
"installed": "설치 버전",
|
||||
"issues": "이슈",
|
||||
"operatingSystem": "운영 체제",
|
||||
"packageManager": "패키지 관리자",
|
||||
"portable": "포터블 버전",
|
||||
"runtime": "실행 환경",
|
||||
"supportInfo": "지원 정보",
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
"installed": "安装版",
|
||||
"issues": "问题反馈",
|
||||
"operatingSystem": "操作系统",
|
||||
"packageManager": "包管理器",
|
||||
"portable": "便携版",
|
||||
"runtime": "运行环境",
|
||||
"supportInfo": "支持信息",
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
"installed": "安裝版",
|
||||
"issues": "問題回報",
|
||||
"operatingSystem": "作業系統",
|
||||
"packageManager": "套件管理器",
|
||||
"portable": "便攜版",
|
||||
"runtime": "執行環境",
|
||||
"supportInfo": "支援資訊",
|
||||
|
||||
Reference in new issue
Block a user