diff --git a/.changes/cli-config-target-mobile.md b/.changes/cli-config-target-mobile.md new file mode 100644 index 000000000000..6157544e8c12 --- /dev/null +++ b/.changes/cli-config-target-mobile.md @@ -0,0 +1,6 @@ +--- +"tauri-cli": patch:bug +"@tauri-apps/cli": patch:bug +--- + +Properly read platform-specific configuration files for mobile targets. diff --git a/.changes/cli-plugin-init.md b/.changes/cli-plugin-init.md new file mode 100644 index 000000000000..d250ad3f18f6 --- /dev/null +++ b/.changes/cli-plugin-init.md @@ -0,0 +1,12 @@ +--- +'tauri-cli': 'patch:breaking' +'@tauri-apps/cli': 'patch:breaking' +--- + +The `tauri plugin` subcommand is receving a couple of consitency and quality of life improvements: + +- Renamed `tauri plugin android/ios add` command to `tauri plugin android/ios init` to match the `tauri plugin init` command. +- Removed the `-n/--name` argument from the `tauri plugin init`, `tauri plugin android/ios init`, and is now parsed from the first positional argument. +- Added `tauri plugin new` to create a plugin in a new directory. +- Changed `tauri plugin init` to initalize a plugin in an existing directory (defaults to current directory) instead of creating a new one. +- Changed `tauri plugin init` to NOT generate mobile projects by default, you can opt-in to generate them using `--android` and `--ios` flags or `--mobile` flag or initalize them later using `tauri plugin android/ios init`. diff --git a/.changes/codegen-target-from-utils.md b/.changes/codegen-target-from-utils.md new file mode 100644 index 000000000000..dfb2ef17babd --- /dev/null +++ b/.changes/codegen-target-from-utils.md @@ -0,0 +1,6 @@ +--- +"tauri-codegen": patch:enhance +"tauri-macros": patch:enhance +--- + +Use `Target` enum from `tauri_utils::platform`. diff --git a/.changes/custom-protocol-http-android.md b/.changes/custom-protocol-http-android.md new file mode 100644 index 000000000000..679ccd1aa2ee --- /dev/null +++ b/.changes/custom-protocol-http-android.md @@ -0,0 +1,8 @@ +--- +"tauri": patch:breaking +"@tauri-apps/api": patch:breaking +"@tauri-apps/cli": patch:breaking +"tauri-cli": patch:breaking +--- + +The custom protocol on Android now uses the `http` scheme instead of `https`. diff --git a/.changes/custom-protocol-response-refactor.md b/.changes/custom-protocol-response-refactor.md new file mode 100644 index 000000000000..791a71ba18aa --- /dev/null +++ b/.changes/custom-protocol-response-refactor.md @@ -0,0 +1,5 @@ +--- +"tauri": patch:breaking +--- + +Changed `Builder::register_uri_scheme_protocol` to return a `http::Response` instead of `Result`. To return an error response, manually create a response with status code >= 400. diff --git a/.changes/devicectl.md b/.changes/devicectl.md new file mode 100644 index 000000000000..2d8302f081cf --- /dev/null +++ b/.changes/devicectl.md @@ -0,0 +1,6 @@ +--- +"tauri-cli": patch:feat +"@tauri-apps/cli": patch:feat +--- + +Use `devicectl` to connect to iOS 17+ devices on macOS 14+. diff --git a/.changes/fix-channel-data-request.md b/.changes/fix-channel-data-request.md new file mode 100644 index 000000000000..632c27f155ff --- /dev/null +++ b/.changes/fix-channel-data-request.md @@ -0,0 +1,5 @@ +--- +"tauri": patch:bug +--- + +Fixes invalid header value type when requesting IPC body through a channel. diff --git a/.changes/fix-icons-android.md b/.changes/fix-icons-android.md new file mode 100644 index 000000000000..650b3f0dfccf --- /dev/null +++ b/.changes/fix-icons-android.md @@ -0,0 +1,6 @@ +--- +"@tauri-apps/cli": patch:bug +"tauri-cli": patch:bug +--- + +Fixes `icon` command not writing files to the correct Android project folders. diff --git a/.changes/fix-ios-logs.md b/.changes/fix-ios-logs.md new file mode 100644 index 000000000000..367e512f1dd5 --- /dev/null +++ b/.changes/fix-ios-logs.md @@ -0,0 +1,6 @@ +--- +"tauri-cli": patch:bug +"@tauri-apps/cli": patch:bug +--- + +Fixes a regression on alpha.11 where iOS logs aren't being displayed when using `ios dev` with a real device. diff --git a/.changes/fix-ipc-payload.md b/.changes/fix-ipc-payload.md new file mode 100644 index 000000000000..ea495b054a12 --- /dev/null +++ b/.changes/fix-ipc-payload.md @@ -0,0 +1,5 @@ +--- +"tauri": 'patch:bug' +--- + +No longer unpacking and flattening the `payload` over the IPC so that commands with arguments called `cmd`, `callback`, `error`, `options` or `payload` aren't breaking the IPC. diff --git a/.changes/fix-ipc-remote-url-macos.md b/.changes/fix-ipc-remote-url-macos.md new file mode 100644 index 000000000000..314ab2e2976b --- /dev/null +++ b/.changes/fix-ipc-remote-url-macos.md @@ -0,0 +1,5 @@ +--- +"tauri": patch:bug +--- + +Fixes IPC failing to communicate for remote URLs on macOS and iOS. diff --git a/.changes/fix-windows-custom-protocol-url.md b/.changes/fix-windows-custom-protocol-url.md new file mode 100644 index 000000000000..5c3b44c84ee2 --- /dev/null +++ b/.changes/fix-windows-custom-protocol-url.md @@ -0,0 +1,8 @@ +--- +"tauri": patch:breaking +"@tauri-apps/api": patch:breaking +"@tauri-apps/cli": patch:breaking +"tauri-cli": patch:breaking +--- + +The custom protocol on Windows now uses the `http` scheme instead of `https`. diff --git a/.changes/fix-windows-custom-protocol.md b/.changes/fix-windows-custom-protocol.md new file mode 100644 index 000000000000..8d6c9a233cde --- /dev/null +++ b/.changes/fix-windows-custom-protocol.md @@ -0,0 +1,6 @@ +--- +"tauri": patch:bug +"tauri-runtime-wry": patch:bug +--- + +Fixes custom protocol not working on Windows. diff --git a/.changes/http-types-refactor.md b/.changes/http-types-refactor.md new file mode 100644 index 000000000000..d44158cf1f16 --- /dev/null +++ b/.changes/http-types-refactor.md @@ -0,0 +1,7 @@ +--- +"tauri": patch:breaking +"tauri-runtime": patch:breaking +"tauri-runtime-wry": patch:breaking +--- + +`tauri-runtime` no longer implements its own HTTP types and relies on the `http` crate instead. diff --git a/.changes/invoke-system-args.md b/.changes/invoke-system-args.md new file mode 100644 index 000000000000..b104100078d2 --- /dev/null +++ b/.changes/invoke-system-args.md @@ -0,0 +1,5 @@ +--- +"tauri": patch:breaking +--- + +Changed `Builder::invoke_system` to take references instead of owned values. diff --git a/.changes/ios-create-asset-dir.md b/.changes/ios-create-asset-dir.md new file mode 100644 index 000000000000..9753aa6e257b --- /dev/null +++ b/.changes/ios-create-asset-dir.md @@ -0,0 +1,6 @@ +--- +"tauri-cli": patch:bug +"@tauri-apps/cli": patch:bug +--- + +Ensure asset directory exists on the iOS project. diff --git a/.changes/mobile-config-naming-conventions.md b/.changes/mobile-config-naming-conventions.md new file mode 100644 index 000000000000..5517951ab269 --- /dev/null +++ b/.changes/mobile-config-naming-conventions.md @@ -0,0 +1,5 @@ +--- +"tauri-utils": patch:breaking +--- + +Follow file name conventions set by desktop for mobile Tauri configuration files. Added `target` argument on most `config::parse` methods. diff --git a/.changes/mobile-docs.md b/.changes/mobile-docs.md new file mode 100644 index 000000000000..b7656f694f1d --- /dev/null +++ b/.changes/mobile-docs.md @@ -0,0 +1,6 @@ +--- +"tauri": patch:enhance +"tauri-runtime": patch:enhance +--- + +Include mobile on docs.rs targets. diff --git a/.changes/move-add-command.md b/.changes/move-add-command.md new file mode 100644 index 000000000000..8f10d6bb2719 --- /dev/null +++ b/.changes/move-add-command.md @@ -0,0 +1,6 @@ +--- +"tauri-cli": patch:breaking +"@tauri-apps/cli": patch:breaking +--- + +Renamed the `plugin add` command to `add`. diff --git a/.changes/pre.json b/.changes/pre.json index a3bd9b4bcea8..5e973a069712 100644 --- a/.changes/pre.json +++ b/.changes/pre.json @@ -11,6 +11,7 @@ ".changes/android-on-new-intent.md", ".changes/android-plugin-command-exception.md", ".changes/api-ipc-refactor.md", + ".changes/app-builder-send.md", ".changes/build-android-env-vars.md", ".changes/bump-1.3.md", ".changes/bundler-remove-dialog-option.md", @@ -23,6 +24,7 @@ ".changes/cli-android-split-per-abit-target.md", ".changes/cli-apple-dev-team.md", ".changes/cli-built-in-dev-server-mobile.md", + ".changes/cli-config-target-mobile.md", ".changes/cli-expose-plugin-config.md", ".changes/cli-ios-build.md", ".changes/cli-ios-metadata-env-var.md", @@ -40,6 +42,7 @@ ".changes/cli-skip-targets-install.md", ".changes/cli-wry-0-28.md", ".changes/codegen-mobile-devurl.md", + ".changes/codegen-target-from-utils.md", ".changes/config-incognito.md", ".changes/config-tray-icon-tooltip.md", ".changes/config-tray-icon.md", @@ -50,11 +53,15 @@ ".changes/core-navigate-method.md", ".changes/core-remove-file-dir-semver-apis.md", ".changes/core-wry-0-28.md", + ".changes/custom-protocol-http-android.md", + ".changes/custom-protocol-response-refactor.md", ".changes/dark-light-mica-effect.md", ".changes/default-tls-features.md", ".changes/default-window-icon.md", ".changes/dev-proxy-response-cache.md", ".changes/dev-proxy.md", + ".changes/devicectl.md", + ".changes/dnd-position.md", ".changes/downgrade-min-sdk-version.md", ".changes/dynamic-wry-plugin.md", ".changes/enable-minify.md", @@ -65,12 +72,17 @@ ".changes/file-associations-config.md", ".changes/file-associations.md", ".changes/fix-build-script-mobile-runner-npm.md", + ".changes/fix-channel-data-request.md", ".changes/fix-dev-server-proxy-path.md", ".changes/fix-empty-identifier.md", + ".changes/fix-icons-android.md", ".changes/fix-ios-cli-panic.md", + ".changes/fix-ios-logs.md", ".changes/fix-ios-plugin-throws-command.md", ".changes/fix-ios-run-xcode14.md", ".changes/fix-ios-template.md", + ".changes/fix-ipc-payload.md", + ".changes/fix-ipc-remote-url-macos.md", ".changes/fix-mobile-env-vars.md", ".changes/fix-nodejs-android-cmds.md", ".changes/fix-orientation-crash.md", @@ -82,17 +94,22 @@ ".changes/fix-shell-build.md", ".changes/fix-tauri-binary-windows.md", ".changes/fix-tray-icon-validation.md", + ".changes/fix-windows-custom-protocol-url.md", + ".changes/fix-windows-custom-protocol.md", ".changes/fix-xcodescript-lib-path.md", ".changes/force-colored-logs.md", ".changes/generate-tauri-activity.md", ".changes/gradle-8.md", ".changes/gtk16.md", + ".changes/http-types-refactor.md", ".changes/improve-local-ip-detection.md", ".changes/improve-mobile-plugin-error-handling.md", ".changes/inject-config.md", ".changes/inject-proguard.md", ".changes/invoke-handler-attributes.md", ".changes/invoke-return-bool.md", + ".changes/invoke-system-args.md", + ".changes/ios-create-asset-dir.md", ".changes/ios-deployment-target.md", ".changes/ios-entitlements.md", ".changes/ios-icon-color.md", @@ -114,6 +131,7 @@ ".changes/migrate-csp.md", ".changes/migrate-plugins.md", ".changes/min-sdk-version.md", + ".changes/mobile-config-naming-conventions.md", ".changes/mobile-config.md", ".changes/mobile-dev-watcher-ignore-gen.md", ".changes/mobile-entry-point-macro.md", @@ -125,6 +143,7 @@ ".changes/mobile-plugins.md", ".changes/mobile-webview-access.md", ".changes/mobile.md", + ".changes/move-add-command.md", ".changes/move-app.md", ".changes/move-cli.md", ".changes/move-dialog-plugin.md", @@ -141,6 +160,7 @@ ".changes/msrv-1.65.md", ".changes/napi-rs.md", ".changes/npm-pass-args.md", + ".changes/nsis-bulgarian.md", ".changes/on-navigation-plugin.md", ".changes/on-new-intent.md", ".changes/only-proxy-on-mobile.md", @@ -161,6 +181,7 @@ ".changes/refactor-macros.md", ".changes/refactor-setup.md", ".changes/refactor-tauri-android-dependency.md", + ".changes/register_asynchronous_uri_scheme_protocol.md", ".changes/remove-allowlist.md", ".changes/remove-attohttpc.md", ".changes/remove-clipboard.md", @@ -179,6 +200,7 @@ ".changes/run-event-opened.md", ".changes/run-mobile-plugin.md", ".changes/runtime-create-window-handler.md", + ".changes/runtime-custom-protocol-async.md", ".changes/runtime-defaultvbox.md", ".changes/runtime-menu-system-tray.md", ".changes/runtime-monitor.md", @@ -187,6 +209,7 @@ ".changes/runtime-new-args.md", ".changes/runtime-opened-event.md", ".changes/safepathbuf-refactor.md", + ".changes/set_native_icon_signature.md", ".changes/shadow-api.md", ".changes/shadow-config.md", ".changes/shadow.md", @@ -194,19 +217,27 @@ ".changes/simplify-ios-plugin-init-fn.md", ".changes/skip-target-install-arg.md", ".changes/state-0.6.md", + ".changes/submenu-and-menu-builders-item-and-id.md", ".changes/system-tray-feat.md", ".changes/target-dir-detection.md", + ".changes/tauri-api-removal.md", ".changes/tauri-app-handle-ref.md", + ".changes/tauri-asset-protocol.md", ".changes/tauri-build-mobile.md", ".changes/tauri-cleanup-before-exit.md", ".changes/tauri-defaultvbox.md", + ".changes/tauri-env-args.md", ".changes/tauri-libxdo-feat.md", ".changes/tauri-menu-tray-refactor.md", ".changes/tauri-mobile-entry-point.md", ".changes/tauri-nsview.md", ".changes/tauri-run_on_main_thread.md", ".changes/tauri-runtime-wry-wry-0-28.md", + ".changes/tauri-scopes.md", ".changes/tauri-tray-icon-feat-flag.md", + ".changes/tauri-tray-icon-id.md", + ".changes/tauri-tray-on-tray-event.md", + ".changes/tauri-utils-tray-icon-id copy.md", ".changes/tempdir-api.md", ".changes/tempdir-core.md", ".changes/tls-features-automatically-enabled.md", @@ -214,11 +245,14 @@ ".changes/ubuntu-20.04-cli.js.md", ".changes/ubuntu-20.04-cli.rs.md", ".changes/update-entitlements-api.md", + ".changes/validate-appimage.md", ".changes/window-effects-api.md", ".changes/window-effects-config.md", ".changes/window-effects.md", + ".changes/window-on-message-refactor.md", ".changes/window-on-navigation-arg.md", ".changes/with-webview.md", + ".changes/wry-0.32.md", ".changes/wry-navigate-method.md", ".changes/wry26.md" ] diff --git a/.changes/register_asynchronous_uri_scheme_protocol.md b/.changes/register_asynchronous_uri_scheme_protocol.md new file mode 100644 index 000000000000..68617316f66c --- /dev/null +++ b/.changes/register_asynchronous_uri_scheme_protocol.md @@ -0,0 +1,5 @@ +--- +"tauri": patch:enhance +--- + +Added `Builder::register_asynchronous_uri_scheme_protocol` to allow resolving a custom URI scheme protocol request asynchronously to prevent blocking the main thread. diff --git a/.changes/runtime-custom-protocol-async.md b/.changes/runtime-custom-protocol-async.md new file mode 100644 index 000000000000..76967cca0c2c --- /dev/null +++ b/.changes/runtime-custom-protocol-async.md @@ -0,0 +1,5 @@ +--- +"tauri-runtime": patch:enhance +--- + +Changed custom protocol closure type to enable asynchronous usage. diff --git a/.changes/set_native_icon_signature.md b/.changes/set_native_icon_signature.md new file mode 100644 index 000000000000..774420baf329 --- /dev/null +++ b/.changes/set_native_icon_signature.md @@ -0,0 +1,5 @@ +--- +"tauri": 'patch:bug' +--- + +Changed `IconMenuItem::set_native_icon` signature to take `&self` instead of `&mut self` to fix compilation error on macos. diff --git a/.changes/tauri-api-removal.md b/.changes/tauri-api-removal.md new file mode 100644 index 000000000000..b6c728d03faf --- /dev/null +++ b/.changes/tauri-api-removal.md @@ -0,0 +1,5 @@ +--- +'tauri': 'major:breaking' +--- + +Removed `tauri::api` module as most apis have been moved to either a plugin or we recommend using other crates. diff --git a/.changes/tauri-asset-protocol.md b/.changes/tauri-asset-protocol.md new file mode 100644 index 000000000000..f90bb6b1ee23 --- /dev/null +++ b/.changes/tauri-asset-protocol.md @@ -0,0 +1,5 @@ +--- +'tauri': 'patch:bug' +--- + +Fix `asset` protocol failing to fetch files. diff --git a/.changes/tauri-env-args.md b/.changes/tauri-env-args.md new file mode 100644 index 000000000000..8c02c9b2f8d7 --- /dev/null +++ b/.changes/tauri-env-args.md @@ -0,0 +1,5 @@ +--- +'tauri': 'major:breaking' +--- + +Changed `Env.args` to `Env.args_os` and now uses `OsString` instead of `String` diff --git a/.changes/tauri-scopes.md b/.changes/tauri-scopes.md new file mode 100644 index 000000000000..76767c18ac17 --- /dev/null +++ b/.changes/tauri-scopes.md @@ -0,0 +1,9 @@ +--- +'tauri': 'patch:breaking' +--- + +`tauri::scope` module is recieving a couple of consistency changes: + +- Added `tauri::scope::fs` module. +- Removed `scope::IpcScope` re-export, use `scope::ipc::Scope`. +- Removed `FsScope`, `GlobPattern` and `FsScopeEvent`, use `scope::fs::Scope`, `scope::fs::Pattern` and `scope::fs::Event` respectively. diff --git a/.changes/tauri-tray-icon-id.md b/.changes/tauri-tray-icon-id.md new file mode 100644 index 000000000000..5e42a4fda7a1 --- /dev/null +++ b/.changes/tauri-tray-icon-id.md @@ -0,0 +1,5 @@ +--- +'tauri': 'patch:enhance' +--- + +Set `main` as the default `id` for the tray icon registered from the configuration file, so if the `id` is not specified, it can be retrieved using `app.tray_by_id("main")`. diff --git a/.changes/tauri-tray-on-tray-event.md b/.changes/tauri-tray-on-tray-event.md new file mode 100644 index 000000000000..89abc7caeb63 --- /dev/null +++ b/.changes/tauri-tray-on-tray-event.md @@ -0,0 +1,5 @@ +--- +'tauri': 'patch:breaking' +--- + +Changed `TrayIconBuilder/TrayIcon::on_tray_event` to `TrayIconBuilder/TrayIcon::on_tray_icon_event` for consistency of naming. diff --git a/.changes/tauri-utils-tray-icon-id copy.md b/.changes/tauri-utils-tray-icon-id copy.md new file mode 100644 index 000000000000..6f1eea9be0e8 --- /dev/null +++ b/.changes/tauri-utils-tray-icon-id copy.md @@ -0,0 +1,5 @@ +--- +'tauri-utils': 'patch:enhance' +--- + +Add an option to specify `id` for the tray icon in the tauri configuration file. diff --git a/.changes/validate-appimage.md b/.changes/validate-appimage.md new file mode 100644 index 000000000000..9a6367a82a7a --- /dev/null +++ b/.changes/validate-appimage.md @@ -0,0 +1,5 @@ +--- +"tauri": patch:bug +--- + +Fix the validation of `std::env::current_exe` warn the user if AppImage is not mounted instead of panicking diff --git a/.changes/window-on-message-refactor.md b/.changes/window-on-message-refactor.md new file mode 100644 index 000000000000..335e8ff19228 --- /dev/null +++ b/.changes/window-on-message-refactor.md @@ -0,0 +1,5 @@ +--- +"tauri": patch:breaking +--- + +Changed `Window::on_message` signature to take a responder closure instead of returning the response object in order to asynchronously process the request. diff --git a/.changes/wry-0.32.md b/.changes/wry-0.32.md new file mode 100644 index 000000000000..a9bfc8f0a2e1 --- /dev/null +++ b/.changes/wry-0.32.md @@ -0,0 +1,5 @@ +--- +"tauri-runtime-wry": patch:enhance +--- + +Update wry to 0.32 to include asynchronous custom protocol support. diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml index a11f6de7bf15..92d294722d82 100644 --- a/.github/workflows/audit.yml +++ b/.github/workflows/audit.yml @@ -23,7 +23,7 @@ jobs: audit-rust: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: rust audit uses: actions-rs/audit-check@v1 with: @@ -32,7 +32,7 @@ jobs: audit-js: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: yarn audit working-directory: tooling/cli/node run: yarn audit diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index f84f7b5afb7f..213ac808178e 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -32,7 +32,7 @@ jobs: runs-on: ${{ matrix.platform.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: install ${{ matrix.rust }} uses: actions-rs/toolchain@v1 with: @@ -70,7 +70,7 @@ jobs: - name: clone benchmarks_results if: github.repository == 'tauri-apps/tauri' && github.ref == 'refs/heads/dev' - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: token: ${{ secrets.BENCH_PAT }} path: gh-pages diff --git a/.github/workflows/check-license-header.yml b/.github/workflows/check-license-header.yml index 00893dc0cc4e..95757a4e2d8b 100644 --- a/.github/workflows/check-license-header.yml +++ b/.github/workflows/check-license-header.yml @@ -15,7 +15,7 @@ jobs: check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: dorny/paths-filter@v2 id: filter with: diff --git a/.github/workflows/covector-status.yml b/.github/workflows/covector-status.yml index cdc3f5ca47e9..fcb3996d6492 100644 --- a/.github/workflows/covector-status.yml +++ b/.github/workflows/covector-status.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: covector status diff --git a/.github/workflows/covector-version-or-publish.yml b/.github/workflows/covector-version-or-publish.yml index bb7155e9b1c0..ad114b63170f 100644 --- a/.github/workflows/covector-version-or-publish.yml +++ b/.github/workflows/covector-version-or-publish.yml @@ -19,7 +19,7 @@ jobs: platform: [ubuntu-latest, macos-latest, windows-latest] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: install stable @@ -66,7 +66,7 @@ jobs: - run-integration-tests steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: actions/setup-node@v2 diff --git a/.github/workflows/lint-cli.yml b/.github/workflows/lint-cli.yml index eedc5bdc51e3..db8e26513a02 100644 --- a/.github/workflows/lint-cli.yml +++ b/.github/workflows/lint-cli.yml @@ -27,7 +27,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: @@ -45,7 +45,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: diff --git a/.github/workflows/lint-core.yml b/.github/workflows/lint-core.yml index fb1251bb2ac1..97f8f1397966 100644 --- a/.github/workflows/lint-core.yml +++ b/.github/workflows/lint-core.yml @@ -29,7 +29,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: @@ -56,7 +56,7 @@ jobs: - { args: '--features custom-protocol', key: 'custom-protocol' } steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: install dependencies run: | diff --git a/.github/workflows/lint-js.yml b/.github/workflows/lint-js.yml index 7cf54f022af0..1666186e28eb 100644 --- a/.github/workflows/lint-js.yml +++ b/.github/workflows/lint-js.yml @@ -19,7 +19,7 @@ jobs: eslint-cli: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions/setup-node@v2 with: node-version: '14' @@ -39,7 +39,7 @@ jobs: eslint-api: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions/setup-node@v2 with: node-version: '14' diff --git a/.github/workflows/test-cli-js.yml b/.github/workflows/test-cli-js.yml index 6668a23e4afd..5162c3714f04 100644 --- a/.github/workflows/test-cli-js.yml +++ b/.github/workflows/test-cli-js.yml @@ -33,7 +33,7 @@ jobs: platform: [ubuntu-latest, macos-latest, windows-latest] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: install Rust stable uses: actions-rs/toolchain@v1 diff --git a/.github/workflows/test-cli-rs.yml b/.github/workflows/test-cli-rs.yml index e906f74dd449..8a80496cb155 100644 --- a/.github/workflows/test-cli-rs.yml +++ b/.github/workflows/test-cli-rs.yml @@ -49,7 +49,7 @@ jobs: } steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: 'Setup Rust' uses: dtolnay/rust-toolchain@stable diff --git a/.github/workflows/test-core.yml b/.github/workflows/test-core.yml index 3fe76186e770..2ec2093b3f1f 100644 --- a/.github/workflows/test-core.yml +++ b/.github/workflows/test-core.yml @@ -77,7 +77,7 @@ jobs: } steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: install stable uses: actions-rs/toolchain@v1 @@ -102,6 +102,10 @@ jobs: # The --precise flag can only be used once per invocation. run: | cargo update -p time --precise 0.3.23 + cargo update -p toml@0.7.8 --precise 0.7.6 + cargo update -p toml_edit@0.19.15 --precise 0.19.14 + cargo update -p cfg-expr@0.15.5 --precise 0.15.4 + cargo update -p system-deps --precise 6.1.1 - name: test uses: actions-rs/cargo@v1 diff --git a/.github/workflows/test-lint-bundler.yml b/.github/workflows/test-lint-bundler.yml index 61fac1febcf8..bab4f195ee2b 100644 --- a/.github/workflows/test-lint-bundler.yml +++ b/.github/workflows/test-lint-bundler.yml @@ -32,7 +32,7 @@ jobs: platform: [ubuntu-latest, macos-latest, windows-latest] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: install stable uses: actions-rs/toolchain@v1 @@ -52,7 +52,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: @@ -70,7 +70,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: install minimal stable with clippy and rustfmt uses: actions-rs/toolchain@v1 diff --git a/.github/workflows/udeps.yml b/.github/workflows/udeps.yml index f3e4d75dee78..e856b1a16f2c 100644 --- a/.github/workflows/udeps.yml +++ b/.github/workflows/udeps.yml @@ -32,7 +32,7 @@ jobs: bundler: ${{ steps.filter.outputs.bundler }} cli: ${{ steps.filter.outputs.cli }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: dorny/paths-filter@v2 id: filter with: @@ -72,7 +72,7 @@ jobs: needs.changes.outputs.cli == 'true' steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: @@ -115,7 +115,7 @@ jobs: if [ "${UTILS}" == "true" ]; then crates[${#crates[@]}]="\"./core/tauri-utils\""; fi if [ "${BUNDLER}" == "true" ]; then crates[${#crates[@]}]="\"./tooling/bundler\""; fi if [ "${CLI}" == "true" ]; then crates[${#crates[@]}]="\"./tooling/cli\""; fi - echo ::set-output name=matrix::[$crates] + echo "matrix=[$crates]" >> "$GITHUB_OUTPUT" outputs: matrix: ${{ steps.create-matrix.outputs.matrix }} @@ -126,7 +126,7 @@ jobs: matrix: path: ${{ fromJson(needs.setup.outputs.matrix) }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: diff --git a/Cargo.toml b/Cargo.toml index 63ee69bc15d5..65e68fbf1b6f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,7 @@ members = [ # integration tests "core/tests/restart", ] +resolver = "2" exclude = [ # examples that can be compiled with the tauri CLI @@ -24,10 +25,10 @@ exclude = [ ] [workspace.package] -authors = [ "Tauri Programme within The Commons Conservancy" ] +authors = ["Tauri Programme within The Commons Conservancy"] homepage = "https://tauri.app/" repository = "https://github.com/tauri-apps/tauri" -categories = [ "gui", "web-programming" ] +categories = ["gui", "web-programming"] license = "Apache-2.0 OR MIT" edition = "2021" rust-version = "1.65" diff --git a/core/tauri-build/CHANGELOG.md b/core/tauri-build/CHANGELOG.md index 373a0f57a267..c28e3734fd9f 100644 --- a/core/tauri-build/CHANGELOG.md +++ b/core/tauri-build/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## \[2.0.0-alpha.9] + +### Dependencies + +- Upgraded to `tauri-codegen@2.0.0-alpha.8` +- Upgraded to `tauri-utils@2.0.0-alpha.8` + ## \[2.0.0-alpha.8] ### Bug Fixes diff --git a/core/tauri-build/Cargo.toml b/core/tauri-build/Cargo.toml index 5f19102210d2..53dff6564a65 100644 --- a/core/tauri-build/Cargo.toml +++ b/core/tauri-build/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-build" -version = "2.0.0-alpha.8" +version = "2.0.0-alpha.9" description = "build time code to pair with https://crates.io/crates/tauri" exclude = [ "CHANGELOG.md", "/target" ] readme = "README.md" @@ -19,8 +19,8 @@ rustdoc-args = [ "--cfg", "doc_cfg" ] [dependencies] anyhow = "1" quote = { version = "1", optional = true } -tauri-codegen = { version = "2.0.0-alpha.7", path = "../tauri-codegen", optional = true } -tauri-utils = { version = "2.0.0-alpha.7", path = "../tauri-utils", features = [ "build", "resources" ] } +tauri-codegen = { version = "2.0.0-alpha.8", path = "../tauri-codegen", optional = true } +tauri-utils = { version = "2.0.0-alpha.8", path = "../tauri-utils", features = [ "build", "resources" ] } cargo_toml = "0.15" serde = "1" serde_json = "1" diff --git a/core/tauri-build/src/lib.rs b/core/tauri-build/src/lib.rs index 8e46612f429e..66eae198cebc 100644 --- a/core/tauri-build/src/lib.rs +++ b/core/tauri-build/src/lib.rs @@ -294,6 +294,7 @@ pub fn try_build(attributes: Attributes) -> Result<()> { cfg_alias("mobile", mobile); let mut config = serde_json::from_value(tauri_utils::config::parse::read_from( + tauri_utils::platform::Target::from_triple(&std::env::var("TARGET").unwrap()), std::env::current_dir().unwrap(), )?)?; if let Ok(env) = std::env::var("TAURI_CONFIG") { diff --git a/core/tauri-codegen/CHANGELOG.md b/core/tauri-codegen/CHANGELOG.md index 61929c296bae..d5760df19272 100644 --- a/core/tauri-codegen/CHANGELOG.md +++ b/core/tauri-codegen/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## \[2.0.0-alpha.8] + +### Enhancements + +- [`100d9ede`](https://www.github.com/tauri-apps/tauri/commit/100d9ede35995d9db21d2087dd5606adfafb89a5)([#7802](https://www.github.com/tauri-apps/tauri/pull/7802)) Use `Target` enum from `tauri_utils::platform`. + +### Dependencies + +- Upgraded to `tauri-utils@2.0.0-alpha.8` + ## \[2.0.0-alpha.7] ### Dependencies diff --git a/core/tauri-codegen/Cargo.toml b/core/tauri-codegen/Cargo.toml index ebc64341c6e7..e1c93dc57b4d 100644 --- a/core/tauri-codegen/Cargo.toml +++ b/core/tauri-codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-codegen" -version = "2.0.0-alpha.7" +version = "2.0.0-alpha.8" description = "code generation meant to be consumed inside of `tauri` through `tauri-build` or `tauri-macros`" exclude = [ "CHANGELOG.md", "/target" ] readme = "README.md" @@ -19,7 +19,7 @@ proc-macro2 = "1" quote = "1" serde = { version = "1", features = [ "derive" ] } serde_json = "1" -tauri-utils = { version = "2.0.0-alpha.7", path = "../tauri-utils", features = [ "build" ] } +tauri-utils = { version = "2.0.0-alpha.8", path = "../tauri-utils", features = [ "build" ] } thiserror = "1" walkdir = "2" brotli = { version = "3", optional = true, default-features = false, features = [ "std" ] } diff --git a/core/tauri-codegen/src/context.rs b/core/tauri-codegen/src/context.rs index 788db7db5d43..f9bdde66b1b6 100644 --- a/core/tauri-codegen/src/context.rs +++ b/core/tauri-codegen/src/context.rs @@ -15,6 +15,7 @@ use tauri_utils::config::{AppUrl, Config, PatternKind, WindowUrl}; use tauri_utils::html::{ inject_nonce_token, parse as parse_html, serialize_node as serialize_html_node, }; +use tauri_utils::platform::Target; use crate::embedded_assets::{AssetOptions, CspHashes, EmbeddedAssets, EmbeddedAssetsError}; @@ -112,26 +113,6 @@ fn map_isolation( } } -#[derive(PartialEq, Eq, Clone, Copy)] -enum Target { - Linux, - Windows, - Darwin, - Android, - // iOS. - Ios, -} - -impl Target { - fn is_mobile(&self) -> bool { - matches!(self, Target::Android | Target::Ios) - } - - fn is_desktop(&self) -> bool { - !self.is_mobile() - } -} - /// Build a `tauri::Context` for including in application code. pub fn context_codegen(data: ContextData) -> Result { let ContextData { @@ -141,34 +122,11 @@ pub fn context_codegen(data: ContextData) -> Result Result<(Config, PathBuf), CodegenConfigError> // it is impossible for the content of two separate configs to get mixed up. The chances are // already unlikely unless the developer goes out of their way to run the cli on a different // project than the target crate. - let mut config = serde_json::from_value(tauri_utils::config::parse::read_from(parent.clone())?)?; + let mut config = serde_json::from_value(tauri_utils::config::parse::read_from( + tauri_utils::platform::Target::current(), + parent.clone(), + )?)?; if let Ok(env) = std::env::var("TAURI_CONFIG") { let merge_config: serde_json::Value = serde_json::from_str(&env).map_err(CodegenConfigError::FormatInline)?; diff --git a/core/tauri-config-schema/schema.json b/core/tauri-config-schema/schema.json index 24bb780ddf69..715a118c71c4 100644 --- a/core/tauri-config-schema/schema.json +++ b/core/tauri-config-schema/schema.json @@ -113,7 +113,7 @@ "additionalProperties": false, "definitions": { "PackageConfig": { - "description": "The package configuration.\n\nSee more: https://tauri.app/v1/api/config#packageconfig", + "description": "The package configuration.\n\nSee more: ", "type": "object", "properties": { "productName": { @@ -136,7 +136,7 @@ "additionalProperties": false }, "TauriConfig": { - "description": "The Tauri configuration object.\n\nSee more: https://tauri.app/v1/api/config#tauriconfig", + "description": "The Tauri configuration object.\n\nSee more: ", "type": "object", "properties": { "pattern": { @@ -291,7 +291,7 @@ ] }, "WindowConfig": { - "description": "The window configuration object.\n\nSee more: https://tauri.app/v1/api/config#windowconfig", + "description": "The window configuration object.\n\nSee more: ", "type": "object", "properties": { "label": { @@ -510,7 +510,7 @@ "type": "boolean" }, "windowEffects": { - "description": "Window effects.\n\nRequires the window to be transparent.\n\n## Platform-specific:\n\n- **Windows**: If using decorations or shadows, you may want to try this workaround https://github.com/tauri-apps/tao/issues/72#issuecomment-975607891 - **Linux**: Unsupported", + "description": "Window effects.\n\nRequires the window to be transparent.\n\n## Platform-specific:\n\n- **Windows**: If using decorations or shadows, you may want to try this workaround - **Linux**: Unsupported", "anyOf": [ { "$ref": "#/definitions/WindowEffectsConfig" @@ -867,7 +867,7 @@ "minItems": 4 }, "BundleConfig": { - "description": "Configuration for tauri-bundler.\n\nSee more: https://tauri.app/v1/api/config#bundleconfig", + "description": "Configuration for tauri-bundler.\n\nSee more: ", "type": "object", "required": [ "identifier" @@ -1229,7 +1229,7 @@ ] }, "AppImageConfig": { - "description": "Configuration for AppImage bundles.\n\nSee more: https://tauri.app/v1/api/config#appimageconfig", + "description": "Configuration for AppImage bundles.\n\nSee more: ", "type": "object", "properties": { "bundleMediaFramework": { @@ -1241,7 +1241,7 @@ "additionalProperties": false }, "DebConfig": { - "description": "Configuration for Debian (.deb) bundles.\n\nSee more: https://tauri.app/v1/api/config#debconfig", + "description": "Configuration for Debian (.deb) bundles.\n\nSee more: ", "type": "object", "properties": { "depends": { @@ -1273,7 +1273,7 @@ "additionalProperties": false }, "MacConfig": { - "description": "Configuration for the macOS bundles.\n\nSee more: https://tauri.app/v1/api/config#macconfig", + "description": "Configuration for the macOS bundles.\n\nSee more: ", "type": "object", "properties": { "frameworks": { @@ -1333,7 +1333,7 @@ "additionalProperties": false }, "WindowsConfig": { - "description": "Windows bundler configuration.\n\nSee more: https://tauri.app/v1/api/config#windowsconfig", + "description": "Windows bundler configuration.\n\nSee more: ", "type": "object", "properties": { "digestAlgorithm": { @@ -1517,7 +1517,7 @@ ] }, "WixConfig": { - "description": "Configuration for the MSI bundle using WiX.\n\nSee more: https://tauri.app/v1/api/config#wixconfig", + "description": "Configuration for the MSI bundle using WiX.\n\nSee more: ", "type": "object", "properties": { "language": { @@ -1642,7 +1642,7 @@ ] }, "WixLanguageConfig": { - "description": "Configuration for a target language for the WiX build.\n\nSee more: https://tauri.app/v1/api/config#wixlanguageconfig", + "description": "Configuration for a target language for the WiX build.\n\nSee more: ", "type": "object", "properties": { "localePath": { @@ -1786,7 +1786,7 @@ "additionalProperties": false }, "UpdaterConfig": { - "description": "The Updater configuration object.\n\nSee more: https://tauri.app/v1/api/config#updaterconfig", + "description": "The Updater configuration object.\n\nSee more: ", "type": "object", "properties": { "active": { @@ -1814,7 +1814,7 @@ "additionalProperties": false }, "UpdaterWindowsConfig": { - "description": "The updater configuration for Windows.\n\nSee more: https://tauri.app/v1/api/config#updaterwindowsconfig", + "description": "The updater configuration for Windows.\n\nSee more: ", "type": "object", "properties": { "installMode": { @@ -1856,7 +1856,7 @@ ] }, "SecurityConfig": { - "description": "Security configuration.\n\nSee more: https://tauri.app/v1/api/config#securityconfig", + "description": "Security configuration.\n\nSee more: ", "type": "object", "properties": { "csp": { @@ -2004,7 +2004,7 @@ "additionalProperties": false }, "AssetProtocolConfig": { - "description": "Config for the asset custom protocol.\n\nSee more: https://tauri.app/v1/api/config#assetprotocolconfig", + "description": "Config for the asset custom protocol.\n\nSee more: ", "type": "object", "properties": { "scope": { @@ -2066,12 +2066,19 @@ ] }, "TrayIconConfig": { - "description": "Configuration for application tray icon.\n\nSee more: https://tauri.app/v1/api/config#trayiconconfig", + "description": "Configuration for application tray icon.\n\nSee more: ", "type": "object", "required": [ "iconPath" ], "properties": { + "id": { + "description": "Set an id for this tray icon so you can reference it later, defaults to `main`.", + "type": [ + "string", + "null" + ] + }, "iconPath": { "description": "Path to the default icon to use for the tray icon.", "type": "string" @@ -2104,7 +2111,7 @@ "additionalProperties": false }, "BuildConfig": { - "description": "The Build configuration object.\n\nSee more: https://tauri.app/v1/api/config#buildconfig", + "description": "The Build configuration object.\n\nSee more: ", "type": "object", "properties": { "runner": { @@ -2267,7 +2274,7 @@ ] }, "PluginConfig": { - "description": "The plugin configs holds a HashMap mapping a plugin name to its configuration object.\n\nSee more: https://tauri.app/v1/api/config#pluginconfig", + "description": "The plugin configs holds a HashMap mapping a plugin name to its configuration object.\n\nSee more: ", "type": "object", "additionalProperties": true } diff --git a/core/tauri-macros/CHANGELOG.md b/core/tauri-macros/CHANGELOG.md index 20c0cffaf767..0e52abca8651 100644 --- a/core/tauri-macros/CHANGELOG.md +++ b/core/tauri-macros/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## \[2.0.0-alpha.8] + +### Enhancements + +- [`100d9ede`](https://www.github.com/tauri-apps/tauri/commit/100d9ede35995d9db21d2087dd5606adfafb89a5)([#7802](https://www.github.com/tauri-apps/tauri/pull/7802)) Use `Target` enum from `tauri_utils::platform`. + +### Dependencies + +- Upgraded to `tauri-codegen@2.0.0-alpha.8` +- Upgraded to `tauri-utils@2.0.0-alpha.8` + ## \[2.0.0-alpha.7] ### Dependencies diff --git a/core/tauri-macros/Cargo.toml b/core/tauri-macros/Cargo.toml index 4d7aa4676634..f734cc61df9e 100644 --- a/core/tauri-macros/Cargo.toml +++ b/core/tauri-macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-macros" -version = "2.0.0-alpha.7" +version = "2.0.0-alpha.8" description = "Macros for the tauri crate." exclude = [ "CHANGELOG.md", "/target" ] readme = "README.md" @@ -20,8 +20,8 @@ proc-macro2 = "1" quote = "1" syn = { version = "1", features = [ "full" ] } heck = "0.4" -tauri-codegen = { version = "2.0.0-alpha.7", default-features = false, path = "../tauri-codegen" } -tauri-utils = { version = "2.0.0-alpha.7", path = "../tauri-utils" } +tauri-codegen = { version = "2.0.0-alpha.8", default-features = false, path = "../tauri-codegen" } +tauri-utils = { version = "2.0.0-alpha.8", path = "../tauri-utils" } [features] custom-protocol = [ ] diff --git a/core/tauri-macros/src/context.rs b/core/tauri-macros/src/context.rs index c2855eebb29d..6d0ffd6892b1 100644 --- a/core/tauri-macros/src/context.rs +++ b/core/tauri-macros/src/context.rs @@ -11,7 +11,7 @@ use syn::{ LitStr, PathArguments, PathSegment, Token, }; use tauri_codegen::{context_codegen, get_config, ContextData}; -use tauri_utils::config::parse::does_supported_file_name_exist; +use tauri_utils::{config::parse::does_supported_file_name_exist, platform::Target}; pub(crate) struct ContextItems { config_file: PathBuf, @@ -20,6 +20,12 @@ pub(crate) struct ContextItems { impl Parse for ContextItems { fn parse(input: &ParseBuffer<'_>) -> syn::parse::Result { + let target = std::env::var("TARGET") + .or_else(|_| std::env::var("TAURI_TARGET_TRIPLE")) + .as_deref() + .map(Target::from_triple) + .unwrap_or_else(|_| Target::current()); + let config_file = if input.is_empty() { std::env::var("CARGO_MANIFEST_DIR").map(|m| PathBuf::from(m).join("tauri.conf.json")) } else { @@ -36,7 +42,7 @@ impl Parse for ContextItems { VarError::NotUnicode(_) => "CARGO_MANIFEST_DIR env var contained invalid utf8".into(), }) .and_then(|path| { - if does_supported_file_name_exist(&path) { + if does_supported_file_name_exist(target, &path) { Ok(path) } else { Err(format!( diff --git a/core/tauri-runtime-wry/CHANGELOG.md b/core/tauri-runtime-wry/CHANGELOG.md index a3a2a3536d21..512d4ec0a504 100644 --- a/core/tauri-runtime-wry/CHANGELOG.md +++ b/core/tauri-runtime-wry/CHANGELOG.md @@ -1,5 +1,36 @@ # Changelog +## \[1.0.0-alpha.3] + +### Dependencies + +- Upgraded to `tauri-utils@2.0.0-alpha.8` +- Upgraded to `tauri-runtime@1.0.0-alpha.2` + +## \[1.0.0-alpha.2] + +### Bug Fixes + +- [`d5074af5`](https://www.github.com/tauri-apps/tauri/commit/d5074af562b2b5cb6c5711442097c4058af32db6)([#7801](https://www.github.com/tauri-apps/tauri/pull/7801)) Fixes custom protocol not working on Windows. + +## \[1.0.0-alpha.1] + +### Enhancements + +- [`0d63732b`](https://www.github.com/tauri-apps/tauri/commit/0d63732b962e71b98430f8d7b34ea5b59a2e8bb4)([#7754](https://www.github.com/tauri-apps/tauri/pull/7754)) Update wry to 0.32 to include asynchronous custom protocol support. + +### What's Changed + +- [`6177150b`](https://www.github.com/tauri-apps/tauri/commit/6177150b6f83b52ca359d6e20f7e540f7554e4eb)([#7601](https://www.github.com/tauri-apps/tauri/pull/7601)) Changed `FileDropEvent` to include drop and hover position. + +### Dependencies + +- Upgraded to `tauri-runtime@1.0.0-alpha.1` + +### Breaking Changes + +- [`0d63732b`](https://www.github.com/tauri-apps/tauri/commit/0d63732b962e71b98430f8d7b34ea5b59a2e8bb4)([#7754](https://www.github.com/tauri-apps/tauri/pull/7754)) `tauri-runtime` no longer implements its own HTTP types and relies on the `http` crate instead. + ## \[1.0.0-alpha.0] ### New Features diff --git a/core/tauri-runtime-wry/Cargo.toml b/core/tauri-runtime-wry/Cargo.toml index 3d17bf3a2b99..20a4256b3338 100644 --- a/core/tauri-runtime-wry/Cargo.toml +++ b/core/tauri-runtime-wry/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-runtime-wry" -version = "1.0.0-alpha.0" +version = "1.0.0-alpha.3" description = "Wry bindings to the Tauri runtime" exclude = [ "CHANGELOG.md", "/target" ] readme = "README.md" @@ -16,12 +16,13 @@ rust-version = { workspace = true } features = [ "dox" ] [dependencies] -wry = { version = "0.31", default-features = false, features = [ "file-drop", "protocol" ] } -tauri-runtime = { version = "1.0.0-alpha.0", path = "../tauri-runtime" } -tauri-utils = { version = "2.0.0-alpha.7", path = "../tauri-utils" } +wry = { version = "0.33", default-features = false, features = [ "tao", "file-drop", "protocol" ] } +tauri-runtime = { version = "1.0.0-alpha.2", path = "../tauri-runtime" } +tauri-utils = { version = "2.0.0-alpha.8", path = "../tauri-utils" } uuid = { version = "1", features = [ "v4" ] } rand = "0.8" raw-window-handle = "0.5" +http = "0.2" [target."cfg(windows)".dependencies] webview2-com = "0.25" diff --git a/core/tauri-runtime-wry/src/lib.rs b/core/tauri-runtime-wry/src/lib.rs index f19c7435af2e..d1e36a5508da 100644 --- a/core/tauri-runtime-wry/src/lib.rs +++ b/core/tauri-runtime-wry/src/lib.rs @@ -13,7 +13,6 @@ use raw_window_handle::{HasRawDisplayHandle, HasRawWindowHandle, RawDisplayHandle}; use tauri_runtime::{ - http::{header::CONTENT_TYPE, Request as HttpRequest, RequestParts, Response as HttpResponse}, monitor::Monitor, webview::{WebviewIpcHandler, WindowBuilder, WindowBuilderBase}, window::{ @@ -61,7 +60,6 @@ use wry::{ UserAttentionType as WryUserAttentionType, }, }, - http::{Request as WryRequest, Response as WryResponse}, webview::{FileDropEvent as WryFileDropEvent, Url, WebContext, WebView, WebViewBuilder}, }; @@ -85,7 +83,6 @@ pub use wry::application::platform::macos::{ }; use std::{ - borrow::Cow, cell::RefCell, collections::{ hash_map::Entry::{Occupied, Vacant}, @@ -94,6 +91,7 @@ use std::{ fmt, ops::Deref, path::PathBuf, + rc::Rc, sync::{ mpsc::{channel, Sender}, Arc, Mutex, Weak, @@ -227,7 +225,7 @@ impl Context { pub struct DispatcherMainThreadContext { pub window_target: EventLoopWindowTarget>, pub web_context: WebContextStore, - pub windows: Arc>>, + pub windows: Rc>>, } impl std::fmt::Debug for DispatcherMainThreadContext { @@ -258,39 +256,6 @@ impl fmt::Debug for Context { } } -struct HttpRequestWrapper(HttpRequest); - -impl From<&WryRequest>> for HttpRequestWrapper { - fn from(req: &WryRequest>) -> Self { - let parts = RequestParts { - uri: req.uri().to_string(), - method: req.method().clone(), - headers: req.headers().clone(), - }; - Self(HttpRequest::new_internal(parts, req.body().clone())) - } -} - -// response -struct HttpResponseWrapper(WryResponse>); -impl From for HttpResponseWrapper { - fn from(response: HttpResponse) -> Self { - let (parts, body) = response.into_parts(); - let mut res_builder = WryResponse::builder() - .status(parts.status) - .version(parts.version); - if let Some(mime) = parts.mimetype { - res_builder = res_builder.header(CONTENT_TYPE, mime); - } - for (name, val) in parts.headers.iter() { - res_builder = res_builder.header(name, val); - } - - let res = res_builder.body(body).unwrap(); - Self(res) - } -} - pub struct DeviceEventFilterWrapper(pub WryDeviceEventFilter); impl From for DeviceEventFilterWrapper { @@ -1544,7 +1509,7 @@ impl Dispatch for WryDispatcher { #[derive(Clone)] enum WindowHandle { Webview { - inner: Arc, + inner: Rc, context_store: WebContextStore, // the key of the WebContext if it's not shared context_key: Option, @@ -1560,7 +1525,7 @@ impl Drop for WindowHandle { context_key, } = self { - if Arc::get_mut(inner).is_some() { + if Rc::get_mut(inner).is_some() { context_store.lock().unwrap().remove(context_key); } } @@ -1816,7 +1781,7 @@ impl Wry { let main_thread_id = current_thread().id(); let web_context = WebContextStore::default(); - let windows = Arc::new(RefCell::new(HashMap::default())); + let windows = Rc::new(RefCell::new(HashMap::default())); let webview_id_map = WebviewIdStore::default(); let context = Context { @@ -2056,11 +2021,11 @@ impl Runtime for Wry { pub struct EventLoopIterationContext<'a, T: UserEvent> { pub callback: &'a mut (dyn FnMut(RunEvent) + 'static), pub webview_id_map: WebviewIdStore, - pub windows: Arc>>, + pub windows: Rc>>, } struct UserMessageContext { - windows: Arc>>, + windows: Rc>>, webview_id_map: WebviewIdStore, } @@ -2529,7 +2494,7 @@ fn handle_event_loop( fn on_close_requested<'a, T: UserEvent>( callback: &'a mut (dyn FnMut(RunEvent) + 'static), window_id: WebviewId, - windows: Arc>>, + windows: Rc>>, ) { let (tx, rx) = channel(); let windows_ref = windows.borrow(); @@ -2557,7 +2522,7 @@ fn on_close_requested<'a, T: UserEvent>( } } -fn on_window_close(window_id: WebviewId, windows: Arc>>) { +fn on_window_close(window_id: WebviewId, windows: Rc>>) { if let Some(window_wrapper) = windows.borrow_mut().get_mut(&window_id) { window_wrapper.inner = None; } @@ -2700,11 +2665,13 @@ fn create_webview( } for (scheme, protocol) in uri_scheme_protocols { - webview_builder = webview_builder.with_custom_protocol(scheme, move |wry_request| { - protocol(&HttpRequestWrapper::from(wry_request).0) - .map(|tauri_response| HttpResponseWrapper::from(tauri_response).0) - .map_err(|_| wry::Error::InitScriptError) - }); + webview_builder = + webview_builder.with_asynchronous_custom_protocol(scheme, move |request, responder| { + protocol( + request, + Box::new(move |response| responder.respond(response)), + ) + }); } for script in webview_attributes.initialization_scripts { @@ -2803,7 +2770,7 @@ fn create_webview( Ok(WindowWrapper { label, inner: Some(WindowHandle::Webview { - inner: Arc::new(webview), + inner: Rc::new(webview), context_store: web_context_store.clone(), context_key: if automation_enabled { None diff --git a/core/tauri-runtime/CHANGELOG.md b/core/tauri-runtime/CHANGELOG.md index 182aacc91458..e1a25afe14b8 100644 --- a/core/tauri-runtime/CHANGELOG.md +++ b/core/tauri-runtime/CHANGELOG.md @@ -1,5 +1,25 @@ # Changelog +## \[1.0.0-alpha.2] + +### Dependencies + +- Upgraded to `tauri-utils@2.0.0-alpha.8` + +## \[1.0.0-alpha.1] + +### Enhancements + +- [`0d63732b`](https://www.github.com/tauri-apps/tauri/commit/0d63732b962e71b98430f8d7b34ea5b59a2e8bb4)([#7754](https://www.github.com/tauri-apps/tauri/pull/7754)) Changed custom protocol closure type to enable asynchronous usage. + +### What's Changed + +- [`6177150b`](https://www.github.com/tauri-apps/tauri/commit/6177150b6f83b52ca359d6e20f7e540f7554e4eb)([#7601](https://www.github.com/tauri-apps/tauri/pull/7601)) Changed `FileDropEvent` to include drop and hover position. + +### Breaking Changes + +- [`0d63732b`](https://www.github.com/tauri-apps/tauri/commit/0d63732b962e71b98430f8d7b34ea5b59a2e8bb4)([#7754](https://www.github.com/tauri-apps/tauri/pull/7754)) `tauri-runtime` no longer implements its own HTTP types and relies on the `http` crate instead. + ## \[1.0.0-alpha.0] ### New Features diff --git a/core/tauri-runtime/Cargo.toml b/core/tauri-runtime/Cargo.toml index 0185ca771cae..3a09423e912f 100644 --- a/core/tauri-runtime/Cargo.toml +++ b/core/tauri-runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-runtime" -version = "1.0.0-alpha.0" +version = "1.0.0-alpha.2" description = "Runtime for Tauri applications" exclude = [ "CHANGELOG.md", "/target" ] readme = "README.md" @@ -19,19 +19,19 @@ default-target = "x86_64-unknown-linux-gnu" targets = [ "x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu", - "x86_64-apple-darwin" + "x86_64-apple-darwin", + "x86_64-linux-android", + "x86_64-apple-ios" ] [dependencies] serde = { version = "1.0", features = [ "derive" ] } serde_json = "1.0" thiserror = "1.0" -tauri-utils = { version = "2.0.0-alpha.7", path = "../tauri-utils" } +tauri-utils = { version = "2.0.0-alpha.8", path = "../tauri-utils" } uuid = { version = "1", features = [ "v4" ] } http = "0.2.4" -http-range = "0.1.4" raw-window-handle = "0.5" -rand = "0.8" url = { version = "2" } [target."cfg(windows)".dependencies.windows] diff --git a/core/tauri-runtime/src/http/mod.rs b/core/tauri-runtime/src/http/mod.rs deleted file mode 100644 index 7ce36f4fadee..000000000000 --- a/core/tauri-runtime/src/http/mod.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2019-2023 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT - -// custom wry types -mod request; -mod response; - -pub use self::{ - request::{Request, RequestParts}, - response::{Builder as ResponseBuilder, Response, ResponseParts}, -}; - -pub use tauri_utils::mime_type::MimeType; - -// re-expose default http types -pub use http::{header, method, status, uri::InvalidUri, version, Uri}; - -// re-export httprange helper as it can be useful and we need it locally -pub use http_range::HttpRange; diff --git a/core/tauri-runtime/src/http/request.rs b/core/tauri-runtime/src/http/request.rs deleted file mode 100644 index 42729de06baf..000000000000 --- a/core/tauri-runtime/src/http/request.rs +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright 2019-2023 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT - -use std::fmt; - -use super::{ - header::{HeaderMap, HeaderValue}, - method::Method, -}; - -/// Represents an HTTP request from the WebView. -/// -/// An HTTP request consists of a head and a potentially optional body. -/// -/// ## Platform-specific -/// -/// - **Linux:** Headers are not exposed. -pub struct Request { - head: RequestParts, - body: Vec, -} - -/// Component parts of an HTTP `Request` -/// -/// The HTTP request head consists of a method, uri, and a set of -/// header fields. -#[derive(Clone)] -pub struct RequestParts { - /// The request's method - pub method: Method, - - /// The request's URI - pub uri: String, - - /// The request's headers - pub headers: HeaderMap, -} - -impl Request { - /// Creates a new blank `Request` with the body - #[inline] - pub fn new(body: Vec) -> Request { - Request { - head: RequestParts::new(), - body, - } - } - - /// Creates a new `Request` with the given head and body. - /// - /// # Stability - /// - /// This API is used internally. It may have breaking changes in the future. - #[inline] - #[doc(hidden)] - pub fn new_internal(head: RequestParts, body: Vec) -> Request { - Request { head, body } - } - - /// Returns a reference to the associated HTTP method. - #[inline] - pub fn method(&self) -> &Method { - &self.head.method - } - - /// Returns a reference to the associated URI. - #[inline] - pub fn uri(&self) -> &str { - &self.head.uri - } - - /// Returns a reference to the associated header field map. - #[inline] - pub fn headers(&self) -> &HeaderMap { - &self.head.headers - } - - /// Returns a reference to the associated HTTP body. - #[inline] - pub fn body(&self) -> &Vec { - &self.body - } - - /// Consumes the request returning the head and body RequestParts. - /// - /// # Stability - /// - /// This API is used internally. It may have breaking changes in the future. - #[inline] - pub fn into_parts(self) -> (RequestParts, Vec) { - (self.head, self.body) - } -} - -impl Default for Request { - fn default() -> Request { - Request::new(Vec::new()) - } -} - -impl fmt::Debug for Request { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_struct("Request") - .field("method", self.method()) - .field("uri", &self.uri()) - .field("headers", self.headers()) - .field("body", self.body()) - .finish() - } -} - -impl RequestParts { - /// Creates a new default instance of `RequestParts` - fn new() -> RequestParts { - RequestParts { - method: Method::default(), - uri: "".into(), - headers: HeaderMap::default(), - } - } -} - -impl fmt::Debug for RequestParts { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_struct("Parts") - .field("method", &self.method) - .field("uri", &self.uri) - .field("headers", &self.headers) - .finish() - } -} diff --git a/core/tauri-runtime/src/http/response.rs b/core/tauri-runtime/src/http/response.rs deleted file mode 100644 index a004d4dc0d5f..000000000000 --- a/core/tauri-runtime/src/http/response.rs +++ /dev/null @@ -1,309 +0,0 @@ -// Copyright 2019-2023 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT - -use super::{ - header::{HeaderMap, HeaderName, HeaderValue}, - status::StatusCode, - version::Version, -}; -use std::{borrow::Cow, fmt}; - -type Result = core::result::Result>; - -/// Represents an HTTP response -/// -/// An HTTP response consists of a head and a potentially body. -/// -/// ## Platform-specific -/// -/// - **Linux:** Headers and status code cannot be changed. -/// -/// # Examples -/// -/// ``` -/// # use tauri_runtime::http::*; -/// -/// let response = ResponseBuilder::new() -/// .status(202) -/// .mimetype("text/html") -/// .body("hello!".as_bytes().to_vec()) -/// .unwrap(); -/// ``` -/// -pub struct Response { - head: ResponseParts, - body: Cow<'static, [u8]>, -} - -/// Component parts of an HTTP `Response` -/// -/// The HTTP response head consists of a status, version, and a set of -/// header fields. -#[derive(Clone)] -pub struct ResponseParts { - /// The response's status. - pub status: StatusCode, - - /// The response's version. - pub version: Version, - - /// The response's headers. - pub headers: HeaderMap, - - /// The response's mimetype type. - pub mimetype: Option, -} - -/// An HTTP response builder -/// -/// This type can be used to construct an instance of `Response` through a -/// builder-like pattern. -#[derive(Debug)] -pub struct Builder { - inner: Result, -} - -impl Response { - /// Creates a new blank `Response` with the body - #[inline] - pub fn new(body: Cow<'static, [u8]>) -> Response { - Response { - head: ResponseParts::new(), - body, - } - } - - /// Consumes the response returning the head and body ResponseParts. - /// - /// # Stability - /// - /// This API is used internally. It may have breaking changes in the future. - #[inline] - #[doc(hidden)] - pub fn into_parts(self) -> (ResponseParts, Cow<'static, [u8]>) { - (self.head, self.body) - } - - /// Sets the status code. - #[inline] - pub fn set_status(&mut self, status: StatusCode) { - self.head.status = status; - } - - /// Returns the [`StatusCode`]. - #[inline] - pub fn status(&self) -> StatusCode { - self.head.status - } - - /// Sets the mimetype. - #[inline] - pub fn set_mimetype(&mut self, mimetype: Option) { - self.head.mimetype = mimetype; - } - - /// Returns a reference to the mime type. - #[inline] - pub fn mimetype(&self) -> Option<&String> { - self.head.mimetype.as_ref() - } - - /// Returns a reference to the associated version. - #[inline] - pub fn version(&self) -> Version { - self.head.version - } - - /// Returns a mutable reference to the associated header field map. - #[inline] - pub fn headers_mut(&mut self) -> &mut HeaderMap { - &mut self.head.headers - } - - /// Returns a reference to the associated header field map. - #[inline] - pub fn headers(&self) -> &HeaderMap { - &self.head.headers - } - - /// Returns a mutable reference to the associated HTTP body. - #[inline] - pub fn body_mut(&mut self) -> &mut Cow<'static, [u8]> { - &mut self.body - } - - /// Returns a reference to the associated HTTP body. - #[inline] - pub fn body(&self) -> &Cow<'static, [u8]> { - &self.body - } -} - -impl Default for Response { - #[inline] - fn default() -> Response { - Response::new(Default::default()) - } -} - -impl fmt::Debug for Response { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_struct("Response") - .field("status", &self.status()) - .field("version", &self.version()) - .field("headers", self.headers()) - .field("body", self.body()) - .finish() - } -} - -impl ResponseParts { - /// Creates a new default instance of `ResponseParts` - fn new() -> ResponseParts { - ResponseParts { - status: StatusCode::default(), - version: Version::default(), - headers: HeaderMap::default(), - mimetype: None, - } - } -} - -impl fmt::Debug for ResponseParts { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_struct("Parts") - .field("status", &self.status) - .field("version", &self.version) - .field("headers", &self.headers) - .finish() - } -} - -impl Builder { - /// Creates a new default instance of `Builder` to construct either a - /// `Head` or a `Response`. - /// - /// # Examples - /// - /// ``` - /// # use tauri_runtime::http::*; - /// - /// let response = ResponseBuilder::new() - /// .status(200) - /// .mimetype("text/html") - /// .body(Vec::new()) - /// .unwrap(); - /// ``` - #[inline] - pub fn new() -> Builder { - Builder { - inner: Ok(ResponseParts::new()), - } - } - - /// Set the HTTP mimetype for this response. - #[must_use] - pub fn mimetype(self, mimetype: &str) -> Self { - self.and_then(move |mut head| { - head.mimetype = Some(mimetype.to_string()); - Ok(head) - }) - } - - /// Set the HTTP status for this response. - #[must_use] - pub fn status(self, status: T) -> Self - where - StatusCode: TryFrom, - >::Error: Into, - { - self.and_then(move |mut head| { - head.status = TryFrom::try_from(status).map_err(Into::into)?; - Ok(head) - }) - } - - /// Set the HTTP version for this response. - /// - /// This function will configure the HTTP version of the `Response` that - /// will be returned from `Builder::build`. - /// - /// By default this is HTTP/1.1 - #[must_use] - pub fn version(self, version: Version) -> Self { - self.and_then(move |mut head| { - head.version = version; - Ok(head) - }) - } - - /// Appends a header to this response builder. - /// - /// This function will append the provided key/value as a header to the - /// internal `HeaderMap` being constructed. Essentially this is equivalent - /// to calling `HeaderMap::append`. - #[must_use] - pub fn header(self, key: K, value: V) -> Self - where - HeaderName: TryFrom, - >::Error: Into, - HeaderValue: TryFrom, - >::Error: Into, - { - self.and_then(move |mut head| { - let name = >::try_from(key).map_err(Into::into)?; - let value = >::try_from(value).map_err(Into::into)?; - head.headers.append(name, value); - Ok(head) - }) - } - - /// "Consumes" this builder, using the provided `body` to return a - /// constructed `Response`. - /// - /// # Errors - /// - /// This function may return an error if any previously configured argument - /// failed to parse or get converted to the internal representation. For - /// example if an invalid `head` was specified via `header("Foo", - /// "Bar\r\n")` the error will be returned when this function is called - /// rather than when `header` was called. - /// - /// # Examples - /// - /// ``` - /// # use tauri_runtime::http::*; - /// - /// let response = ResponseBuilder::new() - /// .mimetype("text/html") - /// .body(Vec::new()) - /// .unwrap(); - /// ``` - pub fn body(self, body: impl Into>) -> Result { - self.inner.map(move |head| Response { - head, - body: body.into(), - }) - } - - // private - - fn and_then(self, func: F) -> Self - where - F: FnOnce(ResponseParts) -> Result, - { - Builder { - inner: self.inner.and_then(func), - } - } -} - -impl Default for Builder { - #[inline] - fn default() -> Builder { - Builder { - inner: Ok(ResponseParts::new()), - } - } -} diff --git a/core/tauri-runtime/src/lib.rs b/core/tauri-runtime/src/lib.rs index 25c743b8ae35..52158ccff121 100644 --- a/core/tauri-runtime/src/lib.rs +++ b/core/tauri-runtime/src/lib.rs @@ -19,7 +19,6 @@ use tauri_utils::Theme; use url::Url; use uuid::Uuid; -pub mod http; /// Types useful for interacting with a user's monitors. pub mod monitor; pub mod webview; @@ -32,11 +31,10 @@ use window::{ CursorIcon, DetachedWindow, PendingWindow, RawWindow, WindowEvent, }; -use crate::http::{ +use http::{ header::{InvalidHeaderName, InvalidHeaderValue}, method::InvalidMethod, status::InvalidStatusCode, - InvalidUri, }; /// Type of user attention requested on a window. @@ -101,8 +99,6 @@ pub enum Error { InvalidHeaderName(#[from] InvalidHeaderName), #[error("Invalid header value: {0}")] InvalidHeaderValue(#[from] InvalidHeaderValue), - #[error("Invalid uri: {0}")] - InvalidUri(#[from] InvalidUri), #[error("Invalid status code: {0}")] InvalidStatusCode(#[from] InvalidStatusCode), #[error("Invalid method: {0}")] diff --git a/core/tauri-runtime/src/window.rs b/core/tauri-runtime/src/window.rs index 5f06b6219eef..2e15a2c22981 100644 --- a/core/tauri-runtime/src/window.rs +++ b/core/tauri-runtime/src/window.rs @@ -5,7 +5,6 @@ //! A layer between raw [`Runtime`] webview windows and Tauri. use crate::{ - http::{Request as HttpRequest, Response as HttpResponse}, webview::{WebviewAttributes, WebviewIpcHandler}, Dispatch, Runtime, UserEvent, WindowBuilder, }; @@ -15,6 +14,7 @@ use tauri_utils::{config::WindowConfig, Theme}; use url::Url; use std::{ + borrow::Cow, collections::HashMap, hash::{Hash, Hasher}, marker::PhantomData, @@ -24,10 +24,13 @@ use std::{ use self::dpi::PhysicalPosition; -type UriSchemeProtocol = - dyn Fn(&HttpRequest) -> Result> + Send + Sync + 'static; +type UriSchemeProtocol = dyn Fn(http::Request>, Box>) + Send>) + + Send + + Sync + + 'static; -type WebResourceRequestHandler = dyn Fn(&HttpRequest, &mut HttpResponse) + Send + Sync; +type WebResourceRequestHandler = + dyn Fn(http::Request>, &mut http::Response>) + Send + Sync; type NavigationHandler = dyn Fn(&Url) -> bool + Send; @@ -306,7 +309,10 @@ impl> PendingWindow { pub fn register_uri_scheme_protocol< N: Into, - H: Fn(&HttpRequest) -> Result> + Send + Sync + 'static, + H: Fn(http::Request>, Box>) + Send>) + + Send + + Sync + + 'static, >( &mut self, uri_scheme: N, @@ -315,7 +321,7 @@ impl> PendingWindow { let uri_scheme = uri_scheme.into(); self .uri_scheme_protocols - .insert(uri_scheme, Box::new(move |data| (protocol)(data))); + .insert(uri_scheme, Box::new(protocol)); } #[cfg(target_os = "android")] diff --git a/core/tauri-utils/CHANGELOG.md b/core/tauri-utils/CHANGELOG.md index e385391b3b2a..3b5107cbc021 100644 --- a/core/tauri-utils/CHANGELOG.md +++ b/core/tauri-utils/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## \[2.0.0-alpha.8] + +### Enhancements + +- Add an option to specify `id` for the tray icon in the tauri configuration file. + +### Breaking Changes + +- [`100d9ede`](https://www.github.com/tauri-apps/tauri/commit/100d9ede35995d9db21d2087dd5606adfafb89a5)([#7802](https://www.github.com/tauri-apps/tauri/pull/7802)) Follow file name conventions set by desktop for mobile Tauri configuration files. Added `target` argument on most `config::parse` methods. + ## \[2.0.0-alpha.7] ### New Features diff --git a/core/tauri-utils/Cargo.toml b/core/tauri-utils/Cargo.toml index 7da87f5c339c..2889aa0d6568 100644 --- a/core/tauri-utils/Cargo.toml +++ b/core/tauri-utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-utils" -version = "2.0.0-alpha.7" +version = "2.0.0-alpha.8" description = "Utilities for Tauri" exclude = [ "CHANGELOG.md", "/target" ] readme = "README.md" @@ -38,6 +38,7 @@ memchr = "2" semver = "1" infer = "0.12" dunce = "1" +log = "0.4.20" [target."cfg(target_os = \"linux\")".dependencies] heck = "0.4" diff --git a/core/tauri-utils/src/config.rs b/core/tauri-utils/src/config.rs index 8ccd4d84ca4c..58dc4118aed0 100644 --- a/core/tauri-utils/src/config.rs +++ b/core/tauri-utils/src/config.rs @@ -252,7 +252,7 @@ impl BundleTarget { /// Configuration for AppImage bundles. /// -/// See more: https://tauri.app/v1/api/config#appimageconfig +/// See more: #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)] #[cfg_attr(feature = "schema", derive(JsonSchema))] #[serde(rename_all = "camelCase", deny_unknown_fields)] @@ -265,7 +265,7 @@ pub struct AppImageConfig { /// Configuration for Debian (.deb) bundles. /// -/// See more: https://tauri.app/v1/api/config#debconfig +/// See more: #[skip_serializing_none] #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)] #[cfg_attr(feature = "schema", derive(JsonSchema))] @@ -295,7 +295,7 @@ where /// Configuration for the macOS bundles. /// -/// See more: https://tauri.app/v1/api/config#macconfig +/// See more: #[skip_serializing_none] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[cfg_attr(feature = "schema", derive(JsonSchema))] @@ -353,7 +353,7 @@ fn minimum_system_version() -> Option { /// Configuration for a target language for the WiX build. /// -/// See more: https://tauri.app/v1/api/config#wixlanguageconfig +/// See more: #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[cfg_attr(feature = "schema", derive(JsonSchema))] #[serde(rename_all = "camelCase", deny_unknown_fields)] @@ -384,7 +384,7 @@ impl Default for WixLanguage { /// Configuration for the MSI bundle using WiX. /// -/// See more: https://tauri.app/v1/api/config#wixconfig +/// See more: #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)] #[cfg_attr(feature = "schema", derive(JsonSchema))] #[serde(rename_all = "camelCase", deny_unknown_fields)] @@ -565,7 +565,7 @@ impl Default for WebviewInstallMode { /// Windows bundler configuration. /// -/// See more: https://tauri.app/v1/api/config#windowsconfig +/// See more: #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[cfg_attr(feature = "schema", derive(JsonSchema))] #[serde(rename_all = "camelCase", deny_unknown_fields)] @@ -698,7 +698,7 @@ pub struct FileAssociation { /// The Updater configuration object. /// -/// See more: https://tauri.app/v1/api/config#updaterconfig +/// See more: #[skip_serializing_none] #[derive(Debug, PartialEq, Eq, Clone, Serialize)] #[cfg_attr(feature = "schema", derive(JsonSchema))] @@ -757,7 +757,7 @@ impl Default for UpdaterConfig { /// Configuration for tauri-bundler. /// -/// See more: https://tauri.app/v1/api/config#bundleconfig +/// See more: #[skip_serializing_none] #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)] #[cfg_attr(feature = "schema", derive(JsonSchema))] @@ -862,7 +862,7 @@ pub struct WindowEffectsConfig { /// The window configuration object. /// -/// See more: https://tauri.app/v1/api/config#windowconfig +/// See more: #[skip_serializing_none] #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[cfg_attr(feature = "schema", derive(JsonSchema))] @@ -1011,7 +1011,7 @@ pub struct WindowConfig { /// /// ## Platform-specific: /// - /// - **Windows**: If using decorations or shadows, you may want to try this workaround https://github.com/tauri-apps/tao/issues/72#issuecomment-975607891 + /// - **Windows**: If using decorations or shadows, you may want to try this workaround /// - **Linux**: Unsupported #[serde(default, alias = "window-effects")] pub window_effects: Option, @@ -1306,7 +1306,7 @@ impl FsScope { /// Config for the asset custom protocol. /// -/// See more: https://tauri.app/v1/api/config#assetprotocolconfig +/// See more: #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)] #[cfg_attr(feature = "schema", derive(JsonSchema))] #[serde(rename_all = "camelCase", deny_unknown_fields)] @@ -1321,7 +1321,7 @@ pub struct AssetProtocolConfig { /// Security configuration. /// -/// See more: https://tauri.app/v1/api/config#securityconfig +/// See more: #[skip_serializing_none] #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)] #[cfg_attr(feature = "schema", derive(JsonSchema))] @@ -1398,7 +1398,7 @@ impl Default for PatternKind { /// The Tauri configuration object. /// -/// See more: https://tauri.app/v1/api/config#tauriconfig +/// See more: #[skip_serializing_none] #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)] #[cfg_attr(feature = "schema", derive(JsonSchema))] @@ -1539,7 +1539,7 @@ impl<'de> Deserialize<'de> for WindowsUpdateInstallMode { /// The updater configuration for Windows. /// -/// See more: https://tauri.app/v1/api/config#updaterwindowsconfig +/// See more: #[skip_serializing_none] #[derive(Debug, Default, PartialEq, Eq, Clone, Serialize, Deserialize)] #[cfg_attr(feature = "schema", derive(JsonSchema))] @@ -1552,12 +1552,14 @@ pub struct UpdaterWindowsConfig { /// Configuration for application tray icon. /// -/// See more: https://tauri.app/v1/api/config#trayiconconfig +/// See more: #[skip_serializing_none] #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)] #[cfg_attr(feature = "schema", derive(JsonSchema))] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct TrayIconConfig { + /// Set an id for this tray icon so you can reference it later, defaults to `main`. + pub id: Option, /// Path to the default icon to use for the tray icon. #[serde(alias = "icon-path")] pub icon_path: PathBuf, @@ -1667,7 +1669,7 @@ pub enum HookCommand { /// The Build configuration object. /// -/// See more: https://tauri.app/v1/api/config#buildconfig +/// See more: #[skip_serializing_none] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[cfg_attr(feature = "schema", derive(JsonSchema))] @@ -1802,7 +1804,7 @@ impl<'d> serde::Deserialize<'d> for PackageVersion { /// The package configuration. /// -/// See more: https://tauri.app/v1/api/config#packageconfig +/// See more: #[derive(Debug, Clone, Default, PartialEq, Eq, Deserialize, Serialize)] #[cfg_attr(feature = "schema", derive(JsonSchema))] #[serde(rename_all = "camelCase", deny_unknown_fields)] @@ -1926,7 +1928,7 @@ pub struct Config { /// The plugin configs holds a HashMap mapping a plugin name to its configuration object. /// -/// See more: https://tauri.app/v1/api/config#pluginconfig +/// See more: #[derive(Debug, Clone, Default, PartialEq, Eq, Deserialize, Serialize)] #[cfg_attr(feature = "schema", derive(JsonSchema))] pub struct PluginConfig(pub HashMap); @@ -2570,6 +2572,7 @@ mod build { impl ToTokens for TrayIconConfig { fn to_tokens(&self, tokens: &mut TokenStream) { + let id = opt_str_lit(self.id.as_ref()); let icon_as_template = self.icon_as_template; let menu_on_left_click = self.menu_on_left_click; let icon_path = path_buf_lit(&self.icon_path); @@ -2578,6 +2581,7 @@ mod build { literal_struct!( tokens, TrayIconConfig, + id, icon_path, icon_as_template, menu_on_left_click, diff --git a/core/tauri-utils/src/config/parse.rs b/core/tauri-utils/src/config/parse.rs index 6590620edd34..b098cb545707 100644 --- a/core/tauri-utils/src/config/parse.rs +++ b/core/tauri-utils/src/config/parse.rs @@ -3,6 +3,7 @@ // SPDX-License-Identifier: MIT use crate::config::Config; +use crate::platform::Target; use json_patch::merge; use serde::de::DeserializeOwned; use serde_json::Value; @@ -47,47 +48,29 @@ impl ConfigFormat { } } - fn into_platform_file_name(self) -> &'static str { + fn into_platform_file_name(self, target: Target) -> &'static str { match self { - Self::Json => { - if cfg!(target_os = "macos") { - "tauri.macos.conf.json" - } else if cfg!(windows) { - "tauri.windows.conf.json" - } else if cfg!(target_os = "android") { - "tauri.android.conf.json" - } else if cfg!(target_os = "ios") { - "tauri.ios.conf.json" - } else { - "tauri.linux.conf.json" - } - } - Self::Json5 => { - if cfg!(target_os = "macos") { - "tauri.macos.conf.json5" - } else if cfg!(windows) { - "tauri.windows.conf.json5" - } else if cfg!(target_os = "android") { - "tauri.android.conf.json" - } else if cfg!(target_os = "ios") { - "tauri.ios.conf.json" - } else { - "tauri.linux.conf.json5" - } - } - Self::Toml => { - if cfg!(target_os = "macos") { - "Tauri.macos.toml" - } else if cfg!(windows) { - "Tauri.windows.toml" - } else if cfg!(target_os = "android") { - "tauri.android.toml" - } else if cfg!(target_os = "ios") { - "tauri.ios.toml" - } else { - "Tauri.linux.toml" - } - } + Self::Json => match target { + Target::Darwin => "tauri.macos.conf.json", + Target::Windows => "tauri.windows.conf.json", + Target::Linux => "tauri.linux.conf.json", + Target::Android => "tauri.android.conf.json", + Target::Ios => "tauri.ios.conf.json", + }, + Self::Json5 => match target { + Target::Darwin => "tauri.macos.conf.json5", + Target::Windows => "tauri.windows.conf.json5", + Target::Linux => "tauri.linux.conf.json5", + Target::Android => "tauri.android.conf.json5", + Target::Ios => "tauri.ios.conf.json5", + }, + Self::Toml => match target { + Target::Darwin => "Tauri.macos.toml", + Target::Windows => "Tauri.windows.toml", + Target::Linux => "Tauri.linux.toml", + Target::Android => "Tauri.android.toml", + Target::Ios => "Tauri.ios.toml", + }, } } } @@ -154,18 +137,18 @@ pub enum ConfigError { } /// Determines if the given folder has a configuration file. -pub fn folder_has_configuration_file(folder: &Path) -> bool { +pub fn folder_has_configuration_file(target: Target, folder: &Path) -> bool { folder.join(ConfigFormat::Json.into_file_name()).exists() || folder.join(ConfigFormat::Json5.into_file_name()).exists() || folder.join(ConfigFormat::Toml.into_file_name()).exists() // platform file names - || folder.join(ConfigFormat::Json.into_platform_file_name()).exists() - || folder.join(ConfigFormat::Json5.into_platform_file_name()).exists() - || folder.join(ConfigFormat::Toml.into_platform_file_name()).exists() + || folder.join(ConfigFormat::Json.into_platform_file_name(target)).exists() + || folder.join(ConfigFormat::Json5.into_platform_file_name(target)).exists() + || folder.join(ConfigFormat::Toml.into_platform_file_name(target)).exists() } /// Determines if the given file path represents a Tauri configuration file. -pub fn is_configuration_file(path: &Path) -> bool { +pub fn is_configuration_file(target: Target, path: &Path) -> bool { path .file_name() .map(|file_name| { @@ -173,9 +156,9 @@ pub fn is_configuration_file(path: &Path) -> bool { || file_name == OsStr::new(ConfigFormat::Json5.into_file_name()) || file_name == OsStr::new(ConfigFormat::Toml.into_file_name()) // platform file names - || file_name == OsStr::new(ConfigFormat::Json.into_platform_file_name()) - || file_name == OsStr::new(ConfigFormat::Json5.into_platform_file_name()) - || file_name == OsStr::new(ConfigFormat::Toml.into_platform_file_name()) + || file_name == OsStr::new(ConfigFormat::Json.into_platform_file_name(target)) + || file_name == OsStr::new(ConfigFormat::Json5.into_platform_file_name(target)) + || file_name == OsStr::new(ConfigFormat::Toml.into_platform_file_name(target)) }) .unwrap_or_default() } @@ -192,9 +175,9 @@ pub fn is_configuration_file(path: &Path) -> bool { /// Merging the configurations using [JSON Merge Patch (RFC 7396)]. /// /// [JSON Merge Patch (RFC 7396)]: https://datatracker.ietf.org/doc/html/rfc7396. -pub fn read_from(root_dir: PathBuf) -> Result { - let mut config: Value = parse_value(root_dir.join("tauri.conf.json"))?.0; - if let Some((platform_config, _)) = read_platform(root_dir)? { +pub fn read_from(target: Target, root_dir: PathBuf) -> Result { + let mut config: Value = parse_value(target, root_dir.join("tauri.conf.json"))?.0; + if let Some((platform_config, _)) = read_platform(target, root_dir)? { merge(&mut config, &platform_config); } Ok(config) @@ -203,10 +186,13 @@ pub fn read_from(root_dir: PathBuf) -> Result { /// Reads the platform-specific configuration file from the given root directory if it exists. /// /// Check [`read_from`] for more information. -pub fn read_platform(root_dir: PathBuf) -> Result, ConfigError> { - let platform_config_path = root_dir.join(ConfigFormat::Json.into_platform_file_name()); - if does_supported_file_name_exist(&platform_config_path) { - let (platform_config, path): (Value, PathBuf) = parse_value(platform_config_path)?; +pub fn read_platform( + target: Target, + root_dir: PathBuf, +) -> Result, ConfigError> { + let platform_config_path = root_dir.join(ConfigFormat::Json.into_platform_file_name(target)); + if does_supported_file_name_exist(target, &platform_config_path) { + let (platform_config, path): (Value, PathBuf) = parse_value(target, platform_config_path)?; Ok(Some((platform_config, path))) } else { Ok(None) @@ -217,16 +203,16 @@ pub fn read_platform(root_dir: PathBuf) -> Result, Conf /// /// The passed path is expected to be the path to the "default" configuration format, in this case /// JSON with `.json`. -pub fn does_supported_file_name_exist(path: impl Into) -> bool { +pub fn does_supported_file_name_exist(target: Target, path: impl Into) -> bool { let path = path.into(); let source_file_name = path.file_name().unwrap().to_str().unwrap(); let lookup_platform_config = ENABLED_FORMATS .iter() - .any(|format| source_file_name == format.into_platform_file_name()); + .any(|format| source_file_name == format.into_platform_file_name(target)); ENABLED_FORMATS.iter().any(|format| { path .with_file_name(if lookup_platform_config { - format.into_platform_file_name() + format.into_platform_file_name(target) } else { format.into_file_name() }) @@ -248,31 +234,37 @@ pub fn does_supported_file_name_exist(path: impl Into) -> bool { /// a. Parse it with `toml` /// b. Return error if all above steps failed /// 4. Return error if all above steps failed -pub fn parse(path: impl Into) -> Result<(Config, PathBuf), ConfigError> { - do_parse(path.into()) +pub fn parse(target: Target, path: impl Into) -> Result<(Config, PathBuf), ConfigError> { + do_parse(target, path.into()) } /// See [`parse`] for specifics, returns a JSON [`Value`] instead of [`Config`]. -pub fn parse_value(path: impl Into) -> Result<(Value, PathBuf), ConfigError> { - do_parse(path.into()) +pub fn parse_value( + target: Target, + path: impl Into, +) -> Result<(Value, PathBuf), ConfigError> { + do_parse(target, path.into()) } -fn do_parse(path: PathBuf) -> Result<(D, PathBuf), ConfigError> { +fn do_parse( + target: Target, + path: PathBuf, +) -> Result<(D, PathBuf), ConfigError> { let file_name = path .file_name() .map(OsStr::to_string_lossy) .unwrap_or_default(); let lookup_platform_config = ENABLED_FORMATS .iter() - .any(|format| file_name == format.into_platform_file_name()); + .any(|format| file_name == format.into_platform_file_name(target)); let json5 = path.with_file_name(if lookup_platform_config { - ConfigFormat::Json5.into_platform_file_name() + ConfigFormat::Json5.into_platform_file_name(target) } else { ConfigFormat::Json5.into_file_name() }); let toml = path.with_file_name(if lookup_platform_config { - ConfigFormat::Toml.into_platform_file_name() + ConfigFormat::Toml.into_platform_file_name(target) } else { ConfigFormat::Toml.into_file_name() }); diff --git a/core/tauri-utils/src/lib.rs b/core/tauri-utils/src/lib.rs index a9fbf6622fc9..54a4328561fc 100644 --- a/core/tauri-utils/src/lib.rs +++ b/core/tauri-utils/src/lib.rs @@ -14,6 +14,7 @@ #![allow(clippy::deprecated_semver)] use std::{ + ffi::OsString, fmt::Display, path::{Path, PathBuf}, }; @@ -21,6 +22,8 @@ use std::{ use semver::Version; use serde::{Deserialize, Deserializer, Serialize, Serializer}; +use log::warn; + pub mod assets; pub mod config; pub mod html; @@ -275,13 +278,13 @@ pub struct Env { #[cfg(target_os = "linux")] pub appdir: Option, /// The command line arguments of the current process. - pub args: Vec, + pub args_os: Vec, } #[allow(clippy::derivable_impls)] impl Default for Env { fn default() -> Self { - let args = std::env::args().skip(1).collect(); + let args_os = std::env::args_os().skip(1).collect(); #[cfg(target_os = "linux")] { let env = Self { @@ -289,7 +292,7 @@ impl Default for Env { appimage: std::env::var_os("APPIMAGE"), #[cfg(target_os = "linux")] appdir: std::env::var_os("APPDIR"), - args, + args_os, }; if env.appimage.is_some() || env.appdir.is_some() { // validate that we're actually running on an AppImage @@ -305,14 +308,14 @@ impl Default for Env { .unwrap_or(true); if !is_temp { - panic!("`APPDIR` or `APPIMAGE` environment variable found but this application was not detected as an AppImage; this might be a security issue."); + warn!("`APPDIR` or `APPIMAGE` environment variable found but this application was not detected as an AppImage; this might be a security issue."); } } env } #[cfg(not(target_os = "linux"))] { - Self { args } + Self { args_os } } } } diff --git a/core/tauri-utils/src/platform.rs b/core/tauri-utils/src/platform.rs index 0ca4fd617966..248c5aa66cee 100644 --- a/core/tauri-utils/src/platform.rs +++ b/core/tauri-utils/src/platform.rs @@ -10,6 +10,59 @@ use crate::{Env, PackageInfo}; mod starting_binary; +/// Platform target. +#[derive(PartialEq, Eq, Copy, Clone)] +pub enum Target { + /// MacOS. + Darwin, + /// Windows. + Windows, + /// Linux. + Linux, + /// Android. + Android, + /// iOS. + Ios, +} + +impl Target { + /// Parses the target from the given target triple. + pub fn from_triple(target: &str) -> Self { + if target.contains("darwin") { + Self::Darwin + } else if target.contains("windows") { + Self::Windows + } else if target.contains("android") { + Self::Android + } else if target.contains("ios") { + Self::Ios + } else { + Self::Linux + } + } + + /// Gets the current build target. + pub fn current() -> Self { + if cfg!(target_os = "macos") { + Self::Darwin + } else if cfg!(target_os = "windows") { + Self::Windows + } else { + Self::Linux + } + } + + /// Whether the target is mobile or not. + pub fn is_mobile(&self) -> bool { + matches!(self, Target::Android | Target::Ios) + } + + /// Whether the target is desktop or not. + pub fn is_desktop(&self) -> bool { + !self.is_mobile() + } +} + /// Retrieves the currently running binary's path, taking into account security considerations. /// /// The path is cached as soon as possible (before even `main` runs) and that value is returned diff --git a/core/tauri/CHANGELOG.md b/core/tauri/CHANGELOG.md index 3bc6484f400d..a5e2a0bec776 100644 --- a/core/tauri/CHANGELOG.md +++ b/core/tauri/CHANGELOG.md @@ -1,5 +1,86 @@ # Changelog +## \[2.0.0-alpha.15] + +### Enhancements + +- [`b597aa5f`](https://www.github.com/tauri-apps/tauri/commit/b597aa5f3974f5ca5ca5159d441abc9ed3e80721)([#7871](https://www.github.com/tauri-apps/tauri/pull/7871)) Set `main` as the default `id` for the tray icon registered from the configuration file, so if the `id` is not specified, it can be retrieved using `app.tray_by_id("main")`. + +### Bug Fixes + +- [`a2021c30`](https://www.github.com/tauri-apps/tauri/commit/a2021c30ba1139fcfe4db2522b96125f3fa4d9d6)([#7866](https://www.github.com/tauri-apps/tauri/pull/7866)) Changed `IconMenuItem::set_native_icon` signature to take `&self` instead of `&mut self` to fix compilation error on macos. +- [`a68ccaf5`](https://www.github.com/tauri-apps/tauri/commit/a68ccaf59a6731dc030bdb4642a35e3bc64d5769)([#7822](https://www.github.com/tauri-apps/tauri/pull/7822)) Fix `asset` protocol failing to fetch files. +- [`6fbd6dba`](https://www.github.com/tauri-apps/tauri/commit/6fbd6dba5290dc017ab0ba5a44cf4358b022836f)([#17](https://www.github.com/tauri-apps/tauri/pull/17)) Fix the validation of `std::env::current_exe` warn the user if AppImage is not mounted instead of panicking + +### Dependencies + +- Upgraded to `tauri-macros@2.0.0-alpha.8` +- Upgraded to `tauri-utils@2.0.0-alpha.8` +- Upgraded to `tauri-build@2.0.0-alpha.9` +- Upgraded to `tauri-runtime@1.0.0-alpha.2` +- Upgraded to `tauri-runtime-wry@1.0.0-alpha.3` + +### Breaking Changes + +- [`092a561c`](https://www.github.com/tauri-apps/tauri/commit/092a561ca69a631d2a03777e29debeba37b197a7)([#7874](https://www.github.com/tauri-apps/tauri/pull/7874)) Removed `tauri::api` module as most apis have been moved to either a plugin or we recommend using other crates. +- [`deea9436`](https://www.github.com/tauri-apps/tauri/commit/deea9436261f651188e0bc86104779bf30029c32)([#7876](https://www.github.com/tauri-apps/tauri/pull/7876)) Changed `Env.args` to `Env.args_os` and now uses `OsString` instead of `String` +- [`b7fd88e1`](https://www.github.com/tauri-apps/tauri/commit/b7fd88e18d24e4450129a5a5007f2e740c69afe5)([#7944](https://www.github.com/tauri-apps/tauri/pull/7944)) `tauri::scope` module is recieving a couple of consistency changes: + + - Added `tauri::scope::fs` module. + - Removed `scope::IpcScope` re-export, use `scope::ipc::Scope`. + - Removed `FsScope`, `GlobPattern` and `FsScopeEvent`, use `scope::fs::Scope`, `scope::fs::Pattern` and `scope::fs::Event` respectively. +- [`c0d03af4`](https://www.github.com/tauri-apps/tauri/commit/c0d03af4704c828698e06e9662dab1087c99c42e)([#7943](https://www.github.com/tauri-apps/tauri/pull/7943)) Changed `TrayIconBuilder/TrayIcon::on_tray_event` to `TrayIconBuilder/TrayIcon::on_tray_icon_event` for consistency of naming. + +## \[2.0.0-alpha.14] + +### Bug Fixes + +- [`d5074af5`](https://www.github.com/tauri-apps/tauri/commit/d5074af562b2b5cb6c5711442097c4058af32db6)([#7801](https://www.github.com/tauri-apps/tauri/pull/7801)) Fixes custom protocol not working on Windows. + +### Dependencies + +- Upgraded to `tauri-runtime-wry@1.0.0-alpha.2` + +### Breaking Changes + +- [`d5074af5`](https://www.github.com/tauri-apps/tauri/commit/d5074af562b2b5cb6c5711442097c4058af32db6)([#7801](https://www.github.com/tauri-apps/tauri/pull/7801)) The custom protocol on Android now uses the `http` scheme instead of `https`. + +## \[2.0.0-alpha.13] + +### Breaking Changes + +- [`4cb51a2d`](https://www.github.com/tauri-apps/tauri/commit/4cb51a2d56cfcae0749062c79ede5236bd8c02c2)([#7779](https://www.github.com/tauri-apps/tauri/pull/7779)) The custom protocol on Windows now uses the `http` scheme instead of `https`. + +## \[2.0.0-alpha.12] + +### Enhancements + +- [`8a676617`](https://www.github.com/tauri-apps/tauri/commit/8a6766173b3da4446a87642e7282c73a5b631afe)([#7618](https://www.github.com/tauri-apps/tauri/pull/7618)) Ensure Builder is Send by requiring the menu closure to be Send. +- [`0d63732b`](https://www.github.com/tauri-apps/tauri/commit/0d63732b962e71b98430f8d7b34ea5b59a2e8bb4)([#7754](https://www.github.com/tauri-apps/tauri/pull/7754)) Added `Builder::register_asynchronous_uri_scheme_protocol` to allow resolving a custom URI scheme protocol request asynchronously to prevent blocking the main thread. + +### Bug Fixes + +- [`0d63732b`](https://www.github.com/tauri-apps/tauri/commit/0d63732b962e71b98430f8d7b34ea5b59a2e8bb4)([#7754](https://www.github.com/tauri-apps/tauri/pull/7754)) Fixes invalid header value type when requesting IPC body through a channel. +- [`e98393e4`](https://www.github.com/tauri-apps/tauri/commit/e98393e499c03504851e97dd9f740b817c4534df)([#7673](https://www.github.com/tauri-apps/tauri/pull/7673)) No longer unpacking and flattening the `payload` over the IPC so that commands with arguments called `cmd`, `callback`, `error`, `options` or `payload` aren't breaking the IPC. +- [`29818de6`](https://www.github.com/tauri-apps/tauri/commit/29818de682146a75cd9a886f7b215154cad1d42d)([#7662](https://www.github.com/tauri-apps/tauri/pull/7662)) Fixes IPC failing to communicate for remote URLs on macOS and iOS. + +### What's Changed + +- [`6177150b`](https://www.github.com/tauri-apps/tauri/commit/6177150b6f83b52ca359d6e20f7e540f7554e4eb)([#7601](https://www.github.com/tauri-apps/tauri/pull/7601)) Changed `FileDropEvent` to include drop and hover position. + +### Dependencies + +- Upgraded to `tauri-runtime@1.0.0-alpha.1` +- Upgraded to `tauri-runtime-wry@1.0.0-alpha.1` + +### Breaking Changes + +- [`0d63732b`](https://www.github.com/tauri-apps/tauri/commit/0d63732b962e71b98430f8d7b34ea5b59a2e8bb4)([#7754](https://www.github.com/tauri-apps/tauri/pull/7754)) Changed `Builder::register_uri_scheme_protocol` to return a `http::Response` instead of `Result`. To return an error response, manually create a response with status code >= 400. +- [`0d63732b`](https://www.github.com/tauri-apps/tauri/commit/0d63732b962e71b98430f8d7b34ea5b59a2e8bb4)([#7754](https://www.github.com/tauri-apps/tauri/pull/7754)) `tauri-runtime` no longer implements its own HTTP types and relies on the `http` crate instead. +- [`0d63732b`](https://www.github.com/tauri-apps/tauri/commit/0d63732b962e71b98430f8d7b34ea5b59a2e8bb4)([#7754](https://www.github.com/tauri-apps/tauri/pull/7754)) Changed `Builder::invoke_system` to take references instead of owned values. +- [`5c95152c`](https://www.github.com/tauri-apps/tauri/commit/5c95152c76391607746f6da942ec57d23c89e89e)([#7621](https://www.github.com/tauri-apps/tauri/pull/7621)) Changed `MenuBuilder\SubmenuBuilder::text`, `MenuBuilder\SubmenuBuilder::check`, `MenuBuilder\SubmenuBuilder::icon` and `MenuBuilder\SubmenuBuilder::native_icon` to take an `id` as the first argument. +- [`0d63732b`](https://www.github.com/tauri-apps/tauri/commit/0d63732b962e71b98430f8d7b34ea5b59a2e8bb4)([#7754](https://www.github.com/tauri-apps/tauri/pull/7754)) Changed `Window::on_message` signature to take a responder closure instead of returning the response object in order to asynchronously process the request. + ## \[2.0.0-alpha.11] ### New Features diff --git a/core/tauri/Cargo.toml b/core/tauri/Cargo.toml index 537929c46db4..6f954833ece6 100644 --- a/core/tauri/Cargo.toml +++ b/core/tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri" -version = "2.0.0-alpha.11" +version = "2.0.0-alpha.15" description = "Make tiny, secure apps for all desktop platforms with Tauri" exclude = [ "/test", "/.scripts", "CHANGELOG.md", "/target" ] readme = "README.md" @@ -30,12 +30,15 @@ default-target = "x86_64-unknown-linux-gnu" targets = [ "x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu", - "x86_64-apple-darwin" + "x86_64-apple-darwin", + "x86_64-linux-android", + "x86_64-apple-ios" ] [package.metadata.cargo-udeps.ignore] normal = [ "reqwest" ] build = [ "tauri-build" ] +development = [ "quickcheck_macros" ] [dependencies] serde_json = { version = "1.0", features = [ "raw_value" ] } @@ -47,10 +50,10 @@ url = { version = "2.4" } anyhow = "1.0" thiserror = "1.0" once_cell = "1" -tauri-runtime = { version = "1.0.0-alpha.0", path = "../tauri-runtime" } -tauri-macros = { version = "2.0.0-alpha.7", path = "../tauri-macros" } -tauri-utils = { version = "2.0.0-alpha.7", features = [ "resources" ], path = "../tauri-utils" } -tauri-runtime-wry = { version = "1.0.0-alpha.0", path = "../tauri-runtime-wry", optional = true } +tauri-runtime = { version = "1.0.0-alpha.2", path = "../tauri-runtime" } +tauri-macros = { version = "2.0.0-alpha.8", path = "../tauri-macros" } +tauri-utils = { version = "2.0.0-alpha.8", features = [ "resources" ], path = "../tauri-utils" } +tauri-runtime-wry = { version = "1.0.0-alpha.3", path = "../tauri-runtime-wry", optional = true } rand = "0.8" serde_repr = "0.1" state = "0.6" @@ -67,6 +70,7 @@ serialize-to-javascript = "=0.1.1" infer = { version = "0.15", optional = true } png = { version = "0.17", optional = true } ico = { version = "0.3.0", optional = true } +http-range = { version = "0.1.4", optional = true } [target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\", target_os = \"windows\", target_os = \"macos\"))".dependencies] muda = { version = "0.8", default-features = false } @@ -105,7 +109,7 @@ swift-rs = "1.0.5" [build-dependencies] heck = "0.4" once_cell = "1" -tauri-build = { path = "../tauri-build/", version = "2.0.0-alpha.8" } +tauri-build = { path = "../tauri-build/", version = "2.0.0-alpha.9" } [dev-dependencies] proptest = "1.2.0" @@ -116,6 +120,7 @@ serde_json = "1.0" tauri = { path = ".", default-features = false, features = [ "wry" ] } tokio = { version = "1", features = [ "full" ] } cargo_toml = "0.15" +http-range = "0.1.4" [features] default = [ @@ -145,7 +150,7 @@ macos-private-api = [ "tauri-runtime-wry/macos-private-api" ] window-data-url = [ "data-url" ] -protocol-asset = [ ] +protocol-asset = [ "http-range" ] config-json5 = [ "tauri-macros/config-json5" ] config-toml = [ "tauri-macros/config-toml" ] icon-ico = [ "infer", "ico" ] diff --git a/core/tauri/scripts/core.js b/core/tauri/scripts/core.js index 6c33e0a0b64b..62ac1d1d2416 100644 --- a/core/tauri/scripts/core.js +++ b/core/tauri/scripts/core.js @@ -18,7 +18,7 @@ window.__TAURI__.convertFileSrc = function convertFileSrc(filePath, protocol = 'asset') { const path = encodeURIComponent(filePath) return osName === 'windows' || osName === 'android' - ? `https://${protocol}.localhost/${path}` + ? `http://${protocol}.localhost/${path}` : `${protocol}://localhost/${path}` } @@ -59,11 +59,11 @@ window.__TAURI_INVOKE__ = function invoke(cmd, payload = {}, options) { return new Promise(function (resolve, reject) { - var callback = window.__TAURI__.transformCallback(function (r) { + const callback = window.__TAURI__.transformCallback(function (r) { resolve(r) delete window[`_${error}`] }, true) - var error = window.__TAURI__.transformCallback(function (e) { + const error = window.__TAURI__.transformCallback(function (e) { reject(e) delete window[`_${callback}`] }, true) diff --git a/core/tauri/scripts/ipc-protocol.js b/core/tauri/scripts/ipc-protocol.js index 724284af80b0..f52ab5e09ad0 100644 --- a/core/tauri/scripts/ipc-protocol.js +++ b/core/tauri/scripts/ipc-protocol.js @@ -10,11 +10,32 @@ Object.defineProperty(window, '__TAURI_POST_MESSAGE__', { value: (message) => { - const { cmd, callback, error, payload, options } = message + const { + cmd, + callback, + error, + payload, + options + } = message - // use custom protocol for IPC if the flag is set to true, the command is the fetch data command or when not on Linux/Android - if (useCustomProtocol || cmd === fetchChannelDataCommand || (osName !== 'linux' && osName !== 'android')) { - const { contentType, data } = processIpcMessage(payload) + // use custom protocol for IPC if: + // - the flag is set to true or + // - the command is the fetch data command or + // - when not on Linux/Android + // AND + // - when not on macOS with an https URL + if ( + ( + useCustomProtocol || + cmd === fetchChannelDataCommand || + !(osName === 'linux' || osName === 'android') + ) && + !((osName === 'macos' || osName === 'ios') && location.protocol === 'https:') + ) { + const { + contentType, + data + } = processIpcMessage(payload) fetch(window.__TAURI__.convertFileSrc(cmd, 'ipc'), { method: 'POST', body: data, @@ -44,7 +65,15 @@ }) } else { // otherwise use the postMessage interface - const { data } = processIpcMessage({ cmd, callback, error, options, ...payload }) + const { + data + } = processIpcMessage({ + cmd, + callback, + error, + options, + payload + }) window.ipc.postMessage(data) } } diff --git a/core/tauri/scripts/ipc.js b/core/tauri/scripts/ipc.js index 433eba1e5db4..1101e123b2c8 100644 --- a/core/tauri/scripts/ipc.js +++ b/core/tauri/scripts/ipc.js @@ -34,7 +34,7 @@ */ function isIsolationMessage(event) { if (typeof event.data === 'object' && typeof event.data.payload === 'object') { - const keys = Object.keys(event.data.payload) + const keys = Object.keys(event.data.payload || {}) return ( keys.length > 0 && keys.every((key) => key === 'nonce' || key === 'payload') diff --git a/core/tauri/src/api/error.rs b/core/tauri/src/api/error.rs deleted file mode 100644 index fe9f3d1a4bfe..000000000000 --- a/core/tauri/src/api/error.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2019-2023 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT - -/// The result type of Tauri API module. -pub type Result = std::result::Result; - -/// The error type of Tauri API module. -#[derive(thiserror::Error, Debug)] -#[non_exhaustive] -pub enum Error { - /// JSON error. - #[error(transparent)] - Json(#[from] serde_json::Error), -} diff --git a/core/tauri/src/api/mod.rs b/core/tauri/src/api/mod.rs deleted file mode 100644 index 10742b7baeb6..000000000000 --- a/core/tauri/src/api/mod.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2019-2023 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT - -//! The Tauri API interface. - -mod error; - -pub use error::{Error, Result}; -// Not public API -#[doc(hidden)] -pub mod private { - pub use once_cell::sync::OnceCell; - - pub trait AsTauriContext { - fn config() -> &'static crate::Config; - fn assets() -> &'static crate::utils::assets::EmbeddedAssets; - fn default_window_icon() -> Option<&'static [u8]>; - fn package_info() -> crate::PackageInfo; - } -} diff --git a/core/tauri/src/api/os.rs b/core/tauri/src/api/os.rs deleted file mode 100644 index c5ea565a8d0e..000000000000 --- a/core/tauri/src/api/os.rs +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2019-2023 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT - -//! Types and functions related to operating system operations. - -/// Returns `Some(String)` with a `BCP-47` language tag inside. If the locale couldn’t be obtained, `None` is returned instead. -pub fn locale() -> Option { - sys_locale::get_locale() -} diff --git a/core/tauri/src/app.rs b/core/tauri/src/app.rs index e6dc32998911..eaa3b6360b3c 100644 --- a/core/tauri/src/app.rs +++ b/core/tauri/src/app.rs @@ -8,15 +8,14 @@ use crate::{ channel::ChannelDataIpcQueue, CallbackFn, Invoke, InvokeError, InvokeHandler, InvokeResponder, InvokeResponse, }, - manager::{Asset, CustomProtocol, WindowManager}, + manager::{Asset, UriSchemeProtocol, WindowManager}, plugin::{Plugin, PluginStore}, runtime::{ - http::{Request as HttpRequest, Response as HttpResponse}, webview::WebviewAttributes, window::{PendingWindow, WindowEvent as RuntimeWindowEvent}, ExitRequestedEventAction, RunEvent as RuntimeRunEvent, }, - scope::IpcScope, + scope, sealed::{ManagerBase, RuntimeOrDispatch}, utils::config::Config, utils::{assets::Assets, Env}, @@ -24,9 +23,6 @@ use crate::{ StateManager, Theme, Window, }; -#[cfg(feature = "protocol-asset")] -use crate::scope::FsScope; - #[cfg(desktop)] use crate::menu::{Menu, MenuEvent}; #[cfg(all(desktop, feature = "tray-icon"))] @@ -49,6 +45,7 @@ use tauri_runtime::{ use tauri_utils::PackageInfo; use std::{ + borrow::Cow, collections::HashMap, fmt, sync::{mpsc::Sender, Arc, Weak}, @@ -534,8 +531,8 @@ macro_rules! shared_app_impl { .push(Box::new(handler)); } - /// Gets the first tray icon registerd, usually the one configured in - /// tauri config file. + /// Gets the first tray icon registered, + /// usually the one configured in the Tauri configuration file. #[cfg(all(desktop, feature = "tray-icon"))] #[cfg_attr(doc_cfg, doc(cfg(all(desktop, feature = "tray-icon"))))] pub fn tray(&self) -> Option> { @@ -990,7 +987,7 @@ pub struct Builder { plugins: PluginStore, /// The webview protocols available to all windows. - uri_scheme_protocols: HashMap>>, + uri_scheme_protocols: HashMap>>, /// App state. state: StateManager, @@ -1097,7 +1094,7 @@ impl Builder { #[must_use] pub fn invoke_system(mut self, initialization_script: String, responder: F) -> Self where - F: Fn(Window, String, &InvokeResponse, CallbackFn, CallbackFn) + Send + Sync + 'static, + F: Fn(&Window, &str, &InvokeResponse, CallbackFn, CallbackFn) + Send + Sync + 'static, { self.invoke_initialization_script = initialization_script; self.invoke_responder.replace(Arc::new(responder)); @@ -1348,14 +1345,31 @@ impl Builder { /// # Arguments /// /// * `uri_scheme` The URI scheme to register, such as `example`. - /// * `protocol` the protocol associated with the given URI scheme. It's a function that takes an URL such as `example://localhost/asset.css`. + /// * `protocol` the protocol associated with the given URI scheme. It's a function that takes a request and returns a response. + /// + /// # Examples + /// ``` + /// tauri::Builder::default() + /// .register_uri_scheme_protocol("app-files", |_app, request| { + /// // skip leading `/` + /// if let Ok(data) = std::fs::read(&request.uri().path()[1..]) { + /// http::Response::builder() + /// .body(data) + /// .unwrap() + /// } else { + /// http::Response::builder() + /// .status(http::StatusCode::BAD_REQUEST) + /// .header(http::header::CONTENT_TYPE, mime::TEXT_PLAIN.essence_str()) + /// .body("failed to read file".as_bytes().to_vec()) + /// .unwrap() + /// } + /// }); + /// ``` #[must_use] pub fn register_uri_scheme_protocol< N: Into, - H: Fn(&AppHandle, &HttpRequest) -> Result> - + Send - + Sync - + 'static, + T: Into>, + H: Fn(&AppHandle, http::Request>) -> http::Response + Send + Sync + 'static, >( mut self, uri_scheme: N, @@ -1363,7 +1377,55 @@ impl Builder { ) -> Self { self.uri_scheme_protocols.insert( uri_scheme.into(), - Arc::new(CustomProtocol { + Arc::new(UriSchemeProtocol { + protocol: Box::new(move |app, request, responder| { + responder.respond(protocol(app, request)) + }), + }), + ); + self + } + + /// Similar to [`Self::register_uri_scheme_protocol`] but with an asynchronous responder that allows you + /// to process the request in a separate thread and respond asynchronously. + /// + /// # Examples + /// ``` + /// tauri::Builder::default() + /// .register_asynchronous_uri_scheme_protocol("app-files", |_app, request, responder| { + /// // skip leading `/` + /// let path = request.uri().path()[1..].to_string(); + /// std::thread::spawn(move || { + /// if let Ok(data) = std::fs::read(path) { + /// responder.respond( + /// http::Response::builder() + /// .body(data) + /// .unwrap() + /// ); + /// } else { + /// responder.respond( + /// http::Response::builder() + /// .status(http::StatusCode::BAD_REQUEST) + /// .header(http::header::CONTENT_TYPE, mime::TEXT_PLAIN.essence_str()) + /// .body("failed to read file".as_bytes().to_vec()) + /// .unwrap() + /// ); + /// } + /// }); + /// }); + /// ``` + #[must_use] + pub fn register_asynchronous_uri_scheme_protocol< + N: Into, + H: Fn(&AppHandle, http::Request>, UriSchemeResponder) + Send + Sync + 'static, + >( + mut self, + uri_scheme: N, + protocol: H, + ) -> Self { + self.uri_scheme_protocols.insert( + uri_scheme.into(), + Arc::new(UriSchemeProtocol { protocol: Box::new(protocol), }), ); @@ -1511,9 +1573,12 @@ impl Builder { app.manage(env); app.manage(Scopes { - ipc: IpcScope::new(&app.config()), + ipc: scope::ipc::Scope::new(&app.config()), #[cfg(feature = "protocol-asset")] - asset_protocol: FsScope::for_fs_api(&app, &app.config().tauri.security.asset_protocol.scope)?, + asset_protocol: scope::fs::Scope::for_fs_api( + &app, + &app.config().tauri.security.asset_protocol.scope, + )?, }); app.manage(ChannelDataIpcQueue::default()); @@ -1550,9 +1615,10 @@ impl Builder { { let config = app.config(); if let Some(tray_config) = &config.tauri.tray_icon { - let mut tray = TrayIconBuilder::new() - .icon_as_template(tray_config.icon_as_template) - .menu_on_left_click(tray_config.menu_on_left_click); + let mut tray = + TrayIconBuilder::with_id(tray_config.id.clone().unwrap_or_else(|| "main".into())) + .icon_as_template(tray_config.icon_as_template) + .menu_on_left_click(tray_config.menu_on_left_click); if let Some(icon) = &app.manager.inner.tray_icon { tray = tray.icon(icon.clone()); } @@ -1579,6 +1645,17 @@ impl Builder { } } +pub(crate) type UriSchemeResponderFn = Box>) + Send>; +pub struct UriSchemeResponder(pub(crate) UriSchemeResponderFn); + +impl UriSchemeResponder { + /// Resolves the request with the given response. + pub fn respond>>(self, response: http::Response) { + let (parts, body) = response.into_parts(); + (self.0)(http::Response::from_parts(parts, body.into())) + } +} + #[cfg(target_os = "macos")] fn init_app_menu(menu: &Menu) -> crate::Result<()> { menu.inner().init_for_nsapp(); diff --git a/core/tauri/src/error.rs b/core/tauri/src/error.rs index 8de7cec0d01b..97b41f03b0ed 100644 --- a/core/tauri/src/error.rs +++ b/core/tauri/src/error.rs @@ -43,9 +43,6 @@ pub enum Error { /// Failed to serialize/deserialize. #[error("JSON error: {0}")] Json(#[from] serde_json::Error), - /// Failed to execute tauri API. - #[error("failed to execute API: {0}")] - FailedToExecuteApi(#[from] crate::api::Error), /// IO error. #[error("{0}")] Io(#[from] std::io::Error), diff --git a/core/tauri/src/ipc/channel.rs b/core/tauri/src/ipc/channel.rs index e09a8d922b53..76a9101cebaf 100644 --- a/core/tauri/src/ipc/channel.rs +++ b/core/tauri/src/ipc/channel.rs @@ -78,7 +78,7 @@ impl Channel { .unwrap() .insert(data_id, body); window.eval(&format!( - "__TAURI_INVOKE__('{FETCH_CHANNEL_DATA_COMMAND}', null, {{ headers: {{ '{CHANNEL_ID_HEADER_NAME}': {data_id} }} }}).then(window['_' + {}]).catch(console.error)", + "__TAURI_INVOKE__('{FETCH_CHANNEL_DATA_COMMAND}', null, {{ headers: {{ '{CHANNEL_ID_HEADER_NAME}': '{data_id}' }} }}).then(window['_' + {}]).catch(console.error)", callback.0 )) }) diff --git a/core/tauri/src/ipc/format_callback.rs b/core/tauri/src/ipc/format_callback.rs index 31d7cbc599d1..ea118c74ba6b 100644 --- a/core/tauri/src/ipc/format_callback.rs +++ b/core/tauri/src/ipc/format_callback.rs @@ -44,7 +44,7 @@ fn serialize_js_with String>( value: &T, options: serialize_to_javascript::Options, cb: F, -) -> crate::api::Result { +) -> crate::Result { // get a raw &str representation of a serialized json value. let string = serde_json::to_string(value)?; let raw = RawValue::from_string(string)?; @@ -83,7 +83,7 @@ fn serialize_js_with String>( /// but will serialize arrays and objects whose serialized JSON string is smaller than 1 GB and larger /// than 10 KiB with `JSON.parse('...')`. /// See [json-parse-benchmark](https://github.com/GoogleChromeLabs/json-parse-benchmark). -pub fn format(function_name: CallbackFn, arg: &T) -> crate::api::Result { +pub fn format(function_name: CallbackFn, arg: &T) -> crate::Result { serialize_js_with(arg, Default::default(), |arg| { format!( r#" @@ -111,7 +111,7 @@ pub fn format_result( result: Result, success_callback: CallbackFn, error_callback: CallbackFn, -) -> crate::api::Result { +) -> crate::Result { match result { Ok(res) => format(success_callback, &res), Err(err) => format(error_callback, &err), @@ -130,7 +130,7 @@ mod test { } } - fn serialize_js(value: &T) -> crate::api::Result { + fn serialize_js(value: &T) -> crate::Result { serialize_js_with(value, Default::default(), |v| v.into()) } diff --git a/core/tauri/src/ipc/mod.rs b/core/tauri/src/ipc/mod.rs index c55db11c2f0a..02bf1f6a83c6 100644 --- a/core/tauri/src/ipc/mod.rs +++ b/core/tauri/src/ipc/mod.rs @@ -6,7 +6,7 @@ //! //! This module includes utilities to send messages to the JS layer of the webview. -use std::sync::Arc; +use std::sync::{Arc, Mutex}; use futures_util::Future; use http::HeaderMap; @@ -21,7 +21,7 @@ use crate::{ }; pub(crate) mod channel; -#[cfg(not(ipc_custom_protocol))] +#[cfg(any(target_os = "macos", target_os = "ios", not(ipc_custom_protocol)))] pub(crate) mod format_callback; pub(crate) mod protocol; @@ -32,9 +32,10 @@ pub type InvokeHandler = dyn Fn(Invoke) -> bool + Send + Sync + 'static; /// A closure that is responsible for respond a JS message. pub type InvokeResponder = - dyn Fn(Window, String, &InvokeResponse, CallbackFn, CallbackFn) + Send + Sync + 'static; -type OwnedInvokeResponder = - dyn Fn(Window, String, InvokeResponse, CallbackFn, CallbackFn) + Send + Sync + 'static; + dyn Fn(&Window, &str, &InvokeResponse, CallbackFn, CallbackFn) + Send + Sync + 'static; +/// Similar to [`InvokeResponder`] but taking owned arguments. +pub type OwnedInvokeResponder = + dyn FnOnce(Window, String, InvokeResponse, CallbackFn, CallbackFn) + Send + 'static; /// Possible values of an IPC payload. #[derive(Debug, Clone)] @@ -226,7 +227,7 @@ impl From for InvokeResponse { #[default_runtime(crate::Wry, wry)] pub struct InvokeResolver { window: Window, - responder: Arc>, + responder: Arc>>>>, cmd: String, pub(crate) callback: CallbackFn, pub(crate) error: CallbackFn, @@ -247,7 +248,7 @@ impl Clone for InvokeResolver { impl InvokeResolver { pub(crate) fn new( window: Window, - responder: Arc>, + responder: Arc>>>>, cmd: String, callback: CallbackFn, error: CallbackFn, @@ -349,7 +350,7 @@ impl InvokeResolver { /// If the Result `is_err()`, the callback will be the `error_callback` function name and the argument will be the Err value. pub async fn return_task( window: Window, - responder: Arc>, + responder: Arc>>>>, task: F, cmd: String, success_callback: CallbackFn, @@ -371,7 +372,7 @@ impl InvokeResolver { pub(crate) fn return_closure Result>( window: Window, - responder: Arc>, + responder: Arc>>>>, f: F, cmd: String, success_callback: CallbackFn, @@ -389,13 +390,19 @@ impl InvokeResolver { pub(crate) fn return_result( window: Window, - responder: Arc>, + responder: Arc>>>>, response: InvokeResponse, cmd: String, success_callback: CallbackFn, error_callback: CallbackFn, ) { - (responder)(window, cmd, response, success_callback, error_callback); + (responder.lock().unwrap().take().expect("resolver consumed"))( + window, + cmd, + response, + success_callback, + error_callback, + ); } } diff --git a/core/tauri/src/ipc/protocol.rs b/core/tauri/src/ipc/protocol.rs index 60883c5c88e2..9e25c1dd1de3 100644 --- a/core/tauri/src/ipc/protocol.rs +++ b/core/tauri/src/ipc/protocol.rs @@ -2,14 +2,15 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT +use std::borrow::Cow; + use http::{ - header::{ACCESS_CONTROL_ALLOW_HEADERS, ACCESS_CONTROL_ALLOW_ORIGIN}, + header::{ACCESS_CONTROL_ALLOW_HEADERS, ACCESS_CONTROL_ALLOW_ORIGIN, CONTENT_TYPE}, HeaderValue, Method, StatusCode, }; use crate::{ manager::WindowManager, - runtime::http::{Request as HttpRequest, Response as HttpResponse}, window::{InvokeRequest, UriSchemeProtocolHandler}, Runtime, }; @@ -19,7 +20,7 @@ use super::{CallbackFn, InvokeBody, InvokeResponse}; const TAURI_CALLBACK_HEADER_NAME: &str = "Tauri-Callback"; const TAURI_ERROR_HEADER_NAME: &str = "Tauri-Error"; -#[cfg(not(ipc_custom_protocol))] +#[cfg(any(target_os = "macos", target_os = "ios", not(ipc_custom_protocol)))] pub fn message_handler( manager: WindowManager, ) -> crate::runtime::webview::WebviewIpcHandler { @@ -27,67 +28,105 @@ pub fn message_handler( } pub fn get(manager: WindowManager, label: String) -> UriSchemeProtocolHandler { - Box::new(move |request| { - let mut response = match *request.method() { + Box::new(move |request, responder| { + let manager = manager.clone(); + let label = label.clone(); + + let respond = move |mut response: http::Response>| { + response + .headers_mut() + .insert(ACCESS_CONTROL_ALLOW_ORIGIN, HeaderValue::from_static("*")); + responder.respond(response); + }; + + match *request.method() { Method::POST => { - let (mut response, content_type) = match handle_ipc_request(request, &manager, &label) { - Ok(data) => match data { - InvokeResponse::Ok(InvokeBody::Json(v)) => ( - HttpResponse::new(serde_json::to_vec(&v)?.into()), - mime::APPLICATION_JSON, - ), - InvokeResponse::Ok(InvokeBody::Raw(v)) => { - (HttpResponse::new(v.into()), mime::APPLICATION_OCTET_STREAM) + if let Some(window) = manager.get_window(&label) { + match parse_invoke_request(&manager, request) { + Ok(request) => { + window.on_message( + request, + Box::new(move |_window, _cmd, response, _callback, _error| { + let (mut response, mime_type) = match response { + InvokeResponse::Ok(InvokeBody::Json(v)) => ( + http::Response::new(serde_json::to_vec(&v).unwrap().into()), + mime::APPLICATION_JSON, + ), + InvokeResponse::Ok(InvokeBody::Raw(v)) => ( + http::Response::new(v.into()), + mime::APPLICATION_OCTET_STREAM, + ), + InvokeResponse::Err(e) => { + let mut response = + http::Response::new(serde_json::to_vec(&e.0).unwrap().into()); + *response.status_mut() = StatusCode::BAD_REQUEST; + (response, mime::TEXT_PLAIN) + } + }; + + response.headers_mut().insert( + CONTENT_TYPE, + HeaderValue::from_str(mime_type.essence_str()).unwrap(), + ); + + respond(response); + }), + ); } - InvokeResponse::Err(e) => { - let mut response = HttpResponse::new(serde_json::to_vec(&e.0)?.into()); - response.set_status(StatusCode::BAD_REQUEST); - (response, mime::TEXT_PLAIN) + Err(e) => { + respond( + http::Response::builder() + .status(StatusCode::BAD_REQUEST) + .header(CONTENT_TYPE, mime::TEXT_PLAIN.essence_str()) + .body(e.as_bytes().to_vec().into()) + .unwrap(), + ); } - }, - Err(e) => { - let mut response = HttpResponse::new(e.as_bytes().to_vec().into()); - response.set_status(StatusCode::BAD_REQUEST); - (response, mime::TEXT_PLAIN) } - }; - - response.set_mimetype(Some(content_type.essence_str().into())); - - response + } else { + respond( + http::Response::builder() + .status(StatusCode::BAD_REQUEST) + .header(CONTENT_TYPE, mime::TEXT_PLAIN.essence_str()) + .body( + "failed to acquire window reference" + .as_bytes() + .to_vec() + .into(), + ) + .unwrap(), + ); + } } Method::OPTIONS => { - let mut r = HttpResponse::new(Vec::new().into()); + let mut r = http::Response::new(Vec::new().into()); r.headers_mut().insert( ACCESS_CONTROL_ALLOW_HEADERS, HeaderValue::from_static("Content-Type, Tauri-Callback, Tauri-Error, Tauri-Channel-Id"), ); - r + respond(r); } _ => { - let mut r = HttpResponse::new( + let mut r = http::Response::new( "only POST and OPTIONS are allowed" .as_bytes() .to_vec() .into(), ); - r.set_status(StatusCode::METHOD_NOT_ALLOWED); - r.set_mimetype(Some(mime::TEXT_PLAIN.essence_str().into())); - r + *r.status_mut() = StatusCode::METHOD_NOT_ALLOWED; + r.headers_mut().insert( + CONTENT_TYPE, + HeaderValue::from_str(mime::TEXT_PLAIN.essence_str()).unwrap(), + ); + respond(r); } - }; - - response - .headers_mut() - .insert(ACCESS_CONTROL_ALLOW_ORIGIN, HeaderValue::from_static("*")); - - Ok(response) + } }) } -#[cfg(not(ipc_custom_protocol))] +#[cfg(any(target_os = "macos", target_os = "ios", not(ipc_custom_protocol)))] fn handle_ipc_message(message: String, manager: &WindowManager, label: &str) { if let Some(window) = manager.get_window(label) { use serde::{Deserialize, Deserializer}; @@ -127,7 +166,6 @@ fn handle_ipc_message(message: String, manager: &WindowManager, l cmd: String, callback: CallbackFn, error: CallbackFn, - #[serde(flatten)] payload: serde_json::Value, options: Option, } @@ -142,7 +180,6 @@ fn handle_ipc_message(message: String, manager: &WindowManager, l cmd: String, callback: CallbackFn, error: CallbackFn, - #[serde(flatten)] payload: crate::utils::pattern::isolation::RawIsolationPayload<'a>, options: Option, } @@ -168,13 +205,75 @@ fn handle_ipc_message(message: String, manager: &WindowManager, l .unwrap_or_else(|| serde_json::from_str::(&message).map_err(Into::into)) { Ok(message) => { - let _ = window.on_message(InvokeRequest { - cmd: message.cmd, - callback: message.callback, - error: message.error, - body: message.payload.into(), - headers: message.options.map(|o| o.headers.0).unwrap_or_default(), - }); + window.on_message( + InvokeRequest { + cmd: message.cmd, + callback: message.callback, + error: message.error, + body: message.payload.into(), + headers: message.options.map(|o| o.headers.0).unwrap_or_default(), + }, + Box::new(move |window, cmd, response, callback, error| { + use crate::ipc::{ + format_callback::{ + format as format_callback, format_result as format_callback_result, + }, + Channel, + }; + use serde_json::Value as JsonValue; + + // the channel data command is the only command that uses a custom protocol on Linux + if window.manager.invoke_responder().is_none() + && cmd != crate::ipc::channel::FETCH_CHANNEL_DATA_COMMAND + { + fn responder_eval( + window: &crate::Window, + js: crate::Result, + error: CallbackFn, + ) { + let eval_js = match js { + Ok(js) => js, + Err(e) => format_callback(error, &e.to_string()) + .expect("unable to serialize response error string to json"), + }; + + let _ = window.eval(&eval_js); + } + + match &response { + InvokeResponse::Ok(InvokeBody::Json(v)) => { + if !(cfg!(target_os = "macos") || cfg!(target_os = "ios")) + && matches!(v, JsonValue::Object(_) | JsonValue::Array(_)) + { + let _ = Channel::from_ipc(window, callback).send(v); + } else { + responder_eval( + &window, + format_callback_result(Result::<_, ()>::Ok(v), callback, error), + error, + ) + } + } + InvokeResponse::Ok(InvokeBody::Raw(v)) => { + if cfg!(target_os = "macos") || cfg!(target_os = "ios") { + responder_eval( + &window, + format_callback_result(Result::<_, ()>::Ok(v), callback, error), + error, + ); + } else { + let _ = Channel::from_ipc(window, callback).send(InvokeBody::Raw(v.clone())); + } + } + InvokeResponse::Err(e) => responder_eval( + &window, + format_callback_result(Result::<(), _>::Err(&e.0), callback, error), + error, + ), + } + } + }), + ); } Err(e) => { let _ = window.eval(&format!( @@ -186,90 +285,76 @@ fn handle_ipc_message(message: String, manager: &WindowManager, l } } -fn handle_ipc_request( - request: &HttpRequest, - manager: &WindowManager, - label: &str, -) -> std::result::Result { - if let Some(window) = manager.get_window(label) { - // TODO: consume instead - #[allow(unused_mut)] - let mut body = request.body().clone(); - - let cmd = request - .uri() - .strip_prefix("ipc://localhost/") - .map(|c| c.to_string()) - // the `strip_prefix` only returns None when a request is made to `https://tauri.$P` on Windows - // where `$P` is not `localhost/*` - // in this case the IPC call is considered invalid - .unwrap_or_else(|| "".to_string()); - let cmd = percent_encoding::percent_decode(cmd.as_bytes()) - .decode_utf8_lossy() - .to_string(); - - // the body is not set if ipc_custom_protocol is not enabled so we'll just ignore it - #[cfg(all(feature = "isolation", ipc_custom_protocol))] - if let crate::Pattern::Isolation { crypto_keys, .. } = manager.pattern() { - body = crate::utils::pattern::isolation::RawIsolationPayload::try_from(&body) - .and_then(|raw| crypto_keys.decrypt(raw)) - .map_err(|e| e.to_string())?; - } +fn parse_invoke_request( + #[allow(unused_variables)] manager: &WindowManager, + request: http::Request>, +) -> std::result::Result { + #[allow(unused_mut)] + let (parts, mut body) = request.into_parts(); - let callback = CallbackFn( - request - .headers() - .get(TAURI_CALLBACK_HEADER_NAME) - .ok_or("missing Tauri-Callback header")? - .to_str() - .map_err(|_| "Tauri callback header value must be a string")? - .parse() - .map_err(|_| "Tauri callback header value must be a numeric string")?, - ); - let error = CallbackFn( - request - .headers() - .get(TAURI_ERROR_HEADER_NAME) - .ok_or("missing Tauri-Error header")? - .to_str() - .map_err(|_| "Tauri error header value must be a string")? - .parse() - .map_err(|_| "Tauri error header value must be a numeric string")?, - ); - - let content_type = request - .headers() - .get(reqwest::header::CONTENT_TYPE) - .and_then(|h| h.to_str().ok()) - .map(|mime| mime.parse()) - .unwrap_or(Ok(mime::APPLICATION_OCTET_STREAM)) - .map_err(|_| "unknown content type")?; - let body = if content_type == mime::APPLICATION_OCTET_STREAM { - body.into() - } else if content_type == mime::APPLICATION_JSON { - if cfg!(ipc_custom_protocol) { - serde_json::from_slice::(&body) - .map_err(|e| e.to_string())? - .into() - } else { - // the body is not set if ipc_custom_protocol is not enabled so we'll just ignore it - serde_json::Value::Object(Default::default()).into() - } - } else { - return Err(format!("content type {content_type} is not implemented")); - }; + // skip leading `/` + let cmd = percent_encoding::percent_decode(parts.uri.path()[1..].as_bytes()) + .decode_utf8_lossy() + .to_string(); - let payload = InvokeRequest { - cmd, - callback, - error, - body, - headers: request.headers().clone(), - }; + // the body is not set if ipc_custom_protocol is not enabled so we'll just ignore it + #[cfg(all(feature = "isolation", ipc_custom_protocol))] + if let crate::Pattern::Isolation { crypto_keys, .. } = manager.pattern() { + body = crate::utils::pattern::isolation::RawIsolationPayload::try_from(&body) + .and_then(|raw| crypto_keys.decrypt(raw)) + .map_err(|e| e.to_string())?; + } - let rx = window.on_message(payload); - Ok(rx.recv().unwrap()) + let callback = CallbackFn( + parts + .headers + .get(TAURI_CALLBACK_HEADER_NAME) + .ok_or("missing Tauri-Callback header")? + .to_str() + .map_err(|_| "Tauri callback header value must be a string")? + .parse() + .map_err(|_| "Tauri callback header value must be a numeric string")?, + ); + let error = CallbackFn( + parts + .headers + .get(TAURI_ERROR_HEADER_NAME) + .ok_or("missing Tauri-Error header")? + .to_str() + .map_err(|_| "Tauri error header value must be a string")? + .parse() + .map_err(|_| "Tauri error header value must be a numeric string")?, + ); + + let content_type = parts + .headers + .get(reqwest::header::CONTENT_TYPE) + .and_then(|h| h.to_str().ok()) + .map(|mime| mime.parse()) + .unwrap_or(Ok(mime::APPLICATION_OCTET_STREAM)) + .map_err(|_| "unknown content type")?; + let body = if content_type == mime::APPLICATION_OCTET_STREAM { + body.into() + } else if content_type == mime::APPLICATION_JSON { + if cfg!(ipc_custom_protocol) { + serde_json::from_slice::(&body) + .map_err(|e| e.to_string())? + .into() + } else { + // the body is not set if ipc_custom_protocol is not enabled so we'll just ignore it + serde_json::Value::Object(Default::default()).into() + } } else { - Err("window not found".into()) - } + return Err(format!("content type {content_type} is not implemented")); + }; + + let payload = InvokeRequest { + cmd, + callback, + error, + body, + headers: parts.headers, + }; + + Ok(payload) } diff --git a/core/tauri/src/lib.rs b/core/tauri/src/lib.rs index a66aca8bd832..e7902fcd61b6 100644 --- a/core/tauri/src/lib.rs +++ b/core/tauri/src/lib.rs @@ -74,10 +74,7 @@ pub use swift_rs; pub use tauri_macros::mobile_entry_point; pub use tauri_macros::{command, generate_handler}; -pub mod api; pub(crate) mod app; -#[cfg(feature = "protocol-asset")] -pub(crate) mod asset_protocol; pub mod async_runtime; pub mod command; mod error; @@ -86,6 +83,7 @@ pub mod ipc; mod manager; mod pattern; pub mod plugin; +pub(crate) mod protocol; mod vibrancy; pub mod window; use tauri_runtime as runtime; @@ -107,6 +105,8 @@ mod state; pub mod tray; pub use tauri_utils as utils; +pub use http; + /// A Tauri [`Runtime`] wrapper around wry. #[cfg(feature = "wry")] #[cfg_attr(doc_cfg, doc(cfg(feature = "wry")))] @@ -174,9 +174,6 @@ use std::{ sync::Arc, }; -// Export types likely to be used by the application. -pub use runtime::http; - #[cfg(feature = "wry")] #[cfg_attr(doc_cfg, doc(cfg(feature = "wry")))] pub use tauri_runtime_wry::webview_version; @@ -242,7 +239,7 @@ pub fn log_stdout() { if let Ok(len) = reader.read_line(&mut buffer) { if len == 0 { break; - } else if let Ok(msg) = CString::new(buffer.clone()) + } else if let Ok(msg) = CString::new(buffer.as_bytes()) .map_err(|_| ()) .and_then(|c| c.into_string().map_err(|_| ())) { @@ -824,13 +821,13 @@ pub trait Manager: sealed::ManagerBase { } /// Gets the scope for the IPC. - fn ipc_scope(&self) -> IpcScope { + fn ipc_scope(&self) -> scope::ipc::Scope { self.state::().inner().ipc.clone() } /// Gets the scope for the asset protocol. #[cfg(feature = "protocol-asset")] - fn asset_protocol_scope(&self) -> FsScope { + fn asset_protocol_scope(&self) -> scope::fs::Scope { self.state::().inner().asset_protocol.clone() } @@ -919,7 +916,8 @@ macro_rules! run_main_thread { let (tx, rx) = channel(); let self_ = $self.clone(); let task = move || { - let _ = tx.send($ex(self_)); + let f = $ex; + let _ = tx.send(f(self_)); }; $self.app_handle.run_on_main_thread(Box::new(task))?; rx.recv().map_err(|_| crate::Error::FailedToReceiveMessage) diff --git a/core/tauri/src/manager.rs b/core/tauri/src/manager.rs index be5b3f39bbbc..93b918c673a4 100644 --- a/core/tauri/src/manager.rs +++ b/core/tauri/src/manager.rs @@ -28,16 +28,15 @@ use tauri_utils::{ }; use crate::{ - app::{AppHandle, GlobalWindowEvent, GlobalWindowEventListener, OnPageLoad, PageLoadPayload}, + app::{ + AppHandle, GlobalWindowEvent, GlobalWindowEventListener, OnPageLoad, PageLoadPayload, + UriSchemeResponder, + }, event::{assert_event_name_is_valid, Event, EventHandler, Listeners}, ipc::{Invoke, InvokeHandler, InvokeResponder}, pattern::PatternJavascript, plugin::PluginStore, runtime::{ - http::{ - MimeType, Request as HttpRequest, Response as HttpResponse, - ResponseBuilder as HttpResponseBuilder, - }, webview::WindowBuilder, window::{ dpi::{PhysicalPosition, PhysicalSize}, @@ -49,7 +48,6 @@ use crate::{ config::{AppUrl, Config, WindowUrl}, PackageInfo, }, - window::{UriSchemeProtocolHandler, WebResourceRequestHandler}, Context, EventLoopMessage, Icon, Manager, Pattern, Runtime, Scopes, StateManager, Window, WindowEvent, }; @@ -81,7 +79,7 @@ pub(crate) const PROCESS_IPC_MESSAGE_FN: &str = // and we do not get a secure context without the custom protocol that proxies to the dev server // additionally, we need the custom protocol to inject the initialization scripts on Android // must also keep in sync with the `let mut response` assignment in prepare_uri_scheme_protocol -const PROXY_DEV_SERVER: bool = cfg!(all(dev, mobile)); +pub(crate) const PROXY_DEV_SERVER: bool = cfg!(all(dev, mobile)); #[cfg(feature = "isolation")] #[derive(Template)] @@ -205,7 +203,7 @@ fn replace_csp_nonce( .into_iter() .map(|n| format!("'nonce-{n}'")) .collect::>(); - let sources = csp.entry(directive.into()).or_insert_with(Default::default); + let sources = csp.entry(directive.into()).or_default(); let self_source = "'self'".to_string(); if !sources.contains(&self_source) { sources.push(self_source); @@ -237,7 +235,7 @@ pub struct InnerWindowManager { package_info: PackageInfo, /// The webview protocols available to all windows. - uri_scheme_protocols: HashMap>>, + uri_scheme_protocols: HashMap>>, /// A set containing a reference to the active menus, including /// the app-wide menu and the window-specific menus /// @@ -306,14 +304,11 @@ pub struct Asset { } /// Uses a custom URI scheme handler to resolve file requests -pub struct CustomProtocol { +pub struct UriSchemeProtocol { /// Handler for protocol #[allow(clippy::type_complexity)] - pub protocol: Box< - dyn Fn(&AppHandle, &HttpRequest) -> Result> - + Send - + Sync, - >, + pub protocol: + Box, http::Request>, UriSchemeResponder) + Send + Sync>, } #[default_runtime(crate::Wry, wry)] @@ -337,7 +332,7 @@ impl WindowManager { plugins: PluginStore, invoke_handler: Box>, on_page_load: Box>, - uri_scheme_protocols: HashMap>>, + uri_scheme_protocols: HashMap>>, state: StateManager, window_event_listeners: Vec>, #[cfg(desktop)] window_menu_event_listeners: HashMap< @@ -511,10 +506,11 @@ impl WindowManager { } pub(crate) fn protocol_url(&self) -> Cow<'_, Url> { - #[cfg(any(windows, target_os = "android"))] - return Cow::Owned(Url::parse("https://tauri.localhost").unwrap()); - #[cfg(not(any(windows, target_os = "android")))] - Cow::Owned(Url::parse("tauri://localhost").unwrap()) + if cfg!(windows) || cfg!(target_os = "android") { + Cow::Owned(Url::parse("http://tauri.localhost").unwrap()) + } else { + Cow::Owned(Url::parse("tauri://localhost").unwrap()) + } } fn csp(&self) -> Option { @@ -604,16 +600,23 @@ impl WindowManager { registered_scheme_protocols.push(uri_scheme.clone()); let protocol = protocol.clone(); let app_handle = Mutex::new(app_handle.clone()); - pending.register_uri_scheme_protocol(uri_scheme.clone(), move |p| { - (protocol.protocol)(&app_handle.lock().unwrap(), p) + pending.register_uri_scheme_protocol(uri_scheme.clone(), move |p, responder| { + (protocol.protocol)( + &app_handle.lock().unwrap(), + p, + UriSchemeResponder(responder), + ) }); } let window_url = Url::parse(&pending.url).unwrap(); let window_origin = if window_url.scheme() == "data" { "null".into() - } else if cfg!(windows) && window_url.scheme() != "http" && window_url.scheme() != "https" { - format!("https://{}.localhost", window_url.scheme()) + } else if (cfg!(windows) || cfg!(target_os = "android")) + && window_url.scheme() != "http" + && window_url.scheme() != "https" + { + format!("http://{}.localhost", window_url.scheme()) } else { format!( "{}://{}{}", @@ -628,30 +631,28 @@ impl WindowManager { if !registered_scheme_protocols.contains(&"tauri".into()) { let web_resource_request_handler = pending.web_resource_request_handler.take(); - pending.register_uri_scheme_protocol( - "tauri", - self.prepare_uri_scheme_protocol(&window_origin, web_resource_request_handler), - ); + let protocol = + crate::protocol::tauri::get(self, &window_origin, web_resource_request_handler); + pending.register_uri_scheme_protocol("tauri", move |request, responder| { + protocol(request, UriSchemeResponder(responder)) + }); registered_scheme_protocols.push("tauri".into()); } if !registered_scheme_protocols.contains(&"ipc".into()) { - pending.register_uri_scheme_protocol( - "ipc", - crate::ipc::protocol::get(self.clone(), pending.label.clone()), - ); + let protocol = crate::ipc::protocol::get(self.clone(), pending.label.clone()); + pending.register_uri_scheme_protocol("ipc", move |request, responder| { + protocol(request, UriSchemeResponder(responder)) + }); registered_scheme_protocols.push("ipc".into()); } #[cfg(feature = "protocol-asset")] if !registered_scheme_protocols.contains(&"asset".into()) { let asset_scope = self.state().get::().asset_protocol.clone(); - pending.register_uri_scheme_protocol("asset", move |request| { - crate::asset_protocol::asset_protocol_handler( - request, - asset_scope.clone(), - window_origin.clone(), - ) + let protocol = crate::protocol::asset::get(asset_scope.clone(), window_origin.clone()); + pending.register_uri_scheme_protocol("asset", move |request, responder| { + protocol(request, UriSchemeResponder(responder)) }); } @@ -663,41 +664,9 @@ impl WindowManager { crypto_keys, } = &self.inner.pattern { - let assets = assets.clone(); - let schema_ = schema.clone(); - let url_base = format!("{schema_}://localhost"); - let aes_gcm_key = *crypto_keys.aes_gcm().raw(); - - pending.register_uri_scheme_protocol(schema, move |request| { - match request_to_path(request, &url_base).as_str() { - "index.html" => match assets.get(&"index.html".into()) { - Some(asset) => { - let asset = String::from_utf8_lossy(asset.as_ref()); - let template = tauri_utils::pattern::isolation::IsolationJavascriptRuntime { - runtime_aes_gcm_key: &aes_gcm_key, - process_ipc_message_fn: PROCESS_IPC_MESSAGE_FN, - }; - match template.render(asset.as_ref(), &Default::default()) { - Ok(asset) => HttpResponseBuilder::new() - .mimetype(mime::TEXT_HTML.as_ref()) - .body(asset.into_string().as_bytes().to_vec()), - Err(_) => HttpResponseBuilder::new() - .status(500) - .mimetype(mime::TEXT_PLAIN.as_ref()) - .body(Vec::new()), - } - } - - None => HttpResponseBuilder::new() - .status(404) - .mimetype(mime::TEXT_PLAIN.as_ref()) - .body(Vec::new()), - }, - _ => HttpResponseBuilder::new() - .status(404) - .mimetype(mime::TEXT_PLAIN.as_ref()) - .body(Vec::new()), - } + let protocol = crate::protocol::isolation::get(assets.clone(), *crypto_keys.aes_gcm().raw()); + pending.register_uri_scheme_protocol(schema, move |request, responder| { + protocol(request, UriSchemeResponder(responder)) }); } @@ -773,7 +742,7 @@ impl WindowManager { } else { asset }; - let mime_type = MimeType::parse(&final_data, &path); + let mime_type = tauri_utils::mime_type::MimeType::parse(&final_data, &path); Ok(Asset { bytes: final_data.to_vec(), mime_type, @@ -787,131 +756,6 @@ impl WindowManager { } } - fn prepare_uri_scheme_protocol( - &self, - window_origin: &str, - web_resource_request_handler: Option>, - ) -> UriSchemeProtocolHandler { - #[cfg(all(dev, mobile))] - let url = { - let mut url = self.get_url().as_str().to_string(); - if url.ends_with('/') { - url.pop(); - } - url - }; - #[cfg(not(all(dev, mobile)))] - let manager = self.clone(); - let window_origin = window_origin.to_string(); - - #[cfg(all(dev, mobile))] - #[derive(Clone)] - struct CachedResponse { - status: http::StatusCode, - headers: http::HeaderMap, - body: bytes::Bytes, - } - - #[cfg(all(dev, mobile))] - let response_cache = Arc::new(Mutex::new(HashMap::new())); - - Box::new(move |request| { - // use the entire URI as we are going to proxy the request - let path = if PROXY_DEV_SERVER { - request.uri() - } else { - // ignore query string and fragment - request.uri().split(&['?', '#'][..]).next().unwrap() - }; - - let path = path - .strip_prefix("tauri://localhost") - .map(|p| p.to_string()) - // the `strip_prefix` only returns None when a request is made to `https://tauri.$P` on Windows - // where `$P` is not `localhost/*` - .unwrap_or_else(|| "".to_string()); - - let mut builder = - HttpResponseBuilder::new().header("Access-Control-Allow-Origin", &window_origin); - - #[cfg(all(dev, mobile))] - let mut response = { - let decoded_path = percent_encoding::percent_decode(path.as_bytes()) - .decode_utf8_lossy() - .to_string(); - let url = format!("{url}{decoded_path}"); - #[allow(unused_mut)] - let mut client_builder = reqwest::ClientBuilder::new(); - #[cfg(any(feature = "native-tls", feature = "rustls-tls"))] - { - client_builder = client_builder.danger_accept_invalid_certs(true); - } - let mut proxy_builder = client_builder - .build() - .unwrap() - .request(request.method().clone(), &url); - for (name, value) in request.headers() { - proxy_builder = proxy_builder.header(name, value); - } - match crate::async_runtime::block_on(proxy_builder.send()) { - Ok(r) => { - let mut response_cache_ = response_cache.lock().unwrap(); - let mut response = None; - if r.status() == http::StatusCode::NOT_MODIFIED { - response = response_cache_.get(&url); - } - let response = if let Some(r) = response { - r - } else { - let status = r.status(); - let headers = r.headers().clone(); - let body = crate::async_runtime::block_on(r.bytes())?; - let response = CachedResponse { - status, - headers, - body, - }; - response_cache_.insert(url.clone(), response); - response_cache_.get(&url).unwrap() - }; - for (name, value) in &response.headers { - builder = builder.header(name, value); - } - builder - .status(response.status) - .body(response.body.to_vec())? - } - Err(e) => { - debug_eprintln!("Failed to request {}: {}", url.as_str(), e); - return Err(Box::new(e)); - } - } - }; - - #[cfg(not(all(dev, mobile)))] - let mut response = { - let asset = manager.get_asset(path)?; - builder = builder.mimetype(&asset.mime_type); - if let Some(csp) = &asset.csp_header { - builder = builder.header("Content-Security-Policy", csp); - } - builder.body(asset.bytes)? - }; - if let Some(handler) = &web_resource_request_handler { - handler(request, &mut response); - } - // if it's an HTML file, we need to set the CSP meta tag on Linux - #[cfg(all(not(dev), target_os = "linux"))] - if let Some(response_csp) = response.headers().get("Content-Security-Policy") { - let response_csp = String::from_utf8_lossy(response_csp.as_bytes()); - let html = String::from_utf8_lossy(response.body()); - let body = html.replacen(tauri_utils::html::CSP_TOKEN, &response_csp, 1); - *response.body_mut() = body.as_bytes().to_vec().into(); - } - Ok(response) - }) - } - fn initialization_script( &self, ipc_script: &str, @@ -1035,8 +879,8 @@ mod test { { assert_eq!( manager.get_url().to_string(), - if cfg!(windows) { - "https://tauri.localhost/" + if cfg!(windows) || cfg!(target_os = "android") { + "http://tauri.localhost/" } else { "tauri://localhost" } @@ -1188,7 +1032,8 @@ impl WindowManager { #[allow(clippy::redundant_clone)] app_handle.clone(), )?; - #[cfg(not(ipc_custom_protocol))] + + #[cfg(any(target_os = "macos", target_os = "ios", not(ipc_custom_protocol)))] { pending.ipc_handler = Some(crate::ipc::protocol::message_handler(self.clone())); } @@ -1485,34 +1330,6 @@ struct ScaleFactorChanged { size: PhysicalSize, } -#[cfg(feature = "isolation")] -fn request_to_path(request: &tauri_runtime::http::Request, base_url: &str) -> String { - let mut path = request - .uri() - .split(&['?', '#'][..]) - // ignore query string - .next() - .unwrap() - .trim_start_matches(base_url) - .to_string(); - - if path.ends_with('/') { - path.pop(); - } - - let path = percent_encoding::percent_decode(path.as_bytes()) - .decode_utf8_lossy() - .to_string(); - - if path.is_empty() { - // if the url has no path, we should load `index.html` - "index.html".to_string() - } else { - // skip leading `/` - path.chars().skip(1).collect() - } -} - #[cfg(test)] mod tests { use super::replace_with_callback; diff --git a/core/tauri/src/menu/icon.rs b/core/tauri/src/menu/icon.rs index 699a0ea9f49e..bdaab0203865 100644 --- a/core/tauri/src/menu/icon.rs +++ b/core/tauri/src/menu/icon.rs @@ -205,9 +205,9 @@ impl IconMenuItem { /// ## Platform-specific: /// /// - **Windows / Linux**: Unsupported. - pub fn set_native_icon(&mut self, _icon: Option) -> crate::Result<()> { + pub fn set_native_icon(&self, _icon: Option) -> crate::Result<()> { #[cfg(target_os = "macos")] - return run_main_thread!(self, |mut self_: Self| self_ + return run_main_thread!(self, |self_: Self| self_ .inner .set_native_icon(_icon.map(Into::into))); #[allow(unreachable_code)] diff --git a/core/tauri/src/pattern.rs b/core/tauri/src/pattern.rs index 2318e5972eaa..7248fc72d80a 100644 --- a/core/tauri/src/pattern.rs +++ b/core/tauri/src/pattern.rs @@ -110,7 +110,7 @@ pub(crate) struct PatternJavascript { #[allow(dead_code)] pub(crate) fn format_real_schema(schema: &str) -> String { if cfg!(windows) || cfg!(target_os = "android") { - format!("https://{schema}.{ISOLATION_IFRAME_SRC_DOMAIN}") + format!("http://{schema}.{ISOLATION_IFRAME_SRC_DOMAIN}") } else { format!("{schema}://{ISOLATION_IFRAME_SRC_DOMAIN}") } diff --git a/core/tauri/src/process.rs b/core/tauri/src/process.rs index 7eef25939acf..de205a56f3be 100644 --- a/core/tauri/src/process.rs +++ b/core/tauri/src/process.rs @@ -76,7 +76,7 @@ pub fn restart(env: &Env) { if let Ok(path) = current_binary(env) { Command::new(path) - .args(&env.args) + .args(&env.args_os) .spawn() .expect("application failed to start"); } diff --git a/core/tauri/src/asset_protocol.rs b/core/tauri/src/protocol/asset.rs similarity index 80% rename from core/tauri/src/asset_protocol.rs rename to core/tauri/src/protocol/asset.rs index ec961a9a1169..449a8a03e5cf 100644 --- a/core/tauri/src/asset_protocol.rs +++ b/core/tauri/src/protocol/asset.rs @@ -2,47 +2,58 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -use crate::path::SafePathBuf; -use crate::scope::FsScope; +use crate::{path::SafePathBuf, scope, window::UriSchemeProtocolHandler}; +use http::{header::*, status::StatusCode, Request, Response}; +use http_range::HttpRange; use rand::RngCore; -use std::io::SeekFrom; -use tauri_runtime::http::HttpRange; -use tauri_runtime::http::{ - header::*, status::StatusCode, MimeType, Request, Response, ResponseBuilder, -}; +use std::{borrow::Cow, io::SeekFrom}; use tauri_utils::debug_eprintln; +use tauri_utils::mime_type::MimeType; use tokio::fs::File; use tokio::io::{AsyncReadExt, AsyncSeekExt, AsyncWriteExt}; -use url::Position; -use url::Url; - -pub fn asset_protocol_handler( - request: &Request, - scope: FsScope, - window_origin: String, -) -> Result> { - let parsed_path = Url::parse(request.uri())?; - let filtered_path = &parsed_path[..Position::AfterPath]; - let path = filtered_path - .strip_prefix("asset://localhost/") - // the `strip_prefix` only returns None when a request is made to `https://tauri.$P` on Windows - // where `$P` is not `localhost/*` - .unwrap_or(""); - let path = percent_encoding::percent_decode(path.as_bytes()) + +pub fn get(scope: scope::fs::Scope, window_origin: String) -> UriSchemeProtocolHandler { + Box::new( + move |request, responder| match get_response(request, &scope, &window_origin) { + Ok(response) => responder.respond(response), + Err(e) => responder.respond( + http::Response::builder() + .status(http::StatusCode::BAD_REQUEST) + .header(CONTENT_TYPE, mime::TEXT_PLAIN.essence_str()) + .body(e.to_string().as_bytes().to_vec()) + .unwrap(), + ), + }, + ) +} + +fn get_response( + request: Request>, + scope: &scope::fs::Scope, + window_origin: &str, +) -> Result>, Box> { + // skip leading `/` + let path = percent_encoding::percent_decode(request.uri().path()[1..].as_bytes()) .decode_utf8_lossy() .to_string(); if let Err(e) = SafePathBuf::new(path.clone().into()) { debug_eprintln!("asset protocol path \"{}\" is not valid: {}", path, e); - return ResponseBuilder::new().status(403).body(Vec::new()); + return Response::builder() + .status(403) + .body(Vec::new().into()) + .map_err(Into::into); } if !scope.is_allowed(&path) { debug_eprintln!("asset protocol not configured to allow the path: {}", path); - return ResponseBuilder::new().status(403).body(Vec::new()); + return Response::builder() + .status(403) + .body(Vec::new().into()) + .map_err(Into::into); } - let mut resp = ResponseBuilder::new().header("Access-Control-Allow-Origin", &window_origin); + let mut resp = Response::builder().header("Access-Control-Allow-Origin", window_origin); let (mut file, len, mime_type, read_bytes) = crate::async_runtime::safe_block_on(async move { let mut file = File::open(&path).await?; @@ -84,10 +95,11 @@ pub fn asset_protocol_handler( resp = resp.header(ACCEPT_RANGES, "bytes"); let not_satisfiable = || { - ResponseBuilder::new() + Response::builder() .status(StatusCode::RANGE_NOT_SATISFIABLE) .header(CONTENT_RANGE, format!("bytes */{len}")) - .body(vec![]) + .body(vec![].into()) + .map_err(Into::into) }; // parse range header @@ -132,7 +144,7 @@ pub fn asset_protocol_handler( resp = resp.header(CONTENT_RANGE, format!("bytes {start}-{end}/{len}")); resp = resp.header(CONTENT_LENGTH, end + 1 - start); resp = resp.status(StatusCode::PARTIAL_CONTENT); - resp.body(buf) + resp.body(buf.into()) } else { let ranges = ranges .iter() @@ -192,7 +204,7 @@ pub fn asset_protocol_handler( Ok::, anyhow::Error>(buf) })?; - resp.body(buf) + resp.body(buf.into()) } } else { // avoid reading the file if we already read it @@ -207,10 +219,10 @@ pub fn asset_protocol_handler( })? }; resp = resp.header(CONTENT_LENGTH, len); - resp.body(buf) + resp.body(buf.into()) }; - response + response.map_err(Into::into) } fn random_boundary() -> String { diff --git a/core/tauri/src/protocol/isolation.rs b/core/tauri/src/protocol/isolation.rs new file mode 100644 index 000000000000..ba3974031095 --- /dev/null +++ b/core/tauri/src/protocol/isolation.rs @@ -0,0 +1,76 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use http::header::CONTENT_TYPE; +use serialize_to_javascript::Template; +use tauri_utils::assets::{Assets, EmbeddedAssets}; + +use std::sync::Arc; + +use crate::{manager::PROCESS_IPC_MESSAGE_FN, window::UriSchemeProtocolHandler}; + +pub fn get(assets: Arc, aes_gcm_key: [u8; 32]) -> UriSchemeProtocolHandler { + Box::new(move |request, responder| { + let response = match request_to_path(&request).as_str() { + "index.html" => match assets.get(&"index.html".into()) { + Some(asset) => { + let asset = String::from_utf8_lossy(asset.as_ref()); + let template = tauri_utils::pattern::isolation::IsolationJavascriptRuntime { + runtime_aes_gcm_key: &aes_gcm_key, + process_ipc_message_fn: PROCESS_IPC_MESSAGE_FN, + }; + match template.render(asset.as_ref(), &Default::default()) { + Ok(asset) => http::Response::builder() + .header(CONTENT_TYPE, mime::TEXT_HTML.as_ref()) + .body(asset.into_string().as_bytes().to_vec()), + Err(_) => http::Response::builder() + .status(http::StatusCode::INTERNAL_SERVER_ERROR) + .header(CONTENT_TYPE, mime::TEXT_PLAIN.as_ref()) + .body(Vec::new()), + } + } + + None => http::Response::builder() + .status(http::StatusCode::NOT_FOUND) + .header(CONTENT_TYPE, mime::TEXT_PLAIN.as_ref()) + .body(Vec::new()), + }, + _ => http::Response::builder() + .status(http::StatusCode::NOT_FOUND) + .header(CONTENT_TYPE, mime::TEXT_PLAIN.as_ref()) + .body(Vec::new()), + }; + + if let Ok(r) = response { + responder.respond(r); + } else { + responder.respond( + http::Response::builder() + .status(http::StatusCode::BAD_REQUEST) + .body("failed to get response".as_bytes().to_vec()) + .unwrap(), + ); + } + }) +} + +fn request_to_path(request: &http::Request>) -> String { + let path = request + .uri() + .path() + .trim_start_matches('/') + .trim_end_matches('/'); + + let path = percent_encoding::percent_decode(path.as_bytes()) + .decode_utf8_lossy() + .to_string(); + + if path.is_empty() { + // if the url has no path, we should load `index.html` + "index.html".to_string() + } else { + // skip leading `/` + path.chars().skip(1).collect() + } +} diff --git a/core/tauri/src/protocol/mod.rs b/core/tauri/src/protocol/mod.rs new file mode 100644 index 000000000000..3f75e4de4990 --- /dev/null +++ b/core/tauri/src/protocol/mod.rs @@ -0,0 +1,9 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +#[cfg(feature = "protocol-asset")] +pub mod asset; +#[cfg(feature = "isolation")] +pub mod isolation; +pub mod tauri; diff --git a/core/tauri/src/protocol/tauri.rs b/core/tauri/src/protocol/tauri.rs new file mode 100644 index 000000000000..109d8a77debc --- /dev/null +++ b/core/tauri/src/protocol/tauri.rs @@ -0,0 +1,179 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use std::borrow::Cow; + +use http::{header::CONTENT_TYPE, Request, Response as HttpResponse, StatusCode}; + +use crate::{ + manager::{WindowManager, PROXY_DEV_SERVER}, + window::{UriSchemeProtocolHandler, WebResourceRequestHandler}, + Runtime, +}; + +#[cfg(all(dev, mobile))] +use std::{ + collections::HashMap, + sync::{Arc, Mutex}, +}; + +#[cfg(all(dev, mobile))] +#[derive(Clone)] +struct CachedResponse { + status: http::StatusCode, + headers: http::HeaderMap, + body: bytes::Bytes, +} + +pub fn get( + manager: &WindowManager, + window_origin: &str, + web_resource_request_handler: Option>, +) -> UriSchemeProtocolHandler { + #[cfg(all(dev, mobile))] + let url = { + let mut url = manager.get_url().as_str().to_string(); + if url.ends_with('/') { + url.pop(); + } + url + }; + + let manager = manager.clone(); + let window_origin = window_origin.to_string(); + + #[cfg(all(dev, mobile))] + let response_cache = Arc::new(Mutex::new(HashMap::new())); + + Box::new(move |request, responder| { + match get_response( + request, + &manager, + &window_origin, + web_resource_request_handler.as_deref(), + #[cfg(all(dev, mobile))] + (&url, &response_cache), + ) { + Ok(response) => responder.respond(response), + Err(e) => responder.respond( + HttpResponse::builder() + .status(StatusCode::BAD_REQUEST) + .header(CONTENT_TYPE, mime::TEXT_PLAIN.essence_str()) + .body(e.to_string().as_bytes().to_vec()) + .unwrap(), + ), + } + }) +} + +fn get_response( + request: Request>, + manager: &WindowManager, + window_origin: &str, + web_resource_request_handler: Option<&WebResourceRequestHandler>, + #[cfg(all(dev, mobile))] (url, response_cache): ( + &str, + &Arc>>, + ), +) -> Result>, Box> { + // use the entire URI as we are going to proxy the request + let path = if PROXY_DEV_SERVER { + request.uri().to_string() + } else { + // ignore query string and fragment + request + .uri() + .to_string() + .split(&['?', '#'][..]) + .next() + .unwrap() + .into() + }; + + let path = path + .strip_prefix("tauri://localhost") + .map(|p| p.to_string()) + // the `strip_prefix` only returns None when a request is made to `https://tauri.$P` on Windows + // where `$P` is not `localhost/*` + .unwrap_or_else(|| "".to_string()); + + let mut builder = HttpResponse::builder().header("Access-Control-Allow-Origin", window_origin); + + #[cfg(all(dev, mobile))] + let mut response = { + let decoded_path = percent_encoding::percent_decode(path.as_bytes()) + .decode_utf8_lossy() + .to_string(); + let url = format!("{url}{decoded_path}"); + #[allow(unused_mut)] + let mut client_builder = reqwest::ClientBuilder::new(); + #[cfg(any(feature = "native-tls", feature = "rustls-tls"))] + { + client_builder = client_builder.danger_accept_invalid_certs(true); + } + let mut proxy_builder = client_builder + .build() + .unwrap() + .request(request.method().clone(), &url); + for (name, value) in request.headers() { + proxy_builder = proxy_builder.header(name, value); + } + match crate::async_runtime::block_on(proxy_builder.send()) { + Ok(r) => { + let mut response_cache_ = response_cache.lock().unwrap(); + let mut response = None; + if r.status() == http::StatusCode::NOT_MODIFIED { + response = response_cache_.get(&url); + } + let response = if let Some(r) = response { + r + } else { + let status = r.status(); + let headers = r.headers().clone(); + let body = crate::async_runtime::block_on(r.bytes())?; + let response = CachedResponse { + status, + headers, + body, + }; + response_cache_.insert(url.clone(), response); + response_cache_.get(&url).unwrap() + }; + for (name, value) in &response.headers { + builder = builder.header(name, value); + } + builder + .status(response.status) + .body(response.body.to_vec().into())? + } + Err(e) => { + tauri_utils::debug_eprintln!("Failed to request {}: {}", url.as_str(), e); + return Err(Box::new(e)); + } + } + }; + + #[cfg(not(all(dev, mobile)))] + let mut response = { + let asset = manager.get_asset(path)?; + builder = builder.header(CONTENT_TYPE, &asset.mime_type); + if let Some(csp) = &asset.csp_header { + builder = builder.header("Content-Security-Policy", csp); + } + builder.body(asset.bytes.into())? + }; + if let Some(handler) = &web_resource_request_handler { + handler(request, &mut response); + } + // if it's an HTML file, we need to set the CSP meta tag on Linux + #[cfg(all(not(dev), target_os = "linux"))] + if let Some(response_csp) = response.headers().get("Content-Security-Policy") { + let response_csp = String::from_utf8_lossy(response_csp.as_bytes()); + let html = String::from_utf8_lossy(response.body()); + let body = html.replacen(tauri_utils::html::CSP_TOKEN, &response_csp, 1); + *response.body_mut() = body.as_bytes().to_vec().into(); + } + + Ok(response) +} diff --git a/core/tauri/src/scope/fs.rs b/core/tauri/src/scope/fs.rs index 8a1bdc2306de..3d1f57b0e96a 100644 --- a/core/tauri/src/scope/fs.rs +++ b/core/tauri/src/scope/fs.rs @@ -9,10 +9,11 @@ use std::{ sync::{Arc, Mutex}, }; -pub use glob::Pattern; use tauri_utils::config::FsScope; use uuid::Uuid; +pub use glob::Pattern; + /// Scope change event. #[derive(Debug, Clone)] pub enum Event { diff --git a/core/tauri/src/scope/ipc.rs b/core/tauri/src/scope/ipc.rs index b0eea0bbd172..363c257cdb8c 100644 --- a/core/tauri/src/scope/ipc.rs +++ b/core/tauri/src/scope/ipc.rs @@ -231,7 +231,7 @@ mod tests { assert_ipc_response( &window, path_is_absolute_request(), - Err(&crate::window::ipc_scope_not_found_error_message( + Err(crate::window::ipc_scope_not_found_error_message( "main", "https://tauri.app/", )), @@ -248,7 +248,7 @@ mod tests { assert_ipc_response( &window, path_is_absolute_request(), - Err(&crate::window::ipc_scope_window_error_message("main")), + Err(crate::window::ipc_scope_window_error_message("main")), ); } @@ -262,7 +262,7 @@ mod tests { assert_ipc_response( &window, path_is_absolute_request(), - Err(&crate::window::ipc_scope_domain_error_message( + Err(crate::window::ipc_scope_domain_error_message( "https://tauri.app/", )), ); @@ -286,7 +286,7 @@ mod tests { assert_ipc_response( &window, path_is_absolute_request(), - Err(&crate::window::ipc_scope_domain_error_message( + Err(crate::window::ipc_scope_domain_error_message( "https://blog.tauri.app/", )), ); @@ -299,7 +299,7 @@ mod tests { assert_ipc_response( &window, path_is_absolute_request(), - Err(&crate::window::ipc_scope_not_found_error_message( + Err(crate::window::ipc_scope_not_found_error_message( "test", "https://dev.tauri.app/", )), @@ -340,7 +340,7 @@ mod tests { assert_ipc_response( &window, plugin_test_request(), - Err(&format!("plugin {PLUGIN_NAME} not found")), + Err(format!("plugin {PLUGIN_NAME} not found")), ); } diff --git a/core/tauri/src/scope/mod.rs b/core/tauri/src/scope/mod.rs index 3bb818d384b0..d69fbc07abde 100644 --- a/core/tauri/src/scope/mod.rs +++ b/core/tauri/src/scope/mod.rs @@ -2,24 +2,23 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -mod fs; +/// FS scope. +pub mod fs; /// IPC scope. pub mod ipc; -pub use self::ipc::Scope as IpcScope; -pub use fs::{Event as FsScopeEvent, Pattern as GlobPattern, Scope as FsScope}; use std::path::Path; /// Managed state for all the core scopes in a tauri application. pub struct Scopes { - pub(crate) ipc: IpcScope, + pub(crate) ipc: ipc::Scope, #[cfg(feature = "protocol-asset")] - pub(crate) asset_protocol: FsScope, + pub(crate) asset_protocol: fs::Scope, } +#[allow(unused)] impl Scopes { /// Allows a directory on the scopes. - #[allow(unused)] pub fn allow_directory>(&self, path: P, recursive: bool) -> crate::Result<()> { #[cfg(feature = "protocol-asset")] self.asset_protocol.allow_directory(path, recursive)?; @@ -27,7 +26,6 @@ impl Scopes { } /// Allows a file on the scopes. - #[allow(unused)] pub fn allow_file>(&self, path: P) -> crate::Result<()> { #[cfg(feature = "protocol-asset")] self.asset_protocol.allow_file(path)?; @@ -35,7 +33,6 @@ impl Scopes { } /// Forbids a file on the scopes. - #[allow(unused)] pub fn forbid_file>(&self, path: P) -> crate::Result<()> { #[cfg(feature = "protocol-asset")] self.asset_protocol.forbid_file(path)?; diff --git a/core/tauri/src/test/mock_runtime.rs b/core/tauri/src/test/mock_runtime.rs index b466de798ec0..0746fd7ec342 100644 --- a/core/tauri/src/test/mock_runtime.rs +++ b/core/tauri/src/test/mock_runtime.rs @@ -160,9 +160,9 @@ impl RuntimeHandle for MockRuntimeHandle { #[cfg(target_os = "android")] fn find_class<'a>( - &'a self, - env: &'a mut jni::JNIEnv<'a>, - activity: &'a jni::objects::JObject<'a>, + &self, + env: &mut jni::JNIEnv<'a>, + activity: &jni::objects::JObject<'_>, name: impl Into, ) -> std::result::Result, jni::errors::Error> { todo!() diff --git a/core/tauri/src/test/mod.rs b/core/tauri/src/test/mod.rs index 7b0a20e4385d..ff163eb2a3fc 100644 --- a/core/tauri/src/test/mod.rs +++ b/core/tauri/src/test/mod.rs @@ -220,23 +220,30 @@ pub fn mock_app() -> App { /// } /// } /// ``` -pub fn assert_ipc_response( +pub fn assert_ipc_response( window: &Window, request: InvokeRequest, expected: Result, ) { - let rx = window.clone().on_message(request); - let response = rx.recv().unwrap(); + let (tx, rx) = std::sync::mpsc::sync_channel(1); + window.clone().on_message( + request, + Box::new(move |_window, _cmd, response, _callback, _error| { + assert_eq!( + match response { + InvokeResponse::Ok(b) => Ok(b.into_json()), + InvokeResponse::Err(e) => Err(e.0), + }, + expected + .map(|e| serde_json::to_value(e).unwrap()) + .map_err(|e| serde_json::to_value(e).unwrap()) + ); - assert_eq!( - match response { - InvokeResponse::Ok(b) => Ok(b.into_json()), - InvokeResponse::Err(e) => Err(e.0), - }, - expected - .map(|e| serde_json::to_value(e).unwrap()) - .map_err(|e| serde_json::to_value(e).unwrap()) + tx.send(()).unwrap(); + }), ); + + rx.recv().unwrap(); } #[cfg(test)] diff --git a/core/tauri/src/tray.rs b/core/tauri/src/tray.rs index be6ea773dc54..d4811c0c976a 100644 --- a/core/tauri/src/tray.rs +++ b/core/tauri/src/tray.rs @@ -109,7 +109,7 @@ impl From for TrayIconEvent { #[derive(Default)] pub struct TrayIconBuilder { on_menu_event: Option>>, - on_tray_event: Option>>, + on_tray_icon_event: Option>>, inner: tray_icon::TrayIconBuilder, } @@ -124,7 +124,7 @@ impl TrayIconBuilder { Self { inner: tray_icon::TrayIconBuilder::new(), on_menu_event: None, - on_tray_event: None, + on_tray_icon_event: None, } } @@ -223,11 +223,11 @@ impl TrayIconBuilder { } /// Set a handler for this tray icon events. - pub fn on_tray_event, TrayIconEvent) + Sync + Send + 'static>( + pub fn on_tray_icon_event, TrayIconEvent) + Sync + Send + 'static>( mut self, f: F, ) -> Self { - self.on_tray_event.replace(Box::new(f)); + self.on_tray_icon_event.replace(Box::new(f)); self } @@ -247,7 +247,11 @@ impl TrayIconBuilder { app_handle: manager.app_handle().clone(), }; - icon.register(&icon.app_handle, self.on_menu_event, self.on_tray_event); + icon.register( + &icon.app_handle, + self.on_menu_event, + self.on_tray_icon_event, + ); Ok(icon) } @@ -285,7 +289,7 @@ impl TrayIcon { &self, app_handle: &AppHandle, on_menu_event: Option>>, - on_tray_event: Option>>, + on_tray_icon_event: Option>>, ) { if let Some(handler) = on_menu_event { app_handle @@ -297,7 +301,7 @@ impl TrayIcon { .push(handler); } - if let Some(handler) = on_tray_event { + if let Some(handler) = on_tray_icon_event { app_handle .manager .inner @@ -337,7 +341,10 @@ impl TrayIcon { } /// Register a handler for this tray icon events. - pub fn on_tray_event, TrayIconEvent) + Sync + Send + 'static>(&self, f: F) { + pub fn on_tray_icon_event, TrayIconEvent) + Sync + Send + 'static>( + &self, + f: F, + ) { self .app_handle .manager diff --git a/core/tauri/src/window.rs b/core/tauri/src/window.rs index 55a91154d4b6..e0c35bcb9ad2 100644 --- a/core/tauri/src/window.rs +++ b/core/tauri/src/window.rs @@ -11,15 +11,15 @@ use url::Url; #[cfg(target_os = "macos")] use crate::TitleBarStyle; use crate::{ - app::AppHandle, + app::{AppHandle, UriSchemeResponder}, command::{CommandArg, CommandItem}, event::{Event, EventHandler}, ipc::{ - CallbackFn, Invoke, InvokeBody, InvokeError, InvokeMessage, InvokeResolver, InvokeResponse, + CallbackFn, Invoke, InvokeBody, InvokeError, InvokeMessage, InvokeResolver, + OwnedInvokeResponder, }, manager::WindowManager, runtime::{ - http::{Request as HttpRequest, Response as HttpResponse}, monitor::Monitor as RuntimeMonitor, webview::{WebviewAttributes, WindowBuilder as _}, window::{ @@ -50,20 +50,19 @@ use windows::Win32::Foundation::HWND; use tauri_macros::default_runtime; use std::{ + borrow::Cow, collections::{HashMap, HashSet}, fmt, hash::{Hash, Hasher}, path::PathBuf, - sync::{ - mpsc::{sync_channel, Receiver}, - Arc, Mutex, - }, + sync::{Arc, Mutex}, }; -pub(crate) type WebResourceRequestHandler = dyn Fn(&HttpRequest, &mut HttpResponse) + Send + Sync; +pub(crate) type WebResourceRequestHandler = + dyn Fn(http::Request>, &mut http::Response>) + Send + Sync; pub(crate) type NavigationHandler = dyn Fn(&Url) -> bool + Send; pub(crate) type UriSchemeProtocolHandler = - Box Result> + Send + Sync>; + Box>, UriSchemeResponder) + Send + Sync>; #[derive(Clone, Serialize)] struct WindowCreatedEvent { @@ -266,15 +265,15 @@ impl<'a, R: Runtime> WindowBuilder<'a, R> { /// ```rust,no_run /// use tauri::{ /// utils::config::{Csp, CspDirectiveSources, WindowUrl}, - /// http::header::HeaderValue, /// window::WindowBuilder, /// }; + /// use http::header::HeaderValue; /// use std::collections::HashMap; /// tauri::Builder::default() /// .setup(|app| { /// WindowBuilder::new(app, "core", WindowUrl::App("index.html".into())) /// .on_web_resource_request(|request, response| { - /// if request.uri().starts_with("tauri://") { + /// if request.uri().scheme_str() == Some("tauri") { /// // if we have a CSP header, Tauri is loading an HTML file /// // for this example, let's dynamically change the CSP /// if let Some(csp) = response.headers_mut().get_mut("Content-Security-Policy") { @@ -291,7 +290,9 @@ impl<'a, R: Runtime> WindowBuilder<'a, R> { /// Ok(()) /// }); /// ``` - pub fn on_web_resource_request( + pub fn on_web_resource_request< + F: Fn(http::Request>, &mut http::Response>) + Send + Sync + 'static, + >( mut self, f: F, ) -> Self { @@ -306,9 +307,9 @@ impl<'a, R: Runtime> WindowBuilder<'a, R> { /// ```rust,no_run /// use tauri::{ /// utils::config::{Csp, CspDirectiveSources, WindowUrl}, - /// http::header::HeaderValue, /// window::WindowBuilder, /// }; + /// use http::header::HeaderValue; /// use std::collections::HashMap; /// tauri::Builder::default() /// .setup(|app| { @@ -892,7 +893,7 @@ pub struct Window { /// The webview window created by the runtime. pub(crate) window: DetachedWindow, /// The manager to associate this webview window with. - manager: WindowManager, + pub(crate) manager: WindowManager, pub(crate) app_handle: AppHandle, js_event_listeners: Arc>>>, // The menu set for this window @@ -2067,7 +2068,7 @@ impl Window { } /// Handles this window receiving an [`InvokeRequest`]. - pub fn on_message(self, request: InvokeRequest) -> Receiver { + pub fn on_message(self, request: InvokeRequest, responder: Box>) { let manager = self.manager.clone(); let current_url = self.url(); let is_local = self.is_local_url(¤t_url); @@ -2090,74 +2091,20 @@ impl Window { } }; - let (tx, rx) = sync_channel(1); - let custom_responder = self.manager.invoke_responder(); let resolver = InvokeResolver::new( self.clone(), - Arc::new( + Arc::new(Mutex::new(Some(Box::new( #[allow(unused_variables)] move |window: Window, cmd, response, callback, error| { - #[cfg(not(ipc_custom_protocol))] - { - use crate::ipc::{ - format_callback::{ - format as format_callback, format_result as format_callback_result, - }, - Channel, - }; - use serde_json::Value as JsonValue; - - // the channel data command is the only command that uses a custom protocol on Linux - if custom_responder.is_none() && cmd != crate::ipc::channel::FETCH_CHANNEL_DATA_COMMAND - { - fn responder_eval( - window: &Window, - js: crate::api::Result, - error: CallbackFn, - ) { - let eval_js = match js { - Ok(js) => js, - Err(e) => format_callback(error, &e.to_string()) - .expect("unable to serialize response error string to json"), - }; - - let _ = window.eval(&eval_js); - } - - match &response { - InvokeResponse::Ok(InvokeBody::Json(v)) => { - if matches!(v, JsonValue::Object(_) | JsonValue::Array(_)) { - let _ = Channel::from_ipc(window.clone(), callback).send(v); - } else { - responder_eval( - &window, - format_callback_result(Result::<_, ()>::Ok(v), callback, error), - error, - ) - } - } - InvokeResponse::Ok(InvokeBody::Raw(v)) => { - let _ = - Channel::from_ipc(window.clone(), callback).send(InvokeBody::Raw(v.clone())); - } - InvokeResponse::Err(e) => responder_eval( - &window, - format_callback_result(Result::<(), _>::Err(&e.0), callback, error), - error, - ), - } - } - } - if let Some(responder) = &custom_responder { - (responder)(window, cmd, &response, callback, error); + (responder)(&window, &cmd, &response, callback, error); } - let _ = tx.send(response); + responder(window, cmd, response, callback, error); }, - ), + )))), request.cmd.clone(), request.callback, request.error, @@ -2207,7 +2154,7 @@ impl Window { .unwrap_or(true)) { invoke.resolver.reject(IPC_SCOPE_DOES_NOT_ALLOW); - return rx; + return; } let command = invoke.message.command.clone(); @@ -2251,7 +2198,7 @@ impl Window { }, ) { resolver.reject(e.to_string()); - return rx; + return; } } } @@ -2268,8 +2215,6 @@ impl Window { } } } - - rx } /// Evaluates JavaScript on this window. @@ -2302,7 +2247,7 @@ impl Window { window_label, event, }) - .or_insert_with(Default::default) + .or_default() .insert(event_id); Ok(event_id) diff --git a/core/tauri/test/fixture/src-tauri/tauri.conf.json b/core/tauri/test/fixture/src-tauri/tauri.conf.json index facec1a219b4..ecb5e3cecad0 100644 --- a/core/tauri/test/fixture/src-tauri/tauri.conf.json +++ b/core/tauri/test/fixture/src-tauri/tauri.conf.json @@ -15,7 +15,7 @@ } ], "security": { - "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; connect-src ipc: https://ipc.localhost" + "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; connect-src ipc: http://ipc.localhost" } } } \ No newline at end of file diff --git a/core/tests/restart/src/main.rs b/core/tests/restart/src/main.rs index 6984ab20c5d3..a37a66643d39 100644 --- a/core/tests/restart/src/main.rs +++ b/core/tests/restart/src/main.rs @@ -21,7 +21,7 @@ fn main() { match argv.nth(1).as_deref() { Some("restart") => { let mut env = Env::default(); - env.args.clear(); + env.args_os.clear(); tauri::process::restart(&env) } Some(invalid) => panic!("only argument `restart` is allowed, {invalid} is invalid"), diff --git a/examples/api/src-tauri/Cargo.lock b/examples/api/src-tauri/Cargo.lock index 01f36e50fd94..d5d2857f07e2 100644 --- a/examples/api/src-tauri/Cargo.lock +++ b/examples/api/src-tauri/Cargo.lock @@ -3399,7 +3399,7 @@ checksum = "9d0e916b1148c8e263850e1ebcbd046f333e0683c724876bb0da63ea4373dc8a" [[package]] name = "tauri" -version = "2.0.0-alpha.10" +version = "2.0.0-alpha.14" dependencies = [ "anyhow", "bytes", @@ -3412,6 +3412,7 @@ dependencies = [ "gtk", "heck", "http", + "http-range", "ico", "infer 0.15.0", "jni", @@ -3449,7 +3450,7 @@ dependencies = [ [[package]] name = "tauri-build" -version = "2.0.0-alpha.6" +version = "2.0.0-alpha.8" dependencies = [ "anyhow", "cargo_toml", @@ -3469,7 +3470,7 @@ dependencies = [ [[package]] name = "tauri-codegen" -version = "2.0.0-alpha.6" +version = "2.0.0-alpha.7" dependencies = [ "base64", "brotli", @@ -3493,7 +3494,7 @@ dependencies = [ [[package]] name = "tauri-macros" -version = "2.0.0-alpha.6" +version = "2.0.0-alpha.7" dependencies = [ "heck", "proc-macro2", @@ -3549,13 +3550,11 @@ dependencies = [ [[package]] name = "tauri-runtime" -version = "0.13.0-alpha.6" +version = "1.0.0-alpha.1" dependencies = [ "gtk", "http", - "http-range", "jni", - "rand 0.8.5", "raw-window-handle", "serde", "serde_json", @@ -3568,10 +3567,11 @@ dependencies = [ [[package]] name = "tauri-runtime-wry" -version = "0.13.0-alpha.6" +version = "1.0.0-alpha.2" dependencies = [ "cocoa 0.24.1", "gtk", + "http", "jni", "percent-encoding", "rand 0.8.5", @@ -3587,7 +3587,7 @@ dependencies = [ [[package]] name = "tauri-utils" -version = "2.0.0-alpha.6" +version = "2.0.0-alpha.7" dependencies = [ "aes-gcm", "brotli", @@ -3600,6 +3600,7 @@ dependencies = [ "infer 0.12.0", "json-patch", "kuchikiki", + "log", "memchr", "phf 0.10.1", "proc-macro2", @@ -4529,9 +4530,9 @@ dependencies = [ [[package]] name = "wry" -version = "0.31.0" +version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c6289018fa3cbc051c13f4ae1a102d80c3f35a527456c75567eb2cad6989020" +checksum = "bf906b43b8042615c85a978dceb4d4b72214d27b850b54abc3edeb7c5a67abab" dependencies = [ "base64", "block", diff --git a/examples/api/src-tauri/src/lib.rs b/examples/api/src-tauri/src/lib.rs index 8af633098e91..9a06be515b09 100644 --- a/examples/api/src-tauri/src/lib.rs +++ b/examples/api/src-tauri/src/lib.rs @@ -63,8 +63,8 @@ pub fn run_app) + Send + 'static>( #[cfg(desktop)] app.manage(PopupMenu( tauri::menu::MenuBuilder::new(app) - .check("Tauri is awesome!") - .text("Do something") + .check("check", "Tauri is awesome!") + .text("text", "Do something") .copy() .build()?, )); diff --git a/examples/api/src-tauri/src/tray.rs b/examples/api/src-tauri/src/tray.rs index 698255061ca5..a81c54348338 100644 --- a/examples/api/src-tauri/src/tray.rs +++ b/examples/api/src-tauri/src/tray.rs @@ -101,7 +101,7 @@ pub fn create_tray(app: &tauri::AppHandle) -> tauri::Result<()> { _ => {} }) - .on_tray_event(|tray, event| { + .on_tray_icon_event(|tray, event| { if event.click_type == ClickType::Left { let app = tray.app_handle(); if let Some(window) = app.get_window("main") { diff --git a/examples/api/src-tauri/tauri.conf.json b/examples/api/src-tauri/tauri.conf.json index 784733dd675f..20bf653403b7 100644 --- a/examples/api/src-tauri/tauri.conf.json +++ b/examples/api/src-tauri/tauri.conf.json @@ -92,11 +92,11 @@ "security": { "csp": { "default-src": "'self' customprotocol: asset:", - "connect-src": "ipc: https://ipc.localhost", + "connect-src": "ipc: http://ipc.localhost", "font-src": [ "https://fonts.gstatic.com" ], - "img-src": "'self' asset: https://asset.localhost blob: data:", + "img-src": "'self' asset: http://asset.localhost blob: data:", "style-src": "'unsafe-inline' 'self' https://fonts.googleapis.com" }, "freezePrototype": true, @@ -114,4 +114,4 @@ } } } -} +} \ No newline at end of file diff --git a/examples/commands/tauri.conf.json b/examples/commands/tauri.conf.json index e618bd5472ab..223643a7e16c 100644 --- a/examples/commands/tauri.conf.json +++ b/examples/commands/tauri.conf.json @@ -51,7 +51,7 @@ } ], "security": { - "csp": "default-src 'self'; connect-src ipc: https://ipc.localhost" + "csp": "default-src 'self'; connect-src ipc: http://ipc.localhost" } } } \ No newline at end of file diff --git a/examples/helloworld/tauri.conf.json b/examples/helloworld/tauri.conf.json index 47869b636288..b9cafb3ea9fe 100644 --- a/examples/helloworld/tauri.conf.json +++ b/examples/helloworld/tauri.conf.json @@ -50,7 +50,7 @@ } ], "security": { - "csp": "default-src 'self'; connect-src ipc: https://ipc.localhost" + "csp": "default-src 'self'; connect-src ipc: http://ipc.localhost" } } } \ No newline at end of file diff --git a/examples/isolation/tauri.conf.json b/examples/isolation/tauri.conf.json index 4187fb3c6036..6da027907089 100644 --- a/examples/isolation/tauri.conf.json +++ b/examples/isolation/tauri.conf.json @@ -60,7 +60,7 @@ } ], "security": { - "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'; connect-src ipc: https://ipc.localhost" + "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'; connect-src ipc: http://ipc.localhost" } } } \ No newline at end of file diff --git a/examples/multiwindow/tauri.conf.json b/examples/multiwindow/tauri.conf.json index 533ea9af644d..607aea31d9c0 100644 --- a/examples/multiwindow/tauri.conf.json +++ b/examples/multiwindow/tauri.conf.json @@ -47,7 +47,7 @@ } ], "security": { - "csp": "default-src 'self'; connect-src ipc: https://ipc.localhost" + "csp": "default-src 'self'; connect-src ipc: http://ipc.localhost" } } } \ No newline at end of file diff --git a/examples/navigation/tauri.conf.json b/examples/navigation/tauri.conf.json index c8a352404028..82e00b902a3f 100644 --- a/examples/navigation/tauri.conf.json +++ b/examples/navigation/tauri.conf.json @@ -47,7 +47,7 @@ } ], "security": { - "csp": "default-src 'self'; connect-src ipc: https://ipc.localhost" + "csp": "default-src 'self'; connect-src ipc: http://ipc.localhost" } } } \ No newline at end of file diff --git a/examples/parent-window/tauri.conf.json b/examples/parent-window/tauri.conf.json index b19c511f00c6..c0f698b0e303 100644 --- a/examples/parent-window/tauri.conf.json +++ b/examples/parent-window/tauri.conf.json @@ -31,7 +31,7 @@ "category": "DeveloperTool" }, "security": { - "csp": "default-src 'self'; connect-src ipc: https://ipc.localhost" + "csp": "default-src 'self'; connect-src ipc: http://ipc.localhost" } } } \ No newline at end of file diff --git a/examples/resources/src-tauri/tauri.conf.json b/examples/resources/src-tauri/tauri.conf.json index 85777f4273a3..be4e9d98b21f 100644 --- a/examples/resources/src-tauri/tauri.conf.json +++ b/examples/resources/src-tauri/tauri.conf.json @@ -53,7 +53,7 @@ } ], "security": { - "csp": "default-src 'self'; connect-src ipc: https://ipc.localhost" + "csp": "default-src 'self'; connect-src ipc: http://ipc.localhost" } } } \ No newline at end of file diff --git a/examples/splashscreen/tauri.conf.json b/examples/splashscreen/tauri.conf.json index 69b17a36e3a3..1429e78d1e2f 100644 --- a/examples/splashscreen/tauri.conf.json +++ b/examples/splashscreen/tauri.conf.json @@ -44,7 +44,7 @@ } ], "security": { - "csp": "default-src 'self'; connect-src ipc: https://ipc.localhost" + "csp": "default-src 'self'; connect-src ipc: http://ipc.localhost" } } } \ No newline at end of file diff --git a/examples/state/tauri.conf.json b/examples/state/tauri.conf.json index d09175aaeb50..06018b37aa60 100644 --- a/examples/state/tauri.conf.json +++ b/examples/state/tauri.conf.json @@ -51,7 +51,7 @@ } ], "security": { - "csp": "default-src 'self'; connect-src ipc: https://ipc.localhost" + "csp": "default-src 'self'; connect-src ipc: http://ipc.localhost" } } } \ No newline at end of file diff --git a/examples/streaming/main.rs b/examples/streaming/main.rs index 087aa4566bbc..fb1d26e0fc4c 100644 --- a/examples/streaming/main.rs +++ b/examples/streaming/main.rs @@ -4,16 +4,16 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] +use http::{header::*, response::Builder as ResponseBuilder, status::StatusCode}; +use http_range::HttpRange; use std::sync::{Arc, Mutex}; +use std::{ + io::{Read, Seek, SeekFrom, Write}, + path::PathBuf, + process::{Command, Stdio}, +}; fn main() { - use std::{ - io::{Read, Seek, SeekFrom, Write}, - path::PathBuf, - process::{Command, Stdio}, - }; - use tauri::http::{header::*, status::StatusCode, HttpRange, ResponseBuilder}; - let video_file = PathBuf::from("test_video.mp4"); let video_url = "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"; @@ -41,144 +41,17 @@ fn main() { tauri::Builder::default() .invoke_handler(tauri::generate_handler![video_uri]) - .register_uri_scheme_protocol("stream", move |_app, request| { - // get the file path - let path = request.uri().strip_prefix("stream://localhost/").unwrap(); - let path = percent_encoding::percent_decode(path.as_bytes()) - .decode_utf8_lossy() - .to_string(); - - if path != "test_video.mp4" { - // return error 404 if it's not our video - return ResponseBuilder::new().status(404).body(Vec::new()); - } - - let mut file = std::fs::File::open(&path)?; - - // get file length - let len = { - let old_pos = file.stream_position()?; - let len = file.seek(SeekFrom::End(0))?; - file.seek(SeekFrom::Start(old_pos))?; - len - }; - - let mut resp = ResponseBuilder::new().header(CONTENT_TYPE, "video/mp4"); - - // if the webview sent a range header, we need to send a 206 in return - // Actually only macOS and Windows are supported. Linux will ALWAYS return empty headers. - let response = if let Some(range_header) = request.headers().get("range") { - let not_satisfiable = || { + .register_asynchronous_uri_scheme_protocol("stream", move |_app, request, responder| { + match get_stream_response(request, &boundary_id) { + Ok(http_response) => responder.respond(http_response), + Err(e) => responder.respond( ResponseBuilder::new() - .status(StatusCode::RANGE_NOT_SATISFIABLE) - .header(CONTENT_RANGE, format!("bytes */{len}")) - .body(vec![]) - }; - - // parse range header - let ranges = if let Ok(ranges) = HttpRange::parse(range_header.to_str()?, len) { - ranges - .iter() - // map the output back to spec range , example: 0-499 - .map(|r| (r.start, r.start + r.length - 1)) - .collect::>() - } else { - return not_satisfiable(); - }; - - /// The Maximum bytes we send in one range - const MAX_LEN: u64 = 1000 * 1024; - - if ranges.len() == 1 { - let &(start, mut end) = ranges.first().unwrap(); - - // check if a range is not satisfiable - // - // this should be already taken care of by HttpRange::parse - // but checking here again for extra assurance - if start >= len || end >= len || end < start { - return not_satisfiable(); - } - - // adjust end byte for MAX_LEN - end = start + (end - start).min(len - start).min(MAX_LEN - 1); - - // calculate number of bytes needed to be read - let bytes_to_read = end + 1 - start; - - // allocate a buf with a suitable capacity - let mut buf = Vec::with_capacity(bytes_to_read as usize); - // seek the file to the starting byte - file.seek(SeekFrom::Start(start))?; - // read the needed bytes - file.take(bytes_to_read).read_to_end(&mut buf)?; - - resp = resp.header(CONTENT_RANGE, format!("bytes {start}-{end}/{len}")); - resp = resp.header(CONTENT_LENGTH, end + 1 - start); - resp = resp.status(StatusCode::PARTIAL_CONTENT); - resp.body(buf) - } else { - let mut buf = Vec::new(); - let ranges = ranges - .iter() - .filter_map(|&(start, mut end)| { - // filter out unsatisfiable ranges - // - // this should be already taken care of by HttpRange::parse - // but checking here again for extra assurance - if start >= len || end >= len || end < start { - None - } else { - // adjust end byte for MAX_LEN - end = start + (end - start).min(len - start).min(MAX_LEN - 1); - Some((start, end)) - } - }) - .collect::>(); - - let mut id = boundary_id.lock().unwrap(); - *id += 1; - let boundary = format!("sadasq2e{id}"); - let boundary_sep = format!("\r\n--{boundary}\r\n"); - let boundary_closer = format!("\r\n--{boundary}\r\n"); - - resp = resp.header( - CONTENT_TYPE, - format!("multipart/byteranges; boundary={boundary}"), - ); - - for (end, start) in ranges { - // a new range is being written, write the range boundary - buf.write_all(boundary_sep.as_bytes())?; - - // write the needed headers `Content-Type` and `Content-Range` - buf.write_all(format!("{CONTENT_TYPE}: video/mp4\r\n").as_bytes())?; - buf.write_all(format!("{CONTENT_RANGE}: bytes {start}-{end}/{len}\r\n").as_bytes())?; - - // write the separator to indicate the start of the range body - buf.write_all("\r\n".as_bytes())?; - - // calculate number of bytes needed to be read - let bytes_to_read = end + 1 - start; - - let mut local_buf = vec![0_u8; bytes_to_read as usize]; - file.seek(SeekFrom::Start(start))?; - file.read_exact(&mut local_buf)?; - buf.extend_from_slice(&local_buf); - } - // all ranges have been written, write the closing boundary - buf.write_all(boundary_closer.as_bytes())?; - - resp.body(buf) - } - } else { - resp = resp.header(CONTENT_LENGTH, len); - let mut buf = Vec::with_capacity(len as usize); - file.read_to_end(&mut buf)?; - resp.body(buf) - }; - - response + .status(StatusCode::BAD_REQUEST) + .header(CONTENT_TYPE, "text/plain") + .body(e.to_string().as_bytes().to_vec()) + .unwrap(), + ), + } }) .run(tauri::generate_context!( "../../examples/streaming/tauri.conf.json" @@ -200,3 +73,145 @@ fn video_uri() -> (&'static str, std::path::PathBuf) { #[cfg(not(feature = "protocol-asset"))] ("stream", "test_video.mp4".into()) } + +fn get_stream_response( + request: http::Request>, + boundary_id: &Arc>, +) -> Result>, Box> { + // skip leading `/` + let path = percent_encoding::percent_decode(request.uri().path()[1..].as_bytes()) + .decode_utf8_lossy() + .to_string(); + + if path != "test_video.mp4" { + // return error 404 if it's not our video + return Ok(ResponseBuilder::new().status(404).body(Vec::new())?); + } + + let mut file = std::fs::File::open(&path)?; + + // get file length + let len = { + let old_pos = file.stream_position()?; + let len = file.seek(SeekFrom::End(0))?; + file.seek(SeekFrom::Start(old_pos))?; + len + }; + + let mut resp = ResponseBuilder::new().header(CONTENT_TYPE, "video/mp4"); + + // if the webview sent a range header, we need to send a 206 in return + // Actually only macOS and Windows are supported. Linux will ALWAYS return empty headers. + let http_response = if let Some(range_header) = request.headers().get("range") { + let not_satisfiable = || { + ResponseBuilder::new() + .status(StatusCode::RANGE_NOT_SATISFIABLE) + .header(CONTENT_RANGE, format!("bytes */{len}")) + .body(vec![]) + }; + + // parse range header + let ranges = if let Ok(ranges) = HttpRange::parse(range_header.to_str()?, len) { + ranges + .iter() + // map the output back to spec range , example: 0-499 + .map(|r| (r.start, r.start + r.length - 1)) + .collect::>() + } else { + return Ok(not_satisfiable()?); + }; + + /// The Maximum bytes we send in one range + const MAX_LEN: u64 = 1000 * 1024; + + if ranges.len() == 1 { + let &(start, mut end) = ranges.first().unwrap(); + + // check if a range is not satisfiable + // + // this should be already taken care of by HttpRange::parse + // but checking here again for extra assurance + if start >= len || end >= len || end < start { + return Ok(not_satisfiable()?); + } + + // adjust end byte for MAX_LEN + end = start + (end - start).min(len - start).min(MAX_LEN - 1); + + // calculate number of bytes needed to be read + let bytes_to_read = end + 1 - start; + + // allocate a buf with a suitable capacity + let mut buf = Vec::with_capacity(bytes_to_read as usize); + // seek the file to the starting byte + file.seek(SeekFrom::Start(start))?; + // read the needed bytes + file.take(bytes_to_read).read_to_end(&mut buf)?; + + resp = resp.header(CONTENT_RANGE, format!("bytes {start}-{end}/{len}")); + resp = resp.header(CONTENT_LENGTH, end + 1 - start); + resp = resp.status(StatusCode::PARTIAL_CONTENT); + resp.body(buf) + } else { + let mut buf = Vec::new(); + let ranges = ranges + .iter() + .filter_map(|&(start, mut end)| { + // filter out unsatisfiable ranges + // + // this should be already taken care of by HttpRange::parse + // but checking here again for extra assurance + if start >= len || end >= len || end < start { + None + } else { + // adjust end byte for MAX_LEN + end = start + (end - start).min(len - start).min(MAX_LEN - 1); + Some((start, end)) + } + }) + .collect::>(); + + let mut id = boundary_id.lock().unwrap(); + *id += 1; + let boundary = format!("sadasq2e{id}"); + let boundary_sep = format!("\r\n--{boundary}\r\n"); + let boundary_closer = format!("\r\n--{boundary}\r\n"); + + resp = resp.header( + CONTENT_TYPE, + format!("multipart/byteranges; boundary={boundary}"), + ); + + for (end, start) in ranges { + // a new range is being written, write the range boundary + buf.write_all(boundary_sep.as_bytes())?; + + // write the needed headers `Content-Type` and `Content-Range` + buf.write_all(format!("{CONTENT_TYPE}: video/mp4\r\n").as_bytes())?; + buf.write_all(format!("{CONTENT_RANGE}: bytes {start}-{end}/{len}\r\n").as_bytes())?; + + // write the separator to indicate the start of the range body + buf.write_all("\r\n".as_bytes())?; + + // calculate number of bytes needed to be read + let bytes_to_read = end + 1 - start; + + let mut local_buf = vec![0_u8; bytes_to_read as usize]; + file.seek(SeekFrom::Start(start))?; + file.read_exact(&mut local_buf)?; + buf.extend_from_slice(&local_buf); + } + // all ranges have been written, write the closing boundary + buf.write_all(boundary_closer.as_bytes())?; + + resp.body(buf) + } + } else { + resp = resp.header(CONTENT_LENGTH, len); + let mut buf = Vec::with_capacity(len as usize); + file.read_to_end(&mut buf)?; + resp.body(buf) + }; + + http_response.map_err(Into::into) +} diff --git a/examples/streaming/tauri.conf.json b/examples/streaming/tauri.conf.json index 970f5760ebd5..e1506fcc1942 100644 --- a/examples/streaming/tauri.conf.json +++ b/examples/streaming/tauri.conf.json @@ -1,8 +1,12 @@ { "$schema": "../../core/tauri-config-schema/schema.json", "build": { - "distDir": ["index.html"], - "devPath": ["index.html"], + "distDir": [ + "index.html" + ], + "devPath": [ + "index.html" + ], "beforeDevCommand": "", "beforeBuildCommand": "", "withGlobalTauri": true @@ -47,10 +51,12 @@ } ], "security": { - "csp": "default-src 'self' ipc:; media-src stream: https://stream.localhost asset: https://asset.localhost", + "csp": "default-src 'self'; connect-src ipc: http://ipc.localhost; media-src stream: http://stream.localhost asset: http://asset.localhost", "assetProtocol": { - "scope": ["**/test_video.mp4"] + "scope": [ + "**/test_video.mp4" + ] } } } -} +} \ No newline at end of file diff --git a/examples/tauri-dynamic-lib/src-tauri/tauri.conf.json b/examples/tauri-dynamic-lib/src-tauri/tauri.conf.json index a7d9b6a090d7..0f597d700571 100644 --- a/examples/tauri-dynamic-lib/src-tauri/tauri.conf.json +++ b/examples/tauri-dynamic-lib/src-tauri/tauri.conf.json @@ -50,7 +50,7 @@ } ], "security": { - "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; connect-src ipc: https://ipc.localhost" + "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; connect-src ipc: http://ipc.localhost" } } } \ No newline at end of file diff --git a/examples/web/core/tauri/Cargo.toml b/examples/web/core/tauri/Cargo.toml index 2f9cf59782c1..ebf0e357cd57 100644 --- a/examples/web/core/tauri/Cargo.toml +++ b/examples/web/core/tauri/Cargo.toml @@ -15,6 +15,7 @@ tauri-build = { path = "../../../../core/tauri-build", features = [] } [dependencies] api = { path = "../api" } tauri = { path = "../../../../core/tauri" } +tauri-plugin-dialog = "2.0.0-alpha.2" [features] -custom-protocol = [ "tauri/custom-protocol" ] +custom-protocol = ["tauri/custom-protocol"] diff --git a/examples/web/core/tauri/src/main.rs b/examples/web/core/tauri/src/main.rs index 5ec45c597eed..76755fda04da 100644 --- a/examples/web/core/tauri/src/main.rs +++ b/examples/web/core/tauri/src/main.rs @@ -3,10 +3,13 @@ // SPDX-License-Identifier: MIT #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] +use tauri_plugin_dialog::DialogExt; #[tauri::command] fn greet(window: tauri::Window, name: String) { - tauri::api::dialog::message(Some(&window), "Tauri Example", api::greet(&name)); + MessageDialogBuilder::new(window.dialog(), "Tauri Example") + .parent(&window) + .show(); } fn main() { diff --git a/tooling/api/CHANGELOG.md b/tooling/api/CHANGELOG.md index d94f5664e3b5..1dee11a89e99 100644 --- a/tooling/api/CHANGELOG.md +++ b/tooling/api/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## \[2.0.0-alpha.8] + +### Breaking Changes + +- [`d5074af5`](https://www.github.com/tauri-apps/tauri/commit/d5074af562b2b5cb6c5711442097c4058af32db6)([#7801](https://www.github.com/tauri-apps/tauri/pull/7801)) The custom protocol on Android now uses the `http` scheme instead of `https`. + +## \[2.0.0-alpha.7] + +### Breaking Changes + +- [`4cb51a2d`](https://www.github.com/tauri-apps/tauri/commit/4cb51a2d56cfcae0749062c79ede5236bd8c02c2)([#7779](https://www.github.com/tauri-apps/tauri/pull/7779)) The custom protocol on Windows now uses the `http` scheme instead of `https`. + ## \[2.0.0-alpha.6] ### New Features diff --git a/tooling/api/package.json b/tooling/api/package.json index 5f2f6cb04b5a..7a5b64967669 100644 --- a/tooling/api/package.json +++ b/tooling/api/package.json @@ -1,6 +1,6 @@ { "name": "@tauri-apps/api", - "version": "2.0.0-alpha.6", + "version": "2.0.0-alpha.8", "description": "Tauri API definitions", "funding": { "type": "opencollective", diff --git a/tooling/api/src/tauri.ts b/tooling/api/src/tauri.ts index 733039733db0..8d76c0d32423 100644 --- a/tooling/api/src/tauri.ts +++ b/tooling/api/src/tauri.ts @@ -181,8 +181,8 @@ async function invoke( /** * Convert a device file path to an URL that can be loaded by the webview. - * Note that `asset:` and `https://asset.localhost` must be added to [`tauri.security.csp`](https://tauri.app/v1/api/config/#securityconfig.csp) in `tauri.conf.json`. - * Example CSP value: `"csp": "default-src 'self' ipc: https://ipc.localhost; img-src 'self' asset: https://asset.localhost"` to use the asset protocol on image sources. + * Note that `asset:` and `http://asset.localhost` must be added to [`tauri.security.csp`](https://tauri.app/v1/api/config/#securityconfig.csp) in `tauri.conf.json`. + * Example CSP value: `"csp": "default-src 'self' ipc: http://ipc.localhost; img-src 'self' asset: http://asset.localhost"` to use the asset protocol on image sources. * * Additionally, `asset` must be added to [`tauri.allowlist.protocol`](https://tauri.app/v1/api/config/#allowlistconfig.protocol) * in `tauri.conf.json` and its access scope must be defined on the `assetScope` array on the same `protocol` object. diff --git a/tooling/bench/tests/cpu_intensive/src-tauri/tauri.conf.json b/tooling/bench/tests/cpu_intensive/src-tauri/tauri.conf.json index eae6098e9823..68100cc05d98 100644 --- a/tooling/bench/tests/cpu_intensive/src-tauri/tauri.conf.json +++ b/tooling/bench/tests/cpu_intensive/src-tauri/tauri.conf.json @@ -43,7 +43,7 @@ } ], "security": { - "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; connect-src ipc: https://ipc.localhost" + "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; connect-src ipc: http://ipc.localhost" } } } \ No newline at end of file diff --git a/tooling/bench/tests/files_transfer/src-tauri/tauri.conf.json b/tooling/bench/tests/files_transfer/src-tauri/tauri.conf.json index eae6098e9823..68100cc05d98 100644 --- a/tooling/bench/tests/files_transfer/src-tauri/tauri.conf.json +++ b/tooling/bench/tests/files_transfer/src-tauri/tauri.conf.json @@ -43,7 +43,7 @@ } ], "security": { - "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; connect-src ipc: https://ipc.localhost" + "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; connect-src ipc: http://ipc.localhost" } } } \ No newline at end of file diff --git a/tooling/bench/tests/helloworld/src-tauri/tauri.conf.json b/tooling/bench/tests/helloworld/src-tauri/tauri.conf.json index eae6098e9823..68100cc05d98 100644 --- a/tooling/bench/tests/helloworld/src-tauri/tauri.conf.json +++ b/tooling/bench/tests/helloworld/src-tauri/tauri.conf.json @@ -43,7 +43,7 @@ } ], "security": { - "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; connect-src ipc: https://ipc.localhost" + "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; connect-src ipc: http://ipc.localhost" } } } \ No newline at end of file diff --git a/tooling/bundler/CHANGELOG.md b/tooling/bundler/CHANGELOG.md index bff3fa7b0147..fd3b4598e9d8 100644 --- a/tooling/bundler/CHANGELOG.md +++ b/tooling/bundler/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## \[2.0.0-alpha.9] + +### Dependencies + +- Upgraded to `tauri-utils@2.0.0-alpha.8` + +## \[2.0.0-alpha.8] + +### Enhancements + +- [`04949d16`](https://www.github.com/tauri-apps/tauri/commit/04949d16586acddab97a3c083a61c81b18d6933e)([#7624](https://www.github.com/tauri-apps/tauri/pull/7624)) Added Bulgarian language support to the NSIS bundler. + ## \[2.0.0-alpha.7] ### Bug Fixes diff --git a/tooling/bundler/Cargo.toml b/tooling/bundler/Cargo.toml index eeba6de3bd16..a704e69ce168 100644 --- a/tooling/bundler/Cargo.toml +++ b/tooling/bundler/Cargo.toml @@ -2,7 +2,7 @@ workspace = { } [package] name = "tauri-bundler" -version = "2.0.0-alpha.7" +version = "2.0.0-alpha.9" authors = [ "George Burton ", "Tauri Programme within The Commons Conservancy" @@ -17,7 +17,7 @@ rust-version = "1.65" exclude = [ "CHANGELOG.md", "/target", "rustfmt.toml" ] [dependencies] -tauri-utils = { version = "2.0.0-alpha.7", path = "../../core/tauri-utils", features = [ "resources" ] } +tauri-utils = { version = "2.0.0-alpha.8", path = "../../core/tauri-utils", features = [ "resources" ] } image = "0.24.7" libflate = "2.0" anyhow = "1.0" diff --git a/tooling/bundler/src/bundle/common.rs b/tooling/bundler/src/bundle/common.rs index 9af5b06445f1..3370c717a17b 100644 --- a/tooling/bundler/src/bundle/common.rs +++ b/tooling/bundler/src/bundle/common.rs @@ -164,9 +164,8 @@ impl CommandExt for Command { let mut lines = stdout_lines_.lock().unwrap(); loop { buf.clear(); - match tauri_utils::io::read_line(&mut stdout, &mut buf) { - Ok(s) if s == 0 => break, - _ => (), + if let Ok(0) = tauri_utils::io::read_line(&mut stdout, &mut buf) { + break; } debug!(action = "stdout"; "{}", String::from_utf8_lossy(&buf)); lines.extend(buf.clone()); @@ -182,9 +181,8 @@ impl CommandExt for Command { let mut lines = stderr_lines_.lock().unwrap(); loop { buf.clear(); - match tauri_utils::io::read_line(&mut stderr, &mut buf) { - Ok(s) if s == 0 => break, - _ => (), + if let Ok(0) = tauri_utils::io::read_line(&mut stderr, &mut buf) { + break; } debug!(action = "stderr"; "{}", String::from_utf8_lossy(&buf)); lines.extend(buf.clone()); diff --git a/tooling/cli/CHANGELOG.md b/tooling/cli/CHANGELOG.md index ddd901ef9d18..7256c9684701 100644 --- a/tooling/cli/CHANGELOG.md +++ b/tooling/cli/CHANGELOG.md @@ -1,5 +1,45 @@ # Changelog +## \[2.0.0-alpha.15] + +### New Features + +- [`b2f17723`](https://www.github.com/tauri-apps/tauri/commit/b2f17723a415f04c2620132a6305eb138d7cb47f)([#7971](https://www.github.com/tauri-apps/tauri/pull/7971)) Use `devicectl` to connect to iOS 17+ devices on macOS 14+. + +### Bug Fixes + +- [`100d9ede`](https://www.github.com/tauri-apps/tauri/commit/100d9ede35995d9db21d2087dd5606adfafb89a5)([#7802](https://www.github.com/tauri-apps/tauri/pull/7802)) Properly read platform-specific configuration files for mobile targets. +- [`228e5a4c`](https://www.github.com/tauri-apps/tauri/commit/228e5a4c76ad5f97409c912d07699b49ba4bb162)([#7902](https://www.github.com/tauri-apps/tauri/pull/7902)) Fixes `icon` command not writing files to the correct Android project folders. + +### Dependencies + +- Upgraded to `tauri-utils@2.0.0-alpha.8` +- Upgraded to `tauri-bundler@2.0.0-alpha.9` + +## \[2.0.0-alpha.14] + +### Breaking Changes + +- [`d5074af5`](https://www.github.com/tauri-apps/tauri/commit/d5074af562b2b5cb6c5711442097c4058af32db6)([#7801](https://www.github.com/tauri-apps/tauri/pull/7801)) The custom protocol on Android now uses the `http` scheme instead of `https`. + +## \[2.0.0-alpha.13] + +### Breaking Changes + +- [`4cb51a2d`](https://www.github.com/tauri-apps/tauri/commit/4cb51a2d56cfcae0749062c79ede5236bd8c02c2)([#7779](https://www.github.com/tauri-apps/tauri/pull/7779)) The custom protocol on Windows now uses the `http` scheme instead of `https`. +- [`974e38b4`](https://www.github.com/tauri-apps/tauri/commit/974e38b4ddc198530aa977ec77d513b76013b9f3)([#7744](https://www.github.com/tauri-apps/tauri/pull/7744)) Renamed the `plugin add` command to `add`. + +## \[2.0.0-alpha.12] + +### Bug Fixes + +- [`b75a1210`](https://www.github.com/tauri-apps/tauri/commit/b75a1210bed589187678861d7314ae6279bf7c87)([#7762](https://www.github.com/tauri-apps/tauri/pull/7762)) Fixes a regression on alpha.11 where iOS logs aren't being displayed when using `ios dev` with a real device. +- [`8faa5a4a`](https://www.github.com/tauri-apps/tauri/commit/8faa5a4a1238a44ca7b54d2084aaed553ac2a1ba)([#7765](https://www.github.com/tauri-apps/tauri/pull/7765)) Ensure asset directory exists on the iOS project. + +### Dependencies + +- Upgraded to `tauri-bundler@2.0.0-alpha.8` + ## \[2.0.0-alpha.11] ### New Features diff --git a/tooling/cli/Cargo.lock b/tooling/cli/Cargo.lock index 65e18ef21a90..5d937182d991 100644 --- a/tooling/cli/Cargo.lock +++ b/tooling/cli/Cargo.lock @@ -2,6 +2,15 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli", +] + [[package]] name = "adler" version = "1.0.2" @@ -26,9 +35,9 @@ dependencies = [ [[package]] name = "aes" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "433cfd6710c9986c576a25ca913c39d66a6474107b406f34f91d4a8923395241" +checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" dependencies = [ "cfg-if", "cipher", @@ -37,9 +46,9 @@ dependencies = [ [[package]] name = "aes-gcm" -version = "0.10.2" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "209b47e8954a928e1d72e86eca7000ebb6655fe1436d33eefc2201cad027e237" +checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1" dependencies = [ "aead", "aes", @@ -56,7 +65,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ "cfg-if", - "getrandom 0.2.9", + "getrandom 0.2.10", "once_cell", "serde", "version_check", @@ -64,21 +73,18 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.20" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +checksum = "ea5d730647d4fadd988536d06fecce94b7b4f2a7efdae548f1cf4b63205518ab" dependencies = [ "memchr", ] [[package]] -name = "aho-corasick" -version = "1.0.1" +name = "android-tzdata" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04" -dependencies = [ - "memchr", -] +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" [[package]] name = "android_system_properties" @@ -91,30 +97,29 @@ dependencies = [ [[package]] name = "anstream" -version = "0.3.2" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" +checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", - "is-terminal", "utf8parse", ] [[package]] name = "anstyle" -version = "1.0.0" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" [[package]] name = "anstyle-parse" -version = "0.2.0" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee" +checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" dependencies = [ "utf8parse", ] @@ -130,9 +135,9 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "1.0.1" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" +checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" dependencies = [ "anstyle", "windows-sys 0.48.0", @@ -140,9 +145,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.71" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" [[package]] name = "ar" @@ -152,34 +157,28 @@ checksum = "d67af77d68a931ecd5cbd8a3b5987d63a1d1d1278f7f6a60ae33db485cdebb69" [[package]] name = "arrayvec" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" - -[[package]] -name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "async-lock" -version = "2.7.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa24f727524730b077666307f2734b4a1a1c57acb79193127dcc8914d5242dd7" +checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" dependencies = [ "event-listener", ] [[package]] name = "async-trait" -version = "0.1.68" +version = "0.1.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" +checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.17", + "syn 2.0.37", ] [[package]] @@ -214,7 +213,7 @@ dependencies = [ "http", "http-body", "hyper", - "itoa 1.0.6", + "itoa 1.0.9", "matchit", "memchr", "mime", @@ -249,6 +248,21 @@ dependencies = [ "tower-service", ] +[[package]] +name = "backtrace" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + [[package]] name = "base64" version = "0.13.1" @@ -257,9 +271,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.2" +version = "0.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" +checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" [[package]] name = "beef" @@ -299,9 +313,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.3.3" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" +checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" [[package]] name = "bitness" @@ -341,9 +355,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.5.0" +version = "1.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a246e68bb43f6cd9db24bea052a53e40405417c5fb372e3d1a8a7f770a564ef5" +checksum = "4c2f7349907b712260e64b0afe2f84692af14a454be26187d9df565c7f69266a" dependencies = [ "memchr", "serde", @@ -351,21 +365,21 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.13.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "bytecount" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c676a478f63e9fa2dd5368a42f28bba0d6c560b775f38583c8bbaa7fcd67c9c" +checksum = "ad152d03a2c813c80bb94fedbf3a3f02b28f793e39e7c214c8a0bcc196343de7" [[package]] name = "bytemuck" -version = "1.13.1" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17febce684fd15d89027105661fec94afb475cb995fbc59d2865198446ba2eea" +checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" [[package]] name = "byteorder" @@ -375,15 +389,59 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" + +[[package]] +name = "cargo-mobile2" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1b56286cbb6fa6c603c849c79b7e38e062d532b227a24ad6ff9d535965f95c5" +dependencies = [ + "cocoa", + "colored 1.9.4", + "core-foundation 0.9.3", + "deunicode", + "duct", + "dunce", + "embed-resource", + "english-numbers", + "freedesktop_entry_parser", + "handlebars", + "heck", + "home", + "ignore", + "indexmap 1.9.3", + "java-properties", + "lexical-core", + "libc", + "log", + "objc", + "objc_id", + "once-cell-regex", + "openssl", + "os_info", + "os_pipe", + "path_abs", + "serde", + "serde_json", + "textwrap", + "thiserror", + "toml", + "ureq", + "which", + "windows 0.39.0", +] [[package]] name = "cc" -version = "1.0.79" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] [[package]] name = "cfb" @@ -404,15 +462,15 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.24" +version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e3c5919066adf22df73762e50cffcde3a758f2a848b113b586d1f86728b673b" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" dependencies = [ + "android-tzdata", "iana-time-zone", - "num-integer", "num-traits", "serde", - "winapi", + "windows-targets 0.48.5", ] [[package]] @@ -427,54 +485,52 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.0" +version = "4.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93aae7a4192245f70fe75dd9157fc7b4a5bf53e88d30bd4396f7d8f9284d5acc" +checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956" dependencies = [ "clap_builder", "clap_derive", - "once_cell", ] [[package]] name = "clap_builder" -version = "4.3.0" +version = "4.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f423e341edefb78c9caba2d9c7f7687d0e72e89df3ce3394554754393ac3990" +checksum = "0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45" dependencies = [ "anstream", "anstyle", - "bitflags 1.3.2", "clap_lex", "strsim", ] [[package]] name = "clap_complete" -version = "4.3.0" +version = "4.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a04ddfaacc3bc9e6ea67d024575fafc2a813027cf374b8f24f7bc233c6b6be12" +checksum = "e3ae8ba90b9d8b007efe66e55e48fb936272f5ca00349b5b0e89877520d35ea7" dependencies = [ "clap", ] [[package]] name = "clap_derive" -version = "4.3.0" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "191d9573962933b4027f932c600cd252ce27a8ad5979418fe78e43c07996f27b" +checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.17", + "syn 2.0.37", ] [[package]] name = "clap_lex" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" +checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" [[package]] name = "cocoa" @@ -505,24 +561,24 @@ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "colored" -version = "1.9.3" +version = "1.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4ffc801dacf156c5854b9df4f425a626539c3a6ef7893cc0c5084a23f0b6c59" +checksum = "5a5f741c91823341bebf717d4c71bda820630ce065443b58bd1b7451af008355" dependencies = [ - "atty", + "is-terminal", "lazy_static", "winapi", ] [[package]] name = "colored" -version = "2.0.0" +version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3616f750b84d8f0de8a58bda93e08e2a81ad3f523089b05f1dffecab48c6cbd" +checksum = "2674ec482fbc38012cf31e6c42ba0177b431a0cb6f15fe40efa5aab1bda516f6" dependencies = [ - "atty", + "is-terminal", "lazy_static", - "winapi", + "windows-sys 0.48.0", ] [[package]] @@ -624,9 +680,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.7" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c1eaa2012c47becbbad2ab175484c2a84d1185b566fb2cc5b8707343dfe58" +checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" dependencies = [ "libc", ] @@ -663,9 +719,9 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.14" +version = "0.9.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695" +checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" dependencies = [ "autocfg", "cfg-if", @@ -676,9 +732,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" dependencies = [ "cfg-if", ] @@ -725,12 +781,12 @@ dependencies = [ [[package]] name = "cssparser-macros" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfae75de57f2b2e85e8768c3ea840fd159c8f33e2b6522c7835b7abac81be16e" +checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" dependencies = [ "quote", - "syn 1.0.109", + "syn 2.0.37", ] [[package]] @@ -745,12 +801,12 @@ dependencies = [ [[package]] name = "ctor" -version = "0.2.0" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd4056f63fce3b82d852c3da92b08ea59959890813a7f4ce9c0ff85b10cf301b" +checksum = "37e366bff8cd32dd8754b0991fb66b279dc48f598c3a18914852a6673deef583" dependencies = [ "quote", - "syn 2.0.17", + "syn 2.0.37", ] [[package]] @@ -764,9 +820,9 @@ dependencies = [ [[package]] name = "ctrlc" -version = "3.3.1" +version = "3.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7394a21d012ce5c850497fb774b167d81b99f060025fbf06ee92b9848bd97eb2" +checksum = "82e95fbd621905b854affdc67943b043a0fbb6ed7385fd5a25650d19a8a6cfdf" dependencies = [ "nix", "windows-sys 0.48.0", @@ -774,9 +830,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.1" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0558d22a7b463ed0241e993f76f09f30b126687447751a8638587b864e4b3944" +checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" dependencies = [ "darling_core", "darling_macro", @@ -784,27 +840,27 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.1" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab8bfa2e259f8ee1ce5e97824a3c55ec4404a0d772ca7fa96bf19f0752a046eb" +checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", "strsim", - "syn 2.0.17", + "syn 2.0.37", ] [[package]] name = "darling_macro" -version = "0.20.1" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29a358ff9f12ec09c3e61fef9b5a9902623a695a46a917b07f269bff1445611a" +checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core", "quote", - "syn 2.0.17", + "syn 2.0.37", ] [[package]] @@ -813,6 +869,15 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7762d17f1241643615821a8455a0b2c3e803784b058693d990b11f2dce25a0ca" +[[package]] +name = "deranged" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946" +dependencies = [ + "serde", +] + [[package]] name = "derive_more" version = "0.99.17" @@ -828,9 +893,9 @@ dependencies = [ [[package]] name = "deunicode" -version = "1.3.3" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c1bba4f227a4a53d12b653f50ca7bf10c9119ae2aba56aff9e0338b5c98f36a" +checksum = "890d779e1bc371e4fa7727ef6d29a9346be20ddfe40cd8c744cd083ce0640b15" [[package]] name = "dialoguer" @@ -887,15 +952,15 @@ dependencies = [ [[package]] name = "dtoa" -version = "0.4.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0" +checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" [[package]] name = "dtoa-short" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bde03329ae10e79ede66c9ce4dc930aa8599043b0743008548680f25b91502d6" +checksum = "dbaceec3c6e4211c79e7b1800fb9680527106beb2f9c51904a3210c03a448c74" dependencies = [ "dtoa", ] @@ -920,15 +985,15 @@ checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" [[package]] name = "dyn-clone" -version = "1.0.11" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b0cf012f1230e43cd00ebb729c6bb58707ecfa8ad08b52ef3a4ccd2697fc30" +checksum = "23d2f3407d9a573d666de4b5bdf10569d73ca9478087346697dcbae6244bfbcd" [[package]] name = "either" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "embed-resource" @@ -1015,9 +1080,9 @@ checksum = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569" [[package]] name = "encoding_rs" -version = "0.8.32" +version = "0.8.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" dependencies = [ "cfg-if", ] @@ -1041,20 +1106,26 @@ dependencies = [ "termcolor", ] +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + [[package]] name = "erased-serde" -version = "0.3.25" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f2b0c2380453a92ea8b6c8e5f64ecaafccddde8ceab55ff7a8ac1029f894569" +checksum = "6c138974f9d5e7fe373eb04df7cae98833802ae4b11c24ac7039a21d5af4b26c" dependencies = [ "serde", ] [[package]] name = "errno" -version = "0.3.1" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" +checksum = "add4f07d43996f76ef320709726a556a9d4f965d9410d8d0271132d2f8293480" dependencies = [ "errno-dragonfly", "libc", @@ -1079,15 +1150,15 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "exr" -version = "1.6.3" +version = "1.71.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdd2162b720141a91a054640662d3edce3d50a944a50ffca5313cd951abb35b4" +checksum = "832a761f35ab3e6664babfbdc6cef35a4860e816ec3916dcfd0882954e98a8a8" dependencies = [ "bit_field", "flume", "half", "lebe", - "miniz_oxide 0.6.2", + "miniz_oxide", "rayon-core", "smallvec", "zune-inflate", @@ -1105,9 +1176,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "fdeflate" @@ -1120,36 +1191,32 @@ dependencies = [ [[package]] name = "filetime" -version = "0.2.21" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cbc844cecaee9d4443931972e1289c8ff485cb4cc2767cb03ca139ed6885153" +checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.2.16", + "redox_syscall 0.3.5", "windows-sys 0.48.0", ] [[package]] name = "flate2" -version = "1.0.26" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" +checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" dependencies = [ "crc32fast", - "miniz_oxide 0.7.1", + "miniz_oxide", ] [[package]] name = "flume" -version = "0.10.14" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577" +checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" dependencies = [ - "futures-core", - "futures-sink", - "nanorand", - "pin-project", "spin 0.9.8", ] @@ -1176,9 +1243,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ "percent-encoding", ] @@ -1266,7 +1333,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.17", + "syn 2.0.37", ] [[package]] @@ -1337,15 +1404,13 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", - "js-sys", "libc", "wasi 0.11.0+wasi-snapshot-preview1", - "wasm-bindgen", ] [[package]] @@ -1368,6 +1433,12 @@ dependencies = [ "weezl", ] +[[package]] +name = "gimli" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" + [[package]] name = "glob" version = "0.3.1" @@ -1376,11 +1447,11 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "globset" -version = "0.4.10" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc" +checksum = "759c97c1e17c55525b57192c06a267cda0ac5210b222d6b82189a2338fa1c13d" dependencies = [ - "aho-corasick 0.7.20", + "aho-corasick", "bstr", "fnv", "log", @@ -1389,9 +1460,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.19" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d357c7ae988e7d2182f7d7871d0b963962420b0678b0997ce7de72001aeab782" +checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" dependencies = [ "bytes", "fnv", @@ -1399,7 +1470,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap", + "indexmap 1.9.3", "slab", "tokio", "tokio-util", @@ -1417,23 +1488,9 @@ dependencies = [ [[package]] name = "handlebars" -version = "3.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4498fc115fa7d34de968184e473529abb40eeb6be8bc5f7faba3d08c316cb3e3" -dependencies = [ - "log", - "pest", - "pest_derive", - "quick-error", - "serde", - "serde_json", -] - -[[package]] -name = "handlebars" -version = "4.3.7" +version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83c3372087601b532857d332f5957cbae686da52bb7810bf038c3e3c3cc2fa0d" +checksum = "c39b3bc2a8f715298032cf5087e58573809374b08160aa7d750582bdb82d2683" dependencies = [ "log", "pest", @@ -1458,6 +1515,12 @@ dependencies = [ "ahash", ] +[[package]] +name = "hashbrown" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dfda62a12f55daeae5015f81b0baea145391cb4520f86c248fc615d72640d12" + [[package]] name = "heck" version = "0.4.1" @@ -1478,18 +1541,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] - -[[package]] -name = "hermit-abi" -version = "0.3.1" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" [[package]] name = "hex" @@ -1515,20 +1569,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "html5ever" -version = "0.25.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5c13fb08e5d4dfc151ee5e88bae63f7773d61852f3bdc73c9f4b9e1bde03148" -dependencies = [ - "log", - "mac", - "markup5ever 0.10.1", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "html5ever" version = "0.26.0" @@ -1537,7 +1577,7 @@ checksum = "bea68cab48b8459f17cf1c944c67ddc572d272d9f2b274140f223ecb1da4a3b7" dependencies = [ "log", "mac", - "markup5ever 0.11.0", + "markup5ever", "proc-macro2", "quote", "syn 1.0.109", @@ -1551,7 +1591,7 @@ checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" dependencies = [ "bytes", "fnv", - "itoa 1.0.6", + "itoa 1.0.9", ] [[package]] @@ -1567,9 +1607,9 @@ dependencies = [ [[package]] name = "http-range-header" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bfe8eed0a9285ef776bb792479ea3834e8b94e13d615c2f66d03dd50a435a29" +checksum = "add0ab9360ddbd88cfeb3bd9574a1d85cfdfa14db10b3e21d3700dbc4328758f" [[package]] name = "httparse" @@ -1579,9 +1619,9 @@ checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" [[package]] name = "httpdate" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "humantime" @@ -1591,9 +1631,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.26" +version = "0.14.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab302d72a6f11a3b910431ff93aae7e773078c769f0a3ef15fb9ec692ed147d4" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" dependencies = [ "bytes", "futures-channel", @@ -1604,9 +1644,9 @@ dependencies = [ "http-body", "httparse", "httpdate", - "itoa 1.0.6", + "itoa 1.0.9", "pin-project-lite", - "socket2", + "socket2 0.4.9", "tokio", "tower-service", "tracing", @@ -1615,9 +1655,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.56" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c" +checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" dependencies = [ "android_system_properties", "core-foundation-sys 0.8.4", @@ -1644,9 +1684,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -1718,6 +1758,17 @@ dependencies = [ "serde", ] +[[package]] +name = "indexmap" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" +dependencies = [ + "equivalent", + "hashbrown 0.14.1", + "serde", +] + [[package]] name = "infer" version = "0.12.0" @@ -1756,32 +1807,20 @@ dependencies = [ "generic-array", ] -[[package]] -name = "io-lifetimes" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" -dependencies = [ - "hermit-abi 0.3.1", - "libc", - "windows-sys 0.48.0", -] - [[package]] name = "ipnet" -version = "2.7.2" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12b6ee2129af8d4fb011108c73d99a1b83a85977f23b82460c0ae2e25bb4b57f" +checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" [[package]] name = "is-terminal" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ - "hermit-abi 0.3.1", - "io-lifetimes", - "rustix 0.37.19", + "hermit-abi 0.3.3", + "rustix", "windows-sys 0.48.0", ] @@ -1811,9 +1850,9 @@ checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] name = "itoa" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "java-properties" @@ -1837,18 +1876,18 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.63" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f37a4a5928311ac501dee68b3c7613a1037d0edb30c8e5427bd832d55d1b790" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" dependencies = [ "wasm-bindgen", ] [[package]] name = "json-patch" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f54898088ccb91df1b492cc80029a6fdf1c48ca0db7c6822a8babad69c94658" +checksum = "4f7765dccf8c39c3a470fc694efe322969d791e713ca46bc7b5c506886157572" dependencies = [ "serde", "serde_json", @@ -1869,9 +1908,9 @@ dependencies = [ [[package]] name = "jsonrpsee" -version = "0.16.2" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d291e3a5818a2384645fd9756362e6d89cf0541b0b916fa7702ea4a9833608e" +checksum = "367a292944c07385839818bb71c8d76611138e2dedb0677d035b8da21d29c78b" dependencies = [ "jsonrpsee-core", "jsonrpsee-server", @@ -1880,9 +1919,9 @@ dependencies = [ [[package]] name = "jsonrpsee-client-transport" -version = "0.16.2" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "965de52763f2004bc91ac5bcec504192440f0b568a5d621c59d9dbd6f886c3fb" +checksum = "c8b3815d9f5d5de348e5f162b316dc9cdf4548305ebb15b4eb9328e66cf27d7a" dependencies = [ "futures-util", "http", @@ -1898,12 +1937,12 @@ dependencies = [ [[package]] name = "jsonrpsee-core" -version = "0.16.2" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4e70b4439a751a5de7dd5ed55eacff78ebf4ffe0fc009cb1ebb11417f5b536b" +checksum = "2b5dde66c53d6dcdc8caea1874a45632ec0fcf5b437789f1e45766a1512ce803" dependencies = [ "anyhow", - "arrayvec 0.7.2", + "arrayvec", "async-lock", "async-trait", "beef", @@ -1926,9 +1965,9 @@ dependencies = [ [[package]] name = "jsonrpsee-server" -version = "0.16.2" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fb69dad85df79527c019659a992498d03f8495390496da2f07e6c24c2b356fc" +checksum = "cf4d945a6008c9b03db3354fb3c83ee02d2faa9f2e755ec1dfb69c3551b8f4ba" dependencies = [ "futures-channel", "futures-util", @@ -1948,9 +1987,9 @@ dependencies = [ [[package]] name = "jsonrpsee-types" -version = "0.16.2" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bd522fe1ce3702fd94812965d7bb7a3364b1c9aba743944c5a00529aae80f8c" +checksum = "245ba8e5aa633dd1c1e4fae72bce06e71f42d34c14a2767c6b4d173b57bee5e5" dependencies = [ "anyhow", "beef", @@ -1962,9 +2001,9 @@ dependencies = [ [[package]] name = "jsonrpsee-ws-client" -version = "0.16.2" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b83daeecfc6517cfe210df24e570fb06213533dfb990318fae781f4c7119dd9" +checksum = "4e1b3975ed5d73f456478681a417128597acd6a2487855fdb7b4a3d4d195bf5e" dependencies = [ "http", "jsonrpsee-client-transport", @@ -1986,7 +2025,7 @@ dependencies = [ "fancy-regex", "fraction", "iso8601", - "itoa 1.0.6", + "itoa 1.0.9", "lazy_static", "memchr", "num-cmp", @@ -2003,9 +2042,9 @@ dependencies = [ [[package]] name = "kqueue" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c8fc60ba15bf51257aa9807a48a61013db043fcf3a78cb0d916e8e396dcad98" +checksum = "7447f1ca1b7b563588a205fe93dea8df60fd981423a768bc1c0ded35ed147d0c" dependencies = [ "kqueue-sys", "libc", @@ -2013,26 +2052,14 @@ dependencies = [ [[package]] name = "kqueue-sys" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8367585489f01bc55dd27404dcf56b95e6da061a256a666ab23be9ba96a2e587" +checksum = "ed9625ffda8729b85e45cf04090035ac368927b8cebc34898e7c120f52e4838b" dependencies = [ "bitflags 1.3.2", "libc", ] -[[package]] -name = "kuchiki" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ea8e9c6e031377cff82ee3001dc8026cdf431ed4e2e6b51f98ab8c73484a358" -dependencies = [ - "cssparser", - "html5ever 0.25.2", - "matches", - "selectors", -] - [[package]] name = "kuchikiki" version = "0.8.2" @@ -2040,8 +2067,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f29e4755b7b995046f510a7520c42b2fed58b77bd94d5a87a8eb43d2fd126da8" dependencies = [ "cssparser", - "html5ever 0.26.0", - "indexmap", + "html5ever", + "indexmap 1.9.3", "matches", "selectors", ] @@ -2060,22 +2087,73 @@ checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" [[package]] name = "lexical-core" -version = "0.7.6" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6607c62aa161d23d17a9072cc5da0be67cdfc89d3afb1e8d9c842bebc2525ffe" +checksum = "2cde5de06e8d4c2faabc400238f9ae1c74d5412d03a7bd067645ccbc47070e46" dependencies = [ - "arrayvec 0.5.2", - "bitflags 1.3.2", - "cfg-if", - "ryu", + "lexical-parse-float", + "lexical-parse-integer", + "lexical-util", + "lexical-write-float", + "lexical-write-integer", +] + +[[package]] +name = "lexical-parse-float" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683b3a5ebd0130b8fb52ba0bdc718cc56815b6a097e28ae5a6997d0ad17dc05f" +dependencies = [ + "lexical-parse-integer", + "lexical-util", + "static_assertions", +] + +[[package]] +name = "lexical-parse-integer" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d0994485ed0c312f6d965766754ea177d07f9c00c9b82a5ee62ed5b47945ee9" +dependencies = [ + "lexical-util", + "static_assertions", +] + +[[package]] +name = "lexical-util" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5255b9ff16ff898710eb9eb63cb39248ea8a5bb036bea8085b1a767ff6c4e3fc" +dependencies = [ + "static_assertions", +] + +[[package]] +name = "lexical-write-float" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accabaa1c4581f05a3923d1b4cfd124c329352288b7b9da09e766b0668116862" +dependencies = [ + "lexical-util", + "lexical-write-integer", + "static_assertions", +] + +[[package]] +name = "lexical-write-integer" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1b6f3d1f4422866b68192d62f77bc5c700bee84f3069f2469d7bc8c77852446" +dependencies = [ + "lexical-util", "static_assertions", ] [[package]] name = "libc" -version = "0.2.147" +version = "0.2.148" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" [[package]] name = "libflate" @@ -2122,15 +2200,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" - -[[package]] -name = "linux-raw-sys" -version = "0.4.5" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" +checksum = "3852614a3bd9ca9804678ba6be5e3b8ce76dfc902cae004e3e0c44051b6e88db" [[package]] name = "local-ip-address" @@ -2146,9 +2218,9 @@ dependencies = [ [[package]] name = "lock_api" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" dependencies = [ "autocfg", "scopeguard", @@ -2156,9 +2228,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.19" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" dependencies = [ "value-bag", ] @@ -2178,20 +2250,6 @@ dependencies = [ "libc", ] -[[package]] -name = "markup5ever" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a24f40fb03852d1cdd84330cddcaf98e9ec08a7b7768e952fad3b4cf048ec8fd" -dependencies = [ - "log", - "phf 0.8.0", - "phf_codegen 0.8.0", - "string_cache", - "string_cache_codegen", - "tendril", -] - [[package]] name = "markup5ever" version = "0.11.0" @@ -2226,15 +2284,15 @@ checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771" [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] name = "memoffset" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" dependencies = [ "autocfg", ] @@ -2257,20 +2315,11 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b23ef13ff1d745b1e52397daaa247e333c607f3cff96d4df2b798dc252db974b" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", "rpassword", "scrypt", ] -[[package]] -name = "miniz_oxide" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" -dependencies = [ - "adler", -] - [[package]] name = "miniz_oxide" version = "0.7.1" @@ -2283,33 +2332,24 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.6" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.45.0", -] - -[[package]] -name = "nanorand" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" -dependencies = [ - "getrandom 0.2.9", + "windows-sys 0.48.0", ] [[package]] name = "napi" -version = "2.13.2" +version = "2.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ede2d12cd6fce44da537a4be1f5510c73be2506c2e32dfaaafd1f36968f3a0e" +checksum = "fd063c93b900149304e3ba96ce5bf210cd4f81ef5eb80ded0d100df3e85a3ac0" dependencies = [ - "bitflags 2.3.3", - "ctor 0.2.0", + "bitflags 2.4.0", + "ctor 0.2.5", "napi-derive", "napi-sys", "once_cell", @@ -2395,14 +2435,13 @@ checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" [[package]] name = "nix" -version = "0.26.2" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" +checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.0", "cfg-if", "libc", - "static_assertions", ] [[package]] @@ -2423,20 +2462,21 @@ dependencies = [ [[package]] name = "notify" -version = "6.0.0" +version = "6.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d9ba6c734de18ca27c8cef5cd7058aa4ac9f63596131e4c7e41e579319032a2" +checksum = "6205bd8bb1e454ad2e27422015fb5e4f2bcc7e08fa8f27058670d208324a4d2d" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.0", "crossbeam-channel", "filetime", "fsevent-sys", "inotify", "kqueue", "libc", + "log", "mio", "walkdir", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -2451,9 +2491,9 @@ dependencies = [ [[package]] name = "num" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43db66d1170d347f9a065114077f7dccb00c1b9478c89384490a3425279a4606" +checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af" dependencies = [ "num-bigint", "num-complex", @@ -2465,9 +2505,9 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" dependencies = [ "autocfg", "num-integer", @@ -2482,9 +2522,9 @@ checksum = "63335b2e2c34fae2fb0aa2cecfd9f0832a1e24b3b32ecec612c3426d46dc8aaa" [[package]] name = "num-complex" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e0d21255c828d6f128a1e41534206671e8c3ea0c62f32291e808dc82cff17d" +checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214" dependencies = [ "num-traits", ] @@ -2524,20 +2564,20 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" dependencies = [ "autocfg", ] [[package]] name = "num_cpus" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.2.6", + "hermit-abi 0.3.3", "libc", ] @@ -2559,6 +2599,15 @@ dependencies = [ "objc", ] +[[package]] +name = "object" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +dependencies = [ + "memchr", +] + [[package]] name = "once-cell-regex" version = "0.2.1" @@ -2571,9 +2620,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "opaque-debug" @@ -2583,11 +2632,11 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.52" +version = "0.10.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01b8574602df80f7b85fdfc5392fa884a4e3b3f4f35402c070ab34c3d3f78d56" +checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.0", "cfg-if", "foreign-types", "libc", @@ -2604,7 +2653,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.17", + "syn 2.0.37", ] [[package]] @@ -2615,18 +2664,18 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-src" -version = "111.25.3+1.1.1t" +version = "300.1.5+3.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "924757a6a226bf60da5f7dd0311a34d2b52283dd82ddeb103208ddc66362f80c" +checksum = "559068e4c12950d7dcaa1857a61725c0d38d4fc03ff8e070ab31a75d6e316491" dependencies = [ "cc", ] [[package]] name = "openssl-sys" -version = "0.9.87" +version = "0.9.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e17f59264b2809d77ae94f0e1ebabc434773f370d6ca667bd223ea10e06cc7e" +checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d" dependencies = [ "cc", "libc", @@ -2677,15 +2726,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.7" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.2.16", + "redox_syscall 0.3.5", "smallvec", - "windows-sys 0.45.0", + "windows-targets 0.48.5", ] [[package]] @@ -2702,9 +2751,9 @@ dependencies = [ [[package]] name = "pbkdf2" -version = "0.12.1" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0ca0b5a68607598bf3bad68f32227a8164f6254833f84eafaac409cd6746c31" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" dependencies = [ "digest 0.10.7", "hmac", @@ -2712,25 +2761,26 @@ dependencies = [ [[package]] name = "percent-encoding" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pest" -version = "2.6.0" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e68e84bfb01f0507134eac1e9b410a12ba379d064eab48c50ba4ce329a527b70" +checksum = "c022f1e7b65d6a24c0dbbd5fb344c66881bc01f3e5ae74a1c8100f2f985d98a4" dependencies = [ + "memchr", "thiserror", "ucd-trie", ] [[package]] name = "pest_derive" -version = "2.6.0" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b79d4c71c865a25a4322296122e3924d30bc8ee0834c8bfc8b95f7f054afbfb" +checksum = "35513f630d46400a977c4cb58f78e1bfbe01434316e60c37d27b9ad6139c66d8" dependencies = [ "pest", "pest_generator", @@ -2738,22 +2788,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.6.0" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c435bf1076437b851ebc8edc3a18442796b30f1728ffea6262d59bbe28b077e" +checksum = "bc9fc1b9e7057baba189b5c626e2d6f40681ae5b6eb064dc7c7834101ec8123a" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.17", + "syn 2.0.37", ] [[package]] name = "pest_meta" -version = "2.6.0" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "745a452f8eb71e39ffd8ee32b3c5f51d03845f99786fa9b68db6ff509c505411" +checksum = "1df74e9e7ec4053ceb980e7c0c8bd3594e977fde1af91daba9c928e8e8c6708d" dependencies = [ "once_cell", "pest", @@ -2870,29 +2920,29 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.0" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c95a7476719eab1e366eaf73d0260af3021184f18177925b07f54b30089ceead" +checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.0" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39407670928234ebc5e6e580247dd567ad73a3578460c5990f9503df207e8f07" +checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.17", + "syn 2.0.37", ] [[package]] name = "pin-project-lite" -version = "0.2.9" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "pin-utils" @@ -2908,12 +2958,12 @@ checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] name = "plist" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bd9647b268a3d3e14ff09c23201133a62589c658db02bb7388c7246aafe0590" +checksum = "bdc0001cfea3db57a2e24bc0d818e9e20e554b5f97fabb9bc231dc240269ae06" dependencies = [ - "base64 0.21.2", - "indexmap", + "base64 0.21.4", + "indexmap 1.9.3", "line-wrap", "quick-xml", "serde", @@ -2922,22 +2972,22 @@ dependencies = [ [[package]] name = "png" -version = "0.17.8" +version = "0.17.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaeebc51f9e7d2c150d3f3bfeb667f2aa985db5ef1e3d212847bdedb488beeaa" +checksum = "dd75bf2d8dd3702b9707cdbc56a5b9ef42cec752eb8b3bafc01234558442aa64" dependencies = [ "bitflags 1.3.2", "crc32fast", "fdeflate", "flate2", - "miniz_oxide 0.7.1", + "miniz_oxide", ] [[package]] name = "polyval" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef234e08c11dfcb2e56f79fd70f6f2eb7f025c0ce2333e82f4f0518ecad30c6" +checksum = "d52cff9d1d4dee5fe6d03729099f4a310a41179e0a10dbf542039873f2e826fb" dependencies = [ "cfg-if", "cpufeatures", @@ -2965,9 +3015,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.59" +version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b" +checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328" dependencies = [ "unicode-ident", ] @@ -2981,26 +3031,20 @@ dependencies = [ "bytemuck", ] -[[package]] -name = "quick-error" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" - [[package]] name = "quick-xml" -version = "0.28.2" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce5e73202a820a31f8a0ee32ada5e21029c81fd9e3ebf668a40832e4219d9d1" +checksum = "81b9228215d82c7b61490fec1de287136b5de6f5700f6e58ea9ad61a7964ca51" dependencies = [ "memchr", ] [[package]] name = "quote" -version = "1.0.28" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -3065,7 +3109,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", ] [[package]] @@ -3088,9 +3132,9 @@ dependencies = [ [[package]] name = "rayon" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" +checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" dependencies = [ "either", "rayon-core", @@ -3098,14 +3142,12 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" +checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" dependencies = [ - "crossbeam-channel", "crossbeam-deque", "crossbeam-utils", - "num_cpus", ] [[package]] @@ -3132,35 +3174,47 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", "redox_syscall 0.2.16", "thiserror", ] [[package]] name = "regex" -version = "1.8.3" +version = "1.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebee201405406dbf528b8b672104ae6d6d63e6d118cb10e4d51abbc7b58044ff" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81ca098a9821bd52d6b24fd8b10bd081f47d39c22778cafaa75a2857a62c6390" +checksum = "59b23e92ee4318893fa3fe3e6fb365258efbfe6ac6ab30f090cdcbb7aa37efa9" dependencies = [ - "aho-corasick 1.0.1", + "aho-corasick", "memchr", "regex-syntax", ] [[package]] name = "regex-syntax" -version = "0.7.2" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" +checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" [[package]] name = "reqwest" -version = "0.11.18" +version = "0.11.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" +checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" dependencies = [ - "base64 0.21.2", + "base64 0.21.4", "bytes", "encoding_rs", "futures-core", @@ -3179,13 +3233,14 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", + "system-configuration", "tokio", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "winreg 0.10.1", + "winreg 0.50.0", ] [[package]] @@ -3230,6 +3285,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + [[package]] name = "rustc-hash" version = "1.1.0" @@ -3247,36 +3308,22 @@ dependencies = [ [[package]] name = "rustix" -version = "0.37.19" +version = "0.38.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" +checksum = "d2f9da0cbd88f9f09e7814e388301c8414c51c62aa6ce1e4b5c551d49d96e531" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.0", "errno", - "io-lifetimes", "libc", - "linux-raw-sys 0.3.8", - "windows-sys 0.48.0", -] - -[[package]] -name = "rustix" -version = "0.38.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "172891ebdceb05aa0005f533a6cbfca599ddd7d966f6f5d4d9b2e70478e70399" -dependencies = [ - "bitflags 2.3.3", - "errno", - "libc", - "linux-raw-sys 0.4.5", + "linux-raw-sys", "windows-sys 0.48.0", ] [[package]] name = "rustls" -version = "0.21.2" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e32ca28af694bc1bbf399c33a516dbdf1c90090b8ab23c2bc24f834aa2247f5f" +checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" dependencies = [ "log", "ring", @@ -3286,9 +3333,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.100.1" +version = "0.101.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6207cd5ed3d8dca7816f8f3725513a34609c0c765bf652b8c3cb4cfd87db46b" +checksum = "3c7d5dece342910d9ba34d259310cae3e0154b873b35408b787b59bce53d34fe" dependencies = [ "ring", "untrusted", @@ -3296,9 +3343,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.13" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "safemem" @@ -3326,18 +3373,18 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.21" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" +checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" dependencies = [ - "windows-sys 0.42.0", + "windows-sys 0.48.0", ] [[package]] name = "schemars" -version = "0.8.12" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02c613288622e5f0c3fdc5dbd4db1c5fbe752746b1d1a56a0630b78fd00de44f" +checksum = "1f7b0ce13155372a76ee2e1c5ffba1fe61ede73fbea5630d61eee6fac4929c0c" dependencies = [ "dyn-clone", "schemars_derive", @@ -3348,9 +3395,9 @@ dependencies = [ [[package]] name = "schemars_derive" -version = "0.8.12" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "109da1e6b197438deb6db99952990c7f959572794b80ff93707d55a232545e7c" +checksum = "e85e2a16b12bdb763244c69ab79363d71db2b4b918a2def53f80b02e0574b13c" dependencies = [ "proc-macro2", "quote", @@ -3360,9 +3407,9 @@ dependencies = [ [[package]] name = "scopeguard" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "scrypt" @@ -3387,9 +3434,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.9.1" +version = "2.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fc758eb7bffce5b308734e9b0c1468893cae9ff70ebf13e7090be8dcbcc83a8" +checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" dependencies = [ "bitflags 1.3.2", "core-foundation 0.9.3", @@ -3400,9 +3447,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.9.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f51d0c0d83bec45f16480d0ce0058397a69e48fcdc52d1dc8855fb68acbd31a7" +checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" dependencies = [ "core-foundation-sys 0.8.4", "libc", @@ -3430,15 +3477,15 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.17" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" +checksum = "ad977052201c6de01a8ef2aa3378c4bd23217a056337d1d6da40468d267a4fb0" [[package]] name = "serde" -version = "1.0.163" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2" +checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" dependencies = [ "serde_derive", ] @@ -3455,13 +3502,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.163" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e" +checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.17", + "syn 2.0.37", ] [[package]] @@ -3486,11 +3533,11 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.96" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" +checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" dependencies = [ - "itoa 1.0.6", + "itoa 1.0.9", "ryu", "serde", ] @@ -3502,65 +3549,38 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" dependencies = [ "form_urlencoded", - "itoa 1.0.6", + "itoa 1.0.9", "ryu", "serde", ] [[package]] name = "serde_with" -version = "2.3.3" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07ff71d2c147a7b57362cead5e22f772cd52f6ab31cfcd9edcd7f6aeb2a0afbe" +checksum = "1ca3b16a3d82c4088f343b7480a93550b3eabe1a358569c2dfe38bbcead07237" dependencies = [ - "base64 0.13.1", + "base64 0.21.4", "chrono", "hex", - "indexmap", + "indexmap 1.9.3", + "indexmap 2.0.2", "serde", "serde_json", - "serde_with_macros 2.3.3", + "serde_with_macros", "time", ] -[[package]] -name = "serde_with" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f02d8aa6e3c385bf084924f660ce2a3a6bd333ba55b35e8590b321f35d88513" -dependencies = [ - "base64 0.21.2", - "chrono", - "hex", - "indexmap", - "serde", - "serde_json", - "serde_with_macros 3.0.0", - "time", -] - -[[package]] -name = "serde_with_macros" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.17", -] - [[package]] name = "serde_with_macros" -version = "3.0.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edc7d5d3932fb12ce722ee5e64dd38c504efba37567f0c402f6ca728c3b8b070" +checksum = "2e6be15c453eb305019bfa438b1593c731f36a289a7853f7707ee29e870b3b3c" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.17", + "syn 2.0.37", ] [[package]] @@ -3621,9 +3641,9 @@ dependencies = [ [[package]] name = "sha1" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", "cpufeatures", @@ -3638,9 +3658,9 @@ checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012" [[package]] name = "sha2" -version = "0.10.6" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", @@ -3665,30 +3685,30 @@ checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" [[package]] name = "simd-adler32" -version = "0.3.5" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "238abfbb77c1915110ad968465608b68e869e0772622c9656714e73e5a1a522f" +checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" [[package]] name = "siphasher" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" [[package]] name = "slab" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg", ] [[package]] name = "smallvec" -version = "1.10.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" [[package]] name = "socket2" @@ -3700,6 +3720,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "socket2" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + [[package]] name = "soketto" version = "0.7.1" @@ -3805,15 +3835,15 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "sval" -version = "2.5.0" +version = "2.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e6aa16ce8d9e472e21a528a52c875a76a49190f3968f2ec7e9b550ccc28b410" +checksum = "9f9150edabce0ada1e9b44f98d52817ba0fba9d572898da47e354a14a3eb406d" [[package]] name = "sval_buffer" -version = "2.5.0" +version = "2.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "905c4373621186ee9637464b0aaa026389ea9e7f841f2225f160a32ba5d5bac4" +checksum = "4fb08e361c8fbbc37fb3d08dc067a98207062d083ee5ef0b21e3739b16e69892" dependencies = [ "sval", "sval_ref", @@ -3821,49 +3851,49 @@ dependencies = [ [[package]] name = "sval_dynamic" -version = "2.5.0" +version = "2.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad6b4988322c5f22859a6a7649fa1249aa3dd01514caf8ed57d83735f997bb8b" +checksum = "ae417f3812ea4403cd0cc0819628427ef6e099d5f482d80ed4e0f92836c51a85" dependencies = [ "sval", ] [[package]] name = "sval_fmt" -version = "2.5.0" +version = "2.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d3ccd10346f925c2fbd97b75e8573b38e34431bfba04cc531cd23aad0fbabb8" +checksum = "97a898ac59b0f7a0344d0ac0f408908f545d422ffbfe46522a5cdff3ed391650" dependencies = [ - "itoa 1.0.6", + "itoa 1.0.9", "ryu", "sval", ] [[package]] name = "sval_json" -version = "2.5.0" +version = "2.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a12e1488defd6344e23243c17ea4a1b185c547968749e8a281373fde0bde2d5" +checksum = "c63eda4f68a4df3d58f0c9805983560c1de8bf414800a990be25e433d1cccc8c" dependencies = [ - "itoa 1.0.6", + "itoa 1.0.9", "ryu", "sval", ] [[package]] name = "sval_ref" -version = "2.5.0" +version = "2.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b797fc4b284dd0e45f7ec424479e604ea5be9bb191a1ef4e96c20c7685649938" +checksum = "87e59d69dac5af4c6b87c79b52581a5b9ab9cc2d019775dea318967ea3c3effd" dependencies = [ "sval", ] [[package]] name = "sval_serde" -version = "2.5.0" +version = "2.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "810fa9a837e67a23e0efa7536250fc4d24043306cc1efd076f1943ba2fc2e62d" +checksum = "93d72e44618c14d0f8aff885af8184a3579ffa0d9ad5b1fbffc59f85d6739982" dependencies = [ "serde", "sval", @@ -3884,9 +3914,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.17" +version = "2.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45b6ddbb36c5b969c182aec3c4a0bce7df3fbad4b77114706a49aacc80567388" +checksum = "7303ef2c05cd654186cb250d29049a24840ca25d2747c25c0381c8d9e2f582e8" dependencies = [ "proc-macro2", "quote", @@ -3912,6 +3942,27 @@ dependencies = [ "walkdir", ] +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags 1.3.2", + "core-foundation 0.9.3", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys 0.8.4", + "libc", +] + [[package]] name = "tar" version = "0.4.40" @@ -3925,7 +3976,7 @@ dependencies = [ [[package]] name = "tauri-bundler" -version = "2.0.0-alpha.7" +version = "2.0.0-alpha.9" dependencies = [ "anyhow", "ar", @@ -3933,7 +3984,7 @@ dependencies = [ "dirs-next", "dunce", "glob", - "handlebars 4.3.7", + "handlebars", "heck", "hex", "image", @@ -3952,7 +4003,7 @@ dependencies = [ "strsim", "tar", "tauri-icns", - "tauri-utils 2.0.0-alpha.7", + "tauri-utils 2.0.0-alpha.8", "tempfile", "thiserror", "time", @@ -3965,24 +4016,25 @@ dependencies = [ [[package]] name = "tauri-cli" -version = "2.0.0-alpha.11" +version = "2.0.0-alpha.15" dependencies = [ "anyhow", "axum", - "base64 0.21.2", + "base64 0.21.4", + "cargo-mobile2", "cc", "clap", "clap_complete", - "colored 2.0.0", + "colored 2.0.4", "common-path", "css-color", "ctrlc", "dialoguer", "duct", "env_logger", - "handlebars 4.3.7", + "handlebars", "heck", - "html5ever 0.26.0", + "html5ever", "ignore", "image", "include_dir", @@ -4012,9 +4064,8 @@ dependencies = [ "sublime_fuzzy", "tauri-bundler", "tauri-icns", - "tauri-mobile", - "tauri-utils 1.3.0", - "tauri-utils 2.0.0-alpha.7", + "tauri-utils 1.5.0", + "tauri-utils 2.0.0-alpha.8", "textwrap", "thiserror", "tokio", @@ -4048,68 +4099,30 @@ dependencies = [ "png", ] -[[package]] -name = "tauri-mobile" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d71d0a35c86cb9707ebb800a37c19fb90ee2d346db2d036c54c344e6839b32" -dependencies = [ - "cocoa", - "colored 1.9.3", - "core-foundation 0.7.0", - "deunicode", - "duct", - "dunce", - "embed-resource", - "english-numbers", - "freedesktop_entry_parser", - "handlebars 3.5.5", - "heck", - "home", - "ignore", - "indexmap", - "java-properties", - "lexical-core", - "libc", - "log", - "objc", - "objc_id", - "once-cell-regex", - "openssl", - "os_pipe", - "path_abs", - "serde", - "serde_json", - "textwrap", - "thiserror", - "toml", - "ureq", - "which", - "windows 0.39.0", -] - [[package]] name = "tauri-utils" -version = "1.3.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a6f9c2dafef5cbcf52926af57ce9561bd33bb41d7394f8bb849c0330260d864" +checksum = "34d55e185904a84a419308d523c2c6891d5e2dbcee740c4997eb42e75a7b0f46" dependencies = [ "aes-gcm", "ctor 0.1.26", - "getrandom 0.2.9", + "dunce", + "getrandom 0.2.10", "heck", - "html5ever 0.25.2", + "html5ever", "infer", "json-patch", "json5", - "kuchiki", + "kuchikiki", + "log", "memchr", "phf 0.10.1", "schemars", "semver", "serde", "serde_json", - "serde_with 2.3.3", + "serde_with", "serialize-to-javascript", "thiserror", "toml", @@ -4119,26 +4132,27 @@ dependencies = [ [[package]] name = "tauri-utils" -version = "2.0.0-alpha.7" +version = "2.0.0-alpha.8" dependencies = [ "aes-gcm", "ctor 0.1.26", "dunce", - "getrandom 0.2.9", + "getrandom 0.2.10", "glob", "heck", - "html5ever 0.26.0", + "html5ever", "infer", "json-patch", "json5", "kuchikiki", + "log", "memchr", "phf 0.10.1", "schemars", "semver", "serde", "serde_json", - "serde_with 3.0.0", + "serde_with", "serialize-to-javascript", "thiserror", "toml", @@ -4149,14 +4163,14 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.7.1" +version = "3.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc02fddf48964c42031a0b3fe0428320ecf3a73c401040fc0096f97794310651" +checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" dependencies = [ "cfg-if", "fastrand", "redox_syscall 0.3.5", - "rustix 0.38.7", + "rustix", "windows-sys 0.48.0", ] @@ -4183,9 +4197,9 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64" dependencies = [ "winapi-util", ] @@ -4208,22 +4222,22 @@ checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c" [[package]] name = "thiserror" -version = "1.0.40" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" +checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.40" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" +checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.17", + "syn 2.0.37", ] [[package]] @@ -4249,11 +4263,12 @@ dependencies = [ [[package]] name = "time" -version = "0.3.21" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3403384eaacbca9923fa06940178ac13e4edb725486d70e8e15881d0c836cc" +checksum = "426f806f4089c493dcac0d24c29c01e2c38baf8e30f1b716ee37e83d200b18fe" dependencies = [ - "itoa 1.0.6", + "deranged", + "itoa 1.0.9", "serde", "time-core", "time-macros", @@ -4261,15 +4276,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.9" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "372950940a5f07bf38dbe211d7283c9e6d7327df53794992d293e534c733d09b" +checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" dependencies = [ "time-core", ] @@ -4291,17 +4306,17 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.28.1" +version = "1.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aa32867d44e6f2ce3385e89dceb990188b8bb0fb25b0cf576647a6f98ac5105" +checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" dependencies = [ - "autocfg", + "backtrace", "bytes", "libc", "mio", "num_cpus", "pin-project-lite", - "socket2", + "socket2 0.5.4", "tokio-macros", "windows-sys 0.48.0", ] @@ -4314,7 +4329,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.17", + "syn 2.0.37", ] [[package]] @@ -4342,9 +4357,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +checksum = "1d68074620f57a0b21594d9735eb2e98ab38b17f80d3fcb189fca266771ca60d" dependencies = [ "bytes", "futures-core", @@ -4361,7 +4376,7 @@ version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" dependencies = [ - "indexmap", + "indexmap 1.9.3", "serde", ] @@ -4372,7 +4387,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5376256e44f2443f8896ac012507c19a012df0fe8758b55246ae51a2279db51f" dependencies = [ "combine", - "indexmap", + "indexmap 1.9.3", "itertools", ] @@ -4438,13 +4453,13 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.24" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74" +checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.17", + "syn 2.0.37", ] [[package]] @@ -4492,15 +4507,15 @@ dependencies = [ [[package]] name = "typenum" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "ucd-trie" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" +checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" [[package]] name = "uname" @@ -4519,9 +4534,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.9" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" @@ -4540,9 +4555,9 @@ checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" [[package]] name = "unicode-width" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" [[package]] name = "universal-hash" @@ -4562,11 +4577,11 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "ureq" -version = "2.7.1" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b11c96ac7ee530603dcdf68ed1557050f374ce55a5a07193ebf8cbc9f8927e9" +checksum = "f5ccd538d4a604753ebc2f17cd9946e89b77bf87f6a8e2309667c6f2e87855e3" dependencies = [ - "base64 0.21.2", + "base64 0.21.4", "flate2", "log", "native-tls", @@ -4579,9 +4594,9 @@ dependencies = [ [[package]] name = "url" -version = "2.3.1" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" dependencies = [ "form_urlencoded", "idna", @@ -4603,19 +4618,19 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.3.3" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "345444e32442451b267fc254ae85a209c64be56d2890e601a0c37ff0c3c5ecd2" +checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", "sha1_smol", ] [[package]] name = "value-bag" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4d330786735ea358f3bc09eea4caa098569c1c93f342d9aca0514915022fe7e" +checksum = "d92ccd67fb88503048c01b59152a04effd0782d035a83a6d256ce6085f08f4a3" dependencies = [ "value-bag-serde1", "value-bag-sval2", @@ -4623,9 +4638,9 @@ dependencies = [ [[package]] name = "value-bag-serde1" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4735c95b4cca1447b448e2e2e87e98d7e7498f4da27e355cf7af02204521001d" +checksum = "b0b9f3feef403a50d4d67e9741a6d8fc688bcbb4e4f31bd4aab72cc690284394" dependencies = [ "erased-serde", "serde", @@ -4634,9 +4649,9 @@ dependencies = [ [[package]] name = "value-bag-sval2" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859cb4f0ce7da6a118b559ba74b0e63bf569bea867c20ba457a6b1c886a04e97" +checksum = "30b24f4146b6f3361e91cbf527d1fb35e9376c3c0cef72ca5ec5af6d640fad7d" dependencies = [ "sval", "sval_buffer", @@ -4681,9 +4696,9 @@ dependencies = [ [[package]] name = "walkdir" -version = "2.3.3" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" dependencies = [ "same-file", "winapi-util", @@ -4691,11 +4706,10 @@ dependencies = [ [[package]] name = "want" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" dependencies = [ - "log", "try-lock", ] @@ -4713,9 +4727,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bba0e8cb82ba49ff4e229459ff22a191bbe9a1cb3a341610c9c33efc27ddf73" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -4723,24 +4737,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b04bc93f9d6bdee709f6bd2118f57dd6679cf1176a1af464fca3ab0d66d8fb" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.17", + "syn 2.0.37", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.36" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d1985d03709c53167ce907ff394f5316aa22cb4e12761295c5dc57dacb6297e" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" dependencies = [ "cfg-if", "js-sys", @@ -4750,9 +4764,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14d6b024f1a526bb0234f52840389927257beb670610081360e5a03c5df9c258" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4760,28 +4774,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.17", + "syn 2.0.37", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "web-sys" -version = "0.3.63" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bdd9ef4e984da1187bf8110c5cf5b845fbc87a23602cdf912386a76fcd3a7c2" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" dependencies = [ "js-sys", "wasm-bindgen", @@ -4789,12 +4803,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.23.1" +version = "0.25.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b03058f88386e5ff5310d9111d53f48b17d732b401aeb83a8d5190f2ac459338" -dependencies = [ - "rustls-webpki", -] +checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" [[package]] name = "weezl" @@ -4804,13 +4815,14 @@ checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb" [[package]] name = "which" -version = "4.4.0" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" dependencies = [ "either", - "libc", + "home", "once_cell", + "rustix", ] [[package]] @@ -4831,9 +4843,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" dependencies = [ "winapi", ] @@ -4866,7 +4878,7 @@ checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ "windows-implement 0.48.0", "windows-interface", - "windows-targets 0.48.0", + "windows-targets 0.48.5", ] [[package]] @@ -4931,7 +4943,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.0", + "windows-targets 0.48.5", ] [[package]] @@ -4951,17 +4963,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm 0.48.0", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm 0.48.0", - "windows_x86_64_msvc 0.48.0", + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] @@ -4978,9 +4990,9 @@ checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_msvc" @@ -4996,9 +5008,9 @@ checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" [[package]] name = "windows_aarch64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_i686_gnu" @@ -5014,9 +5026,9 @@ checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" [[package]] name = "windows_i686_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_msvc" @@ -5032,9 +5044,9 @@ checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" [[package]] name = "windows_i686_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_x86_64_gnu" @@ -5050,9 +5062,9 @@ checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" [[package]] name = "windows_x86_64_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnullvm" @@ -5062,9 +5074,9 @@ checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_msvc" @@ -5080,9 +5092,9 @@ checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" [[package]] name = "windows_x86_64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winreg" diff --git a/tooling/cli/Cargo.toml b/tooling/cli/Cargo.toml index 002e5d8b6721..e1253c48319e 100644 --- a/tooling/cli/Cargo.toml +++ b/tooling/cli/Cargo.toml @@ -3,7 +3,7 @@ members = [ "node" ] [package] name = "tauri-cli" -version = "2.0.0-alpha.11" +version = "2.0.0-alpha.15" authors = [ "Tauri Programme within The Commons Conservancy" ] edition = "2021" rust-version = "1.65" @@ -39,7 +39,7 @@ name = "cargo-tauri" path = "src/main.rs" [dependencies] -tauri-mobile = { version = "0.5.2", default-features = false } +cargo-mobile2 = { version = "0.7", default-features = false } textwrap = { version = "0.11.0", features = [ "term_size" ] } jsonrpsee = { version = "0.16", features = [ "server" ] } jsonrpsee-core = "0.16" @@ -50,7 +50,7 @@ sublime_fuzzy = "0.7" clap_complete = "4" clap = { version = "4.0", features = [ "derive" ] } anyhow = "1.0" -tauri-bundler = { version = "2.0.0-alpha.7", default-features = false, path = "../bundler" } +tauri-bundler = { version = "2.0.0-alpha.9", default-features = false, path = "../bundler" } colored = "2.0" once_cell = "1" serde = { version = "1.0", features = [ "derive" ] } @@ -61,7 +61,7 @@ shared_child = "1.0" duct = "0.13" toml_edit = "0.14" json-patch = "1.0" -tauri-utils = { version = "2.0.0-alpha.7", path = "../../core/tauri-utils", features = [ "isolation", "schema", "config-json5", "config-toml" ] } +tauri-utils = { version = "2.0.0-alpha.8", path = "../../core/tauri-utils", features = [ "isolation", "schema", "config-json5", "config-toml" ] } tauri-utils-v1 = { version = "1", package = "tauri-utils", features = [ "isolation", "schema", "config-json5", "config-toml" ] } toml = "0.5" jsonschema = "0.16" @@ -106,15 +106,15 @@ libc = "0.2" default = [ "rustls" ] native-tls = [ "tauri-bundler/native-tls", - "tauri-mobile/native-tls", + "cargo-mobile2/native-tls", "ureq/native-tls" ] native-tls-vendored = [ "native-tls", "tauri-bundler/native-tls-vendored", - "tauri-mobile/openssl-vendored" + "cargo-mobile2/openssl-vendored" ] -rustls = [ "tauri-bundler/rustls", "tauri-mobile/rustls", "ureq/tls" ] +rustls = [ "tauri-bundler/rustls", "cargo-mobile2/rustls", "ureq/tls" ] [profile.release-size-optimized] inherits = "release" diff --git a/tooling/cli/metadata-v2.json b/tooling/cli/metadata-v2.json index bb876e4cc4a1..4dfed7ee5699 100644 --- a/tooling/cli/metadata-v2.json +++ b/tooling/cli/metadata-v2.json @@ -1,8 +1,8 @@ { "cli.js": { - "version": "2.0.0-alpha.11", + "version": "2.0.0-alpha.15", "node": ">= 10.0.0" }, - "tauri": "2.0.0-alpha.11", - "tauri-build": "2.0.0-alpha.8" + "tauri": "2.0.0-alpha.15", + "tauri-build": "2.0.0-alpha.9" } diff --git a/tooling/cli/node/CHANGELOG.md b/tooling/cli/node/CHANGELOG.md index 3cf6cc743b9c..cad961ba79b6 100644 --- a/tooling/cli/node/CHANGELOG.md +++ b/tooling/cli/node/CHANGELOG.md @@ -1,5 +1,52 @@ # Changelog +## \[2.0.0-alpha.15] + +### New Features + +- [`b2f17723`](https://www.github.com/tauri-apps/tauri/commit/b2f17723a415f04c2620132a6305eb138d7cb47f)([#7971](https://www.github.com/tauri-apps/tauri/pull/7971)) Use `devicectl` to connect to iOS 17+ devices on macOS 14+. + +### Bug Fixes + +- [`100d9ede`](https://www.github.com/tauri-apps/tauri/commit/100d9ede35995d9db21d2087dd5606adfafb89a5)([#7802](https://www.github.com/tauri-apps/tauri/pull/7802)) Properly read platform-specific configuration files for mobile targets. +- [`228e5a4c`](https://www.github.com/tauri-apps/tauri/commit/228e5a4c76ad5f97409c912d07699b49ba4bb162)([#7902](https://www.github.com/tauri-apps/tauri/pull/7902)) Fixes `icon` command not writing files to the correct Android project folders. + +### Dependencies + +- Upgraded to `tauri-cli@2.0.0-alpha.15` + +## \[2.0.0-alpha.14] + +### Dependencies + +- Upgraded to `tauri-cli@2.0.0-alpha.14` + +### Breaking Changes + +- [`d5074af5`](https://www.github.com/tauri-apps/tauri/commit/d5074af562b2b5cb6c5711442097c4058af32db6)([#7801](https://www.github.com/tauri-apps/tauri/pull/7801)) The custom protocol on Android now uses the `http` scheme instead of `https`. + +## \[2.0.0-alpha.13] + +### Dependencies + +- Upgraded to `tauri-cli@2.0.0-alpha.13` + +### Breaking Changes + +- [`4cb51a2d`](https://www.github.com/tauri-apps/tauri/commit/4cb51a2d56cfcae0749062c79ede5236bd8c02c2)([#7779](https://www.github.com/tauri-apps/tauri/pull/7779)) The custom protocol on Windows now uses the `http` scheme instead of `https`. +- [`974e38b4`](https://www.github.com/tauri-apps/tauri/commit/974e38b4ddc198530aa977ec77d513b76013b9f3)([#7744](https://www.github.com/tauri-apps/tauri/pull/7744)) Renamed the `plugin add` command to `add`. + +## \[2.0.0-alpha.12] + +### Bug Fixes + +- [`b75a1210`](https://www.github.com/tauri-apps/tauri/commit/b75a1210bed589187678861d7314ae6279bf7c87)([#7762](https://www.github.com/tauri-apps/tauri/pull/7762)) Fixes a regression on alpha.11 where iOS logs aren't being displayed when using `ios dev` with a real device. +- [`8faa5a4a`](https://www.github.com/tauri-apps/tauri/commit/8faa5a4a1238a44ca7b54d2084aaed553ac2a1ba)([#7765](https://www.github.com/tauri-apps/tauri/pull/7765)) Ensure asset directory exists on the iOS project. + +### Dependencies + +- Upgraded to `tauri-cli@2.0.0-alpha.12` + ## \[2.0.0-alpha.11] ### New Features diff --git a/tooling/cli/node/package.json b/tooling/cli/node/package.json index 0d40bdc55d49..cbcc57d8f0ed 100644 --- a/tooling/cli/node/package.json +++ b/tooling/cli/node/package.json @@ -1,6 +1,6 @@ { "name": "@tauri-apps/cli", - "version": "2.0.0-alpha.11", + "version": "2.0.0-alpha.15", "description": "Command line interface for building Tauri apps", "funding": { "type": "opencollective", diff --git a/tooling/cli/schema.json b/tooling/cli/schema.json index 24bb780ddf69..715a118c71c4 100644 --- a/tooling/cli/schema.json +++ b/tooling/cli/schema.json @@ -113,7 +113,7 @@ "additionalProperties": false, "definitions": { "PackageConfig": { - "description": "The package configuration.\n\nSee more: https://tauri.app/v1/api/config#packageconfig", + "description": "The package configuration.\n\nSee more: ", "type": "object", "properties": { "productName": { @@ -136,7 +136,7 @@ "additionalProperties": false }, "TauriConfig": { - "description": "The Tauri configuration object.\n\nSee more: https://tauri.app/v1/api/config#tauriconfig", + "description": "The Tauri configuration object.\n\nSee more: ", "type": "object", "properties": { "pattern": { @@ -291,7 +291,7 @@ ] }, "WindowConfig": { - "description": "The window configuration object.\n\nSee more: https://tauri.app/v1/api/config#windowconfig", + "description": "The window configuration object.\n\nSee more: ", "type": "object", "properties": { "label": { @@ -510,7 +510,7 @@ "type": "boolean" }, "windowEffects": { - "description": "Window effects.\n\nRequires the window to be transparent.\n\n## Platform-specific:\n\n- **Windows**: If using decorations or shadows, you may want to try this workaround https://github.com/tauri-apps/tao/issues/72#issuecomment-975607891 - **Linux**: Unsupported", + "description": "Window effects.\n\nRequires the window to be transparent.\n\n## Platform-specific:\n\n- **Windows**: If using decorations or shadows, you may want to try this workaround - **Linux**: Unsupported", "anyOf": [ { "$ref": "#/definitions/WindowEffectsConfig" @@ -867,7 +867,7 @@ "minItems": 4 }, "BundleConfig": { - "description": "Configuration for tauri-bundler.\n\nSee more: https://tauri.app/v1/api/config#bundleconfig", + "description": "Configuration for tauri-bundler.\n\nSee more: ", "type": "object", "required": [ "identifier" @@ -1229,7 +1229,7 @@ ] }, "AppImageConfig": { - "description": "Configuration for AppImage bundles.\n\nSee more: https://tauri.app/v1/api/config#appimageconfig", + "description": "Configuration for AppImage bundles.\n\nSee more: ", "type": "object", "properties": { "bundleMediaFramework": { @@ -1241,7 +1241,7 @@ "additionalProperties": false }, "DebConfig": { - "description": "Configuration for Debian (.deb) bundles.\n\nSee more: https://tauri.app/v1/api/config#debconfig", + "description": "Configuration for Debian (.deb) bundles.\n\nSee more: ", "type": "object", "properties": { "depends": { @@ -1273,7 +1273,7 @@ "additionalProperties": false }, "MacConfig": { - "description": "Configuration for the macOS bundles.\n\nSee more: https://tauri.app/v1/api/config#macconfig", + "description": "Configuration for the macOS bundles.\n\nSee more: ", "type": "object", "properties": { "frameworks": { @@ -1333,7 +1333,7 @@ "additionalProperties": false }, "WindowsConfig": { - "description": "Windows bundler configuration.\n\nSee more: https://tauri.app/v1/api/config#windowsconfig", + "description": "Windows bundler configuration.\n\nSee more: ", "type": "object", "properties": { "digestAlgorithm": { @@ -1517,7 +1517,7 @@ ] }, "WixConfig": { - "description": "Configuration for the MSI bundle using WiX.\n\nSee more: https://tauri.app/v1/api/config#wixconfig", + "description": "Configuration for the MSI bundle using WiX.\n\nSee more: ", "type": "object", "properties": { "language": { @@ -1642,7 +1642,7 @@ ] }, "WixLanguageConfig": { - "description": "Configuration for a target language for the WiX build.\n\nSee more: https://tauri.app/v1/api/config#wixlanguageconfig", + "description": "Configuration for a target language for the WiX build.\n\nSee more: ", "type": "object", "properties": { "localePath": { @@ -1786,7 +1786,7 @@ "additionalProperties": false }, "UpdaterConfig": { - "description": "The Updater configuration object.\n\nSee more: https://tauri.app/v1/api/config#updaterconfig", + "description": "The Updater configuration object.\n\nSee more: ", "type": "object", "properties": { "active": { @@ -1814,7 +1814,7 @@ "additionalProperties": false }, "UpdaterWindowsConfig": { - "description": "The updater configuration for Windows.\n\nSee more: https://tauri.app/v1/api/config#updaterwindowsconfig", + "description": "The updater configuration for Windows.\n\nSee more: ", "type": "object", "properties": { "installMode": { @@ -1856,7 +1856,7 @@ ] }, "SecurityConfig": { - "description": "Security configuration.\n\nSee more: https://tauri.app/v1/api/config#securityconfig", + "description": "Security configuration.\n\nSee more: ", "type": "object", "properties": { "csp": { @@ -2004,7 +2004,7 @@ "additionalProperties": false }, "AssetProtocolConfig": { - "description": "Config for the asset custom protocol.\n\nSee more: https://tauri.app/v1/api/config#assetprotocolconfig", + "description": "Config for the asset custom protocol.\n\nSee more: ", "type": "object", "properties": { "scope": { @@ -2066,12 +2066,19 @@ ] }, "TrayIconConfig": { - "description": "Configuration for application tray icon.\n\nSee more: https://tauri.app/v1/api/config#trayiconconfig", + "description": "Configuration for application tray icon.\n\nSee more: ", "type": "object", "required": [ "iconPath" ], "properties": { + "id": { + "description": "Set an id for this tray icon so you can reference it later, defaults to `main`.", + "type": [ + "string", + "null" + ] + }, "iconPath": { "description": "Path to the default icon to use for the tray icon.", "type": "string" @@ -2104,7 +2111,7 @@ "additionalProperties": false }, "BuildConfig": { - "description": "The Build configuration object.\n\nSee more: https://tauri.app/v1/api/config#buildconfig", + "description": "The Build configuration object.\n\nSee more: ", "type": "object", "properties": { "runner": { @@ -2267,7 +2274,7 @@ ] }, "PluginConfig": { - "description": "The plugin configs holds a HashMap mapping a plugin name to its configuration object.\n\nSee more: https://tauri.app/v1/api/config#pluginconfig", + "description": "The plugin configs holds a HashMap mapping a plugin name to its configuration object.\n\nSee more: ", "type": "object", "additionalProperties": true } diff --git a/tooling/cli/src/plugin/add.rs b/tooling/cli/src/add.rs similarity index 98% rename from tooling/cli/src/plugin/add.rs rename to tooling/cli/src/add.rs index 2c7340953467..743be707afc7 100644 --- a/tooling/cli/src/plugin/add.rs +++ b/tooling/cli/src/add.rs @@ -17,7 +17,7 @@ use crate::{ use std::{collections::HashMap, process::Command}; #[derive(Debug, Parser)] -#[clap(about = "Installs a plugin on the project")] +#[clap(about = "Add a tauri plugin to the project")] pub struct Options { /// The plugin to add. plugin: String, diff --git a/tooling/cli/src/build.rs b/tooling/cli/src/build.rs index 74d33d3bf3af..9fd745a2829e 100644 --- a/tooling/cli/src/build.rs +++ b/tooling/cli/src/build.rs @@ -23,9 +23,13 @@ use std::{ process::Command, }; use tauri_bundler::bundle::{bundle_project, Bundle, PackageType}; +use tauri_utils::platform::Target; #[derive(Debug, Clone, Parser)] -#[clap(about = "Tauri build")] +#[clap( + about = "Build your app in release mode and generate bundles and installers", + long_about = "Build your app in release mode and generate bundles and installers. It makes use of the `build.distDir` property from your `tauri.conf.json` file. It also runs your `build.beforeBuildCommand` which usually builds your frontend into `build.distDir`. This will also run `build.beforeBundleCommand` before generating the bundles and installers of your app." +)] pub struct Options { /// Binary to use to build the application, defaults to `cargo` #[clap(short, long)] @@ -65,9 +69,15 @@ pub fn command(mut options: Options, verbosity: u8) -> Result<()> { options.ci = options.ci || std::env::var("CI").is_ok(); let ci = options.ci; - let mut interface = setup(&mut options, false)?; + let target = options + .target + .as_deref() + .map(Target::from_triple) + .unwrap_or_else(Target::current); - let config = get_config(options.config.as_deref())?; + let mut interface = setup(target, &mut options, false)?; + + let config = get_config(target, options.config.as_deref())?; let config_guard = config.lock().unwrap(); let config_ = config_guard.as_ref().unwrap(); @@ -208,11 +218,11 @@ pub fn command(mut options: Options, verbosity: u8) -> Result<()> { Ok(()) } -pub fn setup(options: &mut Options, mobile: bool) -> Result { +pub fn setup(target: Target, options: &mut Options, mobile: bool) -> Result { let (merge_config, merge_config_path) = resolve_merge_config(&options.config)?; options.config = merge_config; - let config = get_config(options.config.as_deref())?; + let config = get_config(target, options.config.as_deref())?; let tauri_path = tauri_dir(); set_current_dir(tauri_path).with_context(|| "failed to change current working directory")?; diff --git a/tooling/cli/src/completions.rs b/tooling/cli/src/completions.rs index 874e5d2a0ce2..192299a64d77 100644 --- a/tooling/cli/src/completions.rs +++ b/tooling/cli/src/completions.rs @@ -13,7 +13,7 @@ use std::{fs::write, path::PathBuf}; const PKG_MANAGERS: &[&str] = &["cargo", "pnpm", "npm", "yarn"]; #[derive(Debug, Clone, Parser)] -#[clap(about = "Shell completions")] +#[clap(about = "Generate Tauri CLI shell completions for Bash, Zsh, PowerShell or Fish")] pub struct Options { /// Shell to generate a completion script for. #[clap(short, long, verbatim_doc_comment)] diff --git a/tooling/cli/src/dev.rs b/tooling/cli/src/dev.rs index 02f6977859cb..a96d0473381e 100644 --- a/tooling/cli/src/dev.rs +++ b/tooling/cli/src/dev.rs @@ -18,6 +18,7 @@ use clap::{ArgAction, Parser}; use log::{error, info, warn}; use once_cell::sync::OnceCell; use shared_child::SharedChild; +use tauri_utils::platform::Target; use std::{ env::set_current_dir, @@ -38,7 +39,11 @@ const KILL_CHILDREN_SCRIPT: &[u8] = include_bytes!("../scripts/kill-children.sh" pub const TAURI_DEV_WATCHER_GITIGNORE: &[u8] = include_bytes!("../tauri-dev-watcher.gitignore"); #[derive(Debug, Clone, Parser)] -#[clap(about = "Tauri dev", trailing_var_arg(true))] +#[clap( + about = "Run your app in development mode", + long_about = "Run your app in development mode with hot-reloading for the Rust code. It makes use of the `build.devPath` property from your `tauri.conf.json` file. It also runs your `build.beforeDevCommand` which usually starts your frontend devServer.", + trailing_var_arg(true) +)] pub struct Options { /// Binary to use to run the application #[clap(short, long)] @@ -84,7 +89,12 @@ pub fn command(options: Options) -> Result<()> { } fn command_internal(mut options: Options) -> Result<()> { - let mut interface = setup(&mut options, false)?; + let target = options + .target + .as_deref() + .map(Target::from_triple) + .unwrap_or_else(Target::current); + let mut interface = setup(target, &mut options, false)?; let exit_on_panic = options.exit_on_panic; let no_watch = options.no_watch; interface.dev(options.into(), move |status, reason| { @@ -135,11 +145,11 @@ pub fn local_ip_address(force: bool) -> &'static IpAddr { }) } -pub fn setup(options: &mut Options, mobile: bool) -> Result { +pub fn setup(target: Target, options: &mut Options, mobile: bool) -> Result { let (merge_config, _merge_config_path) = resolve_merge_config(&options.config)?; options.config = merge_config; - let config = get_config(options.config.as_deref())?; + let config = get_config(target, options.config.as_deref())?; let tauri_path = tauri_dir(); set_current_dir(tauri_path).with_context(|| "failed to change current working directory")?; diff --git a/tooling/cli/src/helpers/app_paths.rs b/tooling/cli/src/helpers/app_paths.rs index 30af98f34bd5..63eb85d51f43 100644 --- a/tooling/cli/src/helpers/app_paths.rs +++ b/tooling/cli/src/helpers/app_paths.rs @@ -12,8 +12,9 @@ use std::{ use ignore::WalkBuilder; use once_cell::sync::Lazy; -use tauri_utils::config::parse::{ - folder_has_configuration_file, is_configuration_file, ConfigFormat, +use tauri_utils::{ + config::parse::{folder_has_configuration_file, is_configuration_file, ConfigFormat}, + platform::Target, }; const TAURI_GITIGNORE: &[u8] = include_bytes!("../../tauri.gitignore"); @@ -73,7 +74,7 @@ fn get_tauri_dir() -> PathBuf { return cwd.join("src-tauri/"); } - lookup(&cwd, |path| folder_has_configuration_file(path) || is_configuration_file(path)) + lookup(&cwd, |path| folder_has_configuration_file(Target::Linux, path) || is_configuration_file(Target::Linux, path)) .map(|p| if p.is_dir() { p } else { p.parent().unwrap().to_path_buf() }) .unwrap_or_else(|| panic!("Couldn't recognize the current folder as a Tauri project. It must contain a `{}`, `{}` or `{}` file in any subfolder.", diff --git a/tooling/cli/src/helpers/config.rs b/tooling/cli/src/helpers/config.rs index e1a12b65e184..bbf1f5129f0b 100644 --- a/tooling/cli/src/helpers/config.rs +++ b/tooling/cli/src/helpers/config.rs @@ -8,7 +8,7 @@ use log::error; use once_cell::sync::Lazy; use serde_json::Value as JsonValue; -pub use tauri_utils::config::*; +pub use tauri_utils::{config::*, platform::Target}; use std::{ collections::HashMap, @@ -21,6 +21,8 @@ use std::{ pub const MERGE_CONFIG_EXTENSION_NAME: &str = "--config"; pub struct ConfigMetadata { + /// The current target. + target: Target, /// The actual configuration, merged with any extension. inner: Config, /// The config extensions (platform-specific config files or the config CLI argument). @@ -117,19 +119,23 @@ fn config_handle() -> &'static ConfigHandle { } /// Gets the static parsed config from `tauri.conf.json`. -fn get_internal(merge_config: Option<&str>, reload: bool) -> crate::Result { +fn get_internal( + merge_config: Option<&str>, + reload: bool, + target: Target, +) -> crate::Result { if !reload && config_handle().lock().unwrap().is_some() { return Ok(config_handle().clone()); } let tauri_dir = super::app_paths::tauri_dir(); let (mut config, config_path) = - tauri_utils::config::parse::parse_value(tauri_dir.join("tauri.conf.json"))?; + tauri_utils::config::parse::parse_value(target, tauri_dir.join("tauri.conf.json"))?; let config_file_name = config_path.file_name().unwrap().to_string_lossy(); let mut extensions = HashMap::new(); if let Some((platform_config, config_path)) = - tauri_utils::config::parse::read_platform(tauri_dir)? + tauri_utils::config::parse::read_platform(target, tauri_dir)? { merge(&mut config, &platform_config); extensions.insert( @@ -186,6 +192,7 @@ fn get_internal(merge_config: Option<&str>, reload: bool) -> crate::Result, reload: bool) -> crate::Result) -> crate::Result { - get_internal(merge_config, false) +pub fn get(target: Target, merge_config: Option<&str>) -> crate::Result { + get_internal(merge_config, false, target) } pub fn reload(merge_config: Option<&str>) -> crate::Result { - get_internal(merge_config, true) + let target = config_handle() + .lock() + .unwrap() + .as_ref() + .map(|conf| conf.target); + if let Some(target) = target { + get_internal(merge_config, true, target) + } else { + Err(anyhow::anyhow!("config not loaded")) + } } diff --git a/tooling/cli/src/icon.rs b/tooling/cli/src/icon.rs index d176aa464c9b..09f6ff2ea372 100644 --- a/tooling/cli/src/icon.rs +++ b/tooling/cli/src/icon.rs @@ -2,10 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -use crate::{ - helpers::{app_paths::tauri_dir, config::get as get_tauri_config}, - Result, -}; +use crate::{helpers::app_paths::tauri_dir, Result}; use std::{ collections::HashMap, @@ -42,7 +39,7 @@ struct PngEntry { } #[derive(Debug, Parser)] -#[clap(about = "Generates various icons for all major platforms")] +#[clap(about = "Generate various icons for all major platforms")] pub struct Options { // TODO: Confirm 1240px /// Path to the source icon (png, 1240x1240px with transparency). @@ -360,22 +357,10 @@ fn png(source: &DynamicImage, out_dir: &Path, ios_color: Rgba) -> Result<()> let mut entries = desktop_entries(out_dir); - // Android - let (config, _metadata) = { - let tauri_config = get_tauri_config(None)?; - - let tauri_config_guard = tauri_config.lock().unwrap(); - let tauri_config_ = tauri_config_guard.as_ref().unwrap(); - crate::mobile::android::get_config( - &crate::mobile::get_app(tauri_config_), - tauri_config_, - &Default::default(), - ) - }; - let android_out = out_dir.parent().unwrap().join(format!( - "gen/android/{}/app/src/main/res/", - config.app().name_snake() - )); + let android_out = out_dir + .parent() + .unwrap() + .join("gen/android/app/src/main/res/"); let out = if android_out.exists() { android_out } else { diff --git a/tooling/cli/src/info/app.rs b/tooling/cli/src/info/app.rs index 65b895528cf0..93713b5f6137 100644 --- a/tooling/cli/src/info/app.rs +++ b/tooling/cli/src/info/app.rs @@ -8,11 +8,12 @@ use std::{ fs::read_to_string, path::{Path, PathBuf}, }; +use tauri_utils::platform::Target; pub fn items(app_dir: Option<&PathBuf>, tauri_dir: Option<&Path>) -> Vec { let mut items = Vec::new(); if tauri_dir.is_some() { - if let Ok(config) = crate::helpers::config::get(None) { + if let Ok(config) = crate::helpers::config::get(Target::current(), None) { let config_guard = config.lock().unwrap(); let config = config_guard.as_ref().unwrap(); diff --git a/tooling/cli/src/info/ios.rs b/tooling/cli/src/info/ios.rs index db3c448fd2a2..92428db07f99 100644 --- a/tooling/cli/src/info/ios.rs +++ b/tooling/cli/src/info/ios.rs @@ -9,7 +9,7 @@ use colored::Colorize; pub fn items() -> Vec { vec![SectionItem::new( || { - let teams = tauri_mobile::apple::teams::find_development_teams().unwrap_or_default(); + let teams = cargo_mobile2::apple::teams::find_development_teams().unwrap_or_default(); Some(( if teams.is_empty() { "Developer Teams: None".red().to_string() diff --git a/tooling/cli/src/info/mod.rs b/tooling/cli/src/info/mod.rs index 329337b12f6d..92afc6fe76a8 100644 --- a/tooling/cli/src/info/mod.rs +++ b/tooling/cli/src/info/mod.rs @@ -200,7 +200,9 @@ impl Section<'_> { } #[derive(Debug, Parser)] -#[clap(about = "Shows information about Tauri dependencies and project configuration")] +#[clap( + about = "Show a concise list of information about the environment, Rust, Node.js and their versions as well as a few relevant project configurations" +)] pub struct Options { /// Interactive mode to apply automatic fixes. #[clap(long)] diff --git a/tooling/cli/src/init.rs b/tooling/cli/src/init.rs index 02623d008bce..5ffc76d6b984 100644 --- a/tooling/cli/src/init.rs +++ b/tooling/cli/src/init.rs @@ -30,7 +30,7 @@ const TEMPLATE_DIR: Dir<'_> = include_dir!("templates/app"); const TAURI_CONF_TEMPLATE: &str = include_str!("../templates/tauri.conf.json"); #[derive(Debug, Parser)] -#[clap(about = "Initializes a Tauri project")] +#[clap(about = "Initialize a Tauri project in an existing directory")] pub struct Options { /// Skip prompting for values #[clap(long)] diff --git a/tooling/cli/src/interface/mod.rs b/tooling/cli/src/interface/mod.rs index c5805cbac0a8..3ab53af02867 100644 --- a/tooling/cli/src/interface/mod.rs +++ b/tooling/cli/src/interface/mod.rs @@ -95,7 +95,7 @@ pub trait Interface: Sized { options: Options, on_exit: F, ) -> crate::Result<()>; - fn mobile_dev crate::Result>>( + fn mobile_dev crate::Result>>( &mut self, options: MobileOptions, runner: R, diff --git a/tooling/cli/src/interface/rust.rs b/tooling/cli/src/interface/rust.rs index 239a2a48ed10..07d7f481a163 100644 --- a/tooling/cli/src/interface/rust.rs +++ b/tooling/cli/src/interface/rust.rs @@ -32,7 +32,7 @@ use crate::helpers::{ app_paths::{app_dir, tauri_dir}, config::{nsis_settings, reload as reload_config, wix_settings, Config}, }; -use tauri_utils::display_path; +use tauri_utils::{display_path, platform::Target}; mod cargo_config; mod desktop; @@ -90,7 +90,7 @@ pub struct MobileOptions { } #[derive(Debug)] -pub struct Target { +pub struct RustupTarget { name: String, installed: bool, } @@ -99,7 +99,7 @@ pub struct Rust { app_settings: RustAppSettings, config_features: Vec, product_name: Option, - available_targets: Option>, + available_targets: Option>, } impl Interface for Rust { @@ -197,7 +197,7 @@ impl Interface for Rust { } } - fn mobile_dev crate::Result>>( + fn mobile_dev crate::Result>>( &mut self, mut options: MobileOptions, runner: R, @@ -431,7 +431,7 @@ impl Rust { options: Options, run_args: Vec, on_exit: F, - ) -> crate::Result> { + ) -> crate::Result> { desktop::run_dev( options, run_args, @@ -441,10 +441,10 @@ impl Rust { self.product_name.clone(), on_exit, ) - .map(|c| Box::new(c) as Box) + .map(|c| Box::new(c) as Box) } - fn run_dev_watcher crate::Result>>( + fn run_dev_watcher crate::Result>>( &mut self, config: Option, run: Arc, @@ -510,7 +510,7 @@ impl Rust { let event_path = event.path; if !ignore_matcher.is_ignore(&event_path, event_path.is_dir()) { - if is_configuration_file(&event_path) { + if is_configuration_file(self.app_settings.target, &event_path) { match reload_config(config.as_deref()) { Ok(config) => { info!("Tauri configuration changed. Rewriting manifest..."); @@ -685,6 +685,7 @@ pub struct RustAppSettings { package_settings: PackageSettings, cargo_config: CargoConfig, target_triple: String, + target: Target, } impl AppSettings for RustAppSettings { @@ -954,6 +955,7 @@ impl RustAppSettings { .to_string() }) }); + let target = Target::from_triple(&target_triple); Ok(Self { manifest, @@ -962,6 +964,7 @@ impl RustAppSettings { package_settings, cargo_config, target_triple, + target, }) } diff --git a/tooling/cli/src/interface/rust/desktop.rs b/tooling/cli/src/interface/rust/desktop.rs index fd84d351a48c..ba78136b852f 100644 --- a/tooling/cli/src/interface/rust/desktop.rs +++ b/tooling/cli/src/interface/rust/desktop.rs @@ -2,7 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -use super::{get_profile, AppSettings, DevProcess, ExitReason, Options, RustAppSettings, Target}; +use super::{ + get_profile, AppSettings, DevProcess, ExitReason, Options, RustAppSettings, RustupTarget, +}; use crate::CommandExt; use tauri_utils::display_path; @@ -69,7 +71,7 @@ impl DevProcess for DevChild { pub fn run_dev, ExitReason) + Send + Sync + 'static>( options: Options, run_args: Vec, - available_targets: &mut Option>, + available_targets: &mut Option>, config_features: Vec, app_settings: &RustAppSettings, product_name: Option, @@ -135,7 +137,7 @@ pub fn build( options: Options, app_settings: &RustAppSettings, product_name: Option, - available_targets: &mut Option>, + available_targets: &mut Option>, config_features: Vec, ) -> crate::Result<()> { let bin_path = app_settings.app_binary_path(&options)?; @@ -194,7 +196,7 @@ pub fn build( fn build_dev_app, ExitReason) + Send + 'static>( options: Options, - available_targets: &mut Option>, + available_targets: &mut Option>, config_features: Vec, on_exit: F, ) -> crate::Result> { @@ -245,9 +247,8 @@ fn build_dev_app, ExitReason) + Send + 'static>( let mut io_stderr = std::io::stderr(); loop { buf.clear(); - match tauri_utils::io::read_line(&mut stderr, &mut buf) { - Ok(s) if s == 0 => break, - _ => (), + if let Ok(0) = tauri_utils::io::read_line(&mut stderr, &mut buf) { + break; } let _ = io_stderr.write_all(&buf); if !buf.ends_with(&[b'\r']) { @@ -288,7 +289,7 @@ fn build_dev_app, ExitReason) + Send + 'static>( fn build_production_app( options: Options, - available_targets: &mut Option>, + available_targets: &mut Option>, config_features: Vec, ) -> crate::Result<()> { let mut build_cmd = build_command(options, available_targets, config_features)?; @@ -311,7 +312,7 @@ fn build_production_app( fn build_command( options: Options, - available_targets: &mut Option>, + available_targets: &mut Option>, config_features: Vec, ) -> crate::Result { let runner = options.runner.unwrap_or_else(|| "cargo".into()); @@ -353,7 +354,7 @@ fn build_command( Ok(build_cmd) } -fn fetch_available_targets() -> Option> { +fn fetch_available_targets() -> Option> { if let Ok(output) = Command::new("rustup").args(["target", "list"]).output() { let stdout = String::from_utf8_lossy(&output.stdout).into_owned(); Some( @@ -363,7 +364,7 @@ fn fetch_available_targets() -> Option> { let mut s = t.split(' '); let name = s.next().unwrap().to_string(); let installed = s.next().map(|v| v == "(installed)").unwrap_or_default(); - Target { name, installed } + RustupTarget { name, installed } }) .filter(|t| !t.name.is_empty()) .collect(), @@ -373,7 +374,10 @@ fn fetch_available_targets() -> Option> { } } -fn validate_target(available_targets: &Option>, target: &str) -> crate::Result<()> { +fn validate_target( + available_targets: &Option>, + target: &str, +) -> crate::Result<()> { if let Some(available_targets) = available_targets { if let Some(target) = available_targets.iter().find(|t| t.name == target) { if !target.installed { diff --git a/tooling/cli/src/lib.rs b/tooling/cli/src/lib.rs index edba74ed5663..5c2fdb839a04 100644 --- a/tooling/cli/src/lib.rs +++ b/tooling/cli/src/lib.rs @@ -13,6 +13,7 @@ pub use anyhow::Result; +mod add; mod build; mod completions; mod dev; @@ -97,19 +98,20 @@ pub(crate) struct Cli { #[derive(Subcommand)] enum Commands { - Build(build::Options), - Dev(dev::Options), - Icon(icon::Options), - Info(info::Options), Init(init::Options), - Plugin(plugin::Cli), - Signer(signer::Cli), - Completions(completions::Options), + Dev(dev::Options), + Build(build::Options), Android(mobile::android::Cli), #[cfg(target_os = "macos")] Ios(mobile::ios::Cli), /// Migrate from v1 to v2 Migrate, + Info(info::Options), + Add(add::Options), + Plugin(plugin::Cli), + Icon(icon::Options), + Signer(signer::Cli), + Completions(completions::Options), } fn format_error(err: clap::Error) -> clap::Error { @@ -205,6 +207,7 @@ where match cli.command { Commands::Build(options) => build::command(options, cli.verbose)?, Commands::Dev(options) => dev::command(options)?, + Commands::Add(options) => add::command(options)?, Commands::Icon(options) => icon::command(options)?, Commands::Info(options) => info::command(options)?, Commands::Init(options) => init::command(options)?, @@ -274,9 +277,8 @@ impl CommandExt for Command { let mut lines = stdout_lines_.lock().unwrap(); loop { buf.clear(); - match tauri_utils::io::read_line(&mut stdout, &mut buf) { - Ok(s) if s == 0 => break, - _ => (), + if let Ok(0) = tauri_utils::io::read_line(&mut stdout, &mut buf) { + break; } debug!(action = "stdout"; "{}", String::from_utf8_lossy(&buf)); lines.extend(buf.clone()); @@ -292,9 +294,8 @@ impl CommandExt for Command { let mut lines = stderr_lines_.lock().unwrap(); loop { buf.clear(); - match tauri_utils::io::read_line(&mut stderr, &mut buf) { - Ok(s) if s == 0 => break, - _ => (), + if let Ok(0) = tauri_utils::io::read_line(&mut stderr, &mut buf) { + break; } debug!(action = "stderr"; "{}", String::from_utf8_lossy(&buf)); lines.extend(buf.clone()); diff --git a/tooling/cli/src/migrate/config.rs b/tooling/cli/src/migrate/config.rs index a6c86bebf4a4..ea827b1a767d 100644 --- a/tooling/cli/src/migrate/config.rs +++ b/tooling/cli/src/migrate/config.rs @@ -85,21 +85,21 @@ fn process_security(security: &mut Map) -> Result<()> { match &mut csp { tauri_utils_v1::config::Csp::Policy(csp) => { if csp.contains("connect-src") { - *csp = csp.replace("connect-src", "connect-src ipc: https://ipc.localhost"); + *csp = csp.replace("connect-src", "connect-src ipc: http://ipc.localhost"); } else { - *csp = format!("{csp}; connect-src ipc: https://ipc.localhost"); + *csp = format!("{csp}; connect-src ipc: http://ipc.localhost"); } } tauri_utils_v1::config::Csp::DirectiveMap(csp) => { if let Some(connect_src) = csp.get_mut("connect-src") { - if !connect_src.contains("ipc: https://ipc.localhost") { - connect_src.push("ipc: https://ipc.localhost"); + if !connect_src.contains("ipc: http://ipc.localhost") { + connect_src.push("ipc: http://ipc.localhost"); } } else { csp.insert( "connect-src".into(), tauri_utils_v1::config::CspDirectiveSources::List(vec![ - "ipc: https://ipc.localhost".to_string() + "ipc: http://ipc.localhost".to_string() ]), ); } @@ -331,7 +331,7 @@ mod test { assert_eq!( migrated["tauri"]["security"]["csp"], format!( - "{}; connect-src ipc: https://ipc.localhost", + "{}; connect-src ipc: http://ipc.localhost", original["tauri"]["security"]["csp"].as_str().unwrap() ) ); @@ -358,7 +358,7 @@ mod test { assert!(migrated["tauri"]["security"]["csp"]["connect-src"] .as_array() .expect("connect-src isn't an array") - .contains(&"ipc: https://ipc.localhost".into())); + .contains(&"ipc: http://ipc.localhost".into())); } #[test] @@ -385,7 +385,7 @@ mod test { .as_str() .expect("connect-src isn't a string"), format!( - "{} ipc: https://ipc.localhost", + "{} ipc: http://ipc.localhost", original["tauri"]["security"]["csp"]["connect-src"] .as_str() .unwrap() diff --git a/tooling/cli/src/migrate/manifest.rs b/tooling/cli/src/migrate/manifest.rs index 22024f9898d9..54673d91766d 100644 --- a/tooling/cli/src/migrate/manifest.rs +++ b/tooling/cli/src/migrate/manifest.rs @@ -225,6 +225,7 @@ mod tests { .as_array() .expect("features must be an array") .clone(); + if toml.contains("reqwest-native-tls-vendored") { assert!( features @@ -233,10 +234,22 @@ mod tests { "reqwest-native-tls-vendored was not replaced with native-tls-vendored" ); } + + if toml.contains("system-tray") { + assert!( + features + .iter() + .any(|f| f.as_str().expect("feature must be a string") == "tray-icon"), + "system-tray was not replaced with tray-icon" + ); + } + for feature in features.iter() { let feature = feature.as_str().expect("feature must be a string"); assert!( - keep_features.contains(&feature) || feature == "native-tls-vendored", + keep_features.contains(&feature) + || feature == "native-tls-vendored" + || feature == "tray-icon", "feature {feature} should have been removed" ); } diff --git a/tooling/cli/src/mobile/android/android_studio_script.rs b/tooling/cli/src/mobile/android/android_studio_script.rs index f6e300a46a5d..77c1fa37f06f 100644 --- a/tooling/cli/src/mobile/android/android_studio_script.rs +++ b/tooling/cli/src/mobile/android/android_studio_script.rs @@ -6,7 +6,7 @@ use super::{detect_target_ok, ensure_init, env, get_app, get_config, read_option use crate::{helpers::config::get as get_tauri_config, Result}; use clap::{ArgAction, Parser}; -use tauri_mobile::{ +use cargo_mobile2::{ android::target::Target, opts::Profile, target::{call_for_targets_with_fallback, TargetTrait}, @@ -36,7 +36,7 @@ pub fn command(options: Options) -> Result<()> { Profile::Debug }; - let tauri_config = get_tauri_config(None)?; + let tauri_config = get_tauri_config(tauri_utils::platform::Target::Android, None)?; let (config, metadata, cli_options) = { let tauri_config_guard = tauri_config.lock().unwrap(); diff --git a/tooling/cli/src/mobile/android/build.rs b/tooling/cli/src/mobile/android/build.rs index 762ee16b8fe9..2cfa76c2a20a 100644 --- a/tooling/cli/src/mobile/android/build.rs +++ b/tooling/cli/src/mobile/android/build.rs @@ -20,7 +20,7 @@ use crate::{ use clap::{ArgAction, Parser}; use anyhow::Context; -use tauri_mobile::{ +use cargo_mobile2::{ android::{aab, apk, config::Config as AndroidConfig, env::Env, target::Target}, opts::{NoiseLevel, Profile}, target::TargetTrait, @@ -29,7 +29,10 @@ use tauri_mobile::{ use std::env::{set_current_dir, set_var}; #[derive(Debug, Clone, Parser)] -#[clap(about = "Android build")] +#[clap( + about = "Build your app in release mode for Android and generate APKs and AABs", + long_about = "Build your app in release mode for Android and generate APKs and AABs. It makes use of the `build.distDir` property from your `tauri.conf.json` file. It also runs your `build.beforeBuildCommand` which usually builds your frontend into `build.distDir`." +)] pub struct Options { /// Builds with the debug flag #[clap(short, long)] @@ -84,7 +87,10 @@ pub fn command(mut options: Options, noise_level: NoiseLevel) -> Result<()> { let (merge_config, _merge_config_path) = resolve_merge_config(&options.config)?; options.config = merge_config; - let tauri_config = get_tauri_config(options.config.as_deref())?; + let tauri_config = get_tauri_config( + tauri_utils::platform::Target::Android, + options.config.as_deref(), + )?; let (app, config, metadata) = { let tauri_config_guard = tauri_config.lock().unwrap(); let tauri_config_ = tauri_config_guard.as_ref().unwrap(); @@ -163,7 +169,11 @@ fn run_build( .triple .into(), ); - let interface = crate::build::setup(&mut build_options, true)?; + let interface = crate::build::setup( + tauri_utils::platform::Target::Android, + &mut build_options, + true, + )?; let interface_options = InterfaceOptions { debug: build_options.debug, diff --git a/tooling/cli/src/mobile/android/dev.rs b/tooling/cli/src/mobile/android/dev.rs index 058d8da7e80a..84ccb79f5cdd 100644 --- a/tooling/cli/src/mobile/android/dev.rs +++ b/tooling/cli/src/mobile/android/dev.rs @@ -20,7 +20,7 @@ use crate::{ use clap::{ArgAction, Parser}; use anyhow::Context; -use tauri_mobile::{ +use cargo_mobile2::{ android::{ config::{Config as AndroidConfig, Metadata as AndroidMetadata}, device::Device, @@ -44,7 +44,10 @@ const WEBVIEW_CLASS_INIT: &str = "this.settings.mixedContentMode = android.webkit.WebSettings.MIXED_CONTENT_ALWAYS_ALLOW"; #[derive(Debug, Clone, Parser)] -#[clap(about = "Android dev")] +#[clap( + about = "Run your app in development mode on Android", + long_about = "Run your app in development mode on Android with hot-reloading for the Rust code. It makes use of the `build.devPath` property from your `tauri.conf.json` file. It also runs your `build.beforeDevCommand` which usually starts your frontend devServer." +)] pub struct Options { /// List of cargo features to activate #[clap(short, long, action = ArgAction::Append, num_args(0..))] @@ -110,7 +113,10 @@ fn run_command(mut options: Options, noise_level: NoiseLevel) -> Result<()> { let (merge_config, _merge_config_path) = resolve_merge_config(&options.config)?; options.config = merge_config; - let tauri_config = get_tauri_config(options.config.as_deref())?; + let tauri_config = get_tauri_config( + tauri_utils::platform::Target::Android, + options.config.as_deref(), + )?; let (app, config, metadata) = { let tauri_config_guard = tauri_config.lock().unwrap(); @@ -141,7 +147,11 @@ fn run_dev( metadata: &AndroidMetadata, noise_level: NoiseLevel, ) -> Result<()> { - setup_dev_config(&mut options.config, options.force_ip_prompt)?; + setup_dev_config( + MobileTarget::Android, + &mut options.config, + options.force_ip_prompt, + )?; let mut env = env()?; let device = if options.open { None @@ -161,7 +171,11 @@ fn run_dev( .map(|d| d.target().triple.to_string()) .unwrap_or_else(|| Target::all().values().next().unwrap().triple.into()); dev_options.target = Some(target_triple.clone()); - let mut interface = crate::dev::setup(&mut dev_options, true)?; + let mut interface = crate::dev::setup( + tauri_utils::platform::Target::Android, + &mut dev_options, + true, + )?; let interface_options = InterfaceOptions { debug: !dev_options.release_mode, @@ -235,7 +249,7 @@ fn run_dev( crate::dev::wait_dev_process(c.clone(), move |status, reason| { crate::dev::on_app_exit(status, reason, exit_on_panic, no_watch) }); - Ok(Box::new(c) as Box) + Ok(Box::new(c) as Box) } Err(e) => { crate::dev::kill_before_dev_process(); diff --git a/tooling/cli/src/mobile/android.rs b/tooling/cli/src/mobile/android/mod.rs similarity index 96% rename from tooling/cli/src/mobile/android.rs rename to tooling/cli/src/mobile/android/mod.rs index 9f1b43ace9a2..1a622c7b40c6 100644 --- a/tooling/cli/src/mobile/android.rs +++ b/tooling/cli/src/mobile/android/mod.rs @@ -2,16 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -use clap::{Parser, Subcommand}; -use std::{ - env::set_var, - fs::{create_dir, create_dir_all, write}, - process::exit, - thread::sleep, - time::Duration, -}; -use sublime_fuzzy::best_match; -use tauri_mobile::{ +use cargo_mobile2::{ android::{ adb, config::{Config as AndroidConfig, Metadata as AndroidMetadata, Raw as RawAndroidConfig}, @@ -20,11 +11,20 @@ use tauri_mobile::{ env::Env, target::Target, }, - config::app::App, + config::app::{App, DEFAULT_ASSET_DIR}, opts::{FilterLevel, NoiseLevel}, os, util::prompt, }; +use clap::{Parser, Subcommand}; +use std::{ + env::set_var, + fs::{create_dir, create_dir_all, write}, + process::exit, + thread::sleep, + time::Duration, +}; +use sublime_fuzzy::best_match; use super::{ ensure_init, get_app, @@ -54,7 +54,7 @@ pub struct Cli { } #[derive(Debug, Parser)] -#[clap(about = "Initializes a Tauri Android project")] +#[clap(about = "Initialize Android target in the project")] pub struct InitOptions { /// Skip prompting for values #[clap(long)] @@ -159,7 +159,7 @@ pub fn get_config( fn env() -> Result { let env = super::env()?; - tauri_mobile::android::env::Env::from_env(env).map_err(Into::into) + cargo_mobile2::android::env::Env::from_env(env).map_err(Into::into) } fn delete_codegen_vars() { @@ -292,7 +292,10 @@ fn open_and_wait(config: &AndroidConfig, env: &Env) -> ! { } fn inject_assets(config: &AndroidConfig, tauri_config: &TauriConfig) -> Result<()> { - let asset_dir = config.project_dir().join("app/src/main/assets"); + let asset_dir = config + .project_dir() + .join("app/src/main") + .join(DEFAULT_ASSET_DIR); create_dir_all(&asset_dir)?; write( diff --git a/tooling/cli/src/mobile/android/open.rs b/tooling/cli/src/mobile/android/open.rs index a058cbdddc7c..bae50bff3d7a 100644 --- a/tooling/cli/src/mobile/android/open.rs +++ b/tooling/cli/src/mobile/android/open.rs @@ -5,10 +5,10 @@ use super::{ensure_init, env, get_app, get_config, inject_assets, MobileTarget}; use crate::{helpers::config::get as get_tauri_config, Result}; -use tauri_mobile::os; +use cargo_mobile2::os; pub fn command() -> Result<()> { - let tauri_config = get_tauri_config(None)?; + let tauri_config = get_tauri_config(tauri_utils::platform::Target::Android, None)?; let (config, _metadata) = { let tauri_config_guard = tauri_config.lock().unwrap(); diff --git a/tooling/cli/src/mobile/android/project.rs b/tooling/cli/src/mobile/android/project.rs index 7bc390156ec9..9c6029d3ce2f 100644 --- a/tooling/cli/src/mobile/android/project.rs +++ b/tooling/cli/src/mobile/android/project.rs @@ -4,9 +4,7 @@ use crate::{helpers::template, Result}; use anyhow::Context; -use handlebars::Handlebars; -use include_dir::{include_dir, Dir}; -use tauri_mobile::{ +use cargo_mobile2::{ android::{ config::{Config, Metadata}, target::Target, @@ -20,6 +18,8 @@ use tauri_mobile::{ prefix_path, }, }; +use handlebars::Handlebars; +use include_dir::{include_dir, Dir}; use std::{ ffi::OsStr, diff --git a/tooling/cli/src/mobile/init.rs b/tooling/cli/src/mobile/init.rs index 6d903d6c6478..4965f14ba9a1 100644 --- a/tooling/cli/src/mobile/init.rs +++ b/tooling/cli/src/mobile/init.rs @@ -5,8 +5,7 @@ use super::{get_app, Target}; use crate::helpers::{config::get as get_tauri_config, template::JsonMap}; use crate::Result; -use handlebars::{Context, Handlebars, Helper, HelperResult, Output, RenderContext, RenderError}; -use tauri_mobile::{ +use cargo_mobile2::{ android::{ config::Config as AndroidConfig, env::Env as AndroidEnv, target::Target as AndroidTarget, }, @@ -18,6 +17,7 @@ use tauri_mobile::{ cli::{Report, TextWrapper}, }, }; +use handlebars::{Context, Handlebars, Helper, HelperResult, Output, RenderContext, RenderError}; use std::{ env::{current_dir, var, var_os}, @@ -88,7 +88,7 @@ pub fn exec( skip_targets_install: bool, ) -> Result { let current_dir = current_dir()?; - let tauri_config = get_tauri_config(None)?; + let tauri_config = get_tauri_config(target.platform_target(), None)?; let tauri_config_guard = tauri_config.lock().unwrap(); let tauri_config_ = tauri_config_guard.as_ref().unwrap(); diff --git a/tooling/cli/src/mobile/ios/build.rs b/tooling/cli/src/mobile/ios/build.rs index 5ee74fbfe9ed..76c3d03be181 100644 --- a/tooling/cli/src/mobile/ios/build.rs +++ b/tooling/cli/src/mobile/ios/build.rs @@ -3,8 +3,8 @@ // SPDX-License-Identifier: MIT use super::{ - configure_cargo, detect_target_ok, ensure_init, env, get_app, get_config, log_finished, - open_and_wait, MobileTarget, + configure_cargo, detect_target_ok, ensure_init, env, get_app, get_config, inject_assets, + log_finished, open_and_wait, MobileTarget, }; use crate::{ build::Options as BuildOptions, @@ -20,7 +20,7 @@ use crate::{ use clap::{ArgAction, Parser}; use anyhow::Context; -use tauri_mobile::{ +use cargo_mobile2::{ apple::{config::Config as AppleConfig, target::Target}, env::Env, opts::{NoiseLevel, Profile}, @@ -30,7 +30,10 @@ use tauri_mobile::{ use std::{env::set_current_dir, fs}; #[derive(Debug, Clone, Parser)] -#[clap(about = "iOS build")] +#[clap( + about = "Build your app in release mode for iOS and generate IPAs", + long_about = "Build your app in release mode for iOS and generate IPAs. It makes use of the `build.distDir` property from your `tauri.conf.json` file. It also runs your `build.beforeBuildCommand` which usually builds your frontend into `build.distDir`." +)] pub struct Options { /// Builds with the debug flag #[clap(short, long)] @@ -78,7 +81,10 @@ pub fn command(mut options: Options, noise_level: NoiseLevel) -> Result<()> { let (merge_config, _merge_config_path) = resolve_merge_config(&options.config)?; options.config = merge_config; - let tauri_config = get_tauri_config(options.config.as_deref())?; + let tauri_config = get_tauri_config( + tauri_utils::platform::Target::Ios, + options.config.as_deref(), + )?; let (app, config) = { let tauri_config_guard = tauri_config.lock().unwrap(); let tauri_config_ = tauri_config_guard.as_ref().unwrap(); @@ -91,6 +97,7 @@ pub fn command(mut options: Options, noise_level: NoiseLevel) -> Result<()> { set_current_dir(tauri_path).with_context(|| "failed to change current working directory")?; ensure_init(config.project_dir(), MobileTarget::Ios)?; + inject_assets(&config)?; let mut env = env()?; configure_cargo(&app, None)?; @@ -126,7 +133,8 @@ fn run_build( .triple .into(), ); - let interface = crate::build::setup(&mut build_options, true)?; + let interface = + crate::build::setup(tauri_utils::platform::Target::Ios, &mut build_options, true)?; let app_settings = interface.app_settings(); let bin_path = app_settings.app_binary_path(&InterfaceOptions { diff --git a/tooling/cli/src/mobile/ios/dev.rs b/tooling/cli/src/mobile/ios/dev.rs index ec866cdc5d06..0dd16cbe0c23 100644 --- a/tooling/cli/src/mobile/ios/dev.rs +++ b/tooling/cli/src/mobile/ios/dev.rs @@ -3,8 +3,8 @@ // SPDX-License-Identifier: MIT use super::{ - configure_cargo, device_prompt, ensure_init, env, get_app, get_config, open_and_wait, - setup_dev_config, MobileTarget, APPLE_DEVELOPMENT_TEAM_ENV_VAR_NAME, + configure_cargo, device_prompt, ensure_init, env, get_app, get_config, inject_assets, + open_and_wait, setup_dev_config, MobileTarget, APPLE_DEVELOPMENT_TEAM_ENV_VAR_NAME, }; use crate::{ dev::Options as DevOptions, @@ -20,18 +20,21 @@ use crate::{ use clap::{ArgAction, Parser}; use anyhow::Context; -use dialoguer::{theme::ColorfulTheme, Select}; -use tauri_mobile::{ +use cargo_mobile2::{ apple::{config::Config as AppleConfig, device::Device, teams::find_development_teams}, config::app::App, env::Env, opts::{NoiseLevel, Profile}, }; +use dialoguer::{theme::ColorfulTheme, Select}; use std::env::{set_current_dir, set_var, var_os}; #[derive(Debug, Clone, Parser)] -#[clap(about = "iOS dev")] +#[clap( + about = "Run your app in development mode on iOS", + long_about = "Run your app in development mode on iOS with hot-reloading for the Rust code. It makes use of the `build.devPath` property from your `tauri.conf.json` file. It also runs your `build.beforeDevCommand` which usually starts your frontend devServer." +)] pub struct Options { /// List of cargo features to activate #[clap(short, long, action = ArgAction::Append, num_args(0..))] @@ -126,7 +129,10 @@ fn run_command(mut options: Options, noise_level: NoiseLevel) -> Result<()> { let (merge_config, _merge_config_path) = resolve_merge_config(&options.config)?; options.config = merge_config; - let tauri_config = get_tauri_config(options.config.as_deref())?; + let tauri_config = get_tauri_config( + tauri_utils::platform::Target::Ios, + options.config.as_deref(), + )?; let (app, config) = { let tauri_config_guard = tauri_config.lock().unwrap(); let tauri_config_ = tauri_config_guard.as_ref().unwrap(); @@ -139,6 +145,7 @@ fn run_command(mut options: Options, noise_level: NoiseLevel) -> Result<()> { set_current_dir(tauri_path).with_context(|| "failed to change current working directory")?; ensure_init(config.project_dir(), MobileTarget::Ios)?; + inject_assets(&config)?; run_dev(options, tauri_config, &app, &config, noise_level) } @@ -149,7 +156,11 @@ fn run_dev( config: &AppleConfig, noise_level: NoiseLevel, ) -> Result<()> { - setup_dev_config(&mut options.config, options.force_ip_prompt)?; + setup_dev_config( + MobileTarget::Ios, + &mut options.config, + options.force_ip_prompt, + )?; let env = env()?; let device = if options.open { None @@ -170,7 +181,8 @@ fn run_dev( .map(|d| d.target().triple.to_string()) .unwrap_or_else(|| "aarch64-apple-ios".into()), ); - let mut interface = crate::dev::setup(&mut dev_options, true)?; + let mut interface = + crate::dev::setup(tauri_utils::platform::Target::Ios, &mut dev_options, true)?; let app_settings = interface.app_settings(); let bin_path = app_settings.app_binary_path(&InterfaceOptions { @@ -221,7 +233,7 @@ fn run_dev( crate::dev::wait_dev_process(c.clone(), move |status, reason| { crate::dev::on_app_exit(status, reason, exit_on_panic, no_watch) }); - Ok(Box::new(c) as Box) + Ok(Box::new(c) as Box) } Err(e) => { crate::dev::kill_before_dev_process(); diff --git a/tooling/cli/src/mobile/ios.rs b/tooling/cli/src/mobile/ios/mod.rs similarity index 91% rename from tooling/cli/src/mobile/ios.rs rename to tooling/cli/src/mobile/ios/mod.rs index 05401a5bfda2..f500465f89ef 100644 --- a/tooling/cli/src/mobile/ios.rs +++ b/tooling/cli/src/mobile/ios/mod.rs @@ -2,25 +2,24 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -use clap::{Parser, Subcommand}; -use sublime_fuzzy::best_match; -use tauri_mobile::{ +use cargo_mobile2::{ apple::{ config::{ Config as AppleConfig, Metadata as AppleMetadata, Platform as ApplePlatform, Raw as RawAppleConfig, }, - device::Device, - ios_deploy, simctl, + device::{self, Device}, target::Target, teams::find_development_teams, }, - config::app::App, + config::app::{App, DEFAULT_ASSET_DIR}, env::Env, opts::NoiseLevel, os, util::prompt, }; +use clap::{Parser, Subcommand}; +use sublime_fuzzy::best_match; use super::{ ensure_init, env, get_app, @@ -30,7 +29,7 @@ use super::{ }; use crate::{helpers::config::Config as TauriConfig, Result}; -use std::{env::set_var, process::exit, thread::sleep, time::Duration}; +use std::{env::set_var, fs::create_dir_all, process::exit, thread::sleep, time::Duration}; mod build; mod dev; @@ -55,7 +54,7 @@ pub struct Cli { } #[derive(Debug, Parser)] -#[clap(about = "Initializes a Tauri iOS project")] +#[clap(about = "Initialize iOS target in the project")] pub struct InitOptions { /// Skip prompting for values #[clap(long)] @@ -146,8 +145,8 @@ pub fn get_config( (config, metadata) } -fn ios_deploy_device_prompt<'a>(env: &'_ Env, target: Option<&str>) -> Result> { - let device_list = ios_deploy::device_list(env) +fn connected_device_prompt<'a>(env: &'_ Env, target: Option<&str>) -> Result> { + let device_list = device::list_devices(env) .map_err(|cause| anyhow::anyhow!("Failed to detect connected iOS devices: {cause}"))?; if !device_list.is_empty() { let device = if let Some(t) = target { @@ -192,8 +191,8 @@ fn ios_deploy_device_prompt<'a>(env: &'_ Env, target: Option<&str>) -> Result) -> Result { - let simulator_list = simctl::device_list(env).map_err(|cause| { +fn simulator_prompt(env: &'_ Env, target: Option<&str>) -> Result { + let simulator_list = device::list_simulators(env).map_err(|cause| { anyhow::anyhow!("Failed to detect connected iOS Simulator devices: {cause}") })?; if !simulator_list.is_empty() { @@ -233,7 +232,7 @@ fn simulator_prompt(env: &'_ Env, target: Option<&str>) -> Result(env: &'_ Env, target: Option<&str>) -> Result> { - if let Ok(device) = ios_deploy_device_prompt(env, target) { + if let Ok(device) = connected_device_prompt(env, target) { Ok(device) } else { let simulator = simulator_prompt(env, target)?; @@ -256,3 +255,9 @@ fn open_and_wait(config: &AppleConfig, env: &Env) -> ! { sleep(Duration::from_secs(24 * 60 * 60)); } } + +fn inject_assets(config: &AppleConfig) -> Result<()> { + let asset_dir = config.project_dir().join(DEFAULT_ASSET_DIR); + create_dir_all(asset_dir)?; + Ok(()) +} diff --git a/tooling/cli/src/mobile/ios/open.rs b/tooling/cli/src/mobile/ios/open.rs index b9e8d2b419ea..2991618e7f4f 100644 --- a/tooling/cli/src/mobile/ios/open.rs +++ b/tooling/cli/src/mobile/ios/open.rs @@ -2,13 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -use super::{ensure_init, env, get_app, get_config, MobileTarget}; +use super::{ensure_init, env, get_app, get_config, inject_assets, MobileTarget}; use crate::{helpers::config::get as get_tauri_config, Result}; -use tauri_mobile::os; +use cargo_mobile2::os; pub fn command() -> Result<()> { - let tauri_config = get_tauri_config(None)?; + let tauri_config = get_tauri_config(tauri_utils::platform::Target::Ios, None)?; let (config, _metadata) = { let tauri_config_guard = tauri_config.lock().unwrap(); @@ -17,6 +17,7 @@ pub fn command() -> Result<()> { }; ensure_init(config.project_dir(), MobileTarget::Ios)?; + inject_assets(&config)?; let env = env()?; os::open_file_with("Xcode", config.project_dir(), &env).map_err(Into::into) } diff --git a/tooling/cli/src/mobile/ios/project.rs b/tooling/cli/src/mobile/ios/project.rs index d1b1a74171c1..8339e6e34a12 100644 --- a/tooling/cli/src/mobile/ios/project.rs +++ b/tooling/cli/src/mobile/ios/project.rs @@ -4,14 +4,7 @@ use crate::{helpers::template, Result}; use anyhow::Context; -use handlebars::Handlebars; -use include_dir::{include_dir, Dir}; -use std::{ - ffi::{OsStr, OsString}, - fs::{create_dir_all, OpenOptions}, - path::{Component, PathBuf}, -}; -use tauri_mobile::{ +use cargo_mobile2::{ apple::{ config::{Config, Metadata}, deps, rust_version_check, @@ -21,6 +14,13 @@ use tauri_mobile::{ target::TargetTrait as _, util::{self, cli::TextWrapper}, }; +use handlebars::Handlebars; +use include_dir::{include_dir, Dir}; +use std::{ + ffi::{OsStr, OsString}, + fs::{create_dir_all, OpenOptions}, + path::{Component, PathBuf}, +}; const TEMPLATE_DIR: Dir<'_> = include_dir!("templates/mobile/ios"); diff --git a/tooling/cli/src/mobile/ios/xcode_script.rs b/tooling/cli/src/mobile/ios/xcode_script.rs index d9e5ef1390bf..d24e98f3d10a 100644 --- a/tooling/cli/src/mobile/ios/xcode_script.rs +++ b/tooling/cli/src/mobile/ios/xcode_script.rs @@ -9,8 +9,8 @@ use crate::{ Result, }; +use cargo_mobile2::{apple::target::Target, opts::Profile}; use clap::Parser; -use tauri_mobile::{apple::target::Target, opts::Profile}; use std::{ collections::HashMap, @@ -68,7 +68,7 @@ pub fn command(options: Options) -> Result<()> { let profile = profile_from_configuration(&options.configuration); let macos = macos_from_platform(&options.platform); - let tauri_config = get_tauri_config(None)?; + let tauri_config = get_tauri_config(tauri_utils::platform::Target::Ios, None)?; let (config, metadata, cli_options) = { let tauri_config_guard = tauri_config.lock().unwrap(); diff --git a/tooling/cli/src/mobile/mod.rs b/tooling/cli/src/mobile/mod.rs index 94a7824179ac..d1705d357684 100644 --- a/tooling/cli/src/mobile/mod.rs +++ b/tooling/cli/src/mobile/mod.rs @@ -19,6 +19,12 @@ use jsonrpsee_client_transport::ws::WsTransportClientBuilder; use jsonrpsee_core::rpc_params; use serde::{Deserialize, Serialize}; +use cargo_mobile2::{ + config::app::{App, Raw as RawAppConfig}, + env::Error as EnvError, + opts::{NoiseLevel, Profile}, + ChildHandle, +}; use std::{ collections::HashMap, env::{set_var, temp_dir}, @@ -33,18 +39,12 @@ use std::{ Arc, }, }; -use tauri_mobile::{ - config::app::{App, Raw as RawAppConfig}, - env::Error as EnvError, - opts::{NoiseLevel, Profile}, - ChildHandle, -}; use tokio::runtime::Runtime; #[cfg(not(windows))] -use tauri_mobile::env::Env; +use cargo_mobile2::env::Env; #[cfg(windows)] -use tauri_mobile::os::Env; +use cargo_mobile2::os::Env; pub mod android; mod init; @@ -123,6 +123,14 @@ impl Target { Self::Ios => "xcode-script", } } + + fn platform_target(&self) -> tauri_utils::platform::Target { + match self { + Self::Android => tauri_utils::platform::Target::Android, + #[cfg(target_os = "macos")] + Self::Ios => tauri_utils::platform::Target::Ios, + } + } } #[derive(Debug, Clone, Serialize, Deserialize)] @@ -145,10 +153,11 @@ impl Default for CliOptions { } fn setup_dev_config( + target: Target, config_extension: &mut Option, force_ip_prompt: bool, ) -> crate::Result<()> { - let config = get_config(config_extension.as_deref())?; + let config = get_config(target.platform_target(), config_extension.as_deref())?; let mut dev_path = config .lock() diff --git a/tooling/cli/src/plugin.rs b/tooling/cli/src/plugin.rs deleted file mode 100644 index 89c7153ead17..000000000000 --- a/tooling/cli/src/plugin.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2019-2023 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT - -use clap::{Parser, Subcommand}; - -use crate::Result; - -mod add; -mod android; -mod init; -mod ios; - -#[derive(Parser)] -#[clap( - author, - version, - about = "Manage Tauri plugins", - subcommand_required(true), - arg_required_else_help(true) -)] -pub struct Cli { - #[clap(subcommand)] - command: Commands, -} - -#[derive(Subcommand)] -enum Commands { - Init(init::Options), - Add(add::Options), - Android(android::Cli), - Ios(ios::Cli), -} - -pub fn command(cli: Cli) -> Result<()> { - match cli.command { - Commands::Init(options) => init::command(options)?, - Commands::Add(options) => add::command(options)?, - Commands::Android(cli) => android::command(cli)?, - Commands::Ios(cli) => ios::command(cli)?, - } - - Ok(()) -} diff --git a/tooling/cli/src/plugin/android.rs b/tooling/cli/src/plugin/android.rs index 83df5e5a3f75..b1f538b79e19 100644 --- a/tooling/cli/src/plugin/android.rs +++ b/tooling/cli/src/plugin/android.rs @@ -17,7 +17,7 @@ use std::{ #[clap( author, version, - about = "Manage the Android project for Tauri plugins", + about = "Manage the Android project for a Tauri plugin", subcommand_required(true), arg_required_else_help(true) )] @@ -28,15 +28,15 @@ pub struct Cli { #[derive(Subcommand)] enum Commands { - Add(AddOptions), + Init(InitOptions), } #[derive(Debug, Parser)] -#[clap(about = "Adds the Android project to an existing Tauri plugin")] -pub struct AddOptions { +#[clap(about = "Initializes the Android project for an existing Tauri plugin")] +pub struct InitOptions { /// Name of your Tauri plugin. Must match the current plugin's name. - #[clap(short = 'n', long = "name")] - plugin_name: String, + /// If not specified, it will be infered from the current directory. + plugin_name: Option, /// The output directory. #[clap(short, long)] #[clap(default_value_t = current_dir().expect("failed to read cwd").to_string_lossy().into_owned())] @@ -45,7 +45,12 @@ pub struct AddOptions { pub fn command(cli: Cli) -> Result<()> { match cli.command { - Commands::Add(options) => { + Commands::Init(options) => { + let plugin_name = match options.plugin_name { + None => super::infer_plugin_name(std::env::current_dir()?)?, + Some(name) => name, + }; + let out_dir = PathBuf::from(options.out_dir); if out_dir.join("android").exists() { return Err(anyhow::anyhow!("android folder already exists")); @@ -53,7 +58,7 @@ pub fn command(cli: Cli) -> Result<()> { let plugin_id = super::init::request_input( "What should be the Android Package ID for your plugin?", - Some(format!("com.plugin.{}", options.plugin_name)), + Some(format!("com.plugin.{}", plugin_name)), false, false, )? @@ -62,7 +67,7 @@ pub fn command(cli: Cli) -> Result<()> { let handlebars = Handlebars::new(); let mut data = BTreeMap::new(); - super::init::plugin_name_data(&mut data, &options.plugin_name); + super::init::plugin_name_data(&mut data, &plugin_name); let mut created_dirs = Vec::new(); template::render_with_generator( @@ -114,7 +119,7 @@ pub fn init() -> TauriPlugin {{ .build() }} "#, - name = options.plugin_name, + name = plugin_name, identifier = plugin_id ); diff --git a/tooling/cli/src/plugin/init.rs b/tooling/cli/src/plugin/init.rs index 77cba7d3701e..ef1c089ae719 100644 --- a/tooling/cli/src/plugin/init.rs +++ b/tooling/cli/src/plugin/init.rs @@ -11,7 +11,7 @@ use anyhow::Context; use clap::Parser; use dialoguer::Input; use handlebars::{to_json, Handlebars}; -use heck::{AsKebabCase, ToKebabCase, ToPascalCase, ToSnakeCase}; +use heck::{ToKebabCase, ToPascalCase, ToSnakeCase}; use include_dir::{include_dir, Dir}; use log::warn; use std::{ @@ -27,27 +27,36 @@ use std::{ pub const TEMPLATE_DIR: Dir<'_> = include_dir!("templates/plugin"); #[derive(Debug, Parser)] -#[clap(about = "Initializes a Tauri plugin project")] +#[clap(about = "Initialize a Tauri plugin project on an existing directory")] pub struct Options { - /// Name of your Tauri plugin - #[clap(short = 'n', long = "name")] - plugin_name: String, + /// Name of your Tauri plugin. + /// If not specified, it will be infered from the current directory. + pub(crate) plugin_name: Option, /// Initializes a Tauri plugin without the TypeScript API #[clap(long)] - no_api: bool, + pub(crate) no_api: bool, /// Initializes a Tauri core plugin (internal usage) #[clap(long, hide(true))] - tauri: bool, + pub(crate) tauri: bool, /// Set target directory for init #[clap(short, long)] #[clap(default_value_t = current_dir().expect("failed to read cwd").display().to_string())] - directory: String, + pub(crate) directory: String, /// Path of the Tauri project to use (relative to the cwd) #[clap(short, long)] - tauri_path: Option, + pub(crate) tauri_path: Option, /// Author name #[clap(short, long)] - author: Option, + pub(crate) author: Option, + /// Whether to initialize an Android project for the plugin. + #[clap(long)] + pub(crate) android: bool, + /// Whether to initialize an iOS project for the plugin. + #[clap(long)] + pub(crate) ios: bool, + /// Whether to initialize Android and iOS projects for the plugin. + #[clap(long)] + pub(crate) mobile: bool, } impl Options { @@ -64,12 +73,15 @@ impl Options { pub fn command(mut options: Options) -> Result<()> { options.load(); - let template_target_path = PathBuf::from(options.directory).join(format!( - "tauri-plugin-{}", - AsKebabCase(&options.plugin_name) - )); + + let plugin_name = match options.plugin_name { + None => super::infer_plugin_name(&options.directory)?, + Some(name) => name, + }; + + let template_target_path = PathBuf::from(options.directory); let metadata = crates_metadata()?; - if template_target_path.exists() { + if std::fs::read_dir(&template_target_path)?.count() > 0 { warn!("Plugin dir ({:?}) not empty.", template_target_path); } else { let (tauri_dep, tauri_example_dep, tauri_build_dep) = @@ -101,7 +113,7 @@ pub fn command(mut options: Options) -> Result<()> { handlebars.register_escape_fn(handlebars::no_escape); let mut data = BTreeMap::new(); - plugin_name_data(&mut data, &options.plugin_name); + plugin_name_data(&mut data, &plugin_name); data.insert("tauri_dep", to_json(tauri_dep)); data.insert("tauri_example_dep", to_json(tauri_example_dep)); data.insert("tauri_build_dep", to_json(tauri_build_dep)); @@ -120,15 +132,20 @@ pub fn command(mut options: Options) -> Result<()> { ); } - let plugin_id = request_input( - "What should be the Android Package ID for your plugin?", - Some(format!("com.plugin.{}", options.plugin_name)), - false, - false, - )? - .unwrap(); + let plugin_id = if options.android || options.mobile { + let plugin_id = request_input( + "What should be the Android Package ID for your plugin?", + Some(format!("com.plugin.{}", plugin_name)), + false, + false, + )? + .unwrap(); - data.insert("android_package_id", to_json(&plugin_id)); + data.insert("android_package_id", to_json(&plugin_id)); + Some(plugin_id) + } else { + None + }; let mut created_dirs = Vec::new(); template::render_with_generator( @@ -157,13 +174,18 @@ pub fn command(mut options: Options) -> Result<()> { } } "android" => { - return generate_android_out_file( - &path, - &template_target_path, - &plugin_id.replace('.', "/"), - &mut created_dirs, - ); + if options.android || options.mobile { + return generate_android_out_file( + &path, + &template_target_path, + &plugin_id.as_ref().unwrap().replace('.', "/"), + &mut created_dirs, + ); + } else { + return Ok(None); + } } + "ios" if !(options.ios || options.mobile) => return Ok(None), "webview-dist" | "webview-src" | "package.json" => { if options.no_api { return Ok(None); diff --git a/tooling/cli/src/plugin/ios.rs b/tooling/cli/src/plugin/ios.rs index b40c890d04b1..104a7759b31f 100644 --- a/tooling/cli/src/plugin/ios.rs +++ b/tooling/cli/src/plugin/ios.rs @@ -18,7 +18,7 @@ use std::{ #[clap( author, version, - about = "Manage the iOS project for Tauri plugins", + about = "Manage the iOS project for a Tauri plugin", subcommand_required(true), arg_required_else_help(true) )] @@ -29,15 +29,15 @@ pub struct Cli { #[derive(Subcommand)] enum Commands { - Add(AddOptions), + Init(InitOptions), } #[derive(Debug, Parser)] -#[clap(about = "Adds the iOS project to an existing Tauri plugin")] -pub struct AddOptions { +#[clap(about = "Initializes the iOS project for an existing Tauri plugin")] +pub struct InitOptions { /// Name of your Tauri plugin. Must match the current plugin's name. - #[clap(short = 'n', long = "name")] - plugin_name: String, + /// If not specified, it will be infered from the current directory. + plugin_name: Option, /// The output directory. #[clap(short, long)] #[clap(default_value_t = current_dir().expect("failed to read cwd").to_string_lossy().into_owned())] @@ -46,7 +46,12 @@ pub struct AddOptions { pub fn command(cli: Cli) -> Result<()> { match cli.command { - Commands::Add(options) => { + Commands::Init(options) => { + let plugin_name = match options.plugin_name { + None => super::infer_plugin_name(std::env::current_dir()?)?, + Some(name) => name, + }; + let out_dir = PathBuf::from(options.out_dir); if out_dir.join("ios").exists() { return Err(anyhow::anyhow!("ios folder already exists")); @@ -55,7 +60,7 @@ pub fn command(cli: Cli) -> Result<()> { let handlebars = Handlebars::new(); let mut data = BTreeMap::new(); - super::init::plugin_name_data(&mut data, &options.plugin_name); + super::init::plugin_name_data(&mut data, &plugin_name); let mut created_dirs = Vec::new(); template::render_with_generator( @@ -111,7 +116,7 @@ pub fn init() -> TauriPlugin {{ .build() }} "#, - name = options.plugin_name, + name = plugin_name, ); log::info!("iOS project added"); diff --git a/tooling/cli/src/plugin/mod.rs b/tooling/cli/src/plugin/mod.rs new file mode 100644 index 000000000000..13f48a6fddfa --- /dev/null +++ b/tooling/cli/src/plugin/mod.rs @@ -0,0 +1,73 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use std::path::Path; + +use clap::{Parser, Subcommand}; + +use crate::Result; + +mod android; +mod init; +mod ios; +mod new; + +#[derive(Parser)] +#[clap( + author, + version, + about = "Manage or create Tauri plugins", + subcommand_required(true), + arg_required_else_help(true) +)] +pub struct Cli { + #[clap(subcommand)] + command: Commands, +} + +#[derive(Subcommand)] +enum Commands { + New(new::Options), + Init(init::Options), + Android(android::Cli), + Ios(ios::Cli), +} + +pub fn command(cli: Cli) -> Result<()> { + match cli.command { + Commands::New(options) => new::command(options)?, + Commands::Init(options) => init::command(options)?, + Commands::Android(cli) => android::command(cli)?, + Commands::Ios(cli) => ios::command(cli)?, + } + + Ok(()) +} + +fn infer_plugin_name>(directory: P) -> Result { + let dir = directory.as_ref(); + let cargo_toml_path = dir.join("Cargo.toml"); + let name = if cargo_toml_path.exists() { + let contents = std::fs::read(cargo_toml_path)?; + let cargo_toml: toml::Value = toml::from_slice(&contents)?; + cargo_toml + .get("package") + .and_then(|v| v.get("name")) + .map(|v| v.as_str().unwrap_or_default()) + .unwrap_or_default() + .to_string() + } else { + dir + .file_name() + .unwrap_or_default() + .to_string_lossy() + .to_string() + }; + Ok( + name + .strip_prefix("tauri-plugin-") + .unwrap_or(&name) + .to_string(), + ) +} diff --git a/tooling/cli/src/plugin/new.rs b/tooling/cli/src/plugin/new.rs new file mode 100644 index 000000000000..15d406c7390a --- /dev/null +++ b/tooling/cli/src/plugin/new.rs @@ -0,0 +1,67 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use crate::Result; +use clap::Parser; +use std::path::PathBuf; + +#[derive(Debug, Parser)] +#[clap(about = "Initializes a new Tauri plugin project")] +pub struct Options { + /// Name of your Tauri plugin + plugin_name: String, + /// Initializes a Tauri plugin without the TypeScript API + #[clap(long)] + no_api: bool, + /// Initializes a Tauri core plugin (internal usage) + #[clap(long, hide(true))] + tauri: bool, + /// Set target directory for init + #[clap(short, long)] + directory: Option, + /// Path of the Tauri project to use (relative to the cwd) + #[clap(short, long)] + tauri_path: Option, + /// Author name + #[clap(short, long)] + author: Option, + /// Whether to initialize an Android project for the plugin. + #[clap(long)] + android: bool, + /// Whether to initialize an iOS project for the plugin. + #[clap(long)] + ios: bool, + /// Whether to initialize Android and iOS projects for the plugin. + #[clap(long)] + mobile: bool, +} + +impl From for super::init::Options { + fn from(o: Options) -> Self { + Self { + plugin_name: Some(o.plugin_name), + no_api: o.no_api, + tauri: o.tauri, + directory: o.directory.unwrap(), + tauri_path: o.tauri_path, + author: o.author, + android: o.android, + ios: o.ios, + mobile: o.mobile, + } + } +} + +pub fn command(mut options: Options) -> Result<()> { + let cwd = std::env::current_dir()?; + if let Some(dir) = &options.directory { + std::fs::create_dir_all(cwd.join(dir))?; + } else { + let target = cwd.join(format!("tauri-plugin-{}", options.plugin_name)); + std::fs::create_dir_all(&target)?; + options.directory.replace(target.display().to_string()); + } + + super::init::command(options.into()) +} diff --git a/tooling/cli/src/signer/generate.rs b/tooling/cli/src/signer/generate.rs index 5bcb69c25d6c..bd65c3921366 100644 --- a/tooling/cli/src/signer/generate.rs +++ b/tooling/cli/src/signer/generate.rs @@ -11,7 +11,7 @@ use std::path::PathBuf; use tauri_utils::display_path; #[derive(Debug, Parser)] -#[clap(about = "Generate keypair to sign files")] +#[clap(about = "Generate a new signing key to sign files")] pub struct Options { /// Set private key password when signing #[clap(short, long)] diff --git a/tooling/cli/src/signer.rs b/tooling/cli/src/signer/mod.rs similarity index 91% rename from tooling/cli/src/signer.rs rename to tooling/cli/src/signer/mod.rs index f14479f96f60..ec461ee7a201 100644 --- a/tooling/cli/src/signer.rs +++ b/tooling/cli/src/signer/mod.rs @@ -12,7 +12,7 @@ mod sign; #[clap( author, version, - about = "Tauri updater signer", + about = "Generate signing keys for Tauri updater or sign files", subcommand_required(true), arg_required_else_help(true) )] diff --git a/tooling/cli/templates/plugin/__example-basic/vanilla/src-tauri/tauri.conf.json b/tooling/cli/templates/plugin/__example-basic/vanilla/src-tauri/tauri.conf.json index 787dadd50f1b..723f2dd24355 100644 --- a/tooling/cli/templates/plugin/__example-basic/vanilla/src-tauri/tauri.conf.json +++ b/tooling/cli/templates/plugin/__example-basic/vanilla/src-tauri/tauri.conf.json @@ -50,7 +50,7 @@ } ], "security": { - "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'; connect-src ipc: https://ipc.localhost" + "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'; connect-src ipc: http://ipc.localhost" } } } \ No newline at end of file