{ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://schema.tauri.app/config/2.9.5", "title": "Config", "description": "Tauri 配置对象。\n 它从文件中读取,您可以在其中定义前端资源,\n 配置打包器并定义托盘图标。\n\n 配置文件由\n [`tauri init`](https://v2.tauri.app/reference/cli/#init) 命令生成,该命令位于\n Tauri 应用程序源目录 (src-tauri) 中。\n\n 生成后,您可以随意修改它以自定义 Tauri 应用程序。\n\n ## 文件格式\n\n 默认情况下,配置被定义为一个名为 `tauri.conf.json` 的 JSON 文件。\n\n Tauri 还通过 `config-json5` 和 `config-toml` Cargo 功能分别支持 JSON5 和 TOML 文件。\n JSON5 文件名必须是 `tauri.conf.json` 或 `tauri.conf.json5`。\n TOML 文件名必须是 `Tauri.toml`。\n\n ## 平台特定配置\n\n 除了默认配置文件外,Tauri 还\n 可以从 `tauri.linux.conf.json`、\n `tauri.windows.conf.json`、`tauri.macos.conf.json`、`tauri.android.conf.json` 和 `tauri.ios.conf.json`\n (或如果使用 `Tauri.toml` 格式,则为 `Tauri.linux.toml`、`Tauri.windows.toml`、`Tauri.macos.toml`、`Tauri.android.toml` 和 `Tauri.ios.toml`)\n 读取平台特定配置,\n 这些配置将与主配置对象合并。\n\n ## 配置结构\n\n 配置由以下对象组成:\n\n - [`app`](#appconfig): Tauri 配置\n - [`build`](#buildconfig): 构建配置\n - [`bundle`](#bundleconfig): 打包配置\n - [`plugins`](#pluginconfig): 插件配置\n\n 示例 tauri.config.json 文件:\n\n ```json\n {\n \"productName\": \"tauri-app\",\n \"version\": \"0.1.0\",\n \"build\": {\n \"beforeBuildCommand\": \"\",\n \"beforeDevCommand\": \"\",\n \"devUrl\": \"http://localhost:3000\",\n \"frontendDist\": \"../dist\"\n },\n \"app\": {\n \"security\": {\n \"csp\": null\n },\n \"windows\": [\n {\n \"fullscreen\": false,\n \"height\": 600,\n \"resizable\": true,\n \"title\": \"Tauri App\",\n \"width\": 800\n }\n ]\n },\n \"bundle\": {},\n \"plugins\": {}\n }\n ```", "type": "object", "required": ["identifier"], "properties": { "$schema": { "description": "Tauri 配置的 JSON schema。", "type": ["string", "null"] }, "productName": { "description": "应用程序名称。", "type": ["string", "null"], "pattern": "^[^/\\:*?\"<>|]+$" }, "mainBinaryName": { "description": "覆盖应用程序主二进制文件的名称。\n\n 默认情况下,Tauri 使用 `cargo` 的输出二进制文件。通过设置此选项,\n我们将重命名该二进制文件,`tauri-cli` 的 `tauri build` 命令会将其重命名,\n并且 `tauri bundle` 会将此二进制文件作为目标。\n\n 如果可能,请更改 [`package name`] 或设置 [`name field`],\n如果这还不够,并且您正在使用 nightly 版本,请考虑使用 [`different-binary-name`] 功能\n\n 注意:此配置不应包含二进制文件扩展名(例如 `.exe`),我们会为您添加", "type": ["string", "null"] }, "version": { "description": "应用程序版本。它是一个 semver 版本号或指向包含 `version` 字段的 `package.json` 文件的路径。\n\n 如果删除,将使用 `Cargo.toml` 中的版本号。\n 建议在 Tauri 配置中管理应用程序版本。\n\n ## 平台特定\n\n - **macOS**: 转换为 bundle 的 CFBundleShortVersionString 属性,并用作默认的 CFBundleVersion。\n 您可以使用 [`bundle > macOS > bundleVersion`](MacConfig::bundle_version) 设置特定的 bundle 版本。\n - **iOS**: 转换为 bundle 的 CFBundleShortVersionString 属性,并用作默认的 CFBundleVersion。\n 您可以使用 [`bundle > iOS > bundleVersion`](IosConfig::bundle_version) 设置特定的 bundle 版本。\n `tauri ios build` CLI 命令有一个 `--build-number ` 选项,允许您在应用程序版本后面附加构建号。\n - **Android**: 默认使用版本 1.0。您可以使用 [`bundle > android > versionCode`](AndroidConfig::version_code) 设置版本代码。\n\n Android 上默认使用版本 1.0。", "type": ["string", "null"] }, "identifier": { "description": "应用程序的标识符,使用反向域名表示法(例如 `com.tauri.example`)。\n 此字符串在应用程序之间必须是唯一的,因为它被用于系统配置中,\n 如 bundle ID 和 webview 数据目录的路径。\n 此字符串只能包含字母数字字符(A-Z、a-z 和 0-9)、连字符(-)\n 和句点(.)。", "type": "string" }, "app": { "description": "应用程序配置。", "default": { "enableGTKAppId": false, "macOSPrivateApi": false, "security": { "assetProtocol": { "enable": false, "scope": [] }, "capabilities": [], "dangerousDisableAssetCspModification": false, "freezePrototype": false, "pattern": { "use": "brownfield" } }, "windows": [], "withGlobalTauri": false }, "allOf": [ { "$ref": "#/definitions/AppConfig" } ] }, "build": { "description": "构建配置。", "default": { "additionalWatchFolders": [], "removeUnusedCommands": false }, "allOf": [ { "$ref": "#/definitions/BuildConfig" } ] }, "bundle": { "description": "打包配置。", "default": { "active": false, "android": { "autoIncrementVersionCode": false, "minSdkVersion": 24 }, "createUpdaterArtifacts": false, "iOS": { "minimumSystemVersion": "14.0" }, "icon": [], "linux": { "appimage": { "bundleMediaFramework": false, "files": {} }, "deb": { "files": {} }, "rpm": { "epoch": 0, "files": {}, "release": "1" } }, "macOS": { "dmg": { "appPosition": { "x": 180, "y": 170 }, "applicationFolderPosition": { "x": 480, "y": 170 }, "windowSize": { "height": 400, "width": 660 } }, "files": {}, "hardenedRuntime": true, "minimumSystemVersion": "10.13" }, "targets": "all", "useLocalToolsDir": false, "windows": { "allowDowngrades": true, "certificateThumbprint": null, "digestAlgorithm": null, "nsis": null, "signCommand": null, "timestampUrl": null, "tsp": false, "webviewInstallMode": { "silent": true, "type": "downloadBootstrapper" }, "wix": null } }, "allOf": [ { "$ref": "#/definitions/BundleConfig" } ] }, "plugins": { "description": "插件配置。", "default": {}, "allOf": [ { "$ref": "#/definitions/PluginConfig" } ] } }, "additionalProperties": false, "definitions": { "AppConfig": { "description": "应用程序配置对象。\n\n 参阅更多: ", "type": "object", "properties": { "windows": { "description": "应用程序窗口配置。\n\n ## 示例:\n\n 在应用程序启动时创建窗口\n\n ```json\n {\n \"app\": {\n \"windows\": [\n { \"width\": 800, \"height\": 600 }\n ]\n }\n }\n ```\n\n 如果未指定,窗口的标签(其标识符)默认为\"main\",\n 您可以使用此标签通过\n Rust 中的 `app.get_webview_window` 或 JavaScript 中的 `WebviewWindow.getByLabel` 获取窗口\n\n 使用多个窗口时,每个窗口都需要一个唯一的标签\n\n ```json\n {\n \"app\": {\n \"windows\": [\n { \"label\": \"main\", \"width\": 800, \"height\": 600 },\n { \"label\": \"secondary\", \"width\": 800, \"height\": 600 }\n ]\n }\n }\n ```\n\n 您还可以将 `create` 设置为 false 并通过 Rust API 使用此配置\n\n ```json\n {\n \"app\": {\n \"windows\": [\n { \"create\": false, \"width\": 800, \"height\": 600 }\n ]\n }\n }\n ```\n\n 并像这样使用它\n\n ```rust\n tauri::Builder::default()\n .setup(|app| {\n tauri::WebviewWindowBuilder::from_config(app.handle(), app.config().app.windows[0])?.build()?;\n Ok(())\n });\n ```", "default": [], "type": "array", "items": { "$ref": "#/definitions/WindowConfig" } }, "security": { "description": "安全配置。", "default": { "assetProtocol": { "enable": false, "scope": [] }, "capabilities": [], "dangerousDisableAssetCspModification": false, "freezePrototype": false, "pattern": { "use": "brownfield" } }, "allOf": [ { "$ref": "#/definitions/SecurityConfig" } ] }, "trayIcon": { "description": "应用程序托盘图标的配置。", "anyOf": [ { "$ref": "#/definitions/TrayIconConfig" }, { "type": "null" } ] }, "macOSPrivateApi": { "description": "macOS 私有 API 配置。启用透明背景 API 并将 `fullScreenEnabled` 首选项设置为 `true`。", "default": false, "type": "boolean" }, "withGlobalTauri": { "description": "我们是否应该在 `window.__TAURI__` 上注入 Tauri API。", "default": false, "type": "boolean" }, "enableGTKAppId": { "description": "如果设置为 true,\"identifier\" 将被设置为 GTK 应用程序 ID (在使用 GTK 的系统上)。", "default": false, "type": "boolean" } }, "additionalProperties": false }, "WindowConfig": { "description": "窗口配置对象。\n\n 参阅更多: ", "type": "object", "properties": { "label": { "description": "窗口标识符。它必须是字母数字。", "default": "main", "type": "string" }, "create": { "description": "Tauri 是否应该在应用程序启动时创建此窗口。\n\n 当此选项设置为 `false` 时,您必须通过 `app.config().app.windows` 手动获取配置对象\n 并使用 [`WebviewWindowBuilder::from_config`](https://docs.rs/tauri/2/tauri/webview/struct.WebviewWindowBuilder.html#method.from_config) 创建它。\n\n ## 示例:\n\n ```rust\n tauri::Builder::default()\n .setup(|app| {\n tauri::WebviewWindowBuilder::from_config(app.handle(), app.config().app.windows[0])?.build()?;\n Ok(())\n });\n ```", "default": true, "type": "boolean" }, "url": { "description": "窗口 webview URL。", "default": "index.html", "allOf": [ { "$ref": "#/definitions/WebviewUrl" } ] }, "userAgent": { "description": "webview 的用户代理。", "type": ["string", "null"] }, "dragDropEnabled": { "description": "webview 上的拖放是否启用。默认情况下启用。\n\n 在 Windows 上的前端使用 HTML5 拖放时需要禁用它。", "default": true, "type": "boolean" }, "center": { "description": "窗口是否以居中方式启动。", "default": false, "type": "boolean" }, "x": { "description": "窗口左上角的水平位置。", "type": ["number", "null"], "format": "double" }, "y": { "description": "窗口左上角的垂直位置。", "type": ["number", "null"], "format": "double" }, "width": { "description": "窗口宽度。", "default": 800, "type": "number", "format": "double" }, "height": { "description": "窗口高度。", "default": 600, "type": "number", "format": "double" }, "minWidth": { "description": "最小窗口宽度。", "type": ["number", "null"], "format": "double" }, "minHeight": { "description": "最小窗口高度。", "type": ["number", "null"], "format": "double" }, "maxWidth": { "description": "最大窗口宽度。", "type": ["number", "null"], "format": "double" }, "maxHeight": { "description": "最大窗口高度。", "type": ["number", "null"], "format": "double" }, "preventOverflow": { "description": "是否防止窗口溢出工作区\n\n ## 平台特定\n\n - **iOS / Android**: 不支持。", "anyOf": [ { "$ref": "#/definitions/PreventOverflowConfig" }, { "type": "null" } ] }, "resizable": { "description": "窗口是否可调整大小。当 resizable 设置为 false 时,本机窗口的最大化按钮将自动禁用。", "default": true, "type": "boolean" }, "maximizable": { "description": "窗口的本机最大化按钮是否启用。\n 如果 resizable 设置为 false,则忽略此设置。\n\n ## 平台特定\n\n - **macOS**: 禁用窗口标题栏中的 \"缩放\" 按钮,该按钮也用于进入全屏模式。\n - **Linux / iOS / Android**: 不支持。", "default": true, "type": "boolean" }, "minimizable": { "description": "窗口的本机最小化按钮是否启用。\n\n ## 平台特定\n\n - **Linux / iOS / Android**: 不支持。", "default": true, "type": "boolean" }, "closable": { "description": "窗口的本机关闭按钮是否启用。\n\n ## 平台特定\n\n - **Linux**: \"GTK+ 将尽力说服窗口管理器不显示关闭按钮。\n 根据系统的不同,此函数在已经可见的窗口上调用时可能不起效\"\n - **iOS / Android**: 不支持。", "default": true, "type": "boolean" }, "title": { "description": "窗口标题。", "default": "Tauri App", "type": "string" }, "fullscreen": { "description": "窗口是否以全屏模式启动。", "default": false, "type": "boolean" }, "focus": { "description": "窗口是否初始聚焦。", "default": true, "type": "boolean" }, "focusable": { "description": "窗口是否可聚焦。", "default": true, "type": "boolean" }, "transparent": { "description": "窗口是否透明。\n\n 请注意,在 `macOS` 上,这需要 `macos-private-api` 功能标志,在 `tauri > macOSPrivateApi` 下启用。\n 警告: 在 `macOS` 上使用私有 API 会阻止您的应用程序被 `App Store` 接受。", "default": false, "type": "boolean" }, "maximized": { "description": "窗口是否最大化。", "default": false, "type": "boolean" }, "visible": { "description": "窗口是否可见。", "default": true, "type": "boolean" }, "decorations": { "description": "窗口是否应该有边框和栏。", "default": true, "type": "boolean" }, "alwaysOnBottom": { "description": "窗口是否应该始终位于其他窗口下方。", "default": false, "type": "boolean" }, "alwaysOnTop": { "description": "窗口是否应该始终位于其他窗口上方。", "default": false, "type": "boolean" }, "visibleOnAllWorkspaces": { "description": "窗口是否在所有工作区或虚拟桌面上可见。\n\n ## 平台特定\n\n - **Windows / iOS / Android**: 不支持。", "default": false, "type": "boolean" }, "contentProtected": { "description": "防止窗口内容被其他应用程序捕获。", "default": false, "type": "boolean" }, "skipTaskbar": { "description": "如果为 `true`,则在 Windows 和 Linux 上隐藏任务栏中的窗口图标。", "default": false, "type": "boolean" }, "windowClassname": { "description": "在 Windows 上创建窗口时使用的窗口类名称。**仅限 Windows**。", "type": ["string", "null"] }, "theme": { "description": "初始窗口主题。默认为系统主题。仅在 Windows 和 macOS 10.14+ 上实现。", "anyOf": [ { "$ref": "#/definitions/Theme" }, { "type": "null" } ] }, "titleBarStyle": { "description": "macOS 标题栏的样式。", "default": "Visible", "allOf": [ { "$ref": "#/definitions/TitleBarStyle" } ] }, "trafficLightPosition": { "description": "macOS 上窗口控件的位置。\n\n 要求 titleBarStyle: Overlay 且 decorations: true。", "anyOf": [ { "$ref": "#/definitions/LogicalPosition" }, { "type": "null" } ] }, "hiddenTitle": { "description": "如果为 `true`,则在 macOS 上隐藏窗口标题。", "default": false, "type": "boolean" }, "acceptFirstMouse": { "description": "在 macOS 上点击非活动窗口时是否也点击到 webview。", "default": false, "type": "boolean" }, "tabbingIdentifier": { "description": "定义 macOS 的窗口 [tabbing identifier]。\n\n 具有匹配 tabbing 标识符的窗口将分组在一起。\n 如果未设置 tabbing 标识符,将禁用自动 tabbing。\n\n [tabbing identifier]: ", "type": ["string", "null"] }, "additionalBrowserArgs": { "description": "在 Windows 上定义额外的浏览器参数。默认情况下 wry 传递 `--disable-features=msWebOOUI,msPdfOOUI,msSmartScreenProtection`\n 因此如果您使用此方法,还需要自己禁用这些组件(如果需要)。", "type": ["string", "null"] }, "shadow": { "description": "窗口是否有阴影。\n\n ## 平台特定\n\n - **Windows**:\n - `false` 对带装饰的窗口无效,阴影始终开启。\n - `true` 会使无装饰窗口具有 1px 白色边框,\n 并且在 Windows 11 上具有圆角。\n - **Linux**: 不支持。", "default": true, "type": "boolean" }, "windowEffects": { "description": "窗口效果。\n\n 要求窗口必须透明。\n\n ## 平台特定:\n\n - **Windows**: 如果使用装饰或阴影,您可能想要尝试此变通方法 \n - **Linux**: 不支持", "anyOf": [ { "$ref": "#/definitions/WindowEffectsConfig" }, { "type": "null" } ] }, "incognito": { "description": "webview 是否应以隐身模式启动。\n\n ## 平台特定:\n\n - **Android**: 不支持。", "default": false, "type": "boolean" }, "parent": { "description": "将与此标签关联的窗口设置为要创建窗口的父窗口。\n\n ## 平台特定\n\n - **Windows**: 这将传递的父窗口设置为要创建窗口的所有者窗口。\n 来自 [MSDN 拥有窗口文档](https://docs.microsoft.com/en-us/windows/win32/winmsg/window-features#owned-windows):\n - 拥有的窗口在 Z 顺序中始终位于其所有者之上。\n - 当其所有者被销毁时,系统会自动销毁拥有的窗口。\n - 当其所有者最小化时,拥有的窗口被隐藏。\n - **Linux**: 这使新窗口成为父窗口的临时窗口,参见 \n - **macOS**: 这将窗口作为父窗口的子窗口添加,参见 ", "type": ["string", "null"] }, "proxyUrl": { "description": "WebView 用于所有网络请求的代理 URL。\n\n 必须是 `http://` 或 `socks5://` URL。\n\n ## 平台特定\n\n - **macOS**: 需要 `macos-proxy` 功能标志,仅在 macOS 14+ 上编译。", "type": ["string", "null"], "format": "uri" }, "zoomHotkeysEnabled": { "description": "是否启用热键进行页面缩放\n\n ## 平台特定:\n\n - **Windows**: 控制 WebView2 的 [`IsZoomControlEnabled`](https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/winrt/microsoft_web_webview2_core/corewebview2settings?view=webview2-winrt-1.0.2420.47#iszoomcontrolenabled) 设置。\n - **MacOS / Linux**: 注入一个 polyfill,使用 `ctrl/command` + `-/=` 进行放大缩小,\n 每步 20%,范围从 20% 到 1000%。需要 `webview:allow-set-webview-zoom` 权限\n\n - **Android / iOS**: 不支持。", "default": false, "type": "boolean" }, "browserExtensionsEnabled": { "description": "是否可以为 webview 进程安装浏览器扩展\n\n ## 平台特定:\n\n - **Windows**: 启用 WebView2 环境的 [`AreBrowserExtensionsEnabled`](https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/winrt/microsoft_web_webview2_core/corewebview2environmentoptions?view=webview2-winrt-1.0.2739.15#arebrowserextensionsenabled)\n - **MacOS / Linux / iOS / Android** - 不支持。", "default": false, "type": "boolean" }, "useHttpsScheme": { "description": "设置自定义协议是否应在 Windows 和 Android 上使用 `https://.localhost` 而不是默认的 `http://.localhost`。默认为 `false`。\n\n ## 注意\n\n 使用 `https` 方案在尝试获取 `http` 端点时将不允许混合内容,因此不会匹配 macOS 和 Linux 上使用的 `://localhost` 协议的行为。\n\n ## 警告\n\n 在版本之间更改此值将更改 IndexedDB、cookies 和 localstorage 的位置,您的应用程序将无法访问旧数据。", "default": false, "type": "boolean" }, "devtools": { "description": "启用 Web 检查器,通常称为浏览器开发工具。默认情况下启用。\n\n 此 API 在 **debug** 构建中有效,但在 **release** 构建中需要 `devtools` 功能标志才能启用它。\n\n ## 平台特定\n\n - macOS: 这将在 **macOS** 上调用私有函数。\n - Android: 在 Chrome 中打开 `chrome://inspect/#devices` 以获取开发工具窗口。Android 上不支持 Wry 的 `WebView` 开发工具 API。\n - iOS: 打开 Safari > 开发 > [您的设备名称] > [您的 WebView] 以获取开发工具窗口。", "type": ["boolean", "null"] }, "backgroundColor": { "description": "设置窗口和 webview 背景颜色。\n\n ## 平台特定:\n\n - **Windows**: alpha 通道对窗口层被忽略。\n - **Windows**: 在 Windows 7 上,alpha 通道对 webview 层被忽略。\n - **Windows**: 在 Windows 8 及更新版本上,如果 alpha 通道不是 `0`,它将对 webview 层被忽略。", "anyOf": [ { "$ref": "#/definitions/Color" }, { "type": "null" } ] }, "backgroundThrottling": { "description": "更改默认的后台节流行为。\n\n 默认情况下,浏览器使用暂停策略,该策略将在视图被最小化或隐藏约 5 分钟后节流定时器甚至卸载整个选项卡(视图)以释放资源。这将暂停所有任务,直到文档可见性状态通过将视图带回前台而从隐藏变回可见。\n\n ## 平台特定\n\n - **Linux / Windows / Android**: 不支持。使用待处理的 WebLock 事务等变通方法可能就足够了。\n - **iOS**: 自版本 17.0+ 起支持。\n - **macOS**: 自版本 14.0+ 起支持。\n\n 参见 https://github.com/tauri-apps/tauri/issues/5250#issuecomment-2569380578", "anyOf": [ { "$ref": "#/definitions/BackgroundThrottlingPolicy" }, { "type": "null" } ] }, "javascriptDisabled": { "description": "我们是否应该在 webview 上禁用 JavaScript 代码执行。", "default": false, "type": "boolean" }, "allowLinkPreview": { "description": "在 macOS 和 iOS 上,长按链接时会有链接预览,默认情况下启用。\n 参见 https://docs.rs/objc2-web-kit/latest/objc2_web_kit/struct.WKWebView.html#method.allowsLinkPreview", "default": true, "type": "boolean" }, "disableInputAccessoryView": { "description": "允许禁用 iOS 上的输入辅助视图。\n\n 辅助视图是当文本输入元素获得焦点时出现在键盘上方的视图。\n 它通常显示带有\"完成\"、\"下一步\"按钮的视图。", "default": false, "type": "boolean" }, "dataDirectory": { "description": "为 webview 的数据目录(localStorage、缓存等)设置自定义路径,**相对于 [`appDataDir()`]/${label}**。\n\n 要设置绝对路径,请使用 [`WebviewWindowBuilder::data_directory`](https://docs.rs/tauri/2/tauri/webview/struct.WebviewWindowBuilder.html#method.data_directory)\n\n #### 平台特定:\n\n - **Windows**: 对于 `additionalBrowserArgs`、`browserExtensionsEnabled` 或 `scrollBarStyle` 等设置具有不同值的 WebView 必须具有不同的数据目录。\n - **macOS / iOS**: 不支持,请改用 `dataStoreIdentifier`。\n - **Android**: 不支持。", "type": ["string", "null"] }, "dataStoreIdentifier": { "description": "使用自定义数据存储标识符初始化 WebView。这可以被视为 `dataDirectory` 的替代品,后者在 WKWebView 中不可用。\n 参见 https://developer.apple.com/documentation/webkit/wkwebsitedatastore/init(foridentifier:)?language=objc\n\n 数组必须包含 16 个 u8 数字。\n\n #### 平台特定:\n\n - **iOS**: 自版本 17.0+ 起支持。\n - **macOS**: 自版本 14.0+ 起支持。\n - **Windows / Linux / Android**: 不支持。", "type": ["array", "null"], "items": { "type": "integer", "format": "uint8", "minimum": 0 }, "maxItems": 16, "minItems": 16 }, "scrollBarStyle": { "description": "指定要与 webview 一起使用的本机滚动条样式。\n 修改滚动条的 CSS 样式将应用在此处配置的本机外观之上。\n\n 默认为 `default`,这是浏览器的默认值。\n\n ## 平台特定\n\n - **Windows**:\n - `fluentOverlay` 需要 WebView2 运行时版本 125.0.2535.41 或更高版本,\n 在旧版本上不起作用。\n - 对于指向相同数据目录的所有 webview,此选项必须具有相同的值。\n - **Linux / Android / iOS / macOS**: 不支持。仅支持 `Default` 并且不执行任何操作。", "default": "default", "allOf": [ { "$ref": "#/definitions/ScrollBarStyle" } ] } }, "additionalProperties": false }, "WebviewUrl": { "description": "在 Tauri webview 窗口中打开的 URL。", "anyOf": [ { "description": "外部 URL。必须使用 `http` 或 `https` 方案。", "type": "string", "format": "uri" }, { "description": "应用程序 URL 的路径部分。\n 例如,要加载 `tauri://localhost/users/john`,\n 您可以在此配置中提供 `users/john`。", "type": "string" }, { "description": "自定义协议 URL,例如 `doom://index.html`", "type": "string", "format": "uri" } ] }, "PreventOverflowConfig": { "description": "使用边距防止溢出", "anyOf": [ { "description": "是否启用防止溢出", "type": "boolean" }, { "description": "使用边距启用防止溢出,\n 使窗口大小 + 此边距不会溢出工作区", "allOf": [ { "$ref": "#/definitions/PreventOverflowMargin" } ] } ] }, "PreventOverflowMargin": { "description": "使用边距启用防止溢出,\n 使窗口大小 + 此边距不会溢出工作区", "type": "object", "required": ["height", "width"], "properties": { "width": { "description": "水平边距,以物理单位为单位", "type": "integer", "format": "uint32", "minimum": 0 }, "height": { "description": "垂直边距,以物理单位为单位", "type": "integer", "format": "uint32", "minimum": 0 } }, "additionalProperties": false }, "Theme": { "description": "系统主题。", "oneOf": [ { "description": "浅色主题。", "type": "string", "enum": ["Light"] }, { "description": "深色主题。", "type": "string", "enum": ["Dark"] } ] }, "TitleBarStyle": { "description": "macOS 上窗口标题栏的显示方式。", "oneOf": [ { "description": "正常标题栏。", "type": "string", "enum": ["Visible"] }, { "description": "使标题栏透明,从而显示窗口背景颜色。\n\n 如果您不需要在标题栏下放置实际的 HTML,这很有用。这使您可以避免使用 `TitleBarStyle::Overlay` 的注意事项。当 Tauri 允许您设置自定义窗口背景颜色时,这将更加有用。", "type": "string", "enum": ["Transparent"] }, { "description": "将标题栏显示为窗口内容之上的透明叠加层。\n\n 请记住:\n - 标题栏的高度在不同的操作系统版本上不同,这可能导致窗口控件和标题不在您预期的位置。\n - 您需要定义自定义拖动区域以使窗口可拖动,但是由于限制,当窗口未聚焦时您无法拖动窗口 。\n - 窗口标题的颜色取决于系统主题。", "type": "string", "enum": ["Overlay"] } ] }, "LogicalPosition": { "description": "位置坐标结构体。", "type": "object", "required": ["x", "y"], "properties": { "x": { "description": "X 坐标。", "type": "number", "format": "double" }, "y": { "description": "Y 坐标。", "type": "number", "format": "double" } }, "additionalProperties": false }, "WindowEffectsConfig": { "description": "窗口效果配置对象", "type": "object", "required": ["effects"], "properties": { "effects": { "description": "应用于窗口的窗口效果列表。\n 冲突的效果将应用第一个并忽略其余的。", "type": "array", "items": { "$ref": "#/definitions/WindowEffect" } }, "state": { "description": "窗口效果状态 **仅限 macOS**", "anyOf": [ { "$ref": "#/definitions/WindowEffectState" }, { "type": "null" } ] }, "radius": { "description": "窗口效果圆角半径 **仅限 macOS**", "type": ["number", "null"], "format": "double" }, "color": { "description": "窗口效果颜色。仅影响 Windows 10 v1903+ 上的 [`WindowEffect::Blur`] 和 [`WindowEffect::Acrylic`]。\n 在 Windows 7 或 Windows 11 上没有任何效果。", "anyOf": [ { "$ref": "#/definitions/Color" }, { "type": "null" } ] } }, "additionalProperties": false }, "WindowEffect": { "description": "平台特定的窗口效果", "oneOf": [ { "description": "适合视图有效外观的默认材质。**macOS 10.14-**", "deprecated": true, "type": "string", "enum": ["appearanceBased"] }, { "description": "**macOS 10.14-**", "deprecated": true, "type": "string", "enum": ["light"] }, { "description": "**macOS 10.14-**", "deprecated": true, "type": "string", "enum": ["dark"] }, { "description": "**macOS 10.14-**", "deprecated": true, "type": "string", "enum": ["mediumLight"] }, { "description": "**macOS 10.14-**", "deprecated": true, "type": "string", "enum": ["ultraDark"] }, { "description": "**macOS 10.10+**", "type": "string", "enum": ["titlebar"] }, { "description": "**macOS 10.10+**", "type": "string", "enum": ["selection"] }, { "description": "**macOS 10.11+**", "type": "string", "enum": ["menu"] }, { "description": "**macOS 10.11+**", "type": "string", "enum": ["popover"] }, { "description": "**macOS 10.11+**", "type": "string", "enum": ["sidebar"] }, { "description": "**macOS 10.14+**", "type": "string", "enum": ["headerView"] }, { "description": "**macOS 10.14+**", "type": "string", "enum": ["sheet"] }, { "description": "**macOS 10.14+**", "type": "string", "enum": ["windowBackground"] }, { "description": "**macOS 10.14+**", "type": "string", "enum": ["hudWindow"] }, { "description": "**macOS 10.14+**", "type": "string", "enum": ["fullScreenUI"] }, { "description": "**macOS 10.14+**", "type": "string", "enum": ["tooltip"] }, { "description": "**macOS 10.14+**", "type": "string", "enum": ["contentBackground"] }, { "description": "**macOS 10.14+**", "type": "string", "enum": ["underWindowBackground"] }, { "description": "**macOS 10.14+**", "type": "string", "enum": ["underPageBackground"] }, { "description": "匹配系统深色偏好的 Mica 效果 **仅限 Windows 11**", "type": "string", "enum": ["mica"] }, { "description": "深色模式的 Mica 效果,但仅当系统启用深色模式时 **仅限 Windows 11**", "type": "string", "enum": ["micaDark"] }, { "description": "浅色模式的 Mica 效果 **仅限 Windows 11**", "type": "string", "enum": ["micaLight"] }, { "description": "匹配系统深色偏好的 Tabbed 效果 **仅限 Windows 11**", "type": "string", "enum": ["tabbed"] }, { "description": "深色模式的 Tabbed 效果,但仅当系统启用深色模式时 **仅限 Windows 11**", "type": "string", "enum": ["tabbedDark"] }, { "description": "浅色模式的 Tabbed 效果 **仅限 Windows 11**", "type": "string", "enum": ["tabbedLight"] }, { "description": "**仅限 Windows 7/10/11(22H1)**\n\n ## 注意\n\n 此效果在 Windows 11 build 22621 上调整/拖动窗口时性能较差。", "type": "string", "enum": ["blur"] }, { "description": "**仅限 Windows 10/11**\n\n ## 注意\n\n 此效果在 Windows 10 v1903+ 和 Windows 11 build 22000 上调整/拖动窗口时性能较差。", "type": "string", "enum": ["acrylic"] } ] }, "WindowEffectState": { "description": "窗口效果状态 **仅限 macOS**\n\n ", "oneOf": [ { "description": "使窗口效果状态跟随窗口的活动状态", "type": "string", "enum": ["followsWindowActiveState"] }, { "description": "使窗口效果状态始终处于活动状态", "type": "string", "enum": ["active"] }, { "description": "使窗口效果状态始终处于非活动状态", "type": "string", "enum": ["inactive"] } ] }, "Color": { "anyOf": [ { "description": "颜色十六进制字符串,例如:#fff、#ffffff 或 #ffffffff。", "type": "string", "pattern": "^#?([A-Fa-f0-9]{3}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$" }, { "description": "RGB 颜色数组。每个值的最小值为 0,最大值为 255。", "type": "array", "items": [ { "type": "integer", "format": "uint8", "minimum": 0 }, { "type": "integer", "format": "uint8", "minimum": 0 }, { "type": "integer", "format": "uint8", "minimum": 0 } ], "maxItems": 3, "minItems": 3 }, { "description": "RGBA 颜色数组。每个值的最小值为 0,最大值为 255。", "type": "array", "items": [ { "type": "integer", "format": "uint8", "minimum": 0 }, { "type": "integer", "format": "uint8", "minimum": 0 }, { "type": "integer", "format": "uint8", "minimum": 0 }, { "type": "integer", "format": "uint8", "minimum": 0 } ], "maxItems": 4, "minItems": 4 }, { "description": "红色、绿色、蓝色、alpha 颜色值的对象。每个值的最小值为 0,最大值为 255。", "type": "object", "required": ["blue", "green", "red"], "properties": { "red": { "type": "integer", "format": "uint8", "minimum": 0 }, "green": { "type": "integer", "format": "uint8", "minimum": 0 }, "blue": { "type": "integer", "format": "uint8", "minimum": 0 }, "alpha": { "default": 255, "type": "integer", "format": "uint8", "minimum": 0 } } } ] }, "BackgroundThrottlingPolicy": { "description": "后台节流策略。", "oneOf": [ { "description": "禁用后台节流的策略", "type": "string", "enum": ["disabled"] }, { "description": "不在窗口中的 web view 完全暂停任务的策略。如果未设置策略,这通常是默认行为。", "type": "string", "enum": ["suspend"] }, { "description": "不在窗口中的 web view 限制处理但不完全暂停任务的策略。", "type": "string", "enum": ["throttle"] } ] }, "ScrollBarStyle": { "description": "webview 中使用的滚动条样式。\n\n ## 平台特定\n\n - **Windows**: 针对相同数据目录的所有 webview,此选项必须具有相同的值。", "oneOf": [ { "description": "webview 中使用的滚动条样式。", "type": "string", "enum": ["default"] }, { "description": "Fluent UI 样式的覆盖滚动条。**仅限 Windows**\n\n 需要 WebView2 运行时版本 125.0.2535.41 或更高版本,在旧版本上不起作用,\n 参见 https://learn.microsoft.com/en-us/microsoft-edge/webview2/release-notes/?tabs=dotnetcsharp#10253541", "type": "string", "enum": ["fluentOverlay"] } ] }, "SecurityConfig": { "description": "安全配置。\n\n 参阅更多: ", "type": "object", "properties": { "csp": { "description": "将注入到构建应用程序中所有 HTML 文件的内容安全策略。\n 如果未指定 [`dev_csp`](#SecurityConfig.devCsp),此值也会在开发环境中注入。\n\n 这是配置中非常重要的部分,因为它有助于确保 WebView 的安全性。\n 参阅 。", "anyOf": [ { "$ref": "#/definitions/Csp" }, { "type": "null" } ] }, "devCsp": { "description": "将注入到开发环境中所有 HTML 文件的内容安全策略。\n\n 这是配置中非常重要的部分,因为它有助于确保 WebView 的安全性。\n 参阅 。", "anyOf": [ { "$ref": "#/definitions/Csp" }, { "type": "null" } ] }, "freezePrototype": { "description": "使用自定义协议时冻结 `Object.prototype`。", "default": false, "type": "boolean" }, "dangerousDisableAssetCspModification": { "description": "禁用 Tauri 注入的 CSP 源。\n\n 在编译时,Tauri 解析所有前端资源并更改内容安全策略,\n 通过注入 nonce 和 hash 源来仅允许加载您自己的脚本和样式。\n 这会严格限制您的 CSP,当与其他灵活源一起使用时可能会引入问题。\n\n 此配置选项允许布尔值和字符串列表作为值。\n 布尔值指示 Tauri 对所有 CSP 注入禁用注入,\n 字符串列表指示 Tauri 无法注入的 CSP 指令。\n\n **警告:** 仅在您知道自己在做什么并且已正确配置 CSP 时才禁用此选项。\n 如果没有此 Tauri 保护,您的应用程序可能容易受到 XSS 攻击。", "default": false, "allOf": [ { "$ref": "#/definitions/DisabledCspModificationKind" } ] }, "assetProtocol": { "description": "自定义协议配置。", "default": { "enable": false, "scope": [] }, "allOf": [ { "$ref": "#/definitions/AssetProtocolConfig" } ] }, "pattern": { "description": "要使用的模式。", "default": { "use": "brownfield" }, "allOf": [ { "$ref": "#/definitions/PatternKind" } ] }, "capabilities": { "description": "应用程序上启用的功能列表。\n\n 默认情况下(未设置或空列表),包含 `./capabilities/` 中的所有功能文件,\n 通过在此条目中设置值,您可以精细控制包含哪些功能\n\n 您可以引用 `./capabilities/` 中定义的功能文件及其标识符或内联 [`Capability`]\n\n ### 示例\n\n ```json\n {\n \"app\": {\n \"capabilities\": [\n \"main-window\",\n {\n \"identifier\": \"drag-window\",\n \"permissions\": [\"core:window:allow-start-dragging\"]\n }\n ]\n }\n }\n ```", "default": [], "type": "array", "items": { "$ref": "#/definitions/CapabilityEntry" } }, "headers": { "description": "添加到从 tauri 到 web view 的每个 http 响应的响应头\n 这不包括 IPC 消息和错误响应", "anyOf": [ { "$ref": "#/definitions/HeaderConfig" }, { "type": "null" } ] } }, "additionalProperties": false }, "Csp": { "description": "内容安全策略定义。\n 参阅 。", "anyOf": [ { "description": "单个文本字符串中的完整 CSP 策略。", "type": "string" }, { "description": "一个对象,将指令与其源值映射为字符串列表。", "type": "object", "additionalProperties": { "$ref": "#/definitions/CspDirectiveSources" } } ] }, "CspDirectiveSources": { "description": "内容安全策略指令源列表。\n 参阅 。", "anyOf": [ { "description": "CSP 源的内联列表。与 [`Self::List`] 相同,但使用空格分隔符连接。", "type": "string" }, { "description": "CSP 源列表。集合将使用空格分隔符连接为 CSP 字符串。", "type": "array", "items": { "type": "string" } } ] }, "DisabledCspModificationKind": { "description": "`dangerous_disable_asset_csp_modification` 配置选项的可能值。", "anyOf": [ { "description": "如果为 `true`,则禁用所有 CSP 修改。\n `false` 是默认值,它配置 Tauri 来控制 CSP。", "type": "boolean" }, { "description": "禁用给定的 CSP 指令修改列表。", "type": "array", "items": { "type": "string" } } ] }, "AssetProtocolConfig": { "description": "资源自定义协议的配置。\n\n 参阅更多: ", "type": "object", "properties": { "scope": { "description": "资源协议的访问范围。", "default": [], "allOf": [ { "$ref": "#/definitions/FsScope" } ] }, "enable": { "description": "启用资源协议。", "default": false, "type": "boolean" } }, "additionalProperties": false }, "FsScope": { "description": "协议范围定义。\n 它是 glob 模式列表,用于限制来自 webview 的 API 访问。\n\n 每个模式可以以一个变量开头,该变量解析为系统基本目录。\n 变量包括:`$AUDIO`、`$CACHE`、`$CONFIG`、`$DATA`、`$LOCALDATA`、`$DESKTOP`,\n `$DOCUMENT`、`$DOWNLOAD`、`$EXE`、`$FONT`、`$HOME`、`$PICTURE`、`$PUBLIC`、`$RUNTIME`,\n `$TEMPLATE`、`$VIDEO`、`$RESOURCE`、`$APP`、`$LOG`、`$TEMP`、`$APPCONFIG`、`$APPDATA`,\n `$APPLOCALDATA`、`$APPCACHE`、`$APPLOG`。", "anyOf": [ { "description": "此范围允许的路径列表。", "type": "array", "items": { "type": "string" } }, { "description": "完整的范围配置。", "type": "object", "properties": { "allow": { "description": "此范围允许的路径列表。", "default": [], "type": "array", "items": { "type": "string" } }, "deny": { "description": "此范围不允许的路径列表。\n 此列表优先于 [`Self::Scope::allow`] 列表。", "default": [], "type": "array", "items": { "type": "string" } }, "requireLiteralLeadingDot": { "description": "包含以 `.` 开头的组件的路径是否需要\n `.` 在模式中字面出现;`*`、`?`、`**`\n 或 `[...]` 将不匹配。这很有用,因为这些文件\n 在 Unix 系统上通常被视为隐藏文件,在列出文件时\n 可能需要跳过它们。\n\n 在 Unix 系统上默认为 `true`,在 Windows 上默认为 `false`", "type": ["boolean", "null"] } } } ] }, "PatternKind": { "description": "应用程序模式。", "oneOf": [ { "description": "Brownfield 模式。", "type": "object", "required": ["use"], "properties": { "use": { "type": "string", "enum": ["brownfield"] } } }, { "description": "隔离模式。出于安全目的推荐使用。", "type": "object", "required": ["options", "use"], "properties": { "use": { "type": "string", "enum": ["isolation"] }, "options": { "type": "object", "required": ["dir"], "properties": { "dir": { "description": "包含安全隔离应用程序的 index.html 文件的目录。", "type": "string" } } } } } ] }, "CapabilityEntry": { "description": "功能条目,可以是内联功能或对在其自己的文件中定义的功能的引用。", "anyOf": [ { "description": "内联功能。", "allOf": [ { "$ref": "#/definitions/Capability" } ] }, { "description": "对功能标识符的引用。", "type": "string" } ] }, "Capability": { "description": "开发者可以用来隔离对 IPC 层的访问的分组和边界机制。\n\n 它控制应用程序窗口和 webview 对 Tauri 核心、应用程序或插件命令的细粒度访问。\n 如果 webview 或其窗口不匹配任何功能,则它根本无法访问 IPC 层。\n\n 这样做可以基于所需的系统访问创建窗口组,这可以减少\n 特权较低的窗口中前端漏洞的影响。\n 可以通过精确名称 (例如 `main-window`) 或 glob 模式 (如 `*` 或 `admin-*`) 将窗口添加到功能。\n 窗口可以没有、有一个或多个关联的功能。\n\n ## 示例\n\n ```json\n {\n \"identifier\": \"main-user-files-write\",\n \"description\": \"此功能允许 macOS 和 Windows 上的 `main` 窗口访问 `filesystem` 写入相关命令和 `dialog` 命令,以实现对用户选择的文件的编程访问。\",\n \"windows\": [\n \"main\"\n ],\n \"permissions\": [\n \"core:default\",\n \"dialog:open\",\n {\n \"identifier\": \"fs:allow-write-text-file\",\n \"allow\": [{ \"path\": \"$HOME/test.txt\" }]\n },\n ],\n \"platforms\": [\"macOS\",\"windows\"]\n }\n ```", "type": "object", "required": ["identifier", "permissions"], "properties": { "identifier": { "description": "功能的标识符。\n\n ## 示例\n\n `main-user-files-write`", "type": "string" }, "description": { "description": "描述功能预期在关联窗口上允许的内容。\n\n 它应包含对分组权限应允许的内容的描述。\n\n ## 示例\n\n 此功能允许 `main` 窗口访问 `filesystem` 写入相关\n 命令和 `dialog` 命令,以实现对用户选择的文件的编程访问。", "default": "", "type": "string" }, "remote": { "description": "配置可以使用功能权限的远程 URL。\n\n 此设置是可选的,默认为不设置,因为我们的\n 默认用例是从本地应用程序提供内容。\n\n :::caution\n 确保您了解为远程源提供本地系统访问的安全影响。\n :::\n\n ## 示例\n\n ```json\n {\n \"urls\": [\"https://*.mydomain.dev\"]\n }\n ```", "anyOf": [ { "$ref": "#/definitions/CapabilityRemote" }, { "type": "null" } ] }, "local": { "description": "是否为本地应用 URL 启用此功能。默认为 `true`。", "default": true, "type": "boolean" }, "windows": { "description": "受此功能影响的窗口列表。可以是 glob 模式。\n\n 如果窗口标签与此列表中的任何模式匹配,\n 该功能将在该窗口的所有 webview 上启用,\n 无论 [`Self::webviews`] 的值如何。\n\n 在多 webview 窗口上,优先指定 [`Self::webviews`] 并省略 [`Self::windows`]\n 以实现细粒度访问控制。\n\n ## 示例\n\n `[\"main\"]`", "type": "array", "items": { "type": "string" } }, "webviews": { "description": "受此功能影响的 webview 列表。可以是 glob 模式。\n\n 该功能将在标签与此列表中的任何模式匹配的所有 webview 上启用,\n 无论 webview 的窗口标签是否与 [`Self::windows`] 中的模式匹配。\n\n ## 示例\n\n `[\"sub-webview-one\", \"sub-webview-two\"]`", "type": "array", "items": { "type": "string" } }, "permissions": { "description": "附加到此功能的权限列表。\n\n 必须以 `${plugin-name}:${permission-name}` 的形式包含插件名称作为前缀。\n 对于直接在应用程序本身中实现的命令,只需要 `${permission-name}`。\n\n ## 示例\n\n ```json\n [\n \"core:default\",\n \"shell:allow-open\",\n \"dialog:open\",\n {\n \"identifier\": \"fs:allow-write-text-file\",\n \"allow\": [{ \"path\": \"$HOME/test.txt\" }]\n }\n ]\n ```", "type": "array", "items": { "$ref": "#/definitions/PermissionEntry" }, "uniqueItems": true }, "platforms": { "description": "限制此功能适用于哪些目标平台。\n\n 默认情况下,所有平台都是目标。\n\n ## 示例\n\n `[\"macOS\",\"windows\"]`", "type": ["array", "null"], "items": { "$ref": "#/definitions/Target" } } } }, "CapabilityRemote": { "description": "与功能关联的远程 URL 的配置。", "type": "object", "required": ["urls"], "properties": { "urls": { "description": "使用 [URLPattern 标准](https://urlpattern.spec.whatwg.org/) 的此功能引用的远程域。\n\n ## 示例\n\n - \"https://*.mydomain.dev\": 允许 mydomain.dev 的子域\n - \"https://mydomain.dev/api/*\": 允许 mydomain.dev/api 的任何子路径", "type": "array", "items": { "type": "string" } } } }, "PermissionEntry": { "description": "[`Capability`] 中权限值的条目可以是原始权限 [`Identifier`]\n 或引用权限并扩展其范围的对象。", "anyOf": [ { "description": "通过标识符引用权限或权限集。", "allOf": [ { "$ref": "#/definitions/Identifier" } ] }, { "description": "通过标识符引用权限或权限集并扩展其范围。", "type": "object", "required": ["identifier"], "properties": { "identifier": { "description": "权限或权限集的标识符。", "allOf": [ { "$ref": "#/definitions/Identifier" } ] }, "allow": { "description": "定义范围允许内容的数据。", "type": ["array", "null"], "items": { "$ref": "#/definitions/Value" } }, "deny": { "description": "定义范围拒绝内容的数据。验证逻辑应优先考虑此数据。", "type": ["array", "null"], "items": { "$ref": "#/definitions/Value" } } } } ] }, "Identifier": { "type": "string" }, "Value": { "description": "所有支持的 ACL 值。", "anyOf": [ { "description": "表示一个 null JSON 值。", "type": "null" }, { "description": "表示一个 [`bool`]。", "type": "boolean" }, { "description": "表示一个有效的 ACL [`Number`]。", "allOf": [ { "$ref": "#/definitions/Number" } ] }, { "description": "表示一个 [`String`]。", "type": "string" }, { "description": "表示其他 [`Value`] 的列表。", "type": "array", "items": { "$ref": "#/definitions/Value" } }, { "description": "表示 [`String`] 键到 [`Value`] 的映射。", "type": "object", "additionalProperties": { "$ref": "#/definitions/Value" } } ] }, "Number": { "description": "一个有效的 ACL 数字。", "anyOf": [ { "description": "表示一个 [`i64`]。", "type": "integer", "format": "int64" }, { "description": "表示一个 [`f64`]。", "type": "number", "format": "double" } ] }, "Target": { "description": "平台目标。", "oneOf": [ { "description": "macOS。", "type": "string", "enum": ["macOS"] }, { "description": "Windows。", "type": "string", "enum": ["windows"] }, { "description": "Linux。", "type": "string", "enum": ["linux"] }, { "description": "Android。", "type": "string", "enum": ["android"] }, { "description": "iOS。", "type": "string", "enum": ["iOS"] } ] }, "HeaderConfig": { "description": "一个结构体,其中键是一些特定的HTTP头名称。\n\n 如果定义了这些键的值,它们将作为响应消息的一部分发送。\n 这不包括错误消息和IPC消息\n\n ## 示例配置\n ```javascript\n {\n //..\n app:{\n //..\n security: {\n headers: {\n \"Cross-Origin-Opener-Policy\": \"same-origin\",\n \"Cross-Origin-Embedder-Policy\": \"require-corp\",\n \"Timing-Allow-Origin\": [\n \"https://developer.mozilla.org\",\n \"https://example.com\",\n ],\n \"Access-Control-Expose-Headers\": \"Tauri-Custom-Header\",\n \"Tauri-Custom-Header\": {\n \"key1\": \"'value1' 'value2'\",\n \"key2\": \"'value3'\"\n }\n },\n csp: \"default-src 'self'; connect-src ipc: http://ipc.localhost\",\n }\n //..\n }\n //..\n }\n ```\n 在此示例中,`Cross-Origin-Opener-Policy` 和 `Cross-Origin-Embedder-Policy` 被设置为允许使用 [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer)。\n 结果是,这些头将被设置在通过 crates/tauri/src/protocol/tauri.rs 中的 `get_response` 函数发送的每个响应上。\n Content-Security-Policy 头是单独定义的,因为它也单独处理。\n\n 对于helloworld示例,此配置转换为这些响应头:\n ```http\n access-control-allow-origin: http://tauri.localhost\n access-control-expose-headers: Tauri-Custom-Header\n content-security-policy: default-src 'self'; connect-src ipc: http://ipc.localhost; script-src 'self' 'sha256-Wjjrs6qinmnr+tOry8x8PPwI77eGpUFR3EEGZktjJNs='\n content-type: text/html\n cross-origin-embedder-policy: require-corp\n cross-origin-opener-policy: same-origin\n tauri-custom-header: key1 'value1' 'value2'; key2 'value3'\n timing-allow-origin: https://developer.mozilla.org, https://example.com\n ```\n 由于结果头值始终是“类字符串”的。因此,根据 HeaderSource 的数据类型,它们需要被转换。\n - `String`(JS/Rust): 保持结果头值相同\n - `Array`(JS)/`Vec\\`(Rust): 项目通过 \", \" 为结果头值连接\n - `Object`(JS)/ `Hashmap\\`(Rust): 从以下内容组成项目:key + space + value。然后通过 \"; \" 为结果头值连接", "type": "object", "properties": { "Access-Control-Allow-Credentials": { "description": "Access-Control-Allow-Credentials 响应头告诉浏览器\n 服务器是否允许跨域 HTTP 请求包含凭据。\n\n 参阅 ", "anyOf": [ { "$ref": "#/definitions/HeaderSource" }, { "type": "null" } ] }, "Access-Control-Allow-Headers": { "description": "Access-Control-Allow-Headers响应头用于响应\n包含Access-Control-Request-Headers的预检请求\n以指示实际请求期间可以使用哪些HTTP头。\n\n如果请求有Access-Control-Request-Headers头,则需要此头。\n\n请参阅 ", "anyOf": [ { "$ref": "#/definitions/HeaderSource" }, { "type": "null" } ] }, "Access-Control-Allow-Methods": { "description": "Access-Control-Allow-Methods响应头指定一个或多个方法\n在响应预检请求访问资源时允许。\n\n请参阅 ", "anyOf": [ { "$ref": "#/definitions/HeaderSource" }, { "type": "null" } ] }, "Access-Control-Expose-Headers": { "description": "Access-Control-Expose-Headers响应头允许服务器指示\n哪些响应头应提供给浏览器中运行的脚本,\n以响应跨域请求。\n\n请参阅 ", "anyOf": [ { "$ref": "#/definitions/HeaderSource" }, { "type": "null" } ] }, "Access-Control-Max-Age": { "description": "Access-Control-Max-Age 响应头指示预检请求的结果\n (即 Access-Control-Allow-Methods 和 Access-Control-Allow-Headers 头中包含的信息)\n 可以缓存多久。\n\n 参阅 ", "anyOf": [ { "$ref": "#/definitions/HeaderSource" }, { "type": "null" } ] }, "Cross-Origin-Embedder-Policy": { "description": "HTTP Cross-Origin-Embedder-Policy (COEP) 响应头配置将跨源资源嵌入到文档中。\n\n 参阅 ", "anyOf": [ { "$ref": "#/definitions/HeaderSource" }, { "type": "null" } ] }, "Cross-Origin-Opener-Policy": { "description": "HTTP Cross-Origin-Opener-Policy (COOP) 响应头允许您确保\n 顶级文档不与跨源文档共享浏览上下文组。\n COOP 将对您的文档进行进程隔离,如果潜在攻击者在弹出窗口中打开它,也无法访问您的全局对象,\n 从而防止一组被称为 XS-Leaks 的跨源攻击。\n\n 参阅 ", "anyOf": [ { "$ref": "#/definitions/HeaderSource" }, { "type": "null" } ] }, "Cross-Origin-Resource-Policy": { "description": "HTTP Cross-Origin-Resource-Policy 响应头传达浏览器\n 应阻止对给定资源的 no-cors 跨源/跨站点请求的愿望。\n\n 参阅 ", "anyOf": [ { "$ref": "#/definitions/HeaderSource" }, { "type": "null" } ] }, "Permissions-Policy": { "description": "HTTP Permissions-Policy 头提供一种机制来允许和拒绝\n 在文档中或文档的任何 \\ 元素中使用浏览器功能。\n\n 参阅 ", "anyOf": [ { "$ref": "#/definitions/HeaderSource" }, { "type": "null" } ] }, "Service-Worker-Allowed": { "description": "HTTP Service-Worker-Allowed 响应头用于扩大\n service worker 默认范围的路径限制。\n\n 默认情况下,service worker 注册的范围是 service worker 脚本所在的目录。\n 例如,如果脚本 `sw.js` 位于 `/js/sw.js`,则默认情况下它只能控制 `/js/` 下的 URL。\n 服务器可以使用 `Service-Worker-Allowed` 头来允许 service worker 控制其自身目录之外的 URL。\n\n 参阅 ", "anyOf": [ { "$ref": "#/definitions/HeaderSource" }, { "type": "null" } ] }, "Timing-Allow-Origin": { "description": "Timing-Allow-Origin 响应头指定允许查看通过 Resource Timing API 功能检索的属性值的源,\n 否则由于跨源限制,这些值将被报告为零。\n\n 参阅 ", "anyOf": [ { "$ref": "#/definitions/HeaderSource" }, { "type": "null" } ] }, "X-Content-Type-Options": { "description": "X-Content-Type-Options 响应 HTTP 头是服务器用来指示\n 应遵循 Content-Type 头中通告的 MIME 类型而不应更改的标记。\n 该头允许您通过说 MIME 类型是故意配置的来避免 MIME 类型嗅探。\n\n 参阅 ", "anyOf": [ { "$ref": "#/definitions/HeaderSource" }, { "type": "null" } ] }, "Tauri-Custom-Header": { "description": "自定义头字段 Tauri-Custom-Header,不要使用它。\n 记得相应地设置 Access-Control-Expose-Headers\n\n **不适用于生产环境**", "anyOf": [ { "$ref": "#/definitions/HeaderSource" }, { "type": "null" } ] } }, "additionalProperties": false }, "HeaderSource": { "description": "头源的定义\n\n 头名称对应的头值", "anyOf": [ { "description": "头值的字符串版本", "type": "string" }, { "description": "头值的列表版本。项目通过 \",\" 连接为真实的头值", "type": "array", "items": { "type": "string" } }, { "description": "(Rust struct | Json | JavaScript Object) 等效的头值。项目由:key + space + value 组成。项目然后通过 \";\" 连接为真实的头值", "type": "object", "additionalProperties": { "type": "string" } } ] }, "TrayIconConfig": { "description": "应用程序托盘图标的配置。\n\n 参阅更多: ", "type": "object", "required": ["iconPath"], "properties": { "id": { "description": "为此托盘图标设置一个 ID,以便您稍后可以引用它,默认为 `main`。", "type": ["string", "null"] }, "iconPath": { "description": "用于托盘图标的默认图标路径。\n\n 注意:这会将图像以原始像素存储到最终二进制文件中,\n因此请保持图标尺寸(宽度和高度)较小,\n否则会导致最终可执行文件膨胀", "type": "string" }, "iconAsTemplate": { "description": "一个布尔值,确定图像是否代表 macOS 上的 [模板](https://developer.apple.com/documentation/appkit/nsimage/1520017-template?language=objc) 图像。", "default": false, "type": "boolean" }, "menuOnLeftClick": { "description": "一个布尔值,确定当托盘图标接收到左键单击时是否应显示菜单。\n\n ## 平台特定:\n\n - **Linux**: 不支持。", "default": true, "deprecated": true, "type": "boolean" }, "showMenuOnLeftClick": { "description": "一个布尔值,确定当托盘图标接收到左键单击时是否应显示菜单。\n\n ## 平台特定:\n\n - **Linux**: 不支持。", "default": true, "type": "boolean" }, "title": { "description": "macOS 托盘的标题。", "type": ["string", "null"] }, "tooltip": { "description": "Windows 和 macOS 上的托盘图标工具提示。", "type": ["string", "null"] } }, "additionalProperties": false }, "BuildConfig": { "description": "构建配置对象。\n\n 参阅更多: ", "type": "object", "properties": { "runner": { "description": "用于构建和运行应用程序的二进制文件。", "anyOf": [ { "$ref": "#/definitions/RunnerConfig" }, { "type": "null" } ] }, "devUrl": { "description": "开发环境中加载的 URL。\n\n 这通常是一个开发服务器的 URL,它提供热重载和 HMR 的应用程序资源。\n 大多数现代 JavaScript 打包器如 [Vite](https://vite.dev/guide/) 默认提供一种启动开发服务器的方法。\n\n 如果您没有开发服务器或不想使用开发服务器,请忽略此选项并使用 [`frontendDist`](BuildConfig::frontend_dist)\n 并指向 web 资源目录,Tauri CLI 将运行其内置开发服务器并提供简单的热重载体验。", "type": ["string", "null"], "format": "uri" }, "frontendDist": { "description": "应用程序资源的路径(通常是 javascript 打包器的 `dist` 文件夹)\n 或可以是 tauri 应用程序中注册的自定义协议(例如:`myprotocol://`)\n 或远程 URL(例如:`https://site.com/app`)的 URL。\n\n 当提供相对于配置文件的路径时,\n 它将被递归读取,所有文件将嵌入到应用程序二进制文件中。\n 然后 Tauri 查找 `index.html` 并将其作为应用程序的默认入口点。\n\n 您还可以提供要嵌入的路径列表,这允许对添加到二进制文件的文件进行细粒度控制。\n 在这种情况下,所有文件都添加到根目录,您必须在 HTML 文件中以这种方式引用它们。\n\n 当提供 URL 时,应用程序将没有打包资源,\n 应用程序默认将加载该 URL。", "anyOf": [ { "$ref": "#/definitions/FrontendDist" }, { "type": "null" } ] }, "beforeDevCommand": { "description": "在 `tauri dev` 启动之前运行的 shell 命令。\n\n 如果您执行条件编译,则会设置 TAURI_ENV_PLATFORM、TAURI_ENV_ARCH、TAURI_ENV_FAMILY、TAURI_ENV_PLATFORM_VERSION、TAURI_ENV_PLATFORM_TYPE 和 TAURI_ENV_DEBUG 环境变量。", "anyOf": [ { "$ref": "#/definitions/BeforeDevCommand" }, { "type": "null" } ] }, "beforeBuildCommand": { "description": "在 `tauri build` 启动之前运行的 shell 命令。\n\n 如果您执行条件编译,则会设置 TAURI_ENV_PLATFORM、TAURI_ENV_ARCH、TAURI_ENV_FAMILY、TAURI_ENV_PLATFORM_VERSION、TAURI_ENV_PLATFORM_TYPE 和 TAURI_ENV_DEBUG 环境变量。", "anyOf": [ { "$ref": "#/definitions/HookCommand" }, { "type": "null" } ] }, "beforeBundleCommand": { "description": "在 `tauri build` 中的打包阶段启动之前运行的 shell 命令。\n\n 如果您执行条件编译,则会设置 TAURI_ENV_PLATFORM、TAURI_ENV_ARCH、TAURI_ENV_FAMILY、TAURI_ENV_PLATFORM_VERSION、TAURI_ENV_PLATFORM_TYPE 和 TAURI_ENV_DEBUG 环境变量。", "anyOf": [ { "$ref": "#/definitions/HookCommand" }, { "type": "null" } ] }, "features": { "description": "传递给 `cargo` 命令的功能。", "type": ["array", "null"], "items": { "type": "string" } }, "removeUnusedCommands": { "description": "尝试在 `tauri build` 期间基于 ACL 列表删除从插件注册的未使用命令,\n 其工作方式是 tauri-cli 将读取此内容并为构建脚本和宏设置环境变量,\n 它们将尝试获取所有允许的命令并删除其余命令\n\n 注意:\n - 当您使用 `dynamic-acl` 功能标志(目前默认启用)中的功能时,这不会考虑动态添加的 ACL,因此在使用时请务必检查\n - 此功能需要 tauri-plugin 2.1 和 tauri 2.4", "default": false, "type": "boolean" }, "additionalWatchFolders": { "description": "运行 `tauri dev` 时要监视更改的其他路径。", "default": [], "type": "array", "items": { "type": "string" } } }, "additionalProperties": false }, "RunnerConfig": { "description": "运行器配置。", "anyOf": [ { "description": "指定要运行的二进制文件的字符串。", "type": "string" }, { "description": "具有高级配置选项的对象。", "type": "object", "required": ["cmd"], "properties": { "cmd": { "description": "要运行的二进制文件。", "type": "string" }, "cwd": { "description": "运行命令的当前工作目录。", "type": ["string", "null"] }, "args": { "description": "传递给命令的参数。", "type": ["array", "null"], "items": { "type": "string" } } } } ] }, "FrontendDist": { "description": "定义要嵌入到应用程序中的 URL 或资源。", "anyOf": [ { "description": "应作为默认应用程序 URL 使用的外部 URL。", "type": "string", "format": "uri" }, { "description": "包含前端 dist 资源的目录路径。", "type": "string" }, { "description": "要嵌入到应用程序中的文件数组。", "type": "array", "items": { "type": "string" } } ] }, "BeforeDevCommand": { "description": "描述在 `tauri dev` 之前运行的 shell 命令。", "anyOf": [ { "description": "使用默认选项运行给定脚本。", "type": "string" }, { "description": "使用自定义选项运行给定脚本。", "type": "object", "required": ["script"], "properties": { "script": { "description": "要执行的脚本。", "type": "string" }, "cwd": { "description": "当前工作目录。", "type": ["string", "null"] }, "wait": { "description": "`tauri dev` 是否应等待命令完成。默认为 `false`。", "default": false, "type": "boolean" } } } ] }, "HookCommand": { "description": "描述在触发 CLI 钩子时要执行的 shell 命令。", "anyOf": [ { "description": "使用默认选项运行给定脚本。", "type": "string" }, { "description": "使用自定义选项运行给定脚本。", "type": "object", "required": ["script"], "properties": { "script": { "description": "要执行的脚本。", "type": "string" }, "cwd": { "description": "当前工作目录。", "type": ["string", "null"] } } } ] }, "BundleConfig": { "description": "tauri-bundler 的配置。\n\n 参阅更多: ", "type": "object", "properties": { "active": { "description": "Tauri 是否应该打包您的应用程序还是仅输出可执行文件。", "default": false, "type": "boolean" }, "targets": { "description": "打包目标,目前支持 [\"deb\", \"rpm\", \"appimage\", \"nsis\", \"msi\", \"app\", \"dmg\"] 或 \"all\"。", "default": "all", "allOf": [ { "$ref": "#/definitions/BundleTarget" } ] }, "createUpdaterArtifacts": { "description": "是否生成更新程序及其签名", "default": false, "allOf": [ { "$ref": "#/definitions/Updater" } ] }, "publisher": { "description": "应用程序的发布者。默认为标识符字符串中的第二个元素。\n\n 目前映射到 Windows Installer 的 Manufacturer 属性\n 和 debian 包的 Maintainer 字段(如果 Cargo.toml 没有 authors 字段)。", "type": ["string", "null"] }, "homepage": { "description": "应用程序主页的 URL。如果未设置,将\n 回退到 `Cargo.toml` 中定义的 `homepage`。\n\n 支持的打包目标:`deb`、`rpm`、`nsis` 和 `msi`。", "type": ["string", "null"] }, "icon": { "description": "应用程序的图标", "default": [], "type": "array", "items": { "type": "string" } }, "resources": { "description": "要打包的应用程序资源。\n 每个资源是文件或目录的路径。\n 支持 glob 模式。\n\n ## 示例\n\n 要包含文件列表:\n\n ```json\n {\n \"bundle\": {\n \"resources\": [\n \"./path/to/some-file.txt\",\n \"/absolute/path/to/textfile.txt\",\n \"../relative/path/to/jsonfile.json\",\n \"some-folder/\",\n \"resources/**/*.md\"\n ]\n }\n }\n ```\n\n 打包的文件将位于 `$RESOURCES/` 中,保留原始目录结构,\n 例如:`./path/to/some-file.txt` -> `$RESOURCE/path/to/some-file.txt`\n\n 要精确控制文件复制到的位置,请改用映射\n\n ```json\n {\n \"bundle\": {\n \"resources\": {\n \"/absolute/path/to/textfile.txt\": \"resources/textfile.txt\",\n \"relative/path/to/jsonfile.json\": \"resources/jsonfile.json\",\n \"resources/\": \"\",\n \"docs/**/*md\": \"website-docs/\"\n }\n }\n }\n ```\n\n 请注意,在这种情况下使用 glob 模式时,不会保留原始目录结构,\n 所有内容都直接复制到目标目录\n\n 参阅更多: ", "anyOf": [ { "$ref": "#/definitions/BundleResources" }, { "type": "null" } ] }, "copyright": { "description": "与应用程序关联的版权字符串。", "type": ["string", "null"] }, "license": { "description": "要包含在相应打包中的软件包许可证标识符。\n 如果未设置,则默认为 Cargo.toml 文件中的许可证。", "type": ["string", "null"] }, "licenseFile": { "description": "要包含在相应打包中的许可证文件路径。", "type": ["string", "null"] }, "category": { "description": "应用程序类型。\n\n 应该是以下之一: Business、DeveloperTool、Education、Entertainment、Finance、Game、ActionGame、AdventureGame、ArcadeGame、BoardGame、CardGame、CasinoGame、DiceGame、EducationalGame、FamilyGame、KidsGame、MusicGame、PuzzleGame、RacingGame、RolePlayingGame、SimulationGame、SportsGame、StrategyGame、TriviaGame、WordGame、GraphicsAndDesign、HealthcareAndFitness、Lifestyle、Medical、Music、News、Photography、Productivity、Reference、SocialNetworking、Sports、Travel、Utility、Video、Weather。", "type": ["string", "null"] }, "fileAssociations": { "description": "与应用程序关联的文件类型。", "type": ["array", "null"], "items": { "$ref": "#/definitions/FileAssociation" } }, "shortDescription": { "description": "应用程序的简短描述。", "type": ["string", "null"] }, "longDescription": { "description": "应用程序的较长、多行描述。", "type": ["string", "null"] }, "useLocalToolsDir": { "description": "是否使用项目的 `target` 目录来缓存构建工具(例如 Wix 和 NSIS)以构建此应用程序。默认为 `false`。\n\n 如果为 true,工具将缓存在 `target/.tauri/` 中。\n 如果为 false,工具将缓存在当前用户的平台特定缓存目录中。\n\n 适合将此选项设置为 `true` 的一个示例是作为 Windows 系统用户(例如 AWS EC2 工作负载)构建此应用程序时,\n 因为 Windows 系统的应用数据目录受到限制。", "default": false, "type": "boolean" }, "externalBin": { "description": "要嵌入到应用程序中的二进制文件的绝对或相对路径列表。\n\n 请注意,Tauri 将按照 \"binary-name{-target-triple}{.system-extension}\" 模式查找特定于系统的二进制文件。\n\n 例如,对于外部二进制文件 \"my-binary\",Tauri 会查找:\n\n - Windows 的 \"my-binary-x86_64-pc-windows-msvc.exe\" \n - macOS 的 \"my-binary-x86_64-apple-darwin\"\n - Linux 的 \"my-binary-x86_64-unknown-linux-gnu\"\n\n 因此不要忘记为所有目标平台提供二进制文件。", "type": ["array", "null"], "items": { "type": "string" } }, "windows": { "description": "Windows 打包的配置。", "default": { "allowDowngrades": true, "certificateThumbprint": null, "digestAlgorithm": null, "nsis": null, "signCommand": null, "timestampUrl": null, "tsp": false, "webviewInstallMode": { "silent": true, "type": "downloadBootstrapper" }, "wix": null }, "allOf": [ { "$ref": "#/definitions/WindowsConfig" } ] }, "linux": { "description": "Linux 打包的配置。", "default": { "appimage": { "bundleMediaFramework": false, "files": {} }, "deb": { "files": {} }, "rpm": { "epoch": 0, "files": {}, "release": "1" } }, "allOf": [ { "$ref": "#/definitions/LinuxConfig" } ] }, "macOS": { "description": "macOS 打包的配置。", "default": { "dmg": { "appPosition": { "x": 180, "y": 170 }, "applicationFolderPosition": { "x": 480, "y": 170 }, "windowSize": { "height": 400, "width": 660 } }, "files": {}, "hardenedRuntime": true, "minimumSystemVersion": "10.13" }, "allOf": [ { "$ref": "#/definitions/MacConfig" } ] }, "iOS": { "description": "iOS configuration.", "default": { "minimumSystemVersion": "14.0" }, "allOf": [ { "$ref": "#/definitions/IosConfig" } ] }, "android": { "description": "Android 配置。", "default": { "autoIncrementVersionCode": false, "minSdkVersion": 24 }, "allOf": [ { "$ref": "#/definitions/AndroidConfig" } ] } }, "additionalProperties": false }, "BundleTarget": { "description": "打包目标。每个值不区分大小写。", "anyOf": [ { "description": "打包所有目标。", "const": "all" }, { "description": "打包目标列表。", "type": "array", "items": { "$ref": "#/definitions/BundleType" } }, { "description": "单个打包目标。", "allOf": [ { "$ref": "#/definitions/BundleType" } ] } ] }, "BundleType": { "description": "由 tauri-bundler 引用的打包。", "oneOf": [ { "description": "Debian 打包文件 (.deb)。", "type": "string", "enum": ["deb"] }, { "description": "RPM 打包文件 (.rpm)。", "type": "string", "enum": ["rpm"] }, { "description": "AppImage 打包文件 (.appimage)。", "type": "string", "enum": ["appimage"] }, { "description": "Microsoft Installer 打包文件 (.msi)。", "type": "string", "enum": ["msi"] }, { "description": "NSIS 打包文件 (.exe)。", "type": "string", "enum": ["nsis"] }, { "description": "macOS 应用程序打包文件 (.app)。", "type": "string", "enum": ["app"] }, { "description": "Apple 磁盘映像打包文件 (.dmg)。", "type": "string", "enum": ["dmg"] } ] }, "Updater": { "description": "更新程序类型", "anyOf": [ { "description": "生成传统的与 v1 兼容的压缩更新程序", "allOf": [ { "$ref": "#/definitions/V1Compatible" } ] }, { "description": "是否生成更新程序及其签名", "type": "boolean" } ] }, "V1Compatible": { "description": "生成传统的与 v1 兼容的压缩更新程序", "oneOf": [ { "description": "生成传统的与 v1 兼容的压缩更新程序", "type": "string", "enum": ["v1Compatible"] } ] }, "BundleResources": { "description": "打包资源的定义。\n 可以是要包含的路径列表,或源到目标路径的映射。", "anyOf": [ { "description": "要包含的路径列表。", "type": "array", "items": { "type": "string" } }, { "description": "源到目标路径的映射。", "type": "object", "additionalProperties": { "type": "string" } } ] }, "FileAssociation": { "description": "文件关联", "type": "object", "required": ["ext"], "properties": { "ext": { "description": "与此应用程序关联的文件扩展名。例如 'png'", "type": "array", "items": { "$ref": "#/definitions/AssociationExt" } }, "contentTypes": { "description": "声明对给定内容类型的文件的支持。在 macOS 上映射到 `LSItemContentTypes`。\n\n 这允许支持符合此类型的另一个应用程序声明的任何文件格式。\n 可以使用 [`Self::exported_type`] 声明新类型,并通过 [`ExportedFileAssociation::conforms_to`] 链接到某些内容类型。", "type": ["array", "null"], "items": { "type": "string" } }, "name": { "description": "名称。在 macOS 上映射到 `CFBundleTypeName`。默认为 `ext[0]`", "type": ["string", "null"] }, "description": { "description": "关联描述。仅限 Windows。它显示在 Windows 资源管理器的 `类型` 列中。", "type": ["string", "null"] }, "role": { "description": "应用程序对该类型的角色。在 macOS 上映射到 `CFBundleTypeRole`。", "default": "Editor", "allOf": [ { "$ref": "#/definitions/BundleTypeRole" } ] }, "mimeType": { "description": "MIME 类型,例如 'image/png' 或 'text/plain'。仅限 Linux。", "type": ["string", "null"] }, "rank": { "description": "此应用程序在声明自己为给定文件类型的编辑器或查看器的应用程序中的排名。在 macOS 上映射到 `LSHandlerRank`。", "default": "Default", "allOf": [ { "$ref": "#/definitions/HandlerRank" } ] }, "exportedType": { "description": "导出类型定义。在 macOS 上映射到 `UTExportedTypeDeclarations` 条目。\n\n 如果关联的文件是您的应用程序定义的自定义文件类型,则应该定义此类型。", "anyOf": [ { "$ref": "#/definitions/ExportedFileAssociation" }, { "type": "null" } ] } }, "additionalProperties": false }, "AssociationExt": { "description": "[`FileAssociation`] 的扩展名。\n\n 前导 `.` 会被自动去除。", "type": "string" }, "BundleTypeRole": { "description": "仅限 macOS。对应 CFBundleTypeRole", "oneOf": [ { "description": "CFBundleTypeRole.Editor。文件可以被读取和编辑。", "type": "string", "enum": ["Editor"] }, { "description": "CFBundleTypeRole.Viewer。文件可以被读取。", "type": "string", "enum": ["Viewer"] }, { "description": "CFBundleTypeRole.Shell", "type": "string", "enum": ["Shell"] }, { "description": "CFBundleTypeRole.QLGenerator", "type": "string", "enum": ["QLGenerator"] }, { "description": "CFBundleTypeRole.None", "type": "string", "enum": ["None"] } ] }, "HandlerRank": { "description": "对应 LSHandlerRank", "oneOf": [ { "description": "LSHandlerRank.Default。此应用程序是此类型文件的打开者;如果未指定排名,也使用此值。", "type": "string", "enum": ["Default"] }, { "description": "LSHandlerRank.Owner。此应用程序是此类型文件的主要创建者。", "type": "string", "enum": ["Owner"] }, { "description": "LSHandlerRank.Alternate。此应用程序是此类型文件的次要查看者。", "type": "string", "enum": ["Alternate"] }, { "description": "LSHandlerRank.None。从不选择此应用程序来打开此类型的文件,但它接受拖放此类型的文件。", "type": "string", "enum": ["None"] } ] }, "ExportedFileAssociation": { "description": "导出类型定义。在 macOS 上映射到 `UTExportedTypeDeclarations` 条目。", "type": "object", "required": ["identifier"], "properties": { "identifier": { "description": "导出类型的唯一标识符。映射到 `UTTypeIdentifier`。", "type": "string" }, "conformsTo": { "description": "此类型遵循的类型。映射到 `UTTypeConformsTo`。\n\n 示例包括 `public.data`、`public.image`、`public.json` 和 `public.database`。", "type": ["array", "null"], "items": { "type": "string" } } }, "additionalProperties": false }, "WindowsConfig": { "description": "Windows 打包配置。\n\n 参阅更多: ", "type": "object", "properties": { "digestAlgorithm": { "description": "指定用于创建文件签名的文件摘要算法。代码签名必需。建议使用 SHA-256。", "type": ["string", "null"] }, "certificateThumbprint": { "description": "指定签名证书的 SHA1 哈希值。", "type": ["string", "null"] }, "timestampUrl": { "description": "在时间戳期间使用的服务器。", "type": ["string", "null"] }, "tsp": { "description": "是否为时间戳服务器使用时间戳协议 (TSP,也称 RFC 3161)。您的代码签名提供商可能\n使用 TSP 时间戳服务器,例如 SSL.com。如果是这样,请通过设置为 true 来启用 TSP。", "default": false, "type": "boolean" }, "webviewInstallMode": { "description": "Webview2 运行时的安装模式。", "default": { "silent": true, "type": "downloadBootstrapper" }, "allOf": [ { "$ref": "#/definitions/WebviewInstallMode" } ] }, "allowDowngrades": { "description": "验证第二次应用程序安装,如果设置为 `false`,则阻止用户安装旧版本。\n\n 例如,如果安装了 `1.2.1`,用户将无法安装应用程序版本 `1.2.0` 或 `1.1.5`。\n\n 此标志的默认值为 `true`。", "default": true, "type": "boolean" }, "wix": { "description": "使用 WiX 生成的 MSI 的配置。", "anyOf": [ { "$ref": "#/definitions/WixConfig" }, { "type": "null" } ] }, "nsis": { "description": "使用 NSIS 生成的安装程序的配置。", "anyOf": [ { "$ref": "#/definitions/NsisConfig" }, { "type": "null" } ] }, "signCommand": { "description": "指定自定义命令来对二进制文件进行签名。\n 此命令需要在参数中有一个 `%1`,它只是二进制文件路径的占位符,\n 我们将在调用命令之前检测并替换它。\n\n 默认情况下,我们使用 `signtool.exe`,它只能在 Windows 上找到,因此\n 如果您在其他平台上并希望交叉编译和签名,您\n将需要使用其他工具,如 `osslsigncode`。", "anyOf": [ { "$ref": "#/definitions/CustomSignCommandConfig" }, { "type": "null" } ] } }, "additionalProperties": false }, "WebviewInstallMode": { "description": "Webview2 运行时的安装模式。\n 注意,对于更新程序打包,使用 [`Self::DownloadBootstrapper`]。\n\n 参阅 。", "oneOf": [ { "description": "不要作为 Windows 安装程序的一部分安装 Webview2。", "type": "object", "required": ["type"], "properties": { "type": { "type": "string", "enum": ["skip"] } }, "additionalProperties": false }, { "description": "下载引导程序并运行它。\n 需要互联网连接。结果安装程序大小更小,但在 Windows 7 上不推荐。", "type": "object", "required": ["type"], "properties": { "type": { "type": "string", "enum": ["downloadBootstrapper"] }, "silent": { "description": "指示安装程序以静默模式运行引导程序。默认为 `true`。", "default": true, "type": "boolean" } }, "additionalProperties": false }, { "description": "嵌入引导程序并运行它。\n 需要互联网连接。将安装程序大小增加约 1.8MB,但在 Windows 7 上提供更好的支持。", "type": "object", "required": ["type"], "properties": { "type": { "type": "string", "enum": ["embedBootstrapper"] }, "silent": { "description": "指示安装程序以静默模式运行引导程序。默认为 `true`。", "default": true, "type": "boolean" } }, "additionalProperties": false }, { "description": "嵌入离线安装程序并运行它。\n 不需要互联网连接。\n 将安装程序大小增加约 127MB。", "type": "object", "required": ["type"], "properties": { "type": { "type": "string", "enum": ["offlineInstaller"] }, "silent": { "description": "指示安装程序以静默模式运行。默认为 `true`。", "default": true, "type": "boolean" } }, "additionalProperties": false }, { "description": "嵌入固定的 webview2 版本并在运行时使用它。\n 将安装程序大小增加约 180MB。", "type": "object", "required": ["path", "type"], "properties": { "type": { "type": "string", "enum": ["fixedRuntime"] }, "path": { "description": "要使用的固定运行时的路径。\n\n 固定版本可以从[官方网站](https://developer.microsoft.com/en-us/microsoft-edge/webview2/#download-section)下载。\n `.cab` 文件必须解压到一个文件夹中,且该文件夹路径必须在此字段中定义。", "type": "string" } }, "additionalProperties": false } ] }, "WixConfig": { "description": "使用 WiX 的 MSI 打包配置。\n\n 参阅更多: ", "type": "object", "properties": { "version": { "description": "MSI 安装程序版本,格式为 `major.minor.patch.build`(build 是可选的)。\n\n 由于 MSI 安装程序需要有效版本,如果未设置此字段,将从 [`Config::version`] 派生。\n\n 第一个字段是主版本,最大值为 255。第二个字段是次版本,最大值为 255。\n 第三个和第四个字段的最大值为 65,535。\n\n 参阅 了解更多信息。", "type": ["string", "null"] }, "upgradeCode": { "description": "MSI 安装程序的 GUID 升级代码。此代码 **_必须在所有更新中保持不变_**,\n否则, Windows 会将您的更新视为不同的应用程序,您的用户将拥有应用程序的重复版本。\n\n 默认情况下,tauri 通过在 DNS 命名空间中使用字符串 `.exe.app.x64` 生成 Uuid v5 来生成此代码。\n 您可以使用 Tauri 的 CLI 生成并打印此代码,运行 `tauri inspect wix-upgrade-code`。\n\n 建议您在 tauri 配置文件中设置此值,以避免在想要更改产品名称时意外更改升级代码。", "type": ["string", "null"], "format": "uuid" }, "language": { "description": "要构建的安装程序语言。参阅 。", "default": "en-US", "allOf": [ { "$ref": "#/definitions/WixLanguage" } ] }, "template": { "description": "要使用的自定义 .wxs 模板。", "type": ["string", "null"] }, "fragmentPaths": { "description": "要使用的包含 WiX 片段的 .wxs 文件路径列表。", "default": [], "type": "array", "items": { "type": "string" } }, "componentGroupRefs": { "description": "您想要从片段中引用的 ComponentGroup 元素 id。", "default": [], "type": "array", "items": { "type": "string" } }, "componentRefs": { "description": "您想要从片段中引用的 Component 元素 id。", "default": [], "type": "array", "items": { "type": "string" } }, "featureGroupRefs": { "description": "您想要从片段中引用的 FeatureGroup 元素 id。", "default": [], "type": "array", "items": { "type": "string" } }, "featureRefs": { "description": "您想要从片段中引用的 Feature 元素 id。", "default": [], "type": "array", "items": { "type": "string" } }, "mergeRefs": { "description": "您想要从片段中引用的 Merge 元素 id。", "default": [], "type": "array", "items": { "type": "string" } }, "enableElevatedUpdateTask": { "description": "在 Windows 任务计划程序中创建提升的更新任务。", "default": false, "type": "boolean" }, "bannerPath": { "description": "用作安装用户界面横幅的位图文件的路径。\n 此位图将出现在安装程序除第一页外的所有页面顶部。\n\n 所需尺寸为 493px × 58px。", "type": ["string", "null"] }, "dialogImagePath": { "description": "在安装用户界面对话框中使用的位图文件的路径。\n 它用于欢迎和完成对话框。\n\n 所需尺寸为 493px × 312px。", "type": ["string", "null"] }, "fipsCompliant": { "description": "启用符合 FIPS 的算法。\n 也可以通过 `TAURI_BUNDLER_WIX_FIPS_COMPLIANT` 环境变量启用。", "default": false, "type": "boolean" } }, "additionalProperties": false }, "WixLanguage": { "description": "使用 WiX 构建的语言。", "anyOf": [ { "description": "要构建的单个语言,无需配置。", "type": "string" }, { "description": "要构建的语言列表,无需配置。", "type": "array", "items": { "type": "string" } }, { "description": "语言及其配置的映射。", "type": "object", "additionalProperties": { "$ref": "#/definitions/WixLanguageConfig" } } ] }, "WixLanguageConfig": { "description": "WiX 构建的目标语言配置。\n\n 参阅更多: ", "type": "object", "properties": { "localePath": { "description": "区域设置 (`.wxl`) 文件的路径。参阅 。", "type": ["string", "null"] } }, "additionalProperties": false }, "NsisConfig": { "description": "使用 NSIS 的安装程序配置。", "type": "object", "properties": { "template": { "description": "要使用的自定义 .nsi 模板。", "type": ["string", "null"] }, "headerImage": { "description": "要在安装程序页面标题显示的位图文件路径。\n\n 推荐尺寸为 150px x 57px。", "type": ["string", "null"] }, "sidebarImage": { "description": "欢迎页面和完成页面的位图文件路径。\n\n 推荐尺寸为 164px x 314px。", "type": ["string", "null"] }, "installerIcon": { "description": "用作安装程序图标的图标文件路径。", "type": ["string", "null"] }, "installMode": { "description": "安装是为所有用户还是仅为当前用户。", "default": "currentUser", "allOf": [ { "$ref": "#/definitions/NSISInstallerMode" } ] }, "languages": { "description": "安装程序语言列表。\n 默认情况下,使用操作系统语言。如果操作系统语言不在语言列表中,则使用第一种语言。\n 要允许用户选择语言,请将 `display_language_selector` 设置为 `true`。\n\n 有关完整语言列表,请参阅 ", "type": ["array", "null"], "items": { "type": "string" } }, "customLanguageFiles": { "description": "键值对,其中键是语言,\n 值是自定义 `.nsh` 文件的路径,该文件包含 tauri 自定义消息的翻译文本。\n\n 有关示例 `.nsh` 文件,请参阅 。\n\n **注意**:键必须是有效的 NSIS 语言,并且必须将其添加到 [`NsisConfig`] languages 数组中,", "type": ["object", "null"], "additionalProperties": { "type": "string" } }, "displayLanguageSelector": { "description": "是否在呈现安装程序和卸载程序窗口之前显示语言选择器对话框。\n 默认情况下,选择操作系统语言,并回退到 `languages` 数组中的第一种语言。", "default": false, "type": "boolean" }, "compression": { "description": "设置用于压缩安装程序中文件的压缩算法。\n\n 参阅 ", "default": "lzma", "allOf": [ { "$ref": "#/definitions/NsisCompression" } ] }, "startMenuFolder": { "description": "设置开始菜单快捷方式的文件夹名称。\n\n 如果您有多个应用程序并希望将其快捷方式分组在一个文件夹下,或者如果您通常更喜欢将快捷方式设置在文件夹内,请使用此选项。\n\n 示例:\n - `AwesomePublisher`,快捷方式将放置在 `%AppData%\\Microsoft\\Windows\\Start Menu\\Programs\\AwesomePublisher\\.lnk`\n - 如果未设置,快捷方式将放置在 `%AppData%\\Microsoft\\Windows\\Start Menu\\Programs\\.lnk`", "type": ["string", "null"] }, "installerHooks": { "description": ".nsh 文件的路径,该文件包含要挂钩到\n 主 installer.nsi 脚本中的特殊 NSIS 宏。\n\n 支持的挂钩有:\n\n - `NSIS_HOOK_PREINSTALL`: 此挂钩在复制文件、设置注册表键值和创建快捷方式之前运行。\n - `NSIS_HOOK_POSTINSTALL`: 此挂钩在安装程序完成复制所有文件、设置注册表键和创建快捷方式之后运行。\n - `NSIS_HOOK_PREUNINSTALL`: 此挂钩在删除任何文件、注册表键和快捷方式之前运行。\n - `NSIS_HOOK_POSTUNINSTALL`: 此挂钩在删除文件、注册表键和快捷方式之后运行。\n\n ### 示例\n\n ```nsh\n !macro NSIS_HOOK_PREINSTALL\n MessageBox MB_OK \"PreInstall\"\n !macroend\n\n !macro NSIS_HOOK_POSTINSTALL\n MessageBox MB_OK \"PostInstall\"\n !macroend\n\n !macro NSIS_HOOK_PREUNINSTALL\n MessageBox MB_OK \"PreUnInstall\"\n !macroend\n\n !macro NSIS_HOOK_POSTUNINSTALL\n MessageBox MB_OK \"PostUninstall\"\n !macroend\n ```", "type": ["string", "null"] }, "minimumWebview2Version": { "description": "尝试确保 WebView2 版本等于或高于此版本,\n 如果用户的 WebView2 版本低于此版本,\n 安装程序将尝试触发 WebView2 更新。", "type": ["string", "null"] } }, "additionalProperties": false }, "NSISInstallerMode": { "description": "NSIS 安装程序的安装模式。", "oneOf": [ { "description": "安装程序的默认模式。\n\n 默认情况下将应用程序安装在不需要管理员访问权限的目录中。\n\n 安装程序元数据将保存在 `HKCU` 注册表路径下。", "type": "string", "enum": ["currentUser"] }, { "description": "默认情况下将应用程序安装在 `Program Files` 文件夹目录中,安装需要管理员访问权限。\n\n 安装程序元数据将保存在 `HKLM` 注册表路径下。", "type": "string", "enum": ["perMachine"] }, { "description": "结合两种模式,允许用户在安装时选择是为当前用户安装还是为计算机安装。\n 注意,即使仅希望为当前用户安装,此模式仍需管理员访问权限。\n\n 安装程序元数据将根据用户选择保存在 `HKLM` 或 `HKCU` 注册表路径下。", "type": "string", "enum": ["both"] } ] }, "NsisCompression": { "description": "NSIS 安装程序中使用的压缩算法。\n\n 参阅 ", "oneOf": [ { "description": "ZLIB 使用 deflate 算法,它是一种快速简单的方法。使用默认压缩级别时,它使用约 300 KB 的内存。", "type": "string", "enum": ["zlib"] }, { "description": "BZIP2 通常提供比 ZLIB 更好的压缩比,但速度稍慢并使用更多内存。使用默认压缩级别时,它使用约 4 MB 的内存。", "type": "string", "enum": ["bzip2"] }, { "description": "LZMA (默认)是一种新的压缩方法,可提供非常好的压缩比。解压速度很高(在 2 GHz CPU 上为 10-20 MB/s),压缩速度较低。解压时使用的内存大小是字典大小加上几 KB,默认为 8 MB。", "type": "string", "enum": ["lzma"] }, { "description": "禁用压缩", "type": "string", "enum": ["none"] } ] }, "CustomSignCommandConfig": { "description": "自定义签名命令配置。", "anyOf": [ { "description": "要执行的脚本的字符串表示法。\n\n \"%1\" 将被替换为要签名的二进制文件的路径。\n\n 这是命令的更简单表示法。\n Tauri 将使用 `' '` 分割字符串,并将第一个元素用作命令名称,其余元素用作参数。\n\n 如果您需要在命令或参数中使用空格,请使用对象表示法 [`Self::ScriptWithOptions`]。", "type": "string" }, { "description": "命令的对象表示法。\n\n 这是命令的更复杂表示法,但\n 这允许您在命令和参数中使用空格。", "type": "object", "required": ["args", "cmd"], "properties": { "cmd": { "description": "用于对二进制文件进行签名的命令。", "type": "string" }, "args": { "description": "要传递给命令的参数。\n\n \"%1\" 将被替换为要签名的二进制文件的路径。", "type": "array", "items": { "type": "string" } } }, "additionalProperties": false } ] }, "LinuxConfig": { "description": "Linux 打包配置。\n\n 参阅更多: ", "type": "object", "properties": { "appimage": { "description": "AppImage 打包配置。", "default": { "bundleMediaFramework": false, "files": {} }, "allOf": [ { "$ref": "#/definitions/AppImageConfig" } ] }, "deb": { "description": "Debian 打包配置。", "default": { "files": {} }, "allOf": [ { "$ref": "#/definitions/DebConfig" } ] }, "rpm": { "description": "RPM 打包配置。", "default": { "epoch": 0, "files": {}, "release": "1" }, "allOf": [ { "$ref": "#/definitions/RpmConfig" } ] } }, "additionalProperties": false }, "AppImageConfig": { "description": "AppImage 打包配置。\n\n 参阅更多: ", "type": "object", "properties": { "bundleMediaFramework": { "description": "包含音频和视频播放所需的额外 gstreamer 依赖项。\n 这会将打包大小增加约 15-35MB,具体取决于您的构建系统。", "default": false, "type": "boolean" }, "files": { "description": "要包含在 AppImage 二进制文件中的文件。", "default": {}, "type": "object", "additionalProperties": { "type": "string" } } }, "additionalProperties": false }, "DebConfig": { "description": "Debian (.deb) 打包配置。\n\n 参阅更多: ", "type": "object", "properties": { "depends": { "description": "您的应用程序依赖的 deb 依赖项列表。", "type": ["array", "null"], "items": { "type": "string" } }, "recommends": { "description": "您的应用程序推荐的 deb 依赖项列表。", "type": ["array", "null"], "items": { "type": "string" } }, "provides": { "description": "包提供的依赖项列表。", "type": ["array", "null"], "items": { "type": "string" } }, "conflicts": { "description": "包冲突列表。", "type": ["array", "null"], "items": { "type": "string" } }, "replaces": { "description": "包替换列表。", "type": ["array", "null"], "items": { "type": "string" } }, "files": { "description": "要包含在打包中的文件。", "default": {}, "type": "object", "additionalProperties": { "type": "string" } }, "section": { "description": "定义 Debian Control 文件中的 section。参阅: https://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections", "type": ["string", "null"] }, "priority": { "description": "更改 Debian 包的优先级。默认情况下,它设置为 `optional`。\n 目前认可的优先级为:`required`、`important`、`standard`、`optional`、`extra`", "type": ["string", "null"] }, "changelog": { "description": "未压缩的 Changelog 文件的路径,将存储在 /usr/share/doc/package-name/changelog.gz。参阅\n ", "type": ["string", "null"] }, "desktopTemplate": { "description": "自定义 desktop 文件 Handlebars 模板的路径。\n\n 可用变量:`categories`、`comment`(可选)、`exec`、`icon` 和 `name`。", "type": ["string", "null"] }, "preInstallScript": { "description": "将在解包打包之前执行的脚本的路径。参阅\n ", "type": ["string", "null"] }, "postInstallScript": { "description": "将在解包打包之后执行的脚本的路径。参阅\n ", "type": ["string", "null"] }, "preRemoveScript": { "description": "将在删除打包之前执行的脚本的路径。参阅\n ", "type": ["string", "null"] }, "postRemoveScript": { "description": "将在删除打包之后执行的脚本的路径。参阅\n ", "type": ["string", "null"] } }, "additionalProperties": false }, "RpmConfig": { "description": "RPM 打包配置。", "type": "object", "properties": { "depends": { "description": "您的应用程序依赖的 RPM 依赖项列表。", "type": ["array", "null"], "items": { "type": "string" } }, "recommends": { "description": "您的应用程序推荐的 RPM 依赖项列表。", "type": ["array", "null"], "items": { "type": "string" } }, "provides": { "description": "您的应用程序提供的 RPM 依赖项列表。", "type": ["array", "null"], "items": { "type": "string" } }, "conflicts": { "description": "您的应用程序冲突的 RPM 依赖项列表。为了安装打包,这些依赖项必须不存在。", "type": ["array", "null"], "items": { "type": "string" } }, "obsoletes": { "description": "您的应用程序取代的 RPM 依赖项列表 - 如果安装了此软件包,\n 列为\"obsoletes\"的软件包将被自动删除(如果存在)。", "type": ["array", "null"], "items": { "type": "string" } }, "release": { "description": "RPM 发布标签。", "default": "1", "type": "string" }, "epoch": { "description": "RPM epoch。", "default": 0, "type": "integer", "format": "uint32", "minimum": 0 }, "files": { "description": "要包含在打包中的文件。", "default": {}, "type": "object", "additionalProperties": { "type": "string" } }, "desktopTemplate": { "description": "自定义 desktop 文件 Handlebars 模板的路径。\n\n 可用变量:`categories`、`comment`(可选)、`exec`、`icon` 和 `name`。", "type": ["string", "null"] }, "preInstallScript": { "description": "将在解包打包之前执行的脚本的路径。参阅\n ", "type": ["string", "null"] }, "postInstallScript": { "description": "将在解包打包之后执行的脚本的路径。参阅\n ", "type": ["string", "null"] }, "preRemoveScript": { "description": "将在删除打包之前执行的脚本的路径。参阅\n ", "type": ["string", "null"] }, "postRemoveScript": { "description": "将在删除打包之后执行的脚本的路径。参阅\n ", "type": ["string", "null"] }, "compression": { "description": "压缩算法和级别。默认使用级别为 6 的 `Gzip`。", "anyOf": [ { "$ref": "#/definitions/RpmCompression" }, { "type": "null" } ] } }, "additionalProperties": false }, "RpmCompression": { "description": "打包 RPM 包时使用的压缩算法。", "oneOf": [ { "description": "Gzip 压缩", "type": "object", "required": ["level", "type"], "properties": { "type": { "type": "string", "enum": ["gzip"] }, "level": { "description": "Gzip 压缩级别", "type": "integer", "format": "uint32", "minimum": 0 } }, "additionalProperties": false }, { "description": "Zstd 压缩", "type": "object", "required": ["level", "type"], "properties": { "type": { "type": "string", "enum": ["zstd"] }, "level": { "description": "Zstd 压缩级别", "type": "integer", "format": "int32" } }, "additionalProperties": false }, { "description": "Xz 压缩", "type": "object", "required": ["level", "type"], "properties": { "type": { "type": "string", "enum": ["xz"] }, "level": { "description": "Xz 压缩级别", "type": "integer", "format": "uint32", "minimum": 0 } }, "additionalProperties": false }, { "description": "Bzip2 压缩", "type": "object", "required": ["level", "type"], "properties": { "type": { "type": "string", "enum": ["bzip2"] }, "level": { "description": "Bzip2 压缩级别", "type": "integer", "format": "uint32", "minimum": 0 } }, "additionalProperties": false }, { "description": "禁用压缩", "type": "object", "required": ["type"], "properties": { "type": { "type": "string", "enum": ["none"] } }, "additionalProperties": false } ] }, "MacConfig": { "description": "macOS 打包配置。\n\n 参阅更多: ", "type": "object", "properties": { "frameworks": { "description": "指示需要与应用程序一起打包的 macOS X 框架的字符串列表。\n\n 如果使用名称,必须省略 \".framework\",它将在标准安装位置中查找。您也可以使用特定框架的路径。", "type": ["array", "null"], "items": { "type": "string" } }, "files": { "description": "要包含在包中的文件。", "default": {}, "type": "object", "additionalProperties": { "type": "string" } }, "bundleVersion": { "description": "标识打包迭代的构建版本。\n\n 转换为打包的 CFBundleVersion 属性。", "type": ["string", "null"] }, "bundleName": { "description": "构建打包的构建器名称。\n\n 转换为打包的 CFBundleName 属性。\n\n 如果未设置,则默认为包的产品名称。", "type": ["string", "null"] }, "minimumSystemVersion": { "description": "指示打包应用程序支持的最低 macOS X 版本的版本字符串。默认为 `10.13`。\n\n 将其设置为 `null` 会完全删除打包的 `Info.plist` 上的 `LSMinimumSystemVersion` 字段\n 和 `MACOSX_DEPLOYMENT_TARGET` 环境变量。\n\n 在 `tauri dev` 中被忽略。\n\n 空字符串被视为无效值,因此使用默认值。", "default": "10.13", "type": ["string", "null"] }, "exceptionDomain": { "description": "允许您的应用程序与外部世界通信。\n 它应该是小写的、不带端口和协议的域名。", "type": ["string", "null"] }, "signingIdentity": { "description": "用于代码签名的身份。", "type": ["string", "null"] }, "hardenedRuntime": { "description": "codesign 是否应该启用[强化运行时](https://developer.apple.com/documentation/security/hardened_runtime)(用于可执行文件)。", "default": true, "type": "boolean" }, "providerShortName": { "description": "用于公证的提供者短名称。", "type": ["string", "null"] }, "entitlements": { "description": "entitlements 文件的路径。", "type": ["string", "null"] }, "infoPlist": { "description": "要与默认 Info.plist 合并的 Info.plist 文件路径。\n\n 请注意,Tauri 还会在与 Tauri 配置文件相同的目录中查找 `Info.plist` 文件。", "type": ["string", "null"] }, "dmg": { "description": "DMG 特定设置。", "default": { "appPosition": { "x": 180, "y": 170 }, "applicationFolderPosition": { "x": 480, "y": 170 }, "windowSize": { "height": 400, "width": 660 } }, "allOf": [ { "$ref": "#/definitions/DmgConfig" } ] } }, "additionalProperties": false }, "DmgConfig": { "description": "Apple 磁盘映像 (.dmg) 打包配置。\n\n 参阅更多: ", "type": "object", "properties": { "background": { "description": "用作 dmg 文件背景的图像。接受的格式:`png`/`jpg`/`gif`。", "type": ["string", "null"] }, "windowPosition": { "description": "卷窗口在屏幕上的位置。", "anyOf": [ { "$ref": "#/definitions/Position" }, { "type": "null" } ] }, "windowSize": { "description": "卷窗口的大小。", "default": { "height": 400, "width": 660 }, "allOf": [ { "$ref": "#/definitions/Size" } ] }, "appPosition": { "description": "应用程序文件在窗口中的位置。", "default": { "x": 180, "y": 170 }, "allOf": [ { "$ref": "#/definitions/Position" } ] }, "applicationFolderPosition": { "description": "应用程序文件夹在窗口中的位置。", "default": { "x": 480, "y": 170 }, "allOf": [ { "$ref": "#/definitions/Position" } ] } }, "additionalProperties": false }, "Position": { "description": "位置坐标结构体。", "type": "object", "required": ["x", "y"], "properties": { "x": { "description": "X 坐标。", "type": "integer", "format": "uint32", "minimum": 0 }, "y": { "description": "Y 坐标。", "type": "integer", "format": "uint32", "minimum": 0 } }, "additionalProperties": false }, "Size": { "description": "窗口大小。", "type": "object", "required": ["height", "width"], "properties": { "width": { "description": "窗口宽度。", "type": "integer", "format": "uint32", "minimum": 0 }, "height": { "description": "窗口高度。", "type": "integer", "format": "uint32", "minimum": 0 } }, "additionalProperties": false }, "IosConfig": { "description": "iOS 目标的通用配置。", "type": "object", "properties": { "template": { "description": "要使用的自定义 [XcodeGen] project.yml 模板。\n\n [XcodeGen]: ", "type": ["string", "null"] }, "frameworks": { "description": "指示需要与应用程序一起打包的 iOS 框架的字符串列表。\n\n 请注意,您需要重新创建 iOS 项目才能应用更改。", "type": ["array", "null"], "items": { "type": "string" } }, "developmentTeam": { "description": "开发团队。由于强制执行代码签名,因此 iOS 开发需要此值。\n 可以设置 `APPLE_DEVELOPMENT_TEAM` 环境变量来覆盖它。", "type": ["string", "null"] }, "bundleVersion": { "description": "标识打包迭代的构建版本。\n\n 转换为打包的 CFBundleVersion 属性。", "type": ["string", "null"] }, "minimumSystemVersion": { "description": "指示打包应用程序支持的最低 iOS 版本的版本字符串。默认为 `13.0`。\n\n 映射到 IPHONEOS_DEPLOYMENT_TARGET 值。", "default": "14.0", "type": "string" }, "infoPlist": { "description": "要与默认 Info.plist 合并的 Info.plist 文件路径。\n\n 请注意,Tauri 还会在与 Tauri 配置文件相同的目录中查找 `Info.plist` 和 `Info.ios.plist` 文件。", "type": ["string", "null"] } }, "additionalProperties": false }, "AndroidConfig": { "description": "Android 目标的通用配置。", "type": "object", "properties": { "minSdkVersion": { "description": "应用程序运行所需的最低 API 级别。\n 如果系统的 API 级别低于指定值,Android 系统将阻止用户安装应用程序。", "default": 24, "type": "integer", "format": "uint32", "minimum": 0 }, "versionCode": { "description": "应用程序的版本代码。\n 根据 Google Play Store 的要求,它限制为 2,100,000,000。\n\n 默认情况下,我们使用您配置的版本并执行以下数学运算:\n versionCode = version.major * 1000000 + version.minor * 1000 + version.patch", "type": ["integer", "null"], "format": "uint32", "maximum": 2100000000, "minimum": 1 }, "autoIncrementVersionCode": { "description": "是否在每次构建时自动递增 `versionCode`。\n\n - 如果为 `true`,生成器将尝试从 `tauri.properties` 读取最后的 `versionCode`,并在每次构建时将其递增 1。\n - 如果为 `false` 或未设置,它将回退到 `version_code` 或 semver 派生的逻辑。\n\n 请注意,要使用此功能,您应该从 `src-tauri/gen/android/app/.gitignore` 中删除 `/tauri.properties`,以便将当前 versionCode 提交到仓库。", "default": false, "type": "boolean" } }, "additionalProperties": false }, "PluginConfig": { "description": "插件配置保存一个 HashMap,将插件名称映射到其配置对象。\n\n 参阅更多: ", "type": "object", "additionalProperties": true } } }