From 7273ae56892e8f1154c5c781f3ab58b3fbfe1a06 Mon Sep 17 00:00:00 2001 From: nunreasonable Date: Mon, 9 Nov 2026 10:19:31 -0300 Subject: [PATCH 1/2] Install winget's package and set the execution policy without starting PowerShell --- installer/Cargo.lock | 2 + installer/README.en.md | 12 +-- installer/README.pt-BR.md | 16 ++-- installer/core/Cargo.toml | 4 + installer/core/src/ops.rs | 35 +++----- installer/core/src/win.rs | 167 ++++++++++++++++++++++++++++---------- 6 files changed, 161 insertions(+), 75 deletions(-) diff --git a/installer/Cargo.lock b/installer/Cargo.lock index 137865a..d16dccc 100644 --- a/installer/Cargo.lock +++ b/installer/Cargo.lock @@ -1491,6 +1491,8 @@ dependencies = [ "sha2", "ureq", "windows", + "windows-collections", + "windows-future", "winreg", "zip", ] diff --git a/installer/README.en.md b/installer/README.en.md index b4f22ab..3d10dda 100644 --- a/installer/README.en.md +++ b/installer/README.en.md @@ -107,8 +107,8 @@ light or dark mode, the accent color and whether the taskbar hides automatically package with no declared install scope, so winget installs it per user, same as Oh My Posh, Starship and eza above (with the same `--accept-package-agreements`/`--accept-source-agreements`). Uninstall removes it only if this setup installed it, the same as PowerShell 7. -- **Allow Windows PowerShell 5.1 to run profile scripts** (off by default): runs - `Set-ExecutionPolicy -Scope CurrentUser RemoteSigned`. This is a **security setting**: it lets +- **Allow Windows PowerShell 5.1 to run profile scripts** (off by default): sets + the same registry value as `Set-ExecutionPolicy -Scope CurrentUser RemoteSigned`. This is a **security setting**: it lets Windows PowerShell 5.1 run scripts stored on this computer, while scripts downloaded from the internet still need a signature. Without it, Windows PowerShell 5.1 doesn't load your profile, so ii's terminal look only appears in PowerShell 7, which allows this already. Nothing is @@ -211,7 +211,8 @@ Uninstall reads `install-manifest.json` and undoes what it lists: - puts the PowerShell execution policy back, if this setup changed it; - uninstalls with winget the terminal tools this setup installed (an option, on by default; PowerShell 7 and FFmpeg too, each as its own option, if this setup installed them), then - removes winget itself (`Remove-AppxPackage`) if this setup installed it on Windows 10, and + removes winget itself (through Windows' `PackageManager`, like `Remove-AppxPackage`) if this + setup installed it on Windows 10, and removes the fonts it installed; - deletes the Windows Terminal fragment folder, `%LOCALAPPDATA%\ii-windows`, ii's folders in `%LOCALAPPDATA%\quickshell` (`ii`, `State`, `cache`, `run`, but not `State\user`), @@ -289,12 +290,13 @@ recommended), next to Windows 11. A few things work differently there: update never adds winget you didn't ask for) downloads the App Installer package and its dependencies (about 300 MB together) from the latest release of [microsoft/winget-cli](https://github.com/microsoft/winget-cli) on GitHub, and installs it for - your user with `Add-AppxPackage` - no administrator permission. Some winget-cli releases + your user through Windows' `PackageManager` (the API behind `Add-AppxPackage`, called directly, + without PowerShell) - no administrator permission. Some winget-cli releases publish the msixbundle's SHA-256 next to it; when that's there, it's checked before installing, and this setup says so; when it isn't, this setup doesn't invent a check of its own, since Windows checks the package's own Microsoft signature on install anyway. Turning the toggle off skips this (same as before: the terminal tools and FFmpeg are skipped too). Uninstall removes - it with `Remove-AppxPackage`, only if this setup installed it. A failed download or install + it the same way, only if this setup installed it. A failed download or install here is a warning, not a failed setup: the terminal tools and FFmpeg are then skipped exactly as they are when winget was never found. - **Windows Terminal** isn't built into Windows 10. If the *Terminal setup* option is on and diff --git a/installer/README.pt-BR.md b/installer/README.pt-BR.md index aa9563b..3b351df 100644 --- a/installer/README.pt-BR.md +++ b/installer/README.pt-BR.md @@ -116,8 +116,8 @@ tarefas se oculta automaticamente. de instalação declarado, então o winget o instala por usuário, do mesmo jeito que o Oh My Posh, o Starship e o eza acima (com os mesmos `--accept-package-agreements`/`--accept-source-agreements`). A desinstalação o remove só se foi este instalador que o instalou, assim como o PowerShell 7. -- **Permitir que o Windows PowerShell 5.1 rode scripts de perfil** (desligada por padrão): roda - `Set-ExecutionPolicy -Scope CurrentUser RemoteSigned`. É uma **configuração de segurança**: +- **Permitir que o Windows PowerShell 5.1 rode scripts de perfil** (desligada por padrão): grava + o mesmo valor no registro que o `Set-ExecutionPolicy -Scope CurrentUser RemoteSigned`. É uma **configuração de segurança**: deixa o Windows PowerShell 5.1 rodar scripts guardados neste computador, enquanto scripts baixados da internet continuam precisando de assinatura. Sem ela, o Windows PowerShell 5.1 não carrega o seu perfil, e o visual de terminal do ii só aparece no PowerShell 7, que já permite @@ -226,8 +226,9 @@ A desinstalação lê o `install-manifest.json` e desfaz o que está nele: - volta a política de execução do PowerShell, se este instalador a mudou; - desinstala com o winget as ferramentas de terminal que este instalador instalou (uma opção, ligada por padrão; o PowerShell 7 e o FFmpeg também, cada um como sua própria opção, se foi - este instalador que os instalou), depois remove o próprio winget (`Remove-AppxPackage`) se foi - este instalador que o instalou no Windows 10, e remove as fontes que ele instalou; + este instalador que os instalou), depois remove o próprio winget (pelo `PackageManager` do + Windows, como o `Remove-AppxPackage`) se foi este instalador que o instalou no Windows 10, e + remove as fontes que ele instalou; - apaga a pasta do fragmento do Windows Terminal, `%LOCALAPPDATA%\ii-windows`, as pastas do ii em `%LOCALAPPDATA%\quickshell` (`ii`, `State`, `cache`, `run`, mas não `State\user`), `%LOCALAPPDATA%\cache\quickshell` e `%TEMP%\quickshell`, e também @@ -308,13 +309,14 @@ O ii-windows também instala no Windows 10 versão 2004 ou mais nova (build 1904 por padrão na instalação; desligada na atualização e no reparo, para uma atualização nunca trazer um winget que você não pediu) baixa o pacote do Instalador de Aplicativo e as dependências dele (cerca de 300 MB juntos) da versão mais nova do [microsoft/winget-cli](https://github.com/microsoft/winget-cli) - no GitHub, e o instala para o seu usuário com `Add-AppxPackage` - sem precisar de permissão de + no GitHub, e o instala para o seu usuário pelo `PackageManager` do Windows (a API por trás do + `Add-AppxPackage`, chamada direto, sem PowerShell) - sem precisar de permissão de administrador. Algumas versões do winget-cli publicam o SHA-256 do msixbundle ao lado dele; quando isso existe, é conferido antes de instalar, e este instalador avisa; quando não existe, este instalador não inventa uma verificação própria, já que o Windows confere a assinatura da Microsoft do pacote ao instalar, de qualquer jeito. Desligar essa opção pula essa etapa (como - antes: as ferramentas de terminal e o FFmpeg também são pulados). A desinstalação o remove com - `Remove-AppxPackage`, só se foi este instalador que o instalou. Um download ou instalação que + antes: as ferramentas de terminal e o FFmpeg também são pulados). A desinstalação o remove do + mesmo jeito, só se foi este instalador que o instalou. Um download ou instalação que falhe aqui é um aviso, não um instalador que falhou: as ferramentas de terminal e o FFmpeg são então pulados, exatamente como quando o winget nunca foi encontrado. - O **Windows Terminal** não vem com o Windows 10. Se a opção *Configuração do terminal* estiver diff --git a/installer/core/Cargo.toml b/installer/core/Cargo.toml index 6cfc33f..c819a28 100644 --- a/installer/core/Cargo.toml +++ b/installer/core/Cargo.toml @@ -14,7 +14,11 @@ pulldown-cmark = { version = "0.13", default-features = false, features = ["html [target.'cfg(windows)'.dependencies] winreg = "0.55" +windows-collections = "0.3" +windows-future = "0.3" windows = { version = "0.62", features = [ + "ApplicationModel", + "Management_Deployment", "Win32_Foundation", "Win32_Globalization", "Win32_Graphics_Gdi", diff --git a/installer/core/src/ops.rs b/installer/core/src/ops.rs index e7d9a46..f83fbfd 100644 --- a/installer/core/src/ops.rs +++ b/installer/core/src/ops.rs @@ -1402,17 +1402,12 @@ fn install_app_installer(ctx: &mut Ctx, m: &mut Manifest) { if reporter.cancelled() { return Err(Msg::new("cancelled", "cancelled")); } - ctx.info(" Add-AppxPackage (per user)"); - let out = win::install_appx_bundle(&msixbundle_path, &dep_paths).map_err(|e| io_msg("io", "Add-AppxPackage", e))?; - ctx.info(format!(" {}", out.text().replace('\n', "\n "))); - if !out.success() { - return Err(Msg::new( - "winget_install_failed", - format!("Add-AppxPackage couldn't install winget (exit {:?})", out.code), - ) - .with("code", format!("{:?}", out.code.map(|c| c as u32)))); - } - Ok(()) + ctx.info(" installing the package for this user"); + win::install_appx_bundle(&msixbundle_path, &dep_paths).map_err(|e| { + let code = format!("0x{:08X}", e.code().0 as u32); + Msg::new("winget_install_failed", format!("Windows couldn't install winget ({code}): {}", e.message())) + .with("code", code) + }) })(); let _ = fsops::remove_any(&dir); match result { @@ -2374,29 +2369,25 @@ pub fn uninstall(ctx: &mut Ctx, run: &RunOptions) -> bool { } } if run.remove_tools && app_installer_ours { - ctx.info(format!(" Get-AppxPackage -Name {} | Remove-AppxPackage", crate::APP_INSTALLER_NAME)); + ctx.info(format!(" removing the {} package for this user", crate::APP_INSTALLER_NAME)); match win::remove_appx_package(crate::APP_INSTALLER_NAME) { - Ok(out) if out.success() => { - ctx.info(format!(" {}", out.text().replace('\n', "\n "))); + Ok(removed) => { + ctx.info(format!(" {removed} package(s) removed")); m.items.app_installer = None; save(ctx, &m); } - Ok(out) => { + Err(e) => { failed = true; - ctx.info(format!(" {}", out.text().replace('\n', "\n "))); + let code = format!("0x{:08X}", e.code().0 as u32); ctx.warn( "tools", Msg::new( "winget_uninstall_failed", - format!("Couldn't remove App Installer (exit {:?})", out.code), + format!("Couldn't remove App Installer ({code}): {}", e.message()), ) - .with("code", format!("{:?}", out.code.map(|c| c as u32))), + .with("code", code), ); } - Err(e) => { - failed = true; - ctx.warn("tools", io_msg("winget_uninstall_failed", "Remove-AppxPackage", e)); - } } } if !failed { diff --git a/installer/core/src/win.rs b/installer/core/src/win.rs index 5dd004b..f9bfc63 100644 --- a/installer/core/src/win.rs +++ b/installer/core/src/win.rs @@ -7,6 +7,8 @@ use std::process::{Command, Stdio}; use std::time::{Duration, Instant}; use windows::core::{Interface, GUID, HSTRING, PCWSTR, PWSTR}; +use windows::Foundation::Uri; +use windows::Management::Deployment::{DeploymentOptions, DeploymentProgress, DeploymentResult, PackageManager}; use windows::Win32::Foundation::{CloseHandle, COLORREF, HWND, LPARAM, WPARAM}; use windows::Win32::Graphics::Gdi::{AddFontResourceW, RemoveFontResourceW}; use windows::Win32::Storage::FileSystem::GetDiskFreeSpaceExW; @@ -25,13 +27,15 @@ use windows::Win32::System::Threading::{ use windows::Win32::UI::Shell::{ DesktopWallpaper, FOLDERID_Desktop, FOLDERID_Documents, FOLDERID_LocalAppData, FOLDERID_Pictures, FOLDERID_Programs, FOLDERID_RoamingAppData, FOLDERID_Videos, IDesktopWallpaper, IShellLinkW, SHAppBarMessage, - SHGetKnownFolderPath, ShellExecuteW, ShellLink, ABM_GETSTATE, ABM_SETSTATE, APPBARDATA, + SHGetKnownFolderPath, ShellExecuteW, ShellLink, UrlCreateFromPathW, ABM_GETSTATE, ABM_SETSTATE, APPBARDATA, DESKTOP_WALLPAPER_POSITION, KF_FLAG_DEFAULT, }; use windows::Win32::UI::WindowsAndMessaging::{ EnumWindows, FindWindowW, GetClassNameW, SendMessageTimeoutW, ShowWindow, HWND_BROADCAST, SMTO_ABORTIFHUNG, SW_SHOWNA, SW_SHOWNORMAL, WM_FONTCHANGE, WM_SETTINGCHANGE, }; +use windows_collections::IIterable; +use windows_future::{AsyncStatus, IAsyncOperationWithProgress}; use winreg::enums::{HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE, KEY_READ, KEY_WRITE}; use winreg::types::FromRegValue; use winreg::RegKey; @@ -1002,24 +1006,49 @@ pub fn profile_path(exe: &Path) -> Result { Ok(PathBuf::from(line)) } -pub fn exec_policy(scope: Option<&str>) -> Option { - let script = "Get-ExecutionPolicy -List | ForEach-Object { '{0}={1}' -f $_.Scope, $_.ExecutionPolicy }"; - let out = ps(&powershell_exe(), script, Duration::from_secs(60)).ok()?; - if !out.success() { - return None; +const PS_SHELL_KEY: &str = r"Software\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell"; +const PS_GROUP_POLICY_KEY: &str = r"Software\Policies\Microsoft\Windows\PowerShell"; +const EXEC_POLICIES: [&str; 6] = ["Undefined", "Restricted", "AllSigned", "RemoteSigned", "Unrestricted", "Bypass"]; + +fn canonical_policy(value: &str) -> &'static str { + EXEC_POLICIES.iter().find(|p| p.eq_ignore_ascii_case(value)).copied().unwrap_or("Restricted") +} + +fn group_policy(enable_scripts: Option, policy: Option) -> Option<&'static str> { + match enable_scripts? { + 0 => Some("Restricted"), + 1 => policy.map(|p| canonical_policy(&p)), + _ => None, } - let list: Vec<(String, String)> = out - .stdout - .lines() - .filter_map(|l| l.trim().split_once('=').map(|(a, b)| (a.to_string(), b.to_string()))) - .collect(); - let get = |name: &str| list.iter().find(|(s, _)| s.eq_ignore_ascii_case(name)).map(|(_, v)| v.clone()); +} + +fn scope_policy(scope: &str) -> Option<&'static str> { + let (root, group) = match scope { + "MachinePolicy" => (HKEY_LOCAL_MACHINE, true), + "UserPolicy" => (HKEY_CURRENT_USER, true), + "CurrentUser" => (HKEY_CURRENT_USER, false), + "LocalMachine" => (HKEY_LOCAL_MACHINE, false), + _ => return None, + }; + let key = RegKey::predef(root) + .open_subkey_with_flags(if group { PS_GROUP_POLICY_KEY } else { PS_SHELL_KEY }, KEY_READ) + .ok(); + let policy = key.as_ref().and_then(|k| k.get_value::("ExecutionPolicy").ok()).filter(|p| !p.is_empty()); + let policy = if group { + group_policy(key.as_ref().and_then(|k| k.get_value::("EnableScripts").ok()), policy) + } else { + policy.map(|p| canonical_policy(&p)) + }; + Some(policy.unwrap_or("Undefined")) +} + +pub fn exec_policy(scope: Option<&str>) -> Option { match scope { - Some(s) => get(s), + Some(s) => scope_policy(s).map(String::from), None => { for s in ["MachinePolicy", "UserPolicy", "CurrentUser", "LocalMachine"] { - if let Some(v) = get(s).filter(|v| !v.eq_ignore_ascii_case("Undefined")) { - return Some(v); + if let Some(v) = scope_policy(s).filter(|v| *v != "Undefined") { + return Some(v.into()); } } Some("Restricted".into()) @@ -1028,20 +1057,16 @@ pub fn exec_policy(scope: Option<&str>) -> Option { } pub fn set_exec_policy_current_user(value: &str) -> Result<(), String> { - let allowed = ["Undefined", "Restricted", "AllSigned", "RemoteSigned", "Unrestricted", "Bypass", "Default"]; - if !allowed.iter().any(|a| a.eq_ignore_ascii_case(value)) { - return Err(format!("unexpected execution policy {value}")); - } - let script = format!( - "try {{ Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy {value} -Force }} catch {{ Write-Output \"note: $($_.Exception.Message)\" }}" - ); - let out = ps(&powershell_exe(), &script, Duration::from_secs(60)).map_err(|e| e.to_string())?; - let now = exec_policy(Some("CurrentUser")).unwrap_or_default(); - if now.eq_ignore_ascii_case(value) { - Ok(()) + let policy = EXEC_POLICIES + .iter() + .find(|p| p.eq_ignore_ascii_case(value)) + .ok_or_else(|| format!("unexpected execution policy {value}"))?; + let written = if *policy == "Undefined" { + delete_value(PS_SHELL_KEY, "ExecutionPolicy") } else { - Err(format!("CurrentUser execution policy is {now} after setting {value}: {}", out.text())) - } + set_string(PS_SHELL_KEY, "ExecutionPolicy", policy) + }; + written.map_err(|e| format!("couldn't write the CurrentUser execution policy: {e}")) } pub fn policy_allows_profiles(policy: &str) -> bool { @@ -1136,20 +1161,40 @@ pub fn winget_uninstall(exe: &Path, id: &str) -> Result { } } -fn ps_quote(s: &str) -> String { - format!("'{}'", s.replace('\'', "''")) +pub fn install_appx_bundle(msixbundle: &Path, dependency_paths: &[PathBuf]) -> windows::core::Result<()> { + let deps = dependency_paths.iter().map(|p| file_uri(p).map(Some)).collect::>>()?; + let manager = PackageManager::new()?; + deployment_done(manager.AddPackageAsync(&file_uri(msixbundle)?, &IIterable::from(deps), DeploymentOptions::None)?) } -pub fn install_appx_bundle(msixbundle: &Path, dependency_paths: &[PathBuf]) -> std::io::Result { - let deps = dependency_paths.iter().map(|p| ps_quote(&p.display().to_string())).collect::>().join(","); - let script = - format!("Add-AppxPackage -Path {} -DependencyPath @({deps})", ps_quote(&msixbundle.display().to_string())); - ps(&powershell_exe(), &script, Duration::from_secs(600)) +pub fn remove_appx_package(name: &str) -> windows::core::Result { + let manager = PackageManager::new()?; + let mut full_names = Vec::new(); + for package in manager.FindPackagesByUserSecurityId(&HSTRING::new())? { + let id = package.Id()?; + if id.Name()?.to_string().eq_ignore_ascii_case(name) { + full_names.push(id.FullName()?); + } + } + for full_name in &full_names { + deployment_done(manager.RemovePackageAsync(full_name)?)?; + } + Ok(full_names.len()) } -pub fn remove_appx_package(name: &str) -> std::io::Result { - let script = format!("Get-AppxPackage -Name {} | Remove-AppxPackage", ps_quote(name)); - ps(&powershell_exe(), &script, Duration::from_secs(120)) +fn deployment_done(op: IAsyncOperationWithProgress) -> windows::core::Result<()> { + let result = op.join()?; + if op.Status()? == AsyncStatus::Completed { + return Ok(()); + } + Err(windows::core::Error::new(op.ErrorCode()?, result.ErrorText()?.to_string())) +} + +fn file_uri(path: &Path) -> windows::core::Result { + let mut buf = [0u16; 4096]; + let mut len = buf.len() as u32; + unsafe { UrlCreateFromPathW(&HSTRING::from(path), PWSTR(buf.as_mut_ptr()), &mut len, 0)? }; + Uri::CreateUri(&HSTRING::from_wide(&buf[..len as usize])) } #[cfg(test)] @@ -1162,9 +1207,49 @@ mod tests { } #[test] - fn ps_quoting() { - assert_eq!(super::ps_quote(r"C:\Users\test\file.exe"), r"'C:\Users\test\file.exe'"); - assert_eq!(super::ps_quote("C:\\Users\\O'Brien\\file.exe"), "'C:\\Users\\O''Brien\\file.exe'"); + fn group_policy_follows_enable_scripts() { + assert_eq!(super::group_policy(None, Some("Bypass".into())), None); + assert_eq!(super::group_policy(Some(0), Some("Bypass".into())), Some("Restricted")); + assert_eq!(super::group_policy(Some(1), Some("allsigned".into())), Some("AllSigned")); + assert_eq!(super::group_policy(Some(1), None), None); + assert_eq!(super::canonical_policy("Default"), "Restricted"); + } + + fn powershell_policies(script: &str) -> String { + let out = super::ps(&super::powershell_exe(), script, std::time::Duration::from_secs(120)).unwrap(); + assert!(out.success(), "{}", out.text()); + out.stdout.trim().to_string() + } + + #[test] + fn exec_policy_agrees_with_powershell() { + let list = powershell_policies( + "Get-ExecutionPolicy -List | ForEach-Object { '{0}={1}' -f $_.Scope, $_.ExecutionPolicy }", + ); + for (scope, policy) in list.lines().filter_map(|l| l.trim().split_once('=')).filter(|(s, _)| *s != "Process") { + assert_eq!(super::exec_policy(Some(scope)).as_deref(), Some(policy), "{scope}"); + } + + let before = super::exec_policy(Some("CurrentUser")).unwrap(); + let target = if before == "AllSigned" { "RemoteSigned" } else { "AllSigned" }; + let set = super::set_exec_policy_current_user(target); + let seen = powershell_policies("Get-ExecutionPolicy -Scope CurrentUser"); + let restored = super::set_exec_policy_current_user(&before); + let seen_after = powershell_policies("Get-ExecutionPolicy -Scope CurrentUser"); + set.unwrap(); + restored.unwrap(); + assert_eq!(seen, target); + assert_eq!(seen_after, before); + } + + #[test] + fn appx_calls_report_errors_instead_of_panicking() { + let missing = std::env::temp_dir().join("iiw test #1").join("missing.msixbundle"); + let uri = super::file_uri(&missing).unwrap(); + assert_eq!(uri.SchemeName().unwrap(), "file"); + assert!(uri.Path().unwrap().to_string().ends_with("/missing.msixbundle"), "{}", uri.AbsoluteUri().unwrap()); + assert!(super::install_appx_bundle(&missing, std::slice::from_ref(&missing)).unwrap_err().code().is_err()); + assert_eq!(super::remove_appx_package("IIW.Test.Missing").unwrap(), 0); } #[test] From 7cf5e6cc9bad56f4aa455ad3dabec9964d7060a6 Mon Sep 17 00:00:00 2001 From: nunreasonable Date: Mon, 9 Nov 2026 12:43:40 -0300 Subject: [PATCH 2/2] Let the uninstall remove winget even when the setup installed no terminal tools --- installer/app/src/main.rs | 2 ++ installer/ui/app.js | 5 +++-- installer/ui/i18n.js | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/installer/app/src/main.rs b/installer/app/src/main.rs index 47ae8d3..62b758a 100644 --- a/installer/app/src/main.rs +++ b/installer/app/src/main.rs @@ -113,6 +113,7 @@ struct InstalledInfo { tools: Vec, pwsh7_ours: bool, ffmpeg_ours: bool, + app_installer_ours: bool, fonts: usize, profiles: Vec, exec_policy_changed: bool, @@ -175,6 +176,7 @@ fn info(state: tauri::State<'_, AppState>) -> Info { .collect(), pwsh7_ours: m.has_winget(iiw_setup_core::PWSH_WINGET_ID), ffmpeg_ours: m.has_winget(iiw_setup_core::FFMPEG_WINGET_ID), + app_installer_ours: m.items.app_installer.is_some(), fonts: m.items.fonts.len(), profiles: m.items.profiles.iter().map(|p| p.path.display().to_string()).collect(), exec_policy_changed: m.items.exec_policy.as_ref().is_some_and(|c| c.changed), diff --git a/installer/ui/app.js b/installer/ui/app.js index b9ee415..5b5dbc5 100644 --- a/installer/ui/app.js +++ b/installer/ui/app.js @@ -483,10 +483,11 @@ html += checksCard(a); } else if (a === "uninstall") { const inst = info.installed; - if (!S.uopts) S.uopts = { remove_tools: inst.tools.length > 0, remove_pwsh7: inst.pwsh7_ours, remove_ffmpeg: inst.ffmpeg_ours, delete_user_data: false, restore_look: inst.has_pre_install }; + const tools = inst.app_installer_ours ? [...inst.tools, t("u_tools_winget")] : inst.tools; + if (!S.uopts) S.uopts = { remove_tools: tools.length > 0, remove_pwsh7: inst.pwsh7_ours, remove_ffmpeg: inst.ffmpeg_ours, delete_user_data: false, restore_look: inst.has_pre_install }; const u = S.uopts; html += `
${esc(t("card_options"))}
- ${switchRow("remove_tools", "terminal", t("u_tools"), esc(inst.tools.length ? inst.tools.join(", ") : t("u_tools_none")), u.remove_tools, { disabled: !inst.tools.length })} + ${switchRow("remove_tools", "terminal", t("u_tools"), esc(tools.length ? tools.join(", ") : t("u_tools_none")), u.remove_tools, { disabled: !tools.length })} ${inst.pwsh7_ours ? switchRow("remove_pwsh7", "pwsh", t("u_pwsh7"), esc(t("u_pwsh7_desc")), u.remove_pwsh7) : ""} ${inst.ffmpeg_ours ? switchRow("remove_ffmpeg", "box", t("u_ffmpeg"), esc(t("u_ffmpeg_desc")), u.remove_ffmpeg) : ""} ${switchRow("restore_look", "palette", t("u_restore"), esc(inst.has_pre_install ? t("u_restore_desc") : t("u_restore_none")), u.restore_look, { disabled: !inst.has_pre_install })} diff --git a/installer/ui/i18n.js b/installer/ui/i18n.js index b2df590..3f50326 100644 --- a/installer/ui/i18n.js +++ b/installer/ui/i18n.js @@ -133,6 +133,7 @@ window.I18N = { o_restart: "Start illogical-impulse again when done", u_tools: "Uninstall the terminal tools this setup installed", u_tools_none: "This setup didn't install any terminal tools.", + u_tools_winget: "winget (App Installer)", u_pwsh7: "Uninstall PowerShell 7", u_pwsh7_desc: "This setup installed it. Windows asks for administrator permission.", u_ffmpeg: "Uninstall FFmpeg", @@ -420,6 +421,7 @@ window.I18N = { o_restart: "Abrir o illogical-impulse de novo ao terminar", u_tools: "Desinstalar as ferramentas de terminal que este instalador instalou", u_tools_none: "Este instalador não instalou nenhuma ferramenta de terminal.", + u_tools_winget: "winget (Instalador de Aplicativo)", u_pwsh7: "Desinstalar o PowerShell 7", u_pwsh7_desc: "Foi este instalador que o instalou. O Windows pede permissão de administrador.", u_ffmpeg: "Desinstalar o FFmpeg",