|
@@ -78,6 +78,8 @@ pub enum BundleType {
|
|
|
AppImage,
|
|
|
/// The Microsoft Installer bundle (.msi).
|
|
|
Msi,
|
|
|
+ /// The NSIS bundle (.exe).
|
|
|
+ Nsis,
|
|
|
/// The macOS application bundle (.app).
|
|
|
App,
|
|
|
/// The Apple Disk Image bundle (.dmg).
|
|
@@ -95,6 +97,7 @@ impl Display for BundleType {
|
|
|
Self::Deb => "deb",
|
|
|
Self::AppImage => "appimage",
|
|
|
Self::Msi => "msi",
|
|
|
+ Self::Nsis => "nsis",
|
|
|
Self::App => "app",
|
|
|
Self::Dmg => "dmg",
|
|
|
Self::Updater => "updater",
|
|
@@ -122,6 +125,7 @@ impl<'de> Deserialize<'de> for BundleType {
|
|
|
"deb" => Ok(Self::Deb),
|
|
|
"appimage" => Ok(Self::AppImage),
|
|
|
"msi" => Ok(Self::Msi),
|
|
|
+ "nsis" => Ok(Self::Nsis),
|
|
|
"app" => Ok(Self::App),
|
|
|
"dmg" => Ok(Self::Dmg),
|
|
|
"updater" => Ok(Self::Updater),
|
|
@@ -416,6 +420,71 @@ pub struct WixConfig {
|
|
|
pub dialog_image_path: Option<PathBuf>,
|
|
|
}
|
|
|
|
|
|
+/// Configuration for the Installer bundle using NSIS.
|
|
|
+#[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
|
|
|
+#[cfg_attr(feature = "schema", derive(JsonSchema))]
|
|
|
+#[serde(rename_all = "camelCase", deny_unknown_fields)]
|
|
|
+pub struct NsisConfig {
|
|
|
+ /// The path to the license file to render on the installer.
|
|
|
+ pub license: Option<PathBuf>,
|
|
|
+ /// The path to a bitmap file to display on the header of installers pages.
|
|
|
+ ///
|
|
|
+ /// The recommended dimensions are 150px x 57px.
|
|
|
+ #[serde(alias = "header-image")]
|
|
|
+ pub header_image: Option<PathBuf>,
|
|
|
+ /// The path to a bitmap file for the Welcome page and the Finish page.
|
|
|
+ ///
|
|
|
+ /// The recommended dimensions are 164px x 314px.
|
|
|
+ #[serde(alias = "sidebar-image")]
|
|
|
+ pub sidebar_image: Option<PathBuf>,
|
|
|
+ /// The path to an icon file used as the installer icon.
|
|
|
+ #[serde(alias = "install-icon")]
|
|
|
+ pub installer_icon: Option<PathBuf>,
|
|
|
+ /// Whether the installation will be for all users or just the current user.
|
|
|
+ #[serde(default, alias = "install-mode")]
|
|
|
+ pub install_mode: NSISInstallerMode,
|
|
|
+ /// A list of installer languages.
|
|
|
+ /// By default the OS language is used. If the OS language is not in the list of languages, the first language will be used.
|
|
|
+ /// To allow the user to select the language, set `display_language_selector` to `true`.
|
|
|
+ ///
|
|
|
+ /// See <https://github.com/kichik/nsis/tree/9465c08046f00ccb6eda985abbdbf52c275c6c4d/Contrib/Language%20files> for the complete list of languages.
|
|
|
+ pub languages: Option<Vec<String>>,
|
|
|
+ /// Whether to display a language selector dialog before the installer and uninstaller windows are rendered or not.
|
|
|
+ /// By default the OS language is selected, with a fallback to the first language in the `languages` array.
|
|
|
+ #[serde(default, alias = "display-language-selector")]
|
|
|
+ pub display_language_selector: bool,
|
|
|
+}
|
|
|
+
|
|
|
+/// Install Modes for the NSIS installer.
|
|
|
+#[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize, Deserialize)]
|
|
|
+#[serde(rename_all = "camelCase", deny_unknown_fields)]
|
|
|
+#[cfg_attr(feature = "schema", derive(JsonSchema))]
|
|
|
+pub enum NSISInstallerMode {
|
|
|
+ /// Default mode for the installer.
|
|
|
+ ///
|
|
|
+ /// Install the app by default in a directory that doesn't require Administrator access.
|
|
|
+ ///
|
|
|
+ /// Installer metadata will be saved under the `HKCU` registry path.
|
|
|
+ CurrentUser,
|
|
|
+ /// Install the app by default in the `Program Files` folder directory requires Administrator
|
|
|
+ /// access for the installation.
|
|
|
+ ///
|
|
|
+ /// Installer metadata will be saved under the `HKLM` registry path.
|
|
|
+ PerMachine,
|
|
|
+ /// Combines both modes and allows the user to choose at install time
|
|
|
+ /// whether to install for the current user or per machine. Note that this mode
|
|
|
+ /// will require Administrator access even if the user wants to install it for the current user only.
|
|
|
+ ///
|
|
|
+ /// Installer metadata will be saved under the `HKLM` or `HKCU` registry path based on the user's choice.
|
|
|
+ Both,
|
|
|
+}
|
|
|
+
|
|
|
+impl Default for NSISInstallerMode {
|
|
|
+ fn default() -> Self {
|
|
|
+ Self::CurrentUser
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
/// Install modes for the Webview2 runtime.
|
|
|
/// Note that for the updater bundle [`Self::DownloadBootstrapper`] is used.
|
|
|
///
|
|
@@ -508,6 +577,8 @@ pub struct WindowsConfig {
|
|
|
pub allow_downgrades: bool,
|
|
|
/// Configuration for the MSI generated with WiX.
|
|
|
pub wix: Option<WixConfig>,
|
|
|
+ /// Configuration for the installer generated with NSIS.
|
|
|
+ pub nsis: Option<NsisConfig>,
|
|
|
}
|
|
|
|
|
|
impl Default for WindowsConfig {
|
|
@@ -521,6 +592,7 @@ impl Default for WindowsConfig {
|
|
|
webview_fixed_runtime_path: None,
|
|
|
allow_downgrades: default_true(),
|
|
|
wix: None,
|
|
|
+ nsis: None,
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -534,7 +606,7 @@ pub struct BundleConfig {
|
|
|
/// Whether Tauri should bundle your application or just output the executable.
|
|
|
#[serde(default)]
|
|
|
pub active: bool,
|
|
|
- /// The bundle targets, currently supports ["deb", "appimage", "msi", "app", "dmg", "updater"] or "all".
|
|
|
+ /// The bundle targets, currently supports ["deb", "appimage", "nsis", "msi", "app", "dmg", "updater"] or "all".
|
|
|
#[serde(default)]
|
|
|
pub targets: BundleTarget,
|
|
|
/// The application identifier in reverse domain name notation (e.g. `com.tauri.example`).
|
|
@@ -854,6 +926,9 @@ pub struct WindowConfig {
|
|
|
/// Whether the window should always be on top of other windows.
|
|
|
#[serde(default, alias = "always-on-top")]
|
|
|
pub always_on_top: bool,
|
|
|
+ /// Prevents the window contents from being captured by other apps.
|
|
|
+ #[serde(default, alias = "content-protected")]
|
|
|
+ pub content_protected: bool,
|
|
|
/// If `true`, hides the window icon from the taskbar on Windows and Linux.
|
|
|
#[serde(default, alias = "skip-taskbar")]
|
|
|
pub skip_taskbar: bool,
|
|
@@ -876,6 +951,10 @@ pub struct WindowConfig {
|
|
|
/// [tabbing identifier]: <https://developer.apple.com/documentation/appkit/nswindow/1644704-tabbingidentifier>
|
|
|
#[serde(default, alias = "tabbing-identifier")]
|
|
|
pub tabbing_identifier: Option<String>,
|
|
|
+ /// Defines additional browser arguments on Windows. By default wry passes `--disable-features=msWebOOUI,msPdfOOUI,msSmartScreenProtection`
|
|
|
+ /// so if you use this method, you also need to disable these components by yourself if you want.
|
|
|
+ #[serde(default, alias = "additional-browser-args")]
|
|
|
+ pub additional_browser_args: Option<String>,
|
|
|
/// Whether or not the window has shadow.
|
|
|
///
|
|
|
/// ## Platform-specific
|
|
@@ -914,12 +993,14 @@ impl Default for WindowConfig {
|
|
|
visible: default_true(),
|
|
|
decorations: default_true(),
|
|
|
always_on_top: false,
|
|
|
+ content_protected: false,
|
|
|
skip_taskbar: false,
|
|
|
theme: None,
|
|
|
title_bar_style: Default::default(),
|
|
|
hidden_title: false,
|
|
|
accept_first_mouse: false,
|
|
|
tabbing_identifier: None,
|
|
|
+ additional_browser_args: None,
|
|
|
shadow: false,
|
|
|
}
|
|
|
}
|
|
@@ -1323,6 +1404,9 @@ pub struct WindowAllowlistConfig {
|
|
|
/// Allows setting the always_on_top flag of the window.
|
|
|
#[serde(default, alias = "set-always-on-top")]
|
|
|
pub set_always_on_top: bool,
|
|
|
+ /// Allows preventing the window contents from being captured by other apps.
|
|
|
+ #[serde(default, alias = "set-content-protected")]
|
|
|
+ pub set_content_protected: bool,
|
|
|
/// Allows setting the window size.
|
|
|
#[serde(default, alias = "set-size")]
|
|
|
pub set_size: bool,
|
|
@@ -1388,6 +1472,7 @@ impl Allowlist for WindowAllowlistConfig {
|
|
|
close: true,
|
|
|
set_decorations: true,
|
|
|
set_always_on_top: true,
|
|
|
+ set_content_protected: false,
|
|
|
set_size: true,
|
|
|
set_min_size: true,
|
|
|
set_max_size: true,
|
|
@@ -1440,6 +1525,12 @@ impl Allowlist for WindowAllowlistConfig {
|
|
|
set_always_on_top,
|
|
|
"window-set-always-on-top"
|
|
|
);
|
|
|
+ check_feature!(
|
|
|
+ self,
|
|
|
+ features,
|
|
|
+ set_content_protected,
|
|
|
+ "window-set-content-protected"
|
|
|
+ );
|
|
|
check_feature!(self, features, set_size, "window-set-size");
|
|
|
check_feature!(self, features, set_min_size, "window-set-min-size");
|
|
|
check_feature!(self, features, set_max_size, "window-set-max-size");
|
|
@@ -1595,7 +1686,7 @@ pub struct ShellAllowlistScope(pub Vec<ShellAllowedCommand>);
|
|
|
pub enum ShellAllowlistOpen {
|
|
|
/// If the shell open API should be enabled.
|
|
|
///
|
|
|
- /// If enabled, the default validation regex (`^https?://`) is used.
|
|
|
+ /// If enabled, the default validation regex (`^((mailto:\w+)|(tel:\w+)|(https?://\w+)).+`) is used.
|
|
|
Flag(bool),
|
|
|
|
|
|
/// Enable the shell open API, with a custom regex that the opened path must match against.
|
|
@@ -2058,7 +2149,16 @@ impl Allowlist for AppAllowlistConfig {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-/// Allowlist configuration.
|
|
|
+/// Allowlist configuration. The allowlist is a translation of the [Cargo allowlist features](https://docs.rs/tauri/latest/tauri/#cargo-allowlist-features).
|
|
|
+///
|
|
|
+/// # Notes
|
|
|
+///
|
|
|
+/// - Endpoints that don't have their own allowlist option are enabled by default.
|
|
|
+/// - There is only "opt-in", no "opt-out". Setting an option to `false` has no effect.
|
|
|
+///
|
|
|
+/// # Examples
|
|
|
+///
|
|
|
+/// - * [`"app-all": true`](https://tauri.app/v1/api/config/#appallowlistconfig.all) will make the [hide](https://tauri.app/v1/api/js/app#hide) endpoint be available regardless of whether `hide` is set to `false` or `true` in the allowlist.
|
|
|
#[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
|
|
|
#[cfg_attr(feature = "schema", derive(JsonSchema))]
|
|
|
#[serde(rename_all = "camelCase", deny_unknown_fields)]
|
|
@@ -2283,7 +2383,7 @@ pub enum WindowsUpdateInstallMode {
|
|
|
/// Specifies there's a basic UI during the installation process, including a final dialog box at the end.
|
|
|
BasicUi,
|
|
|
/// The quiet mode means there's no user interaction required.
|
|
|
- /// Requires admin privileges if the installer does.
|
|
|
+ /// Requires admin privileges if the installer does (WiX).
|
|
|
Quiet,
|
|
|
/// Specifies unattended mode, which means the installation only shows a progress bar.
|
|
|
Passive,
|
|
@@ -2354,6 +2454,9 @@ impl<'de> Deserialize<'de> for WindowsUpdateInstallMode {
|
|
|
#[cfg_attr(feature = "schema", derive(JsonSchema))]
|
|
|
#[serde(rename_all = "camelCase", deny_unknown_fields)]
|
|
|
pub struct UpdaterWindowsConfig {
|
|
|
+ /// Additional arguments given to the NSIS or WiX installer.
|
|
|
+ #[serde(default, alias = "installer-args")]
|
|
|
+ pub installer_args: Vec<String>,
|
|
|
/// The installation mode for the update on Windows. Defaults to `passive`.
|
|
|
#[serde(default, alias = "install-mode")]
|
|
|
pub install_mode: WindowsUpdateInstallMode,
|
|
@@ -3033,12 +3136,14 @@ mod build {
|
|
|
let visible = self.visible;
|
|
|
let decorations = self.decorations;
|
|
|
let always_on_top = self.always_on_top;
|
|
|
+ let content_protected = self.content_protected;
|
|
|
let skip_taskbar = self.skip_taskbar;
|
|
|
let theme = opt_lit(self.theme.as_ref());
|
|
|
let title_bar_style = &self.title_bar_style;
|
|
|
let hidden_title = self.hidden_title;
|
|
|
let accept_first_mouse = self.accept_first_mouse;
|
|
|
let tabbing_identifier = opt_str_lit(self.tabbing_identifier.as_ref());
|
|
|
+ let additional_browser_args = opt_str_lit(self.additional_browser_args.as_ref());
|
|
|
let shadow = self.shadow;
|
|
|
|
|
|
literal_struct!(
|
|
@@ -3066,12 +3171,14 @@ mod build {
|
|
|
visible,
|
|
|
decorations,
|
|
|
always_on_top,
|
|
|
+ content_protected,
|
|
|
skip_taskbar,
|
|
|
theme,
|
|
|
title_bar_style,
|
|
|
hidden_title,
|
|
|
accept_first_mouse,
|
|
|
tabbing_identifier,
|
|
|
+ additional_browser_args,
|
|
|
shadow
|
|
|
);
|
|
|
}
|
|
@@ -3330,7 +3437,8 @@ mod build {
|
|
|
impl ToTokens for UpdaterWindowsConfig {
|
|
|
fn to_tokens(&self, tokens: &mut TokenStream) {
|
|
|
let install_mode = &self.install_mode;
|
|
|
- literal_struct!(tokens, UpdaterWindowsConfig, install_mode);
|
|
|
+ let installer_args = vec_lit(&self.installer_args, str_lit);
|
|
|
+ literal_struct!(tokens, UpdaterWindowsConfig, install_mode, installer_args);
|
|
|
}
|
|
|
}
|
|
|
|