mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 18:18:55 +00:00
windows: tell Windows that our release builds should always run as admin (#2838)
It'll show UAC when you first run the app. After that we can open and close the VPN network adapter without showing more UAC dialogs since we have sudo powers.
This commit is contained in:
@@ -6,6 +6,7 @@ description = "Firezone Windows Client"
|
||||
edition = "2021"
|
||||
|
||||
[build-dependencies]
|
||||
anyhow = { version = "1.0" }
|
||||
tauri-build = { version = "1.5", features = [] }
|
||||
|
||||
[dependencies]
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
fn main() {
|
||||
tauri_build::build()
|
||||
fn main() -> anyhow::Result<()> {
|
||||
let win = tauri_build::WindowsAttributes::new().app_manifest(WINDOWS_MANIFEST);
|
||||
let attr = tauri_build::Attributes::new().windows_attributes(win);
|
||||
tauri_build::try_build(attr)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// If we ask for admin privilege in the manifest, we can't run in Cygwin,
|
||||
// which makes debugging hard on my dev system.
|
||||
// So always ask for it in Release, which is simpler for users, and in Release
|
||||
// mode we run as a GUI so we lose stdout/stderr anyway.
|
||||
// If you need admin privileges for debugging, you can right-click the debug exe.
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
const WINDOWS_MANIFEST: &str = include_str!("firezone-windows-client-debug.manifest");
|
||||
|
||||
#[cfg(not(debug_assertions))]
|
||||
const WINDOWS_MANIFEST: &str = include_str!("firezone-windows-client-release.manifest");
|
||||
|
||||
14
rust/windows-client/src-tauri/firezone-windows-client-debug.manifest
Executable file
14
rust/windows-client/src-tauri/firezone-windows-client-debug.manifest
Executable file
@@ -0,0 +1,14 @@
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
</assembly>
|
||||
22
rust/windows-client/src-tauri/firezone-windows-client-release.manifest
Executable file
22
rust/windows-client/src-tauri/firezone-windows-client-release.manifest
Executable file
@@ -0,0 +1,22 @@
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<security>
|
||||
<requestedPrivileges>
|
||||
<!-- Ask Windows to always run us with admin privilege -->
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
</assembly>
|
||||
Reference in New Issue
Block a user