From 572f9700cfa2a9b0ea65cf999796d5b76fe50136 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Fri, 12 May 2023 08:33:06 -0300 Subject: [PATCH] remove window from allowlist config --- core/tauri-config-schema/schema.json | 277 --------------------------- core/tauri-utils/src/config.rs | 108 ----------- examples/multiwindow/tauri.conf.json | 5 - examples/navigation/tauri.conf.json | 5 - tooling/cli/schema.json | 277 --------------------------- 5 files changed, 672 deletions(-) diff --git a/core/tauri-config-schema/schema.json b/core/tauri-config-schema/schema.json index 34f73f452..c844c3717 100644 --- a/core/tauri-config-schema/schema.json +++ b/core/tauri-config-schema/schema.json @@ -32,40 +32,6 @@ "all": false, "asset": false, "assetScope": [] - }, - "window": { - "all": false, - "center": false, - "close": false, - "create": false, - "hide": false, - "maximize": false, - "minimize": false, - "print": false, - "requestUserAttention": false, - "setAlwaysOnTop": false, - "setContentProtected": false, - "setCursorGrab": false, - "setCursorIcon": false, - "setCursorPosition": false, - "setCursorVisible": false, - "setDecorations": false, - "setFocus": false, - "setFullscreen": false, - "setIcon": false, - "setIgnoreCursorEvents": false, - "setMaxSize": false, - "setMinSize": false, - "setPosition": false, - "setResizable": false, - "setShadow": false, - "setSize": false, - "setSkipTaskbar": false, - "setTitle": false, - "show": false, - "startDragging": false, - "unmaximize": false, - "unminimize": false } }, "bundle": { @@ -252,40 +218,6 @@ "all": false, "asset": false, "assetScope": [] - }, - "window": { - "all": false, - "center": false, - "close": false, - "create": false, - "hide": false, - "maximize": false, - "minimize": false, - "print": false, - "requestUserAttention": false, - "setAlwaysOnTop": false, - "setContentProtected": false, - "setCursorGrab": false, - "setCursorIcon": false, - "setCursorPosition": false, - "setCursorVisible": false, - "setDecorations": false, - "setFocus": false, - "setFullscreen": false, - "setIcon": false, - "setIgnoreCursorEvents": false, - "setMaxSize": false, - "setMinSize": false, - "setPosition": false, - "setResizable": false, - "setShadow": false, - "setSize": false, - "setSkipTaskbar": false, - "setTitle": false, - "show": false, - "startDragging": false, - "unmaximize": false, - "unminimize": false } }, "allOf": [ @@ -1508,48 +1440,6 @@ "default": false, "type": "boolean" }, - "window": { - "description": "Window API allowlist.", - "default": { - "all": false, - "center": false, - "close": false, - "create": false, - "hide": false, - "maximize": false, - "minimize": false, - "print": false, - "requestUserAttention": false, - "setAlwaysOnTop": false, - "setContentProtected": false, - "setCursorGrab": false, - "setCursorIcon": false, - "setCursorPosition": false, - "setCursorVisible": false, - "setDecorations": false, - "setFocus": false, - "setFullscreen": false, - "setIcon": false, - "setIgnoreCursorEvents": false, - "setMaxSize": false, - "setMinSize": false, - "setPosition": false, - "setResizable": false, - "setShadow": false, - "setSize": false, - "setSkipTaskbar": false, - "setTitle": false, - "show": false, - "startDragging": false, - "unmaximize": false, - "unminimize": false - }, - "allOf": [ - { - "$ref": "#/definitions/WindowAllowlistConfig" - } - ] - }, "protocol": { "description": "Custom protocol allowlist.", "default": { @@ -1566,173 +1456,6 @@ }, "additionalProperties": false }, - "WindowAllowlistConfig": { - "description": "Allowlist for the window APIs.\n\nSee more: https://tauri.app/v1/api/config#windowallowlistconfig", - "type": "object", - "properties": { - "all": { - "description": "Use this flag to enable all window API features.", - "default": false, - "type": "boolean" - }, - "create": { - "description": "Allows dynamic window creation.", - "default": false, - "type": "boolean" - }, - "center": { - "description": "Allows centering the window.", - "default": false, - "type": "boolean" - }, - "requestUserAttention": { - "description": "Allows requesting user attention on the window.", - "default": false, - "type": "boolean" - }, - "setResizable": { - "description": "Allows setting the resizable flag of the window.", - "default": false, - "type": "boolean" - }, - "setTitle": { - "description": "Allows changing the window title.", - "default": false, - "type": "boolean" - }, - "maximize": { - "description": "Allows maximizing the window.", - "default": false, - "type": "boolean" - }, - "unmaximize": { - "description": "Allows unmaximizing the window.", - "default": false, - "type": "boolean" - }, - "minimize": { - "description": "Allows minimizing the window.", - "default": false, - "type": "boolean" - }, - "unminimize": { - "description": "Allows unminimizing the window.", - "default": false, - "type": "boolean" - }, - "show": { - "description": "Allows showing the window.", - "default": false, - "type": "boolean" - }, - "hide": { - "description": "Allows hiding the window.", - "default": false, - "type": "boolean" - }, - "close": { - "description": "Allows closing the window.", - "default": false, - "type": "boolean" - }, - "setDecorations": { - "description": "Allows setting the decorations flag of the window.", - "default": false, - "type": "boolean" - }, - "setShadow": { - "description": "Allows setting the shadow flag of the window.", - "default": false, - "type": "boolean" - }, - "setAlwaysOnTop": { - "description": "Allows setting the always_on_top flag of the window.", - "default": false, - "type": "boolean" - }, - "setContentProtected": { - "description": "Allows preventing the window contents from being captured by other apps.", - "default": false, - "type": "boolean" - }, - "setSize": { - "description": "Allows setting the window size.", - "default": false, - "type": "boolean" - }, - "setMinSize": { - "description": "Allows setting the window minimum size.", - "default": false, - "type": "boolean" - }, - "setMaxSize": { - "description": "Allows setting the window maximum size.", - "default": false, - "type": "boolean" - }, - "setPosition": { - "description": "Allows changing the position of the window.", - "default": false, - "type": "boolean" - }, - "setFullscreen": { - "description": "Allows setting the fullscreen flag of the window.", - "default": false, - "type": "boolean" - }, - "setFocus": { - "description": "Allows focusing the window.", - "default": false, - "type": "boolean" - }, - "setIcon": { - "description": "Allows changing the window icon.", - "default": false, - "type": "boolean" - }, - "setSkipTaskbar": { - "description": "Allows setting the skip_taskbar flag of the window.", - "default": false, - "type": "boolean" - }, - "setCursorGrab": { - "description": "Allows grabbing the cursor.", - "default": false, - "type": "boolean" - }, - "setCursorVisible": { - "description": "Allows setting the cursor visibility.", - "default": false, - "type": "boolean" - }, - "setCursorIcon": { - "description": "Allows changing the cursor icon.", - "default": false, - "type": "boolean" - }, - "setCursorPosition": { - "description": "Allows setting the cursor position.", - "default": false, - "type": "boolean" - }, - "setIgnoreCursorEvents": { - "description": "Allows ignoring cursor events.", - "default": false, - "type": "boolean" - }, - "startDragging": { - "description": "Allows start dragging on the window.", - "default": false, - "type": "boolean" - }, - "print": { - "description": "Allows opening the system dialog to print the window content.", - "default": false, - "type": "boolean" - } - }, - "additionalProperties": false - }, "ProtocolAllowlistConfig": { "description": "Allowlist for the custom protocols.\n\nSee more: https://tauri.app/v1/api/config#protocolallowlistconfig", "type": "object", diff --git a/core/tauri-utils/src/config.rs b/core/tauri-utils/src/config.rs index 68eac2a8b..9b67d6330 100644 --- a/core/tauri-utils/src/config.rs +++ b/core/tauri-utils/src/config.rs @@ -1152,111 +1152,6 @@ macro_rules! check_feature { }; } -/// Allowlist for the window APIs. -/// -/// See more: https://tauri.app/v1/api/config#windowallowlistconfig -#[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)] -#[cfg_attr(feature = "schema", derive(JsonSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct WindowAllowlistConfig { - /// Use this flag to enable all window API features. - #[serde(default)] - pub all: bool, - /// Allows dynamic window creation. - #[serde(default)] - pub create: bool, - /// Allows centering the window. - #[serde(default)] - pub center: bool, - /// Allows requesting user attention on the window. - #[serde(default, alias = "request-user-attention")] - pub request_user_attention: bool, - /// Allows setting the resizable flag of the window. - #[serde(default, alias = "set-resizable")] - pub set_resizable: bool, - /// Allows changing the window title. - #[serde(default, alias = "set-title")] - pub set_title: bool, - /// Allows maximizing the window. - #[serde(default)] - pub maximize: bool, - /// Allows unmaximizing the window. - #[serde(default)] - pub unmaximize: bool, - /// Allows minimizing the window. - #[serde(default)] - pub minimize: bool, - /// Allows unminimizing the window. - #[serde(default)] - pub unminimize: bool, - /// Allows showing the window. - #[serde(default)] - pub show: bool, - /// Allows hiding the window. - #[serde(default)] - pub hide: bool, - /// Allows closing the window. - #[serde(default)] - pub close: bool, - /// Allows setting the decorations flag of the window. - #[serde(default, alias = "set-decorations")] - pub set_decorations: bool, - /// Allows setting the shadow flag of the window. - #[serde(default, alias = "set-shadow")] - pub set_shadow: bool, - /// 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, - /// Allows setting the window minimum size. - #[serde(default, alias = "set-min-size")] - pub set_min_size: bool, - /// Allows setting the window maximum size. - #[serde(default, alias = "set-max-size")] - pub set_max_size: bool, - /// Allows changing the position of the window. - #[serde(default, alias = "set-position")] - pub set_position: bool, - /// Allows setting the fullscreen flag of the window. - #[serde(default, alias = "set-fullscreen")] - pub set_fullscreen: bool, - /// Allows focusing the window. - #[serde(default, alias = "set-focus")] - pub set_focus: bool, - /// Allows changing the window icon. - #[serde(default, alias = "set-icon")] - pub set_icon: bool, - /// Allows setting the skip_taskbar flag of the window. - #[serde(default, alias = "set-skip-taskbar")] - pub set_skip_taskbar: bool, - /// Allows grabbing the cursor. - #[serde(default, alias = "set-cursor-grab")] - pub set_cursor_grab: bool, - /// Allows setting the cursor visibility. - #[serde(default, alias = "set-cursor-visible")] - pub set_cursor_visible: bool, - /// Allows changing the cursor icon. - #[serde(default, alias = "set-cursor-icon")] - pub set_cursor_icon: bool, - /// Allows setting the cursor position. - #[serde(default, alias = "set-cursor-position")] - pub set_cursor_position: bool, - /// Allows ignoring cursor events. - #[serde(default, alias = "set-ignore-cursor-events")] - pub set_ignore_cursor_events: bool, - /// Allows start dragging on the window. - #[serde(default, alias = "start-dragging")] - pub start_dragging: bool, - /// Allows opening the system dialog to print the window content. - #[serde(default)] - pub print: bool, -} - /// Protocol scope definition. /// It is a list of glob patterns that restrict the API access from the webview. /// @@ -1365,9 +1260,6 @@ pub struct AllowlistConfig { /// Use this flag to enable all API features. #[serde(default)] pub all: bool, - /// Window API allowlist. - #[serde(default)] - pub window: WindowAllowlistConfig, /// Custom protocol allowlist. #[serde(default)] pub protocol: ProtocolAllowlistConfig, diff --git a/examples/multiwindow/tauri.conf.json b/examples/multiwindow/tauri.conf.json index d8332d40a..3c0b34ad9 100644 --- a/examples/multiwindow/tauri.conf.json +++ b/examples/multiwindow/tauri.conf.json @@ -26,11 +26,6 @@ "copyright": "", "category": "DeveloperTool" }, - "allowlist": { - "window": { - "create": true - } - }, "windows": [ { "label": "Main", diff --git a/examples/navigation/tauri.conf.json b/examples/navigation/tauri.conf.json index 1c079a3b7..97378e737 100644 --- a/examples/navigation/tauri.conf.json +++ b/examples/navigation/tauri.conf.json @@ -37,11 +37,6 @@ "exceptionDomain": "" } }, - "allowlist": { - "window": { - "create": true - } - }, "windows": [ { "title": "Welcome to Tauri!", diff --git a/tooling/cli/schema.json b/tooling/cli/schema.json index 34f73f452..c844c3717 100644 --- a/tooling/cli/schema.json +++ b/tooling/cli/schema.json @@ -32,40 +32,6 @@ "all": false, "asset": false, "assetScope": [] - }, - "window": { - "all": false, - "center": false, - "close": false, - "create": false, - "hide": false, - "maximize": false, - "minimize": false, - "print": false, - "requestUserAttention": false, - "setAlwaysOnTop": false, - "setContentProtected": false, - "setCursorGrab": false, - "setCursorIcon": false, - "setCursorPosition": false, - "setCursorVisible": false, - "setDecorations": false, - "setFocus": false, - "setFullscreen": false, - "setIcon": false, - "setIgnoreCursorEvents": false, - "setMaxSize": false, - "setMinSize": false, - "setPosition": false, - "setResizable": false, - "setShadow": false, - "setSize": false, - "setSkipTaskbar": false, - "setTitle": false, - "show": false, - "startDragging": false, - "unmaximize": false, - "unminimize": false } }, "bundle": { @@ -252,40 +218,6 @@ "all": false, "asset": false, "assetScope": [] - }, - "window": { - "all": false, - "center": false, - "close": false, - "create": false, - "hide": false, - "maximize": false, - "minimize": false, - "print": false, - "requestUserAttention": false, - "setAlwaysOnTop": false, - "setContentProtected": false, - "setCursorGrab": false, - "setCursorIcon": false, - "setCursorPosition": false, - "setCursorVisible": false, - "setDecorations": false, - "setFocus": false, - "setFullscreen": false, - "setIcon": false, - "setIgnoreCursorEvents": false, - "setMaxSize": false, - "setMinSize": false, - "setPosition": false, - "setResizable": false, - "setShadow": false, - "setSize": false, - "setSkipTaskbar": false, - "setTitle": false, - "show": false, - "startDragging": false, - "unmaximize": false, - "unminimize": false } }, "allOf": [ @@ -1508,48 +1440,6 @@ "default": false, "type": "boolean" }, - "window": { - "description": "Window API allowlist.", - "default": { - "all": false, - "center": false, - "close": false, - "create": false, - "hide": false, - "maximize": false, - "minimize": false, - "print": false, - "requestUserAttention": false, - "setAlwaysOnTop": false, - "setContentProtected": false, - "setCursorGrab": false, - "setCursorIcon": false, - "setCursorPosition": false, - "setCursorVisible": false, - "setDecorations": false, - "setFocus": false, - "setFullscreen": false, - "setIcon": false, - "setIgnoreCursorEvents": false, - "setMaxSize": false, - "setMinSize": false, - "setPosition": false, - "setResizable": false, - "setShadow": false, - "setSize": false, - "setSkipTaskbar": false, - "setTitle": false, - "show": false, - "startDragging": false, - "unmaximize": false, - "unminimize": false - }, - "allOf": [ - { - "$ref": "#/definitions/WindowAllowlistConfig" - } - ] - }, "protocol": { "description": "Custom protocol allowlist.", "default": { @@ -1566,173 +1456,6 @@ }, "additionalProperties": false }, - "WindowAllowlistConfig": { - "description": "Allowlist for the window APIs.\n\nSee more: https://tauri.app/v1/api/config#windowallowlistconfig", - "type": "object", - "properties": { - "all": { - "description": "Use this flag to enable all window API features.", - "default": false, - "type": "boolean" - }, - "create": { - "description": "Allows dynamic window creation.", - "default": false, - "type": "boolean" - }, - "center": { - "description": "Allows centering the window.", - "default": false, - "type": "boolean" - }, - "requestUserAttention": { - "description": "Allows requesting user attention on the window.", - "default": false, - "type": "boolean" - }, - "setResizable": { - "description": "Allows setting the resizable flag of the window.", - "default": false, - "type": "boolean" - }, - "setTitle": { - "description": "Allows changing the window title.", - "default": false, - "type": "boolean" - }, - "maximize": { - "description": "Allows maximizing the window.", - "default": false, - "type": "boolean" - }, - "unmaximize": { - "description": "Allows unmaximizing the window.", - "default": false, - "type": "boolean" - }, - "minimize": { - "description": "Allows minimizing the window.", - "default": false, - "type": "boolean" - }, - "unminimize": { - "description": "Allows unminimizing the window.", - "default": false, - "type": "boolean" - }, - "show": { - "description": "Allows showing the window.", - "default": false, - "type": "boolean" - }, - "hide": { - "description": "Allows hiding the window.", - "default": false, - "type": "boolean" - }, - "close": { - "description": "Allows closing the window.", - "default": false, - "type": "boolean" - }, - "setDecorations": { - "description": "Allows setting the decorations flag of the window.", - "default": false, - "type": "boolean" - }, - "setShadow": { - "description": "Allows setting the shadow flag of the window.", - "default": false, - "type": "boolean" - }, - "setAlwaysOnTop": { - "description": "Allows setting the always_on_top flag of the window.", - "default": false, - "type": "boolean" - }, - "setContentProtected": { - "description": "Allows preventing the window contents from being captured by other apps.", - "default": false, - "type": "boolean" - }, - "setSize": { - "description": "Allows setting the window size.", - "default": false, - "type": "boolean" - }, - "setMinSize": { - "description": "Allows setting the window minimum size.", - "default": false, - "type": "boolean" - }, - "setMaxSize": { - "description": "Allows setting the window maximum size.", - "default": false, - "type": "boolean" - }, - "setPosition": { - "description": "Allows changing the position of the window.", - "default": false, - "type": "boolean" - }, - "setFullscreen": { - "description": "Allows setting the fullscreen flag of the window.", - "default": false, - "type": "boolean" - }, - "setFocus": { - "description": "Allows focusing the window.", - "default": false, - "type": "boolean" - }, - "setIcon": { - "description": "Allows changing the window icon.", - "default": false, - "type": "boolean" - }, - "setSkipTaskbar": { - "description": "Allows setting the skip_taskbar flag of the window.", - "default": false, - "type": "boolean" - }, - "setCursorGrab": { - "description": "Allows grabbing the cursor.", - "default": false, - "type": "boolean" - }, - "setCursorVisible": { - "description": "Allows setting the cursor visibility.", - "default": false, - "type": "boolean" - }, - "setCursorIcon": { - "description": "Allows changing the cursor icon.", - "default": false, - "type": "boolean" - }, - "setCursorPosition": { - "description": "Allows setting the cursor position.", - "default": false, - "type": "boolean" - }, - "setIgnoreCursorEvents": { - "description": "Allows ignoring cursor events.", - "default": false, - "type": "boolean" - }, - "startDragging": { - "description": "Allows start dragging on the window.", - "default": false, - "type": "boolean" - }, - "print": { - "description": "Allows opening the system dialog to print the window content.", - "default": false, - "type": "boolean" - } - }, - "additionalProperties": false - }, "ProtocolAllowlistConfig": { "description": "Allowlist for the custom protocols.\n\nSee more: https://tauri.app/v1/api/config#protocolallowlistconfig", "type": "object",