diff --git a/.cargo/audit.toml b/.cargo/audit.toml index 23c3852b..268d3716 100644 --- a/.cargo/audit.toml +++ b/.cargo/audit.toml @@ -7,5 +7,5 @@ ignore = [ # wry needs kuchiki on Android "RUSTSEC-2023-0019", # atty is only used when the `colored` feature is enabled on tauri-plugin-log - "RUSTSEC-2021-0145" -] \ No newline at end of file + "RUSTSEC-2021-0145", +] diff --git a/.changes/beta.md b/.changes/beta.md deleted file mode 100644 index 3761074e..00000000 --- a/.changes/beta.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -"authenticator": patch -"autostart": patch -"barcode-scanner": patch -"biometric": patch -"cli": patch -"clipboard-manager": patch -"deep-link": patch -"dialog": patch -"fs": patch -"global-shortcut": patch -"http": patch -"localhost": patch -"log-plugin": patch -"nfc": patch -"notification": patch -"os": patch -"persisted-scope": patch -"positioner": patch -"process": patch -"shell": patch -"single-instance": patch -"sql": patch -"store": patch -"stronghold": patch -"updater": patch -"upload": patch -"websocket": patch -"window-state": patch -"authenticator-js": patch -"autostart-js": patch -"barcode-scanner-js": patch -"biometric-js": patch -"cli-js": patch -"clipboard-manager-js": patch -"deep-link-js": patch -"dialog-js": patch -"fs-js": patch -"global-shortcut-js": patch -"http-js": patch -"log-js": patch -"nfc-js": patch -"notification-js": patch -"os-js": patch -"positioner-js": patch -"process-js": patch -"shell-js": patch -"sql-js": patch -"store-js": patch -"stronghold-js": patch -"updater-js": patch -"upload-js": patch -"websocket-js": patch -"window-state-js": patch ---- - -Update to tauri beta. diff --git a/.changes/config.json b/.changes/config.json index 78bcd57b..93ed46e3 100644 --- a/.changes/config.json +++ b/.changes/config.json @@ -3,24 +3,50 @@ "pkgManagers": { "javascript": { "version": true, - "getPublishedVersion": "node ../../.scripts/covector/package-latest-version.cjs npm ${ pkgFile.pkg.name } ${ pkgFile.pkg.version }", - "publish": ["pnpm build", "pnpm publish --access public --no-git-checks"] + "getPublishedVersion": { + "use": "fetch:check", + "options": { + "url": "https://registry.npmjs.com/${ pkg.pkgFile.pkg.name }/${ pkg.pkgFile.version }" + } + }, + "publish": [ + { + "command": "pnpm build", + "dryRunCommand": "pnpm build" + }, + { + "command": "echo '
\n

PNPM Publish

\n\n```'", + "dryRunCommand": true, + "pipe": true + }, + { + "command": "npm publish --provenance --access public", + "dryRunCommand": "npm publish --provenance --access public --dry-run", + "pipe": true + }, + { + "command": "echo '```\n\n
\n'", + "dryRunCommand": true, + "pipe": true + } + ] }, "rust": { "version": true, - "getPublishedVersion": "node ../../.scripts/covector/package-latest-version.cjs cargo ${ pkgFile.pkg.package.name } ${ pkgFile.pkg.package.version }", + "getPublishedVersion": { + "use": "fetch:check", + "options": { + "url": "https://crates.io/api/v1/crates/${ pkg.pkgFile.pkg.package.name }/${ pkg.pkgFile.version }" + } + }, "publish": [ - { - "command": "cargo package --no-verify", - "dryRunCommand": true - }, { "command": "echo '
\n

Cargo Publish

\n\n```'", "dryRunCommand": true, "pipe": true }, { - "command": "cargo publish", + "command": "cargo publish --no-verify", "dryRunCommand": "cargo publish --dry-run", "pipe": true }, @@ -40,19 +66,23 @@ "dependencies": [ "barcode-scanner", "biometric", - "log-plugin", + "log", "cli", "clipboard-manager", "dialog", "fs", "global-shortcut", + "opener", "http", "nfc", "notification", "os", "process", "shell", - "updater" + "store", + "updater", + "geolocation", + "haptics" ] }, "api-example-js": { @@ -68,12 +98,14 @@ "dialog-js", "fs-js", "global-shortcut-js", + "opener-js", "http-js", "nfc-js", "notification-js", "os-js", "process-js", "shell-js", + "store-js", "updater-js" ], "postversion": "pnpm install --no-frozen-lockfile" @@ -85,14 +117,6 @@ "dependencies": ["deep-link-js"], "postversion": "pnpm install --no-frozen-lockfile" }, - "authenticator": { - "path": "./plugins/authenticator", - "manager": "rust" - }, - "authenticator-js": { - "path": "./plugins/authenticator", - "manager": "javascript" - }, "autostart": { "path": "./plugins/autostart", "manager": "rust" @@ -156,6 +180,15 @@ }, "dialog-js": { "path": "./plugins/dialog", + "manager": "javascript", + "dependencies": ["fs-js"] + }, + "geolocation": { + "path": "./plugins/geolocation", + "manager": "rust" + }, + "geolocation-js": { + "path": "./plugins/geolocation", "manager": "javascript" }, "global-shortcut": { @@ -166,6 +199,22 @@ "path": "./plugins/global-shortcut", "manager": "javascript" }, + "opener": { + "path": "./plugins/opener", + "manager": "rust" + }, + "opener-js": { + "path": "./plugins/opener", + "manager": "javascript" + }, + "haptics": { + "path": "./plugins/haptics", + "manager": "rust" + }, + "haptics-js": { + "path": "./plugins/haptics", + "manager": "javascript" + }, "http": { "path": "./plugins/http", "manager": "rust", @@ -173,13 +222,14 @@ }, "http-js": { "path": "./plugins/http", - "manager": "javascript" + "manager": "javascript", + "dependencies": ["fs-js"] }, "localhost": { "path": "./plugins/localhost", "manager": "rust" }, - "log-plugin": { + "log": { "path": "./plugins/log", "manager": "rust" }, @@ -242,32 +292,12 @@ }, "single-instance": { "path": "./plugins/single-instance", - "manager": "rust" + "manager": "rust", + "dependencies": ["deep-link"] }, "sql": { "path": "./plugins/sql", - "manager": "rust", - "publish": [ - { - "command": "cargo package --no-verify", - "dryRunCommand": true - }, - { - "command": "echo '
\n

Cargo Publish

\n\n```'", - "dryRunCommand": true, - "pipe": true - }, - { - "command": "cargo publish --features sqlite", - "dryRunCommand": "cargo publish --features sqlite --dry-run", - "pipe": true - }, - { - "command": "echo '```\n\n
\n'", - "dryRunCommand": true, - "pipe": true - } - ] + "manager": "rust" }, "sql-js": { "path": "./plugins/sql", diff --git a/.changes/dialog-can-create-directories.md b/.changes/dialog-can-create-directories.md deleted file mode 100644 index 9b62fbdb..00000000 --- a/.changes/dialog-can-create-directories.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -"dialog": "patch" -"dialog-js": "patch" ---- - -Allow configuring `canCreateDirectories` for open and save dialogs on macOS, if not configured, it will be set to `true` by default. diff --git a/.changes/fix-macos-cwd-single-instance.md b/.changes/fix-macos-cwd-single-instance.md new file mode 100644 index 00000000..2d528d1f --- /dev/null +++ b/.changes/fix-macos-cwd-single-instance.md @@ -0,0 +1,5 @@ +--- +single-instance: patch +--- + +fix `cwd` in single instance on macOS, which was the cwd of the first instance, instead of the second (like it is on windows and linux) diff --git a/.changes/fix-zbus-import.md b/.changes/fix-zbus-import.md deleted file mode 100644 index e78a3cc8..00000000 --- a/.changes/fix-zbus-import.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"single-instance": patch ---- - -Fix `zbus::blocking::connection::Builder` import. diff --git a/.changes/fs-watch-cleanup.md b/.changes/fs-watch-cleanup.md new file mode 100644 index 00000000..c46559a7 --- /dev/null +++ b/.changes/fs-watch-cleanup.md @@ -0,0 +1,6 @@ +--- +fs: minor +fs-js: minor +--- + +Reduce the overhead of `watch` and `unwatch` diff --git a/.changes/http-fix-204.md b/.changes/http-fix-204.md new file mode 100644 index 00000000..d98241cb --- /dev/null +++ b/.changes/http-fix-204.md @@ -0,0 +1,6 @@ +--- +"http": patch +"http-js": patch +--- + +Properly handle responses with status code 204. diff --git a/.changes/http-user-agent.md b/.changes/http-user-agent.md deleted file mode 100644 index b323659d..00000000 --- a/.changes/http-user-agent.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -"http": "patch" -"http-js": "patch" ---- - -Allow `User-Agent` header to be set. diff --git a/.changes/msrv-1.75.md b/.changes/msrv-1.75.md deleted file mode 100644 index c694ae87..00000000 --- a/.changes/msrv-1.75.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -"authenticator": patch -"autostart": patch -"barcode-scanner": patch -"biometric": patch -"cli": patch -"clipboard-manager": patch -"deep-link": patch -"dialog": patch -"fs": patch -"global-shortcut": patch -"http": patch -"localhost": patch -"log-plugin": patch -"nfc": patch -"notification": patch -"os": patch -"persisted-scope": patch -"positioner": patch -"process": patch -"shell": patch -"single-instance": patch -"sql": patch -"store": patch -"stronghold": patch -"updater": patch -"upload": patch -"websocket": patch -"window-state": patch ---- - -Update MSRV to 1.75. diff --git a/.changes/opener-windows-0.61.md b/.changes/opener-windows-0.61.md new file mode 100644 index 00000000..006f4ceb --- /dev/null +++ b/.changes/opener-windows-0.61.md @@ -0,0 +1,6 @@ +--- +"opener": patch +"opener-js": patch +--- + +Update `windows` crate to 0.61 to align with Tauri 2.5 diff --git a/.changes/pre.json b/.changes/pre.json deleted file mode 100644 index f9896471..00000000 --- a/.changes/pre.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "tag": "beta", - "changes": [ - ".changes/beta.md", - ".changes/fix-zbus-import.md", - ".changes/msrv-1.75.md", - ".changes/tauri-beta-4.md" - ] -} diff --git a/.changes/readme.md b/.changes/readme.md index 002f4643..6d9396ba 100644 --- a/.changes/readme.md +++ b/.changes/readme.md @@ -6,12 +6,14 @@ As you create PRs and make changes that require a version bump, please add a new When you select the version bump required, you do _not_ need to consider dependencies. Only note the package with the actual change, and any packages that depend on that package will be bumped automatically in the process. +**Note, that in this repository, even if only the Rust code or only the JavaScript code of a plugin changed, both packages need to be bumped with the same increment!** + Use the following format: ```md --- "package-a": patch -"package-b": minor +"package-b": minor:feat --- Change summary goes here diff --git a/.changes/tauri-beta-4.md b/.changes/tauri-beta-4.md deleted file mode 100644 index 53026485..00000000 --- a/.changes/tauri-beta-4.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -"authenticator": patch -"autostart": patch -"barcode-scanner": patch -"biometric": patch -"cli": patch -"clipboard-manager": patch -"deep-link": patch -"dialog": patch -"fs": patch -"global-shortcut": patch -"http": patch -"localhost": patch -"log-plugin": patch -"nfc": patch -"notification": patch -"os": patch -"persisted-scope": patch -"positioner": patch -"process": patch -"shell": patch -"single-instance": patch -"sql": patch -"store": patch -"stronghold": patch -"updater": patch -"upload": patch -"websocket": patch -"window-state": patch -"authenticator-js": patch -"autostart-js": patch -"barcode-scanner-js": patch -"biometric-js": patch -"cli-js": patch -"clipboard-manager-js": patch -"deep-link-js": patch -"dialog-js": patch -"fs-js": patch -"global-shortcut-js": patch -"http-js": patch -"log-js": patch -"nfc-js": patch -"notification-js": patch -"os-js": patch -"positioner-js": patch -"process-js": patch -"shell-js": patch -"sql-js": patch -"store-js": patch -"stronghold-js": patch -"updater-js": patch -"upload-js": patch -"websocket-js": patch -"window-state-js": patch ---- - -Update to tauri beta.4. diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index d7526cfb..00000000 --- a/.eslintignore +++ /dev/null @@ -1,8 +0,0 @@ -target -node_modules -dist -build/ -dist-js -api-iife.js -init-iife.js -init.js \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 84c29bc5..00000000 --- a/.eslintrc.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "env": { - "browser": true, - "es2021": true - }, - "extends": [ - "prettier", - "eslint:recommended", - "plugin:@typescript-eslint/recommended", - "plugin:security/recommended-legacy" - ], - "overrides": [], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": "latest", - "sourceType": "module" - }, - "plugins": ["@typescript-eslint"], - "rules": {} -} diff --git a/.github/sponsors/rescue.png b/.github/sponsors/rescue.png new file mode 100644 index 00000000..2b5916f4 Binary files /dev/null and b/.github/sponsors/rescue.png differ diff --git a/.github/workflows/audit-javascript.yml b/.github/workflows/audit-javascript.yml index 618ebf59..f1a3ec3f 100644 --- a/.github/workflows/audit-javascript.yml +++ b/.github/workflows/audit-javascript.yml @@ -7,23 +7,23 @@ name: Audit JavaScript on: workflow_dispatch: schedule: - - cron: "0 0 * * *" + - cron: '0 0 * * *' push: branches: - v1 - v2 paths: - - ".github/workflows/audit-javascript.yml" - - "**/pnpm-lock.yaml" - - "**/package.json" + - '.github/workflows/audit-javascript.yml' + - '**/pnpm-lock.yaml' + - '**/package.json' pull_request: branches: - v1 - v2 paths: - - ".github/workflows/audit-javascript.yml" - - "**/pnpm-lock.yaml" - - "**/package.json" + - '.github/workflows/audit-javascript.yml' + - '**/pnpm-lock.yaml' + - '**/package.json' concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -33,20 +33,20 @@ jobs: audit-js: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Cache pnpm modules - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.pnpm-store key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}- - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: - node-version: 18 - - uses: pnpm/action-setup@v2 + node-version: 'lts/*' + - uses: pnpm/action-setup@v4 with: - version: 7.x.x + version: 10.x.x run_install: true - name: audit run: pnpm audit diff --git a/.github/workflows/audit-rust.yml b/.github/workflows/audit-rust.yml index a2d61a7f..e0c72a89 100644 --- a/.github/workflows/audit-rust.yml +++ b/.github/workflows/audit-rust.yml @@ -7,23 +7,23 @@ name: Audit Rust on: workflow_dispatch: schedule: - - cron: "0 0 * * *" + - cron: '0 0 * * *' push: branches: - v1 - v2 paths: - - ".github/workflows/audit-rust.yml" - - "**/Cargo.lock" - - "**/Cargo.toml" + - '.github/workflows/audit-rust.yml' + - '**/Cargo.lock' + - '**/Cargo.toml' pull_request: branches: - v1 - v2 paths: - - ".github/workflows/audit-rust.yml" - - "**/Cargo.lock" - - "**/Cargo.toml" + - '.github/workflows/audit-rust.yml' + - '**/Cargo.lock' + - '**/Cargo.toml' concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -33,7 +33,7 @@ jobs: audit-rust: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: rustsec/audit-check@v1 with: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/check-change-files.yml b/.github/workflows/check-change-files.yml new file mode 100644 index 00000000..898f265f --- /dev/null +++ b/.github/workflows/check-change-files.yml @@ -0,0 +1,44 @@ +# Copyright 2019-2023 Tauri Programme within The Commons Conservancy +# SPDX-License-Identifier: Apache-2.0 +# SPDX-License-Identifier: MIT + +name: check change files + +on: + pull_request: + paths: + - '.changes/*.md' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: check change files end with .md + run: | + for file in .changes/* + do + if [[ ! "$file" =~ \.(md|json)$ ]]; then + echo ".changes directory should only contain files that end with .md" + echo "found an invalid file in .changes directory:" + echo "$file" + exit 1 + fi + done + + - uses: dorny/paths-filter@v3 + id: filter + with: + list-files: shell + filters: | + changes: + - added|modified: '.changes/*.md' + + - name: check + run: node ./.scripts/ci/check-change-files.js ${{ steps.filter.outputs.changes_files }} + if: ${{ steps.filter.outputs.changes == 'true' }} diff --git a/.github/workflows/check-generated-files.yml b/.github/workflows/check-generated-files.yml index 52be59f0..6a513b23 100644 --- a/.github/workflows/check-generated-files.yml +++ b/.github/workflows/check-generated-files.yml @@ -7,8 +7,9 @@ name: check generated files on: pull_request: paths: - - ".github/workflows/check-generated-files.yml" - - "**/guest-js/**" + - '.github/workflows/check-generated-files.yml' + - pnpm-lock.yaml + - '**/guest-js/**' concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -20,93 +21,124 @@ jobs: outputs: packages: ${{ steps.filter.outputs.changes }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: dorny/paths-filter@v2 id: filter with: filters: | - authenticator: - - .github/workflows/check-generated-files.yml - - plugins/authenticator/guest-js/** - - plugins/authenticator/src/api-iife.js autostart: - .github/workflows/check-generated-files.yml + - pnpm-lock.yaml - plugins/autostart/guest-js/** - plugins/autostart/src/api-iife.js cli: - .github/workflows/check-generated-files.yml + - pnpm-lock.yaml - plugins/cli/guest-js/** - plugins/cli/src/api-iife.js clipboard-manager: - .github/workflows/check-generated-files.yml + - pnpm-lock.yaml - plugins/clipboard-manager/guest-js/** - plugins/clipboard-manager/src/api-iife.js dialog: - .github/workflows/check-generated-files.yml + - pnpm-lock.yaml - plugins/dialog/guest-js/** - plugins/dialog/src/api-iife.js fs: - .github/workflows/check-generated-files.yml + - pnpm-lock.yaml - plugins/fs/guest-js/** - plugins/fs/src/api-iife.js + geolocation: + - .github/workflows/check-generated-files.yml + - pnpm-lock.yaml + - plugins/geolocation/guest-js/** + - plugins/geolocation/src/api-iife.js global-shortcut: - .github/workflows/check-generated-files.yml + - pnpm-lock.yaml - plugins/global-shortcut/guest-js/** - plugins/global-shortcut/src/api-iife.js + opener: + - .github/workflows/check-generated-files.yml + - pnpm-lock.yaml + - plugins/opener/guest-js/** + - plugins/opener/src/api-iife.js + haptics: + - .github/workflows/check-generated-files.yml + - pnpm-lock.yaml + - plugins/haptics/guest-js/** + - plugins/haptics/src/api-iife.js http: - .github/workflows/check-generated-files.yml + - pnpm-lock.yaml - plugins/http/guest-js/** - plugins/http/src/api-iife.js log: - .github/workflows/check-generated-files.yml + - pnpm-lock.yaml - plugins/log/guest-js/** - plugins/log/src/api-iife.js notification: - .github/workflows/check-generated-files.yml + - pnpm-lock.yaml - plugins/notification/guest-js/** - plugins/notification/src/api-iife.js os: - .github/workflows/check-generated-files.yml + - pnpm-lock.yaml - plugins/os/guest-js/** - plugins/os/src/api-iife.js positioner: - .github/workflows/check-generated-files.yml + - pnpm-lock.yaml - plugins/positioner/guest-js/** - plugins/positioner/src/api-iife.js process: - .github/workflows/check-generated-files.yml + - pnpm-lock.yaml - plugins/process/guest-js/** - plugins/process/src/api-iife.js shell: - .github/workflows/check-generated-files.yml + - pnpm-lock.yaml - plugins/shell/guest-js/** - plugins/shell/src/api-iife.js sql: - .github/workflows/check-generated-files.yml + - pnpm-lock.yaml - plugins/sql/guest-js/** - plugins/sql/src/api-iife.js store: - .github/workflows/check-generated-files.yml + - pnpm-lock.yaml - plugins/store/guest-js/** - plugins/store/src/api-iife.js stronghold: - .github/workflows/check-generated-files.yml + - pnpm-lock.yaml - plugins/stronghold/guest-js/** - plugins/stronghold/src/api-iife.js updater: - .github/workflows/check-generated-files.yml + - pnpm-lock.yaml - plugins/updater/guest-js/** - plugins/updater/src/api-iife.js upload: - .github/workflows/check-generated-files.yml + - pnpm-lock.yaml - plugins/upload/guest-js/** - plugins/upload/src/api-iife.js websocket: - .github/workflows/check-generated-files.yml + - pnpm-lock.yaml - plugins/websocket/guest-js/** - plugins/websocket/src/api-iife.js window-state: - .github/workflows/check-generated-files.yml + - pnpm-lock.yaml - plugins/window-state/guest-js/** - plugins/window-state/src/api-iife.js @@ -121,21 +153,21 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Cache pnpm modules - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.pnpm-store key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}- - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: - node-version: 18 - - uses: pnpm/action-setup@v2 + node-version: 'lts/*' + - uses: pnpm/action-setup@v4 with: - version: 7.x.x + version: 10.x.x run_install: true - name: build api diff --git a/.github/workflows/check-license-header.yml b/.github/workflows/check-license-header.yml index 011a1780..338a0041 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-comment-on-fork.yml b/.github/workflows/covector-comment-on-fork.yml new file mode 100644 index 00000000..494a5348 --- /dev/null +++ b/.github/workflows/covector-comment-on-fork.yml @@ -0,0 +1,30 @@ +# Copyright 2019-2023 Tauri Programme within The Commons Conservancy +# SPDX-License-Identifier: Apache-2.0 +# SPDX-License-Identifier: MIT + +name: covector comment +on: + workflow_run: + workflows: [covector status] # the `name` of the workflow run on `pull_request` running `status` with `comment: true` + types: + - completed + +# note all other permissions are set to none if not specified +# and these set the permissions for `secrets.GITHUB_TOKEN` +permissions: + # to read the action artifacts on `covector status` workflows + actions: read + # to write the comment + pull-requests: write + +jobs: + download: + runs-on: ubuntu-latest + if: github.event.workflow_run.conclusion == 'success' && + (github.event.workflow_run.head_repository.full_name != github.repository || github.actor == 'dependabot[bot]') + steps: + - name: covector status + uses: jbolda/covector/packages/action@covector-v0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + command: 'status' diff --git a/.github/workflows/covector-status.yml b/.github/workflows/covector-status.yml index 562dd70a..7eeda427 100644 --- a/.github/workflows/covector-status.yml +++ b/.github/workflows/covector-status.yml @@ -10,11 +10,13 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 # required for use of git history - name: covector status uses: jbolda/covector/packages/action@covector-v0 id: covector with: - command: "status" + command: 'status' + token: ${{ secrets.GITHUB_TOKEN }} + comment: true diff --git a/.github/workflows/covector-version-or-publish-v2.yml b/.github/workflows/covector-version-or-publish-v2.yml deleted file mode 100644 index 6d1ce3a7..00000000 --- a/.github/workflows/covector-version-or-publish-v2.yml +++ /dev/null @@ -1,68 +0,0 @@ -# Copyright 2019-2023 Tauri Programme within The Commons Conservancy -# SPDX-License-Identifier: Apache-2.0 -# SPDX-License-Identifier: MIT - -name: version or publish - -on: - push: - branches: - - v2 - -jobs: - version-or-publish: - runs-on: ubuntu-latest - timeout-minutes: 65 - outputs: - change: ${{ steps.covector.outputs.change }} - commandRan: ${{ steps.covector.outputs.commandRan }} - successfulPublish: ${{ steps.covector.outputs.successfulPublish }} - - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 # required for use of git history - - - uses: actions/setup-node@v3 - with: - node-version: "lts/*" - registry-url: "https://registry.npmjs.org" - - - uses: pnpm/action-setup@v2 - with: - version: 7.x.x - run_install: true - - - name: install webkit2gtk and libudev for [authenticator] - run: | - sudo apt-get update - sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libudev-dev - - - name: cargo login - run: cargo login ${{ secrets.ORG_CRATES_IO_TOKEN }} - - - name: git config - run: | - git config --global user.name "${{ github.event.pusher.name }}" - git config --global user.email "${{ github.event.pusher.email }}" - - - name: covector version or publish (publish when no change files present) - uses: jbolda/covector/packages/action@covector-v0 - id: covector - env: - NODE_AUTH_TOKEN: ${{ secrets.ORG_NPM_TOKEN }} - with: - token: ${{ secrets.GITHUB_TOKEN }} - command: "version-or-publish" - createRelease: true - - - name: Create Pull Request With Versions Bumped - id: cpr - uses: tauri-apps/create-pull-request@v3 - if: steps.covector.outputs.commandRan == 'version' - with: - title: "Publish New Versions (v2)" - commit-message: "publish new versions" - labels: "version updates" - branch: "release-v2" - body: ${{ steps.covector.outputs.change }} diff --git a/.github/workflows/covector-version-or-publish.yml b/.github/workflows/covector-version-or-publish.yml index c5ef8161..34bd0178 100644 --- a/.github/workflows/covector-version-or-publish.yml +++ b/.github/workflows/covector-version-or-publish.yml @@ -8,6 +8,15 @@ on: push: branches: - v1 + - v2 + +permissions: + # required for npm provenance + id-token: write + # required to create the GitHub Release + contents: write + # required for creating the Version Packages Release + pull-requests: write jobs: version-or-publish: @@ -19,25 +28,20 @@ jobs: successfulPublish: ${{ steps.covector.outputs.successfulPublish }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 # required for use of git history - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: - node-version: "lts/*" - registry-url: "https://registry.npmjs.org" + node-version: 'lts/*' + registry-url: 'https://registry.npmjs.org' - - uses: pnpm/action-setup@v2 + - uses: pnpm/action-setup@v4 with: - version: 7.x.x + version: 10.x.x run_install: true - - name: install webkit2gtk and libudev for [authenticator] - run: | - sudo apt-get update - sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libudev-dev - - name: cargo login run: cargo login ${{ secrets.ORG_CRATES_IO_TOKEN }} @@ -46,23 +50,36 @@ jobs: git config --global user.name "${{ github.event.pusher.name }}" git config --global user.email "${{ github.event.pusher.email }}" + - name: Setup target dir on /mnt + # This directory has a larger partition size + run: | + sudo mkdir /mnt/target + WORKSPACE_OWNER="$(stat -c '%U:%G' "${GITHUB_WORKSPACE}")" + sudo chown -R "${WORKSPACE_OWNER}" /mnt/target + - name: covector version or publish (publish when no change files present) uses: jbolda/covector/packages/action@covector-v0 id: covector env: + CARGO_TARGET_DIR: /mnt/target NODE_AUTH_TOKEN: ${{ secrets.ORG_NPM_TOKEN }} with: token: ${{ secrets.GITHUB_TOKEN }} - command: "version-or-publish" + command: 'version-or-publish' createRelease: true + recognizeContributors: true + + - name: Sync Cargo.lock + if: steps.covector.outputs.commandRan == 'version' + run: cargo tree --depth 0 - name: Create Pull Request With Versions Bumped id: cpr - uses: tauri-apps/create-pull-request@v3 + uses: peter-evans/create-pull-request@dd2324fc52d5d43c699a5636bcf19fceaa70c284 # 7.0.7 if: steps.covector.outputs.commandRan == 'version' with: - title: "Publish New Versions" - commit-message: "publish new versions" - labels: "version updates" - branch: "release" + title: 'Publish New Versions (${{ github.ref_name }})' + commit-message: 'publish new versions' + labels: 'version updates' + branch: 'ci/release-${{ github.ref_name }}' body: ${{ steps.covector.outputs.change }} diff --git a/.github/workflows/fmt.yml b/.github/workflows/fmt.yml new file mode 100644 index 00000000..087b7674 --- /dev/null +++ b/.github/workflows/fmt.yml @@ -0,0 +1,59 @@ +# Copyright 2019-2023 Tauri Programme within The Commons Conservancy +# SPDX-License-Identifier: Apache-2.0 +# SPDX-License-Identifier: MIT + +name: check formatting + +on: + pull_request: + +jobs: + rustfmt: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: install Rust stable and rustfmt + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt + + - name: run cargo fmt + run: cargo fmt --all -- --check + + prettier: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Cache pnpm modules + uses: actions/cache@v4 + with: + path: ~/.pnpm-store + key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}- + - uses: actions/setup-node@v4 + with: + node-version: 'lts/*' + - uses: pnpm/action-setup@v4 + with: + version: 10.x.x + run_install: true + - run: pnpm format:check + + taplo: + name: taplo (.toml files) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: install Rust stable + uses: dtolnay/rust-toolchain@stable + + - name: install taplo-cli + uses: taiki-e/install-action@v2 + with: + tool: taplo-cli + + - run: taplo fmt --check --diff diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index f616ef6f..fbbca96a 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -10,15 +10,15 @@ on: - v1 - v2 paths: - - ".github/workflows/integration-tests.yml" - - "plugins/updater/src/**" + - '.github/workflows/integration-tests.yml' + - 'plugins/updater/src/**' pull_request: branches: - v1 - v2 paths: - - ".github/workflows/integration-tests.yml" - - "plugins/updater/src/**" + - '.github/workflows/integration-tests.yml' + - 'plugins/updater/src/**' jobs: run-integration-tests: @@ -27,23 +27,21 @@ jobs: strategy: fail-fast: false matrix: - platform: [ubuntu-latest, macos-latest, windows-latest] + platform: [ubuntu-22.04, macos-latest, windows-latest] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: install stable - uses: actions-rs/toolchain@v1 - with: - toolchain: stable + uses: dtolnay/rust-toolchain@stable - name: install Linux dependencies - if: matrix.platform == 'ubuntu-latest' + if: matrix.platform == 'ubuntu-22.04' run: | sudo apt-get update - sudo apt-get install -y webkit2gtk-4.1 libayatana-appindicator3-dev libfuse2 + sudo apt-get install -y webkit2gtk-4.0 libwebkit2gtk-4.1-dev libayatana-appindicator3-dev libfuse2 - uses: Swatinem/rust-cache@v2 diff --git a/.github/workflows/lint-javascript.yml b/.github/workflows/lint-javascript.yml index 02b96541..4c9db35e 100644 --- a/.github/workflows/lint-javascript.yml +++ b/.github/workflows/lint-javascript.yml @@ -10,23 +10,23 @@ on: - v1 - v2 paths: - - ".github/workflows/lint-javascript.yml" - - "plugins/*/guest-js/**" - - ".eslintignore" - - ".eslintrc.json" - - ".prettierignore" - - "**/package.json" + - '.github/workflows/lint-javascript.yml' + - 'plugins/*/guest-js/**' + - '.eslintignore' + - '.eslintrc.json' + - '.prettierignore' + - '**/package.json' pull_request: branches: - v1 - v2 paths: - - ".github/workflows/lint-javascript.yml" - - "plugins/*/guest-js/**" - - ".eslintignore" - - ".eslintrc.json" - - ".prettierignore" - - "**/package.json" + - '.github/workflows/lint-javascript.yml' + - 'plugins/*/guest-js/**' + - '.eslintignore' + - '.eslintrc.json' + - '.prettierignore' + - '**/package.json' concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -36,40 +36,20 @@ jobs: eslint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Cache pnpm modules - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.pnpm-store key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}- - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: - node-version: 18 - - uses: pnpm/action-setup@v2 + node-version: 'lts/*' + - uses: pnpm/action-setup@v4 with: - version: 7.x.x + version: 10.x.x run_install: true - name: eslint run: pnpm lint - prettier: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Cache pnpm modules - uses: actions/cache@v3 - with: - path: ~/.pnpm-store - key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}- - - uses: actions/setup-node@v3 - with: - node-version: 18 - - uses: pnpm/action-setup@v2 - with: - version: 7.x.x - run_install: true - - name: prettier check - run: pnpm format-check diff --git a/.github/workflows/lint-rust.yml b/.github/workflows/lint-rust.yml index b2e2a933..db922ef1 100644 --- a/.github/workflows/lint-rust.yml +++ b/.github/workflows/lint-rust.yml @@ -10,19 +10,19 @@ on: - v1 - v2 paths: - - ".github/workflows/lint-rust.yml" - - "plugins/*/src/**" - - "!plugins/*/src/api-iife.js" - - "**/Cargo.toml" + - '.github/workflows/lint-rust.yml' + - 'plugins/*/src/**' + - '!plugins/*/src/api-iife.js' + - '**/Cargo.toml' pull_request: branches: - v1 - v2 paths: - - ".github/workflows/lint-rust.yml" - - "plugins/*/src/**" - - "!plugins/*/src/api-iife.js" - - "**/Cargo.toml" + - '.github/workflows/lint-rust.yml' + - 'plugins/*/src/**' + - '!plugins/*/src/api-iife.js' + - '**/Cargo.toml' concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -36,14 +36,11 @@ jobs: outputs: packages: ${{ steps.filter.outputs.changes }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: dorny/paths-filter@v2 id: filter with: filters: | - tauri-plugin-authenticator: - - .github/workflows/lint-rust.yml - - plugins/authenticator/** tauri-plugin-autostart: - .github/workflows/lint-rust.yml - plugins/autostart/** @@ -53,6 +50,9 @@ jobs: tauri-plugin-clipboard-manager: - .github/workflows/lint-rust.yml - plugins/clipboard-manager/** + tauri-plugin-deep-link: + - .github/workflows/lint-rust.yml + - plugins/deep-link/** tauri-plugin-dialog: - .github/workflows/lint-rust.yml - plugins/dialog/** @@ -60,9 +60,18 @@ jobs: tauri-plugin-fs: - .github/workflows/lint-rust.yml - plugins/fs/** + tauri-plugin-geolocation: + - .github/workflows/lint-rust.yml + - plugins/geolocation/** tauri-plugin-global-shortcut: - .github/workflows/lint-rust.yml - plugins/global-shortcut/** + tauri-plugin-opener: + - .github/workflows/lint-rust.yml + - plugins/opener/** + tauri-plugin-haptics: + - .github/workflows/lint-rust.yml + - plugins/haptics/** tauri-plugin-http: - .github/workflows/lint-rust.yml - plugins/http/** @@ -120,19 +129,19 @@ jobs: clippy: needs: changes if: ${{ needs.changes.outputs.packages != '[]' && needs.changes.outputs.packages != '' }} - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 strategy: fail-fast: false matrix: package: ${{ fromJSON(needs.changes.outputs.packages) }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - name: install webkit2gtk and libudev for [authenticator] + - name: install webkit2gtk run: | sudo apt-get update - sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libudev-dev + sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev - name: Install clippy with stable toolchain uses: dtolnay/rust-toolchain@stable @@ -141,32 +150,8 @@ jobs: - uses: Swatinem/rust-cache@v2 - - name: create dummy dist - working-directory: examples/api - run: mkdir dist - - name: clippy ${{ matrix.package }} - if: matrix.package != 'tauri-plugin-sql' run: cargo clippy --package ${{ matrix.package }} --all-targets -- -D warnings - - name: clippy ${{ matrix.package }} mysql - if: matrix.package == 'tauri-plugin-sql' - run: cargo clippy --package ${{ matrix.package }} --all-targets --no-default-features --features mysql -- -D warnings - - - name: clippy ${{ matrix.package }} postgres - if: matrix.package == 'tauri-plugin-sql' - run: cargo clippy --package ${{ matrix.package }} --all-targets --no-default-features --features postgres -- -D warnings - - fmt: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Install rustfmt with nightly toolchain - uses: dtolnay/rust-toolchain@nightly - with: - components: rustfmt - - - name: Check formatting - run: cargo fmt --all -- --check + - name: clippy ${{ matrix.package }} --all-features + run: cargo clippy --package ${{ matrix.package }} --all-targets --all-features -- -D warnings diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index b34ccc7c..6764cf8a 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -19,26 +19,26 @@ jobs: sync-to-mirrors: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Fetch git tags run: git fetch origin 'refs/tags/*:refs/tags/*' - name: Cache pnpm modules - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.pnpm-store key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}- - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 'lts/*' - - uses: pnpm/action-setup@v2 + - uses: pnpm/action-setup@v4 with: - version: 7.x.x + version: 10.x.x run_install: true - name: Build packages diff --git a/.github/workflows/test-rust.yml b/.github/workflows/test-rust.yml index ead80be3..496efe6e 100644 --- a/.github/workflows/test-rust.yml +++ b/.github/workflows/test-rust.yml @@ -10,21 +10,21 @@ on: - v1 - v2 paths: - - ".github/workflows/test-rust.yml" - - "plugins/*/src/**" - - "!plugins/*/src/api-iife.js" - - "**/Cargo.toml" - - "**/Cargo.lock" + - '.github/workflows/test-rust.yml' + - 'plugins/*/src/**' + - '!plugins/*/src/api-iife.js' + - '**/Cargo.toml' + - '**/Cargo.lock' pull_request: branches: - v1 - v2 paths: - - ".github/workflows/test-rust.yml" - - "plugins/*/src/**" - - "!plugins/*/src/api-iife.js" - - "**/Cargo.toml" - - "**/Cargo.lock" + - '.github/workflows/test-rust.yml' + - 'plugins/*/src/**' + - '!plugins/*/src/api-iife.js' + - '**/Cargo.toml' + - '**/Cargo.lock' concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -38,85 +38,149 @@ jobs: outputs: packages: ${{ steps.filter.outputs.changes }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: dorny/paths-filter@v2 id: filter with: + base: v2 filters: | - tauri-plugin-authenticator: - - .github/workflows/test-rust.yml - - plugins/authenticator/** tauri-plugin-autostart: - .github/workflows/test-rust.yml + - Cargo.toml + - Cargo.lock - plugins/autostart/** tauri-plugin-cli: - .github/workflows/test-rust.yml + - Cargo.toml + - Cargo.lock - plugins/cli/** tauri-plugin-clipboard-manager: - .github/workflows/test-rust.yml + - Cargo.toml + - Cargo.lock - plugins/clipboard-manager/** + tauri-plugin-deep-link: + - .github/workflows/test-rust.yml + - Cargo.toml + - Cargo.lock + - plugins/deep-link/** tauri-plugin-dialog: - .github/workflows/test-rust.yml + - Cargo.toml + - Cargo.lock - plugins/dialog/** - plugins/fs/** tauri-plugin-fs: - .github/workflows/test-rust.yml + - Cargo.toml + - Cargo.lock - plugins/fs/** + tauri-plugin-geolocation: + - .github/workflows/test-rust.yml + - Cargo.toml + - Cargo.lock + - plugins/geolocation/** tauri-plugin-global-shortcut: - .github/workflows/test-rust.yml + - Cargo.toml + - Cargo.lock - plugins/global-shortcut/** + tauri-plugin-opener: + - .github/workflows/test-rust.yml + - Cargo.toml + - Cargo.lock + - plugins/opener/** + tauri-plugin-haptics: + - .github/workflows/test-rust.yml + - Cargo.toml + - Cargo.lock + - plugins/haptics/** tauri-plugin-http: - .github/workflows/test-rust.yml + - Cargo.toml + - Cargo.lock - plugins/http/** - plugins/fs/** tauri-plugin-localhost: - .github/workflows/test-rust.yml + - Cargo.toml + - Cargo.lock - plugins/localhost/** tauri-plugin-log: - .github/workflows/test-rust.yml + - Cargo.toml + - Cargo.lock - plugins/log/** tauri-plugin-notification: - .github/workflows/test-rust.yml + - Cargo.toml + - Cargo.lock - plugins/notification/** tauri-plugin-os: - .github/workflows/test-rust.yml + - Cargo.toml + - Cargo.lock - plugins/os/** tauri-plugin-persisted-scope: - .github/workflows/test-rust.yml + - Cargo.toml + - Cargo.lock - plugins/persisted-scope/** - plugins/fs/** tauri-plugin-positioner: - .github/workflows/test-rust.yml + - Cargo.toml + - Cargo.lock - plugins/positioner/** tauri-plugin-process: - .github/workflows/test-rust.yml + - Cargo.toml + - Cargo.lock - plugins/process/** tauri-plugin-shell: - .github/workflows/test-rust.yml + - Cargo.toml + - Cargo.lock - plugins/shell/** tauri-plugin-single-instance: - .github/workflows/test-rust.yml + - Cargo.toml + - Cargo.lock - plugins/single-instance/** tauri-plugin-sql: - .github/workflows/test-rust.yml + - Cargo.toml + - Cargo.lock - plugins/sql/** tauri-plugin-store: - .github/workflows/test-rust.yml + - Cargo.toml + - Cargo.lock - plugins/store/** tauri-plugin-stronghold: - .github/workflows/test-rust.yml + - Cargo.toml + - Cargo.lock - plugins/stronghold/** tauri-plugin-updater: - .github/workflows/test-rust.yml + - Cargo.toml + - Cargo.lock - plugins/updater/** tauri-plugin-upload: - .github/workflows/test-rust.yml + - Cargo.toml + - Cargo.lock - plugins/upload/** tauri-plugin-websocket: - .github/workflows/test-rust.yml + - Cargo.toml + - Cargo.lock - plugins/websocket/** tauri-plugin-window-state: - .github/workflows/test-rust.yml + - Cargo.toml + - Cargo.lock - plugins/window-state/** test: @@ -131,51 +195,45 @@ jobs: target: x86_64-pc-windows-msvc, os: windows-latest, runner: 'cargo', - command: "test", + command: 'test' } - { target: x86_64-unknown-linux-gnu, - os: ubuntu-latest, + os: ubuntu-22.04, runner: 'cargo', - command: "test", + command: 'test' } - { - target: x86_64-apple-darwin, + target: aarch64-apple-darwin, os: macos-latest, runner: 'cargo', - command: "test", + command: 'test' } - { target: aarch64-apple-ios, os: macos-latest, runner: 'cargo', - command: "build", + command: 'build' } - { target: aarch64-linux-android, os: ubuntu-latest, runner: 'cross', - command: "build", + command: 'build' } runs-on: ${{ matrix.platform.os }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - name: install webkit2gtk and libudev for [authenticator] + - name: install webkit2gtk if: contains(matrix.platform.target, 'unknown-linux') run: | sudo apt-get update - sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libudev-dev + sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev - - name: install openssl - if: ${{ matrix.platform.os == 'windows-latest' && matrix.package == 'tauri-plugin-authenticator' }} - run: | - echo "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Append - vcpkg install openssl:x64-windows-static-md - - - uses: dtolnay/rust-toolchain@1.75.0 + - uses: dtolnay/rust-toolchain@1.77.2 with: targets: ${{ matrix.platform.target }} @@ -183,30 +241,14 @@ jobs: with: key: cache-${{ matrix.package }}-${{ matrix.platform.target }} - - name: create dummy dist - working-directory: examples/api - run: mkdir dist - - name: install cross if: ${{ matrix.platform.runner == 'cross' }} run: cargo +stable install cross --git https://github.com/cross-rs/cross - name: test ${{ matrix.package }} - if: matrix.package != 'tauri-plugin-sql' && matrix.package != 'tauri-plugin-http' + if: matrix.package != 'tauri-plugin-http' run: ${{ matrix.platform.runner }} ${{ matrix.platform.command }} --package ${{ matrix.package }} --target ${{ matrix.platform.target }} --all-targets --all-features - name: test ${{ matrix.package }} if: matrix.package == 'tauri-plugin-http' run: ${{ matrix.platform.runner }} ${{ matrix.platform.command }} --package ${{ matrix.package }} --target ${{ matrix.platform.target }} --all-targets - - - name: test ${{ matrix.package }} sqlite - if: matrix.package == 'tauri-plugin-sql' - run: ${{ matrix.platform.runner }} ${{ matrix.platform.command }} --package ${{ matrix.package }} --target ${{ matrix.platform.target }} --all-targets --features sqlite - - - name: test ${{ matrix.package }} mysql - if: matrix.package == 'tauri-plugin-sql' - run: ${{ matrix.platform.runner }} ${{ matrix.platform.command }} --package ${{ matrix.package }} --target ${{ matrix.platform.target }} --all-targets --features mysql - - - name: test ${{ matrix.package }} postgres - if: matrix.package == 'tauri-plugin-sql' - run: ${{ matrix.platform.runner }} ${{ matrix.platform.command }} --package ${{ matrix.package }} --target ${{ matrix.platform.target }} --all-targets --features postgres diff --git a/.gitignore b/.gitignore index f8932e56..56b2e525 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,60 @@ -target -node_modules -dist-js -dist \ No newline at end of file +# dependency directories +node_modules/ +target/ + +# Optional npm and yarn cache directory +.npm/ +.yarn/ + +# Output of 'npm pack' +*.tgz + +# dotenv environment variables file +.env + +# .vscode workspace settings file +.vscode/settings.json +.vscode/launch.json +.vscode/tasks.json + +# npm, yarn and bun lock files +package-lock.json +yarn.lock +bun.lockb + +# rust compiled folders +target/ + +# compiled plugins +dist-js/ + +# plugins .tauri directory +/plugins/*/.tauri + +# examples +examples/*/dist +plugins/*/examples/*/dist +examples/*/src-tauri/gen/schemas +plugins/*/examples/*/src-tauri/gen/schemas + +# logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# runtime data +pids +*.pid +*.seed +*.pid.lock + +# miscellaneous +/.vs +.DS_Store +.Thumbs.db +*.sublime* +.idea +debug.log +TODO.md \ No newline at end of file diff --git a/.npmrc b/.npmrc index f87a0443..30ab299d 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1 @@ -auto-install-peers=true \ No newline at end of file +link-workspace-packages=true diff --git a/.prettierignore b/.prettierignore index c5d0524a..bc4fca6d 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,12 +1,27 @@ -target -node_modules -dist -dist-js +/.changes +/.vscode + +# dependcies and artifacts directories +node_modules/ +target/ +dist-js/ +dist/ + +# lock files pnpm-lock.yaml -Cargo.lock -.build -build + +# examples gen directory +examples/*/src-tauri/gen/ +plugins/*/examples/*/src-tauri/gen/ + +# autogenerated files +**/autogenerated/**/*.md api-iife.js init-iife.js -intermediates/ -*schema.json \ No newline at end of file +CHANGELOG.md +*schema.json + +# mobile build +**/ios/.build +**/.tauri +plugins/*/android/build diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..6ca6fdd2 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,6 @@ +{ + "singleQuote": true, + "semi": false, + "trailingComma": "none", + "experimentalOperatorPosition": "start" +} diff --git a/.scripts/ci/check-change-files.js b/.scripts/ci/check-change-files.js new file mode 100644 index 00000000..c9ff7e9b --- /dev/null +++ b/.scripts/ci/check-change-files.js @@ -0,0 +1,86 @@ +#!/usr/bin/env node + +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +import { readFileSync, readdirSync } from 'fs' +import { join } from 'path' + +/* const ignorePackages = [ + 'api-example', + 'api-example-js', + 'deep-link-example', + 'deep-link-example-js' +] */ + +const rsOnly = ['localhost', 'persisted-scope', 'single-instance'] + +function checkChangeFiles(changeFiles) { + let code = 0 + + for (const file of changeFiles) { + const content = readFileSync(file, 'utf8') + const [frontMatter] = /^---[\s\S.]*---\n/i.exec(content) + const packages = frontMatter + .split('\n') + .filter((l) => !(l === '---' || !l)) + .map((l) => l.replace(/('|")/g, '').split(':')) + + const rsPackages = Object.fromEntries( + packages + .filter((v) => !v[0].endsWith('-js')) + .map((v) => [v[0], v[1].trim()]) + ) + const jsPackages = Object.fromEntries( + packages + .filter((v) => v[0].endsWith('-js')) + .map((v) => [v[0].slice(0, -3), v[1].trim()]) + ) + + for (const pkg in rsPackages) { + if (rsOnly.includes(pkg)) continue + + if (!jsPackages[pkg]) { + console.error( + `Missing "${rsPackages[pkg]}" bump for JS package "${pkg}-js" in ${file}.` + ) + code = 1 + } else if (rsPackages[pkg] != jsPackages[pkg]) { + console.error( + `"${pkg}" and "${pkg}-js" have different version bumps in ${file}.` + ) + code = 1 + } + } + + for (const pkg in jsPackages) { + if (!rsPackages[pkg]) { + console.error( + `Missing "${jsPackages[pkg]}" bump for Rust package "${pkg}" in ${file}.` + ) + code = 1 + } else if (rsPackages[pkg] != jsPackages[pkg]) { + console.error( + `"${pkg}" and "${pkg}-js" have different version bumps in ${file}.` + ) + code = 1 + } + } + } + + process.exit(code) +} + +const [_bin, _script, ...files] = process.argv + +if (files.length > 0) { + checkChangeFiles( + files.filter((f) => f.toLowerCase() !== '.changes/readme.md') + ) +} else { + const changeFiles = readdirSync('.changes') + .filter((f) => f.endsWith('.md') && f.toLowerCase() !== 'readme.md') + .map((p) => join('.changes', p)) + checkChangeFiles(changeFiles) +} diff --git a/.scripts/ci/check-license-header.js b/.scripts/ci/check-license-header.js index 7c69bb33..4341e5a2 100644 --- a/.scripts/ci/check-license-header.js +++ b/.scripts/ci/check-license-header.js @@ -2,129 +2,129 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import fs from "fs"; -import path from "path"; -import readline from "readline"; +import fs from 'fs' +import path from 'path' +import readline from 'readline' const header = `Copyright 2019-2023 Tauri Programme within The Commons Conservancy SPDX-License-Identifier: Apache-2.0 -SPDX-License-Identifier: MIT`; +SPDX-License-Identifier: MIT` const ignoredLicenses = [ - "// Copyright 2021 Flavio Oliveira", - "// Copyright 2021 Jonas Kruckenberg", - "// Copyright 2018-2023 the Deno authors.", -]; + '// Copyright 2021 Flavio Oliveira', + '// Copyright 2021 Jonas Kruckenberg', + '// Copyright 2018-2023 the Deno authors.' +] -const extensions = [".rs", ".js", ".ts", ".yml", ".swift", ".kt"]; +const extensions = ['.rs', '.js', '.ts', '.yml', '.swift', '.kt'] const ignore = [ - "target", - "templates", - "node_modules", - "gen", - "dist", - "dist-js", - ".svelte-kit", - "api-iife.js", - "init-iife.js", - ".build", - "notify_rust", -]; + 'target', + 'templates', + 'node_modules', + 'gen', + 'dist', + 'dist-js', + '.svelte-kit', + 'api-iife.js', + 'init-iife.js', + '.build', + 'notify_rust' +] async function checkFile(file) { if ( - extensions.some((e) => file.endsWith(e)) && - !ignore.some((i) => file.includes(`${path.sep}${i}`)) + extensions.some((e) => file.endsWith(e)) + && !ignore.some((i) => file.includes(`${path.sep}${i}`)) ) { - const fileStream = fs.createReadStream(file); + const fileStream = fs.createReadStream(file) const rl = readline.createInterface({ input: fileStream, - crlfDelay: Infinity, - }); + crlfDelay: Infinity + }) - let contents = ``; - let i = 0; + let contents = `` + let i = 0 for await (let line of rl) { // ignore empty lines, allow shebang, swift-tools-version and bundler license if ( - line.length === 0 || - line.startsWith("#!") || - line.startsWith("// swift-tools-version:") || - ignoredLicenses.includes(line) + line.length === 0 + || line.startsWith('#!') + || line.startsWith('// swift-tools-version:') + || ignoredLicenses.includes(line) ) { - continue; + continue } // strip comment marker - if (line.startsWith("// ")) { - line = line.substring(3); - } else if (line.startsWith("# ")) { - line = line.substring(2); + if (line.startsWith('// ')) { + line = line.substring(3) + } else if (line.startsWith('# ')) { + line = line.substring(2) } - contents += line; + contents += line if (++i === 3) { - break; + break } - contents += "\n"; + contents += '\n' } if (contents !== header) { - return true; + return true } } - return false; + return false } async function check(src) { - const missingHeader = []; + const missingHeader = [] for (const entry of fs.readdirSync(src, { - withFileTypes: true, + withFileTypes: true })) { - const p = path.join(src, entry.name); + const p = path.join(src, entry.name) if (entry.isSymbolicLink() || ignore.includes(entry.name)) { - continue; + continue } if (entry.isDirectory()) { - const missing = await check(p); - missingHeader.push(...missing); + const missing = await check(p) + missingHeader.push(...missing) } else { - const isMissing = await checkFile(p); + const isMissing = await checkFile(p) if (isMissing) { - missingHeader.push(p); + missingHeader.push(p) } } } - return missingHeader; + return missingHeader } -const [_bin, _script, ...files] = process.argv; +const [_bin, _script, ...files] = process.argv if (files.length > 0) { async function run() { - const missing = []; + const missing = [] for (const f of files) { - const isMissing = await checkFile(f); + const isMissing = await checkFile(f) if (isMissing) { - missing.push(f); + missing.push(f) } } if (missing.length > 0) { - console.log(missing.join("\n")); - process.exit(1); + console.log(missing.join('\n')) + process.exit(1) } } - run(); + run() } else { - check(path.resolve(new URL(import.meta.url).pathname, "../../..")).then( + check(path.resolve(new URL(import.meta.url).pathname, '../../..')).then( (missing) => { if (missing.length > 0) { - console.log(missing.join("\n")); - process.exit(1); + console.log(missing.join('\n')) + process.exit(1) } - }, - ); + } + ) } diff --git a/.scripts/ci/has-diff.sh b/.scripts/ci/has-diff.sh index dd40c06f..1f18ac64 100755 --- a/.scripts/ci/has-diff.sh +++ b/.scripts/ci/has-diff.sh @@ -5,5 +5,6 @@ then echo "working directory is clean" else echo "found diff" + git diff --name-status HEAD exit 1 fi diff --git a/.scripts/covector/package-latest-version.cjs b/.scripts/covector/package-latest-version.cjs deleted file mode 100644 index fde1d4c0..00000000 --- a/.scripts/covector/package-latest-version.cjs +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env node -// Copyright 2019-2023 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT - -/* -This script is solely intended to be run as part of the `covector publish` step to -check the latest version of a crate, considering the current minor version. -*/ - -const https = require("https"); - -const kind = process.argv[2]; -const packageName = process.argv[3]; -const packageVersion = process.argv[4]; -const target = packageVersion.substring(0, packageVersion.lastIndexOf(".")); - -let url = null; -switch (kind) { - case "cargo": - url = `https://crates.io/api/v1/crates/${packageName}`; - break; - case "npm": - url = `https://registry.npmjs.org/${packageName}`; - break; - default: - throw new Error("unexpected kind " + kind); -} - -const options = { - headers: { - "Content-Type": "application/json", - Accept: "application/json", - "User-Agent": "tauri (https://github.com/tauri-apps/tauri)", - }, -}; - -https.get(url, options, (response) => { - let chunks = []; - response.on("data", function (chunk) { - chunks.push(chunk); - }); - - response.on("end", function () { - const data = JSON.parse(chunks.join("")); - if (kind === "cargo") { - if (data.versions) { - const versions = data.versions.filter((v) => v.num.startsWith(target)); - console.log(versions.length ? versions[0].num : "0.0.0"); - } else { - console.log("0.0.0"); - } - } else if (kind === "npm") { - const versions = Object.keys(data.versions || {}).filter((v) => - v.startsWith(target), - ); - console.log(versions[versions.length - 1] || "0.0.0"); - } - }); -}); diff --git a/.taurignore b/.taurignore new file mode 100644 index 00000000..28a49db3 --- /dev/null +++ b/.taurignore @@ -0,0 +1,2 @@ +plugins/*/permissions/autogenerated/ +plugins/*/android/.tauri/tauri-api/build/ diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000..68acfc90 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,8 @@ +{ + "recommendations": [ + "rust-lang.rust-analyzer", + "EditorConfig.EditorConfig", + "esbenp.prettier-vscode", + "tamasfe.even-better-toml" + ] +} diff --git a/Cargo.lock b/Cargo.lock index 13b16169..5355311f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,29 +2,32 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" + [[package]] name = "addr2line" -version = "0.21.0" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ "gimli", ] [[package]] -name = "adler" -version = "1.0.2" +name = "adler2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" [[package]] -name = "aead" -version = "0.4.3" +name = "adler32" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" -dependencies = [ - "generic-array", -] +checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" [[package]] name = "aead" @@ -36,18 +39,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "aes" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" -dependencies = [ - "cfg-if", - "cipher 0.3.0", - "cpufeatures", - "opaque-debug", -] - [[package]] name = "aes" version = "0.8.4" @@ -55,35 +46,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" dependencies = [ "cfg-if", - "cipher 0.4.4", + "cipher", "cpufeatures", ] -[[package]] -name = "aes-gcm" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc3be92e19a7ef47457b8e6f90707e12b6ac5d20c6f3866584fa3be0787d839f" -dependencies = [ - "aead 0.4.3", - "aes 0.7.5", - "cipher 0.3.0", - "ctr 0.7.0", - "ghash 0.4.4", - "subtle", -] - [[package]] name = "aes-gcm" version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1" dependencies = [ - "aead 0.5.2", - "aes 0.8.4", - "cipher 0.4.4", - "ctr 0.9.2", - "ghash 0.5.0", + "aead", + "aes", + "cipher", + "ctr", + "ghash", "subtle", ] @@ -93,29 +70,28 @@ version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" dependencies = [ - "getrandom 0.2.12", + "getrandom 0.2.15", "once_cell", "version_check", ] [[package]] name = "ahash" -version = "0.8.8" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42cd52102d3df161c77a887b608d7a4897d7cc112886a9537b738a887a03aaff" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", - "getrandom 0.2.12", "once_cell", "version_check", - "zerocopy", + "zerocopy 0.7.35", ] [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] @@ -137,9 +113,9 @@ dependencies = [ [[package]] name = "allocator-api2" -version = "0.2.16" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "android-tzdata" @@ -149,20 +125,19 @@ checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" [[package]] name = "android_log-sys" -version = "0.2.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85965b6739a430150bdd138e2374a98af0c3ee0d030b3bb7fc3bddff58d0102e" +checksum = "84521a3cf562bc62942e294181d9eef17eb38ceb8c68677bc49f144e4c3d4f8d" [[package]] name = "android_logger" -version = "0.11.3" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8619b80c242aa7bd638b5c7ddd952addeecb71f69c75e33f1d47b2804f8f883a" +checksum = "f6f39be698127218cca460cb624878c9aa4e2b47dba3b277963d2bf00bad263b" dependencies = [ "android_log-sys", - "env_logger", + "env_filter", "log", - "once_cell", ] [[package]] @@ -176,61 +151,63 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.12" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96b09b5178381e0874812a9b157f7fe84982617e48f71f4e3235482775e5b540" +checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", + "is_terminal_polyfill", "utf8parse", ] [[package]] name = "anstyle" -version = "1.0.6" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" +checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" [[package]] name = "anstyle-parse" -version = "0.2.3" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" +checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.2" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" +checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.2" +version = "3.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" +checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e" dependencies = [ "anstyle", - "windows-sys 0.52.0", + "once_cell", + "windows-sys 0.59.0", ] [[package]] name = "anyhow" -version = "1.0.80" +version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1" +checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" [[package]] name = "api" -version = "2.0.0-beta.1" +version = "2.0.25" dependencies = [ "log", "serde", @@ -243,17 +220,22 @@ dependencies = [ "tauri-plugin-clipboard-manager", "tauri-plugin-dialog", "tauri-plugin-fs", + "tauri-plugin-geolocation", "tauri-plugin-global-shortcut", + "tauri-plugin-haptics", "tauri-plugin-http", "tauri-plugin-log", "tauri-plugin-nfc", "tauri-plugin-notification", + "tauri-plugin-opener", "tauri-plugin-os", "tauri-plugin-process", "tauri-plugin-shell", + "tauri-plugin-store", "tauri-plugin-updater", - "tiny_http 0.11.0", - "window-shadows", + "tauri-plugin-window-state", + "time", + "tiny_http", ] [[package]] @@ -266,45 +248,73 @@ dependencies = [ "tauri-build", "tauri-plugin-updater", "time", - "tiny_http 0.11.0", + "tiny_http", +] + +[[package]] +name = "app-updater-v2" +version = "0.1.0" +dependencies = [ + "serde", + "serde_json", + "tauri", + "tauri-build", + "tauri-plugin-updater", + "tiny_http", +] + +[[package]] +name = "app_settings_manager" +version = "0.0.0" +dependencies = [ + "serde", + "serde_json", + "tauri", + "tauri-build", + "tauri-plugin-store", +] + +[[package]] +name = "arbitrary" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223" +dependencies = [ + "derive_arbitrary", ] [[package]] name = "arboard" -version = "3.3.1" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1faa3c733d9a3dd6fbaf85da5d162a2e03b2e0033a90dceb0e2a90fdd1e5380a" +checksum = "c1df21f715862ede32a0c525ce2ca4d52626bb0007f8c18b87a384503ac33e70" dependencies = [ "clipboard-win", - "core-graphics 0.23.1", "image", "log", - "objc", - "objc-foundation", - "objc_id", + "objc2 0.6.0", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.0", "parking_lot", - "thiserror", - "windows-sys 0.48.0", + "percent-encoding", + "windows-sys 0.59.0", + "wl-clipboard-rs", "x11rb", ] [[package]] name = "arrayref" -version = "0.3.7" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" [[package]] name = "arrayvec" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" - -[[package]] -name = "as-raw-xcb-connection" -version = "1.0.1" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "ascii" @@ -314,14 +324,15 @@ checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16" [[package]] name = "ashpd" -version = "0.8.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b22517ee647547c01a687cf9b76074e1c91334032a4324f7243c6ee0f949390" +checksum = "6cbdf310d77fd3aaee6ea2093db7011dc2d35d2eb3481e5607f1f8d942ed99df" dependencies = [ "enumflags2", "futures-channel", "futures-util", - "rand 0.8.5", + "rand 0.9.0", + "raw-window-handle", "serde", "serde_repr", "tokio", @@ -341,34 +352,33 @@ dependencies = [ [[package]] name = "async-broadcast" -version = "0.7.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "258b52a1aa741b9f09783b2d86cf0aeeb617bbf847f6933340a39644227acbdb" +checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532" dependencies = [ - "event-listener 5.1.0", - "event-listener-strategy 0.5.0", + "event-listener", + "event-listener-strategy", "futures-core", "pin-project-lite", ] [[package]] name = "async-channel" -version = "2.2.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f28243a43d821d11341ab73c80bed182dc015c514b951616cf79bd4af39af0c3" +checksum = "89b47800b0be77592da0afd425cc03468052844aff33b84e33cc696f64e77b6a" dependencies = [ "concurrent-queue", - "event-listener 5.1.0", - "event-listener-strategy 0.5.0", + "event-listener-strategy", "futures-core", "pin-project-lite", ] [[package]] name = "async-compression" -version = "0.4.6" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a116f46a969224200a0a97f29cfd4c50e7534e4b4826bd23ea2c3c533039c82c" +checksum = "59a194f9d963d8099596278594b3107448656ba73831c9d8c783e613ce86da64" dependencies = [ "brotli", "flate2", @@ -376,15 +386,16 @@ dependencies = [ "memchr", "pin-project-lite", "tokio", + "zstd", + "zstd-safe", ] [[package]] name = "async-executor" -version = "1.8.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ae5ebefcc48e7452b4987947920dac9450be1110cadf34d1b8c116bdbaf97c" +checksum = "30ca9a001c1e8ba5149f91a74362376cc6bc5b919d92d988668657bd570bdcec" dependencies = [ - "async-lock 3.3.0", "async-task", "concurrent-queue", "fastrand", @@ -394,137 +405,129 @@ dependencies = [ [[package]] name = "async-fs" -version = "2.1.1" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc19683171f287921f2405677dd2ed2549c3b3bda697a563ebc3a121ace2aba1" +checksum = "ebcd09b382f40fcd159c2d695175b2ae620ffa5f3bd6f664131efff4e8b9e04a" dependencies = [ - "async-lock 3.3.0", + "async-lock", "blocking", "futures-lite", ] [[package]] name = "async-io" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f97ab0c5b00a7cdbe5a371b9a782ee7be1316095885c8a4ea1daf490eb0ef65" +checksum = "43a2b323ccce0a1d90b449fd71f2a06ca7faa7c54c2751f06c9bd851fc061059" dependencies = [ - "async-lock 3.3.0", + "async-lock", "cfg-if", "concurrent-queue", "futures-io", "futures-lite", "parking", "polling", - "rustix", + "rustix 0.38.44", "slab", "tracing", - "windows-sys 0.52.0", -] - -[[package]] -name = "async-lock" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" -dependencies = [ - "event-listener 2.5.3", + "windows-sys 0.59.0", ] [[package]] name = "async-lock" -version = "3.3.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d034b430882f8381900d3fe6f0aaa3ad94f2cb4ac519b429692a1bc2dda4ae7b" +checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18" dependencies = [ - "event-listener 4.0.3", - "event-listener-strategy 0.4.0", + "event-listener", + "event-listener-strategy", "pin-project-lite", ] [[package]] name = "async-process" -version = "2.1.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "451e3cf68011bd56771c79db04a9e333095ab6349f7e47592b788e9b98720cc8" +checksum = "63255f1dc2381611000436537bbedfe83183faa303a5a0edaf191edef06526bb" dependencies = [ "async-channel", "async-io", - "async-lock 3.3.0", + "async-lock", "async-signal", + "async-task", "blocking", "cfg-if", - "event-listener 5.1.0", + "event-listener", "futures-lite", - "rustix", - "windows-sys 0.52.0", + "rustix 0.38.44", + "tracing", ] [[package]] name = "async-recursion" -version = "1.0.5" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" +checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" dependencies = [ "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.100", ] [[package]] name = "async-signal" -version = "0.2.5" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e47d90f65a225c4527103a8d747001fc56e375203592b25ad103e1ca13124c5" +checksum = "637e00349800c0bdf8bfc21ebbc0b6524abea702b0da4168ac00d070d0c0b9f3" dependencies = [ "async-io", - "async-lock 2.8.0", + "async-lock", "atomic-waker", "cfg-if", "futures-core", "futures-io", - "rustix", + "rustix 0.38.44", "signal-hook-registry", "slab", - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] name = "async-task" -version = "4.7.0" +version = "4.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbb36e985947064623dbd357f727af08ffd077f93d696782f3c56365fa2e2799" +checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" [[package]] name = "async-trait" -version = "0.1.77" +version = "0.1.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" +checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.100", ] [[package]] name = "atk" -version = "0.18.0" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4af014b17dd80e8af9fa689b2d4a211ddba6eb583c1622f35d0cb543f6b17e4" +checksum = "241b621213072e993be4f6f3a9e4b45f65b7e6faad43001be957184b7bb1824b" dependencies = [ "atk-sys", - "glib 0.18.5", + "glib", "libc", ] [[package]] name = "atk-sys" -version = "0.18.0" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "251e0b7d90e33e0ba930891a505a9a35ece37b2dd37a14f3ffc306c13b980009" +checksum = "c5e48b684b0ca77d2bbadeef17424c2ea3c897d44d566a1617e7e8f30614d086" dependencies = [ - "glib-sys 0.18.1", - "gobject-sys 0.18.0", + "glib-sys", + "gobject-sys", "libc", "system-deps", ] @@ -544,76 +547,44 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" -[[package]] -name = "atomic-write-file" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edcdbedc2236483ab103a53415653d6b4442ea6141baf1ffa85df29635e88436" -dependencies = [ - "nix 0.27.1", - "rand 0.8.5", -] - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "authenticator" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08cee7a0952628fde958e149507c2bb321ab4fccfafd225da0b20adc956ef88a" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "devd-rs", - "libc", - "libudev", - "log", - "rand 0.7.3", - "runloop", - "winapi 0.3.9", -] - [[package]] name = "auto-launch" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f012b8cc0c850f34117ec8252a44418f2e34a2cf501de89e29b241ae5f79471" dependencies = [ - "dirs", - "thiserror", + "dirs 4.0.0", + "thiserror 1.0.69", "winreg 0.10.1", ] [[package]] name = "autocfg" -version = "1.1.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "backtrace" -version = "0.3.69" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", - "cc", "cfg-if", "libc", "miniz_oxide", "object", "rustc-demangle", + "windows-targets 0.52.6", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "base64" version = "0.13.1" @@ -626,6 +597,12 @@ version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + [[package]] name = "base64ct" version = "1.6.0" @@ -641,12 +618,6 @@ dependencies = [ "serde", ] -[[package]] -name = "bit_field" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61" - [[package]] name = "bitflags" version = "1.3.2" @@ -655,9 +626,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.2" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" dependencies = [ "serde", ] @@ -680,89 +651,97 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" dependencies = [ - "digest 0.10.7", + "digest", ] [[package]] name = "blake2b_simd" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23285ad32269793932e830392f2fe2f83e26488fd3ec778883a93c8323735780" +checksum = "06e903a20b159e944f91ec8499fe1e55651480c541ea0a584f5d967c49ad9d99" dependencies = [ "arrayref", "arrayvec", - "constant_time_eq 0.3.0", + "constant_time_eq 0.3.1", ] [[package]] -name = "block" -version = "0.1.6" +name = "block-buffer" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] [[package]] -name = "block-buffer" -version = "0.9.0" +name = "block-padding" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93" dependencies = [ "generic-array", ] [[package]] -name = "block-buffer" -version = "0.10.4" +name = "block2" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f" dependencies = [ - "generic-array", + "objc2 0.5.2", +] + +[[package]] +name = "block2" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d59b4c170e16f0405a2e95aff44432a0d41aa97675f3d52623effe95792a037" +dependencies = [ + "objc2 0.6.0", ] [[package]] name = "blocking" -version = "1.5.1" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a37913e8dc4ddcc604f0c6d3bf2887c995153af3611de9e23c352b44c1b9118" +checksum = "703f41c54fc768e63e091340b424302bb1c29ef4aa0c7f10fe849dfb114d29ea" dependencies = [ "async-channel", - "async-lock 3.3.0", "async-task", - "fastrand", "futures-io", "futures-lite", "piper", - "tracing", ] [[package]] name = "borsh" -version = "1.3.0" +version = "1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d4d6dafc1a3bb54687538972158f07b2c948bc57d5890df22c0739098b3028" +checksum = "ad8646f98db542e39fc66e68a20b2144f6a732636df7c2354e74645faaa433ce" dependencies = [ "borsh-derive", - "cfg_aliases 0.1.1", + "cfg_aliases", ] [[package]] name = "borsh-derive" -version = "1.3.0" +version = "1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4918709cc4dd777ad2b6303ed03cb37f3ca0ccede8c1b0d28ac6db8f4710e0" +checksum = "fdd1d3c0c2f5833f22386f252fe8ed005c7f59fdcddeef025c01b4c3b9fd9ac3" dependencies = [ "once_cell", - "proc-macro-crate 2.0.2", + "proc-macro-crate 3.3.0", "proc-macro2", "quote", - "syn 2.0.49", - "syn_derive", + "syn 2.0.100", ] [[package]] name = "brotli" -version = "3.4.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "516074a47ef4bce09577a3b379392300159ce5b1ba2e501ff1c819950066100f" +checksum = "cc97b8f16f944bba54f0433f07e30be199b6dc2bd25937444bbad560bcea29bd" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -771,9 +750,9 @@ dependencies = [ [[package]] name = "brotli-decompressor" -version = "2.5.1" +version = "4.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e2e4afe60d7dd600fdd3de8d0f08c2b7ec039712e3b6137ff98b7004e82de4f" +checksum = "74fa05ad7d803d413eb8380983b092cbbaf9a85f151b871360e7b00cd7060b37" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -781,15 +760,15 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.15.0" +version = "3.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32a994c2b3ca201d9b263612a374263f05e7adde37c4707f693dcd375076d1f" +checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" [[package]] name = "byte-unit" -version = "5.1.4" +version = "5.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ac19bdf0b2665407c39d82dbc937e951e7e2001609f0fb32edd0af45a2d63e" +checksum = "e1cd29c3c585209b0cbc7309bfe3ed7efd8c84c21b7af29c8bfae908f8777174" dependencies = [ "rust_decimal", "serde", @@ -820,23 +799,9 @@ dependencies = [ [[package]] name = "bytemuck" -version = "1.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2ef034f05691a48569bd920a96c81b9d91bbad1ab5ac7c4616c1f6ef36cb79f" -dependencies = [ - "bytemuck_derive", -] - -[[package]] -name = "bytemuck_derive" -version = "1.5.0" +version = "1.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.49", -] +checksum = "b6b1fc10dbac614ebc03540c9dbd60e83887fda27794998c6528f1782047d540" [[package]] name = "byteorder" @@ -845,33 +810,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] -name = "bytes" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" -dependencies = [ - "serde", -] - -[[package]] -name = "bzip2" -version = "0.4.4" +name = "byteorder-lite" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" -dependencies = [ - "bzip2-sys", - "libc", -] +checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" [[package]] -name = "bzip2-sys" -version = "0.1.11+1.0.8" +name = "bytes" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" +checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" dependencies = [ - "cc", - "libc", - "pkg-config", + "serde", ] [[package]] @@ -880,12 +830,12 @@ version = "0.18.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ca26ef0159422fb77631dc9d17b102f253b876fe1586b03b803e63a309b4ee2" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.9.0", "cairo-sys-rs", - "glib 0.18.5", + "glib", "libc", "once_cell", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -894,61 +844,62 @@ version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "685c9fa8e590b8b3d678873528d83411db17242a73fccaed827770ea0fedda51" dependencies = [ - "glib-sys 0.18.1", + "glib-sys", "libc", "system-deps", ] [[package]] name = "camino" -version = "1.1.6" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" +checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" dependencies = [ "serde", ] [[package]] name = "cargo-platform" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "694c8807f2ae16faecc43dc17d74b3eb042482789fd0eb64b39a2e04e087053f" +checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc" dependencies = [ "serde", ] [[package]] name = "cargo_metadata" -version = "0.18.1" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" +checksum = "afc309ed89476c8957c50fb818f56fe894db857866c3e163335faa91dc34eb85" dependencies = [ "camino", "cargo-platform", "semver", "serde", "serde_json", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "cargo_toml" -version = "0.17.2" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a969e13a7589e9e3e4207e153bae624ade2b5622fb4684a4923b23ec3d57719" +checksum = "02260d489095346e5cafd04dea8e8cb54d1d74fcd759022a9b72986ebe9a1257" dependencies = [ "serde", - "toml 0.8.2", + "toml", ] [[package]] name = "cc" -version = "1.0.83" +version = "1.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +checksum = "8e3a13707ac958681c13b39b458c073d0d9bc8a22cb1b2f4c8e55eb72c13f362" dependencies = [ "jobserver", "libc", + "shlex", ] [[package]] @@ -970,9 +921,9 @@ dependencies = [ [[package]] name = "cfg-expr" -version = "0.15.7" +version = "0.15.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa50868b64a9a6fda9d593ce778849ea8715cd2a3d2cc17ffdb4a2f2f2f1961d" +checksum = "d067ad48b8650848b989a59a86c6c36a995d02d2bf778d45c3c5d57bc2718f02" dependencies = [ "smallvec", "target-lexicon", @@ -986,54 +937,45 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "cfg_aliases" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" - -[[package]] -name = "cfg_aliases" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77e53693616d3075149f4ead59bdeecd204ac6b8192d8969757601b74bddf00f" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "chacha20" -version = "0.8.2" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c80e5460aa66fe3b91d40bcbdab953a597b60053e34d684ac6903f863b680a6" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" dependencies = [ "cfg-if", - "cipher 0.3.0", + "cipher", "cpufeatures", - "zeroize", ] [[package]] name = "chacha20poly1305" -version = "0.9.1" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a18446b09be63d457bbec447509e85f662f32952b035ce892290396bc0b0cff5" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" dependencies = [ - "aead 0.4.3", + "aead", "chacha20", - "cipher 0.3.0", + "cipher", "poly1305", "zeroize", ] [[package]] name = "chrono" -version = "0.4.34" +version = "0.4.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b" +checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c" dependencies = [ "android-tzdata", "iana-time-zone", - "js-sys", "num-traits", "serde", - "wasm-bindgen", - "windows-targets 0.52.0", + "windows-link", ] [[package]] @@ -1042,15 +984,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e4de3bc4ea267985becf712dc6d9eed8b04c953b3fcfb339ebc87acd9804901" -[[package]] -name = "cipher" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" -dependencies = [ - "generic-array", -] - [[package]] name = "cipher" version = "0.4.4" @@ -1059,139 +992,76 @@ checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" dependencies = [ "crypto-common", "inout", + "zeroize", ] [[package]] name = "clap" -version = "4.5.1" +version = "4.5.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c918d541ef2913577a0f9566e9ce27cb35b6df072075769e0b26cb5a554520da" +checksum = "2df961d8c8a0d08aa9945718ccf584145eee3f3aa06cddbeac12933781102e04" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.5.1" +version = "4.5.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f3e7391dad68afb0c2ede1bf619f579a3dc9c2ec67f089baa397123a2f3d1eb" +checksum = "132dbda40fb6753878316a489d5a1242a8ef2f0d9e47ba01c951ea8aa7d013a5" dependencies = [ "anstream", "anstyle", "clap_lex", - "strsim 0.11.0", + "strsim", ] [[package]] name = "clap_lex" -version = "0.7.0" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" +checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" [[package]] name = "clipboard-win" -version = "5.1.0" +version = "5.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ec832972fefb8cf9313b45a0d1945e29c9c251f1d4c6eafc5fe2124c02d2e81" +checksum = "15efe7a882b08f34e38556b14f2fb3daa98769d06c7f0c1b076dfd0d983bc892" dependencies = [ "error-code", ] [[package]] -name = "cocoa" -version = "0.24.1" +name = "color-backtrace" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f425db7937052c684daec3bd6375c8abe2d146dca4b8b143d6db777c39138f3a" +checksum = "2123a5984bd52ca861c66f66a9ab9883b27115c607f801f86c1bc2a84eb69f0f" dependencies = [ - "bitflags 1.3.2", - "block", - "cocoa-foundation", - "core-foundation", - "core-graphics 0.22.3", - "foreign-types 0.3.2", - "libc", - "objc", + "backtrace", + "termcolor", ] -[[package]] -name = "cocoa" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6140449f97a6e97f9511815c5632d84c8aacf8ac271ad77c559218161a1373c" -dependencies = [ - "bitflags 1.3.2", - "block", - "cocoa-foundation", - "core-foundation", - "core-graphics 0.23.1", - "foreign-types 0.5.0", - "libc", - "objc", -] - -[[package]] -name = "cocoa-foundation" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c6234cbb2e4c785b456c0644748b1ac416dd045799740356f8363dfe00c93f7" -dependencies = [ - "bitflags 1.3.2", - "block", - "core-foundation", - "core-graphics-types", - "libc", - "objc", -] - -[[package]] -name = "color-backtrace" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd6c04463c99389fff045d2b90ce84f5131332712c7ffbede020f5e9ad1ed685" -dependencies = [ - "atty", - "backtrace", - "termcolor", -] - -[[package]] -name = "color_quant" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" - [[package]] name = "colorchoice" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" - -[[package]] -name = "colored" -version = "1.9.4" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a5f741c91823341bebf717d4c71bda820630ce065443b58bd1b7451af008355" -dependencies = [ - "is-terminal", - "lazy_static", - "winapi 0.3.9", -] +checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "colored" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" +checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c" dependencies = [ "lazy_static", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "combine" -version = "4.6.6" +version = "4.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" dependencies = [ "bytes", "memchr", @@ -1199,9 +1069,9 @@ dependencies = [ [[package]] name = "concurrent-queue" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d16048cd947b08fa32c24458a22f5dc5e835264f689f4f5653210c69fd107363" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" dependencies = [ "crossbeam-utils", ] @@ -1212,6 +1082,26 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" +[[package]] +name = "const-random" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87e00182fe74b066627d63b85fd550ac2998d4b0bd86bfed477a0ae4c7c71359" +dependencies = [ + "const-random-macro", +] + +[[package]] +name = "const-random-macro" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" +dependencies = [ + "getrandom 0.2.15", + "once_cell", + "tiny-keccak", +] + [[package]] name = "constant_time_eq" version = "0.1.5" @@ -1220,9 +1110,9 @@ checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] name = "constant_time_eq" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" +checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" [[package]] name = "convert_case" @@ -1232,9 +1122,9 @@ checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" [[package]] name = "cookie" -version = "0.17.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7efb37c3e1ccb1ff97164ad95ac1606e8ccd35b3fa0a7d99a304c7f4a428cc24" +checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747" dependencies = [ "percent-encoding", "time", @@ -1243,12 +1133,13 @@ dependencies = [ [[package]] name = "cookie_store" -version = "0.20.0" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "387461abbc748185c3a6e1673d826918b450b87ff22639429c694619a83b6cf6" +checksum = "2eac901828f88a5241ee0600950ab981148a18f2f756900ffba1b125ca6a3ef9" dependencies = [ "cookie", - "idna 0.3.0", + "document-features", + "idna", "log", "publicsuffix", "serde", @@ -1268,63 +1159,69 @@ dependencies = [ "libc", ] +[[package]] +name = "core-foundation" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "core-graphics" -version = "0.22.3" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" +checksum = "fa95a34622365fa5bbf40b20b75dba8dfa8c94c734aea8ac9a5ca38af14316f1" dependencies = [ - "bitflags 1.3.2", - "core-foundation", + "bitflags 2.9.0", + "core-foundation 0.10.0", "core-graphics-types", - "foreign-types 0.3.2", + "foreign-types 0.5.0", "libc", ] [[package]] -name = "core-graphics" -version = "0.23.1" +name = "core-graphics-types" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "970a29baf4110c26fedbc7f82107d42c23f7e88e404c4577ed73fe99ff85a212" +checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb" dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "core-graphics-types", - "foreign-types 0.5.0", + "bitflags 2.9.0", + "core-foundation 0.10.0", "libc", ] [[package]] -name = "core-graphics-types" -version = "0.1.3" +name = "core2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" +checksum = "b49ba7ef1ad6107f8824dbe97de947cbaac53c44e7f9756a1fba0d37c1eec505" dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "libc", + "memchr", ] [[package]] name = "cpufeatures" -version = "0.2.12" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" dependencies = [ "libc", ] [[package]] name = "crc" -version = "3.0.1" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe" +checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" dependencies = [ "crc-catalog", ] @@ -1337,61 +1234,54 @@ checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" [[package]] name = "crc32fast" -version = "1.4.0" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" dependencies = [ "cfg-if", ] [[package]] name = "crossbeam-channel" -version = "0.5.11" +version = "0.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "176dc175b78f56c0f321911d9c8eb2b77a78a4860b9c19db83835fea1a46649b" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2" dependencies = [ "crossbeam-utils", ] [[package]] name = "crossbeam-queue" -version = "0.3.11" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35" +checksum = "0f58bbc28f91df819d0aa2a2c00cd19754769c2fad90579b3592b1c9ba7a3115" dependencies = [ "crossbeam-utils", ] [[package]] name = "crossbeam-utils" -version = "0.8.19" +version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" [[package]] name = "crunchy" -version = "0.2.2" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] [[package]] name = "crypto-common" @@ -1428,26 +1318,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" dependencies = [ "quote", - "syn 2.0.49", + "syn 2.0.100", ] [[package]] name = "ctor" -version = "0.2.6" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30d2b3721e861707777e3195b0158f950ae6dc4a27e4d02ff9f67e3eb3de199e" +checksum = "32a2785755761f3ddc1492979ce1e48d2c00d09311c39e4466429188f3dd6501" dependencies = [ "quote", - "syn 2.0.49", -] - -[[package]] -name = "ctr" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a232f92a03f37dd7d7dd2adc67166c77e9cd88de5b019b9a9eecfaeaf7bfd481" -dependencies = [ - "cipher 0.3.0", + "syn 2.0.100", ] [[package]] @@ -1456,27 +1337,41 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" dependencies = [ - "cipher 0.4.4", + "cipher", ] [[package]] name = "curve25519-dalek" -version = "3.2.0" +version = "4.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core 0.5.1", + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "rustc_version", "subtle", "zeroize", ] +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "darling" -version = "0.20.6" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c376d08ea6aa96aafe61237c7200d1241cb177b7d3a542d791f2d118e9cbb955" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" dependencies = [ "darling_core", "darling_macro", @@ -1484,34 +1379,40 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.6" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33043dcd19068b8192064c704b3f83eb464f91f1ff527b44a4e2b08d9cdb8855" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim 0.10.0", - "syn 2.0.49", + "strsim", + "syn 2.0.100", ] [[package]] name = "darling_macro" -version = "0.20.6" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5a91391accf613803c2a9bf9abccdbaa07c54b4244a5b64883f9c3c137c86be" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" dependencies = [ "darling_core", "quote", - "syn 2.0.49", + "syn 2.0.100", ] +[[package]] +name = "dary_heap" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04d2cd9c18b9f454ed67da600630b021a8a80bf33f8c95896ab33aaf1c26b728" + [[package]] name = "data-encoding" -version = "2.5.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" +checksum = "2a2330da5de22e8a3cb63252ce2abb30116bf5265e89c0e01bc17015ce30a476" [[package]] name = "data-url" @@ -1523,18 +1424,21 @@ checksum = "5c297a1c74b71ae29df00c3e22dd9534821d60eb9af5a0192823fa2acea70c2a" name = "deep-link-example" version = "0.0.0" dependencies = [ + "log", "serde", "serde_json", "tauri", "tauri-build", "tauri-plugin-deep-link", + "tauri-plugin-log", + "tauri-plugin-single-instance", ] [[package]] name = "der" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" dependencies = [ "const-oid", "pem-rfc7468", @@ -1543,55 +1447,36 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.11" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e" dependencies = [ "powerfmt", "serde", ] [[package]] -name = "derivative" -version = "2.2.0" +name = "derive_arbitrary" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +checksum = "30542c1ad912e0e3d22a1935c290e12e8a29d704a420177a31faad4a601a0800" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.100", ] [[package]] name = "derive_more" -version = "0.99.17" +version = "0.99.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +checksum = "3da29a38df43d6f156149c9b43ded5e018ddff2a855cf2cfd62e8cd7d079c69f" dependencies = [ "convert_case", "proc-macro2", "quote", "rustc_version", - "syn 1.0.109", -] - -[[package]] -name = "devd-rs" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9313f104b590510b46fc01c0a324fc76505c13871454d3c48490468d04c8d395" -dependencies = [ - "libc", - "nom", -] - -[[package]] -name = "digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array", + "syn 2.0.100", ] [[package]] @@ -1600,7 +1485,7 @@ version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "block-buffer 0.10.4", + "block-buffer", "const-oid", "crypto-common", "subtle", @@ -1612,7 +1497,16 @@ version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" dependencies = [ - "dirs-sys", + "dirs-sys 0.3.7", +] + +[[package]] +name = "dirs" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e" +dependencies = [ + "dirs-sys 0.5.0", ] [[package]] @@ -1632,8 +1526,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" dependencies = [ "libc", - "redox_users", - "winapi 0.3.9", + "redox_users 0.4.6", + "winapi", +] + +[[package]] +name = "dirs-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" +dependencies = [ + "libc", + "option-ext", + "redox_users 0.5.0", + "windows-sys 0.59.0", ] [[package]] @@ -1643,8 +1549,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" dependencies = [ "libc", - "redox_users", - "winapi 0.3.9", + "redox_users 0.4.6", + "winapi", ] [[package]] @@ -1654,12 +1560,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" [[package]] -name = "dlib" -version = "0.5.2" +name = "dispatch2" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412" +checksum = "1a0d569e003ff27784e0e14e4a594048698e0c0f0b66cabcb51511be55a7caa0" dependencies = [ - "libloading 0.8.1", + "bitflags 2.9.0", + "block2 0.6.0", + "libc", + "objc2 0.6.0", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", ] [[package]] @@ -1671,7 +1591,7 @@ dependencies = [ "dlopen2_derive", "libc", "once_cell", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1682,122 +1602,153 @@ checksum = "f2b99bf03862d7f545ebc28ddd33a665b50865f4dfd84031a393823879bd4c54" dependencies = [ "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.100", ] [[package]] -name = "dotenvy" -version = "0.15.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" - -[[package]] -name = "downcast-rs" -version = "1.2.0" +name = "dlv-list" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" +checksum = "442039f5147480ba31067cb00ada1adae6892028e40e45fc5de7b7df6dcc1b5f" +dependencies = [ + "const-random", +] [[package]] -name = "drm" -version = "0.11.1" +name = "document-features" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0f8a69e60d75ae7dab4ef26a59ca99f2a89d4c142089b537775ae0c198bdcde" +checksum = "95249b50c6c185bee49034bcb378a49dc2b5dff0be90ff6616d31d64febab05d" dependencies = [ - "bitflags 2.4.2", - "bytemuck", - "drm-ffi", - "drm-fourcc", - "rustix", + "litrs", ] [[package]] -name = "drm-ffi" -version = "0.7.1" +name = "dotenvy" +version = "0.15.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41334f8405792483e32ad05fbb9c5680ff4e84491883d2947a4757dc54cb2ac6" -dependencies = [ - "drm-sys", - "rustix", -] +checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" [[package]] -name = "drm-fourcc" -version = "2.2.0" +name = "downcast-rs" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aafbcdb8afc29c1a7ee5fbe53b5d62f4565b35a042a662ca9fecd0b54dae6f4" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" [[package]] -name = "drm-sys" -version = "0.6.1" +name = "dpi" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d09ff881f92f118b11105ba5e34ff8f4adf27b30dae8f12e28c193af1c83176" +checksum = "f25c0e292a7ca6d6498557ff1df68f32c99850012b6ea401cf8daf771f22ff53" dependencies = [ - "libc", - "linux-raw-sys 0.6.4", + "serde", ] [[package]] name = "dtoa" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" +checksum = "d6add3b8cff394282be81f3fc1a0605db594ed69890078ca6e2cab1c408bcf04" [[package]] name = "dtoa-short" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbaceec3c6e4211c79e7b1800fb9680527106beb2f9c51904a3210c03a448c74" +checksum = "cd1511a7b6a56299bd043a9c167a6d2bfb37bf84a6dfceaba651168adfb43c87" dependencies = [ "dtoa", ] [[package]] name = "dunce" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" [[package]] name = "dyn-clone" -version = "1.0.16" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c7a8fb8a9fbf66c1f703fe16184d10ca0ee9d23be5b4436400408ba54a95005" + +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "ed25519" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "545b22097d44f8a9581187cdf93de7a71e4722bf51200cfaba810865b49a495d" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "signature", +] [[package]] name = "ed25519-zebra" -version = "3.1.0" +version = "4.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" +checksum = "7d9ce6874da5d4415896cd45ffbc4d1cfc0c4f9c079427bd870742c30f2f65a9" dependencies = [ "curve25519-dalek", - "hashbrown 0.12.3", + "ed25519", + "hashbrown 0.14.5", "hex", "rand_core 0.6.4", - "sha2 0.9.9", + "sha2", "zeroize", ] [[package]] name = "either" -version = "1.10.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" dependencies = [ "serde", ] +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "embed-resource" -version = "2.4.1" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bde55e389bea6a966bd467ad1ad7da0ae14546a5bc794d16d1e55e7fca44881" +checksum = "7fbc6e0d8e0c03a655b53ca813f0463d2c956bc4db8138dbc89f120b066551e3" dependencies = [ "cc", "memchr", "rustc_version", - "toml 0.8.2", + "toml", "vswhom", - "winreg 0.51.0", + "winreg 0.52.0", ] [[package]] @@ -1808,9 +1759,9 @@ checksum = "4ef6b89e5b37196644d8796de5268852ff179b44e96276cf4290264843743bb7" [[package]] name = "encoding_rs" -version = "0.8.33" +version = "0.8.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" dependencies = [ "cfg-if", ] @@ -1821,23 +1772,11 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3d8a32ae18130a3c84dd492d4215c3d913c3b07c6b63c2eb3eb7ff1101ab7bf" -[[package]] -name = "enum-as-inner" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ffccbb6966c05b32ef8fbac435df276c4ae4d3dc55a8cd0eb9745e6c12f546a" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn 2.0.49", -] - [[package]] name = "enumflags2" -version = "0.7.9" +version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3278c9d5fb675e0a51dabcf4c0d355f692b064171535ba72361be1528a9d8e8d" +checksum = "ba2f4b465f5318854c6f8dd686ede6c0a9dc67d4b1ac241cf0eb51521a309147" dependencies = [ "enumflags2_derive", "serde", @@ -1845,49 +1784,56 @@ dependencies = [ [[package]] name = "enumflags2_derive" -version = "0.7.9" +version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c785274071b1b420972453b306eeca06acf4633829db4223b58a2a8c5953bc4" +checksum = "fc4caf64a58d7a6d65ab00639b046ff54399a39f5f2554728895ace4b297cd79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.100", ] [[package]] -name = "env_logger" -version = "0.10.2" +name = "env_filter" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580" +checksum = "186e05a59d4c50738528153b83b0b0194d3a29507dfec16eccd4b342903397d0" dependencies = [ - "humantime", - "is-terminal", "log", "regex", - "termcolor", ] [[package]] name = "equivalent" -version = "1.0.1" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "erased-serde" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +checksum = "e004d887f51fcb9fef17317a2f3525c887d8aa3f4f50fed920816a688284a5b7" +dependencies = [ + "serde", + "typeid", +] [[package]] name = "errno" -version = "0.3.8" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +checksum = "976dd42dc7e85965fe702eb8164f21f450704bdde31faefd6471dba214cb594e" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "error-code" -version = "3.0.0" +version = "3.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "281e452d3bad4005426416cdba5ccfd4f5c1280e10099e21db27f7c1c28347fc" +checksum = "a5d9305ccc6942a704f4335694ecd3de2ea531b114ac2d51f5f843750787a92f" [[package]] name = "etcetera" @@ -1902,15 +1848,9 @@ dependencies = [ [[package]] name = "event-listener" -version = "2.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" - -[[package]] -name = "event-listener" -version = "4.0.3" +version = "5.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67b215c49b2b248c855fb73579eb1f4f26c38ffdc12973e20e07b91d78d5646e" +checksum = "3492acde4c3fc54c845eaab3eed8bd00c7a7d881f78bfc801e43a93dec1331ae" dependencies = [ "concurrent-queue", "parking", @@ -1918,76 +1858,55 @@ dependencies = [ ] [[package]] -name = "event-listener" -version = "5.1.0" +name = "event-listener-strategy" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7ad6fd685ce13acd6d9541a30f6db6567a7a24c9ffd4ba2955d29e3f22c8b27" +checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" dependencies = [ - "concurrent-queue", - "parking", + "event-listener", "pin-project-lite", ] [[package]] -name = "event-listener-strategy" -version = "0.4.0" +name = "fastrand" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "958e4d70b6d5e81971bebec42271ec641e7ff4e170a6fa605f2b8a8b65cb97d3" -dependencies = [ - "event-listener 4.0.3", - "pin-project-lite", -] +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] -name = "event-listener-strategy" -version = "0.5.0" +name = "fdeflate" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feedafcaa9b749175d5ac357452a9d41ea2911da598fde46ce1fe02c37751291" +checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" dependencies = [ - "event-listener 5.1.0", - "pin-project-lite", + "simd-adler32", ] [[package]] -name = "exr" -version = "1.72.0" +name = "fern" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "887d93f60543e9a9362ef8a21beedd0a833c5d9610e18c67abe15a5963dcb1a4" +checksum = "4316185f709b23713e41e3195f90edef7fb00c3ed4adc79769cf09cc762a3b29" dependencies = [ - "bit_field", - "flume", - "half", - "lebe", - "miniz_oxide", - "rayon-core", - "smallvec", - "zune-inflate", + "colored", + "log", ] [[package]] -name = "fastrand" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" - -[[package]] -name = "fdeflate" -version = "0.3.4" +name = "ff" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f9bfee30e4dedf0ab8b422f03af778d9612b63f502710fc500a334ebe2de645" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" dependencies = [ - "simd-adler32", + "rand_core 0.6.4", + "subtle", ] [[package]] -name = "fern" -version = "0.6.2" +name = "fiat-crypto" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9f0c14694cbd524c8720dd69b0e3179344f04ebb5f90f2e4a440c6ea3b2f1ee" -dependencies = [ - "colored 1.9.4", - "log", -] +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" [[package]] name = "field-offset" @@ -1995,42 +1914,42 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f" dependencies = [ - "memoffset 0.9.0", + "memoffset 0.9.1", "rustc_version", ] [[package]] name = "file-id" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6584280525fb2059cba3db2c04abf947a1a29a45ddae89f3870f8281704fafc9" +checksum = "6bc904b9bbefcadbd8e3a9fb0d464a9b979de6324c03b3c663e8994f46a5be36" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "filetime" -version = "0.2.23" +version = "0.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd" +checksum = "35c0522e981e68cbfa8c3f978441a5f34b30b96e146b33cd3359176b50fe8586" dependencies = [ "cfg-if", "libc", - "redox_syscall", - "windows-sys 0.52.0", + "libredox", + "windows-sys 0.59.0", ] [[package]] -name = "finl_unicode" -version = "1.2.0" +name = "fixedbitset" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.0.28" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" +checksum = "7ced92e76e966ca2fd84c8f7aa01a4aea65b0eb6648d72f7c8f3e2764a67fece" dependencies = [ "crc32fast", "miniz_oxide", @@ -2038,13 +1957,13 @@ dependencies = [ [[package]] name = "flume" -version = "0.11.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" +checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" dependencies = [ "futures-core", "futures-sink", - "spin 0.9.8", + "spin", ] [[package]] @@ -2053,6 +1972,12 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + [[package]] name = "foreign-types" version = "0.3.2" @@ -2080,7 +2005,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.100", ] [[package]] @@ -2131,9 +2056,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -2146,9 +2071,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -2156,15 +2081,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -2184,15 +2109,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-lite" -version = "2.2.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445ba825b27408685aaecefd65178908c36c6e96aaf6d8599419d46e624192ba" +checksum = "f5edaec856126859abb19ed65f39e90fea3a9574b9707f13539acf4abf7eb532" dependencies = [ "fastrand", "futures-core", @@ -2203,32 +2128,32 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.100", ] [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", @@ -2253,15 +2178,15 @@ dependencies = [ [[package]] name = "gdk" -version = "0.18.0" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5ba081bdef3b75ebcdbfc953699ed2d7417d6bd853347a42a37d76406a33646" +checksum = "d9f245958c627ac99d8e529166f9823fb3b838d1d41fd2b297af3075093c2691" dependencies = [ "cairo-rs", "gdk-pixbuf", "gdk-sys", "gio", - "glib 0.18.5", + "glib", "libc", "pango", ] @@ -2274,7 +2199,7 @@ checksum = "50e1f5f1b0bfb830d6ccc8066d18db35c487b1b2b1e8589b5dfe9f07e8defaec" dependencies = [ "gdk-pixbuf-sys", "gio", - "glib 0.18.5", + "glib", "libc", "once_cell", ] @@ -2285,24 +2210,24 @@ version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9839ea644ed9c97a34d129ad56d38a25e6756f99f3a88e15cd39c20629caf7" dependencies = [ - "gio-sys 0.18.1", - "glib-sys 0.18.1", - "gobject-sys 0.18.0", + "gio-sys", + "glib-sys", + "gobject-sys", "libc", "system-deps", ] [[package]] name = "gdk-sys" -version = "0.18.0" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31ff856cb3386dae1703a920f803abafcc580e9b5f711ca62ed1620c25b51ff2" +checksum = "5c2d13f38594ac1e66619e188c6d5a1adb98d11b2fcf7894fc416ad76aa2f3f7" dependencies = [ "cairo-sys-rs", "gdk-pixbuf-sys", - "gio-sys 0.18.1", - "glib-sys 0.18.1", - "gobject-sys 0.18.0", + "gio-sys", + "glib-sys", + "gobject-sys", "libc", "pango-sys", "pkg-config", @@ -2311,13 +2236,13 @@ dependencies = [ [[package]] name = "gdkwayland-sys" -version = "0.18.0" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a90fbf5c033c65d93792192a49a8efb5bb1e640c419682a58bb96f5ae77f3d4a" +checksum = "140071d506d223f7572b9f09b5e155afbd77428cd5cc7af8f2694c41d98dfe69" dependencies = [ "gdk-sys", - "glib-sys 0.18.1", - "gobject-sys 0.18.0", + "glib-sys", + "gobject-sys", "libc", "pkg-config", "system-deps", @@ -2325,44 +2250,31 @@ dependencies = [ [[package]] name = "gdkx11" -version = "0.18.0" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db2ea8a4909d530f79921290389cbd7c34cb9d623bfe970eaae65ca5f9cd9cce" +checksum = "3caa00e14351bebbc8183b3c36690327eb77c49abc2268dd4bd36b856db3fbfe" dependencies = [ "gdk", "gdkx11-sys", "gio", - "glib 0.18.5", + "glib", "libc", "x11", ] [[package]] name = "gdkx11-sys" -version = "0.18.0" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fee8f00f4ee46cad2939b8990f5c70c94ff882c3028f3cc5abf950fa4ab53043" +checksum = "6e2e7445fe01ac26f11601db260dd8608fe172514eb63b3b5e261ea6b0f4428d" dependencies = [ "gdk-sys", - "glib-sys 0.18.1", + "glib-sys", "libc", "system-deps", "x11", ] -[[package]] -name = "generator" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc16584ff22b460a382b7feec54b23d2908d858152e5739a120b949293bd74e" -dependencies = [ - "cc", - "libc", - "log", - "rustversion", - "windows 0.48.0", -] - [[package]] name = "generic-array" version = "0.14.7" @@ -2371,6 +2283,7 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", ] [[package]] @@ -2383,6 +2296,16 @@ dependencies = [ "windows-targets 0.48.5", ] +[[package]] +name = "gethostname" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed7131e57abbde63513e0e6636f76668a1ca9798dcae2df4e283cae9ee83859e" +dependencies = [ + "rustix 1.0.5", + "windows-targets 0.52.6", +] + [[package]] name = "getrandom" version = "0.1.16" @@ -2396,9 +2319,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "js-sys", @@ -2408,40 +2331,34 @@ dependencies = [ ] [[package]] -name = "ghash" -version = "0.4.4" +name = "getrandom" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1583cc1656d7839fd3732b80cf4f38850336cdb9b8ded1cd399ca62958de3c99" +checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0" dependencies = [ - "opaque-debug", - "polyval 0.5.3", + "cfg-if", + "js-sys", + "libc", + "r-efi", + "wasi 0.14.2+wasi-0.2.4", + "wasm-bindgen", ] [[package]] name = "ghash" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d930750de5717d2dd0b8c0d42c076c0e884c81a73e6cab859bbd2339c71e3e40" +checksum = "f0d8a4362ccb29cb0b265253fb0a2728f592895ee6854fd9bc13f2ffda266ff1" dependencies = [ "opaque-debug", - "polyval 0.6.1", -] - -[[package]] -name = "gif" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80792593675e051cf94a4b111980da2ba60d4a83e43e0048c5693baab3977045" -dependencies = [ - "color_quant", - "weezl", + "polyval", ] [[package]] name = "gimli" -version = "0.28.1" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "gio" @@ -2453,26 +2370,13 @@ dependencies = [ "futures-core", "futures-io", "futures-util", - "gio-sys 0.18.1", - "glib 0.18.5", + "gio-sys", + "glib", "libc", "once_cell", "pin-project-lite", "smallvec", - "thiserror", -] - -[[package]] -name = "gio-sys" -version = "0.16.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9b693b8e39d042a95547fc258a7b07349b1f0b48f4b2fa3108ba3c51c0b5229" -dependencies = [ - "glib-sys 0.16.3", - "gobject-sys 0.16.3", - "libc", - "system-deps", - "winapi 0.3.9", + "thiserror 1.0.69", ] [[package]] @@ -2481,33 +2385,11 @@ version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37566df850baf5e4cb0dfb78af2e4b9898d817ed9263d1090a2df958c64737d2" dependencies = [ - "glib-sys 0.18.1", - "gobject-sys 0.18.0", + "glib-sys", + "gobject-sys", "libc", "system-deps", - "winapi 0.3.9", -] - -[[package]] -name = "glib" -version = "0.16.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16aa2475c9debed5a32832cb5ff2af5a3f9e1ab9e69df58eaadc1ab2004d6eba" -dependencies = [ - "bitflags 1.3.2", - "futures-channel", - "futures-core", - "futures-executor", - "futures-task", - "futures-util", - "gio-sys 0.16.3", - "glib-macros 0.16.8", - "glib-sys 0.16.3", - "gobject-sys 0.16.3", - "libc", - "once_cell", - "smallvec", - "thiserror", + "winapi", ] [[package]] @@ -2516,36 +2398,21 @@ version = "0.18.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "233daaf6e83ae6a12a52055f568f9d7cf4671dabb78ff9560ab6da230ce00ee5" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.9.0", "futures-channel", "futures-core", "futures-executor", "futures-task", "futures-util", - "gio-sys 0.18.1", - "glib-macros 0.18.5", - "glib-sys 0.18.1", - "gobject-sys 0.18.0", + "gio-sys", + "glib-macros", + "glib-sys", + "gobject-sys", "libc", "memchr", "once_cell", "smallvec", - "thiserror", -] - -[[package]] -name = "glib-macros" -version = "0.16.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb1a9325847aa46f1e96ffea37611b9d51fc4827e67f79e7de502a297560a67b" -dependencies = [ - "anyhow", - "heck", - "proc-macro-crate 1.3.1", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 1.0.109", + "thiserror 1.0.69", ] [[package]] @@ -2554,22 +2421,12 @@ version = "0.18.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bb0228f477c0900c880fd78c8759b95c7636dbd7842707f49e132378aa2acdc" dependencies = [ - "heck", - "proc-macro-crate 2.0.2", + "heck 0.4.1", + "proc-macro-crate 2.0.0", "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.49", -] - -[[package]] -name = "glib-sys" -version = "0.16.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61a4f46316d06bfa33a7ac22df6f0524c8be58e3db2d9ca99ccb1f357b62a65" -dependencies = [ - "libc", - "system-deps", + "syn 2.0.100", ] [[package]] @@ -2584,51 +2441,54 @@ dependencies = [ [[package]] name = "glob" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" [[package]] name = "global-hotkey" -version = "0.2.4" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c12993a445d59000c3994fcd3d179e7da026a4234cc46db652987aa2785e4a" +checksum = "41fbb3a4e56c901ee66c190fdb3fa08344e6d09593cc6c61f8eb9add7144b271" dependencies = [ "crossbeam-channel", - "keyboard-types 0.6.2", + "keyboard-types", + "objc2 0.6.0", + "objc2-app-kit", "once_cell", - "thiserror", - "windows-sys 0.48.0", + "serde", + "thiserror 2.0.12", + "windows-sys 0.59.0", "x11-dl", ] [[package]] name = "gobject-sys" -version = "0.16.3" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3520bb9c07ae2a12c7f2fbb24d4efc11231c8146a86956413fb1a79bb760a0f1" +checksum = "0850127b514d1c4a4654ead6dedadb18198999985908e6ffe4436f53c785ce44" dependencies = [ - "glib-sys 0.16.3", + "glib-sys", "libc", "system-deps", ] [[package]] -name = "gobject-sys" -version = "0.18.0" +name = "group" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0850127b514d1c4a4654ead6dedadb18198999985908e6ffe4436f53c785ce44" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" dependencies = [ - "glib-sys 0.18.1", - "libc", - "system-deps", + "ff", + "rand_core 0.6.4", + "subtle", ] [[package]] name = "gtk" -version = "0.18.1" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93c4f5e0e20b60e10631a5f06da7fe3dda744b05ad0ea71fee2f47adf865890c" +checksum = "fd56fb197bfc42bd5d2751f4f017d44ff59fbb58140c6b49f9b3b2bdab08506a" dependencies = [ "atk", "cairo-rs", @@ -2637,7 +2497,7 @@ dependencies = [ "gdk", "gdk-pixbuf", "gio", - "glib 0.18.5", + "glib", "gtk-sys", "gtk3-macros", "libc", @@ -2647,17 +2507,17 @@ dependencies = [ [[package]] name = "gtk-sys" -version = "0.18.0" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "771437bf1de2c1c0b496c11505bdf748e26066bbe942dfc8f614c9460f6d7722" +checksum = "8f29a1c21c59553eb7dd40e918be54dccd60c52b049b75119d5d96ce6b624414" dependencies = [ "atk-sys", "cairo-sys-rs", "gdk-pixbuf-sys", "gdk-sys", - "gio-sys 0.18.1", - "glib-sys 0.18.1", - "gobject-sys 0.18.0", + "gio-sys", + "glib-sys", + "gobject-sys", "libc", "pango-sys", "system-deps", @@ -2665,30 +2525,30 @@ dependencies = [ [[package]] name = "gtk3-macros" -version = "0.18.0" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6063efb63db582968fb7df72e1ae68aa6360dcfb0a75143f34fc7d616bad75e" +checksum = "52ff3c5b21f14f0736fed6dcfc0bfb4225ebf5725f3c0209edeec181e4d73e9d" dependencies = [ "proc-macro-crate 1.3.1", "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.100", ] [[package]] name = "h2" -version = "0.3.24" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" +checksum = "75249d144030531f8dee69fe9cea04d3edf809a017ae445e2abdff6629e86633" dependencies = [ + "atomic-waker", "bytes", "fnv", "futures-core", "futures-sink", - "futures-util", - "http 0.2.11", - "indexmap 2.2.3", + "http", + "indexmap 2.9.0", "slab", "tokio", "tokio-util", @@ -2696,71 +2556,42 @@ dependencies = [ ] [[package]] -name = "h3" -version = "0.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b83e1915177ea624b5bbbdb16bc54f0c106c9664892c695f995e53f5c6793b80" -dependencies = [ - "bytes", - "fastrand", - "futures-util", - "http 0.2.11", - "pin-project-lite", - "tokio", - "tracing", -] - -[[package]] -name = "h3-quinn" -version = "0.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac9675014d703c3d516a121757bbc02e53f1ee838e0729fc7534b35024a81ae4" -dependencies = [ - "bytes", - "futures", - "h3", - "quinn", - "quinn-proto", - "tokio", - "tokio-util", -] - -[[package]] -name = "half" -version = "2.3.1" +name = "hashbrown" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc52e53916c08643f1b56ec082790d1e86a32e58dc5268f897f313fbae7b4872" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "cfg-if", - "crunchy", + "ahash 0.7.8", ] [[package]] name = "hashbrown" -version = "0.12.3" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ - "ahash 0.7.8", + "ahash 0.8.11", + "allocator-api2", ] [[package]] name = "hashbrown" -version = "0.14.3" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" dependencies = [ - "ahash 0.8.8", "allocator-api2", + "equivalent", + "foldhash", ] [[package]] name = "hashlink" -version = "0.8.4" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" +checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" dependencies = [ - "hashbrown 0.14.3", + "hashbrown 0.15.2", ] [[package]] @@ -2768,24 +2599,18 @@ name = "heck" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" -dependencies = [ - "unicode-segmentation", -] [[package]] -name = "hermit-abi" -version = "0.1.19" +name = "heck" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hermit-abi" -version = "0.3.6" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd5256b483761cd23699d0da46cc6fd2ee3be420bbe6d020ae4a091e70b7e9fd" +checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" [[package]] name = "hex" @@ -2808,7 +2633,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest 0.10.7", + "digest", ] [[package]] @@ -2820,17 +2645,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "hostname" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" -dependencies = [ - "libc", - "match_cfg", - "winapi 0.3.9", -] - [[package]] name = "html5ever" version = "0.26.0" @@ -2847,34 +2661,35 @@ dependencies = [ [[package]] name = "http" -version = "0.2.11" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" +checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" dependencies = [ "bytes", "fnv", - "itoa 1.0.10", + "itoa 1.0.15", ] [[package]] -name = "http" -version = "1.0.0" +name = "http-body" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", - "fnv", - "itoa 1.0.10", + "http", ] [[package]] -name = "http-body" -version = "0.4.6" +name = "http-body-util" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" dependencies = [ "bytes", - "http 0.2.11", + "futures-core", + "http", + "http-body", "pin-project-lite", ] @@ -2886,9 +2701,9 @@ checksum = "21dec9db110f5f872ed9699c3ecf50cf16f423502706ba5c72462e28d3157573" [[package]] name = "httparse" -version = "1.8.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" [[package]] name = "httpdate" @@ -2896,75 +2711,95 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" -[[package]] -name = "humantime" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" - [[package]] name = "hyper" -version = "0.14.28" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" +checksum = "cc2b571658e38e0c01b1fdca3bbbe93c00d3d71693ff2770043f8c29bc7d6f80" dependencies = [ "bytes", "futures-channel", - "futures-core", "futures-util", "h2", - "http 0.2.11", + "http", "http-body", "httparse", "httpdate", - "itoa 1.0.10", + "itoa 1.0.15", "pin-project-lite", - "socket2", + "smallvec", "tokio", - "tower-service", - "tracing", "want", ] [[package]] name = "hyper-rustls" -version = "0.24.2" +version = "0.27.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" +checksum = "2d191583f3da1305256f22463b9bb0471acad48a4e534a5218b9963e9c1f59b2" dependencies = [ "futures-util", - "http 0.2.11", + "http", "hyper", - "rustls 0.21.10", + "hyper-util", + "rustls", + "rustls-native-certs", + "rustls-pki-types", "tokio", - "tokio-rustls 0.24.1", + "tokio-rustls", + "tower-service", + "webpki-roots", ] [[package]] name = "hyper-tls" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", + "http-body-util", "hyper", + "hyper-util", "native-tls", "tokio", "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "497bbc33a26fdd4af9ed9c70d63f61cf56a938375fbb32df34db9b1cd6d643f2" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "libc", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", ] [[package]] name = "iana-time-zone" -version = "0.1.60" +version = "0.1.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", + "log", "wasm-bindgen", - "windows-core 0.52.0", + "windows-core", ] [[package]] @@ -2978,65 +2813,169 @@ dependencies = [ [[package]] name = "ico" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3804960be0bb5e4edb1e1ad67afd321a9ecfd875c3e65c099468fd2717d7cae" +checksum = "cc50b891e4acf8fe0e71ef88ec43ad82ee07b3810ad09de10f1d01f072ed4b98" dependencies = [ "byteorder", "png", ] [[package]] -name = "ident_case" -version = "1.0.1" +name = "icu_collections" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] [[package]] -name = "idna" -version = "0.3.0" +name = "icu_locid" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", ] [[package]] -name = "idna" -version = "0.4.0" +name = "icu_locid_transform" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7515e6d781098bf9f7205ab3fc7e9709d34554ae0b21ddbcb5febfa4bc7df11d" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5e8338228bdc8ab83303f16b797e177953730f601a96c25d10cb3ab0daa0cb7" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", ] +[[package]] +name = "icu_properties_data" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85fb8799753b75aee8d2a21d7c14d9f38921b54b3dbda10f5a3c7a7b82dba5e2" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" -version = "0.5.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +dependencies = [ + "icu_normalizer", + "icu_properties", ] [[package]] name = "image" -version = "0.24.8" +version = "0.25.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "034bbe799d1909622a74d1193aa50147769440040ff36cb2baa947609b0a4e23" +checksum = "db35664ce6b9810857a38a906215e75a9c879f0696556a39f59c62829710251a" dependencies = [ "bytemuck", - "byteorder", - "color_quant", - "exr", - "gif", - "jpeg-decoder", + "byteorder-lite", "num-traits", "png", - "qoi", "tiff", ] @@ -3053,31 +2992,31 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.3" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" +checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" dependencies = [ "equivalent", - "hashbrown 0.14.3", + "hashbrown 0.15.2", "serde", ] [[package]] name = "infer" -version = "0.15.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb33622da908807a06f9513c19b3c1ad50fab3e4137d82a78107d502075aa199" +checksum = "a588916bfdfd92e71cacef98a63d9b1f0d74d6599980d11894290e7ddefffcf7" dependencies = [ "cfb", ] [[package]] name = "inotify" -version = "0.9.6" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8069d3ec154eb856955c1c0fbffefbf5f3c40a104ec912d4797314c1801abff" +checksum = "f37dccff2791ab604f9babef0ba14fbe0be30bd368dc541e2b08d07c8aa908f3" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.9.0", "inotify-sys", "libc", ] @@ -3093,92 +3032,71 @@ dependencies = [ [[package]] name = "inout" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" dependencies = [ + "block-padding", "generic-array", ] -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", -] - [[package]] name = "iota-crypto" -version = "0.15.3" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e04d492224bff6e97142f033d0a4383bcbc05918be1ff7b3abd2c1cc85205a2" +checksum = "98a38db844c910d78825e173c083f2ef416b69cb091bba8ac1055763c6db065b" dependencies = [ - "aead 0.4.3", - "aes 0.7.5", - "aes-gcm 0.9.2", + "aead", + "aes", + "aes-gcm", "autocfg", + "base64 0.21.7", "blake2", "chacha20poly1305", + "cipher", "curve25519-dalek", - "digest 0.10.7", + "digest", "ed25519-zebra", "generic-array", - "getrandom 0.2.12", + "getrandom 0.2.15", + "hkdf", "hmac", + "iterator-sorted", + "k256", "pbkdf2", + "rand 0.8.5", + "scrypt", "serde", - "sha2 0.10.8", + "sha2", + "tiny-keccak", "unicode-normalization", "x25519-dalek", "zeroize", ] -[[package]] -name = "iota-crypto" -version = "0.23.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5db0e2d85e258d6d0db66f4a6bf1e8bdf5b10c3353aa87d98b168778d13fdc1" -dependencies = [ - "autocfg", -] - [[package]] name = "iota_stronghold" -version = "1.0.5" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c5baaa2460627283f54b968db7a38c9c754dc6059157cae64550ed1b79c91aa" +checksum = "8c0d301c7edbc31494d183b7d24c1bb51d3fb10fce2f3793df1baf45b6988e10" dependencies = [ "bincode", "hkdf", - "iota-crypto 0.15.3", - "rust-argon2", + "iota-crypto", + "rust-argon2 1.0.0", "serde", "stronghold-derive", "stronghold-utils", "stronghold_engine", - "thiserror", + "thiserror 1.0.69", "zeroize", ] -[[package]] -name = "ipconfig" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f" -dependencies = [ - "socket2", - "widestring", - "windows-sys 0.48.0", - "winreg 0.50.0", -] - [[package]] name = "ipnet" -version = "2.9.0" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" [[package]] name = "is-docker" @@ -3189,17 +3107,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "is-terminal" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" -dependencies = [ - "hermit-abi 0.3.6", - "libc", - "windows-sys 0.52.0", -] - [[package]] name = "is-wsl" version = "0.4.0" @@ -3211,13 +3118,16 @@ dependencies = [ ] [[package]] -name = "itertools" -version = "0.12.1" +name = "is_terminal_polyfill" +version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" -dependencies = [ - "either", -] +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + +[[package]] +name = "iterator-sorted" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d101775d2bc8f99f4ac18bf29b9ed70c0dd138b9a1e88d7b80179470cbbe8bd2" [[package]] name = "itoa" @@ -3227,9 +3137,9 @@ checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] name = "itoa" -version = "1.0.10" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "javascriptcore-rs" @@ -3238,7 +3148,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca5671e9ffce8ffba57afc24070e906da7fc4b1ba66f2cabebf61bf2ea257fcc" dependencies = [ "bitflags 1.3.2", - "glib 0.18.5", + "glib", "javascriptcore-rs-sys", ] @@ -3248,8 +3158,8 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af1be78d14ffa4b75b66df31840478fef72b51f8c2465d4ca7c194da9f7a5124" dependencies = [ - "glib-sys 0.18.1", - "gobject-sys 0.18.0", + "glib-sys", + "gobject-sys", "libc", "system-deps", ] @@ -3265,8 +3175,8 @@ dependencies = [ "combine", "jni-sys", "log", - "thiserror", - "walkdir 2.4.0", + "thiserror 1.0.69", + "walkdir", "windows-sys 0.45.0", ] @@ -3278,10 +3188,11 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "jobserver" -version = "0.1.28" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab46a6e9526ddef3ae7f787c06f0f2600639ba80ea3eade3d8e670a2230f51d6" +checksum = "38f262f097c174adebe41eb73d66ae9c06b2844fb0da69969647bbddd9b0538a" dependencies = [ + "getrandom 0.3.2", "libc", ] @@ -3290,50 +3201,50 @@ name = "jpeg-decoder" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0" -dependencies = [ - "rayon", -] [[package]] name = "js-sys" -version = "0.3.68" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" dependencies = [ + "once_cell", "wasm-bindgen", ] [[package]] name = "json-patch" -version = "1.2.0" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55ff1e1486799e3f64129f8ccad108b38290df9cd7015cd31bed17239f0789d6" +checksum = "863726d7afb6bc2590eeff7135d923545e5e964f004c2ccf8716c25e70a86f08" dependencies = [ + "jsonptr", "serde", "serde_json", - "thiserror", - "treediff", + "thiserror 1.0.69", ] [[package]] -name = "kernel32-sys" -version = "0.2.2" +name = "jsonptr" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +checksum = "5dea2b27dd239b2556ed7a25ba842fe47fd602e7fc7433c2a8d6106d4d9edd70" dependencies = [ - "winapi 0.2.8", - "winapi-build", + "serde", + "serde_json", ] [[package]] -name = "keyboard-types" -version = "0.6.2" +name = "k256" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7668b7cff6a51fe61cdde64cd27c8a220786f399501b57ebe36f7d8112fd68" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" dependencies = [ - "bitflags 1.3.2", - "serde", - "unicode-segmentation", + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2", ] [[package]] @@ -3342,7 +3253,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b750dcadc39a09dbadd74e118f6dd6598df77fa01df0cfcdc52c28dece74528a" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.9.0", "serde", "unicode-segmentation", ] @@ -3382,26 +3293,20 @@ dependencies = [ [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" dependencies = [ - "spin 0.5.2", + "spin", ] -[[package]] -name = "lebe" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" - [[package]] name = "libappindicator" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03589b9607c868cc7ae54c0b2a22c8dc03dd41692d48f2d7df73615c6a95dc0a" dependencies = [ - "glib 0.18.5", + "glib", "gtk", "gtk-sys", "libappindicator-sys", @@ -3415,70 +3320,89 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e9ec52138abedcc58dc17a7c6c0c00a2bdb4f3427c7f63fa97fd0d859155caf" dependencies = [ "gtk-sys", - "libloading 0.7.4", + "libloading", "once_cell", ] [[package]] name = "libc" -version = "0.2.153" +version = "0.2.172" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" [[package]] -name = "libloading" -version = "0.7.4" +name = "libflate" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +checksum = "45d9dfdc14ea4ef0900c1cddbc8dcd553fbaacd8a4a282cf4018ae9dd04fb21e" dependencies = [ - "cfg-if", - "winapi 0.3.9", + "adler32", + "core2", + "crc32fast", + "dary_heap", + "libflate_lz77", +] + +[[package]] +name = "libflate_lz77" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e0d73b369f386f1c44abd9c570d5318f55ccde816ff4b562fa452e5182863d" +dependencies = [ + "core2", + "hashbrown 0.14.5", + "rle-decode-fast", ] [[package]] name = "libloading" -version = "0.8.1" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c571b676ddfc9a8c12f1f3d3085a7b163966a8fd8098a90640953ce5f6170161" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" dependencies = [ "cfg-if", - "windows-sys 0.48.0", + "winapi", ] [[package]] name = "libm" -version = "0.2.8" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" +checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa" [[package]] name = "libredox" -version = "0.0.1" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.9.0", "libc", "redox_syscall", ] [[package]] -name = "libsodium-sys" -version = "0.2.7" +name = "libsodium-sys-stable" +version = "1.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b779387cd56adfbc02ea4a668e704f729be8d6a6abd2c27ca5ee537849a92fd" +checksum = "b023d38f2afdfe36f81e15a9d7232097701d7b107e3a93ba903083985e235239" dependencies = [ "cc", "libc", + "libflate", + "minisign-verify", "pkg-config", - "walkdir 2.4.0", + "tar", + "ureq", + "vcpkg", + "zip", ] [[package]] name = "libsqlite3-sys" -version = "0.27.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716" +checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149" dependencies = [ "cc", "pkg-config", @@ -3486,93 +3410,52 @@ dependencies = [ ] [[package]] -name = "libudev" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea626d3bdf40a1c5aee3bcd4f40826970cae8d80a8fec934c82a63840094dcfe" -dependencies = [ - "libc", - "libudev-sys", -] - -[[package]] -name = "libudev-sys" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c8469b4a23b962c1396b9b451dda50ef5b283e8dd309d69033475fa9b334324" -dependencies = [ - "libc", - "pkg-config", -] - -[[package]] -name = "line-wrap" -version = "0.1.1" +name = "linux-raw-sys" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30344350a2a51da54c1d53be93fade8a237e545dbcc4bdbe635413f2117cab9" -dependencies = [ - "safemem", -] +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" [[package]] -name = "linked-hash-map" -version = "0.5.6" +name = "linux-raw-sys" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" +checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" [[package]] -name = "linux-raw-sys" -version = "0.4.13" +name = "litemap" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" +checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" [[package]] -name = "linux-raw-sys" -version = "0.6.4" +name = "litrs" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0b5399f6804fbab912acbd8878ed3532d506b7c951b8f9f164ef90fef39e3f4" +checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5" [[package]] name = "lock_api" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ "autocfg", "scopeguard", ] [[package]] -name = "log" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" -dependencies = [ - "value-bag", -] - -[[package]] -name = "loom" -version = "0.5.6" +name = "lockfree-object-pool" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff50ecb28bb86013e935fb6683ab1f6d3a20016f123c76fd4c27470076ac30f5" -dependencies = [ - "cfg-if", - "generator", - "scoped-tls", - "serde", - "serde_json", - "tracing", - "tracing-subscriber", -] +checksum = "9374ef4228402d4b7e403e5838cb880d9ee663314b0a900d5a6aabf0c213552e" [[package]] -name = "lru-cache" -version = "0.1.2" +name = "log" +version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" dependencies = [ - "linked-hash-map", + "value-bag", ] [[package]] @@ -3583,26 +3466,16 @@ checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" [[package]] name = "mac-notification-sys" -version = "0.6.1" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51fca4d74ff9dbaac16a01b924bc3693fa2bba0862c2c633abc73f9a8ea21f64" +checksum = "0b95dfb34071d1592b45622bf93e315e3a72d414b6782aca9a015c12bec367ef" dependencies = [ "cc", - "dirs-next", - "objc-foundation", - "objc_id", + "objc2 0.6.0", + "objc2-foundation 0.3.0", "time", ] -[[package]] -name = "malloc_buf" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" -dependencies = [ - "libc", -] - [[package]] name = "maplit" version = "1.0.2" @@ -3623,21 +3496,6 @@ dependencies = [ "tendril", ] -[[package]] -name = "match_cfg" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" - -[[package]] -name = "matchers" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" -dependencies = [ - "regex-automata 0.1.10", -] - [[package]] name = "matches" version = "0.1.10" @@ -3651,23 +3509,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" dependencies = [ "cfg-if", - "digest 0.10.7", + "digest", ] [[package]] name = "memchr" -version = "2.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" - -[[package]] -name = "memmap2" -version = "0.9.4" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe751422e4a8caa417e13c3ea66452215d7d63e19e604f4980461212f3ae1322" -dependencies = [ - "libc", -] +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "memoffset" @@ -3680,9 +3529,9 @@ dependencies = [ [[package]] name = "memoffset" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" dependencies = [ "autocfg", ] @@ -3695,9 +3544,9 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "mime_guess" -version = "2.0.4" +version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" +checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" dependencies = [ "mime", "unicase", @@ -3711,98 +3560,107 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "minisign-verify" -version = "0.2.1" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "933dca44d65cdd53b355d0b73d380a2ff5da71f87f036053188bf1eab6a19881" +checksum = "6367d84fb54d4242af283086402907277715b8fe46976963af5ebf173f8efba3" [[package]] name = "miniz_oxide" -version = "0.7.2" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" +checksum = "3be647b768db090acb35d5ec5db2b0e1f1de11133ca123b9eacf5137868f892a" dependencies = [ - "adler", + "adler2", "simd-adler32", ] [[package]] name = "mio" -version = "0.8.10" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" +checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" dependencies = [ "libc", "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "mockito" -version = "0.31.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80f9fece9bd97ab74339fe19f4bcaf52b76dcc18e5364c7977c1838f76b38de9" +checksum = "7760e0e418d9b7e5777c0374009ca4c93861b9066f18cb334a20ce50ab63aa48" dependencies = [ "assert-json-diff", - "colored 2.1.0", - "httparse", - "lazy_static", + "bytes", + "colored", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-util", "log", - "rand 0.8.5", + "rand 0.9.0", "regex", "serde_json", "serde_urlencoded", "similar", + "tokio", ] [[package]] name = "muda" -version = "0.11.5" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c47e7625990fc1af2226ea4f34fb2412b03c12639fcb91868581eb3a6893453" +checksum = "4de14a9b5d569ca68d7c891d613b390cf5ab4f851c77aaa2f9e435555d3d9492" dependencies = [ - "cocoa 0.25.0", "crossbeam-channel", + "dpi", "gtk", - "keyboard-types 0.7.0", - "objc", + "keyboard-types", + "objc2 0.6.0", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-foundation 0.3.0", "once_cell", "png", "serde", - "thiserror", - "windows-sys 0.52.0", + "thiserror 2.0.12", + "windows-sys 0.59.0", ] [[package]] name = "native-tls" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" dependencies = [ - "lazy_static", "libc", "log", "openssl", "openssl-probe", "openssl-sys", "schannel", - "security-framework", + "security-framework 2.11.1", "security-framework-sys", "tempfile", ] [[package]] name = "ndk" -version = "0.7.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "451422b7e4718271c8b5b3aadf5adedba43dc76312454b387e98fae0fc951aa0" +checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.9.0", "jni-sys", + "log", "ndk-sys", "num_enum", - "raw-window-handle 0.5.2", - "thiserror", + "raw-window-handle", + "thiserror 1.0.69", ] [[package]] @@ -3813,18 +3671,18 @@ checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" [[package]] name = "ndk-sys" -version = "0.4.1+23.1.7779620" +version = "0.6.0+11769913" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cf2aae958bd232cac5069850591667ad422d263686d75b52a065f9badeee5a3" +checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" dependencies = [ "jni-sys", ] [[package]] name = "new_debug_unreachable" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" [[package]] name = "nix" @@ -3840,14 +3698,15 @@ dependencies = [ [[package]] name = "nix" -version = "0.27.1" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" +checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.9.0", "cfg-if", + "cfg_aliases", "libc", - "memoffset 0.9.0", + "memoffset 0.9.1", ] [[package]] @@ -3868,12 +3727,11 @@ dependencies = [ [[package]] name = "notify" -version = "6.1.1" +version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6205bd8bb1e454ad2e27422015fb5e4f2bcc7e08fa8f27058670d208324a4d2d" +checksum = "2fee8403b3d66ac7b26aee6e40a897d85dc5ce26f44da36b8b73e987cc52e943" dependencies = [ - "bitflags 2.4.2", - "crossbeam-channel", + "bitflags 2.9.0", "filetime", "fsevent-sys", "inotify", @@ -3881,33 +3739,45 @@ dependencies = [ "libc", "log", "mio", - "serde", - "walkdir 2.4.0", - "windows-sys 0.48.0", + "notify-types", + "walkdir", + "windows-sys 0.59.0", ] [[package]] name = "notify-debouncer-full" -version = "0.3.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f5dab59c348b9b50cf7f261960a20e389feb2713636399cd9082cd4b536154" +checksum = "d2d88b1a7538054351c8258338df7c931a590513fb3745e8c15eb9ff4199b8d1" dependencies = [ - "crossbeam-channel", "file-id", "log", "notify", - "parking_lot", - "walkdir 2.4.0", + "notify-types", + "walkdir", +] + +[[package]] +name = "notify-rust" +version = "4.11.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6442248665a5aa2514e794af3b39661a8e73033b1cc5e59899e1276117ee4400" +dependencies = [ + "futures-lite", + "log", + "mac-notification-sys", + "serde", + "tauri-winrt-notification", + "zbus", ] [[package]] -name = "nu-ansi-term" -version = "0.46.0" +name = "notify-types" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +checksum = "5e0826a989adedc2a244799e823aece04662b66609d96af8dff7ac6df9a8925d" dependencies = [ - "overload", - "winapi 0.3.9", + "serde", ] [[package]] @@ -3944,9 +3814,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -3955,120 +3825,296 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", "libm", ] [[package]] -name = "num_cpus" -version = "1.16.0" +name = "num_enum" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e613fc340b2220f734a8595782c551f1250e969d87d3be1ae0579e8d4065179" +dependencies = [ + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" +dependencies = [ + "proc-macro-crate 3.3.0", + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "num_threads" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" +dependencies = [ + "libc", +] + +[[package]] +name = "objc-sys" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310" + +[[package]] +name = "objc2" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46a785d4eeff09c14c487497c162e92766fbb3e4059a71840cecc03d9a50b804" +dependencies = [ + "objc-sys", + "objc2-encode", +] + +[[package]] +name = "objc2" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3531f65190d9cff863b77a99857e74c314dd16bf56c538c4b57c7cbc3f3a6e59" +dependencies = [ + "objc2-encode", + "objc2-exception-helper", +] + +[[package]] +name = "objc2-app-kit" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5906f93257178e2f7ae069efb89fbd6ee94f0592740b5f8a1512ca498814d0fb" +dependencies = [ + "bitflags 2.9.0", + "block2 0.6.0", + "libc", + "objc2 0.6.0", + "objc2-cloud-kit", + "objc2-core-data", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-core-image", + "objc2-foundation 0.3.0", + "objc2-quartz-core 0.3.0", +] + +[[package]] +name = "objc2-cloud-kit" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c1948a9be5f469deadbd6bcb86ad7ff9e47b4f632380139722f7d9840c0d42c" +dependencies = [ + "bitflags 2.9.0", + "objc2 0.6.0", + "objc2-foundation 0.3.0", +] + +[[package]] +name = "objc2-core-data" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f860f8e841f6d32f754836f51e6bc7777cd7e7053cf18528233f6811d3eceb4" +dependencies = [ + "bitflags 2.9.0", + "objc2 0.6.0", + "objc2-foundation 0.3.0", +] + +[[package]] +name = "objc2-core-foundation" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daeaf60f25471d26948a1c2f840e3f7d86f4109e3af4e8e4b5cd70c39690d925" +dependencies = [ + "bitflags 2.9.0", + "objc2 0.6.0", +] + +[[package]] +name = "objc2-core-graphics" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dca602628b65356b6513290a21a6405b4d4027b8b250f0b98dddbb28b7de02" +dependencies = [ + "bitflags 2.9.0", + "objc2 0.6.0", + "objc2-core-foundation", + "objc2-io-surface", +] + +[[package]] +name = "objc2-core-image" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ffa6bea72bf42c78b0b34e89c0bafac877d5f80bf91e159a5d96ea7f693ca56" +dependencies = [ + "objc2 0.6.0", + "objc2-foundation 0.3.0", +] + +[[package]] +name = "objc2-encode" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" + +[[package]] +name = "objc2-exception-helper" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7a1c5fbb72d7735b076bb47b578523aedc40f3c439bea6dfd595c089d79d98a" +dependencies = [ + "cc", +] + +[[package]] +name = "objc2-foundation" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" +dependencies = [ + "bitflags 2.9.0", + "block2 0.5.1", + "libc", + "objc2 0.5.2", +] + +[[package]] +name = "objc2-foundation" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +checksum = "3a21c6c9014b82c39515db5b396f91645182611c97d24637cf56ac01e5f8d998" dependencies = [ - "hermit-abi 0.3.6", + "bitflags 2.9.0", + "block2 0.6.0", "libc", + "objc2 0.6.0", + "objc2-core-foundation", ] [[package]] -name = "num_enum" -version = "0.5.11" +name = "objc2-io-surface" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" +checksum = "161a8b87e32610086e1a7a9e9ec39f84459db7b3a0881c1f16ca5a2605581c19" dependencies = [ - "num_enum_derive", + "bitflags 2.9.0", + "objc2 0.6.0", + "objc2-core-foundation", ] [[package]] -name = "num_enum_derive" -version = "0.5.11" +name = "objc2-metal" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" +checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6" dependencies = [ - "proc-macro-crate 1.3.1", - "proc-macro2", - "quote", - "syn 1.0.109", + "bitflags 2.9.0", + "block2 0.5.1", + "objc2 0.5.2", + "objc2-foundation 0.2.2", ] [[package]] -name = "num_threads" -version = "0.1.7" +name = "objc2-osa-kit" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" +checksum = "a1ac59da3ceebc4a82179b35dc550431ad9458f9cc326e053f49ba371ce76c5a" dependencies = [ - "libc", + "bitflags 2.9.0", + "objc2 0.6.0", + "objc2-app-kit", + "objc2-foundation 0.3.0", ] [[package]] -name = "objc" -version = "0.2.7" +name = "objc2-quartz-core" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" +checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a" dependencies = [ - "malloc_buf", - "objc_exception", + "bitflags 2.9.0", + "block2 0.5.1", + "objc2 0.5.2", + "objc2-foundation 0.2.2", + "objc2-metal", ] [[package]] -name = "objc-foundation" -version = "0.1.1" +name = "objc2-quartz-core" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9" +checksum = "6fb3794501bb1bee12f08dcad8c61f2a5875791ad1c6f47faa71a0f033f20071" dependencies = [ - "block", - "objc", - "objc_id", + "bitflags 2.9.0", + "objc2 0.6.0", + "objc2-foundation 0.3.0", ] [[package]] -name = "objc_exception" -version = "0.1.2" +name = "objc2-ui-kit" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad970fb455818ad6cba4c122ad012fae53ae8b4795f86378bce65e4f6bab2ca4" +checksum = "777a571be14a42a3990d4ebedaeb8b54cd17377ec21b92e8200ac03797b3bee1" dependencies = [ - "cc", + "bitflags 2.9.0", + "objc2 0.6.0", + "objc2-core-foundation", + "objc2-foundation 0.3.0", ] [[package]] -name = "objc_id" -version = "0.1.1" +name = "objc2-web-kit" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b" +checksum = "b717127e4014b0f9f3e8bba3d3f2acec81f1bde01f656823036e823ed2c94dce" dependencies = [ - "objc", + "bitflags 2.9.0", + "block2 0.6.0", + "objc2 0.6.0", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-foundation 0.3.0", ] [[package]] name = "object" -version = "0.32.2" +version = "0.36.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.19.0" +version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] name = "opaque-debug" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "open" -version = "4.2.0" +version = "5.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a083c0c7e5e4a8ec4176346cf61f67ac674e8bfb059d9226e1c54a96b377c12" +checksum = "e2483562e62ea94312f3576a7aca397306df7990b8d89033e18766744377ef95" dependencies = [ + "dunce", "is-wsl", "libc", "pathdiff", @@ -4076,11 +4122,11 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.63" +version = "0.10.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15c9d69dd87a29568d4d017cfe8ec518706046a05184e5aea92d0af890b803c8" +checksum = "fedfea7d58a1f73118430a55da6a286e7b044961736ce96a16a17068ea25e5da" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.9.0", "cfg-if", "foreign-types 0.3.2", "libc", @@ -4097,29 +4143,29 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.100", ] [[package]] name = "openssl-probe" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" +checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" [[package]] name = "openssl-src" -version = "300.2.3+3.2.1" +version = "300.5.0+3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cff92b6f71555b61bb9315f7c64da3ca43d87531622120fea0195fc761b4843" +checksum = "e8ce546f549326b0e6052b649198487d91320875da901e7bd11a06d1ee3f9c2f" dependencies = [ "cc", ] [[package]] name = "openssl-sys" -version = "0.9.99" +version = "0.9.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e1bf214306098e4832460f797824c05d25aacdf896f64a985fb0fd992454ae" +checksum = "8288979acd84749c744a9014b4382d42b8f7b2592847b5afb2ed29e5d16ede07" dependencies = [ "cc", "libc", @@ -4128,6 +4174,22 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + +[[package]] +name = "ordered-multimap" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49203cdcae0030493bad186b28da2fa25645fa276a51b6fec8010d281e02ef79" +dependencies = [ + "dlv-list", + "hashbrown 0.14.5", +] + [[package]] name = "ordered-stream" version = "0.2.0" @@ -4140,30 +4202,38 @@ dependencies = [ [[package]] name = "os_info" -version = "3.7.0" +version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "006e42d5b888366f1880eda20371fedde764ed2213dc8496f49622fa0c99cd5e" +checksum = "2a604e53c24761286860eba4e2c8b23a0161526476b1de520139d69cdb85a6b5" dependencies = [ "log", "serde", - "winapi 0.3.9", + "windows-sys 0.52.0", ] [[package]] name = "os_pipe" -version = "1.1.5" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57119c3b893986491ec9aa85056780d3a0f3cf4da7cc09dd3650dbd6c6738fb9" +checksum = "5ffd2b0a5634335b135d5728d84c5e0fd726954b87111f7506a61c502280d982" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] -name = "overload" -version = "0.1.1" +name = "osakit" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" +checksum = "732c71caeaa72c065bb69d7ea08717bd3f4863a4f451402fc9513e29dbd5261b" +dependencies = [ + "objc2 0.6.0", + "objc2-foundation 0.3.0", + "objc2-osa-kit", + "serde", + "serde_json", + "thiserror 2.0.12", +] [[package]] name = "pango" @@ -4172,7 +4242,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ca27ec1eb0457ab26f3036ea52229edbdb74dee1edd29063f5b9b010e7ebee4" dependencies = [ "gio", - "glib 0.18.5", + "glib", "libc", "once_cell", "pango-sys", @@ -4184,23 +4254,23 @@ version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "436737e391a843e5933d6d9aa102cb126d501e815b83601365a948a518555dc5" dependencies = [ - "glib-sys 0.18.1", - "gobject-sys 0.18.0", + "glib-sys", + "gobject-sys", "libc", "system-deps", ] [[package]] name = "parking" -version = "2.2.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" [[package]] name = "parking_lot" -version = "0.12.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" dependencies = [ "lock_api", "parking_lot_core", @@ -4208,50 +4278,37 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.9" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-targets 0.48.5", -] - -[[package]] -name = "password-hash" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" -dependencies = [ - "base64ct", - "rand_core 0.6.4", - "subtle", + "windows-targets 0.52.6", ] [[package]] name = "paste" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "pathdiff" -version = "0.2.1" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" +checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3" [[package]] name = "pbkdf2" -version = "0.11.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" dependencies = [ - "digest 0.10.7", + "digest", "hmac", - "password-hash", - "sha2 0.10.8", ] [[package]] @@ -4269,6 +4326,16 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +[[package]] +name = "petgraph" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" +dependencies = [ + "fixedbitset", + "indexmap 2.9.0", +] + [[package]] name = "phf" version = "0.8.0" @@ -4291,12 +4358,12 @@ dependencies = [ [[package]] name = "phf" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" +checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" dependencies = [ - "phf_macros 0.11.2", - "phf_shared 0.11.2", + "phf_macros 0.11.3", + "phf_shared 0.11.3", ] [[package]] @@ -4341,11 +4408,11 @@ dependencies = [ [[package]] name = "phf_generator" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" +checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" dependencies = [ - "phf_shared 0.11.2", + "phf_shared 0.11.3", "rand 0.8.5", ] @@ -4365,15 +4432,15 @@ dependencies = [ [[package]] name = "phf_macros" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" +checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216" dependencies = [ - "phf_generator 0.11.2", - "phf_shared 0.11.2", + "phf_generator 0.11.3", + "phf_shared 0.11.3", "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.100", ] [[package]] @@ -4382,7 +4449,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7" dependencies = [ - "siphasher", + "siphasher 0.3.11", ] [[package]] @@ -4391,23 +4458,23 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" dependencies = [ - "siphasher", + "siphasher 0.3.11", ] [[package]] name = "phf_shared" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" dependencies = [ - "siphasher", + "siphasher 1.0.1", ] [[package]] name = "pin-project-lite" -version = "0.2.13" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] name = "pin-utils" @@ -4417,9 +4484,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "piper" -version = "0.2.1" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "668d31b1c4eba19242f2088b2bf3316b82ca31082a8335764db4e083db7485d4" +checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066" dependencies = [ "atomic-waker", "fastrand", @@ -4449,29 +4516,28 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.30" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "plist" -version = "1.6.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5699cc8a63d1aa2b1ee8e12b9ad70ac790d65788cd36101fa37f87ea46c4cef" +checksum = "eac26e981c03a6e53e0aee43c113e3202f5581d5360dae7bd2c70e800dd0451d" dependencies = [ - "base64 0.21.7", - "indexmap 2.2.3", - "line-wrap", - "quick-xml 0.31.0", + "base64 0.22.1", + "indexmap 2.9.0", + "quick-xml 0.32.0", "serde", "time", ] [[package]] name = "png" -version = "0.17.13" +version = "0.17.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06e4b0d3d1312775e782c86c91a111aa1f910cbb65e1337f9975b5f9a554b5e1" +checksum = "82151a2fc869e011c153adc57cf2789ccb8d9906ce52c0b39a6b5697749d7526" dependencies = [ "bitflags 1.3.2", "crc32fast", @@ -4482,51 +4548,40 @@ dependencies = [ [[package]] name = "polling" -version = "3.5.0" +version = "3.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24f040dee2588b4963afb4e420540439d126f73fdacf4a9c486a96d840bac3c9" +checksum = "a604568c3202727d1507653cb121dbd627a58684eb09a820fd746bee38b4442f" dependencies = [ "cfg-if", "concurrent-queue", + "hermit-abi", "pin-project-lite", - "rustix", + "rustix 0.38.44", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "poly1305" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "048aeb476be11a4b6ca432ca569e375810de9294ae78f4774e78ea98a9246ede" -dependencies = [ - "cpufeatures", - "opaque-debug", - "universal-hash 0.4.0", -] - -[[package]] -name = "polyval" -version = "0.5.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" dependencies = [ - "cfg-if", "cpufeatures", "opaque-debug", - "universal-hash 0.4.0", + "universal-hash", ] [[package]] name = "polyval" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52cff9d1d4dee5fe6d03729099f4a310a41179e0a10dbf542039873f2e826fb" +checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25" dependencies = [ "cfg-if", "cpufeatures", "opaque-debug", - "universal-hash 0.5.1", + "universal-hash", ] [[package]] @@ -4537,9 +4592,12 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" -version = "0.2.17" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy 0.8.24", +] [[package]] name = "precomputed-hash" @@ -4559,12 +4617,20 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "2.0.2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b00f26d3400549137f92511a46ac1cd8ce37cb5598a96d382381458b992a5d24" +checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8" dependencies = [ - "toml_datetime", - "toml_edit 0.20.2", + "toml_edit 0.20.7", +] + +[[package]] +name = "proc-macro-crate" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edce586971a4dfaa28950c6f18ed55e0406c1ab88bbce2c6f6293a7aaba73d35" +dependencies = [ + "toml_edit 0.22.24", ] [[package]] @@ -4599,9 +4665,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" dependencies = [ "unicode-ident", ] @@ -4634,23 +4700,14 @@ dependencies = [ [[package]] name = "publicsuffix" -version = "2.2.3" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96a8c1bda5ae1af7f99a2962e49df150414a43d62404644d98dd5c3a93d07457" +checksum = "6f42ea446cab60335f76979ec15e12619a2165b5ae2c12166bef27d283a9fadf" dependencies = [ - "idna 0.3.0", + "idna", "psl-types", ] -[[package]] -name = "qoi" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001" -dependencies = [ - "bytemuck", -] - [[package]] name = "quick-error" version = "1.2.3" @@ -4659,79 +4716,91 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quick-xml" -version = "0.30.0" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eff6510e86862b57b210fd8cbe8ed3f0d7d600b9c2863cd4549a2e033c66e956" +checksum = "1d3a6e5838b60e0e8fa7a43f22ade549a37d61f8bdbe636d0d7816191de969c2" dependencies = [ "memchr", ] [[package]] name = "quick-xml" -version = "0.31.0" +version = "0.37.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1004a344b30a54e2ee58d66a71b32d2db2feb0a31f9a2d302bf0536f15de2a33" +checksum = "a4ce8c88de324ff838700f36fb6ab86c96df0e3c4ab6ef3a9b2044465cce1369" dependencies = [ "memchr", ] [[package]] name = "quinn" -version = "0.10.2" +version = "0.11.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cc2c5017e4b43d5995dcea317bc46c1e09404c0a9664d2908f7f02dfe943d75" +checksum = "c3bd15a6f2967aef83887dcb9fec0014580467e33720d073560cf015a5683012" dependencies = [ "bytes", - "futures-io", + "cfg_aliases", "pin-project-lite", "quinn-proto", "quinn-udp", "rustc-hash", - "rustls 0.21.10", - "thiserror", + "rustls", + "socket2", + "thiserror 2.0.12", "tokio", "tracing", + "web-time", ] [[package]] name = "quinn-proto" -version = "0.10.6" +version = "0.11.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "141bf7dfde2fbc246bfd3fe12f2455aa24b0fbd9af535d8c86c7bd1381ff2b1a" +checksum = "b820744eb4dc9b57a3398183639c511b5a26d2ed702cedd3febaa1393caa22cc" dependencies = [ "bytes", - "rand 0.8.5", - "ring 0.16.20", + "getrandom 0.3.2", + "rand 0.9.0", + "ring", "rustc-hash", - "rustls 0.21.10", + "rustls", + "rustls-pki-types", "slab", - "thiserror", + "thiserror 2.0.12", "tinyvec", "tracing", + "web-time", ] [[package]] name = "quinn-udp" -version = "0.4.1" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "055b4e778e8feb9f93c4e439f71dc2156ef13360b432b799e179a8c4cdf0b1d7" +checksum = "541d0f57c6ec747a90738a52741d3221f7960e8ac2f0ff4b1a63680e033b4ab5" dependencies = [ - "bytes", + "cfg_aliases", "libc", + "once_cell", "socket2", "tracing", - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] name = "quote" -version = "1.0.35" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] +[[package]] +name = "r-efi" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" + [[package]] name = "radium" version = "0.7.0" @@ -4763,6 +4832,17 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "rand" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.3", + "zerocopy 0.8.24", +] + [[package]] name = "rand_chacha" version = "0.2.2" @@ -4783,6 +4863,16 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", +] + [[package]] name = "rand_core" version = "0.5.1" @@ -4798,7 +4888,16 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.12", + "getrandom 0.2.15", +] + +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.2", ] [[package]] @@ -4821,35 +4920,9 @@ dependencies = [ [[package]] name = "raw-window-handle" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" - -[[package]] -name = "raw-window-handle" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42a9830a0e1b9fb145ebb365b8bc4ccd75f290f98c0247deafbbe2c75cefb544" - -[[package]] -name = "rayon" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7237101a77a10773db45d62004a272517633fbcc3df19d96455ede1122e051" -dependencies = [ - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.12.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" -dependencies = [ - "crossbeam-deque", - "crossbeam-utils", -] +checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" [[package]] name = "read-progress-stream" @@ -4864,67 +4937,63 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.4.1" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +checksum = "d2f103c6d277498fbceb16e84d317e2a400f160f46904d5f5410848c829511a3" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.9.0", ] [[package]] name = "redox_users" -version = "0.4.4" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ - "getrandom 0.2.12", + "getrandom 0.2.15", "libredox", - "thiserror", + "thiserror 1.0.69", ] [[package]] -name = "regex" -version = "1.10.3" +name = "redox_users" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +checksum = "dd6f9d3d47bdd2ad6945c5015a226ec6155d0bcdfd8f7cd29f86b71f8de99d2b" dependencies = [ - "aho-corasick", - "memchr", - "regex-automata 0.4.5", - "regex-syntax 0.8.2", + "getrandom 0.2.15", + "libredox", + "thiserror 2.0.12", ] [[package]] -name = "regex-automata" -version = "0.1.10" +name = "regex" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ - "regex-syntax 0.6.29", + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", ] [[package]] name = "regex-automata" -version = "0.4.5" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.2", + "regex-syntax", ] [[package]] name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - -[[package]] -name = "regex-syntax" -version = "0.8.2" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "rend" @@ -4937,12 +5006,12 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.24" +version = "0.12.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6920094eb85afde5e4a138be3f2de8bbdf28000f0029e72c45025a56b042251" +checksum = "d19c46a6fdd48bc4dab94b6103fccc55d34c67cc0ad04653aad4ea2a07cd7bbb" dependencies = [ "async-compression", - "base64 0.21.7", + "base64 0.22.1", "bytes", "cookie", "cookie_store", @@ -4951,13 +5020,13 @@ dependencies = [ "futures-core", "futures-util", "h2", - "h3", - "h3-quinn", - "http 0.2.11", + "http", "http-body", + "http-body-util", "hyper", "hyper-rustls", "hyper-tls", + "hyper-util", "ipnet", "js-sys", "log", @@ -4968,9 +5037,10 @@ dependencies = [ "percent-encoding", "pin-project-lite", "quinn", - "rustls 0.21.10", + "rustls", "rustls-native-certs", "rustls-pemfile", + "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", @@ -4978,89 +5048,74 @@ dependencies = [ "system-configuration", "tokio", "tokio-native-tls", - "tokio-rustls 0.24.1", + "tokio-rustls", "tokio-socks", "tokio-util", + "tower", "tower-service", - "trust-dns-resolver", "url", "wasm-bindgen", "wasm-bindgen-futures", "wasm-streams", "web-sys", - "webpki-roots 0.25.4", - "winreg 0.50.0", + "webpki-roots", + "windows-registry 0.4.0", ] [[package]] -name = "resolv-conf" -version = "0.7.0" +name = "rfc6979" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" dependencies = [ - "hostname", - "quick-error", + "hmac", + "subtle", ] [[package]] name = "rfd" -version = "0.14.0" +version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "373d2fc6310e2d14943d4e66ebed5b774a2b6b3b1610e7377edf124fb2760d6b" +checksum = "80c844748fdc82aae252ee4594a89b6e7ebef1063de7951545564cbc4e57075d" dependencies = [ "ashpd", - "block", - "dispatch", - "glib-sys 0.18.1", - "gobject-sys 0.18.0", + "block2 0.6.0", + "dispatch2", + "glib-sys", + "gobject-sys", "gtk-sys", "js-sys", "log", - "objc", - "objc-foundation", - "objc_id", - "raw-window-handle 0.6.0", + "objc2 0.6.0", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-foundation 0.3.0", + "raw-window-handle", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "windows-sys 0.48.0", -] - -[[package]] -name = "ring" -version = "0.16.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" -dependencies = [ - "cc", - "libc", - "once_cell", - "spin 0.5.2", - "untrusted 0.7.1", - "web-sys", - "winapi 0.3.9", + "windows-sys 0.59.0", ] [[package]] name = "ring" -version = "0.17.8" +version = "0.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" dependencies = [ "cc", "cfg-if", - "getrandom 0.2.12", + "getrandom 0.2.15", "libc", - "spin 0.9.8", - "untrusted 0.9.0", + "untrusted", "windows-sys 0.52.0", ] [[package]] name = "rkyv" -version = "0.7.44" +version = "0.7.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cba464629b3394fc4dbc6f940ff8f5b4ff5c7aef40f29166fd4ad12acbc99c0" +checksum = "9008cd6385b9e161d8229e1f6549dd23c3d022f132a2ea37ac3a10ac4935779b" dependencies = [ "bitvec", "bytecheck", @@ -5076,23 +5131,29 @@ dependencies = [ [[package]] name = "rkyv_derive" -version = "0.7.44" +version = "0.7.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7dddfff8de25e6f62b9d64e6e432bf1c6736c57d20323e15ee10435fbda7c65" +checksum = "503d1d27590a2b0a3a4ca4c94755aa2875657196ecbf401a42eff41d7de532c0" dependencies = [ "proc-macro2", "quote", "syn 1.0.109", ] +[[package]] +name = "rle-decode-fast" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3582f63211428f83597b51b2ddb88e2a91a9d52d12831f9d08f5e624e8977422" + [[package]] name = "rsa" -version = "0.9.6" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d0e5124fcb30e76a7e79bfee683a2746db83784b86289f6251b54b7950a0dfc" +checksum = "78928ac1ed176a5ca1d17e578a1825f3d81ca54cf41053a592584b020cfd691b" dependencies = [ "const-oid", - "digest 0.10.7", + "digest", "num-bigint-dig", "num-integer", "num-traits", @@ -5105,12 +5166,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "runloop" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d79b4b604167921892e84afbbaad9d5ad74e091bf6c511d9dbfb0593f09fabd" - [[package]] name = "rust-argon2" version = "1.0.0" @@ -5123,11 +5178,33 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "rust-argon2" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d9848531d60c9cbbcf9d166c885316c24bc0e2a9d3eba0956bb6cbbd79bc6e8" +dependencies = [ + "base64 0.21.7", + "blake2b_simd", + "constant_time_eq 0.3.1", +] + +[[package]] +name = "rust-ini" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e310ef0e1b6eeb79169a1171daf9abcb87a2e17c03bee2c4bb100b55c75409f" +dependencies = [ + "cfg-if", + "ordered-multimap", + "trim-in-place", +] + [[package]] name = "rust_decimal" -version = "1.34.3" +version = "1.37.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b39449a79f45e8da28c57c341891b69a183044b29518bb8f86dbac9df60bb7df" +checksum = "faa7de2ba56ac291bd90c6b9bece784a52ae1411f9506544b3eae36dd2356d50" dependencies = [ "arrayvec", "borsh", @@ -5141,117 +5218,111 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustc-hash" -version = "1.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" [[package]] name = "rustc_version" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ "semver", ] [[package]] name = "rustix" -version = "0.38.31" +version = "0.38.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.9.0", "errno", "libc", - "linux-raw-sys 0.4.13", - "windows-sys 0.52.0", + "linux-raw-sys 0.4.15", + "windows-sys 0.59.0", ] [[package]] -name = "rustls" -version = "0.21.10" +name = "rustix" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" +checksum = "d97817398dd4bb2e6da002002db259209759911da105da92bec29ccb12cf58bf" dependencies = [ - "log", - "ring 0.17.8", - "rustls-webpki 0.101.7", - "sct", + "bitflags 2.9.0", + "errno", + "libc", + "linux-raw-sys 0.9.4", + "windows-sys 0.59.0", ] [[package]] name = "rustls" -version = "0.22.2" +version = "0.23.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e87c9956bd9807afa1f77e0f7594af32566e830e088a5576d27c5b6f30f49d41" +checksum = "df51b5869f3a441595eac5e8ff14d486ff285f7b8c0df8770e49c3b56351f0f0" dependencies = [ - "log", - "ring 0.17.8", + "once_cell", + "ring", "rustls-pki-types", - "rustls-webpki 0.102.2", + "rustls-webpki", "subtle", "zeroize", ] [[package]] name = "rustls-native-certs" -version = "0.6.3" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" +checksum = "7fcff2dd52b58a8d98a70243663a0d234c4e2b79235637849d15913394a247d3" dependencies = [ "openssl-probe", - "rustls-pemfile", + "rustls-pki-types", "schannel", - "security-framework", + "security-framework 3.2.0", ] [[package]] name = "rustls-pemfile" -version = "1.0.4" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" dependencies = [ - "base64 0.21.7", + "rustls-pki-types", ] [[package]] name = "rustls-pki-types" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "048a63e5b3ac996d78d402940b5fa47973d2d080c6c6fffa1d0f19c4445310b7" - -[[package]] -name = "rustls-webpki" -version = "0.101.7" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +checksum = "917ce264624a4b4db1c364dcc35bfca9ded014d0a958cd47ad3e960e988ea51c" dependencies = [ - "ring 0.17.8", - "untrusted 0.9.0", + "web-time", ] [[package]] name = "rustls-webpki" -version = "0.102.2" +version = "0.103.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "faaa0a62740bedb9b2ef5afa303da42764c012f743917351dc9a237ea1663610" +checksum = "fef8b8769aaccf73098557a87cd1816b4f9c7c16811c9c77142aa695c16f2c03" dependencies = [ - "ring 0.17.8", + "ring", "rustls-pki-types", - "untrusted 0.9.0", + "untrusted", ] [[package]] name = "rustversion" -version = "1.0.14" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" +checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" [[package]] name = "rusty-fork" @@ -5267,24 +5338,17 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" - -[[package]] -name = "safemem" -version = "0.3.3" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" [[package]] -name = "same-file" -version = "0.1.3" +name = "salsa20" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d931a44fdaa43b8637009e7632a02adc4f2b2e0733c08caa4cf00e8da4a117a7" +checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" dependencies = [ - "kernel32-sys", - "winapi 0.2.8", + "cipher", ] [[package]] @@ -5298,18 +5362,18 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.23" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" +checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "schemars" -version = "0.8.16" +version = "0.8.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45a28f4c49489add4ce10783f7911893516f15afe45d015608d41faca6bc4d29" +checksum = "3fbf2ae1b8bc8e02df939598064d22402220cd5bbcca1c76f7d6a310974d5615" dependencies = [ "dyn-clone", "indexmap 1.9.3", @@ -5317,26 +5381,21 @@ dependencies = [ "serde", "serde_json", "url", + "uuid", ] [[package]] name = "schemars_derive" -version = "0.8.16" +version = "0.8.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c767fd6fa65d9ccf9cf026122c1b555f2ef9a4f0cea69da4d7dbc3e258d30967" +checksum = "32e265784ad618884abaea0600a9adf15393368d840e0222d101a072f3f7534d" dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 1.0.109", + "syn 2.0.100", ] -[[package]] -name = "scoped-tls" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" - [[package]] name = "scopeguard" version = "1.2.0" @@ -5344,13 +5403,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] -name = "sct" -version = "0.7.1" +name = "scrypt" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" +checksum = "0516a385866c09368f0b5bcd1caff3366aace790fcd46e2bb032697bb172fd1f" dependencies = [ - "ring 0.17.8", - "untrusted 0.9.0", + "pbkdf2", + "salsa20", + "sha2", ] [[package]] @@ -5359,14 +5419,41 @@ version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + [[package]] name = "security-framework" -version = "2.9.2" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags 1.3.2", - "core-foundation", + "bitflags 2.9.0", + "core-foundation 0.9.4", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271720403f46ca04f7ba6f55d438f8bd878d6b8ca0a1046e8228c4145bcbb316" +dependencies = [ + "bitflags 2.9.0", + "core-foundation 0.10.0", "core-foundation-sys", "libc", "security-framework-sys", @@ -5374,9 +5461,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.9.1" +version = "2.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32" dependencies = [ "core-foundation-sys", "libc", @@ -5404,71 +5491,83 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.22" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" +checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" dependencies = [ "serde", ] [[package]] name = "serde" -version = "1.0.196" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" dependencies = [ "serde_derive", ] +[[package]] +name = "serde-untagged" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "299d9c19d7d466db4ab10addd5703e4c615dec2a5a16dbbafe191045e87ee66e" +dependencies = [ + "erased-serde", + "serde", + "typeid", +] + [[package]] name = "serde_derive" -version = "1.0.196" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.100", ] [[package]] name = "serde_derive_internals" -version = "0.26.0" +version = "0.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85bf8229e7920a9f636479437026331ce11aa132b4dde37d121944a44d6e5f3c" +checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.100", ] [[package]] name = "serde_json" -version = "1.0.113" +version = "1.0.140" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" dependencies = [ - "itoa 1.0.10", + "itoa 1.0.15", + "memchr", "ryu", "serde", ] [[package]] name = "serde_repr" -version = "0.1.18" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb" +checksum = "175ee3e80ae9982737ca543e96133087cbd9a485eecc3bc4de9c1a37b47ea59c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.100", ] [[package]] name = "serde_spanned" -version = "0.6.5" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" dependencies = [ "serde", ] @@ -5480,22 +5579,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" dependencies = [ "form_urlencoded", - "itoa 1.0.10", + "itoa 1.0.15", "ryu", "serde", ] [[package]] name = "serde_with" -version = "3.6.1" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15d167997bd841ec232f5b2b8e0e26606df2e7caa4c31b95ea9ca52b200bd270" +checksum = "d6b6f7f2fcb69f747921f79f3926bd1e203fce4fef62c268dd3abfb6d86029aa" dependencies = [ - "base64 0.21.7", + "base64 0.22.1", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.2.3", + "indexmap 2.9.0", "serde", "serde_derive", "serde_json", @@ -5505,14 +5604,14 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.6.1" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "865f9743393e638991566a8b7a479043c2c8da94a33e0a31f18214c9cae0a64d" +checksum = "8d00caa5193a3c8362ac2b73be6b9e768aa5a4b2f721d8f4b339600c3cb51f8e" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.100", ] [[package]] @@ -5555,20 +5654,7 @@ checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.7", -] - -[[package]] -name = "sha2" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if", - "cpufeatures", - "digest 0.9.0", - "opaque-debug", + "digest", ] [[package]] @@ -5579,33 +5665,30 @@ checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.7", + "digest", ] [[package]] -name = "sharded-slab" -version = "0.1.7" +name = "shared_child" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +checksum = "09fa9338aed9a1df411814a5b2252f7cd206c55ae9bf2fa763f8de84603aa60c" dependencies = [ - "lazy_static", + "libc", + "windows-sys 0.59.0", ] [[package]] -name = "shared_child" -version = "1.0.0" +name = "shlex" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0d94659ad3c2137fef23ae75b03d5241d633f8acded53d672decfa0e6e0caef" -dependencies = [ - "libc", - "winapi 0.3.9", -] +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "signal-hook-registry" -version = "1.4.1" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" dependencies = [ "libc", ] @@ -5616,7 +5699,7 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ - "digest 0.10.7", + "digest", "rand_core 0.6.4", ] @@ -5628,15 +5711,15 @@ checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" [[package]] name = "simdutf8" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" [[package]] name = "similar" -version = "2.4.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32fea41aca09ee824cc9724996433064c89f7777e60762749a4170a14abbfa21" +checksum = "bbbb5d9659141646ae647b42fe094daf6c6192d1620870b449d9557f748b2daa" [[package]] name = "single-instance-example" @@ -5646,6 +5729,7 @@ dependencies = [ "serde_json", "tauri", "tauri-build", + "tauri-plugin-cli", "tauri-plugin-single-instance", ] @@ -5655,6 +5739,12 @@ version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" +[[package]] +name = "siphasher" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" + [[package]] name = "slab" version = "0.4.9" @@ -5666,49 +5756,43 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.13.1" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" +checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9" +dependencies = [ + "serde", +] [[package]] name = "socket2" -version = "0.5.5" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +checksum = "4f5fd57c80058a56cf5c777ab8a126398ece8e442983605d280a44ce79d0edef" dependencies = [ "libc", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "softbuffer" -version = "0.4.1" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071916a85d1db274b4ed57af3a14afb66bd836ae7f82ebb6f1fd3455107830d9" +checksum = "18051cdd562e792cad055119e0cdb2cfc137e44e3987532e0f9659a77931bb08" dependencies = [ - "as-raw-xcb-connection", "bytemuck", - "cfg_aliases 0.2.0", - "cocoa 0.25.0", - "core-graphics 0.23.1", - "drm", - "fastrand", + "cfg_aliases", + "core-graphics", "foreign-types 0.5.0", "js-sys", "log", - "memmap2", - "objc", - "raw-window-handle 0.6.0", + "objc2 0.5.2", + "objc2-foundation 0.2.2", + "objc2-quartz-core 0.2.2", + "raw-window-handle", "redox_syscall", - "rustix", - "tiny-xlib", "wasm-bindgen", - "wayland-backend", - "wayland-client", - "wayland-sys", "web-sys", - "windows-sys 0.52.0", - "x11rb", + "windows-sys 0.59.0", ] [[package]] @@ -5719,7 +5803,7 @@ checksum = "471f924a40f31251afc77450e781cb26d55c0b650842efafc9c6cbd2f7cc4f9f" dependencies = [ "futures-channel", "gio", - "glib 0.18.5", + "glib", "libc", "soup3-sys", ] @@ -5730,18 +5814,35 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebe8950a680a12f24f15ebe1bf70db7af98ad242d9db43596ad3108aab86c27" dependencies = [ - "gio-sys 0.18.1", - "glib-sys 0.18.1", - "gobject-sys 0.18.0", + "gio-sys", + "glib-sys", + "gobject-sys", "libc", "system-deps", ] [[package]] -name = "spin" -version = "0.5.2" +name = "specta" +version = "2.0.0-rc.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +checksum = "ab7f01e9310a820edd31c80fde3cae445295adde21a3f9416517d7d65015b971" +dependencies = [ + "paste", + "specta-macros", + "thiserror 1.0.69", +] + +[[package]] +name = "specta-macros" +version = "2.0.0-rc.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0074b9e30ed84c6924eb63ad8d2fe71cdc82628525d84b1fcb1f2fd40676517" +dependencies = [ + "Inflector", + "proc-macro2", + "quote", + "syn 2.0.100", +] [[package]] name = "spin" @@ -5762,22 +5863,11 @@ dependencies = [ "der", ] -[[package]] -name = "sqlformat" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce81b7bd7c4493975347ef60d8c7e8b742d4694f4c49f93e0a12ea263938176c" -dependencies = [ - "itertools", - "nom", - "unicode_categories", -] - [[package]] name = "sqlx" -version = "0.7.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dba03c279da73694ef99763320dea58b51095dfe87d001b1d4b5fe78ba8763cf" +checksum = "f3c3a85280daca669cfd3bcb68a337882a8bc57ec882f72c5d13a430613a738e" dependencies = [ "sqlx-core", "sqlx-macros", @@ -5788,83 +5878,75 @@ dependencies = [ [[package]] name = "sqlx-core" -version = "0.7.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d84b0a3c3739e220d94b3239fd69fb1f74bc36e16643423bd99de3b43c21bfbd" +checksum = "f743f2a3cea30a58cd479013f75550e879009e3a02f616f18ca699335aa248c3" dependencies = [ - "ahash 0.8.8", - "atoi", - "byteorder", + "base64 0.22.1", "bytes", "crc", "crossbeam-queue", - "dotenvy", "either", - "event-listener 2.5.3", - "futures-channel", + "event-listener", "futures-core", "futures-intrusive", "futures-io", "futures-util", + "hashbrown 0.15.2", "hashlink", - "hex", - "indexmap 2.2.3", + "indexmap 2.9.0", "log", "memchr", "once_cell", - "paste", "percent-encoding", - "rustls 0.21.10", - "rustls-pemfile", + "rustls", "serde", "serde_json", - "sha2 0.10.8", + "sha2", "smallvec", - "sqlformat", - "thiserror", + "thiserror 2.0.12", "time", "tokio", "tokio-stream", "tracing", "url", - "webpki-roots 0.25.4", + "webpki-roots", ] [[package]] name = "sqlx-macros" -version = "0.7.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89961c00dc4d7dffb7aee214964b065072bff69e36ddb9e2c107541f75e4f2a5" +checksum = "7f4200e0fde19834956d4252347c12a083bdcb237d7a1a1446bffd8768417dce" dependencies = [ "proc-macro2", "quote", "sqlx-core", "sqlx-macros-core", - "syn 1.0.109", + "syn 2.0.100", ] [[package]] name = "sqlx-macros-core" -version = "0.7.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0bd4519486723648186a08785143599760f7cc81c52334a55d6a83ea1e20841" +checksum = "882ceaa29cade31beca7129b6beeb05737f44f82dbe2a9806ecea5a7093d00b7" dependencies = [ - "atomic-write-file", "dotenvy", "either", - "heck", + "heck 0.5.0", "hex", "once_cell", "proc-macro2", "quote", "serde", "serde_json", - "sha2 0.10.8", + "sha2", "sqlx-core", "sqlx-mysql", "sqlx-postgres", "sqlx-sqlite", - "syn 1.0.109", + "syn 2.0.100", "tempfile", "tokio", "url", @@ -5872,17 +5954,17 @@ dependencies = [ [[package]] name = "sqlx-mysql" -version = "0.7.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e37195395df71fd068f6e2082247891bc11e3289624bbc776a0cdfa1ca7f1ea4" +checksum = "0afdd3aa7a629683c2d750c2df343025545087081ab5942593a5288855b1b7a7" dependencies = [ "atoi", - "base64 0.21.7", - "bitflags 2.4.2", + "base64 0.22.1", + "bitflags 2.9.0", "byteorder", "bytes", "crc", - "digest 0.10.7", + "digest", "dotenvy", "either", "futures-channel", @@ -5893,7 +5975,7 @@ dependencies = [ "hex", "hkdf", "hmac", - "itoa 1.0.10", + "itoa 1.0.15", "log", "md-5", "memchr", @@ -5903,11 +5985,11 @@ dependencies = [ "rsa", "serde", "sha1", - "sha2 0.10.8", + "sha2", "smallvec", "sqlx-core", "stringprep", - "thiserror", + "thiserror 2.0.12", "time", "tracing", "whoami", @@ -5915,26 +5997,25 @@ dependencies = [ [[package]] name = "sqlx-postgres" -version = "0.7.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6ac0ac3b7ccd10cc96c7ab29791a7dd236bd94021f31eec7ba3d46a74aa1c24" +checksum = "a0bedbe1bbb5e2615ef347a5e9d8cd7680fb63e77d9dafc0f29be15e53f1ebe6" dependencies = [ "atoi", - "base64 0.21.7", - "bitflags 2.4.2", + "base64 0.22.1", + "bitflags 2.9.0", "byteorder", "crc", "dotenvy", "etcetera", "futures-channel", "futures-core", - "futures-io", "futures-util", "hex", "hkdf", "hmac", "home", - "itoa 1.0.10", + "itoa 1.0.15", "log", "md-5", "memchr", @@ -5942,12 +6023,11 @@ dependencies = [ "rand 0.8.5", "serde", "serde_json", - "sha1", - "sha2 0.10.8", + "sha2", "smallvec", "sqlx-core", "stringprep", - "thiserror", + "thiserror 2.0.12", "time", "tracing", "whoami", @@ -5955,9 +6035,9 @@ dependencies = [ [[package]] name = "sqlx-sqlite" -version = "0.7.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "210976b7d948c7ba9fced8ca835b11cbb2d677c59c79de41ac0d397e14547490" +checksum = "c26083e9a520e8eb87a06b12347679b142dc2ea29e6e409f805644a7a979a5bc" dependencies = [ "atoi", "flume", @@ -5970,11 +6050,12 @@ dependencies = [ "log", "percent-encoding", "serde", + "serde_urlencoded", "sqlx-core", + "thiserror 2.0.12", "time", "tracing", "url", - "urlencoding", ] [[package]] @@ -5983,15 +6064,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" -[[package]] -name = "state" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b8c4a4445d81357df8b1a650d0d0d6fbbbfe99d064aa5e02f3e4022061476d8" -dependencies = [ - "loom", -] - [[package]] name = "static_assertions" version = "1.1.0" @@ -6000,39 +6072,38 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "string_cache" -version = "0.8.7" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" +checksum = "bf776ba3fa74f83bf4b63c3dcbbf82173db2632ed8452cb2d891d33f459de70f" dependencies = [ "new_debug_unreachable", - "once_cell", "parking_lot", - "phf_shared 0.10.0", + "phf_shared 0.11.3", "precomputed-hash", "serde", ] [[package]] name = "string_cache_codegen" -version = "0.5.2" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988" +checksum = "c711928715f1fe0fe509c53b43e993a9a557babc2d0a3567d0a3006f1ac931a0" dependencies = [ - "phf_generator 0.10.0", - "phf_shared 0.10.0", + "phf_generator 0.11.3", + "phf_shared 0.11.3", "proc-macro2", "quote", ] [[package]] name = "stringprep" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb41d74e231a107a1b4ee36bd1214b11285b77768d2e3824aedafa988fd36ee6" +checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1" dependencies = [ - "finl_unicode", "unicode-bidi", "unicode-normalization", + "unicode-properties", ] [[package]] @@ -6048,19 +6119,19 @@ dependencies = [ [[package]] name = "stronghold-runtime" -version = "1.0.2" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d93abb10fbd11335d31c33a70b2523c0caab348215caa2ce6da04a268c30afcb" +checksum = "18db7cc51450cefdab5f4990e128dd02c98da6d2992b93ffef8992ac0d2f3ddf" dependencies = [ - "dirs", - "iota-crypto 0.15.3", + "dirs 4.0.0", + "iota-crypto", "libc", - "libsodium-sys", + "libsodium-sys-stable", "log", "nix 0.24.3", "rand 0.8.5", "serde", - "thiserror", + "thiserror 1.0.69", "windows 0.36.1", "zeroize", ] @@ -6077,45 +6148,39 @@ dependencies = [ [[package]] name = "stronghold_engine" -version = "1.0.2" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d68a609d0a4f05dbde8b704619faa7f861069bbc649e3abecb4d389f10236f" +checksum = "2fd7371c42e557dd71a7f860bb2ec6b6fdb32f97a97987ccc2435fdd1f3a8615" dependencies = [ "anyhow", "dirs-next", "hex", - "iota-crypto 0.15.3", + "iota-crypto", "once_cell", "paste", "serde", "stronghold-runtime", - "thiserror", + "thiserror 1.0.69", "zeroize", ] [[package]] name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "strsim" -version = "0.11.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "subtle" -version = "2.5.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "swift-rs" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bbdb58577b6301f8d17ae2561f32002a5bae056d444e0f69e611e504a276204" +checksum = "4057c98e2e852d51fdcfca832aac7b571f6b351ad159f9eda5db1655f8d0c4d7" dependencies = [ "base64 0.21.7", "serde", @@ -6135,9 +6200,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.49" +version = "2.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915aea9e586f80826ee59f8453c1101f9d1c4b3964cd2460185ee8e299ada496" +checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" dependencies = [ "proc-macro2", "quote", @@ -6145,48 +6210,50 @@ dependencies = [ ] [[package]] -name = "syn_derive" -version = "0.1.8" +name = "sync_wrapper" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1329189c02ff984e9736652b1631330da25eaa6bc639089ed4915d25446cbe7b" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" dependencies = [ - "proc-macro-error", - "proc-macro2", - "quote", - "syn 2.0.49", + "futures-core", ] [[package]] -name = "sync_wrapper" -version = "0.1.2" +name = "synstructure" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] [[package]] name = "sys-locale" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e801cf239ecd6ccd71f03d270d67dd53d13e90aab208bf4b8fe4ad957ea949b0" +checksum = "8eab9a99a024a169fe8a903cf9d4a3b3601109bcc13bd9e3c6fff259138626c4" dependencies = [ "libc", ] [[package]] name = "system-configuration" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" dependencies = [ - "bitflags 1.3.2", - "core-foundation", + "bitflags 2.9.0", + "core-foundation 0.9.4", "system-configuration-sys", ] [[package]] name = "system-configuration-sys" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" dependencies = [ "core-foundation-sys", "libc", @@ -6194,35 +6261,33 @@ dependencies = [ [[package]] name = "system-deps" -version = "6.2.0" +version = "6.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2d580ff6a20c55dfb86be5f9c238f67835d0e81cbdea8bf5680e0897320331" +checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349" dependencies = [ "cfg-expr", - "heck", + "heck 0.5.0", "pkg-config", - "toml 0.8.2", + "toml", "version-compare", ] [[package]] name = "tao" -version = "0.26.0" +version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29d9325da2dd7ebd48a8a433c64240079b15dbe1249da04c72557611bcd08d1c" +checksum = "1e59c1f38e657351a2e822eadf40d6a2ad4627b9c25557bc1180ec1b3295ef82" dependencies = [ - "bitflags 1.3.2", - "cocoa 0.25.0", - "core-foundation", - "core-graphics 0.23.1", + "bitflags 2.9.0", + "core-foundation 0.10.0", + "core-graphics", "crossbeam-channel", "dispatch", "dlopen2", + "dpi", "gdkwayland-sys", "gdkx11-sys", "gtk", - "image", - "instant", "jni", "lazy_static", "libc", @@ -6230,30 +6295,31 @@ dependencies = [ "ndk", "ndk-context", "ndk-sys", - "objc", + "objc2 0.6.0", + "objc2-app-kit", + "objc2-foundation 0.3.0", "once_cell", "parking_lot", - "png", - "raw-window-handle 0.6.0", + "raw-window-handle", "scopeguard", "tao-macros", "unicode-segmentation", "url", - "windows 0.52.0", - "windows-implement", + "windows 0.61.1", + "windows-core", "windows-version", "x11-dl", ] [[package]] name = "tao-macros" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec114582505d158b669b136e6851f85840c109819d77c42bb7c0709f727d18c2" +checksum = "f4e16beb8b2ac17db28eab8bca40e62dbfbb34c0fcdc6d9826b11b7b5d047dfd" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.100", ] [[package]] @@ -6264,9 +6330,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tar" -version = "0.4.40" +version = "0.4.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b16afcea1f22891c49a00c751c7b63b2233284064f11a200fc624137c51e2ddb" +checksum = "1d863878d212c87a19c1a610eb53bb01fe12951c0501cf5a0d65f724914a667a" dependencies = [ "filetime", "libc", @@ -6275,74 +6341,76 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.12.13" +version = "0.12.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69758bda2e78f098e4ccb393021a0963bb3442eac05f135c30f61b7370bbafae" +checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "tauri" -version = "2.0.0-beta.4" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb6b10809e932ed85813fff9ac748cbcc0cf4c78209433b1b6e025660619f2e4" +checksum = "be03adf68fba02f87c4653da7bd73f40b0ecf9c6b7c2c39830f6981d0651912f" dependencies = [ "anyhow", "bytes", - "cocoa 0.25.0", - "dirs-next", + "dirs 6.0.0", + "dunce", "embed_plist", "futures-util", - "getrandom 0.2.12", + "getrandom 0.2.15", "glob", "gtk", - "heck", - "http 0.2.11", + "heck 0.5.0", + "http", "http-range", - "ico", - "infer", + "image", "jni", "libc", "log", "mime", "muda", - "objc", + "objc2 0.6.0", + "objc2-app-kit", + "objc2-foundation 0.3.0", + "objc2-ui-kit", "percent-encoding", - "png", - "raw-window-handle 0.6.0", + "plist", + "raw-window-handle", "reqwest", "serde", "serde_json", "serde_repr", "serialize-to-javascript", - "state", - "static_assertions", + "specta", "swift-rs", "tauri-build", "tauri-macros", "tauri-runtime", "tauri-runtime-wry", "tauri-utils", - "thiserror", + "thiserror 2.0.12", "tokio", "tray-icon", "url", + "urlpattern", "uuid", "webkit2gtk", "webview2-com", "window-vibrancy", - "windows 0.52.0", + "windows 0.61.1", ] [[package]] name = "tauri-build" -version = "2.0.0-beta.3" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4ea663cde4862231178215d364b3650dade8cb159fc84a1bea5c365689dacd0" +checksum = "d7a0350f0df1db385ca5c02888a83e0e66655c245b7443db8b78a70da7d7f8fc" dependencies = [ "anyhow", "cargo_toml", - "dirs-next", + "dirs 6.0.0", "glob", - "heck", + "heck 0.5.0", "json-patch", "quote", "schemars", @@ -6352,17 +6420,17 @@ dependencies = [ "tauri-codegen", "tauri-utils", "tauri-winres", - "toml 0.8.2", - "walkdir 2.4.0", + "toml", + "walkdir", ] [[package]] name = "tauri-codegen" -version = "2.0.0-beta.3" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94a770b18aa021b0c8568c8f0d347044a72d349b6a13dd1db28c558832e8e681" +checksum = "f93f035551bf7b11b3f51ad9bc231ebbe5e085565527991c16cf326aa38cdf47" dependencies = [ - "base64 0.21.7", + "base64 0.22.1", "brotli", "ico", "json-patch", @@ -6373,97 +6441,74 @@ dependencies = [ "semver", "serde", "serde_json", - "sha2 0.10.8", - "syn 2.0.49", + "sha2", + "syn 2.0.100", "tauri-utils", - "thiserror", + "thiserror 2.0.12", "time", "url", "uuid", - "walkdir 2.4.0", + "walkdir", ] [[package]] name = "tauri-macros" -version = "2.0.0-beta.3" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b100bf9f05a013719fa6c9bf096da42511888b3671d9c22bffa12a030d76a9" +checksum = "8db4df25e2d9d45de0c4c910da61cd5500190da14ae4830749fee3466dddd112" dependencies = [ - "heck", + "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.100", "tauri-codegen", "tauri-utils", ] [[package]] name = "tauri-plugin" -version = "2.0.0-beta.3" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "140c010cfb7120c9276e6e0b0c271dabb7988be2998011f918b669e766224e55" +checksum = "37a5ebe6a610d1b78a94650896e6f7c9796323f408800cef436e0fa0539de601" dependencies = [ "anyhow", "glob", - "plist", - "schemars", - "serde", - "serde_json", - "tauri-utils", - "toml 0.8.2", - "walkdir 1.0.7", -] - -[[package]] -name = "tauri-plugin-authenticator" -version = "2.0.0-beta.1" -dependencies = [ - "authenticator", - "base64 0.21.7", - "byteorder", - "bytes", - "chrono", - "log", - "once_cell", - "openssl", - "rand 0.8.5", - "rusty-fork", + "plist", + "schemars", "serde", "serde_json", - "sha2 0.10.8", - "tauri", - "tauri-plugin", - "thiserror", + "tauri-utils", + "toml", + "walkdir", ] [[package]] name = "tauri-plugin-autostart" -version = "2.0.0-beta.1" +version = "2.3.0" dependencies = [ "auto-launch", - "log", "serde", "serde_json", "tauri", "tauri-plugin", - "thiserror", + "thiserror 2.0.12", ] [[package]] name = "tauri-plugin-barcode-scanner" -version = "2.0.0-beta.1" +version = "2.2.0" dependencies = [ "log", "serde", "serde_json", "tauri", "tauri-plugin", - "thiserror", + "thiserror 2.0.12", ] [[package]] name = "tauri-plugin-biometric" -version = "2.0.0-beta.1" +version = "2.2.1" dependencies = [ "log", "serde", @@ -6471,12 +6516,12 @@ dependencies = [ "serde_repr", "tauri", "tauri-plugin", - "thiserror", + "thiserror 2.0.12", ] [[package]] name = "tauri-plugin-cli" -version = "2.0.0-beta.1" +version = "2.2.0" dependencies = [ "clap", "log", @@ -6484,12 +6529,12 @@ dependencies = [ "serde_json", "tauri", "tauri-plugin", - "thiserror", + "thiserror 2.0.12", ] [[package]] name = "tauri-plugin-clipboard-manager" -version = "2.0.0-beta.1" +version = "2.2.2" dependencies = [ "arboard", "log", @@ -6497,60 +6542,81 @@ dependencies = [ "serde_json", "tauri", "tauri-plugin", - "thiserror", + "thiserror 2.0.12", ] [[package]] name = "tauri-plugin-deep-link" -version = "2.0.0-beta.1" +version = "2.2.1" dependencies = [ - "log", + "dunce", + "rust-ini", "serde", "serde_json", "tauri", "tauri-plugin", - "thiserror", + "tauri-utils", + "thiserror 2.0.12", + "tracing", "url", + "windows-registry 0.5.1", + "windows-result", ] [[package]] name = "tauri-plugin-dialog" -version = "2.0.0-beta.1" +version = "2.2.1" dependencies = [ - "glib 0.16.9", "log", - "raw-window-handle 0.6.0", + "raw-window-handle", "rfd", "serde", "serde_json", "tauri", "tauri-plugin", "tauri-plugin-fs", - "thiserror", + "thiserror 2.0.12", + "url", ] [[package]] name = "tauri-plugin-fs" -version = "2.0.0-beta.1" +version = "2.2.1" dependencies = [ "anyhow", + "dunce", "glob", "notify", "notify-debouncer-full", + "percent-encoding", "schemars", "serde", "serde_json", "serde_repr", "tauri", "tauri-plugin", - "thiserror", + "tauri-utils", + "thiserror 2.0.12", + "toml", "url", - "uuid", +] + +[[package]] +name = "tauri-plugin-geolocation" +version = "2.2.4" +dependencies = [ + "log", + "serde", + "serde_json", + "specta", + "tauri", + "tauri-plugin", + "thiserror 2.0.12", ] [[package]] name = "tauri-plugin-global-shortcut" -version = "2.0.0-beta.1" +version = "2.2.0" dependencies = [ "global-hotkey", "log", @@ -6558,16 +6624,31 @@ dependencies = [ "serde_json", "tauri", "tauri-plugin", - "thiserror", + "thiserror 2.0.12", +] + +[[package]] +name = "tauri-plugin-haptics" +version = "2.2.4" +dependencies = [ + "log", + "serde", + "serde_json", + "specta", + "tauri", + "tauri-plugin", + "thiserror 2.0.12", ] [[package]] name = "tauri-plugin-http" -version = "2.0.0-beta.1" +version = "2.4.3" dependencies = [ + "bytes", + "cookie_store", "data-url", - "glob", - "http 0.2.11", + "http", + "regex", "reqwest", "schemars", "serde", @@ -6575,45 +6656,50 @@ dependencies = [ "tauri", "tauri-plugin", "tauri-plugin-fs", - "thiserror", + "thiserror 2.0.12", + "tokio", + "tracing", "url", + "urlpattern", ] [[package]] name = "tauri-plugin-localhost" -version = "2.0.0-beta.1" +version = "2.2.0" dependencies = [ - "http 1.0.0", + "http", "log", "serde", "serde_json", "tauri", - "thiserror", - "tiny_http 0.12.0", + "thiserror 2.0.12", + "tiny_http", ] [[package]] name = "tauri-plugin-log" -version = "2.0.0-beta.1" +version = "2.4.0" dependencies = [ "android_logger", "byte-unit", - "cocoa 0.24.1", "fern", "log", - "objc", + "objc2 0.6.0", + "objc2-foundation 0.3.0", "serde", "serde_json", "serde_repr", "swift-rs", "tauri", "tauri-plugin", + "thiserror 2.0.12", "time", + "tracing", ] [[package]] name = "tauri-plugin-nfc" -version = "2.0.0-beta.1" +version = "2.2.0" dependencies = [ "log", "serde", @@ -6621,42 +6707,56 @@ dependencies = [ "serde_repr", "tauri", "tauri-plugin", - "thiserror", + "thiserror 2.0.12", ] [[package]] name = "tauri-plugin-notification" -version = "2.0.0-beta.1" +version = "2.2.2" dependencies = [ - "chrono", "color-backtrace", "ctor", - "env_logger", - "image", - "lazy_static", "log", - "mac-notification-sys", "maplit", + "notify-rust", "rand 0.8.5", "serde", "serde_json", "serde_repr", "tauri", "tauri-plugin", - "tauri-winrt-notification", - "thiserror", + "thiserror 2.0.12", "time", "url", "win7-notifications", "windows-version", +] + +[[package]] +name = "tauri-plugin-opener" +version = "2.2.6" +dependencies = [ + "dunce", + "glob", + "objc2-app-kit", + "objc2-foundation 0.3.0", + "open", + "schemars", + "serde", + "serde_json", + "tauri", + "tauri-plugin", + "thiserror 2.0.12", + "url", + "windows 0.61.1", "zbus", ] [[package]] name = "tauri-plugin-os" -version = "2.0.0-beta.1" +version = "2.2.1" dependencies = [ - "gethostname", + "gethostname 1.0.1", "log", "os_info", "serde", @@ -6665,12 +6765,12 @@ dependencies = [ "sys-locale", "tauri", "tauri-plugin", - "thiserror", + "thiserror 2.0.12", ] [[package]] name = "tauri-plugin-persisted-scope" -version = "2.0.0-beta.1" +version = "2.2.1" dependencies = [ "aho-corasick", "bincode", @@ -6679,12 +6779,12 @@ dependencies = [ "serde_json", "tauri", "tauri-plugin-fs", - "thiserror", + "thiserror 2.0.12", ] [[package]] name = "tauri-plugin-positioner" -version = "2.0.0-beta.1" +version = "2.2.0" dependencies = [ "log", "serde", @@ -6692,12 +6792,12 @@ dependencies = [ "serde_repr", "tauri", "tauri-plugin", - "thiserror", + "thiserror 2.0.12", ] [[package]] name = "tauri-plugin-process" -version = "2.0.0-beta.1" +version = "2.2.1" dependencies = [ "tauri", "tauri-plugin", @@ -6705,7 +6805,7 @@ dependencies = [ [[package]] name = "tauri-plugin-shell" -version = "2.0.0-beta.1" +version = "2.2.1" dependencies = [ "encoding_rs", "log", @@ -6718,82 +6818,90 @@ dependencies = [ "shared_child", "tauri", "tauri-plugin", - "thiserror", + "thiserror 2.0.12", + "tokio", ] [[package]] name = "tauri-plugin-single-instance" -version = "2.0.0-beta.1" +version = "2.2.3" dependencies = [ - "log", + "semver", "serde", "serde_json", "tauri", - "thiserror", - "windows-sys 0.52.0", + "tauri-plugin-deep-link", + "thiserror 2.0.12", + "tracing", + "windows-sys 0.59.0", "zbus", ] [[package]] name = "tauri-plugin-sql" -version = "2.0.0-beta.1" +version = "2.2.0" dependencies = [ "futures-core", + "indexmap 2.9.0", "log", "serde", "serde_json", "sqlx", "tauri", "tauri-plugin", - "thiserror", + "thiserror 2.0.12", "time", "tokio", ] [[package]] name = "tauri-plugin-store" -version = "2.0.0-beta.1" +version = "2.2.0" dependencies = [ - "log", + "dunce", "serde", "serde_json", "tauri", "tauri-plugin", - "thiserror", + "thiserror 2.0.12", + "tokio", + "tracing", ] [[package]] name = "tauri-plugin-stronghold" -version = "2.0.0-beta.1" +version = "2.2.0" dependencies = [ "hex", - "iota-crypto 0.23.1", + "iota-crypto", "iota_stronghold", "log", "rand 0.8.5", "rand_chacha 0.3.1", "rand_core 0.6.4", - "rust-argon2", + "rust-argon2 2.1.0", "rusty-fork", "serde", "serde_json", "tauri", "tauri-plugin", - "thiserror", + "thiserror 2.0.12", "zeroize", ] [[package]] name = "tauri-plugin-updater" -version = "2.0.0-beta.1" +version = "2.7.1" dependencies = [ - "base64 0.21.7", - "dirs-next", + "base64 0.22.1", + "dirs 6.0.0", "flate2", "futures-util", - "http 0.2.11", + "http", + "infer", + "log", "minisign-verify", - "mockito", + "osakit", "percent-encoding", "reqwest", "semver", @@ -6803,167 +6911,185 @@ dependencies = [ "tauri", "tauri-plugin", "tempfile", - "thiserror", + "thiserror 2.0.12", "time", "tokio", "url", + "windows-sys 0.59.0", "zip", ] [[package]] name = "tauri-plugin-upload" -version = "2.0.0-beta.1" +version = "2.2.1" dependencies = [ "futures-util", "log", + "mockito", "read-progress-stream", "reqwest", "serde", "serde_json", "tauri", "tauri-plugin", - "thiserror", + "thiserror 2.0.12", "tokio", "tokio-util", ] [[package]] name = "tauri-plugin-websocket" -version = "2.0.0-beta.1" +version = "2.3.0" dependencies = [ "futures-util", - "http 1.0.0", + "http", "log", "rand 0.8.5", "serde", "serde_json", "tauri", "tauri-plugin", - "thiserror", + "thiserror 2.0.12", "tokio", "tokio-tungstenite", ] [[package]] name = "tauri-plugin-window-state" -version = "2.0.0-beta.1" +version = "2.2.2" dependencies = [ - "bincode", - "bitflags 2.4.2", + "bitflags 2.9.0", "log", "serde", "serde_json", "tauri", "tauri-plugin", - "thiserror", + "thiserror 2.0.12", ] [[package]] name = "tauri-runtime" -version = "2.0.0-beta.3" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc687ef6571127f0ad9a9bef141ca3f8d9597b7f99949047d5c69ed731cf36c4" +checksum = "00f004905d549854069e6774533d742b03cacfd6f03deb08940a8677586cbe39" dependencies = [ + "cookie", + "dpi", "gtk", - "http 0.2.11", + "http", "jni", - "raw-window-handle 0.6.0", + "objc2 0.6.0", + "objc2-ui-kit", + "raw-window-handle", "serde", "serde_json", "tauri-utils", - "thiserror", + "thiserror 2.0.12", "url", - "windows 0.52.0", + "windows 0.61.1", ] [[package]] name = "tauri-runtime-wry" -version = "2.0.0-beta.3" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a07b1d76d4159aec5c2cff742e30b0f5b3675a2520b979acbbc66c5f92c99491" +checksum = "f85d056f4d4b014fe874814034f3416d57114b617a493a4fe552580851a3f3a2" dependencies = [ - "cocoa 0.25.0", "gtk", - "http 0.2.11", + "http", "jni", + "log", + "objc2 0.6.0", + "objc2-app-kit", + "objc2-foundation 0.3.0", + "once_cell", "percent-encoding", - "raw-window-handle 0.6.0", + "raw-window-handle", "softbuffer", "tao", "tauri-runtime", "tauri-utils", + "url", "webkit2gtk", "webview2-com", - "windows 0.52.0", + "windows 0.61.1", "wry", ] [[package]] name = "tauri-utils" -version = "2.0.0-beta.3" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2729b59832a96dd05f4f2ced33e2ab976ca60c58c1d675afe6aabc486eb51143" +checksum = "b2900399c239a471bcff7f15c4399eb1a8c4fe511ba2853e07c996d771a5e0a4" dependencies = [ - "aes-gcm 0.10.3", + "aes-gcm", + "anyhow", "brotli", "cargo_metadata", "ctor", "dunce", - "getrandom 0.2.12", + "getrandom 0.2.15", "glob", - "heck", "html5ever", + "http", "infer", "json-patch", "kuchikiki", "log", "memchr", - "phf 0.11.2", + "phf 0.11.3", "proc-macro2", "quote", + "regex", "schemars", "semver", "serde", + "serde-untagged", "serde_json", "serde_with", "serialize-to-javascript", "swift-rs", - "thiserror", - "toml 0.8.2", + "thiserror 2.0.12", + "toml", "url", - "walkdir 2.4.0", + "urlpattern", + "uuid", + "walkdir", ] [[package]] name = "tauri-winres" -version = "0.1.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5993dc129e544393574288923d1ec447c857f3f644187f4fbf7d9a875fbfc4fb" +checksum = "56eaa45f707bedf34d19312c26d350bc0f3c59a47e58e8adbeecdc850d2c13a0" dependencies = [ "embed-resource", - "toml 0.7.8", + "toml", ] [[package]] name = "tauri-winrt-notification" -version = "0.1.3" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "006851c9ccefa3c38a7646b8cec804bb429def3da10497bfa977179869c3e8e2" +checksum = "0b1e66e07de489fe43a46678dd0b8df65e0c973909df1b60ba33874e297ba9b9" dependencies = [ - "quick-xml 0.30.0", - "windows 0.51.1", + "quick-xml 0.37.4", + "thiserror 2.0.12", + "windows 0.61.1", + "windows-version", ] [[package]] name = "tempfile" -version = "3.10.0" +version = "3.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67" +checksum = "7437ac7763b9b123ccf33c338a5cc1bac6f69b45a136c19bdd8a65e3916435bf" dependencies = [ - "cfg-if", "fastrand", - "rustix", - "windows-sys 0.52.0", + "getrandom 0.3.2", + "once_cell", + "rustix 1.0.5", + "windows-sys 0.59.0", ] [[package]] @@ -6994,32 +7120,42 @@ checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c" [[package]] name = "thiserror" -version = "1.0.57" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" +dependencies = [ + "thiserror-impl 2.0.12", ] [[package]] name = "thiserror-impl" -version = "1.0.57" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.100", ] [[package]] -name = "thread_local" -version = "1.1.7" +name = "thiserror-impl" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ - "cfg-if", - "once_cell", + "proc-macro2", + "quote", + "syn 2.0.100", ] [[package]] @@ -7035,12 +7171,12 @@ dependencies = [ [[package]] name = "time" -version = "0.3.34" +version = "0.3.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" +checksum = "8a7619e19bc266e0f9c5e6686659d394bc57973859340060a69221e57dbc0c40" dependencies = [ "deranged", - "itoa 1.0.10", + "itoa 1.0.15", "libc", "num-conv", "num_threads", @@ -7052,62 +7188,56 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" +checksum = "c9e9a38711f559d9e3ce1cdb06dd7c5b8ea546bc90052da6d06bb76da74bb07c" [[package]] name = "time-macros" -version = "0.2.17" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" +checksum = "3526739392ec93fd8b359c8e98514cb3e8e021beb4e5f597b00a0221f8ed8a49" dependencies = [ "num-conv", "time-core", ] [[package]] -name = "tiny-xlib" -version = "0.2.2" +name = "tiny-keccak" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4098d49269baa034a8d1eae9bd63e9fa532148d772121dace3bcd6a6c98eb6d" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" dependencies = [ - "as-raw-xcb-connection", - "ctor", - "libloading 0.8.1", - "tracing", + "crunchy", ] [[package]] name = "tiny_http" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0d6ef4e10d23c1efb862eecad25c5054429a71958b4eeef85eb5e7170b477ca" +checksum = "389915df6413a2e74fb181895f933386023c71110878cd0825588928e64cdc82" dependencies = [ "ascii", "chunked_transfer", + "httpdate", "log", - "time", - "url", ] [[package]] -name = "tiny_http" -version = "0.12.0" +name = "tinystr" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "389915df6413a2e74fb181895f933386023c71110878cd0825588928e64cdc82" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" dependencies = [ - "ascii", - "chunked_transfer", - "httpdate", - "log", + "displaydoc", + "zerovec", ] [[package]] name = "tinyvec" -version = "1.6.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +checksum = "09b3661f17e86524eccd4371ab0429194e0d7c008abb45f7a7495b1719463c71" dependencies = [ "tinyvec_macros", ] @@ -7120,70 +7250,71 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.36.0" +version = "1.44.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" +checksum = "e6b88822cbe49de4185e3a4cbf8321dd487cf5fe0c5c65695fef6346371e9c48" dependencies = [ "backtrace", "bytes", "libc", "mio", - "num_cpus", + "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2", + "tokio-macros", "tracing", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] -name = "tokio-native-tls" -version = "0.3.1" +name = "tokio-macros" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" dependencies = [ - "native-tls", - "tokio", + "proc-macro2", + "quote", + "syn 2.0.100", ] [[package]] -name = "tokio-rustls" -version = "0.24.1" +name = "tokio-native-tls" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" dependencies = [ - "rustls 0.21.10", + "native-tls", "tokio", ] [[package]] name = "tokio-rustls" -version = "0.25.0" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" +checksum = "8e727b36a1a0e8b74c376ac2211e40c2c8af09fb4013c60d910495810f008e9b" dependencies = [ - "rustls 0.22.2", - "rustls-pki-types", + "rustls", "tokio", ] [[package]] name = "tokio-socks" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51165dfa029d2a65969413a6cc96f354b86b464498702f174a4efa13608fd8c0" +checksum = "0d4770b8024672c1101b3f6733eab95b18007dbe0847a8afe341fcf79e06043f" dependencies = [ "either", "futures-util", - "thiserror", + "thiserror 1.0.69", "tokio", ] [[package]] name = "tokio-stream" -version = "0.1.14" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" +checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" dependencies = [ "futures-core", "pin-project-lite", @@ -7192,238 +7323,192 @@ dependencies = [ [[package]] name = "tokio-tungstenite" -version = "0.21.0" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c83b561d025642014097b66e6c1bb422783339e0909e4429cde4749d1990bc38" +checksum = "7a9daff607c6d2bf6c16fd681ccb7eecc83e4e2cdc1ca067ffaadfca5de7f084" dependencies = [ "futures-util", "log", "native-tls", - "rustls 0.22.2", + "rustls", + "rustls-native-certs", "rustls-pki-types", "tokio", "tokio-native-tls", - "tokio-rustls 0.25.0", + "tokio-rustls", "tungstenite", - "webpki-roots 0.26.1", + "webpki-roots", ] [[package]] name = "tokio-util" -version = "0.7.10" +version = "0.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" +checksum = "6b9590b93e6fcc1739458317cccd391ad3955e2bde8913edf6f95f9e65a8f034" dependencies = [ "bytes", "futures-core", "futures-sink", "pin-project-lite", "tokio", - "tracing", ] [[package]] name = "toml" -version = "0.7.8" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" +checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.19.15", + "toml_edit 0.22.24", ] [[package]] -name = "toml" -version = "0.8.2" +name = "toml_datetime" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "185d8ab0dfbb35cf1399a6344d8484209c088f75f8f68230da55d48d95d43e3d" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" dependencies = [ "serde", - "serde_spanned", - "toml_datetime", - "toml_edit 0.20.2", ] [[package]] -name = "toml_datetime" -version = "0.6.3" +name = "toml_edit" +version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "serde", + "indexmap 2.9.0", + "toml_datetime", + "winnow 0.5.40", ] [[package]] name = "toml_edit" -version = "0.19.15" +version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" dependencies = [ - "indexmap 2.2.3", - "serde", - "serde_spanned", + "indexmap 2.9.0", "toml_datetime", - "winnow", + "winnow 0.5.40", ] [[package]] name = "toml_edit" -version = "0.20.2" +version = "0.22.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" +checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" dependencies = [ - "indexmap 2.2.3", + "indexmap 2.9.0", "serde", "serde_spanned", "toml_datetime", - "winnow", + "winnow 0.7.6", ] [[package]] -name = "tower-service" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" - -[[package]] -name = "tracing" -version = "0.1.40" +name = "tower" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" dependencies = [ - "log", + "futures-core", + "futures-util", "pin-project-lite", - "tracing-attributes", - "tracing-core", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", ] [[package]] -name = "tracing-attributes" -version = "0.1.27" +name = "tower-layer" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.49", -] +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" [[package]] -name = "tracing-core" -version = "0.1.32" +name = "tower-service" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" -dependencies = [ - "once_cell", - "valuable", -] +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] -name = "tracing-log" -version = "0.2.0" +name = "tracing" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "log", - "once_cell", + "pin-project-lite", + "tracing-attributes", "tracing-core", ] [[package]] -name = "tracing-subscriber" -version = "0.3.18" +name = "tracing-attributes" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ - "matchers", - "nu-ansi-term", - "once_cell", - "regex", - "sharded-slab", - "smallvec", - "thread_local", - "tracing", - "tracing-core", - "tracing-log", + "proc-macro2", + "quote", + "syn 2.0.100", ] [[package]] -name = "tray-icon" -version = "0.11.3" +name = "tracing-core" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a4d9ddd4a7c0f3b6862af1c4911b529a49db4ee89310d3a258859c2f5053fdd" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ - "cocoa 0.25.0", - "core-graphics 0.23.1", - "crossbeam-channel", - "dirs-next", - "libappindicator", - "muda", - "objc", "once_cell", - "png", - "serde", - "thiserror", - "windows-sys 0.52.0", -] - -[[package]] -name = "treediff" -version = "4.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d127780145176e2b5d16611cc25a900150e86e9fd79d3bde6ff3a37359c9cb5" -dependencies = [ - "serde_json", ] [[package]] -name = "trust-dns-proto" -version = "0.23.2" +name = "tray-icon" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3119112651c157f4488931a01e586aa459736e9d6046d3bd9105ffb69352d374" -dependencies = [ - "async-trait", - "cfg-if", - "data-encoding", - "enum-as-inner", - "futures-channel", - "futures-io", - "futures-util", - "idna 0.4.0", - "ipnet", - "once_cell", - "rand 0.8.5", - "smallvec", - "thiserror", - "tinyvec", - "tokio", - "tracing", - "url", +checksum = "d433764348e7084bad2c5ea22c96c71b61b17afe3a11645710f533bd72b6a2b5" +dependencies = [ + "crossbeam-channel", + "dirs 6.0.0", + "libappindicator", + "muda", + "objc2 0.6.0", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.0", + "once_cell", + "png", + "serde", + "thiserror 2.0.12", + "windows-sys 0.59.0", ] [[package]] -name = "trust-dns-resolver" -version = "0.23.2" +name = "tree_magic_mini" +version = "3.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a3e6c3aff1718b3c73e395d1f35202ba2ffa847c6a62eea0db8fb4cfe30be6" +checksum = "aac5e8971f245c3389a5a76e648bfc80803ae066a1243a75db0064d7c1129d63" dependencies = [ - "cfg-if", - "futures-util", - "ipconfig", - "lru-cache", + "fnv", + "memchr", + "nom", "once_cell", - "parking_lot", - "rand 0.8.5", - "resolv-conf", - "smallvec", - "thiserror", - "tokio", - "tracing", - "trust-dns-proto", + "petgraph", ] +[[package]] +name = "trim-in-place" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "343e926fc669bc8cde4fa3129ab681c63671bae288b1f1081ceee6d9d37904fc" + [[package]] name = "try-lock" version = "0.2.5" @@ -7432,31 +7517,35 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "tungstenite" -version = "0.21.0" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ef1a641ea34f399a848dea702823bbecfb4c486f911735368f1f137cb8257e1" +checksum = "4793cb5e56680ecbb1d843515b23b6de9a75eb04b66643e256a396d43be33c13" dependencies = [ - "byteorder", "bytes", "data-encoding", - "http 1.0.0", + "http", "httparse", "log", "native-tls", - "rand 0.8.5", - "rustls 0.22.2", + "rand 0.9.0", + "rustls", "rustls-pki-types", "sha1", - "thiserror", - "url", + "thiserror 2.0.12", "utf-8", ] +[[package]] +name = "typeid" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c" + [[package]] name = "typenum" -version = "1.17.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" [[package]] name = "uds_windows" @@ -7464,63 +7553,91 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89daebc3e6fd160ac4aa9fc8b3bf71e1f74fbf92367ae71fb83a037e8bf164b9" dependencies = [ - "memoffset 0.9.0", + "memoffset 0.9.1", "tempfile", - "winapi 0.3.9", + "winapi", ] [[package]] -name = "unicase" -version = "2.7.0" +name = "unic-char-property" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" +checksum = "a8c57a407d9b6fa02b4795eb81c5b6652060a15a7903ea981f3d723e6c0be221" dependencies = [ - "version_check", + "unic-char-range", ] [[package]] -name = "unicode-bidi" -version = "0.3.15" +name = "unic-char-range" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" +checksum = "0398022d5f700414f6b899e10b8348231abf9173fa93144cbc1a43b9793c1fbc" [[package]] -name = "unicode-ident" -version = "1.0.12" +name = "unic-common" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "80d7ff825a6a654ee85a63e80f92f054f904f21e7d12da4e22f9834a4aaa35bc" [[package]] -name = "unicode-normalization" -version = "0.1.22" +name = "unic-ucd-ident" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +checksum = "e230a37c0381caa9219d67cf063aa3a375ffed5bf541a452db16e744bdab6987" dependencies = [ - "tinyvec", + "unic-char-property", + "unic-char-range", + "unic-ucd-version", ] [[package]] -name = "unicode-segmentation" -version = "1.11.0" +name = "unic-ucd-version" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" +checksum = "96bd2f2237fe450fcd0a1d2f5f4e91711124f7857ba2e964247776ebeeb7b0c4" +dependencies = [ + "unic-common", +] [[package]] -name = "unicode_categories" -version = "0.1.1" +name = "unicase" +version = "2.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" +checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539" [[package]] -name = "universal-hash" -version = "0.4.0" +name = "unicode-bidi" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" + +[[package]] +name = "unicode-ident" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" + +[[package]] +name = "unicode-normalization" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8326b2c654932e3e4f9196e69d08fdf7cfd718e1dc6f66b347e6024a0c961402" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" dependencies = [ - "generic-array", - "subtle", + "tinyvec", ] +[[package]] +name = "unicode-properties" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0" + +[[package]] +name = "unicode-segmentation" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" + [[package]] name = "universal-hash" version = "0.5.1" @@ -7533,33 +7650,58 @@ dependencies = [ [[package]] name = "untrusted" -version = "0.7.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] -name = "untrusted" -version = "0.9.0" +name = "updater-migration-test" +version = "0.1.0" +dependencies = [ + "serde", + "serde_json", + "tauri", + "tauri-build", + "tauri-plugin-updater", + "time", + "tiny_http", +] + +[[package]] +name = "ureq" +version = "2.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" +checksum = "02d1a66277ed75f640d608235660df48c8e3c19f3b4edb6a263315626cc3c01d" +dependencies = [ + "base64 0.22.1", + "log", + "once_cell", + "url", +] [[package]] name = "url" -version = "2.5.0" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" dependencies = [ "form_urlencoded", - "idna 0.5.0", + "idna", "percent-encoding", "serde", ] [[package]] -name = "urlencoding" -version = "2.1.3" +name = "urlpattern" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" +checksum = "70acd30e3aa1450bc2eece896ce2ad0d178e9c079493819301573dae3c37ba6d" +dependencies = [ + "regex", + "serde", + "unic-ucd-ident", + "url", +] [[package]] name = "utf-8" @@ -7567,38 +7709,45 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + [[package]] name = "utf8-width" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86bd8d4e895da8537e5315b8254664e6b769c4ff3db18321b297a1e7004392e3" +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "utf8parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.7.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" +checksum = "458f7a779bf54acc9f347480ac654f68407d3aab21269a6e3c9f922acd9e2da9" dependencies = [ - "getrandom 0.2.12", + "getrandom 0.3.2", + "serde", ] -[[package]] -name = "valuable" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" - [[package]] name = "value-bag" -version = "1.7.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126e423afe2dd9ac52142e7e9d5ce4135d7e13776c529d27fd6bc49f19e3280b" +checksum = "943ce29a8a743eb10d6082545d861b24f9d1b160b7d741e0f2cdf726bec909c5" [[package]] name = "vcpkg" @@ -7608,15 +7757,15 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "version-compare" -version = "0.1.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29" +checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "vswhom" @@ -7630,9 +7779,9 @@ dependencies = [ [[package]] name = "vswhom-sys" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3b17ae1f6c8a2b28506cd96d412eebf83b4a0ff2cbefeeb952f2f9dfa44ba18" +checksum = "fb067e4cbd1ff067d1df46c9194b5de0e98efd2810bbc95c5d5e5f25a3231150" dependencies = [ "cc", "libc", @@ -7640,31 +7789,20 @@ dependencies = [ [[package]] name = "wait-timeout" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" +checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11" dependencies = [ "libc", ] [[package]] name = "walkdir" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb08f9e670fab86099470b97cd2b252d6527f0b3cc1401acdb595ffc9dd288ff" -dependencies = [ - "kernel32-sys", - "same-file 0.1.3", - "winapi 0.2.8", -] - -[[package]] -name = "walkdir" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" dependencies = [ - "same-file 1.0.6", + "same-file", "winapi-util", ] @@ -7689,48 +7827,65 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasi" +version = "0.14.2+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" +dependencies = [ + "wit-bindgen-rt", +] + +[[package]] +name = "wasite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" + [[package]] name = "wasm-bindgen" -version = "0.2.91" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" dependencies = [ "cfg-if", + "once_cell", + "rustversion", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.91" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" dependencies = [ "bumpalo", "log", - "once_cell", "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.100", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.41" +version = "0.4.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877b9c3f61ceea0e56331985743b13f3d25c406a7098d45180fb5f09bc19ed97" +checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61" dependencies = [ "cfg-if", "js-sys", + "once_cell", "wasm-bindgen", "web-sys", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.91" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -7738,28 +7893,31 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.91" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.100", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.91" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] [[package]] name = "wasm-streams" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b65dc4c90b63b118468cf747d8bf3566c1913ef60be765b5730ead9e0a3ba129" +checksum = "15053d8d85c7eccdbefef60f06769760a563c7f0a9d6902a13d35c7800b0ad65" dependencies = [ "futures-util", "js-sys", @@ -7770,58 +7928,89 @@ dependencies = [ [[package]] name = "wayland-backend" -version = "0.3.3" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d50fa61ce90d76474c87f5fc002828d81b32677340112b4ef08079a9d459a40" +checksum = "b7208998eaa3870dad37ec8836979581506e0c5c64c20c9e79e9d2a10d6f47bf" dependencies = [ "cc", "downcast-rs", - "rustix", - "scoped-tls", + "rustix 0.38.44", "smallvec", "wayland-sys", ] [[package]] name = "wayland-client" -version = "0.31.2" +version = "0.31.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2120de3d33638aaef5b9f4472bff75f07c56379cf76ea320bd3a3d65ecaf73f" +dependencies = [ + "bitflags 2.9.0", + "rustix 0.38.44", + "wayland-backend", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols" +version = "0.32.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0781cf46869b37e36928f7b432273c0995aa8aed9552c556fb18754420541efc" +dependencies = [ + "bitflags 2.9.0", + "wayland-backend", + "wayland-client", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-wlr" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82fb96ee935c2cea6668ccb470fb7771f6215d1691746c2d896b447a00ad3f1f" +checksum = "248a02e6f595aad796561fa82d25601bd2c8c3b145b1c7453fc8f94c1a58f8b2" dependencies = [ - "bitflags 2.4.2", - "rustix", + "bitflags 2.9.0", "wayland-backend", + "wayland-client", + "wayland-protocols", "wayland-scanner", ] [[package]] name = "wayland-scanner" -version = "0.31.1" +version = "0.31.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63b3a62929287001986fb58c789dce9b67604a397c15c611ad9f747300b6c283" +checksum = "896fdafd5d28145fce7958917d69f2fd44469b1d4e861cb5961bcbeebc6d1484" dependencies = [ "proc-macro2", - "quick-xml 0.31.0", + "quick-xml 0.37.4", "quote", ] [[package]] name = "wayland-sys" -version = "0.31.1" +version = "0.31.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15a0c8eaff5216d07f226cb7a549159267f3467b289d9a2e52fd3ef5aae2b7af" +checksum = "dbcebb399c77d5aa9fa5db874806ee7b4eba4e73650948e8f93963f128896615" dependencies = [ - "dlib", - "log", - "once_cell", "pkg-config", ] [[package]] name = "web-sys" -version = "0.3.68" +version = "0.3.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96565907687f7aceb35bc5fc03770a8a0471d82e479f25832f54a0e3f4b28446" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" dependencies = [ "js-sys", "wasm-bindgen", @@ -7838,10 +8027,10 @@ dependencies = [ "gdk", "gdk-sys", "gio", - "gio-sys 0.18.1", - "glib 0.18.5", - "glib-sys 0.18.1", - "gobject-sys 0.18.0", + "gio-sys", + "glib", + "glib-sys", + "gobject-sys", "gtk", "gtk-sys", "javascriptcore-rs", @@ -7860,9 +8049,9 @@ dependencies = [ "bitflags 1.3.2", "cairo-sys-rs", "gdk-sys", - "gio-sys 0.18.1", - "glib-sys 0.18.1", - "gobject-sys 0.18.0", + "gio-sys", + "glib-sys", + "gobject-sys", "gtk-sys", "javascriptcore-rs-sys", "libc", @@ -7873,15 +8062,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.25.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" - -[[package]] -name = "webpki-roots" -version = "0.26.1" +version = "0.26.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3de34ae270483955a94f4b21bdaaeb83d508bb84a01435f393818edb0012009" +checksum = "2210b291f7ea53617fbafcc4939f10914214ec15aace5ba62293a668f322c5c9" dependencies = [ "rustls-pki-types", ] @@ -7902,38 +8085,38 @@ dependencies = [ [[package]] name = "webview2-com" -version = "0.28.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0ae9c7e420783826cf769d2c06ac9ba462f450eca5893bb8c6c6529a4e5dd33" +checksum = "b542b5cfbd9618c46c2784e4d41ba218c336ac70d44c55e47b251033e7d85601" dependencies = [ "webview2-com-macros", "webview2-com-sys", - "windows 0.52.0", - "windows-core 0.52.0", + "windows 0.61.1", + "windows-core", "windows-implement", "windows-interface", ] [[package]] name = "webview2-com-macros" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1345798ecd8122468840bcdf1b95e5dc6d2206c5e4b0eafa078d061f59c9bc" +checksum = "1d228f15bba3b9d56dde8bddbee66fa24545bd17b48d5128ccf4a8742b18e431" dependencies = [ "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.100", ] [[package]] name = "webview2-com-sys" -version = "0.28.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6ad85fceee6c42fa3d61239eba5a11401bf38407a849ed5ea1b407df08cca72" +checksum = "8ae2d11c4a686e4409659d7891791254cf9286d3cfe0eef54df1523533d22295" dependencies = [ - "thiserror", - "windows 0.52.0", - "windows-core 0.52.0", + "thiserror 2.0.12", + "windows 0.61.1", + "windows-core", ] [[package]] @@ -7944,32 +8127,24 @@ checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082" [[package]] name = "whoami" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22fc3756b8a9133049b26c7f61ab35416c130e8c09b660f5b3958b446f52cc50" - -[[package]] -name = "widestring" -version = "1.0.2" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8" +checksum = "6994d13118ab492c3c80c1f81928718159254c53c472bf9ce36f8dae4add02a7" +dependencies = [ + "redox_syscall", + "wasite", +] [[package]] name = "win7-notifications" -version = "0.3.1" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "210952d7163b9ed83a6fd9754ab2a101d14480f8491b5f1d6292771d88dbee70" +checksum = "63b4745047a00800bd8f2b8fb4b0eb6f7d96822084127f0ff7d68d07f692fe38" dependencies = [ "once_cell", - "windows-sys 0.36.1", + "windows-sys 0.59.0", ] -[[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" - [[package]] name = "winapi" version = "0.3.9" @@ -7980,12 +8155,6 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" - [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -7994,11 +8163,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.6" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "winapi 0.3.9", + "windows-sys 0.52.0", ] [[package]] @@ -8007,28 +8176,18 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "window-shadows" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ff424735b1ac21293b0492b069394b0a189c8a463fb015a16dea7c2e221c08" -dependencies = [ - "cocoa 0.25.0", - "objc", - "raw-window-handle 0.5.2", - "windows-sys 0.48.0", -] - [[package]] name = "window-vibrancy" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33082acd404763b315866e14a0d5193f3422c81086657583937a750cdd3ec340" +checksum = "d9bec5a31f3f9362f2258fd0e9c9dd61a9ca432e7306cc78c444258f0dce9a9c" dependencies = [ - "cocoa 0.25.0", - "objc", - "raw-window-handle 0.6.0", - "windows-sys 0.52.0", + "objc2 0.6.0", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-foundation 0.3.0", + "raw-window-handle", + "windows-sys 0.59.0", "windows-version", ] @@ -8047,86 +8206,134 @@ dependencies = [ [[package]] name = "windows" -version = "0.48.0" +version = "0.61.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +checksum = "c5ee8f3d025738cb02bad7868bbb5f8a6327501e870bf51f1b455b0a2454a419" dependencies = [ - "windows-targets 0.48.5", + "windows-collections", + "windows-core", + "windows-future", + "windows-link", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" +dependencies = [ + "windows-core", +] + +[[package]] +name = "windows-core" +version = "0.61.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4763c1de310c86d75a878046489e2e5ba02c649d185f21c67d4cf8a56d098980" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings 0.4.0", +] + +[[package]] +name = "windows-future" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a1d6bbefcb7b60acd19828e1bc965da6fcf18a7e39490c5f8be71e54a19ba32" +dependencies = [ + "windows-core", + "windows-link", +] + +[[package]] +name = "windows-implement" +version = "0.60.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "windows-interface" +version = "0.59.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", ] [[package]] -name = "windows" -version = "0.51.1" +name = "windows-link" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca229916c5ee38c2f2bc1e9d8f04df975b4bd93f9955dc69fabb5d91270045c9" -dependencies = [ - "windows-core 0.51.1", - "windows-targets 0.48.5", -] +checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" [[package]] -name = "windows" -version = "0.52.0" +name = "windows-numerics" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" +checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" dependencies = [ - "windows-core 0.52.0", - "windows-implement", - "windows-interface", - "windows-targets 0.52.0", + "windows-core", + "windows-link", ] [[package]] -name = "windows-core" -version = "0.51.1" +name = "windows-registry" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" +checksum = "4286ad90ddb45071efd1a66dfa43eb02dd0dfbae1545ad6cc3c51cf34d7e8ba3" dependencies = [ - "windows-targets 0.48.5", + "windows-result", + "windows-strings 0.3.1", + "windows-targets 0.53.0", ] [[package]] -name = "windows-core" -version = "0.52.0" +name = "windows-registry" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +checksum = "ad1da3e436dc7653dfdf3da67332e22bff09bb0e28b0239e1624499c7830842e" dependencies = [ - "windows-targets 0.52.0", + "windows-link", + "windows-result", + "windows-strings 0.4.0", ] [[package]] -name = "windows-implement" -version = "0.52.0" +name = "windows-result" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12168c33176773b86799be25e2a2ba07c7aab9968b37541f1094dbd7a60c8946" +checksum = "c64fd11a4fd95df68efcfee5f44a294fe71b8bc6a91993e2791938abcc712252" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.49", + "windows-link", ] [[package]] -name = "windows-interface" -version = "0.52.0" +name = "windows-strings" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d8dc32e0095a7eeccebd0e3f09e9509365ecb3fc6ac4d6f5f14a3f6392942d1" +checksum = "87fa48cc5d406560701792be122a10132491cff9d0aeb23583cc2dcafc847319" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.49", + "windows-link", ] [[package]] -name = "windows-sys" -version = "0.36.1" +name = "windows-strings" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +checksum = "7a2ba9642430ee452d5a7aa78d72907ebe8cfda358e8cb7918a2050581322f97" dependencies = [ - "windows_aarch64_msvc 0.36.1", - "windows_i686_gnu 0.36.1", - "windows_i686_msvc 0.36.1", - "windows_x86_64_gnu 0.36.1", - "windows_x86_64_msvc 0.36.1", + "windows-link", ] [[package]] @@ -8153,7 +8360,16 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", ] [[package]] @@ -8188,26 +8404,43 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.0" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm 0.52.6", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +checksum = "b1e4c7e8ceaaf9cb7d7507c974735728ab453b67ef8f18febdd7c11fe59dca8b" dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", + "windows_aarch64_gnullvm 0.53.0", + "windows_aarch64_msvc 0.53.0", + "windows_i686_gnu 0.53.0", + "windows_i686_gnullvm 0.53.0", + "windows_i686_msvc 0.53.0", + "windows_x86_64_gnu 0.53.0", + "windows_x86_64_gnullvm 0.53.0", + "windows_x86_64_msvc 0.53.0", ] [[package]] name = "windows-version" -version = "0.1.0" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75aa004c988e080ad34aff5739c39d0312f4684699d6d71fc8a198d057b8b9b4" +checksum = "e04a5c6627e310a23ad2358483286c7df260c964eb2d003d8efd6d0f4e79265c" dependencies = [ - "windows-targets 0.52.0", + "windows-link", ] [[package]] @@ -8224,9 +8457,15 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.0" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" +checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" [[package]] name = "windows_aarch64_msvc" @@ -8248,9 +8487,15 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.0" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" +checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" [[package]] name = "windows_i686_gnu" @@ -8272,9 +8517,27 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.0" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" +checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" [[package]] name = "windows_i686_msvc" @@ -8296,9 +8559,15 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.0" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" +checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" [[package]] name = "windows_x86_64_gnu" @@ -8320,9 +8589,15 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.0" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" +checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" [[package]] name = "windows_x86_64_gnullvm" @@ -8338,9 +8613,15 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.0" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" +checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" [[package]] name = "windows_x86_64_msvc" @@ -8362,9 +8643,15 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" [[package]] name = "winnow" @@ -8375,76 +8662,114 @@ dependencies = [ "memchr", ] +[[package]] +name = "winnow" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63d3fcd9bba44b03821e7d699eeee959f3126dcc4aa8e4ae18ec617c2a5cea10" +dependencies = [ + "memchr", +] + [[package]] name = "winreg" version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] name = "winreg" -version = "0.50.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" dependencies = [ "cfg-if", "windows-sys 0.48.0", ] [[package]] -name = "winreg" -version = "0.51.0" +name = "wit-bindgen-rt" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "937f3df7948156640f46aacef17a70db0de5917bda9c92b0f751f3a955b588fc" +checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" dependencies = [ - "cfg-if", - "windows-sys 0.48.0", + "bitflags 2.9.0", +] + +[[package]] +name = "wl-clipboard-rs" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5ff8d0e60065f549fafd9d6cb626203ea64a798186c80d8e7df4f8af56baeb" +dependencies = [ + "libc", + "log", + "os_pipe", + "rustix 0.38.44", + "tempfile", + "thiserror 2.0.12", + "tree_magic_mini", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-protocols-wlr", ] +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + [[package]] name = "wry" -version = "0.36.0" +version = "0.51.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a9e7b81968555303086ef882a0c213896a76099de4ed0b86a798775c2d54304" +checksum = "c886a0a9d2a94fd90cfa1d929629b79cfefb1546e2c7430c63a47f0664c0e4e2" dependencies = [ - "base64 0.21.7", - "block", - "cfg_aliases 0.1.1", - "cocoa 0.25.0", - "core-graphics 0.23.1", + "base64 0.22.1", + "block2 0.6.0", + "cookie", "crossbeam-channel", + "dpi", "dunce", "gdkx11", "gtk", "html5ever", - "http 0.2.11", + "http", "javascriptcore-rs", "jni", "kuchikiki", "libc", - "log", "ndk", - "ndk-context", - "ndk-sys", - "objc", - "objc_id", + "objc2 0.6.0", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-foundation 0.3.0", + "objc2-ui-kit", + "objc2-web-kit", "once_cell", - "raw-window-handle 0.6.0", - "serde", - "serde_json", - "sha2 0.10.8", + "percent-encoding", + "raw-window-handle", + "sha2", "soup3", "tao-macros", - "thiserror", + "thiserror 2.0.12", "url", "webkit2gtk", "webkit2gtk-sys", "webview2-com", - "windows 0.52.0", - "windows-implement", + "windows 0.61.1", + "windows-core", "windows-version", "x11-dl", ] @@ -8481,91 +8806,107 @@ dependencies = [ [[package]] name = "x11rb" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8f25ead8c7e4cba123243a6367da5d3990e0d3affa708ea19dce96356bd9f1a" +checksum = "5d91ffca73ee7f68ce055750bf9f6eca0780b8c85eff9bc046a3b0da41755e12" dependencies = [ - "as-raw-xcb-connection", - "gethostname", - "libc", - "libloading 0.8.1", - "once_cell", - "rustix", + "gethostname 0.4.3", + "rustix 0.38.44", "x11rb-protocol", ] [[package]] name = "x11rb-protocol" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e63e71c4b8bd9ffec2c963173a4dc4cbde9ee96961d4fcb4429db9929b606c34" +checksum = "ec107c4503ea0b4a98ef47356329af139c0a4f7750e621cf2973cd3385ebcb3d" [[package]] name = "x25519-dalek" -version = "1.1.1" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a0c105152107e3b96f6a00a65e86ce82d9b125230e1c4302940eca58ff71f4f" +checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" dependencies = [ "curve25519-dalek", - "rand_core 0.5.1", + "rand_core 0.6.4", "zeroize", ] [[package]] name = "xattr" -version = "1.3.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da84f1a25939b27f6820d92aed108f83ff920fdf11a7b19366c27c4cda81d4f" +checksum = "0d65cbf2f12c15564212d48f4e3dfb87923d25d611f2aed18f4cb23f0413d89e" dependencies = [ "libc", - "linux-raw-sys 0.4.13", - "rustix", + "rustix 1.0.5", ] [[package]] name = "xdg-home" -version = "1.1.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21e5a325c3cb8398ad6cf859c1135b25dd29e186679cf2da7581d9679f63b38e" +checksum = "ec1cdab258fb55c0da61328dc52c8764709b249011b2cad0454c72f0bf10a1f6" dependencies = [ "libc", - "winapi 0.3.9", + "windows-sys 0.59.0", +] + +[[package]] +name = "yoke" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", + "synstructure", ] [[package]] name = "zbus" -version = "4.0.1" +version = "5.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b8e3d6ae3342792a6cc2340e4394334c7402f3d793b390d2c5494a4032b3030" +checksum = "59c333f648ea1b647bc95dc1d34807c8e25ed7a6feff3394034dc4776054b236" dependencies = [ "async-broadcast", "async-executor", "async-fs", "async-io", - "async-lock 3.3.0", + "async-lock", "async-process", "async-recursion", "async-task", "async-trait", "blocking", - "derivative", "enumflags2", - "event-listener 5.1.0", + "event-listener", "futures-core", - "futures-sink", - "futures-util", + "futures-lite", "hex", - "nix 0.27.1", + "nix 0.29.0", "ordered-stream", - "rand 0.8.5", "serde", "serde_repr", - "sha1", "static_assertions", "tokio", "tracing", "uds_windows", - "windows-sys 0.52.0", + "windows-sys 0.59.0", + "winnow 0.7.6", "xdg-home", "zbus_macros", "zbus_names", @@ -8574,55 +8915,99 @@ dependencies = [ [[package]] name = "zbus_macros" -version = "4.0.1" +version = "5.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7a3e850ff1e7217a3b7a07eba90d37fe9bb9e89a310f718afcde5885ca9b6d7" +checksum = "f325ad10eb0d0a3eb060203494c3b7ec3162a01a59db75d2deee100339709fc0" dependencies = [ - "proc-macro-crate 1.3.1", + "proc-macro-crate 3.3.0", "proc-macro2", "quote", - "regex", - "syn 1.0.109", + "syn 2.0.100", + "zbus_names", + "zvariant", "zvariant_utils", ] [[package]] name = "zbus_names" -version = "3.0.0" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b9b1fef7d021261cc16cba64c351d291b715febe0fa10dc3a443ac5a5022e6c" +checksum = "7be68e64bf6ce8db94f63e72f0c7eb9a60d733f7e0499e628dfab0f84d6bcb97" dependencies = [ "serde", "static_assertions", + "winnow 0.7.6", "zvariant", ] [[package]] name = "zerocopy" -version = "0.7.32" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "zerocopy-derive 0.7.35", +] + +[[package]] +name = "zerocopy" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +dependencies = [ + "zerocopy-derive 0.8.24", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ - "zerocopy-derive", + "proc-macro2", + "quote", + "syn 2.0.100", ] [[package]] name = "zerocopy-derive" -version = "0.7.32" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "zerofrom" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.100", + "synstructure", ] [[package]] name = "zeroize" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" dependencies = [ + "serde", "zeroize_derive", ] @@ -8634,101 +9019,127 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.100", +] + +[[package]] +name = "zerovec" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", ] [[package]] name = "zip" -version = "0.6.6" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" +checksum = "1dcb24d0152526ae49b9b96c1dcf71850ca1e0b882e4e28ed898a93c41334744" dependencies = [ - "aes 0.8.4", - "byteorder", - "bzip2", - "constant_time_eq 0.1.5", + "arbitrary", "crc32fast", "crossbeam-utils", "flate2", - "hmac", - "pbkdf2", - "sha1", - "time", - "zstd", + "indexmap 2.9.0", + "memchr", + "zopfli", +] + +[[package]] +name = "zopfli" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5019f391bac5cf252e93bbcc53d039ffd62c7bfb7c150414d61369afe57e946" +dependencies = [ + "bumpalo", + "crc32fast", + "lockfree-object-pool", + "log", + "once_cell", + "simd-adler32", ] [[package]] name = "zstd" -version = "0.11.2+zstd.1.5.2" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" +checksum = "e91ee311a569c327171651566e07972200e76fcfe2242a4fa446149a3881c08a" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "5.0.2+zstd.1.5.2" +version = "7.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" +checksum = "8f49c4d5f0abb602a93fb8736af2a4f4dd9512e36f7f570d66e65ff867ed3b9d" dependencies = [ - "libc", "zstd-sys", ] [[package]] name = "zstd-sys" -version = "2.0.9+zstd.1.5.5" +version = "2.0.15+zstd.1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e16efa8a874a0481a574084d34cc26fdb3b99627480f785888deb6386506656" +checksum = "eb81183ddd97d0c74cedf1d50d85c8d08c1b8b68ee863bdee9e706eedba1a237" dependencies = [ "cc", "pkg-config", ] -[[package]] -name = "zune-inflate" -version = "0.2.54" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02" -dependencies = [ - "simd-adler32", -] - [[package]] name = "zvariant" -version = "4.0.0" +version = "5.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e09e8be97d44eeab994d752f341e67b3b0d80512a8b315a0671d47232ef1b65" +checksum = "b2df9ee044893fcffbdc25de30546edef3e32341466811ca18421e3cd6c5a3ac" dependencies = [ "endi", "enumflags2", "serde", "static_assertions", "url", + "winnow 0.7.6", "zvariant_derive", + "zvariant_utils", ] [[package]] name = "zvariant_derive" -version = "4.0.0" +version = "5.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72a5857e2856435331636a9fbb415b09243df4521a267c5bedcd5289b4d5799e" +checksum = "74170caa85b8b84cc4935f2d56a57c7a15ea6185ccdd7eadb57e6edd90f94b2f" dependencies = [ - "proc-macro-crate 1.3.1", + "proc-macro-crate 3.3.0", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.100", "zvariant_utils", ] [[package]] name = "zvariant_utils" -version = "1.1.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00bedb16a193cc12451873fee2a1bc6550225acece0e36f333e68326c73c8172" +checksum = "e16edfee43e5d7b553b77872d99bc36afdda75c223ca7ad5e3fbecd82ca5fc34" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "serde", + "static_assertions", + "syn 2.0.100", + "winnow 0.7.6", ] diff --git a/Cargo.toml b/Cargo.toml index cdc5865e..d85be889 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,7 @@ members = [ "plugins/*", "plugins/*/tests/*", + "plugins/updater/tests/updater-migration/v2-app", "plugins/*/examples/*/src-tauri", "examples/*/src-tauri", ] @@ -9,20 +10,27 @@ resolver = "2" [workspace.dependencies] serde = { version = "1", features = ["derive"] } +tracing = "0.1" log = "0.4" -tauri = "2.0.0-beta.4" -tauri-build = "2.0.0-beta.3" -tauri-plugin = "2.0.0-beta.3" +tauri = { version = "2", default-features = false } +tauri-build = "2" +tauri-plugin = "2" +tauri-utils = "2" serde_json = "1" -thiserror = "1" +thiserror = "2" url = "2" schemars = "0.8" +dunce = "1" +specta = "^2.0.0-rc.16" +glob = "0.3" +zbus = "5" [workspace.package] edition = "2021" authors = ["Tauri Programme within The Commons Conservancy"] license = "Apache-2.0 OR MIT" -rust-version = "1.75" +rust-version = "1.77.2" +repository = "https://github.com/tauri-apps/plugins-workspace" # default to small, optimized release binaries [profile.release] diff --git a/README.md b/README.md index 444c4e99..33039295 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,49 @@ +# Official Tauri Plugins + +This repo and all plugins require a Rust version of at least **1.77.2** + ## Plugins Found Here -| | | Win | Mac | Lin | iOS | And | -| ----------------------------------------------- | ------------------------------------------------------ | --- | --- | --- | --- | --- | -| [authenticator](plugins/authenticator) | Interface with hardware security keys. | ✅ | ✅ | ✅ | ? | ? | -| [autostart](plugins/autostart) | Automatically launch your app at system startup. | ✅ | ✅ | ✅ | ? | ? | -| [barcode-scanner](plugins/barcode-scanner) | Allows your mobile application to use the camera to scan QR codes, EAN-13 and other kinds of barcodes. | ? | ? | ? | ✅ | ✅ | -| [biometric](plugins/biometric) | Prompt the user for biometric authentication on Android and iOS. | ? | ? | ? | ✅ | ✅ | -| [cli](plugins/cli) | Parse arguments from your Command Line Interface | ✅ | ✅ | ✅ | ? | ? | -| [clipboard-manager](plugins/clipboard-manager) | Read and write to the system clipboard. | ✅ | ✅ | ✅ | ✅ | ✅ | -| [deep-link](plugins/deep-link) | Set your Tauri application as the default handler for an URL. | ? | ? | ? | ✅ | ✅ | -| [dialog](plugins/dialog) | Native system dialogs for opening and saving files along with message dialogs. | ✅ | ✅ | ✅ | ✅ | ✅ | -| [fs](plugins/fs) | Access the file system. | ✅ | ✅ | ✅ | ? | ? | -| [global-shortcut](plugins/global-shortcut) | Register global shortcuts. | ✅ | ✅ | ✅ | ? | ? | -| [http](plugins/http) | Access the HTTP client written in Rust. | ✅ | ✅ | ✅ | ✅ | ✅ | -| [localhost](plugins/localhost) | Use a localhost server in production apps. | ✅ | ✅ | ✅ | ? | ? | -| [log](plugins/log) | Configurable logging. | ✅ | ✅ | ✅ | ✅ | ✅ | -| [nfc](plugins/nfc) | Read and write NFC tags on Android and iOS. | ? | ? | ? | ✅ | ✅ | -| [notification](plugins/notification) | Send message notifications (brief auto-expiring OS window element) to your user. Can also be used with the Notification Web API. | ✅ | ✅ | ✅ | ✅ | ✅ | -| [os](plugins/os) | Read information about the operating system. | ✅ | ✅ | ✅ | ✅ | ✅ | -| [persisted-scope](plugins/persisted-scope) | Persist runtime scope changes on the filesystem. | ✅ | ✅ | ✅ | ? | ? | -| [positioner](plugins/positioner) | Move windows to common locations. | ✅ | ✅ | ✅ | ? | ? | -| [process](plugins/process) | This plugin provides APIs to access the current process. To spawn child processes, see the [`shell`](https://github.com/tauri-apps/tauri-plugin-shell) plugin. | ✅ | ✅ | ✅ | ? | ? | -| [shell](plugins/shell) | Access the system shell. Allows you to spawn child processes and manage files and URLs using their default application. | ✅ | ✅ | ✅ | ? | ? | -| [single-instance](plugins/single-instance) | Ensure a single instance of your tauri app is running. | ✅ | ? | ✅ | ? | ? | -| [sql](plugins/sql) | Interface with SQL databases. | ✅ | ✅ | ✅ | ? | ? | -| [store](plugins/store) | Persistent key value storage. | ✅ | ✅ | ✅ | ? | ? | -| [stronghold](plugins/stronghold) | Encrypted, secure database. | ✅ | ✅ | ✅ | ? | ? | -| [updater](plugins/updater) | In-app updates for Tauri applications. | ✅ | ✅ | ✅ | ? | ? | -| [upload](plugins/upload) | Tauri plugin for file uploads through HTTP. | ✅ | ✅ | ✅ | ? | ? | -| [websocket](plugins/websocket) | Open a WebSocket connection using a Rust client in JS. | ✅ | ✅ | ✅ | ? | ? | -| [window-state](plugins/window-state) | Persist window sizes and positions. | ✅ | ✅ | ✅ | ? | ? | - -_This repo and all plugins require a Rust version of at least **1.75**_ +| | | Win | Mac | Lin | iOS | And | +| ---------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- | --- | --- | --- | --- | +| [autostart](plugins/autostart) | Automatically launch your app at system startup. | ✅ | ✅ | ✅ | ❌ | ❌ | +| [barcode-scanner](plugins/barcode-scanner) | Allows your mobile application to use the camera to scan QR codes, EAN-13 and other kinds of barcodes. | ? | ? | ? | ✅ | ✅ | +| [biometric](plugins/biometric) | Prompt the user for biometric authentication on Android and iOS. | ? | ? | ? | ✅ | ✅ | +| [cli](plugins/cli) | Parse arguments from your Command Line Interface | ✅ | ✅ | ✅ | ❌ | ❌ | +| [clipboard-manager](plugins/clipboard-manager) | Read and write to the system clipboard. | ✅ | ✅ | ✅ | ✅ | ✅ | +| [deep-link](plugins/deep-link) | Set your Tauri application as the default handler for an URL. | ✅ | ✅ | ✅ | ✅ | ✅ | +| [dialog](plugins/dialog) | Native system dialogs for opening and saving files along with message dialogs. | ✅ | ✅ | ✅ | ✅ | ✅ | +| [fs](plugins/fs) | Access the file system. | ✅ | ✅ | ✅ | ? | ? | +| [geolocation](plugins/geolocation) | Get and track current device position. | ? | ? | ? | ✅ | ✅ | +| [global-shortcut](plugins/global-shortcut) | Register global shortcuts. | ✅ | ✅ | ✅ | ? | ? | +| [haptics](plugins/haptics) | Haptic feedback and vibrations. | ? | ? | ? | ✅ | ✅ | +| [http](plugins/http) | Access the HTTP client written in Rust. | ✅ | ✅ | ✅ | ✅ | ✅ | +| [localhost](plugins/localhost) | Use a localhost server in production apps. | ✅ | ✅ | ✅ | ? | ? | +| [log](plugins/log) | Configurable logging. | ✅ | ✅ | ✅ | ✅ | ✅ | +| [nfc](plugins/nfc) | Read and write NFC tags on Android and iOS. | ? | ? | ? | ✅ | ✅ | +| [notification](plugins/notification) | Send message notifications (brief auto-expiring OS window element) to your user. Can also be used with the Notification Web API. | ✅ | ✅ | ✅ | ✅ | ✅ | +| [opener](plugins/opener) | Open files and URLs using their default application. | ✅ | ✅ | ✅ | ? | ? | +| [os](plugins/os) | Read information about the operating system. | ✅ | ✅ | ✅ | ✅ | ✅ | +| [persisted-scope](plugins/persisted-scope) | Persist runtime scope changes on the filesystem. | ✅ | ✅ | ✅ | ? | ? | +| [positioner](plugins/positioner) | Move windows to common locations. | ✅ | ✅ | ✅ | ❌ | ❌ | +| [process](plugins/process) | This plugin provides APIs to access the current process. To spawn child processes, see the [`shell`](https://github.com/tauri-apps/tauri-plugin-shell) plugin. | ✅ | ✅ | ✅ | ? | ? | +| [shell](plugins/shell) | Access the system shell. Allows you to spawn child processes and manage files and URLs using their default application. | ✅ | ✅ | ✅ | ? | ? | +| [single-instance](plugins/single-instance) | Ensure a single instance of your tauri app is running. | ✅ | ✅ | ✅ | ❌ | ❌ | +| [sql](plugins/sql) | Interface with SQL databases. | ✅ | ✅ | ✅ | ✅ | ✅ | +| [store](plugins/store) | Persistent key value storage. | ✅ | ✅ | ✅ | ✅ | ✅ | +| [stronghold](plugins/stronghold) | Encrypted, secure database. | ✅ | ✅ | ✅ | ? | ? | +| [updater](plugins/updater) | In-app updates for Tauri applications. | ✅ | ✅ | ✅ | ❌ | ❌ | +| [upload](plugins/upload) | Tauri plugin for file uploads through HTTP. | ✅ | ✅ | ✅ | ? | ? | +| [websocket](plugins/websocket) | Open a WebSocket connection using a Rust client in JS. | ✅ | ✅ | ✅ | ? | ? | +| [window-state](plugins/window-state) | Persist window sizes and positions. | ✅ | ✅ | ✅ | ❌ | ❌ | + +- ✅: (Partially) Supported +- ❌: Not supported +- `?` : Unknown/Untested or Planned + +## Contributing + +PRs accepted. Please make sure to read the [Contributing Guide](https://github.com/tauri-apps/tauri/blob/dev/.github/CONTRIBUTING.md) before making a pull request. ## Partners diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 00000000..4f09bbac --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,23 @@ +# Security Policy + +**Do not report security vulnerabilities through public GitHub issues.** + +**Please use the [Private Vulnerability Disclosure](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability) feature of GitHub.** + +Include as much of the following information: + +- Type of issue (e.g. improper input parsing, privilege escalation, etc.) +- The location of the affected source code (tag/branch/commit or direct URL) +- Any special configuration required to reproduce the issue +- The distribution affected or used to help us with reproduction of the issue +- Step-by-step instructions to reproduce the issue +- Ideally a reproduction repository +- Impact of the issue, including how an attacker might exploit the issue + +We prefer to receive reports in English. + +## Contact + +Please disclose a vulnerability or security relevant issue here: [https://github.com/tauri-apps/plugins-workspace/security/advisories/new](https://github.com/tauri-apps/plugins-workspace/security/advisories/new). + +Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app). diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 00000000..f34103ee --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,38 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +import eslint from '@eslint/js' +import eslintConfigPrettier from 'eslint-config-prettier' +import eslintPluginSecurity from 'eslint-plugin-security' +import tseslint from 'typescript-eslint' + +export default tseslint.config( + { + ignores: [ + '**/target', + '**/node_modules', + '**/examples', + '**/dist', + '**/dist-js', + '**/build', + '**/api-iife.js', + '**/init-iife.js', + '**/init.js', + '**/rollup.config.js', + '**/bindings.ts', + '**/.test-server', + '.scripts', + 'eslint.config.js' + ] + }, + eslint.configs.recommended, + eslintConfigPrettier, + eslintPluginSecurity.configs.recommended, + ...tseslint.configs.recommendedTypeChecked, + { + languageOptions: { + parserOptions: { project: true, tsconfigRootDir: import.meta.dirname } + } + } +) diff --git a/examples/api/.gitignore b/examples/api/.gitignore deleted file mode 100644 index ac9643a2..00000000 --- a/examples/api/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/node_modules/ -/.vscode/ -.DS_Store -.cargo diff --git a/examples/api/CHANGELOG.md b/examples/api/CHANGELOG.md index 97bab4e7..6ed56a11 100644 --- a/examples/api/CHANGELOG.md +++ b/examples/api/CHANGELOG.md @@ -1,5 +1,431 @@ # Changelog +## \[2.0.21] + +### Dependencies + +- Upgraded to `log-js@2.4.0` +- Upgraded to `biometric-js@2.2.1` +- Upgraded to `updater-js@2.7.1` + +## \[2.0.20] + +### Dependencies + +- Upgraded to `http-js@2.4.3` +- Upgraded to `shell-js@2.2.1` +- Upgraded to `fs-js@2.2.1` +- Upgraded to `process-js@2.2.1` +- Upgraded to `updater-js@2.7.0` +- Upgraded to `dialog-js@2.2.1` + +## \[2.0.19] + +### Dependencies + +- Upgraded to `http-js@2.4.2` +- Upgraded to `updater-js@2.6.1` + +## \[2.0.18] + +### Dependencies + +- Upgraded to `http-js@2.4.1` + +## \[2.0.17] + +### Dependencies + +- Upgraded to `log-js@2.3.1` + +## \[2.0.16] + +### Dependencies + +- Upgraded to `clipboard-manager-js@2.2.2` +- Upgraded to `notification-js@2.2.2` +- Upgraded to `os-js@2.2.1` +- Upgraded to `http-js@2.4.0` +- Upgraded to `log-js@2.3.0` +- Upgraded to `updater-js@2.6.0` + +## \[2.0.15] + +### Dependencies + +- Upgraded to `log-js@2.2.3` +- Upgraded to `opener-js@2.2.6` + +## \[2.0.14] + +### Dependencies + +- Upgraded to `log-js@2.2.2` +- Upgraded to `updater-js@2.5.1` + +## \[2.0.13] + +### Dependencies + +- Upgraded to `updater-js@2.5.0` + +## \[2.0.12] + +### Dependencies + +- Upgraded to `clipboard-manager-js@2.2.1` +- Upgraded to `http-js@2.3.0` +- Upgraded to `log-js@2.2.1` +- Upgraded to `updater-js@2.4.0` + +## \[2.0.11] + +### Dependencies + +- Upgraded to `opener-js@2.2.5` + +## \[2.0.10] + +### Dependencies + +- Upgraded to `notification-js@2.2.1` +- Upgraded to `opener-js@2.2.4` + +## \[2.0.9] + +### Dependencies + +- Upgraded to `opener-js@2.2.3` +- Upgraded to `updater-js@2.3.1` + +## \[2.0.8] + +### Dependencies + +- Upgraded to `opener-js@2.2.2` + +## \[2.0.7] + +### Dependencies + +- Upgraded to `updater-js@2.3.0` +- Upgraded to `opener-js@2.2.1` + +## \[2.0.6] + +### Dependencies + +- Upgraded to `barcode-scanner-js@2.1.0` +- Upgraded to `biometric-js@2.1.0` +- Upgraded to `cli-js@2.1.0` +- Upgraded to `clipboard-manager-js@2.1.0` +- Upgraded to `dialog-js@2.1.0` +- Upgraded to `fs-js@2.1.0` +- Upgraded to `global-shortcut-js@2.1.0` +- Upgraded to `http-js@2.1.0` +- Upgraded to `log-js@2.1.0` +- Upgraded to `nfc-js@2.1.0` +- Upgraded to `notification-js@2.1.0` +- Upgraded to `opener-js@2.1.0` +- Upgraded to `os-js@2.1.0` +- Upgraded to `process-js@2.1.0` +- Upgraded to `shell-js@2.1.0` +- Upgraded to `store-js@2.2.0` +- Upgraded to `updater-js@2.1.0` + +## \[2.0.5] + +### Dependencies + +- Upgraded to `fs-js@2.0.4` +- Upgraded to `dialog-js@2.0.2` +- Upgraded to `http-js@2.0.2` + +## \[2.0.4] + +### Dependencies + +- Upgraded to `log-js@2.0.2` + +## \[2.0.3] + +### Dependencies + +- Upgraded to `clipboard-manager-js@2.0.1` +- Upgraded to `log-js@2.0.1` +- Upgraded to `fs-js@2.0.3` +- Upgraded to `opener-js@2.0.0` + +## \[2.0.2] + +### Dependencies + +- Upgraded to `fs-js@2.0.2` + +## \[2.0.1] + +### Dependencies + +- Upgraded to `dialog-js@2.0.1` +- Upgraded to `fs-js@2.0.1` +- Upgraded to `http-js@2.0.1` +- Upgraded to `shell-js@2.0.1` +- Upgraded to `store-js@2.1.0` + +## \[2.0.0] + +- [`e2c4dfb6`](https://github.com/tauri-apps/plugins-workspace/commit/e2c4dfb6af43e5dd8d9ceba232c315f5febd55c1) Update to tauri v2 stable release. + +### Dependencies + +- Upgraded to `barcode-scanner-js@2.0.0` +- Upgraded to `biometric-js@2.0.0` +- Upgraded to `cli-js@2.0.0` +- Upgraded to `clipboard-manager-js@2.0.0` +- Upgraded to `fs-js@2.0.0` +- Upgraded to `dialog-js@2.0.0` +- Upgraded to `global-shortcut-js@2.0.0` +- Upgraded to `http-js@2.0.0` +- Upgraded to `log-js@2.0.0` +- Upgraded to `nfc-js@2.0.0` +- Upgraded to `notification-js@2.0.0` +- Upgraded to `os-js@2.0.0` +- Upgraded to `process-js@2.0.0` +- Upgraded to `shell-js@2.0.0` +- Upgraded to `store-js@2.0.0` +- Upgraded to `updater-js@2.0.0` + +## \[2.0.0-rc.5] + +### Dependencies + +- Upgraded to `store-js@2.0.0-rc.2` + +## \[2.0.0-rc.4] + +### Dependencies + +- Upgraded to `barcode-scanner-js@2.0.0-rc.2` +- Upgraded to `clipboard-manager-js@2.0.0-rc.2` + +## \[2.0.0-rc.3] + +### Dependencies + +- Upgraded to `updater-js@2.0.0-rc.2` + +## \[2.0.0-rc.2] + +### Dependencies + +- Upgraded to `barcode-scanner-js@2.0.0-rc.1` +- Upgraded to `notification-js@2.0.0-rc.1` +- Upgraded to `dialog-js@2.0.0-rc.1` +- Upgraded to `biometric-js@2.0.0-rc.1` +- Upgraded to `cli-js@2.0.0-rc.1` +- Upgraded to `clipboard-manager-js@2.0.0-rc.1` +- Upgraded to `fs-js@2.0.0-rc.2` +- Upgraded to `global-shortcut-js@2.0.0-rc.1` +- Upgraded to `http-js@2.0.0-rc.2` +- Upgraded to `log-js@2.0.0-rc.1` +- Upgraded to `nfc-js@2.0.0-rc.1` +- Upgraded to `os-js@2.0.0-rc.1` +- Upgraded to `process-js@2.0.0-rc.1` +- Upgraded to `shell-js@2.0.0-rc.1` +- Upgraded to `store-js@2.0.0-rc.1` +- Upgraded to `updater-js@2.0.0-rc.1` + +## \[2.0.0-rc.1] + +### Dependencies + +- Upgraded to `http-js@2.0.0-rc.1` +- Upgraded to `fs-js@2.0.0-rc.1` + +## \[2.0.0-rc.0] + +### Dependencies + +- Upgraded to `barcode-scanner-js@2.0.0-rc.0` +- Upgraded to `biometric-js@2.0.0-rc.0` +- Upgraded to `cli-js@2.0.0-rc.0` +- Upgraded to `clipboard-manager-js@2.0.0-rc.0` +- Upgraded to `dialog-js@2.0.0-rc.0` +- Upgraded to `fs-js@2.0.0-rc.0` +- Upgraded to `global-shortcut-js@2.0.0-rc.0` +- Upgraded to `http-js@2.0.0-rc.0` +- Upgraded to `log-js@2.0.0-rc.0` +- Upgraded to `nfc-js@2.0.0-rc.0` +- Upgraded to `notification-js@2.0.0-rc.0` +- Upgraded to `os-js@2.0.0-rc.0` +- Upgraded to `process-js@2.0.0-rc.0` +- Upgraded to `shell-js@2.0.0-rc.0` +- Upgraded to `updater-js@2.0.0-rc.0` + +## \[2.0.0-beta.12] + +### Dependencies + +- Upgraded to `barcode-scanner-js@2.0.0-beta.8` +- Upgraded to `biometric-js@2.0.0-beta.8` +- Upgraded to `cli-js@2.0.0-beta.8` +- Upgraded to `clipboard-manager-js@2.1.0-beta.6` +- Upgraded to `dialog-js@2.0.0-beta.8` +- Upgraded to `fs-js@2.0.0-beta.8` +- Upgraded to `global-shortcut-js@2.0.0-beta.8` +- Upgraded to `http-js@2.0.0-beta.9` +- Upgraded to `log-js@2.0.0-beta.9` +- Upgraded to `nfc-js@2.0.0-beta.8` +- Upgraded to `notification-js@2.0.0-beta.8` +- Upgraded to `os-js@2.0.0-beta.8` +- Upgraded to `process-js@2.0.0-beta.8` +- Upgraded to `shell-js@2.0.0-beta.9` +- Upgraded to `updater-js@2.0.0-beta.8` + +## \[2.0.0-beta.11] + +### Dependencies + +- Upgraded to `global-shortcut-js@2.0.0-beta.7` +- Upgraded to `http-js@2.0.0-beta.8` +- Upgraded to `os-js@2.0.0-beta.7` +- Upgraded to `barcode-scanner-js@2.0.0-beta.7` +- Upgraded to `biometric-js@2.0.0-beta.7` +- Upgraded to `cli-js@2.0.0-beta.7` +- Upgraded to `clipboard-manager-js@2.1.0-beta.5` +- Upgraded to `dialog-js@2.0.0-beta.7` +- Upgraded to `fs-js@2.0.0-beta.7` +- Upgraded to `log-js@2.0.0-beta.8` +- Upgraded to `nfc-js@2.0.0-beta.7` +- Upgraded to `notification-js@2.0.0-beta.7` +- Upgraded to `process-js@2.0.0-beta.7` +- Upgraded to `shell-js@2.0.0-beta.8` +- Upgraded to `updater-js@2.0.0-beta.7` + +## \[2.0.0-beta.10] + +### Dependencies + +- Upgraded to `os-js@2.0.0-beta.6` +- Upgraded to `barcode-scanner-js@2.0.0-beta.6` +- Upgraded to `biometric-js@2.0.0-beta.6` +- Upgraded to `cli-js@2.0.0-beta.6` +- Upgraded to `clipboard-manager-js@2.1.0-beta.4` +- Upgraded to `dialog-js@2.0.0-beta.6` +- Upgraded to `fs-js@2.0.0-beta.6` +- Upgraded to `global-shortcut-js@2.0.0-beta.6` +- Upgraded to `http-js@2.0.0-beta.7` +- Upgraded to `log-js@2.0.0-beta.7` +- Upgraded to `nfc-js@2.0.0-beta.6` +- Upgraded to `notification-js@2.0.0-beta.6` +- Upgraded to `process-js@2.0.0-beta.6` +- Upgraded to `shell-js@2.0.0-beta.7` +- Upgraded to `updater-js@2.0.0-beta.6` + +## \[2.0.0-beta.9] + +### Dependencies + +- Upgraded to `http-js@2.0.0-beta.6` + +## \[2.0.0-beta.8] + +### Dependencies + +- Upgraded to `barcode-scanner-js@2.0.0-beta.5` +- Upgraded to `biometric-js@2.0.0-beta.5` +- Upgraded to `cli-js@2.0.0-beta.5` +- Upgraded to `clipboard-manager-js@2.1.0-beta.3` +- Upgraded to `dialog-js@2.0.0-beta.5` +- Upgraded to `fs-js@2.0.0-beta.5` +- Upgraded to `global-shortcut-js@2.0.0-beta.5` +- Upgraded to `http-js@2.0.0-beta.5` +- Upgraded to `log-js@2.0.0-beta.6` +- Upgraded to `nfc-js@2.0.0-beta.5` +- Upgraded to `notification-js@2.0.0-beta.5` +- Upgraded to `os-js@2.0.0-beta.5` +- Upgraded to `process-js@2.0.0-beta.5` +- Upgraded to `shell-js@2.0.0-beta.6` +- Upgraded to `updater-js@2.0.0-beta.5` + +## \[2.0.0-beta.7] + +### Dependencies + +- Upgraded to `http-js@2.0.0-beta.4` +- Upgraded to `barcode-scanner-js@2.0.0-beta.4` +- Upgraded to `biometric-js@2.0.0-beta.4` +- Upgraded to `cli-js@2.0.0-beta.4` +- Upgraded to `clipboard-manager-js@2.1.0-beta.2` +- Upgraded to `dialog-js@2.0.0-beta.4` +- Upgraded to `fs-js@2.0.0-beta.4` +- Upgraded to `global-shortcut-js@2.0.0-beta.4` +- Upgraded to `log-js@2.0.0-beta.5` +- Upgraded to `nfc-js@2.0.0-beta.4` +- Upgraded to `notification-js@2.0.0-beta.4` +- Upgraded to `os-js@2.0.0-beta.4` +- Upgraded to `process-js@2.0.0-beta.4` +- Upgraded to `shell-js@2.0.0-beta.5` +- Upgraded to `updater-js@2.0.0-beta.4` + +## \[2.0.0-beta.6] + +### Dependencies + +- Upgraded to `shell-js@2.0.0-beta.4` + +## \[2.0.0-beta.5] + +### Dependencies + +- Upgraded to `global-shortcut-js@2.0.0-beta.3` +- Upgraded to `barcode-scanner-js@2.0.0-beta.3` +- Upgraded to `biometric-js@2.0.0-beta.3` +- Upgraded to `cli-js@2.0.0-beta.3` +- Upgraded to `clipboard-manager-js@2.1.0-beta.1` +- Upgraded to `dialog-js@2.0.0-beta.3` +- Upgraded to `fs-js@2.0.0-beta.3` +- Upgraded to `http-js@2.0.0-beta.3` +- Upgraded to `log-js@2.0.0-beta.4` +- Upgraded to `nfc-js@2.0.0-beta.3` +- Upgraded to `notification-js@2.0.0-beta.3` +- Upgraded to `os-js@2.0.0-beta.3` +- Upgraded to `process-js@2.0.0-beta.3` +- Upgraded to `shell-js@2.0.0-beta.3` +- Upgraded to `updater-js@2.0.0-beta.3` + +## \[2.0.0-beta.4] + +### Dependencies + +- Upgraded to `log-js@2.0.0-beta.3` + +## \[2.0.0-beta.3] + +### Dependencies + +- Upgraded to `clipboard-manager-js@2.1.0-beta.0` + +## \[2.0.0-beta.2] + +### Dependencies + +- Upgraded to `clipboard-manager-js@2.0.0-beta.2` +- Upgraded to `dialog-js@2.0.0-beta.2` +- Upgraded to `fs-js@2.0.0-beta.2` +- Upgraded to `http-js@2.0.0-beta.2` +- Upgraded to `shell-js@2.0.0-beta.2` +- Upgraded to `barcode-scanner-js@2.0.0-beta.2` +- Upgraded to `biometric-js@2.0.0-beta.2` +- Upgraded to `cli-js@2.0.0-beta.2` +- Upgraded to `global-shortcut-js@2.0.0-beta.2` +- Upgraded to `log-js@2.0.0-beta.2` +- Upgraded to `nfc-js@2.0.0-beta.2` +- Upgraded to `notification-js@2.0.0-beta.2` +- Upgraded to `os-js@2.0.0-beta.2` +- Upgraded to `process-js@2.0.0-beta.2` +- Upgraded to `updater-js@2.0.0-beta.2` + ## \[2.0.0-beta.1] ### Dependencies diff --git a/examples/api/isolation-dist/index.js b/examples/api/isolation-dist/index.js index 83f35e0d..7e2df30d 100644 --- a/examples/api/isolation-dist/index.js +++ b/examples/api/isolation-dist/index.js @@ -3,5 +3,5 @@ // SPDX-License-Identifier: MIT window.__TAURI_ISOLATION_HOOK__ = (payload) => { - return payload; -}; + return payload +} diff --git a/examples/api/jsconfig.json b/examples/api/jsconfig.json index 42585941..5696a2de 100644 --- a/examples/api/jsconfig.json +++ b/examples/api/jsconfig.json @@ -1,14 +1,14 @@ { "compilerOptions": { - "moduleResolution": "node", - "target": "esnext", - "module": "esnext", + "moduleResolution": "bundler", + "target": "ESNext", + "module": "ESNext", /** * svelte-preprocess cannot figure out whether you have * a value or a type, so tell TypeScript to enforce using * `import type` instead of `import` for Types. */ - "importsNotUsedAsValues": "error", + "verbatimModuleSyntax": true, "isolatedModules": true, "resolveJsonModule": true, /** @@ -18,8 +18,6 @@ "sourceMap": true, "esModuleInterop": true, "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, - "baseUrl": ".", /** * Typecheck JS in `.svelte` and `.js` files by default. * Disable this if you'd like to use dynamic types. diff --git a/examples/api/package.json b/examples/api/package.json index f10d760a..c367cb0b 100644 --- a/examples/api/package.json +++ b/examples/api/package.json @@ -1,40 +1,44 @@ { - "name": "svelte-app", + "name": "api", "private": true, - "version": "2.0.0-beta.1", + "version": "2.0.21", "type": "module", "scripts": { "dev": "vite --clearScreen false", "build": "vite build", - "serve": "vite preview" + "serve": "vite preview", + "tauri": "tauri" }, "dependencies": { - "@tauri-apps/api": "2.0.0-beta.2", - "@tauri-apps/plugin-barcode-scanner": "2.0.0-beta.1", - "@tauri-apps/plugin-biometric": "2.0.0-beta.1", - "@tauri-apps/plugin-cli": "2.0.0-beta.1", - "@tauri-apps/plugin-clipboard-manager": "2.0.0-beta.1", - "@tauri-apps/plugin-dialog": "2.0.0-beta.1", - "@tauri-apps/plugin-fs": "2.0.0-beta.1", - "@tauri-apps/plugin-global-shortcut": "2.0.0-beta.1", - "@tauri-apps/plugin-http": "2.0.0-beta.1", - "@tauri-apps/plugin-nfc": "2.0.0-beta.1", - "@tauri-apps/plugin-notification": "2.0.0-beta.1", - "@tauri-apps/plugin-os": "2.0.0-beta.1", - "@tauri-apps/plugin-process": "2.0.0-beta.1", - "@tauri-apps/plugin-shell": "2.0.0-beta.1", - "@tauri-apps/plugin-updater": "2.0.0-beta.1", - "@zerodevx/svelte-json-view": "1.0.7" + "@tauri-apps/api": "2.5.0", + "@tauri-apps/plugin-barcode-scanner": "^2.2.0", + "@tauri-apps/plugin-biometric": "^2.2.1", + "@tauri-apps/plugin-cli": "^2.2.0", + "@tauri-apps/plugin-clipboard-manager": "^2.2.2", + "@tauri-apps/plugin-dialog": "^2.2.1", + "@tauri-apps/plugin-fs": "^2.2.1", + "@tauri-apps/plugin-geolocation": "^2.2.0", + "@tauri-apps/plugin-global-shortcut": "^2.2.0", + "@tauri-apps/plugin-haptics": "^2.2.0", + "@tauri-apps/plugin-http": "^2.4.3", + "@tauri-apps/plugin-nfc": "^2.2.0", + "@tauri-apps/plugin-notification": "^2.2.2", + "@tauri-apps/plugin-opener": "^2.2.6", + "@tauri-apps/plugin-os": "^2.2.1", + "@tauri-apps/plugin-process": "^2.2.1", + "@tauri-apps/plugin-shell": "^2.2.1", + "@tauri-apps/plugin-store": "^2.2.0", + "@tauri-apps/plugin-updater": "^2.7.1", + "@zerodevx/svelte-json-view": "1.0.11" }, "devDependencies": { - "@iconify-json/codicon": "^1.1.37", - "@iconify-json/ph": "^1.1.8", - "@sveltejs/vite-plugin-svelte": "^3.0.1", - "@tauri-apps/cli": "2.0.0-beta.3", - "@unocss/extractor-svelte": "^0.58.0", - "internal-ip": "^8.0.0", - "svelte": "^4.2.8", - "unocss": "^0.58.0", - "vite": "^5.0.12" + "@iconify-json/codicon": "^1.2.12", + "@iconify-json/ph": "^1.2.2", + "@sveltejs/vite-plugin-svelte": "^5.0.3", + "@tauri-apps/cli": "2.5.0", + "@unocss/extractor-svelte": "^66.0.0", + "svelte": "^5.20.4", + "unocss": "^66.0.0", + "vite": "^6.2.6" } } diff --git a/examples/api/src-tauri/CHANGELOG.md b/examples/api/src-tauri/CHANGELOG.md index 20364e9a..dd85eb10 100644 --- a/examples/api/src-tauri/CHANGELOG.md +++ b/examples/api/src-tauri/CHANGELOG.md @@ -1,5 +1,594 @@ # Changelog +## \[2.0.25] + +### Dependencies + +- Upgraded to `log@2.4.0` +- Upgraded to `biometric@2.2.1` +- Upgraded to `updater@2.7.1` + +## \[2.0.24] + +### Dependencies + +- Upgraded to `http@2.4.3` +- Upgraded to `shell@2.2.1` +- Upgraded to `fs@2.2.1` +- Upgraded to `process@2.2.1` +- Upgraded to `updater@2.7.0` +- Upgraded to `dialog@2.2.1` + +## \[2.0.23] + +### Dependencies + +- Upgraded to `http@2.4.2` +- Upgraded to `updater@2.6.1` + +## \[2.0.22] + +### Dependencies + +- Upgraded to `http@2.4.1` + +## \[2.0.21] + +### Dependencies + +- Upgraded to `log@2.3.1` + +## \[2.0.20] + +### Dependencies + +- Upgraded to `clipboard-manager@2.2.2` +- Upgraded to `geolocation@2.2.4` +- Upgraded to `haptics@2.2.4` +- Upgraded to `notification@2.2.2` +- Upgraded to `os@2.2.1` +- Upgraded to `http@2.4.0` +- Upgraded to `log@2.3.0` +- Upgraded to `updater@2.6.0` + +## \[2.0.19] + +### Dependencies + +- Upgraded to `log@2.2.3` +- Upgraded to `opener@2.2.6` + +## \[2.0.18] + +### Dependencies + +- Upgraded to `log@2.2.2` +- Upgraded to `updater@2.5.1` + +## \[2.0.17] + +### Dependencies + +- Upgraded to `updater@2.5.0` + +## \[2.0.16] + +### Dependencies + +- Upgraded to `clipboard-manager@2.2.1` +- Upgraded to `http@2.3.0` +- Upgraded to `log@2.2.1` +- Upgraded to `updater@2.4.0` + +## \[2.0.15] + +### Dependencies + +- Upgraded to `haptics@2.2.3` +- Upgraded to `geolocation@2.2.3` +- Upgraded to `opener@2.2.5` + +## \[2.0.14] + +### Dependencies + +- Upgraded to `geolocation@2.2.2` +- Upgraded to `haptics@2.2.2` +- Upgraded to `notification@2.2.1` +- Upgraded to `opener@2.2.4` + +## \[2.0.13] + +### Dependencies + +- Upgraded to `geolocation@2.2.1` +- Upgraded to `haptics@2.2.1` + +## \[2.0.12] + +### Dependencies + +- Upgraded to `opener@2.2.3` +- Upgraded to `updater@2.3.1` + +## \[2.0.11] + +### Dependencies + +- Upgraded to `opener@2.2.2` + +## \[2.0.10] + +### Dependencies + +- Upgraded to `updater@2.3.0` +- Upgraded to `opener@2.2.1` + +## \[2.0.9] + +### Dependencies + +- Upgraded to `barcode-scanner@2.1.0` +- Upgraded to `biometric@2.1.0` +- Upgraded to `cli@2.1.0` +- Upgraded to `clipboard-manager@2.1.0` +- Upgraded to `dialog@2.1.0` +- Upgraded to `fs@2.2.0` +- Upgraded to `geolocation@2.1.0` +- Upgraded to `global-shortcut@2.1.0` +- Upgraded to `haptics@2.1.0` +- Upgraded to `http@2.1.0` +- Upgraded to `log@2.1.0` +- Upgraded to `nfc@2.1.0` +- Upgraded to `notification@2.1.0` +- Upgraded to `opener@2.1.0` +- Upgraded to `os@2.1.0` +- Upgraded to `process@2.1.0` +- Upgraded to `shell@2.1.0` +- Upgraded to `store@2.2.0` +- Upgraded to `updater@2.2.0` + +## \[2.0.8] + +### Dependencies + +- Upgraded to `fs@2.1.1` +- Upgraded to `dialog@2.0.5` +- Upgraded to `http@2.0.5` + +## \[2.0.7] + +### Dependencies + +- Upgraded to `log@2.0.4` + +## \[2.0.6] + +### Dependencies + +- Upgraded to `fs@2.1.0` +- Upgraded to `updater@2.1.0` +- Upgraded to `dialog@2.0.4` +- Upgraded to `log-plugin@2.0.3` +- Upgraded to `http@2.0.4` +- Upgraded to `opener@2.0.0` + +## \[2.0.5] + +### Dependencies + +- Upgraded to `clipboard-manager@2.0.2` +- Upgraded to `log-plugin@2.0.2` + +## \[2.0.4] + +### Dependencies + +- Upgraded to `fs@2.0.3` +- Upgraded to `dialog@2.0.3` +- Upgraded to `http@2.0.3` + +## \[2.0.3] + +### Dependencies + +- Upgraded to `dialog@2.0.2` +- Upgraded to `fs@2.0.2` +- Upgraded to `http@2.0.2` +- Upgraded to `shell@2.0.2` +- Upgraded to `store@2.1.0` + +## \[2.0.2] + +- [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7. + +### Dependencies + +- Upgraded to `barcode-scanner@2.0.1` +- Upgraded to `biometric@2.0.1` +- Upgraded to `cli@2.0.1` +- Upgraded to `clipboard-manager@2.0.1` +- Upgraded to `fs@2.0.1` +- Upgraded to `dialog@2.0.1` +- Upgraded to `geolocation@2.0.1` +- Upgraded to `global-shortcut@2.0.1` +- Upgraded to `haptics@2.0.1` +- Upgraded to `http@2.0.1` +- Upgraded to `log-plugin@2.0.1` +- Upgraded to `nfc@2.0.1` +- Upgraded to `notification@2.0.1` +- Upgraded to `os@2.0.1` +- Upgraded to `process@2.0.1` +- Upgraded to `shell@2.0.1` +- Upgraded to `store@2.0.1` +- Upgraded to `updater@2.0.2` + +## \[2.0.1] + +### Dependencies + +- Upgraded to `updater@2.0.1` + +## \[2.0.0] + +- [`e2c4dfb6`](https://github.com/tauri-apps/plugins-workspace/commit/e2c4dfb6af43e5dd8d9ceba232c315f5febd55c1) Update to tauri v2 stable release. + +### Dependencies + +- Upgraded to `barcode-scanner@2.0.0` +- Upgraded to `biometric@2.0.0` +- Upgraded to `cli@2.0.0` +- Upgraded to `clipboard-manager@2.0.0` +- Upgraded to `fs@2.0.0` +- Upgraded to `dialog@2.0.0` +- Upgraded to `global-shortcut@2.0.0` +- Upgraded to `http@2.0.0` +- Upgraded to `log-plugin@2.0.0` +- Upgraded to `nfc@2.0.0` +- Upgraded to `notification@2.0.0` +- Upgraded to `os@2.0.0` +- Upgraded to `process@2.0.0` +- Upgraded to `shell@2.0.0` +- Upgraded to `store@2.0.0` +- Upgraded to `updater@2.0.0` + +## \[2.0.0-rc.8] + +### Dependencies + +- Upgraded to `cli@2.0.0-rc.2` +- Upgraded to `dialog@2.0.0-rc.8` +- Upgraded to `fs@2.0.0-rc.6` +- Upgraded to `shell@2.0.0-rc.4` +- Upgraded to `store@2.0.0-rc.4` +- Upgraded to `updater@2.0.0-rc.4` +- Upgraded to `http@2.0.0-rc.6` + +## \[2.0.0-rc.7] + +### Dependencies + +- Upgraded to `clipboard-manager@2.0.0-rc.4` +- Upgraded to `fs@2.0.0-rc.5` +- Upgraded to `notification@2.0.0-rc.5` +- Upgraded to `dialog@2.0.0-rc.7` +- Upgraded to `http@2.0.0-rc.5` + +## \[2.0.0-rc.6] + +### Dependencies + +- Upgraded to `dialog@2.0.0-rc.6` +- Upgraded to `fs@2.0.0-rc.4` +- Upgraded to `http@2.0.0-rc.4` + +## \[2.0.0-rc.5] + +### Dependencies + +- Upgraded to `barcode-scanner@2.0.0-rc.4` +- Upgraded to `notification@2.0.0-rc.4` + +## \[2.0.0-rc.4] + +### Dependencies + +- Upgraded to `fs@2.0.0-rc.3` +- Upgraded to `dialog@2.0.0-rc.5` +- Upgraded to `updater@2.0.0-rc.3` +- Upgraded to `http@2.0.0-rc.3` + +## \[2.0.0-rc.3] + +### Dependencies + +- Upgraded to `fs@2.0.0-rc.2` +- Upgraded to `dialog@2.0.0-rc.4` +- Upgraded to `http@2.0.0-rc.2` + +## \[2.0.0-rc.2] + +### Dependencies + +- Upgraded to `barcode-scanner@2.0.0-rc.3` +- Upgraded to `notification@2.0.0-rc.3` +- Upgraded to `dialog@2.0.0-rc.3` +- Upgraded to `fs@2.0.0-rc.1` +- Upgraded to `global-shortcut@2.0.0-rc.2` +- Upgraded to `store@2.0.0-rc.3` +- Upgraded to `biometric@2.0.0-rc.3` +- Upgraded to `cli@2.0.0-rc.1` +- Upgraded to `clipboard-manager@2.0.0-rc.3` +- Upgraded to `http@2.0.0-rc.1` +- Upgraded to `log-plugin@2.0.0-rc.2` +- Upgraded to `nfc@2.0.0-rc.3` +- Upgraded to `os@2.0.0-rc.1` +- Upgraded to `process@2.0.0-rc.1` +- Upgraded to `shell@2.0.0-rc.3` +- Upgraded to `updater@2.0.0-rc.2` + +## \[2.0.0-rc.1] + +### Dependencies + +- Upgraded to `barcode-scanner@2.0.0-rc.2` +- Upgraded to `biometric@2.0.0-rc.2` +- Upgraded to `clipboard-manager@2.0.0-rc.2` +- Upgraded to `dialog@2.0.0-rc.2` +- Upgraded to `log-plugin@2.0.0-rc.1` +- Upgraded to `nfc@2.0.0-rc.2` +- Upgraded to `notification@2.0.0-rc.2` +- Upgraded to `shell@2.0.0-rc.2` + +## \[2.0.0-rc.0] + +### Dependencies + +- Upgraded to `dialog@2.0.0-rc.1` +- Upgraded to `updater@2.0.0-rc.1` +- Upgraded to `barcode-scanner@2.0.0-rc.1` +- Upgraded to `clipboard-manager@2.0.0-rc.1` +- Upgraded to `global-shortcut@2.0.0-rc.1` +- Upgraded to `biometric@2.0.0-rc.1` +- Upgraded to `nfc@2.0.0-rc.1` +- Upgraded to `notification@2.0.0-rc.1` +- Upgraded to `shell@2.0.0-rc.1` + +## \[2.0.0-beta.17] + +### Dependencies + +- Upgraded to `barcode-scanner@2.0.0-rc.0` +- Upgraded to `biometric@2.0.0-rc.0` +- Upgraded to `cli@2.0.0-rc.0` +- Upgraded to `clipboard-manager@2.0.0-rc.0` +- Upgraded to `dialog@2.0.0-rc.0` +- Upgraded to `fs@2.0.0-rc.0` +- Upgraded to `global-shortcut@2.0.0-rc.0` +- Upgraded to `http@2.0.0-rc.0` +- Upgraded to `log-plugin@2.0.0-rc.0` +- Upgraded to `nfc@2.0.0-rc.0` +- Upgraded to `notification@2.0.0-rc.0` +- Upgraded to `os@2.0.0-rc.0` +- Upgraded to `process@2.0.0-rc.0` +- Upgraded to `shell@2.0.0-rc.0` +- Upgraded to `updater@2.0.0-rc.0` + +## \[2.0.0-beta.16] + +### Dependencies + +- Upgraded to `fs@2.0.0-beta.12` +- Upgraded to `barcode-scanner@2.0.0-beta.10` +- Upgraded to `biometric@2.0.0-beta.9` +- Upgraded to `cli@2.0.0-beta.9` +- Upgraded to `clipboard-manager@2.1.0-beta.7` +- Upgraded to `dialog@2.0.0-beta.12` +- Upgraded to `global-shortcut@2.0.0-beta.9` +- Upgraded to `http@2.0.0-beta.13` +- Upgraded to `log-plugin@2.0.0-beta.10` +- Upgraded to `nfc@2.0.0-beta.9` +- Upgraded to `notification@2.0.0-beta.12` +- Upgraded to `os@2.0.0-beta.9` +- Upgraded to `process@2.0.0-beta.9` +- Upgraded to `shell@2.0.0-beta.10` +- Upgraded to `updater@2.0.0-beta.12` + +## \[2.0.0-beta.15] + +### Dependencies + +- Upgraded to `log-plugin@2.0.0-beta.9` + +## \[2.0.0-beta.14] + +### Dependencies + +- Upgraded to `notification@2.0.0-beta.11` +- Upgraded to `updater@2.0.0-beta.11` + +## \[2.0.0-beta.13] + +### Dependencies + +- Upgraded to `biometric@2.0.0-beta.8` +- Upgraded to `global-shortcut@2.0.0-beta.8` +- Upgraded to `http@2.0.0-beta.12` +- Upgraded to `barcode-scanner@2.0.0-beta.9` +- Upgraded to `cli@2.0.0-beta.8` +- Upgraded to `clipboard-manager@2.1.0-beta.6` +- Upgraded to `dialog@2.0.0-beta.11` +- Upgraded to `fs@2.0.0-beta.11` +- Upgraded to `log-plugin@2.0.0-beta.8` +- Upgraded to `nfc@2.0.0-beta.8` +- Upgraded to `notification@2.0.0-beta.10` +- Upgraded to `os@2.0.0-beta.8` +- Upgraded to `process@2.0.0-beta.8` +- Upgraded to `shell@2.0.0-beta.9` +- Upgraded to `updater@2.0.0-beta.10` + +## \[2.0.0-beta.12] + +### Dependencies + +- Upgraded to `clipboard-manager@2.1.0-beta.5` +- Upgraded to `fs@2.0.0-beta.10` +- Upgraded to `updater@2.0.0-beta.9` +- Upgraded to `notification@2.0.0-beta.9` +- Upgraded to `os@2.0.0-beta.7` +- Upgraded to `barcode-scanner@2.0.0-beta.8` +- Upgraded to `biometric@2.0.0-beta.7` +- Upgraded to `cli@2.0.0-beta.7` +- Upgraded to `dialog@2.0.0-beta.10` +- Upgraded to `global-shortcut@2.0.0-beta.7` +- Upgraded to `http@2.0.0-beta.11` +- Upgraded to `log-plugin@2.0.0-beta.7` +- Upgraded to `nfc@2.0.0-beta.7` +- Upgraded to `process@2.0.0-beta.7` +- Upgraded to `shell@2.0.0-beta.8` + +## \[2.0.0-beta.11] + +### Dependencies + +- Upgraded to `notification@2.0.0-beta.8` +- Upgraded to `http@2.0.0-beta.10` +- Upgraded to `updater@2.0.0-beta.8` + +## \[2.0.0-beta.10] + +### Dependencies + +- Upgraded to `barcode-scanner@2.0.0-beta.7` +- Upgraded to `biometric@2.0.0-beta.6` +- Upgraded to `clipboard-manager@2.1.0-beta.4` +- Upgraded to `nfc@2.0.0-beta.6` +- Upgraded to `notification@2.0.0-beta.7` +- Upgraded to `shell@2.0.0-beta.7` +- Upgraded to `cli@2.0.0-beta.6` +- Upgraded to `dialog@2.0.0-beta.9` +- Upgraded to `fs@2.0.0-beta.9` +- Upgraded to `global-shortcut@2.0.0-beta.6` +- Upgraded to `http@2.0.0-beta.9` +- Upgraded to `log-plugin@2.0.0-beta.6` +- Upgraded to `os@2.0.0-beta.6` +- Upgraded to `process@2.0.0-beta.6` +- Upgraded to `updater@2.0.0-beta.7` + +## \[2.0.0-beta.9] + +### Dependencies + +- Upgraded to `clipboard-manager@2.1.0-beta.3` +- Upgraded to `dialog@2.0.0-beta.8` +- Upgraded to `http@2.0.0-beta.8` +- Upgraded to `notification@2.0.0-beta.6` +- Upgraded to `shell@2.0.0-beta.6` +- Upgraded to `barcode-scanner@2.0.0-beta.6` +- Upgraded to `biometric@2.0.0-beta.5` +- Upgraded to `nfc@2.0.0-beta.5` +- Upgraded to `cli@2.0.0-beta.5` +- Upgraded to `fs@2.0.0-beta.8` +- Upgraded to `global-shortcut@2.0.0-beta.5` +- Upgraded to `log-plugin@2.0.0-beta.5` +- Upgraded to `os@2.0.0-beta.5` +- Upgraded to `process@2.0.0-beta.5` +- Upgraded to `updater@2.0.0-beta.6` + +## \[2.0.0-beta.8] + +### Dependencies + +- Upgraded to `shell@2.0.0-beta.5` + +## \[2.0.0-beta.7] + +### Dependencies + +- Upgraded to `clipboard-manager@2.1.0-beta.2` +- Upgraded to `global-shortcut@2.0.0-beta.4` +- Upgraded to `barcode-scanner@2.0.0-beta.5` +- Upgraded to `biometric@2.0.0-beta.4` +- Upgraded to `cli@2.0.0-beta.4` +- Upgraded to `dialog@2.0.0-beta.7` +- Upgraded to `fs@2.0.0-beta.7` +- Upgraded to `http@2.0.0-beta.7` +- Upgraded to `log-plugin@2.0.0-beta.4` +- Upgraded to `nfc@2.0.0-beta.4` +- Upgraded to `notification@2.0.0-beta.5` +- Upgraded to `os@2.0.0-beta.4` +- Upgraded to `process@2.0.0-beta.4` +- Upgraded to `shell@2.0.0-beta.4` +- Upgraded to `updater@2.0.0-beta.5` + +## \[2.0.0-beta.6] + +### Dependencies + +- Upgraded to `notification@2.0.0-beta.4` +- Upgraded to `barcode-scanner@2.0.0-beta.4` +- Upgraded to `dialog@2.0.0-beta.6` +- Upgraded to `fs@2.0.0-beta.6` +- Upgraded to `http@2.0.0-beta.6` + +## \[2.0.0-beta.5] + +### Dependencies + +- Upgraded to `clipboard-manager@2.1.0-beta.1` +- Upgraded to `http@2.0.0-beta.5` +- Upgraded to `updater@2.0.0-beta.4` +- Upgraded to `dialog@2.0.0-beta.5` +- Upgraded to `fs@2.0.0-beta.5` + +## \[2.0.0-beta.4] + +### Dependencies + +- Upgraded to `dialog@2.0.0-beta.4` +- Upgraded to `fs@2.0.0-beta.4` +- Upgraded to `http@2.0.0-beta.4` + +## \[2.0.0-beta.3] + +### Dependencies + +- Upgraded to `clipboard-manager@2.1.0-beta.0` +- Upgraded to `dialog@2.0.0-beta.3` +- Upgraded to `fs@2.0.0-beta.3` +- Upgraded to `http@2.0.0-beta.3` +- Upgraded to `updater@2.0.0-beta.3` +- Upgraded to `barcode-scanner@2.0.0-beta.3` +- Upgraded to `biometric@2.0.0-beta.3` +- Upgraded to `cli@2.0.0-beta.3` +- Upgraded to `global-shortcut@2.0.0-beta.3` +- Upgraded to `log-plugin@2.0.0-beta.3` +- Upgraded to `nfc@2.0.0-beta.3` +- Upgraded to `notification@2.0.0-beta.3` +- Upgraded to `os@2.0.0-beta.3` +- Upgraded to `process@2.0.0-beta.3` +- Upgraded to `shell@2.0.0-beta.3` + +## \[2.0.0-beta.2] + +### Dependencies + +- Upgraded to `clipboard-manager@2.0.0-beta.2` +- Upgraded to `dialog@2.0.0-beta.2` +- Upgraded to `http@2.0.0-beta.2` +- Upgraded to `fs@2.0.0-beta.2` +- Upgraded to `shell@2.0.0-beta.2` +- Upgraded to `barcode-scanner@2.0.0-beta.2` +- Upgraded to `biometric@2.0.0-beta.2` +- Upgraded to `cli@2.0.0-beta.2` +- Upgraded to `global-shortcut@2.0.0-beta.2` +- Upgraded to `log-plugin@2.0.0-beta.2` +- Upgraded to `nfc@2.0.0-beta.2` +- Upgraded to `notification@2.0.0-beta.2` +- Upgraded to `os@2.0.0-beta.2` +- Upgraded to `process@2.0.0-beta.2` +- Upgraded to `updater@2.0.0-beta.2` + ## \[2.0.0-beta.1] ### Dependencies diff --git a/examples/api/src-tauri/Cargo.toml b/examples/api/src-tauri/Cargo.toml index 9b0891c2..2faf175f 100644 --- a/examples/api/src-tauri/Cargo.toml +++ b/examples/api/src-tauri/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "api" publish = false -version = "2.0.0-beta.1" +version = "2.0.25" description = "An example Tauri Application showcasing the api" edition = "2021" rust-version = { workspace = true } @@ -9,49 +9,61 @@ license = "Apache-2.0 OR MIT" [lib] name = "api_lib" -crate-type = [ "staticlib", "cdylib", "rlib" ] +crate-type = ["staticlib", "cdylib", "rlib"] [build-dependencies] -tauri-build = { workspace = true, features = [ "codegen", "isolation" ] } +tauri-build = { workspace = true, features = ["codegen", "isolation"] } [dependencies] serde_json = { workspace = true } serde = { workspace = true } -tiny_http = "0.11" +tiny_http = "0.12" +time = "0.3" log = { workspace = true } -tauri-plugin-log = { path = "../../../plugins/log", version = "2.0.0-beta.1" } -tauri-plugin-fs = { path = "../../../plugins/fs", version = "2.0.0-beta.1", features = [ "watch" ] } -tauri-plugin-clipboard-manager = { path = "../../../plugins/clipboard-manager", version = "2.0.0-beta.1" } -tauri-plugin-dialog = { path = "../../../plugins/dialog", version = "2.0.0-beta.1" } -tauri-plugin-http = { path = "../../../plugins/http", features = [ "multipart" ], version = "2.0.0-beta.1" } -tauri-plugin-notification = { path = "../../../plugins/notification", version = "2.0.0-beta.1", features = [ "windows7-compat" ] } -tauri-plugin-os = { path = "../../../plugins/os", version = "2.0.0-beta.1" } -tauri-plugin-process = { path = "../../../plugins/process", version = "2.0.0-beta.1" } -tauri-plugin-shell = { path = "../../../plugins/shell", version = "2.0.0-beta.1" } +tauri-plugin-log = { path = "../../../plugins/log", version = "2.4.0" } +tauri-plugin-fs = { path = "../../../plugins/fs", version = "2.2.1", features = [ + "watch", +] } +tauri-plugin-clipboard-manager = { path = "../../../plugins/clipboard-manager", version = "2.2.2" } +tauri-plugin-dialog = { path = "../../../plugins/dialog", version = "2.2.1" } +tauri-plugin-http = { path = "../../../plugins/http", features = [ + "multipart", + "cookies", +], version = "2.4.3" } +tauri-plugin-notification = { path = "../../../plugins/notification", version = "2.2.2", features = [ + "windows7-compat", +] } +tauri-plugin-os = { path = "../../../plugins/os", version = "2.2.1" } +tauri-plugin-process = { path = "../../../plugins/process", version = "2.2.1" } +tauri-plugin-opener = { path = "../../../plugins/opener", version = "2.2.6" } +tauri-plugin-shell = { path = "../../../plugins/shell", version = "2.2.1" } +tauri-plugin-store = { path = "../../../plugins/store", version = "2.2.0" } - [dependencies.tauri] - workspace = true - features = [ - "icon-ico", - "icon-png", +[dependencies.tauri] +workspace = true +features = [ + "wry", + "compression", + "image-ico", + "image-png", "isolation", "macos-private-api", "tray-icon", - "protocol-asset" + "protocol-asset", ] [target."cfg(any(target_os = \"macos\", windows, target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies] -tauri-plugin-cli = { path = "../../../plugins/cli", version = "2.0.0-beta.1" } -tauri-plugin-global-shortcut = { path = "../../../plugins/global-shortcut", version = "2.0.0-beta.1" } -tauri-plugin-updater = { path = "../../../plugins/updater", version = "2.0.0-beta.1" } +tauri-plugin-cli = { path = "../../../plugins/cli", version = "2.2.0" } +tauri-plugin-global-shortcut = { path = "../../../plugins/global-shortcut", version = "2.2.0" } +tauri-plugin-updater = { path = "../../../plugins/updater", version = "2.7.1" } +tauri-plugin-window-state = { path = "../../../plugins/window-state", version = "2.2.0" } [target."cfg(any(target_os = \"android\", target_os = \"ios\"))".dependencies] -tauri-plugin-barcode-scanner = { path = "../../../plugins/barcode-scanner/", version = "2.0.0-beta.1" } -tauri-plugin-nfc = { path = "../../../plugins/nfc", version = "2.0.0-beta.1" } -tauri-plugin-biometric = { path = "../../../plugins/biometric/", version = "2.0.0-beta.1" } - -[target."cfg(target_os = \"windows\")".dependencies] -window-shadows = "0.2" +tauri-plugin-barcode-scanner = { path = "../../../plugins/barcode-scanner/", version = "2.2.0" } +tauri-plugin-nfc = { path = "../../../plugins/nfc", version = "2.2.0" } +tauri-plugin-biometric = { path = "../../../plugins/biometric/", version = "2.2.1" } +tauri-plugin-geolocation = { path = "../../../plugins/geolocation/", version = "2.2.4" } +tauri-plugin-haptics = { path = "../../../plugins/haptics/", version = "2.2.4" } [features] -custom-protocol = [ "tauri/custom-protocol" ] +prod = ["tauri/custom-protocol"] diff --git a/examples/api/src-tauri/Info.plist b/examples/api/src-tauri/Info.plist index fe253ec7..4dcd6aca 100644 --- a/examples/api/src-tauri/Info.plist +++ b/examples/api/src-tauri/Info.plist @@ -1,10 +1,14 @@ - - NSCameraUsageDescription - Request camera access for WebRTC - NSMicrophoneUsageDescription - Request microphone access for WebRTC - + + NSCameraUsageDescription + Request camera access for WebRTC + NSMicrophoneUsageDescription + Request microphone access for WebRTC + NSFaceIDUsageDescription + Authenticate with biometrics + NFCReaderUsageDescription + Read and write to NFC tags for testing + diff --git a/examples/api/src-tauri/build.rs b/examples/api/src-tauri/build.rs index 322bc7bf..88537dde 100644 --- a/examples/api/src-tauri/build.rs +++ b/examples/api/src-tauri/build.rs @@ -3,11 +3,5 @@ // SPDX-License-Identifier: MIT fn main() { - let mut codegen = tauri_build::CodegenContext::new(); - if !cfg!(feature = "custom-protocol") { - codegen = codegen.dev(); - } - - tauri_build::try_build(tauri_build::Attributes::new().codegen(codegen)) - .expect("failed to run tauri_build::try_build"); + tauri_build::build(); } diff --git a/examples/api/src-tauri/capabilities/base.json b/examples/api/src-tauri/capabilities/base.json index f34be5ec..cefc4d8a 100644 --- a/examples/api/src-tauri/capabilities/base.json +++ b/examples/api/src-tauri/capabilities/base.json @@ -8,27 +8,28 @@ { "identifier": "http:default", "allow": [ + "https://tauri.app", { "url": "http://localhost:3003" } ] }, - "app:default", - "resources:default", + "core:default", "fs:default", - "menu:default", - "path:default", - "tray:default", - "event:default", - "window:default", + "core:window:allow-minimize", + "core:window:allow-maximize", + "core:window:allow-unmaximize", + "core:window:allow-close", + "core:window:allow-start-dragging", "notification:default", "os:allow-platform", "dialog:allow-open", + "dialog:allow-ask", "dialog:allow-save", "dialog:allow-confirm", "dialog:allow-message", { - "identifier": "shell:allow-execute", + "identifier": "shell:allow-spawn", "allow": [ { "name": "sh", @@ -36,7 +37,7 @@ "args": [ "-c", { - "validator": "\\S+" + "validator": ".+" } ] }, @@ -46,20 +47,29 @@ "args": [ "/C", { - "validator": "\\S+" + "validator": ".+" } ] } ] }, + "shell:default", "shell:allow-kill", "shell:allow-stdin-write", - "clipboard-manager:allow-read", - "clipboard-manager:allow-write", + "process:allow-exit", + "process:allow-restart", + "clipboard-manager:allow-read-text", + "clipboard-manager:allow-write-text", + "clipboard-manager:allow-read-image", + "clipboard-manager:allow-write-image", + "fs:allow-open", + "fs:allow-write", + "fs:allow-read", "fs:allow-rename", "fs:allow-mkdir", "fs:allow-remove", "fs:allow-write-text-file", + "fs:read-meta", "fs:scope-download-recursive", "fs:scope-resource-recursive", { @@ -69,11 +79,13 @@ "path": "$APPDATA/db/**" } ], - "deny": [ - { - "path": "$APPDATA/db/*.stronghold" - } - ] + "deny": ["$APPDATA/db/*.stronghold"] + }, + "store:default", + "opener:default", + { + "identifier": "opener:allow-open-path", + "allow": [{ "path": "$APPDATA" }, { "path": "$APPDATA/**" }] } ] } diff --git a/examples/api/src-tauri/capabilities/desktop.json b/examples/api/src-tauri/capabilities/desktop.json index 2edd44cd..82d8354f 100644 --- a/examples/api/src-tauri/capabilities/desktop.json +++ b/examples/api/src-tauri/capabilities/desktop.json @@ -9,6 +9,8 @@ "updater:default", "global-shortcut:allow-unregister", "global-shortcut:allow-register", - "global-shortcut:allow-unregister-all" + "global-shortcut:allow-unregister-all", + { "identifier": "fs:allow-watch", "allow": ["*", "**/*"] }, + "fs:allow-unwatch" ] } diff --git a/examples/api/src-tauri/capabilities/mobile.json b/examples/api/src-tauri/capabilities/mobile.json index 40f547ff..da77f5e5 100644 --- a/examples/api/src-tauri/capabilities/mobile.json +++ b/examples/api/src-tauri/capabilities/mobile.json @@ -11,6 +11,14 @@ "barcode-scanner:allow-scan", "barcode-scanner:allow-cancel", "barcode-scanner:allow-request-permissions", - "barcode-scanner:allow-check-permissions" + "barcode-scanner:allow-check-permissions", + "geolocation:allow-check-permissions", + "geolocation:allow-request-permissions", + "geolocation:allow-watch-position", + "geolocation:allow-get-current-position", + "haptics:allow-impact-feedback", + "haptics:allow-notification-feedback", + "haptics:allow-selection-feedback", + "haptics:allow-vibrate" ] } diff --git a/examples/api/src-tauri/gen/android/.idea/.gitignore b/examples/api/src-tauri/gen/android/.idea/.gitignore deleted file mode 100644 index 26d33521..00000000 --- a/examples/api/src-tauri/gen/android/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/examples/api/src-tauri/gen/android/.idea/gradle.xml b/examples/api/src-tauri/gen/android/.idea/gradle.xml index 692c9e58..ff118549 100644 --- a/examples/api/src-tauri/gen/android/.idea/gradle.xml +++ b/examples/api/src-tauri/gen/android/.idea/gradle.xml @@ -4,13 +4,22 @@ diff --git a/examples/api/src-tauri/gen/android/.idea/jarRepositories.xml b/examples/api/src-tauri/gen/android/.idea/jarRepositories.xml deleted file mode 100644 index d2ce72d1..00000000 --- a/examples/api/src-tauri/gen/android/.idea/jarRepositories.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/examples/api/src-tauri/gen/android/.idea/kotlinc.xml b/examples/api/src-tauri/gen/android/.idea/kotlinc.xml index 0fc31131..4cb74572 100644 --- a/examples/api/src-tauri/gen/android/.idea/kotlinc.xml +++ b/examples/api/src-tauri/gen/android/.idea/kotlinc.xml @@ -1,6 +1,6 @@ - \ No newline at end of file diff --git a/examples/api/src-tauri/gen/android/.idea/misc.xml b/examples/api/src-tauri/gen/android/.idea/misc.xml index 0ad17cbd..8978d23d 100644 --- a/examples/api/src-tauri/gen/android/.idea/misc.xml +++ b/examples/api/src-tauri/gen/android/.idea/misc.xml @@ -1,4 +1,3 @@ - diff --git a/examples/api/src-tauri/gen/android/app/.gitignore b/examples/api/src-tauri/gen/android/app/.gitignore index ff9cb538..4008dd74 100644 --- a/examples/api/src-tauri/gen/android/app/.gitignore +++ b/examples/api/src-tauri/gen/android/app/.gitignore @@ -2,4 +2,5 @@ /src/main/jniLibs/**/*.so /src/main/assets/tauri.conf.json /tauri.build.gradle.kts -/proguard-tauri.pro \ No newline at end of file +/proguard-tauri.pro +/tauri.properties \ No newline at end of file diff --git a/examples/api/src-tauri/gen/android/app/build.gradle.kts b/examples/api/src-tauri/gen/android/app/build.gradle.kts index e3de36fd..f7047ca0 100644 --- a/examples/api/src-tauri/gen/android/app/build.gradle.kts +++ b/examples/api/src-tauri/gen/android/app/build.gradle.kts @@ -1,19 +1,28 @@ +import java.util.Properties + plugins { id("com.android.application") id("org.jetbrains.kotlin.android") id("rust") } +val tauriProperties = Properties().apply { + val propFile = file("tauri.properties") + if (propFile.exists()) { + propFile.inputStream().use { load(it) } + } +} + android { - compileSdk = 33 + compileSdk = 34 namespace = "com.tauri.api" defaultConfig { manifestPlaceholders["usesCleartextTraffic"] = "false" applicationId = "com.tauri.api" minSdk = 24 - targetSdk = 33 - versionCode = 1 - versionName = "1.0" + targetSdk = 34 + versionCode = tauriProperties.getProperty("tauri.android.versionCode", "1").toInt() + versionName = tauriProperties.getProperty("tauri.android.versionName", "1.0") } buildTypes { getByName("debug") { @@ -39,6 +48,9 @@ android { kotlinOptions { jvmTarget = "1.8" } + buildFeatures { + buildConfig = true + } } rust { @@ -54,4 +66,4 @@ dependencies { androidTestImplementation("androidx.test.espresso:espresso-core:3.5.0") } -apply(from = "tauri.build.gradle.kts") +apply(from = "tauri.build.gradle.kts") \ No newline at end of file diff --git a/examples/api/src-tauri/gen/android/app/src/main/AndroidManifest.xml b/examples/api/src-tauri/gen/android/app/src/main/AndroidManifest.xml index 4679a745..8ebe7c4b 100644 --- a/examples/api/src-tauri/gen/android/app/src/main/AndroidManifest.xml +++ b/examples/api/src-tauri/gen/android/app/src/main/AndroidManifest.xml @@ -1,7 +1,10 @@ - + + + + + + diff --git a/examples/api/src-tauri/gen/android/app/src/main/java/com/tauri/api/MainActivity.kt b/examples/api/src-tauri/gen/android/app/src/main/java/com/tauri/api/MainActivity.kt index ad3fa238..0a05f42b 100644 --- a/examples/api/src-tauri/gen/android/app/src/main/java/com/tauri/api/MainActivity.kt +++ b/examples/api/src-tauri/gen/android/app/src/main/java/com/tauri/api/MainActivity.kt @@ -1,3 +1,3 @@ package com.tauri.api -class MainActivity : TauriActivity() +class MainActivity : TauriActivity() \ No newline at end of file diff --git a/examples/api/src-tauri/gen/android/build.gradle.kts b/examples/api/src-tauri/gen/android/build.gradle.kts index 5ce764e3..c5ef452a 100644 --- a/examples/api/src-tauri/gen/android/build.gradle.kts +++ b/examples/api/src-tauri/gen/android/build.gradle.kts @@ -4,8 +4,8 @@ buildscript { mavenCentral() } dependencies { - classpath("com.android.tools.build:gradle:8.0.0") - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21") + classpath("com.android.tools.build:gradle:8.5.1") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.25") } } diff --git a/examples/api/src-tauri/gen/android/buildSrc/build.gradle.kts b/examples/api/src-tauri/gen/android/buildSrc/build.gradle.kts index 099feff7..39e90b05 100644 --- a/examples/api/src-tauri/gen/android/buildSrc/build.gradle.kts +++ b/examples/api/src-tauri/gen/android/buildSrc/build.gradle.kts @@ -18,6 +18,6 @@ repositories { dependencies { compileOnly(gradleApi()) - implementation("com.android.tools.build:gradle:8.0.0") + implementation("com.android.tools.build:gradle:8.5.1") } diff --git a/examples/api/src-tauri/gen/android/buildSrc/src/main/java/com/tauri/api/kotlin/BuildTask.kt b/examples/api/src-tauri/gen/android/buildSrc/src/main/java/com/tauri/api/kotlin/BuildTask.kt index 2ad998b1..f9874825 100644 --- a/examples/api/src-tauri/gen/android/buildSrc/src/main/java/com/tauri/api/kotlin/BuildTask.kt +++ b/examples/api/src-tauri/gen/android/buildSrc/src/main/java/com/tauri/api/kotlin/BuildTask.kt @@ -16,7 +16,7 @@ open class BuildTask : DefaultTask() { @TaskAction fun assemble() { - val executable = """node"""; + val executable = """pnpm"""; try { runTauriCli(executable) } catch (e: Exception) { @@ -32,7 +32,7 @@ open class BuildTask : DefaultTask() { val rootDirRel = rootDirRel ?: throw GradleException("rootDirRel cannot be null") val target = target ?: throw GradleException("target cannot be null") val release = release ?: throw GradleException("release cannot be null") - val args = listOf("../node_modules/.bin/../@tauri-apps/cli/tauri.js", "android", "android-studio-script"); + val args = listOf("tauri", "android", "android-studio-script"); project.exec { workingDir(File(project.projectDir, rootDirRel)) diff --git a/examples/api/src-tauri/gen/android/gradle.properties b/examples/api/src-tauri/gen/android/gradle.properties index 022338b7..2a7ec695 100644 --- a/examples/api/src-tauri/gen/android/gradle.properties +++ b/examples/api/src-tauri/gen/android/gradle.properties @@ -21,5 +21,4 @@ kotlin.code.style=official # resources declared in the library itself and none from the library's dependencies, # thereby reducing the size of the R class for that library android.nonTransitiveRClass=true -android.defaults.buildfeatures.buildconfig=true android.nonFinalResIds=false \ No newline at end of file diff --git a/examples/api/src-tauri/gen/android/gradle/wrapper/gradle-wrapper.properties b/examples/api/src-tauri/gen/android/gradle/wrapper/gradle-wrapper.properties index 40a43506..0df10d55 100644 --- a/examples/api/src-tauri/gen/android/gradle/wrapper/gradle-wrapper.properties +++ b/examples/api/src-tauri/gen/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Tue May 10 19:22:52 CST 2022 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/examples/api/src-tauri/gen/android/gradlew.bat b/examples/api/src-tauri/gen/android/gradlew.bat index ac1b06f9..107acd32 100644 --- a/examples/api/src-tauri/gen/android/gradlew.bat +++ b/examples/api/src-tauri/gen/android/gradlew.bat @@ -1,89 +1,89 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@1x.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@1x.png index f8b128e3..a6ac2a8c 100644 Binary files a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@1x.png and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@1x.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x-1.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x-1.png index 6bbd9e3c..2869541f 100644 Binary files a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x-1.png and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x-1.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x.png index 6bbd9e3c..2869541f 100644 Binary files a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x.png and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@3x.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@3x.png index f702cc04..cf265a45 100644 Binary files a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@3x.png and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@3x.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@1x.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@1x.png index c5e92f78..29c9746c 100644 Binary files a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@1x.png and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@1x.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x-1.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x-1.png index 1c607d5c..a4e68c8d 100644 Binary files a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x-1.png and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x-1.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x.png index 1c607d5c..a4e68c8d 100644 Binary files a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x.png and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@3x.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@3x.png index 60e93a6a..e4adcbce 100644 Binary files a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@3x.png and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@3x.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@1x.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@1x.png index 6bbd9e3c..2869541f 100644 Binary files a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@1x.png and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@1x.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x-1.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x-1.png index 819410f9..a414e65b 100644 Binary files a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x-1.png and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x-1.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x.png index 819410f9..a414e65b 100644 Binary files a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x.png and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@3x.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@3x.png index e00ae5a6..a0807e5d 100644 Binary files a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@3x.png and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@3x.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png index f5301f37..704c9291 100644 Binary files a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-512x512@2x.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-512x512@2x.png deleted file mode 100644 index 5e9add73..00000000 Binary files a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-512x512@2x.png and /dev/null differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@2x.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@2x.png index e00ae5a6..a0807e5d 100644 Binary files a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@2x.png and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@2x.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@3x.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@3x.png index 3546ca10..2a9fbc26 100644 Binary files a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@3x.png and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@3x.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@1x.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@1x.png index d8367101..2cdf1848 100644 Binary files a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@1x.png and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@1x.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@2x.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@2x.png index 29925f2a..4723e4b4 100644 Binary files a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@2x.png and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@2x.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-83.5x83.5@2x.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-83.5x83.5@2x.png index dfd22619..f26fee45 100644 Binary files a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-83.5x83.5@2x.png and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-83.5x83.5@2x.png differ diff --git a/examples/api/src-tauri/gen/apple/ExportOptions.plist b/examples/api/src-tauri/gen/apple/ExportOptions.plist index b69cf1de..0428a171 100644 --- a/examples/api/src-tauri/gen/apple/ExportOptions.plist +++ b/examples/api/src-tauri/gen/apple/ExportOptions.plist @@ -3,6 +3,6 @@ method - development + debugging diff --git a/examples/api/src-tauri/gen/apple/LaunchScreen.storyboard b/examples/api/src-tauri/gen/apple/LaunchScreen.storyboard new file mode 100644 index 00000000..dd79351e --- /dev/null +++ b/examples/api/src-tauri/gen/apple/LaunchScreen.storyboard @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/api/src-tauri/gen/apple/api.xcodeproj/project.pbxproj b/examples/api/src-tauri/gen/apple/api.xcodeproj/project.pbxproj index 8528f099..64ef20a8 100644 --- a/examples/api/src-tauri/gen/apple/api.xcodeproj/project.pbxproj +++ b/examples/api/src-tauri/gen/apple/api.xcodeproj/project.pbxproj @@ -3,16 +3,17 @@ archiveVersion = 1; classes = { }; - objectVersion = 51; + objectVersion = 56; objects = { /* Begin PBXBuildFile section */ - 2ECFC1BC47D948875C8CEC41 /* libapi.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FC53D4128D7F74E4E6338455 /* libapi.a */; }; 3043432501C9BC2DB6B4CB95 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 71EB788DE4662CFC0D97F567 /* CoreGraphics.framework */; }; 328B4ADB3700C1873BEB7B10 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = 90D3B673AFAB8D8AB561F616 /* main.mm */; }; 6F379F15DA085785BA2624D4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6B7E79E23E646BA7968B457C /* Assets.xcassets */; }; + 832F9A55FEDEF3D807D8C40A /* libapp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 248286BAA086BB1A5F98B2B2 /* libapp.a */; }; 9AADB041D25772D04E543F15 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 62601E25FA39E62BE119B74D /* Metal.framework */; }; 9DDA3BE70DD0E4013973FE38 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B6082E363D51372A7658C351 /* UIKit.framework */; }; + AC8BDC2C7A63FA3FDC5967F4 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4B2D1B108AE002010BDEC6D2 /* LaunchScreen.storyboard */; }; AFA0CA286325FD7A34968CA2 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 384966E551417F94A02D2706 /* Security.framework */; }; B60763BD194DFACA215EC7DA /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC377692DC31A070A0188C9D /* QuartzCore.framework */; }; C6D80743F168BDF017B7769E /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 59CFE20DCF760BE67D9CE3D6 /* WebKit.framework */; }; @@ -21,25 +22,26 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 0E96CE07CD20273DD46BF325 /* main.rs */ = {isa = PBXFileReference; path = main.rs; sourceTree = ""; }; - 1C1AB1B414CA2795AFBEDDB9 /* tray.rs */ = {isa = PBXFileReference; path = tray.rs; sourceTree = ""; }; + 0E96CE07CD20273DD46BF325 /* main.rs */ = {isa = PBXFileReference; lastKnownFileType = text; path = main.rs; sourceTree = ""; }; + 1C1AB1B414CA2795AFBEDDB9 /* tray.rs */ = {isa = PBXFileReference; lastKnownFileType = text; path = tray.rs; sourceTree = ""; }; + 248286BAA086BB1A5F98B2B2 /* libapp.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libapp.a; sourceTree = ""; }; 2F63E2AA460089BB58D40C79 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; 338E66700FD330B99D434DD7 /* MetalKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MetalKit.framework; path = System/Library/Frameworks/MetalKit.framework; sourceTree = SDKROOT; }; 384966E551417F94A02D2706 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; + 4B2D1B108AE002010BDEC6D2 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = ""; }; 59CFE20DCF760BE67D9CE3D6 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; - 5AC703CEBA41A121596066F3 /* api_iOS.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = api_iOS.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 5AC703CEBA41A121596066F3 /* Tauri API.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Tauri API.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 62601E25FA39E62BE119B74D /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = System/Library/Frameworks/Metal.framework; sourceTree = SDKROOT; }; 6B7E79E23E646BA7968B457C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 71EB788DE4662CFC0D97F567 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 74A8FDFB350B966F5AAD4A24 /* assets */ = {isa = PBXFileReference; lastKnownFileType = folder; path = assets; sourceTree = SOURCE_ROOT; }; - 785D025E9542F7E098BF22B5 /* lib.rs */ = {isa = PBXFileReference; path = lib.rs; sourceTree = ""; }; + 785D025E9542F7E098BF22B5 /* lib.rs */ = {isa = PBXFileReference; lastKnownFileType = text; path = lib.rs; sourceTree = ""; }; 879941AE3DAA14534BBC6391 /* api_iOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = api_iOS.entitlements; sourceTree = ""; }; 90D3B673AFAB8D8AB561F616 /* main.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = ""; }; B6082E363D51372A7658C351 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; DC377692DC31A070A0188C9D /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; EC8C7948C50C3C9B5D96CB61 /* bindings.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = bindings.h; sourceTree = ""; }; - F835F52713CE8F029D5D252C /* cmd.rs */ = {isa = PBXFileReference; path = cmd.rs; sourceTree = ""; }; - FC53D4128D7F74E4E6338455 /* libapi.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libapi.a; sourceTree = ""; }; + F835F52713CE8F029D5D252C /* cmd.rs */ = {isa = PBXFileReference; lastKnownFileType = text; path = cmd.rs; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -47,7 +49,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 2ECFC1BC47D948875C8CEC41 /* libapi.a in Frameworks */, + 832F9A55FEDEF3D807D8C40A /* libapp.a in Frameworks */, 3043432501C9BC2DB6B4CB95 /* CoreGraphics.framework in Frameworks */, 9AADB041D25772D04E543F15 /* Metal.framework in Frameworks */, DFFF888045C8D9D9FB69E8FD /* MetalKit.framework in Frameworks */, @@ -66,6 +68,7 @@ children = ( 74A8FDFB350B966F5AAD4A24 /* assets */, 6B7E79E23E646BA7968B457C /* Assets.xcassets */, + 4B2D1B108AE002010BDEC6D2 /* LaunchScreen.storyboard */, F2116A6428EED18BE2A07E2B /* api_iOS */, 86D903732E10FAC4D300E8DF /* Externals */, 7A9A7AC155D9E22E54D6D847 /* Sources */, @@ -87,7 +90,7 @@ isa = PBXGroup; children = ( 71EB788DE4662CFC0D97F567 /* CoreGraphics.framework */, - FC53D4128D7F74E4E6338455 /* libapi.a */, + 248286BAA086BB1A5F98B2B2 /* libapp.a */, 62601E25FA39E62BE119B74D /* Metal.framework */, 338E66700FD330B99D434DD7 /* MetalKit.framework */, DC377692DC31A070A0188C9D /* QuartzCore.framework */, @@ -101,7 +104,7 @@ 4AC51E67B71E27F15B02C5CD /* Products */ = { isa = PBXGroup; children = ( - 5AC703CEBA41A121596066F3 /* api_iOS.app */, + 5AC703CEBA41A121596066F3 /* Tauri API.app */, ); name = Products; sourceTree = ""; @@ -169,7 +172,7 @@ ); name = api_iOS; productName = api_iOS; - productReference = 5AC703CEBA41A121596066F3 /* api_iOS.app */; + productReference = 5AC703CEBA41A121596066F3 /* Tauri API.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ @@ -178,7 +181,8 @@ 9BC88C3717DA5D4B78A51C15 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1200; + BuildIndependentTargetsInParallel = YES; + LastUpgradeCheck = 1430; TargetAttributes = { 54DC6E273C78071F3BA12EF3 = { DevelopmentTeam = Q93MBH6S2F; @@ -186,7 +190,7 @@ }; }; buildConfigurationList = 8FA67D0F928A09CD639137D1 /* Build configuration list for PBXProject "api" */; - compatibilityVersion = "Xcode 11.0"; + compatibilityVersion = "Xcode 14.0"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( @@ -208,6 +212,7 @@ buildActionMask = 2147483647; files = ( 6F379F15DA085785BA2624D4 /* Assets.xcassets in Resources */, + AC8BDC2C7A63FA3FDC5967F4 /* LaunchScreen.storyboard in Resources */, F86717F05E27C72C9FA1FB27 /* assets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -229,12 +234,13 @@ outputFileListPaths = ( ); outputPaths = ( - "$(SRCROOT)/target/aarch64-apple-ios/${CONFIGURATION}/deps/libapi.a", - "$(SRCROOT)/target/x86_64-apple-ios/${CONFIGURATION}/deps/libapi.a", + "$(SRCROOT)/Externals/x86_64/${CONFIGURATION}/libapp.a", + "$(SRCROOT)/Externals/arm64/${CONFIGURATION}/libapp.a", + "$(SRCROOT)/Externals/arm64-sim/${CONFIGURATION}/libapp.a", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "node ../../../node_modules/.bin/../@tauri-apps/cli/tauri.js ios xcode-script -v --platform ${PLATFORM_DISPLAY_NAME:?} --sdk-root ${SDKROOT:?} --framework-search-paths \"${FRAMEWORK_SEARCH_PATHS:?}\" --header-search-paths \"${HEADER_SEARCH_PATHS:?}\" --gcc-preprocessor-definitions \"${GCC_PREPROCESSOR_DEFINITIONS:-}\" --configuration ${CONFIGURATION:?} ${FORCE_COLOR} ${ARCHS:?}"; + shellScript = "pnpm tauri ios xcode-script -v --platform ${PLATFORM_DISPLAY_NAME:?} --sdk-root ${SDKROOT:?} --framework-search-paths \"${FRAMEWORK_SEARCH_PATHS:?}\" --header-search-paths \"${HEADER_SEARCH_PATHS:?}\" --gcc-preprocessor-definitions \"${GCC_PREPROCESSOR_DEFINITIONS:-}\" --configuration ${CONFIGURATION:?} ${FORCE_COLOR} ${ARCHS:?}"; }; /* End PBXShellScriptBuildPhase section */ @@ -380,20 +386,42 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = api_iOS/api_iOS.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = Q93MBH6S2F; ENABLE_BITCODE = NO; + "EXCLUDED_ARCHS[sdk=iphoneos*]" = "arm64-sim x86_64"; + "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\".\"", ); INFOPLIST_FILE = api_iOS/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - "LIBRARY_SEARCH_PATHS[arch=arm64-sim]" = "$(inherited) $(PROJECT_DIR)/Externals/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)"; - "LIBRARY_SEARCH_PATHS[arch=arm64]" = "$(inherited) $(PROJECT_DIR)/Externals/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)"; - "LIBRARY_SEARCH_PATHS[arch=x86_64]" = "$(inherited) $(PROJECT_DIR)/Externals/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)"; + "LIBRARY_SEARCH_PATHS[arch=arm64-sim]" = ( + "$(inherited)", + "$(PROJECT_DIR)/Externals/arm64-sim/$(CONFIGURATION)", + "$(SDKROOT)/usr/lib/swift", + "$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)", + "$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)", + ); + "LIBRARY_SEARCH_PATHS[arch=arm64]" = ( + "$(inherited)", + "$(PROJECT_DIR)/Externals/arm64/$(CONFIGURATION)", + "$(SDKROOT)/usr/lib/swift", + "$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)", + "$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)", + ); + "LIBRARY_SEARCH_PATHS[arch=x86_64]" = ( + "$(inherited)", + "$(PROJECT_DIR)/Externals/x86_64/$(CONFIGURATION)", + "$(SDKROOT)/usr/lib/swift", + "$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)", + "$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)", + ); PRODUCT_BUNDLE_IDENTIFIER = com.tauri.api; PRODUCT_NAME = "Tauri API"; SDKROOT = iphoneos; @@ -413,20 +441,42 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = api_iOS/api_iOS.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = Q93MBH6S2F; ENABLE_BITCODE = NO; + "EXCLUDED_ARCHS[sdk=iphoneos*]" = "arm64-sim x86_64"; + "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\".\"", ); INFOPLIST_FILE = api_iOS/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - "LIBRARY_SEARCH_PATHS[arch=arm64-sim]" = "$(inherited) $(PROJECT_DIR)/Externals/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)"; - "LIBRARY_SEARCH_PATHS[arch=arm64]" = "$(inherited) $(PROJECT_DIR)/Externals/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)"; - "LIBRARY_SEARCH_PATHS[arch=x86_64]" = "$(inherited) $(PROJECT_DIR)/Externals/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)"; + "LIBRARY_SEARCH_PATHS[arch=arm64-sim]" = ( + "$(inherited)", + "$(PROJECT_DIR)/Externals/arm64-sim/$(CONFIGURATION)", + "$(SDKROOT)/usr/lib/swift", + "$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)", + "$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)", + ); + "LIBRARY_SEARCH_PATHS[arch=arm64]" = ( + "$(inherited)", + "$(PROJECT_DIR)/Externals/arm64/$(CONFIGURATION)", + "$(SDKROOT)/usr/lib/swift", + "$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)", + "$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)", + ); + "LIBRARY_SEARCH_PATHS[arch=x86_64]" = ( + "$(inherited)", + "$(PROJECT_DIR)/Externals/x86_64/$(CONFIGURATION)", + "$(SDKROOT)/usr/lib/swift", + "$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)", + "$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)", + ); PRODUCT_BUNDLE_IDENTIFIER = com.tauri.api; PRODUCT_NAME = "Tauri API"; SDKROOT = iphoneos; diff --git a/examples/api/src-tauri/gen/apple/api.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/examples/api/src-tauri/gen/apple/api.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/examples/api/src-tauri/gen/apple/api.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/examples/api/src-tauri/gen/apple/api.xcodeproj/xcshareddata/xcschemes/api_iOS.xcscheme b/examples/api/src-tauri/gen/apple/api.xcodeproj/xcshareddata/xcschemes/api_iOS.xcscheme index b4aafe53..2a9f5045 100644 --- a/examples/api/src-tauri/gen/apple/api.xcodeproj/xcshareddata/xcschemes/api_iOS.xcscheme +++ b/examples/api/src-tauri/gen/apple/api.xcodeproj/xcshareddata/xcschemes/api_iOS.xcscheme @@ -1,6 +1,6 @@ - NFCReaderUsageDescription - NFC Test - NSCameraUsageDescription - Request camera access for barcode scanner CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleExecutable @@ -45,6 +41,12 @@ UIInterfaceOrientationLandscapeRight NSFaceIDUsageDescription - Biometric Test + Authenticate with biometrics + NSCameraUsageDescription + Request camera access for WebRTC + NSMicrophoneUsageDescription + Request microphone access for WebRTC + NFCReaderUsageDescription + Read and write to NFC tags for testing - + \ No newline at end of file diff --git a/examples/api/src-tauri/gen/apple/api_iOS/api_iOS.entitlements b/examples/api/src-tauri/gen/apple/api_iOS/api_iOS.entitlements index 9db395a2..2bb4dee1 100644 --- a/examples/api/src-tauri/gen/apple/api_iOS/api_iOS.entitlements +++ b/examples/api/src-tauri/gen/apple/api_iOS/api_iOS.entitlements @@ -5,7 +5,6 @@ com.apple.developer.nfc.readersession.formats TAG - NDEF diff --git a/examples/api/src-tauri/gen/apple/project.yml b/examples/api/src-tauri/gen/apple/project.yml index 1be5cc64..9705de23 100644 --- a/examples/api/src-tauri/gen/apple/project.yml +++ b/examples/api/src-tauri/gen/apple/project.yml @@ -1,8 +1,8 @@ name: api options: - bundleIdPrefix: com.tauri + bundleIdPrefix: com.tauri.api deploymentTarget: - iOS: 13.0 + iOS: 14.0 fileGroups: [../../src] configs: debug: debug @@ -36,6 +36,7 @@ targets: - path: assets buildPhase: resources type: folder + - path: LaunchScreen.storyboard info: path: api_iOS/Info.plist properties: @@ -63,14 +64,16 @@ targets: base: ENABLE_BITCODE: false ARCHS: [arm64, arm64-sim] - VALID_ARCHS: arm64 arm64-sim - LIBRARY_SEARCH_PATHS[arch=x86_64]: $(inherited) $(PROJECT_DIR)/Externals/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME) - LIBRARY_SEARCH_PATHS[arch=arm64]: $(inherited) $(PROJECT_DIR)/Externals/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME) - LIBRARY_SEARCH_PATHS[arch=arm64-sim]: $(inherited) $(PROJECT_DIR)/Externals/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME) + VALID_ARCHS: arm64 arm64-sim + LIBRARY_SEARCH_PATHS[arch=x86_64]: $(inherited) $(PROJECT_DIR)/Externals/x86_64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME) + LIBRARY_SEARCH_PATHS[arch=arm64]: $(inherited) $(PROJECT_DIR)/Externals/arm64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME) + LIBRARY_SEARCH_PATHS[arch=arm64-sim]: $(inherited) $(PROJECT_DIR)/Externals/arm64-sim/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME) ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES: true + EXCLUDED_ARCHS[sdk=iphonesimulator*]: arm64 + EXCLUDED_ARCHS[sdk=iphoneos*]: arm64-sim x86_64 groups: [app] dependencies: - - framework: libapi.a + - framework: libapp.a embed: false - sdk: CoreGraphics.framework - sdk: Metal.framework @@ -80,9 +83,10 @@ targets: - sdk: UIKit.framework - sdk: WebKit.framework preBuildScripts: - - script: node ../../../node_modules/.bin/../@tauri-apps/cli/tauri.js ios xcode-script -v --platform ${PLATFORM_DISPLAY_NAME:?} --sdk-root ${SDKROOT:?} --framework-search-paths "${FRAMEWORK_SEARCH_PATHS:?}" --header-search-paths "${HEADER_SEARCH_PATHS:?}" --gcc-preprocessor-definitions "${GCC_PREPROCESSOR_DEFINITIONS:-}" --configuration ${CONFIGURATION:?} ${FORCE_COLOR} ${ARCHS:?} + - script: pnpm tauri ios xcode-script -v --platform ${PLATFORM_DISPLAY_NAME:?} --sdk-root ${SDKROOT:?} --framework-search-paths "${FRAMEWORK_SEARCH_PATHS:?}" --header-search-paths "${HEADER_SEARCH_PATHS:?}" --gcc-preprocessor-definitions "${GCC_PREPROCESSOR_DEFINITIONS:-}" --configuration ${CONFIGURATION:?} ${FORCE_COLOR} ${ARCHS:?} name: Build Rust Code basedOnDependencyAnalysis: false outputFiles: - - $(SRCROOT)/target/aarch64-apple-ios/${CONFIGURATION}/deps/libapi.a - - $(SRCROOT)/target/x86_64-apple-ios/${CONFIGURATION}/deps/libapi.a \ No newline at end of file + - $(SRCROOT)/Externals/x86_64/${CONFIGURATION}/libapp.a + - $(SRCROOT)/Externals/arm64/${CONFIGURATION}/libapp.a + - $(SRCROOT)/Externals/arm64-sim/${CONFIGURATION}/libapp.a diff --git a/examples/api/src-tauri/gen/schemas/desktop-schema.json b/examples/api/src-tauri/gen/schemas/desktop-schema.json deleted file mode 100644 index 88c01d5b..00000000 --- a/examples/api/src-tauri/gen/schemas/desktop-schema.json +++ /dev/null @@ -1,6826 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "CapabilityFile", - "description": "Capability formats accepted in a capability file.", - "anyOf": [ - { - "description": "A single capability.", - "allOf": [ - { - "$ref": "#/definitions/Capability" - } - ] - }, - { - "description": "A list of capabilities.", - "type": "object", - "required": [ - "capabilities" - ], - "properties": { - "capabilities": { - "description": "The list of capabilities.", - "type": "array", - "items": { - "$ref": "#/definitions/Capability" - } - } - } - } - ], - "definitions": { - "Capability": { - "description": "a grouping and boundary mechanism developers can use to separate windows or plugins functionality from each other at runtime.\n\nIf a window is not matching any capability then it has no access to the IPC layer at all.\n\nThis can be done to create trust groups and reduce impact of vulnerabilities in certain plugins or windows. Windows can be added to a capability by exact name or glob patterns like *, admin-* or main-window.", - "type": "object", - "required": [ - "identifier", - "permissions", - "windows" - ], - "properties": { - "identifier": { - "description": "Identifier of the capability.", - "type": "string" - }, - "description": { - "description": "Description of the capability.", - "default": "", - "type": "string" - }, - "context": { - "description": "Execution context of the capability.\n\nAt runtime, Tauri filters the IPC command together with the context to determine whether it is allowed or not and its scope.", - "default": "local", - "allOf": [ - { - "$ref": "#/definitions/CapabilityContext" - } - ] - }, - "windows": { - "description": "List of windows that uses this capability. Can be a glob pattern.\n\nOn multiwebview windows, prefer [`Self::webviews`] for a fine grained access control.", - "type": "array", - "items": { - "type": "string" - } - }, - "webviews": { - "description": "List of webviews that uses this capability. Can be a glob pattern.\n\nThis is only required when using on multiwebview contexts, by default all child webviews of a window that matches [`Self::windows`] are linked.", - "type": "array", - "items": { - "type": "string" - } - }, - "permissions": { - "description": "List of permissions attached to this capability. Must include the plugin name as prefix in the form of `${plugin-name}:${permission-name}`.", - "type": "array", - "items": { - "$ref": "#/definitions/PermissionEntry" - } - }, - "platforms": { - "description": "Target platforms this capability applies. By default all platforms applies.", - "default": [ - "linux", - "macOS", - "windows", - "android", - "iOS" - ], - "type": "array", - "items": { - "$ref": "#/definitions/Target" - } - } - } - }, - "CapabilityContext": { - "description": "Context of the capability.", - "oneOf": [ - { - "description": "Capability refers to local URL usage.", - "type": "string", - "enum": [ - "local" - ] - }, - { - "description": "Capability refers to remote usage.", - "type": "object", - "required": [ - "remote" - ], - "properties": { - "remote": { - "type": "object", - "required": [ - "urls" - ], - "properties": { - "urls": { - "description": "Remote domains this capability refers to. Can use glob patterns.", - "type": "array", - "items": { - "type": "string" - } - } - } - } - }, - "additionalProperties": false - } - ] - }, - "PermissionEntry": { - "description": "An entry for a permission value in a [`Capability`] can be either a raw permission [`Identifier`] or an object that references a permission and extends its scope.", - "anyOf": [ - { - "description": "Reference a permission or permission set by identifier.", - "allOf": [ - { - "$ref": "#/definitions/Identifier" - } - ] - }, - { - "description": "Reference a permission or permission set by identifier and extends its scope.", - "type": "object", - "oneOf": [ - { - "type": "object", - "required": [ - "identifier" - ], - "properties": { - "identifier": { - "oneOf": [ - { - "description": "fs:default -> # Tauri `fs` default permissions\n\nThis configuration file defines the default permissions granted\nto the filesystem.\n\n### Granted Permissions\n\nThis default permission set enables all read-related commands and\nallows access to the `$APP` folder and sub directories created in it.\nThe location of the `$APP` folder depends on the operating system,\nwhere the application is run.\n\nIn general the `$APP` folder needs to be manually created\nby the application at runtime, before accessing files or folders\nin it is possible.\n\n### Denied Permissions\n\nThis default permission set prevents access to critical components\nof the Tauri application by default.\nOn Windows the webview data folder access is denied.\n\n", - "type": "string", - "enum": [ - "fs:default" - ] - }, - { - "description": "fs:allow-app-meta -> This allows read access to metadata of the `$APP` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-app-meta" - ] - }, - { - "description": "fs:allow-app-meta-recursive -> This allows read access to metadata of the `$APP` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-app-meta-recursive" - ] - }, - { - "description": "fs:allow-app-read -> This allows non-recursive read access to the `$APP` folder.", - "type": "string", - "enum": [ - "fs:allow-app-read" - ] - }, - { - "description": "fs:allow-app-read-recursive -> This allows full recursive read access to the complete `$APP` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-app-read-recursive" - ] - }, - { - "description": "fs:allow-app-write -> This allows non-recursive write access to the `$APP` folder.", - "type": "string", - "enum": [ - "fs:allow-app-write" - ] - }, - { - "description": "fs:allow-app-write-recursive -> This allows full recusrive write access to the complete `$APP` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-app-write-recursive" - ] - }, - { - "description": "fs:allow-appcache-meta -> This allows read access to metadata of the `$APPCACHE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-appcache-meta" - ] - }, - { - "description": "fs:allow-appcache-meta-recursive -> This allows read access to metadata of the `$APPCACHE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-appcache-meta-recursive" - ] - }, - { - "description": "fs:allow-appcache-read -> This allows non-recursive read access to the `$APPCACHE` folder.", - "type": "string", - "enum": [ - "fs:allow-appcache-read" - ] - }, - { - "description": "fs:allow-appcache-read-recursive -> This allows full recursive read access to the complete `$APPCACHE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-appcache-read-recursive" - ] - }, - { - "description": "fs:allow-appcache-write -> This allows non-recursive write access to the `$APPCACHE` folder.", - "type": "string", - "enum": [ - "fs:allow-appcache-write" - ] - }, - { - "description": "fs:allow-appcache-write-recursive -> This allows full recusrive write access to the complete `$APPCACHE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-appcache-write-recursive" - ] - }, - { - "description": "fs:allow-appconfig-meta -> This allows read access to metadata of the `$APPCONFIG` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-appconfig-meta" - ] - }, - { - "description": "fs:allow-appconfig-meta-recursive -> This allows read access to metadata of the `$APPCONFIG` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-appconfig-meta-recursive" - ] - }, - { - "description": "fs:allow-appconfig-read -> This allows non-recursive read access to the `$APPCONFIG` folder.", - "type": "string", - "enum": [ - "fs:allow-appconfig-read" - ] - }, - { - "description": "fs:allow-appconfig-read-recursive -> This allows full recursive read access to the complete `$APPCONFIG` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-appconfig-read-recursive" - ] - }, - { - "description": "fs:allow-appconfig-write -> This allows non-recursive write access to the `$APPCONFIG` folder.", - "type": "string", - "enum": [ - "fs:allow-appconfig-write" - ] - }, - { - "description": "fs:allow-appconfig-write-recursive -> This allows full recusrive write access to the complete `$APPCONFIG` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-appconfig-write-recursive" - ] - }, - { - "description": "fs:allow-appdata-meta -> This allows read access to metadata of the `$APPDATA` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-appdata-meta" - ] - }, - { - "description": "fs:allow-appdata-meta-recursive -> This allows read access to metadata of the `$APPDATA` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-appdata-meta-recursive" - ] - }, - { - "description": "fs:allow-appdata-read -> This allows non-recursive read access to the `$APPDATA` folder.", - "type": "string", - "enum": [ - "fs:allow-appdata-read" - ] - }, - { - "description": "fs:allow-appdata-read-recursive -> This allows full recursive read access to the complete `$APPDATA` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-appdata-read-recursive" - ] - }, - { - "description": "fs:allow-appdata-write -> This allows non-recursive write access to the `$APPDATA` folder.", - "type": "string", - "enum": [ - "fs:allow-appdata-write" - ] - }, - { - "description": "fs:allow-appdata-write-recursive -> This allows full recusrive write access to the complete `$APPDATA` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-appdata-write-recursive" - ] - }, - { - "description": "fs:allow-applocaldata-meta -> This allows read access to metadata of the `$APPLOCALDATA` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-applocaldata-meta" - ] - }, - { - "description": "fs:allow-applocaldata-meta-recursive -> This allows read access to metadata of the `$APPLOCALDATA` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-applocaldata-meta-recursive" - ] - }, - { - "description": "fs:allow-applocaldata-read -> This allows non-recursive read access to the `$APPLOCALDATA` folder.", - "type": "string", - "enum": [ - "fs:allow-applocaldata-read" - ] - }, - { - "description": "fs:allow-applocaldata-read-recursive -> This allows full recursive read access to the complete `$APPLOCALDATA` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-applocaldata-read-recursive" - ] - }, - { - "description": "fs:allow-applocaldata-write -> This allows non-recursive write access to the `$APPLOCALDATA` folder.", - "type": "string", - "enum": [ - "fs:allow-applocaldata-write" - ] - }, - { - "description": "fs:allow-applocaldata-write-recursive -> This allows full recusrive write access to the complete `$APPLOCALDATA` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-applocaldata-write-recursive" - ] - }, - { - "description": "fs:allow-applog-meta -> This allows read access to metadata of the `$APPLOG` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-applog-meta" - ] - }, - { - "description": "fs:allow-applog-meta-recursive -> This allows read access to metadata of the `$APPLOG` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-applog-meta-recursive" - ] - }, - { - "description": "fs:allow-applog-read -> This allows non-recursive read access to the `$APPLOG` folder.", - "type": "string", - "enum": [ - "fs:allow-applog-read" - ] - }, - { - "description": "fs:allow-applog-read-recursive -> This allows full recursive read access to the complete `$APPLOG` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-applog-read-recursive" - ] - }, - { - "description": "fs:allow-applog-write -> This allows non-recursive write access to the `$APPLOG` folder.", - "type": "string", - "enum": [ - "fs:allow-applog-write" - ] - }, - { - "description": "fs:allow-applog-write-recursive -> This allows full recusrive write access to the complete `$APPLOG` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-applog-write-recursive" - ] - }, - { - "description": "fs:allow-audio-meta -> This allows read access to metadata of the `$AUDIO` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-audio-meta" - ] - }, - { - "description": "fs:allow-audio-meta-recursive -> This allows read access to metadata of the `$AUDIO` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-audio-meta-recursive" - ] - }, - { - "description": "fs:allow-audio-read -> This allows non-recursive read access to the `$AUDIO` folder.", - "type": "string", - "enum": [ - "fs:allow-audio-read" - ] - }, - { - "description": "fs:allow-audio-read-recursive -> This allows full recursive read access to the complete `$AUDIO` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-audio-read-recursive" - ] - }, - { - "description": "fs:allow-audio-write -> This allows non-recursive write access to the `$AUDIO` folder.", - "type": "string", - "enum": [ - "fs:allow-audio-write" - ] - }, - { - "description": "fs:allow-audio-write-recursive -> This allows full recusrive write access to the complete `$AUDIO` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-audio-write-recursive" - ] - }, - { - "description": "fs:allow-cache-meta -> This allows read access to metadata of the `$CACHE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-cache-meta" - ] - }, - { - "description": "fs:allow-cache-meta-recursive -> This allows read access to metadata of the `$CACHE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-cache-meta-recursive" - ] - }, - { - "description": "fs:allow-cache-read -> This allows non-recursive read access to the `$CACHE` folder.", - "type": "string", - "enum": [ - "fs:allow-cache-read" - ] - }, - { - "description": "fs:allow-cache-read-recursive -> This allows full recursive read access to the complete `$CACHE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-cache-read-recursive" - ] - }, - { - "description": "fs:allow-cache-write -> This allows non-recursive write access to the `$CACHE` folder.", - "type": "string", - "enum": [ - "fs:allow-cache-write" - ] - }, - { - "description": "fs:allow-cache-write-recursive -> This allows full recusrive write access to the complete `$CACHE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-cache-write-recursive" - ] - }, - { - "description": "fs:allow-config-meta -> This allows read access to metadata of the `$CONFIG` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-config-meta" - ] - }, - { - "description": "fs:allow-config-meta-recursive -> This allows read access to metadata of the `$CONFIG` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-config-meta-recursive" - ] - }, - { - "description": "fs:allow-config-read -> This allows non-recursive read access to the `$CONFIG` folder.", - "type": "string", - "enum": [ - "fs:allow-config-read" - ] - }, - { - "description": "fs:allow-config-read-recursive -> This allows full recursive read access to the complete `$CONFIG` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-config-read-recursive" - ] - }, - { - "description": "fs:allow-config-write -> This allows non-recursive write access to the `$CONFIG` folder.", - "type": "string", - "enum": [ - "fs:allow-config-write" - ] - }, - { - "description": "fs:allow-config-write-recursive -> This allows full recusrive write access to the complete `$CONFIG` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-config-write-recursive" - ] - }, - { - "description": "fs:allow-data-meta -> This allows read access to metadata of the `$DATA` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-data-meta" - ] - }, - { - "description": "fs:allow-data-meta-recursive -> This allows read access to metadata of the `$DATA` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-data-meta-recursive" - ] - }, - { - "description": "fs:allow-data-read -> This allows non-recursive read access to the `$DATA` folder.", - "type": "string", - "enum": [ - "fs:allow-data-read" - ] - }, - { - "description": "fs:allow-data-read-recursive -> This allows full recursive read access to the complete `$DATA` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-data-read-recursive" - ] - }, - { - "description": "fs:allow-data-write -> This allows non-recursive write access to the `$DATA` folder.", - "type": "string", - "enum": [ - "fs:allow-data-write" - ] - }, - { - "description": "fs:allow-data-write-recursive -> This allows full recusrive write access to the complete `$DATA` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-data-write-recursive" - ] - }, - { - "description": "fs:allow-desktop-meta -> This allows read access to metadata of the `$DESKTOP` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-desktop-meta" - ] - }, - { - "description": "fs:allow-desktop-meta-recursive -> This allows read access to metadata of the `$DESKTOP` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-desktop-meta-recursive" - ] - }, - { - "description": "fs:allow-desktop-read -> This allows non-recursive read access to the `$DESKTOP` folder.", - "type": "string", - "enum": [ - "fs:allow-desktop-read" - ] - }, - { - "description": "fs:allow-desktop-read-recursive -> This allows full recursive read access to the complete `$DESKTOP` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-desktop-read-recursive" - ] - }, - { - "description": "fs:allow-desktop-write -> This allows non-recursive write access to the `$DESKTOP` folder.", - "type": "string", - "enum": [ - "fs:allow-desktop-write" - ] - }, - { - "description": "fs:allow-desktop-write-recursive -> This allows full recusrive write access to the complete `$DESKTOP` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-desktop-write-recursive" - ] - }, - { - "description": "fs:allow-document-meta -> This allows read access to metadata of the `$DOCUMENT` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-document-meta" - ] - }, - { - "description": "fs:allow-document-meta-recursive -> This allows read access to metadata of the `$DOCUMENT` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-document-meta-recursive" - ] - }, - { - "description": "fs:allow-document-read -> This allows non-recursive read access to the `$DOCUMENT` folder.", - "type": "string", - "enum": [ - "fs:allow-document-read" - ] - }, - { - "description": "fs:allow-document-read-recursive -> This allows full recursive read access to the complete `$DOCUMENT` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-document-read-recursive" - ] - }, - { - "description": "fs:allow-document-write -> This allows non-recursive write access to the `$DOCUMENT` folder.", - "type": "string", - "enum": [ - "fs:allow-document-write" - ] - }, - { - "description": "fs:allow-document-write-recursive -> This allows full recusrive write access to the complete `$DOCUMENT` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-document-write-recursive" - ] - }, - { - "description": "fs:allow-download-meta -> This allows read access to metadata of the `$DOWNLOAD` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-download-meta" - ] - }, - { - "description": "fs:allow-download-meta-recursive -> This allows read access to metadata of the `$DOWNLOAD` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-download-meta-recursive" - ] - }, - { - "description": "fs:allow-download-read -> This allows non-recursive read access to the `$DOWNLOAD` folder.", - "type": "string", - "enum": [ - "fs:allow-download-read" - ] - }, - { - "description": "fs:allow-download-read-recursive -> This allows full recursive read access to the complete `$DOWNLOAD` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-download-read-recursive" - ] - }, - { - "description": "fs:allow-download-write -> This allows non-recursive write access to the `$DOWNLOAD` folder.", - "type": "string", - "enum": [ - "fs:allow-download-write" - ] - }, - { - "description": "fs:allow-download-write-recursive -> This allows full recusrive write access to the complete `$DOWNLOAD` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-download-write-recursive" - ] - }, - { - "description": "fs:allow-exe-meta -> This allows read access to metadata of the `$EXE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-exe-meta" - ] - }, - { - "description": "fs:allow-exe-meta-recursive -> This allows read access to metadata of the `$EXE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-exe-meta-recursive" - ] - }, - { - "description": "fs:allow-exe-read -> This allows non-recursive read access to the `$EXE` folder.", - "type": "string", - "enum": [ - "fs:allow-exe-read" - ] - }, - { - "description": "fs:allow-exe-read-recursive -> This allows full recursive read access to the complete `$EXE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-exe-read-recursive" - ] - }, - { - "description": "fs:allow-exe-write -> This allows non-recursive write access to the `$EXE` folder.", - "type": "string", - "enum": [ - "fs:allow-exe-write" - ] - }, - { - "description": "fs:allow-exe-write-recursive -> This allows full recusrive write access to the complete `$EXE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-exe-write-recursive" - ] - }, - { - "description": "fs:allow-font-meta -> This allows read access to metadata of the `$FONT` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-font-meta" - ] - }, - { - "description": "fs:allow-font-meta-recursive -> This allows read access to metadata of the `$FONT` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-font-meta-recursive" - ] - }, - { - "description": "fs:allow-font-read -> This allows non-recursive read access to the `$FONT` folder.", - "type": "string", - "enum": [ - "fs:allow-font-read" - ] - }, - { - "description": "fs:allow-font-read-recursive -> This allows full recursive read access to the complete `$FONT` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-font-read-recursive" - ] - }, - { - "description": "fs:allow-font-write -> This allows non-recursive write access to the `$FONT` folder.", - "type": "string", - "enum": [ - "fs:allow-font-write" - ] - }, - { - "description": "fs:allow-font-write-recursive -> This allows full recusrive write access to the complete `$FONT` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-font-write-recursive" - ] - }, - { - "description": "fs:allow-home-meta -> This allows read access to metadata of the `$HOME` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-home-meta" - ] - }, - { - "description": "fs:allow-home-meta-recursive -> This allows read access to metadata of the `$HOME` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-home-meta-recursive" - ] - }, - { - "description": "fs:allow-home-read -> This allows non-recursive read access to the `$HOME` folder.", - "type": "string", - "enum": [ - "fs:allow-home-read" - ] - }, - { - "description": "fs:allow-home-read-recursive -> This allows full recursive read access to the complete `$HOME` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-home-read-recursive" - ] - }, - { - "description": "fs:allow-home-write -> This allows non-recursive write access to the `$HOME` folder.", - "type": "string", - "enum": [ - "fs:allow-home-write" - ] - }, - { - "description": "fs:allow-home-write-recursive -> This allows full recusrive write access to the complete `$HOME` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-home-write-recursive" - ] - }, - { - "description": "fs:allow-localdata-meta -> This allows read access to metadata of the `$LOCALDATA` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-localdata-meta" - ] - }, - { - "description": "fs:allow-localdata-meta-recursive -> This allows read access to metadata of the `$LOCALDATA` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-localdata-meta-recursive" - ] - }, - { - "description": "fs:allow-localdata-read -> This allows non-recursive read access to the `$LOCALDATA` folder.", - "type": "string", - "enum": [ - "fs:allow-localdata-read" - ] - }, - { - "description": "fs:allow-localdata-read-recursive -> This allows full recursive read access to the complete `$LOCALDATA` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-localdata-read-recursive" - ] - }, - { - "description": "fs:allow-localdata-write -> This allows non-recursive write access to the `$LOCALDATA` folder.", - "type": "string", - "enum": [ - "fs:allow-localdata-write" - ] - }, - { - "description": "fs:allow-localdata-write-recursive -> This allows full recusrive write access to the complete `$LOCALDATA` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-localdata-write-recursive" - ] - }, - { - "description": "fs:allow-log-meta -> This allows read access to metadata of the `$LOG` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-log-meta" - ] - }, - { - "description": "fs:allow-log-meta-recursive -> This allows read access to metadata of the `$LOG` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-log-meta-recursive" - ] - }, - { - "description": "fs:allow-log-read -> This allows non-recursive read access to the `$LOG` folder.", - "type": "string", - "enum": [ - "fs:allow-log-read" - ] - }, - { - "description": "fs:allow-log-read-recursive -> This allows full recursive read access to the complete `$LOG` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-log-read-recursive" - ] - }, - { - "description": "fs:allow-log-write -> This allows non-recursive write access to the `$LOG` folder.", - "type": "string", - "enum": [ - "fs:allow-log-write" - ] - }, - { - "description": "fs:allow-log-write-recursive -> This allows full recusrive write access to the complete `$LOG` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-log-write-recursive" - ] - }, - { - "description": "fs:allow-picture-meta -> This allows read access to metadata of the `$PICTURE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-picture-meta" - ] - }, - { - "description": "fs:allow-picture-meta-recursive -> This allows read access to metadata of the `$PICTURE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-picture-meta-recursive" - ] - }, - { - "description": "fs:allow-picture-read -> This allows non-recursive read access to the `$PICTURE` folder.", - "type": "string", - "enum": [ - "fs:allow-picture-read" - ] - }, - { - "description": "fs:allow-picture-read-recursive -> This allows full recursive read access to the complete `$PICTURE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-picture-read-recursive" - ] - }, - { - "description": "fs:allow-picture-write -> This allows non-recursive write access to the `$PICTURE` folder.", - "type": "string", - "enum": [ - "fs:allow-picture-write" - ] - }, - { - "description": "fs:allow-picture-write-recursive -> This allows full recusrive write access to the complete `$PICTURE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-picture-write-recursive" - ] - }, - { - "description": "fs:allow-public-meta -> This allows read access to metadata of the `$PUBLIC` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-public-meta" - ] - }, - { - "description": "fs:allow-public-meta-recursive -> This allows read access to metadata of the `$PUBLIC` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-public-meta-recursive" - ] - }, - { - "description": "fs:allow-public-read -> This allows non-recursive read access to the `$PUBLIC` folder.", - "type": "string", - "enum": [ - "fs:allow-public-read" - ] - }, - { - "description": "fs:allow-public-read-recursive -> This allows full recursive read access to the complete `$PUBLIC` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-public-read-recursive" - ] - }, - { - "description": "fs:allow-public-write -> This allows non-recursive write access to the `$PUBLIC` folder.", - "type": "string", - "enum": [ - "fs:allow-public-write" - ] - }, - { - "description": "fs:allow-public-write-recursive -> This allows full recusrive write access to the complete `$PUBLIC` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-public-write-recursive" - ] - }, - { - "description": "fs:allow-resource-meta -> This allows read access to metadata of the `$RESOURCE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-resource-meta" - ] - }, - { - "description": "fs:allow-resource-meta-recursive -> This allows read access to metadata of the `$RESOURCE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-resource-meta-recursive" - ] - }, - { - "description": "fs:allow-resource-read -> This allows non-recursive read access to the `$RESOURCE` folder.", - "type": "string", - "enum": [ - "fs:allow-resource-read" - ] - }, - { - "description": "fs:allow-resource-read-recursive -> This allows full recursive read access to the complete `$RESOURCE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-resource-read-recursive" - ] - }, - { - "description": "fs:allow-resource-write -> This allows non-recursive write access to the `$RESOURCE` folder.", - "type": "string", - "enum": [ - "fs:allow-resource-write" - ] - }, - { - "description": "fs:allow-resource-write-recursive -> This allows full recusrive write access to the complete `$RESOURCE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-resource-write-recursive" - ] - }, - { - "description": "fs:allow-runtime-meta -> This allows read access to metadata of the `$RUNTIME` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-runtime-meta" - ] - }, - { - "description": "fs:allow-runtime-meta-recursive -> This allows read access to metadata of the `$RUNTIME` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-runtime-meta-recursive" - ] - }, - { - "description": "fs:allow-runtime-read -> This allows non-recursive read access to the `$RUNTIME` folder.", - "type": "string", - "enum": [ - "fs:allow-runtime-read" - ] - }, - { - "description": "fs:allow-runtime-read-recursive -> This allows full recursive read access to the complete `$RUNTIME` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-runtime-read-recursive" - ] - }, - { - "description": "fs:allow-runtime-write -> This allows non-recursive write access to the `$RUNTIME` folder.", - "type": "string", - "enum": [ - "fs:allow-runtime-write" - ] - }, - { - "description": "fs:allow-runtime-write-recursive -> This allows full recusrive write access to the complete `$RUNTIME` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-runtime-write-recursive" - ] - }, - { - "description": "fs:allow-temp-meta -> This allows read access to metadata of the `$TEMP` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-temp-meta" - ] - }, - { - "description": "fs:allow-temp-meta-recursive -> This allows read access to metadata of the `$TEMP` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-temp-meta-recursive" - ] - }, - { - "description": "fs:allow-temp-read -> This allows non-recursive read access to the `$TEMP` folder.", - "type": "string", - "enum": [ - "fs:allow-temp-read" - ] - }, - { - "description": "fs:allow-temp-read-recursive -> This allows full recursive read access to the complete `$TEMP` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-temp-read-recursive" - ] - }, - { - "description": "fs:allow-temp-write -> This allows non-recursive write access to the `$TEMP` folder.", - "type": "string", - "enum": [ - "fs:allow-temp-write" - ] - }, - { - "description": "fs:allow-temp-write-recursive -> This allows full recusrive write access to the complete `$TEMP` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-temp-write-recursive" - ] - }, - { - "description": "fs:allow-template-meta -> This allows read access to metadata of the `$TEMPLATE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-template-meta" - ] - }, - { - "description": "fs:allow-template-meta-recursive -> This allows read access to metadata of the `$TEMPLATE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-template-meta-recursive" - ] - }, - { - "description": "fs:allow-template-read -> This allows non-recursive read access to the `$TEMPLATE` folder.", - "type": "string", - "enum": [ - "fs:allow-template-read" - ] - }, - { - "description": "fs:allow-template-read-recursive -> This allows full recursive read access to the complete `$TEMPLATE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-template-read-recursive" - ] - }, - { - "description": "fs:allow-template-write -> This allows non-recursive write access to the `$TEMPLATE` folder.", - "type": "string", - "enum": [ - "fs:allow-template-write" - ] - }, - { - "description": "fs:allow-template-write-recursive -> This allows full recusrive write access to the complete `$TEMPLATE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-template-write-recursive" - ] - }, - { - "description": "fs:allow-video-meta -> This allows read access to metadata of the `$VIDEO` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-video-meta" - ] - }, - { - "description": "fs:allow-video-meta-recursive -> This allows read access to metadata of the `$VIDEO` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-video-meta-recursive" - ] - }, - { - "description": "fs:allow-video-read -> This allows non-recursive read access to the `$VIDEO` folder.", - "type": "string", - "enum": [ - "fs:allow-video-read" - ] - }, - { - "description": "fs:allow-video-read-recursive -> This allows full recursive read access to the complete `$VIDEO` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-video-read-recursive" - ] - }, - { - "description": "fs:allow-video-write -> This allows non-recursive write access to the `$VIDEO` folder.", - "type": "string", - "enum": [ - "fs:allow-video-write" - ] - }, - { - "description": "fs:allow-video-write-recursive -> This allows full recusrive write access to the complete `$VIDEO` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-video-write-recursive" - ] - }, - { - "description": "fs:deny-default -> This denies access to dangerous Tauri relevant files and folders by default.", - "type": "string", - "enum": [ - "fs:deny-default" - ] - }, - { - "description": "fs:allow-copy-file -> Enables the copy_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-copy-file" - ] - }, - { - "description": "fs:allow-create -> Enables the create command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-create" - ] - }, - { - "description": "fs:allow-exists -> Enables the exists command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-exists" - ] - }, - { - "description": "fs:allow-fstat -> Enables the fstat command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-fstat" - ] - }, - { - "description": "fs:allow-ftruncate -> Enables the ftruncate command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-ftruncate" - ] - }, - { - "description": "fs:allow-lstat -> Enables the lstat command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-lstat" - ] - }, - { - "description": "fs:allow-mkdir -> Enables the mkdir command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-mkdir" - ] - }, - { - "description": "fs:allow-open -> Enables the open command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-open" - ] - }, - { - "description": "fs:allow-read -> Enables the read command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-read" - ] - }, - { - "description": "fs:allow-read-dir -> Enables the read_dir command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-read-dir" - ] - }, - { - "description": "fs:allow-read-file -> Enables the read_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-read-file" - ] - }, - { - "description": "fs:allow-read-text-file -> Enables the read_text_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-read-text-file" - ] - }, - { - "description": "fs:allow-read-text-file-lines -> Enables the read_text_file_lines command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-read-text-file-lines" - ] - }, - { - "description": "fs:allow-read-text-file-lines-next -> Enables the read_text_file_lines_next command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-read-text-file-lines-next" - ] - }, - { - "description": "fs:allow-remove -> Enables the remove command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-remove" - ] - }, - { - "description": "fs:allow-rename -> Enables the rename command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-rename" - ] - }, - { - "description": "fs:allow-seek -> Enables the seek command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-seek" - ] - }, - { - "description": "fs:allow-stat -> Enables the stat command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-stat" - ] - }, - { - "description": "fs:allow-truncate -> Enables the truncate command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-truncate" - ] - }, - { - "description": "fs:allow-unwatch -> Enables the unwatch command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-unwatch" - ] - }, - { - "description": "fs:allow-watch -> Enables the watch command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-watch" - ] - }, - { - "description": "fs:allow-write -> Enables the write command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-write" - ] - }, - { - "description": "fs:allow-write-file -> Enables the write_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-write-file" - ] - }, - { - "description": "fs:allow-write-text-file -> Enables the write_text_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-write-text-file" - ] - }, - { - "description": "fs:deny-copy-file -> Denies the copy_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-copy-file" - ] - }, - { - "description": "fs:deny-create -> Denies the create command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-create" - ] - }, - { - "description": "fs:deny-exists -> Denies the exists command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-exists" - ] - }, - { - "description": "fs:deny-fstat -> Denies the fstat command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-fstat" - ] - }, - { - "description": "fs:deny-ftruncate -> Denies the ftruncate command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-ftruncate" - ] - }, - { - "description": "fs:deny-lstat -> Denies the lstat command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-lstat" - ] - }, - { - "description": "fs:deny-mkdir -> Denies the mkdir command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-mkdir" - ] - }, - { - "description": "fs:deny-open -> Denies the open command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-open" - ] - }, - { - "description": "fs:deny-read -> Denies the read command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-read" - ] - }, - { - "description": "fs:deny-read-dir -> Denies the read_dir command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-read-dir" - ] - }, - { - "description": "fs:deny-read-file -> Denies the read_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-read-file" - ] - }, - { - "description": "fs:deny-read-text-file -> Denies the read_text_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-read-text-file" - ] - }, - { - "description": "fs:deny-read-text-file-lines -> Denies the read_text_file_lines command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-read-text-file-lines" - ] - }, - { - "description": "fs:deny-read-text-file-lines-next -> Denies the read_text_file_lines_next command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-read-text-file-lines-next" - ] - }, - { - "description": "fs:deny-remove -> Denies the remove command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-remove" - ] - }, - { - "description": "fs:deny-rename -> Denies the rename command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-rename" - ] - }, - { - "description": "fs:deny-seek -> Denies the seek command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-seek" - ] - }, - { - "description": "fs:deny-stat -> Denies the stat command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-stat" - ] - }, - { - "description": "fs:deny-truncate -> Denies the truncate command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-truncate" - ] - }, - { - "description": "fs:deny-unwatch -> Denies the unwatch command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-unwatch" - ] - }, - { - "description": "fs:deny-watch -> Denies the watch command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-watch" - ] - }, - { - "description": "fs:deny-webview-data-linux -> This denies read access to the\n`$APPLOCALDATA` folder on linux as the webview data and configuration values are stored here.\nAllowing access can lead to sensitive information disclosure and should be well considered.", - "type": "string", - "enum": [ - "fs:deny-webview-data-linux" - ] - }, - { - "description": "fs:deny-webview-data-windows -> This denies read access to the\n`$APPLOCALDATA/EBWebView` folder on windows as the webview data and configuration values are stored here.\nAllowing access can lead to sensitive information disclosure and should be well considered.", - "type": "string", - "enum": [ - "fs:deny-webview-data-windows" - ] - }, - { - "description": "fs:deny-write -> Denies the write command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-write" - ] - }, - { - "description": "fs:deny-write-file -> Denies the write_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-write-file" - ] - }, - { - "description": "fs:deny-write-text-file -> Denies the write_text_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-write-text-file" - ] - }, - { - "description": "fs:read-all -> This enables all read related commands without any pre-configured accessible paths.", - "type": "string", - "enum": [ - "fs:read-all" - ] - }, - { - "description": "fs:read-dirs -> This enables directory read and file metadata related commands without any pre-configured accessible paths.", - "type": "string", - "enum": [ - "fs:read-dirs" - ] - }, - { - "description": "fs:read-files -> This enables file read related commands without any pre-configured accessible paths.", - "type": "string", - "enum": [ - "fs:read-files" - ] - }, - { - "description": "fs:read-meta -> This enables all index or metadata related commands without any pre-configured accessible paths.", - "type": "string", - "enum": [ - "fs:read-meta" - ] - }, - { - "description": "fs:scope -> An empty permission you can use to modify the global scope.", - "type": "string", - "enum": [ - "fs:scope" - ] - }, - { - "description": "fs:scope-app -> This scope permits access to all files and list content of top level directories in the `$APP`folder.", - "type": "string", - "enum": [ - "fs:scope-app" - ] - }, - { - "description": "fs:scope-app-index -> This scope permits to list all files and folders in the `$APP`folder.", - "type": "string", - "enum": [ - "fs:scope-app-index" - ] - }, - { - "description": "fs:scope-app-recursive -> This scope recursive access to the complete `$APP` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-app-recursive" - ] - }, - { - "description": "fs:scope-appcache -> This scope permits access to all files and list content of top level directories in the `$APPCACHE`folder.", - "type": "string", - "enum": [ - "fs:scope-appcache" - ] - }, - { - "description": "fs:scope-appcache-index -> This scope permits to list all files and folders in the `$APPCACHE`folder.", - "type": "string", - "enum": [ - "fs:scope-appcache-index" - ] - }, - { - "description": "fs:scope-appcache-recursive -> This scope recursive access to the complete `$APPCACHE` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-appcache-recursive" - ] - }, - { - "description": "fs:scope-appconfig -> This scope permits access to all files and list content of top level directories in the `$APPCONFIG`folder.", - "type": "string", - "enum": [ - "fs:scope-appconfig" - ] - }, - { - "description": "fs:scope-appconfig-index -> This scope permits to list all files and folders in the `$APPCONFIG`folder.", - "type": "string", - "enum": [ - "fs:scope-appconfig-index" - ] - }, - { - "description": "fs:scope-appconfig-recursive -> This scope recursive access to the complete `$APPCONFIG` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-appconfig-recursive" - ] - }, - { - "description": "fs:scope-appdata -> This scope permits access to all files and list content of top level directories in the `$APPDATA`folder.", - "type": "string", - "enum": [ - "fs:scope-appdata" - ] - }, - { - "description": "fs:scope-appdata-index -> This scope permits to list all files and folders in the `$APPDATA`folder.", - "type": "string", - "enum": [ - "fs:scope-appdata-index" - ] - }, - { - "description": "fs:scope-appdata-recursive -> This scope recursive access to the complete `$APPDATA` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-appdata-recursive" - ] - }, - { - "description": "fs:scope-applocaldata -> This scope permits access to all files and list content of top level directories in the `$APPLOCALDATA`folder.", - "type": "string", - "enum": [ - "fs:scope-applocaldata" - ] - }, - { - "description": "fs:scope-applocaldata-index -> This scope permits to list all files and folders in the `$APPLOCALDATA`folder.", - "type": "string", - "enum": [ - "fs:scope-applocaldata-index" - ] - }, - { - "description": "fs:scope-applocaldata-recursive -> This scope recursive access to the complete `$APPLOCALDATA` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-applocaldata-recursive" - ] - }, - { - "description": "fs:scope-applog -> This scope permits access to all files and list content of top level directories in the `$APPLOG`folder.", - "type": "string", - "enum": [ - "fs:scope-applog" - ] - }, - { - "description": "fs:scope-applog-index -> This scope permits to list all files and folders in the `$APPLOG`folder.", - "type": "string", - "enum": [ - "fs:scope-applog-index" - ] - }, - { - "description": "fs:scope-applog-recursive -> This scope recursive access to the complete `$APPLOG` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-applog-recursive" - ] - }, - { - "description": "fs:scope-audio -> This scope permits access to all files and list content of top level directories in the `$AUDIO`folder.", - "type": "string", - "enum": [ - "fs:scope-audio" - ] - }, - { - "description": "fs:scope-audio-index -> This scope permits to list all files and folders in the `$AUDIO`folder.", - "type": "string", - "enum": [ - "fs:scope-audio-index" - ] - }, - { - "description": "fs:scope-audio-recursive -> This scope recursive access to the complete `$AUDIO` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-audio-recursive" - ] - }, - { - "description": "fs:scope-cache -> This scope permits access to all files and list content of top level directories in the `$CACHE`folder.", - "type": "string", - "enum": [ - "fs:scope-cache" - ] - }, - { - "description": "fs:scope-cache-index -> This scope permits to list all files and folders in the `$CACHE`folder.", - "type": "string", - "enum": [ - "fs:scope-cache-index" - ] - }, - { - "description": "fs:scope-cache-recursive -> This scope recursive access to the complete `$CACHE` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-cache-recursive" - ] - }, - { - "description": "fs:scope-config -> This scope permits access to all files and list content of top level directories in the `$CONFIG`folder.", - "type": "string", - "enum": [ - "fs:scope-config" - ] - }, - { - "description": "fs:scope-config-index -> This scope permits to list all files and folders in the `$CONFIG`folder.", - "type": "string", - "enum": [ - "fs:scope-config-index" - ] - }, - { - "description": "fs:scope-config-recursive -> This scope recursive access to the complete `$CONFIG` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-config-recursive" - ] - }, - { - "description": "fs:scope-data -> This scope permits access to all files and list content of top level directories in the `$DATA`folder.", - "type": "string", - "enum": [ - "fs:scope-data" - ] - }, - { - "description": "fs:scope-data-index -> This scope permits to list all files and folders in the `$DATA`folder.", - "type": "string", - "enum": [ - "fs:scope-data-index" - ] - }, - { - "description": "fs:scope-data-recursive -> This scope recursive access to the complete `$DATA` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-data-recursive" - ] - }, - { - "description": "fs:scope-desktop -> This scope permits access to all files and list content of top level directories in the `$DESKTOP`folder.", - "type": "string", - "enum": [ - "fs:scope-desktop" - ] - }, - { - "description": "fs:scope-desktop-index -> This scope permits to list all files and folders in the `$DESKTOP`folder.", - "type": "string", - "enum": [ - "fs:scope-desktop-index" - ] - }, - { - "description": "fs:scope-desktop-recursive -> This scope recursive access to the complete `$DESKTOP` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-desktop-recursive" - ] - }, - { - "description": "fs:scope-document -> This scope permits access to all files and list content of top level directories in the `$DOCUMENT`folder.", - "type": "string", - "enum": [ - "fs:scope-document" - ] - }, - { - "description": "fs:scope-document-index -> This scope permits to list all files and folders in the `$DOCUMENT`folder.", - "type": "string", - "enum": [ - "fs:scope-document-index" - ] - }, - { - "description": "fs:scope-document-recursive -> This scope recursive access to the complete `$DOCUMENT` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-document-recursive" - ] - }, - { - "description": "fs:scope-download -> This scope permits access to all files and list content of top level directories in the `$DOWNLOAD`folder.", - "type": "string", - "enum": [ - "fs:scope-download" - ] - }, - { - "description": "fs:scope-download-index -> This scope permits to list all files and folders in the `$DOWNLOAD`folder.", - "type": "string", - "enum": [ - "fs:scope-download-index" - ] - }, - { - "description": "fs:scope-download-recursive -> This scope recursive access to the complete `$DOWNLOAD` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-download-recursive" - ] - }, - { - "description": "fs:scope-exe -> This scope permits access to all files and list content of top level directories in the `$EXE`folder.", - "type": "string", - "enum": [ - "fs:scope-exe" - ] - }, - { - "description": "fs:scope-exe-index -> This scope permits to list all files and folders in the `$EXE`folder.", - "type": "string", - "enum": [ - "fs:scope-exe-index" - ] - }, - { - "description": "fs:scope-exe-recursive -> This scope recursive access to the complete `$EXE` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-exe-recursive" - ] - }, - { - "description": "fs:scope-font -> This scope permits access to all files and list content of top level directories in the `$FONT`folder.", - "type": "string", - "enum": [ - "fs:scope-font" - ] - }, - { - "description": "fs:scope-font-index -> This scope permits to list all files and folders in the `$FONT`folder.", - "type": "string", - "enum": [ - "fs:scope-font-index" - ] - }, - { - "description": "fs:scope-font-recursive -> This scope recursive access to the complete `$FONT` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-font-recursive" - ] - }, - { - "description": "fs:scope-home -> This scope permits access to all files and list content of top level directories in the `$HOME`folder.", - "type": "string", - "enum": [ - "fs:scope-home" - ] - }, - { - "description": "fs:scope-home-index -> This scope permits to list all files and folders in the `$HOME`folder.", - "type": "string", - "enum": [ - "fs:scope-home-index" - ] - }, - { - "description": "fs:scope-home-recursive -> This scope recursive access to the complete `$HOME` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-home-recursive" - ] - }, - { - "description": "fs:scope-localdata -> This scope permits access to all files and list content of top level directories in the `$LOCALDATA`folder.", - "type": "string", - "enum": [ - "fs:scope-localdata" - ] - }, - { - "description": "fs:scope-localdata-index -> This scope permits to list all files and folders in the `$LOCALDATA`folder.", - "type": "string", - "enum": [ - "fs:scope-localdata-index" - ] - }, - { - "description": "fs:scope-localdata-recursive -> This scope recursive access to the complete `$LOCALDATA` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-localdata-recursive" - ] - }, - { - "description": "fs:scope-log -> This scope permits access to all files and list content of top level directories in the `$LOG`folder.", - "type": "string", - "enum": [ - "fs:scope-log" - ] - }, - { - "description": "fs:scope-log-index -> This scope permits to list all files and folders in the `$LOG`folder.", - "type": "string", - "enum": [ - "fs:scope-log-index" - ] - }, - { - "description": "fs:scope-log-recursive -> This scope recursive access to the complete `$LOG` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-log-recursive" - ] - }, - { - "description": "fs:scope-picture -> This scope permits access to all files and list content of top level directories in the `$PICTURE`folder.", - "type": "string", - "enum": [ - "fs:scope-picture" - ] - }, - { - "description": "fs:scope-picture-index -> This scope permits to list all files and folders in the `$PICTURE`folder.", - "type": "string", - "enum": [ - "fs:scope-picture-index" - ] - }, - { - "description": "fs:scope-picture-recursive -> This scope recursive access to the complete `$PICTURE` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-picture-recursive" - ] - }, - { - "description": "fs:scope-public -> This scope permits access to all files and list content of top level directories in the `$PUBLIC`folder.", - "type": "string", - "enum": [ - "fs:scope-public" - ] - }, - { - "description": "fs:scope-public-index -> This scope permits to list all files and folders in the `$PUBLIC`folder.", - "type": "string", - "enum": [ - "fs:scope-public-index" - ] - }, - { - "description": "fs:scope-public-recursive -> This scope recursive access to the complete `$PUBLIC` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-public-recursive" - ] - }, - { - "description": "fs:scope-resource -> This scope permits access to all files and list content of top level directories in the `$RESOURCE`folder.", - "type": "string", - "enum": [ - "fs:scope-resource" - ] - }, - { - "description": "fs:scope-resource-index -> This scope permits to list all files and folders in the `$RESOURCE`folder.", - "type": "string", - "enum": [ - "fs:scope-resource-index" - ] - }, - { - "description": "fs:scope-resource-recursive -> This scope recursive access to the complete `$RESOURCE` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-resource-recursive" - ] - }, - { - "description": "fs:scope-runtime -> This scope permits access to all files and list content of top level directories in the `$RUNTIME`folder.", - "type": "string", - "enum": [ - "fs:scope-runtime" - ] - }, - { - "description": "fs:scope-runtime-index -> This scope permits to list all files and folders in the `$RUNTIME`folder.", - "type": "string", - "enum": [ - "fs:scope-runtime-index" - ] - }, - { - "description": "fs:scope-runtime-recursive -> This scope recursive access to the complete `$RUNTIME` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-runtime-recursive" - ] - }, - { - "description": "fs:scope-temp -> This scope permits access to all files and list content of top level directories in the `$TEMP`folder.", - "type": "string", - "enum": [ - "fs:scope-temp" - ] - }, - { - "description": "fs:scope-temp-index -> This scope permits to list all files and folders in the `$TEMP`folder.", - "type": "string", - "enum": [ - "fs:scope-temp-index" - ] - }, - { - "description": "fs:scope-temp-recursive -> This scope recursive access to the complete `$TEMP` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-temp-recursive" - ] - }, - { - "description": "fs:scope-template -> This scope permits access to all files and list content of top level directories in the `$TEMPLATE`folder.", - "type": "string", - "enum": [ - "fs:scope-template" - ] - }, - { - "description": "fs:scope-template-index -> This scope permits to list all files and folders in the `$TEMPLATE`folder.", - "type": "string", - "enum": [ - "fs:scope-template-index" - ] - }, - { - "description": "fs:scope-template-recursive -> This scope recursive access to the complete `$TEMPLATE` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-template-recursive" - ] - }, - { - "description": "fs:scope-video -> This scope permits access to all files and list content of top level directories in the `$VIDEO`folder.", - "type": "string", - "enum": [ - "fs:scope-video" - ] - }, - { - "description": "fs:scope-video-index -> This scope permits to list all files and folders in the `$VIDEO`folder.", - "type": "string", - "enum": [ - "fs:scope-video-index" - ] - }, - { - "description": "fs:scope-video-recursive -> This scope recursive access to the complete `$VIDEO` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-video-recursive" - ] - }, - { - "description": "fs:write-all -> This enables all write related commands without any pre-configured accessible paths.", - "type": "string", - "enum": [ - "fs:write-all" - ] - }, - { - "description": "fs:write-files -> This enables all file write related commands without any pre-configured accessible paths.", - "type": "string", - "enum": [ - "fs:write-files" - ] - } - ] - }, - "allow": { - "items": { - "title": "Entry", - "type": "object", - "required": [ - "path" - ], - "properties": { - "path": { - "type": "string" - } - } - } - }, - "deny": { - "items": { - "title": "Entry", - "type": "object", - "required": [ - "path" - ], - "properties": { - "path": { - "type": "string" - } - } - } - } - } - }, - { - "type": "object", - "required": [ - "identifier" - ], - "properties": { - "identifier": { - "oneOf": [ - { - "description": "http:default -> Allows all fetch operations", - "type": "string", - "enum": [ - "http:default" - ] - }, - { - "description": "http:allow-fetch -> Enables the fetch command without any pre-configured scope.", - "type": "string", - "enum": [ - "http:allow-fetch" - ] - }, - { - "description": "http:allow-fetch-cancel -> Enables the fetch_cancel command without any pre-configured scope.", - "type": "string", - "enum": [ - "http:allow-fetch-cancel" - ] - }, - { - "description": "http:allow-fetch-read-body -> Enables the fetch_read_body command without any pre-configured scope.", - "type": "string", - "enum": [ - "http:allow-fetch-read-body" - ] - }, - { - "description": "http:allow-fetch-send -> Enables the fetch_send command without any pre-configured scope.", - "type": "string", - "enum": [ - "http:allow-fetch-send" - ] - }, - { - "description": "http:deny-fetch -> Denies the fetch command without any pre-configured scope.", - "type": "string", - "enum": [ - "http:deny-fetch" - ] - }, - { - "description": "http:deny-fetch-cancel -> Denies the fetch_cancel command without any pre-configured scope.", - "type": "string", - "enum": [ - "http:deny-fetch-cancel" - ] - }, - { - "description": "http:deny-fetch-read-body -> Denies the fetch_read_body command without any pre-configured scope.", - "type": "string", - "enum": [ - "http:deny-fetch-read-body" - ] - }, - { - "description": "http:deny-fetch-send -> Denies the fetch_send command without any pre-configured scope.", - "type": "string", - "enum": [ - "http:deny-fetch-send" - ] - } - ] - }, - "allow": { - "items": { - "title": "ScopeEntry", - "description": "HTTP scope entry object definition.", - "type": "object", - "required": [ - "url" - ], - "properties": { - "url": { - "description": "A URL that can be accessed by the webview when using the HTTP APIs. The scoped URL is matched against the request URL using a glob pattern.\n\nExamples:\n\n- \"https://*\" or \"https://**\" : allows all HTTPS urls\n\n- \"https://*.github.com/tauri-apps/tauri\": allows any subdomain of \"github.com\" with the \"tauri-apps/api\" path\n\n- \"https://myapi.service.com/users/*\": allows access to any URLs that begins with \"https://myapi.service.com/users/\"", - "type": "string" - } - } - } - }, - "deny": { - "items": { - "title": "ScopeEntry", - "description": "HTTP scope entry object definition.", - "type": "object", - "required": [ - "url" - ], - "properties": { - "url": { - "description": "A URL that can be accessed by the webview when using the HTTP APIs. The scoped URL is matched against the request URL using a glob pattern.\n\nExamples:\n\n- \"https://*\" or \"https://**\" : allows all HTTPS urls\n\n- \"https://*.github.com/tauri-apps/tauri\": allows any subdomain of \"github.com\" with the \"tauri-apps/api\" path\n\n- \"https://myapi.service.com/users/*\": allows access to any URLs that begins with \"https://myapi.service.com/users/\"", - "type": "string" - } - } - } - } - } - }, - { - "type": "object", - "required": [ - "identifier" - ], - "properties": { - "identifier": { - "oneOf": [ - { - "description": "shell:allow-execute -> Enables the execute command without any pre-configured scope.", - "type": "string", - "enum": [ - "shell:allow-execute" - ] - }, - { - "description": "shell:allow-kill -> Enables the kill command without any pre-configured scope.", - "type": "string", - "enum": [ - "shell:allow-kill" - ] - }, - { - "description": "shell:allow-open -> Enables the open command without any pre-configured scope.", - "type": "string", - "enum": [ - "shell:allow-open" - ] - }, - { - "description": "shell:allow-stdin-write -> Enables the stdin_write command without any pre-configured scope.", - "type": "string", - "enum": [ - "shell:allow-stdin-write" - ] - }, - { - "description": "shell:deny-execute -> Denies the execute command without any pre-configured scope.", - "type": "string", - "enum": [ - "shell:deny-execute" - ] - }, - { - "description": "shell:deny-kill -> Denies the kill command without any pre-configured scope.", - "type": "string", - "enum": [ - "shell:deny-kill" - ] - }, - { - "description": "shell:deny-open -> Denies the open command without any pre-configured scope.", - "type": "string", - "enum": [ - "shell:deny-open" - ] - }, - { - "description": "shell:deny-stdin-write -> Denies the stdin_write command without any pre-configured scope.", - "type": "string", - "enum": [ - "shell:deny-stdin-write" - ] - } - ] - }, - "allow": { - "items": { - "title": "Entry", - "description": "A command allowed to be executed by the webview API.", - "type": "object", - "required": [ - "args", - "command", - "name", - "sidecar" - ], - "properties": { - "args": { - "description": "The allowed arguments for the command execution.", - "allOf": [ - { - "$ref": "#/definitions/ShellAllowedArgs" - } - ] - }, - "command": { - "description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.", - "type": "string" - }, - "name": { - "description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.", - "type": "string" - }, - "sidecar": { - "description": "If this command is a sidecar command.", - "type": "boolean" - } - } - } - }, - "deny": { - "items": { - "title": "Entry", - "description": "A command allowed to be executed by the webview API.", - "type": "object", - "required": [ - "args", - "command", - "name", - "sidecar" - ], - "properties": { - "args": { - "description": "The allowed arguments for the command execution.", - "allOf": [ - { - "$ref": "#/definitions/ShellAllowedArgs" - } - ] - }, - "command": { - "description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.", - "type": "string" - }, - "name": { - "description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.", - "type": "string" - }, - "sidecar": { - "description": "If this command is a sidecar command.", - "type": "boolean" - } - } - } - } - } - } - ] - } - ] - }, - "Identifier": { - "oneOf": [ - { - "description": "app:default -> Default permissions for the plugin.", - "type": "string", - "enum": [ - "app:default" - ] - }, - { - "description": "app:allow-app-hide -> Enables the app_hide command without any pre-configured scope.", - "type": "string", - "enum": [ - "app:allow-app-hide" - ] - }, - { - "description": "app:allow-app-show -> Enables the app_show command without any pre-configured scope.", - "type": "string", - "enum": [ - "app:allow-app-show" - ] - }, - { - "description": "app:allow-name -> Enables the name command without any pre-configured scope.", - "type": "string", - "enum": [ - "app:allow-name" - ] - }, - { - "description": "app:allow-tauri-version -> Enables the tauri_version command without any pre-configured scope.", - "type": "string", - "enum": [ - "app:allow-tauri-version" - ] - }, - { - "description": "app:allow-version -> Enables the version command without any pre-configured scope.", - "type": "string", - "enum": [ - "app:allow-version" - ] - }, - { - "description": "app:deny-app-hide -> Denies the app_hide command without any pre-configured scope.", - "type": "string", - "enum": [ - "app:deny-app-hide" - ] - }, - { - "description": "app:deny-app-show -> Denies the app_show command without any pre-configured scope.", - "type": "string", - "enum": [ - "app:deny-app-show" - ] - }, - { - "description": "app:deny-name -> Denies the name command without any pre-configured scope.", - "type": "string", - "enum": [ - "app:deny-name" - ] - }, - { - "description": "app:deny-tauri-version -> Denies the tauri_version command without any pre-configured scope.", - "type": "string", - "enum": [ - "app:deny-tauri-version" - ] - }, - { - "description": "app:deny-version -> Denies the version command without any pre-configured scope.", - "type": "string", - "enum": [ - "app:deny-version" - ] - }, - { - "description": "cli:default -> Allows reading the CLI matches", - "type": "string", - "enum": [ - "cli:default" - ] - }, - { - "description": "cli:allow-cli-matches -> Enables the cli_matches command without any pre-configured scope.", - "type": "string", - "enum": [ - "cli:allow-cli-matches" - ] - }, - { - "description": "cli:deny-cli-matches -> Denies the cli_matches command without any pre-configured scope.", - "type": "string", - "enum": [ - "cli:deny-cli-matches" - ] - }, - { - "description": "clipboard-manager:allow-read -> Enables the read command without any pre-configured scope.", - "type": "string", - "enum": [ - "clipboard-manager:allow-read" - ] - }, - { - "description": "clipboard-manager:allow-write -> Enables the write command without any pre-configured scope.", - "type": "string", - "enum": [ - "clipboard-manager:allow-write" - ] - }, - { - "description": "clipboard-manager:deny-read -> Denies the read command without any pre-configured scope.", - "type": "string", - "enum": [ - "clipboard-manager:deny-read" - ] - }, - { - "description": "clipboard-manager:deny-write -> Denies the write command without any pre-configured scope.", - "type": "string", - "enum": [ - "clipboard-manager:deny-write" - ] - }, - { - "description": "dialog:allow-ask -> Enables the ask command without any pre-configured scope.", - "type": "string", - "enum": [ - "dialog:allow-ask" - ] - }, - { - "description": "dialog:allow-confirm -> Enables the confirm command without any pre-configured scope.", - "type": "string", - "enum": [ - "dialog:allow-confirm" - ] - }, - { - "description": "dialog:allow-message -> Enables the message command without any pre-configured scope.", - "type": "string", - "enum": [ - "dialog:allow-message" - ] - }, - { - "description": "dialog:allow-open -> Enables the open command without any pre-configured scope.", - "type": "string", - "enum": [ - "dialog:allow-open" - ] - }, - { - "description": "dialog:allow-save -> Enables the save command without any pre-configured scope.", - "type": "string", - "enum": [ - "dialog:allow-save" - ] - }, - { - "description": "dialog:deny-ask -> Denies the ask command without any pre-configured scope.", - "type": "string", - "enum": [ - "dialog:deny-ask" - ] - }, - { - "description": "dialog:deny-confirm -> Denies the confirm command without any pre-configured scope.", - "type": "string", - "enum": [ - "dialog:deny-confirm" - ] - }, - { - "description": "dialog:deny-message -> Denies the message command without any pre-configured scope.", - "type": "string", - "enum": [ - "dialog:deny-message" - ] - }, - { - "description": "dialog:deny-open -> Denies the open command without any pre-configured scope.", - "type": "string", - "enum": [ - "dialog:deny-open" - ] - }, - { - "description": "dialog:deny-save -> Denies the save command without any pre-configured scope.", - "type": "string", - "enum": [ - "dialog:deny-save" - ] - }, - { - "description": "event:default -> Default permissions for the plugin.", - "type": "string", - "enum": [ - "event:default" - ] - }, - { - "description": "event:allow-emit -> Enables the emit command without any pre-configured scope.", - "type": "string", - "enum": [ - "event:allow-emit" - ] - }, - { - "description": "event:allow-emit-to -> Enables the emit_to command without any pre-configured scope.", - "type": "string", - "enum": [ - "event:allow-emit-to" - ] - }, - { - "description": "event:allow-listen -> Enables the listen command without any pre-configured scope.", - "type": "string", - "enum": [ - "event:allow-listen" - ] - }, - { - "description": "event:allow-unlisten -> Enables the unlisten command without any pre-configured scope.", - "type": "string", - "enum": [ - "event:allow-unlisten" - ] - }, - { - "description": "event:deny-emit -> Denies the emit command without any pre-configured scope.", - "type": "string", - "enum": [ - "event:deny-emit" - ] - }, - { - "description": "event:deny-emit-to -> Denies the emit_to command without any pre-configured scope.", - "type": "string", - "enum": [ - "event:deny-emit-to" - ] - }, - { - "description": "event:deny-listen -> Denies the listen command without any pre-configured scope.", - "type": "string", - "enum": [ - "event:deny-listen" - ] - }, - { - "description": "event:deny-unlisten -> Denies the unlisten command without any pre-configured scope.", - "type": "string", - "enum": [ - "event:deny-unlisten" - ] - }, - { - "description": "fs:allow-app-meta -> This allows read access to metadata of the `$APP` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-app-meta" - ] - }, - { - "description": "fs:allow-app-meta-recursive -> This allows read access to metadata of the `$APP` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-app-meta-recursive" - ] - }, - { - "description": "fs:allow-app-read -> This allows non-recursive read access to the `$APP` folder.", - "type": "string", - "enum": [ - "fs:allow-app-read" - ] - }, - { - "description": "fs:allow-app-read-recursive -> This allows full recursive read access to the complete `$APP` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-app-read-recursive" - ] - }, - { - "description": "fs:allow-app-write -> This allows non-recursive write access to the `$APP` folder.", - "type": "string", - "enum": [ - "fs:allow-app-write" - ] - }, - { - "description": "fs:allow-app-write-recursive -> This allows full recusrive write access to the complete `$APP` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-app-write-recursive" - ] - }, - { - "description": "fs:allow-appcache-meta -> This allows read access to metadata of the `$APPCACHE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-appcache-meta" - ] - }, - { - "description": "fs:allow-appcache-meta-recursive -> This allows read access to metadata of the `$APPCACHE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-appcache-meta-recursive" - ] - }, - { - "description": "fs:allow-appcache-read -> This allows non-recursive read access to the `$APPCACHE` folder.", - "type": "string", - "enum": [ - "fs:allow-appcache-read" - ] - }, - { - "description": "fs:allow-appcache-read-recursive -> This allows full recursive read access to the complete `$APPCACHE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-appcache-read-recursive" - ] - }, - { - "description": "fs:allow-appcache-write -> This allows non-recursive write access to the `$APPCACHE` folder.", - "type": "string", - "enum": [ - "fs:allow-appcache-write" - ] - }, - { - "description": "fs:allow-appcache-write-recursive -> This allows full recusrive write access to the complete `$APPCACHE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-appcache-write-recursive" - ] - }, - { - "description": "fs:allow-appconfig-meta -> This allows read access to metadata of the `$APPCONFIG` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-appconfig-meta" - ] - }, - { - "description": "fs:allow-appconfig-meta-recursive -> This allows read access to metadata of the `$APPCONFIG` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-appconfig-meta-recursive" - ] - }, - { - "description": "fs:allow-appconfig-read -> This allows non-recursive read access to the `$APPCONFIG` folder.", - "type": "string", - "enum": [ - "fs:allow-appconfig-read" - ] - }, - { - "description": "fs:allow-appconfig-read-recursive -> This allows full recursive read access to the complete `$APPCONFIG` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-appconfig-read-recursive" - ] - }, - { - "description": "fs:allow-appconfig-write -> This allows non-recursive write access to the `$APPCONFIG` folder.", - "type": "string", - "enum": [ - "fs:allow-appconfig-write" - ] - }, - { - "description": "fs:allow-appconfig-write-recursive -> This allows full recusrive write access to the complete `$APPCONFIG` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-appconfig-write-recursive" - ] - }, - { - "description": "fs:allow-appdata-meta -> This allows read access to metadata of the `$APPDATA` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-appdata-meta" - ] - }, - { - "description": "fs:allow-appdata-meta-recursive -> This allows read access to metadata of the `$APPDATA` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-appdata-meta-recursive" - ] - }, - { - "description": "fs:allow-appdata-read -> This allows non-recursive read access to the `$APPDATA` folder.", - "type": "string", - "enum": [ - "fs:allow-appdata-read" - ] - }, - { - "description": "fs:allow-appdata-read-recursive -> This allows full recursive read access to the complete `$APPDATA` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-appdata-read-recursive" - ] - }, - { - "description": "fs:allow-appdata-write -> This allows non-recursive write access to the `$APPDATA` folder.", - "type": "string", - "enum": [ - "fs:allow-appdata-write" - ] - }, - { - "description": "fs:allow-appdata-write-recursive -> This allows full recusrive write access to the complete `$APPDATA` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-appdata-write-recursive" - ] - }, - { - "description": "fs:allow-applocaldata-meta -> This allows read access to metadata of the `$APPLOCALDATA` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-applocaldata-meta" - ] - }, - { - "description": "fs:allow-applocaldata-meta-recursive -> This allows read access to metadata of the `$APPLOCALDATA` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-applocaldata-meta-recursive" - ] - }, - { - "description": "fs:allow-applocaldata-read -> This allows non-recursive read access to the `$APPLOCALDATA` folder.", - "type": "string", - "enum": [ - "fs:allow-applocaldata-read" - ] - }, - { - "description": "fs:allow-applocaldata-read-recursive -> This allows full recursive read access to the complete `$APPLOCALDATA` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-applocaldata-read-recursive" - ] - }, - { - "description": "fs:allow-applocaldata-write -> This allows non-recursive write access to the `$APPLOCALDATA` folder.", - "type": "string", - "enum": [ - "fs:allow-applocaldata-write" - ] - }, - { - "description": "fs:allow-applocaldata-write-recursive -> This allows full recusrive write access to the complete `$APPLOCALDATA` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-applocaldata-write-recursive" - ] - }, - { - "description": "fs:allow-applog-meta -> This allows read access to metadata of the `$APPLOG` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-applog-meta" - ] - }, - { - "description": "fs:allow-applog-meta-recursive -> This allows read access to metadata of the `$APPLOG` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-applog-meta-recursive" - ] - }, - { - "description": "fs:allow-applog-read -> This allows non-recursive read access to the `$APPLOG` folder.", - "type": "string", - "enum": [ - "fs:allow-applog-read" - ] - }, - { - "description": "fs:allow-applog-read-recursive -> This allows full recursive read access to the complete `$APPLOG` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-applog-read-recursive" - ] - }, - { - "description": "fs:allow-applog-write -> This allows non-recursive write access to the `$APPLOG` folder.", - "type": "string", - "enum": [ - "fs:allow-applog-write" - ] - }, - { - "description": "fs:allow-applog-write-recursive -> This allows full recusrive write access to the complete `$APPLOG` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-applog-write-recursive" - ] - }, - { - "description": "fs:allow-audio-meta -> This allows read access to metadata of the `$AUDIO` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-audio-meta" - ] - }, - { - "description": "fs:allow-audio-meta-recursive -> This allows read access to metadata of the `$AUDIO` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-audio-meta-recursive" - ] - }, - { - "description": "fs:allow-audio-read -> This allows non-recursive read access to the `$AUDIO` folder.", - "type": "string", - "enum": [ - "fs:allow-audio-read" - ] - }, - { - "description": "fs:allow-audio-read-recursive -> This allows full recursive read access to the complete `$AUDIO` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-audio-read-recursive" - ] - }, - { - "description": "fs:allow-audio-write -> This allows non-recursive write access to the `$AUDIO` folder.", - "type": "string", - "enum": [ - "fs:allow-audio-write" - ] - }, - { - "description": "fs:allow-audio-write-recursive -> This allows full recusrive write access to the complete `$AUDIO` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-audio-write-recursive" - ] - }, - { - "description": "fs:allow-cache-meta -> This allows read access to metadata of the `$CACHE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-cache-meta" - ] - }, - { - "description": "fs:allow-cache-meta-recursive -> This allows read access to metadata of the `$CACHE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-cache-meta-recursive" - ] - }, - { - "description": "fs:allow-cache-read -> This allows non-recursive read access to the `$CACHE` folder.", - "type": "string", - "enum": [ - "fs:allow-cache-read" - ] - }, - { - "description": "fs:allow-cache-read-recursive -> This allows full recursive read access to the complete `$CACHE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-cache-read-recursive" - ] - }, - { - "description": "fs:allow-cache-write -> This allows non-recursive write access to the `$CACHE` folder.", - "type": "string", - "enum": [ - "fs:allow-cache-write" - ] - }, - { - "description": "fs:allow-cache-write-recursive -> This allows full recusrive write access to the complete `$CACHE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-cache-write-recursive" - ] - }, - { - "description": "fs:allow-config-meta -> This allows read access to metadata of the `$CONFIG` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-config-meta" - ] - }, - { - "description": "fs:allow-config-meta-recursive -> This allows read access to metadata of the `$CONFIG` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-config-meta-recursive" - ] - }, - { - "description": "fs:allow-config-read -> This allows non-recursive read access to the `$CONFIG` folder.", - "type": "string", - "enum": [ - "fs:allow-config-read" - ] - }, - { - "description": "fs:allow-config-read-recursive -> This allows full recursive read access to the complete `$CONFIG` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-config-read-recursive" - ] - }, - { - "description": "fs:allow-config-write -> This allows non-recursive write access to the `$CONFIG` folder.", - "type": "string", - "enum": [ - "fs:allow-config-write" - ] - }, - { - "description": "fs:allow-config-write-recursive -> This allows full recusrive write access to the complete `$CONFIG` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-config-write-recursive" - ] - }, - { - "description": "fs:allow-data-meta -> This allows read access to metadata of the `$DATA` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-data-meta" - ] - }, - { - "description": "fs:allow-data-meta-recursive -> This allows read access to metadata of the `$DATA` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-data-meta-recursive" - ] - }, - { - "description": "fs:allow-data-read -> This allows non-recursive read access to the `$DATA` folder.", - "type": "string", - "enum": [ - "fs:allow-data-read" - ] - }, - { - "description": "fs:allow-data-read-recursive -> This allows full recursive read access to the complete `$DATA` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-data-read-recursive" - ] - }, - { - "description": "fs:allow-data-write -> This allows non-recursive write access to the `$DATA` folder.", - "type": "string", - "enum": [ - "fs:allow-data-write" - ] - }, - { - "description": "fs:allow-data-write-recursive -> This allows full recusrive write access to the complete `$DATA` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-data-write-recursive" - ] - }, - { - "description": "fs:allow-desktop-meta -> This allows read access to metadata of the `$DESKTOP` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-desktop-meta" - ] - }, - { - "description": "fs:allow-desktop-meta-recursive -> This allows read access to metadata of the `$DESKTOP` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-desktop-meta-recursive" - ] - }, - { - "description": "fs:allow-desktop-read -> This allows non-recursive read access to the `$DESKTOP` folder.", - "type": "string", - "enum": [ - "fs:allow-desktop-read" - ] - }, - { - "description": "fs:allow-desktop-read-recursive -> This allows full recursive read access to the complete `$DESKTOP` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-desktop-read-recursive" - ] - }, - { - "description": "fs:allow-desktop-write -> This allows non-recursive write access to the `$DESKTOP` folder.", - "type": "string", - "enum": [ - "fs:allow-desktop-write" - ] - }, - { - "description": "fs:allow-desktop-write-recursive -> This allows full recusrive write access to the complete `$DESKTOP` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-desktop-write-recursive" - ] - }, - { - "description": "fs:allow-document-meta -> This allows read access to metadata of the `$DOCUMENT` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-document-meta" - ] - }, - { - "description": "fs:allow-document-meta-recursive -> This allows read access to metadata of the `$DOCUMENT` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-document-meta-recursive" - ] - }, - { - "description": "fs:allow-document-read -> This allows non-recursive read access to the `$DOCUMENT` folder.", - "type": "string", - "enum": [ - "fs:allow-document-read" - ] - }, - { - "description": "fs:allow-document-read-recursive -> This allows full recursive read access to the complete `$DOCUMENT` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-document-read-recursive" - ] - }, - { - "description": "fs:allow-document-write -> This allows non-recursive write access to the `$DOCUMENT` folder.", - "type": "string", - "enum": [ - "fs:allow-document-write" - ] - }, - { - "description": "fs:allow-document-write-recursive -> This allows full recusrive write access to the complete `$DOCUMENT` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-document-write-recursive" - ] - }, - { - "description": "fs:allow-download-meta -> This allows read access to metadata of the `$DOWNLOAD` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-download-meta" - ] - }, - { - "description": "fs:allow-download-meta-recursive -> This allows read access to metadata of the `$DOWNLOAD` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-download-meta-recursive" - ] - }, - { - "description": "fs:allow-download-read -> This allows non-recursive read access to the `$DOWNLOAD` folder.", - "type": "string", - "enum": [ - "fs:allow-download-read" - ] - }, - { - "description": "fs:allow-download-read-recursive -> This allows full recursive read access to the complete `$DOWNLOAD` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-download-read-recursive" - ] - }, - { - "description": "fs:allow-download-write -> This allows non-recursive write access to the `$DOWNLOAD` folder.", - "type": "string", - "enum": [ - "fs:allow-download-write" - ] - }, - { - "description": "fs:allow-download-write-recursive -> This allows full recusrive write access to the complete `$DOWNLOAD` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-download-write-recursive" - ] - }, - { - "description": "fs:allow-exe-meta -> This allows read access to metadata of the `$EXE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-exe-meta" - ] - }, - { - "description": "fs:allow-exe-meta-recursive -> This allows read access to metadata of the `$EXE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-exe-meta-recursive" - ] - }, - { - "description": "fs:allow-exe-read -> This allows non-recursive read access to the `$EXE` folder.", - "type": "string", - "enum": [ - "fs:allow-exe-read" - ] - }, - { - "description": "fs:allow-exe-read-recursive -> This allows full recursive read access to the complete `$EXE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-exe-read-recursive" - ] - }, - { - "description": "fs:allow-exe-write -> This allows non-recursive write access to the `$EXE` folder.", - "type": "string", - "enum": [ - "fs:allow-exe-write" - ] - }, - { - "description": "fs:allow-exe-write-recursive -> This allows full recusrive write access to the complete `$EXE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-exe-write-recursive" - ] - }, - { - "description": "fs:allow-font-meta -> This allows read access to metadata of the `$FONT` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-font-meta" - ] - }, - { - "description": "fs:allow-font-meta-recursive -> This allows read access to metadata of the `$FONT` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-font-meta-recursive" - ] - }, - { - "description": "fs:allow-font-read -> This allows non-recursive read access to the `$FONT` folder.", - "type": "string", - "enum": [ - "fs:allow-font-read" - ] - }, - { - "description": "fs:allow-font-read-recursive -> This allows full recursive read access to the complete `$FONT` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-font-read-recursive" - ] - }, - { - "description": "fs:allow-font-write -> This allows non-recursive write access to the `$FONT` folder.", - "type": "string", - "enum": [ - "fs:allow-font-write" - ] - }, - { - "description": "fs:allow-font-write-recursive -> This allows full recusrive write access to the complete `$FONT` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-font-write-recursive" - ] - }, - { - "description": "fs:allow-home-meta -> This allows read access to metadata of the `$HOME` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-home-meta" - ] - }, - { - "description": "fs:allow-home-meta-recursive -> This allows read access to metadata of the `$HOME` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-home-meta-recursive" - ] - }, - { - "description": "fs:allow-home-read -> This allows non-recursive read access to the `$HOME` folder.", - "type": "string", - "enum": [ - "fs:allow-home-read" - ] - }, - { - "description": "fs:allow-home-read-recursive -> This allows full recursive read access to the complete `$HOME` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-home-read-recursive" - ] - }, - { - "description": "fs:allow-home-write -> This allows non-recursive write access to the `$HOME` folder.", - "type": "string", - "enum": [ - "fs:allow-home-write" - ] - }, - { - "description": "fs:allow-home-write-recursive -> This allows full recusrive write access to the complete `$HOME` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-home-write-recursive" - ] - }, - { - "description": "fs:allow-localdata-meta -> This allows read access to metadata of the `$LOCALDATA` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-localdata-meta" - ] - }, - { - "description": "fs:allow-localdata-meta-recursive -> This allows read access to metadata of the `$LOCALDATA` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-localdata-meta-recursive" - ] - }, - { - "description": "fs:allow-localdata-read -> This allows non-recursive read access to the `$LOCALDATA` folder.", - "type": "string", - "enum": [ - "fs:allow-localdata-read" - ] - }, - { - "description": "fs:allow-localdata-read-recursive -> This allows full recursive read access to the complete `$LOCALDATA` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-localdata-read-recursive" - ] - }, - { - "description": "fs:allow-localdata-write -> This allows non-recursive write access to the `$LOCALDATA` folder.", - "type": "string", - "enum": [ - "fs:allow-localdata-write" - ] - }, - { - "description": "fs:allow-localdata-write-recursive -> This allows full recusrive write access to the complete `$LOCALDATA` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-localdata-write-recursive" - ] - }, - { - "description": "fs:allow-log-meta -> This allows read access to metadata of the `$LOG` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-log-meta" - ] - }, - { - "description": "fs:allow-log-meta-recursive -> This allows read access to metadata of the `$LOG` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-log-meta-recursive" - ] - }, - { - "description": "fs:allow-log-read -> This allows non-recursive read access to the `$LOG` folder.", - "type": "string", - "enum": [ - "fs:allow-log-read" - ] - }, - { - "description": "fs:allow-log-read-recursive -> This allows full recursive read access to the complete `$LOG` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-log-read-recursive" - ] - }, - { - "description": "fs:allow-log-write -> This allows non-recursive write access to the `$LOG` folder.", - "type": "string", - "enum": [ - "fs:allow-log-write" - ] - }, - { - "description": "fs:allow-log-write-recursive -> This allows full recusrive write access to the complete `$LOG` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-log-write-recursive" - ] - }, - { - "description": "fs:allow-picture-meta -> This allows read access to metadata of the `$PICTURE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-picture-meta" - ] - }, - { - "description": "fs:allow-picture-meta-recursive -> This allows read access to metadata of the `$PICTURE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-picture-meta-recursive" - ] - }, - { - "description": "fs:allow-picture-read -> This allows non-recursive read access to the `$PICTURE` folder.", - "type": "string", - "enum": [ - "fs:allow-picture-read" - ] - }, - { - "description": "fs:allow-picture-read-recursive -> This allows full recursive read access to the complete `$PICTURE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-picture-read-recursive" - ] - }, - { - "description": "fs:allow-picture-write -> This allows non-recursive write access to the `$PICTURE` folder.", - "type": "string", - "enum": [ - "fs:allow-picture-write" - ] - }, - { - "description": "fs:allow-picture-write-recursive -> This allows full recusrive write access to the complete `$PICTURE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-picture-write-recursive" - ] - }, - { - "description": "fs:allow-public-meta -> This allows read access to metadata of the `$PUBLIC` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-public-meta" - ] - }, - { - "description": "fs:allow-public-meta-recursive -> This allows read access to metadata of the `$PUBLIC` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-public-meta-recursive" - ] - }, - { - "description": "fs:allow-public-read -> This allows non-recursive read access to the `$PUBLIC` folder.", - "type": "string", - "enum": [ - "fs:allow-public-read" - ] - }, - { - "description": "fs:allow-public-read-recursive -> This allows full recursive read access to the complete `$PUBLIC` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-public-read-recursive" - ] - }, - { - "description": "fs:allow-public-write -> This allows non-recursive write access to the `$PUBLIC` folder.", - "type": "string", - "enum": [ - "fs:allow-public-write" - ] - }, - { - "description": "fs:allow-public-write-recursive -> This allows full recusrive write access to the complete `$PUBLIC` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-public-write-recursive" - ] - }, - { - "description": "fs:allow-resource-meta -> This allows read access to metadata of the `$RESOURCE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-resource-meta" - ] - }, - { - "description": "fs:allow-resource-meta-recursive -> This allows read access to metadata of the `$RESOURCE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-resource-meta-recursive" - ] - }, - { - "description": "fs:allow-resource-read -> This allows non-recursive read access to the `$RESOURCE` folder.", - "type": "string", - "enum": [ - "fs:allow-resource-read" - ] - }, - { - "description": "fs:allow-resource-read-recursive -> This allows full recursive read access to the complete `$RESOURCE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-resource-read-recursive" - ] - }, - { - "description": "fs:allow-resource-write -> This allows non-recursive write access to the `$RESOURCE` folder.", - "type": "string", - "enum": [ - "fs:allow-resource-write" - ] - }, - { - "description": "fs:allow-resource-write-recursive -> This allows full recusrive write access to the complete `$RESOURCE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-resource-write-recursive" - ] - }, - { - "description": "fs:allow-runtime-meta -> This allows read access to metadata of the `$RUNTIME` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-runtime-meta" - ] - }, - { - "description": "fs:allow-runtime-meta-recursive -> This allows read access to metadata of the `$RUNTIME` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-runtime-meta-recursive" - ] - }, - { - "description": "fs:allow-runtime-read -> This allows non-recursive read access to the `$RUNTIME` folder.", - "type": "string", - "enum": [ - "fs:allow-runtime-read" - ] - }, - { - "description": "fs:allow-runtime-read-recursive -> This allows full recursive read access to the complete `$RUNTIME` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-runtime-read-recursive" - ] - }, - { - "description": "fs:allow-runtime-write -> This allows non-recursive write access to the `$RUNTIME` folder.", - "type": "string", - "enum": [ - "fs:allow-runtime-write" - ] - }, - { - "description": "fs:allow-runtime-write-recursive -> This allows full recusrive write access to the complete `$RUNTIME` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-runtime-write-recursive" - ] - }, - { - "description": "fs:allow-temp-meta -> This allows read access to metadata of the `$TEMP` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-temp-meta" - ] - }, - { - "description": "fs:allow-temp-meta-recursive -> This allows read access to metadata of the `$TEMP` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-temp-meta-recursive" - ] - }, - { - "description": "fs:allow-temp-read -> This allows non-recursive read access to the `$TEMP` folder.", - "type": "string", - "enum": [ - "fs:allow-temp-read" - ] - }, - { - "description": "fs:allow-temp-read-recursive -> This allows full recursive read access to the complete `$TEMP` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-temp-read-recursive" - ] - }, - { - "description": "fs:allow-temp-write -> This allows non-recursive write access to the `$TEMP` folder.", - "type": "string", - "enum": [ - "fs:allow-temp-write" - ] - }, - { - "description": "fs:allow-temp-write-recursive -> This allows full recusrive write access to the complete `$TEMP` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-temp-write-recursive" - ] - }, - { - "description": "fs:allow-template-meta -> This allows read access to metadata of the `$TEMPLATE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-template-meta" - ] - }, - { - "description": "fs:allow-template-meta-recursive -> This allows read access to metadata of the `$TEMPLATE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-template-meta-recursive" - ] - }, - { - "description": "fs:allow-template-read -> This allows non-recursive read access to the `$TEMPLATE` folder.", - "type": "string", - "enum": [ - "fs:allow-template-read" - ] - }, - { - "description": "fs:allow-template-read-recursive -> This allows full recursive read access to the complete `$TEMPLATE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-template-read-recursive" - ] - }, - { - "description": "fs:allow-template-write -> This allows non-recursive write access to the `$TEMPLATE` folder.", - "type": "string", - "enum": [ - "fs:allow-template-write" - ] - }, - { - "description": "fs:allow-template-write-recursive -> This allows full recusrive write access to the complete `$TEMPLATE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-template-write-recursive" - ] - }, - { - "description": "fs:allow-video-meta -> This allows read access to metadata of the `$VIDEO` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-video-meta" - ] - }, - { - "description": "fs:allow-video-meta-recursive -> This allows read access to metadata of the `$VIDEO` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-video-meta-recursive" - ] - }, - { - "description": "fs:allow-video-read -> This allows non-recursive read access to the `$VIDEO` folder.", - "type": "string", - "enum": [ - "fs:allow-video-read" - ] - }, - { - "description": "fs:allow-video-read-recursive -> This allows full recursive read access to the complete `$VIDEO` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-video-read-recursive" - ] - }, - { - "description": "fs:allow-video-write -> This allows non-recursive write access to the `$VIDEO` folder.", - "type": "string", - "enum": [ - "fs:allow-video-write" - ] - }, - { - "description": "fs:allow-video-write-recursive -> This allows full recusrive write access to the complete `$VIDEO` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-video-write-recursive" - ] - }, - { - "description": "fs:deny-default -> This denies access to dangerous Tauri relevant files and folders by default.", - "type": "string", - "enum": [ - "fs:deny-default" - ] - }, - { - "description": "fs:default -> # Tauri `fs` default permissions\n\nThis configuration file defines the default permissions granted\nto the filesystem.\n\n### Granted Permissions\n\nThis default permission set enables all read-related commands and\nallows access to the `$APP` folder and sub directories created in it.\nThe location of the `$APP` folder depends on the operating system,\nwhere the application is run.\n\nIn general the `$APP` folder needs to be manually created\nby the application at runtime, before accessing files or folders\nin it is possible.\n\n### Denied Permissions\n\nThis default permission set prevents access to critical components\nof the Tauri application by default.\nOn Windows the webview data folder access is denied.\n\n", - "type": "string", - "enum": [ - "fs:default" - ] - }, - { - "description": "fs:allow-copy-file -> Enables the copy_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-copy-file" - ] - }, - { - "description": "fs:allow-create -> Enables the create command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-create" - ] - }, - { - "description": "fs:allow-exists -> Enables the exists command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-exists" - ] - }, - { - "description": "fs:allow-fstat -> Enables the fstat command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-fstat" - ] - }, - { - "description": "fs:allow-ftruncate -> Enables the ftruncate command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-ftruncate" - ] - }, - { - "description": "fs:allow-lstat -> Enables the lstat command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-lstat" - ] - }, - { - "description": "fs:allow-mkdir -> Enables the mkdir command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-mkdir" - ] - }, - { - "description": "fs:allow-open -> Enables the open command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-open" - ] - }, - { - "description": "fs:allow-read -> Enables the read command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-read" - ] - }, - { - "description": "fs:allow-read-dir -> Enables the read_dir command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-read-dir" - ] - }, - { - "description": "fs:allow-read-file -> Enables the read_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-read-file" - ] - }, - { - "description": "fs:allow-read-text-file -> Enables the read_text_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-read-text-file" - ] - }, - { - "description": "fs:allow-read-text-file-lines -> Enables the read_text_file_lines command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-read-text-file-lines" - ] - }, - { - "description": "fs:allow-read-text-file-lines-next -> Enables the read_text_file_lines_next command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-read-text-file-lines-next" - ] - }, - { - "description": "fs:allow-remove -> Enables the remove command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-remove" - ] - }, - { - "description": "fs:allow-rename -> Enables the rename command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-rename" - ] - }, - { - "description": "fs:allow-seek -> Enables the seek command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-seek" - ] - }, - { - "description": "fs:allow-stat -> Enables the stat command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-stat" - ] - }, - { - "description": "fs:allow-truncate -> Enables the truncate command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-truncate" - ] - }, - { - "description": "fs:allow-unwatch -> Enables the unwatch command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-unwatch" - ] - }, - { - "description": "fs:allow-watch -> Enables the watch command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-watch" - ] - }, - { - "description": "fs:allow-write -> Enables the write command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-write" - ] - }, - { - "description": "fs:allow-write-file -> Enables the write_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-write-file" - ] - }, - { - "description": "fs:allow-write-text-file -> Enables the write_text_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-write-text-file" - ] - }, - { - "description": "fs:deny-copy-file -> Denies the copy_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-copy-file" - ] - }, - { - "description": "fs:deny-create -> Denies the create command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-create" - ] - }, - { - "description": "fs:deny-exists -> Denies the exists command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-exists" - ] - }, - { - "description": "fs:deny-fstat -> Denies the fstat command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-fstat" - ] - }, - { - "description": "fs:deny-ftruncate -> Denies the ftruncate command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-ftruncate" - ] - }, - { - "description": "fs:deny-lstat -> Denies the lstat command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-lstat" - ] - }, - { - "description": "fs:deny-mkdir -> Denies the mkdir command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-mkdir" - ] - }, - { - "description": "fs:deny-open -> Denies the open command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-open" - ] - }, - { - "description": "fs:deny-read -> Denies the read command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-read" - ] - }, - { - "description": "fs:deny-read-dir -> Denies the read_dir command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-read-dir" - ] - }, - { - "description": "fs:deny-read-file -> Denies the read_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-read-file" - ] - }, - { - "description": "fs:deny-read-text-file -> Denies the read_text_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-read-text-file" - ] - }, - { - "description": "fs:deny-read-text-file-lines -> Denies the read_text_file_lines command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-read-text-file-lines" - ] - }, - { - "description": "fs:deny-read-text-file-lines-next -> Denies the read_text_file_lines_next command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-read-text-file-lines-next" - ] - }, - { - "description": "fs:deny-remove -> Denies the remove command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-remove" - ] - }, - { - "description": "fs:deny-rename -> Denies the rename command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-rename" - ] - }, - { - "description": "fs:deny-seek -> Denies the seek command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-seek" - ] - }, - { - "description": "fs:deny-stat -> Denies the stat command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-stat" - ] - }, - { - "description": "fs:deny-truncate -> Denies the truncate command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-truncate" - ] - }, - { - "description": "fs:deny-unwatch -> Denies the unwatch command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-unwatch" - ] - }, - { - "description": "fs:deny-watch -> Denies the watch command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-watch" - ] - }, - { - "description": "fs:deny-webview-data-linux -> This denies read access to the\n`$APPLOCALDATA` folder on linux as the webview data and configuration values are stored here.\nAllowing access can lead to sensitive information disclosure and should be well considered.", - "type": "string", - "enum": [ - "fs:deny-webview-data-linux" - ] - }, - { - "description": "fs:deny-webview-data-windows -> This denies read access to the\n`$APPLOCALDATA/EBWebView` folder on windows as the webview data and configuration values are stored here.\nAllowing access can lead to sensitive information disclosure and should be well considered.", - "type": "string", - "enum": [ - "fs:deny-webview-data-windows" - ] - }, - { - "description": "fs:deny-write -> Denies the write command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-write" - ] - }, - { - "description": "fs:deny-write-file -> Denies the write_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-write-file" - ] - }, - { - "description": "fs:deny-write-text-file -> Denies the write_text_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-write-text-file" - ] - }, - { - "description": "fs:read-all -> This enables all read related commands without any pre-configured accessible paths.", - "type": "string", - "enum": [ - "fs:read-all" - ] - }, - { - "description": "fs:read-dirs -> This enables directory read and file metadata related commands without any pre-configured accessible paths.", - "type": "string", - "enum": [ - "fs:read-dirs" - ] - }, - { - "description": "fs:read-files -> This enables file read related commands without any pre-configured accessible paths.", - "type": "string", - "enum": [ - "fs:read-files" - ] - }, - { - "description": "fs:read-meta -> This enables all index or metadata related commands without any pre-configured accessible paths.", - "type": "string", - "enum": [ - "fs:read-meta" - ] - }, - { - "description": "fs:scope -> An empty permission you can use to modify the global scope.", - "type": "string", - "enum": [ - "fs:scope" - ] - }, - { - "description": "fs:scope-app -> This scope permits access to all files and list content of top level directories in the `$APP`folder.", - "type": "string", - "enum": [ - "fs:scope-app" - ] - }, - { - "description": "fs:scope-app-index -> This scope permits to list all files and folders in the `$APP`folder.", - "type": "string", - "enum": [ - "fs:scope-app-index" - ] - }, - { - "description": "fs:scope-app-recursive -> This scope recursive access to the complete `$APP` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-app-recursive" - ] - }, - { - "description": "fs:scope-appcache -> This scope permits access to all files and list content of top level directories in the `$APPCACHE`folder.", - "type": "string", - "enum": [ - "fs:scope-appcache" - ] - }, - { - "description": "fs:scope-appcache-index -> This scope permits to list all files and folders in the `$APPCACHE`folder.", - "type": "string", - "enum": [ - "fs:scope-appcache-index" - ] - }, - { - "description": "fs:scope-appcache-recursive -> This scope recursive access to the complete `$APPCACHE` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-appcache-recursive" - ] - }, - { - "description": "fs:scope-appconfig -> This scope permits access to all files and list content of top level directories in the `$APPCONFIG`folder.", - "type": "string", - "enum": [ - "fs:scope-appconfig" - ] - }, - { - "description": "fs:scope-appconfig-index -> This scope permits to list all files and folders in the `$APPCONFIG`folder.", - "type": "string", - "enum": [ - "fs:scope-appconfig-index" - ] - }, - { - "description": "fs:scope-appconfig-recursive -> This scope recursive access to the complete `$APPCONFIG` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-appconfig-recursive" - ] - }, - { - "description": "fs:scope-appdata -> This scope permits access to all files and list content of top level directories in the `$APPDATA`folder.", - "type": "string", - "enum": [ - "fs:scope-appdata" - ] - }, - { - "description": "fs:scope-appdata-index -> This scope permits to list all files and folders in the `$APPDATA`folder.", - "type": "string", - "enum": [ - "fs:scope-appdata-index" - ] - }, - { - "description": "fs:scope-appdata-recursive -> This scope recursive access to the complete `$APPDATA` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-appdata-recursive" - ] - }, - { - "description": "fs:scope-applocaldata -> This scope permits access to all files and list content of top level directories in the `$APPLOCALDATA`folder.", - "type": "string", - "enum": [ - "fs:scope-applocaldata" - ] - }, - { - "description": "fs:scope-applocaldata-index -> This scope permits to list all files and folders in the `$APPLOCALDATA`folder.", - "type": "string", - "enum": [ - "fs:scope-applocaldata-index" - ] - }, - { - "description": "fs:scope-applocaldata-recursive -> This scope recursive access to the complete `$APPLOCALDATA` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-applocaldata-recursive" - ] - }, - { - "description": "fs:scope-applog -> This scope permits access to all files and list content of top level directories in the `$APPLOG`folder.", - "type": "string", - "enum": [ - "fs:scope-applog" - ] - }, - { - "description": "fs:scope-applog-index -> This scope permits to list all files and folders in the `$APPLOG`folder.", - "type": "string", - "enum": [ - "fs:scope-applog-index" - ] - }, - { - "description": "fs:scope-applog-recursive -> This scope recursive access to the complete `$APPLOG` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-applog-recursive" - ] - }, - { - "description": "fs:scope-audio -> This scope permits access to all files and list content of top level directories in the `$AUDIO`folder.", - "type": "string", - "enum": [ - "fs:scope-audio" - ] - }, - { - "description": "fs:scope-audio-index -> This scope permits to list all files and folders in the `$AUDIO`folder.", - "type": "string", - "enum": [ - "fs:scope-audio-index" - ] - }, - { - "description": "fs:scope-audio-recursive -> This scope recursive access to the complete `$AUDIO` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-audio-recursive" - ] - }, - { - "description": "fs:scope-cache -> This scope permits access to all files and list content of top level directories in the `$CACHE`folder.", - "type": "string", - "enum": [ - "fs:scope-cache" - ] - }, - { - "description": "fs:scope-cache-index -> This scope permits to list all files and folders in the `$CACHE`folder.", - "type": "string", - "enum": [ - "fs:scope-cache-index" - ] - }, - { - "description": "fs:scope-cache-recursive -> This scope recursive access to the complete `$CACHE` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-cache-recursive" - ] - }, - { - "description": "fs:scope-config -> This scope permits access to all files and list content of top level directories in the `$CONFIG`folder.", - "type": "string", - "enum": [ - "fs:scope-config" - ] - }, - { - "description": "fs:scope-config-index -> This scope permits to list all files and folders in the `$CONFIG`folder.", - "type": "string", - "enum": [ - "fs:scope-config-index" - ] - }, - { - "description": "fs:scope-config-recursive -> This scope recursive access to the complete `$CONFIG` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-config-recursive" - ] - }, - { - "description": "fs:scope-data -> This scope permits access to all files and list content of top level directories in the `$DATA`folder.", - "type": "string", - "enum": [ - "fs:scope-data" - ] - }, - { - "description": "fs:scope-data-index -> This scope permits to list all files and folders in the `$DATA`folder.", - "type": "string", - "enum": [ - "fs:scope-data-index" - ] - }, - { - "description": "fs:scope-data-recursive -> This scope recursive access to the complete `$DATA` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-data-recursive" - ] - }, - { - "description": "fs:scope-desktop -> This scope permits access to all files and list content of top level directories in the `$DESKTOP`folder.", - "type": "string", - "enum": [ - "fs:scope-desktop" - ] - }, - { - "description": "fs:scope-desktop-index -> This scope permits to list all files and folders in the `$DESKTOP`folder.", - "type": "string", - "enum": [ - "fs:scope-desktop-index" - ] - }, - { - "description": "fs:scope-desktop-recursive -> This scope recursive access to the complete `$DESKTOP` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-desktop-recursive" - ] - }, - { - "description": "fs:scope-document -> This scope permits access to all files and list content of top level directories in the `$DOCUMENT`folder.", - "type": "string", - "enum": [ - "fs:scope-document" - ] - }, - { - "description": "fs:scope-document-index -> This scope permits to list all files and folders in the `$DOCUMENT`folder.", - "type": "string", - "enum": [ - "fs:scope-document-index" - ] - }, - { - "description": "fs:scope-document-recursive -> This scope recursive access to the complete `$DOCUMENT` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-document-recursive" - ] - }, - { - "description": "fs:scope-download -> This scope permits access to all files and list content of top level directories in the `$DOWNLOAD`folder.", - "type": "string", - "enum": [ - "fs:scope-download" - ] - }, - { - "description": "fs:scope-download-index -> This scope permits to list all files and folders in the `$DOWNLOAD`folder.", - "type": "string", - "enum": [ - "fs:scope-download-index" - ] - }, - { - "description": "fs:scope-download-recursive -> This scope recursive access to the complete `$DOWNLOAD` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-download-recursive" - ] - }, - { - "description": "fs:scope-exe -> This scope permits access to all files and list content of top level directories in the `$EXE`folder.", - "type": "string", - "enum": [ - "fs:scope-exe" - ] - }, - { - "description": "fs:scope-exe-index -> This scope permits to list all files and folders in the `$EXE`folder.", - "type": "string", - "enum": [ - "fs:scope-exe-index" - ] - }, - { - "description": "fs:scope-exe-recursive -> This scope recursive access to the complete `$EXE` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-exe-recursive" - ] - }, - { - "description": "fs:scope-font -> This scope permits access to all files and list content of top level directories in the `$FONT`folder.", - "type": "string", - "enum": [ - "fs:scope-font" - ] - }, - { - "description": "fs:scope-font-index -> This scope permits to list all files and folders in the `$FONT`folder.", - "type": "string", - "enum": [ - "fs:scope-font-index" - ] - }, - { - "description": "fs:scope-font-recursive -> This scope recursive access to the complete `$FONT` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-font-recursive" - ] - }, - { - "description": "fs:scope-home -> This scope permits access to all files and list content of top level directories in the `$HOME`folder.", - "type": "string", - "enum": [ - "fs:scope-home" - ] - }, - { - "description": "fs:scope-home-index -> This scope permits to list all files and folders in the `$HOME`folder.", - "type": "string", - "enum": [ - "fs:scope-home-index" - ] - }, - { - "description": "fs:scope-home-recursive -> This scope recursive access to the complete `$HOME` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-home-recursive" - ] - }, - { - "description": "fs:scope-localdata -> This scope permits access to all files and list content of top level directories in the `$LOCALDATA`folder.", - "type": "string", - "enum": [ - "fs:scope-localdata" - ] - }, - { - "description": "fs:scope-localdata-index -> This scope permits to list all files and folders in the `$LOCALDATA`folder.", - "type": "string", - "enum": [ - "fs:scope-localdata-index" - ] - }, - { - "description": "fs:scope-localdata-recursive -> This scope recursive access to the complete `$LOCALDATA` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-localdata-recursive" - ] - }, - { - "description": "fs:scope-log -> This scope permits access to all files and list content of top level directories in the `$LOG`folder.", - "type": "string", - "enum": [ - "fs:scope-log" - ] - }, - { - "description": "fs:scope-log-index -> This scope permits to list all files and folders in the `$LOG`folder.", - "type": "string", - "enum": [ - "fs:scope-log-index" - ] - }, - { - "description": "fs:scope-log-recursive -> This scope recursive access to the complete `$LOG` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-log-recursive" - ] - }, - { - "description": "fs:scope-picture -> This scope permits access to all files and list content of top level directories in the `$PICTURE`folder.", - "type": "string", - "enum": [ - "fs:scope-picture" - ] - }, - { - "description": "fs:scope-picture-index -> This scope permits to list all files and folders in the `$PICTURE`folder.", - "type": "string", - "enum": [ - "fs:scope-picture-index" - ] - }, - { - "description": "fs:scope-picture-recursive -> This scope recursive access to the complete `$PICTURE` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-picture-recursive" - ] - }, - { - "description": "fs:scope-public -> This scope permits access to all files and list content of top level directories in the `$PUBLIC`folder.", - "type": "string", - "enum": [ - "fs:scope-public" - ] - }, - { - "description": "fs:scope-public-index -> This scope permits to list all files and folders in the `$PUBLIC`folder.", - "type": "string", - "enum": [ - "fs:scope-public-index" - ] - }, - { - "description": "fs:scope-public-recursive -> This scope recursive access to the complete `$PUBLIC` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-public-recursive" - ] - }, - { - "description": "fs:scope-resource -> This scope permits access to all files and list content of top level directories in the `$RESOURCE`folder.", - "type": "string", - "enum": [ - "fs:scope-resource" - ] - }, - { - "description": "fs:scope-resource-index -> This scope permits to list all files and folders in the `$RESOURCE`folder.", - "type": "string", - "enum": [ - "fs:scope-resource-index" - ] - }, - { - "description": "fs:scope-resource-recursive -> This scope recursive access to the complete `$RESOURCE` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-resource-recursive" - ] - }, - { - "description": "fs:scope-runtime -> This scope permits access to all files and list content of top level directories in the `$RUNTIME`folder.", - "type": "string", - "enum": [ - "fs:scope-runtime" - ] - }, - { - "description": "fs:scope-runtime-index -> This scope permits to list all files and folders in the `$RUNTIME`folder.", - "type": "string", - "enum": [ - "fs:scope-runtime-index" - ] - }, - { - "description": "fs:scope-runtime-recursive -> This scope recursive access to the complete `$RUNTIME` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-runtime-recursive" - ] - }, - { - "description": "fs:scope-temp -> This scope permits access to all files and list content of top level directories in the `$TEMP`folder.", - "type": "string", - "enum": [ - "fs:scope-temp" - ] - }, - { - "description": "fs:scope-temp-index -> This scope permits to list all files and folders in the `$TEMP`folder.", - "type": "string", - "enum": [ - "fs:scope-temp-index" - ] - }, - { - "description": "fs:scope-temp-recursive -> This scope recursive access to the complete `$TEMP` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-temp-recursive" - ] - }, - { - "description": "fs:scope-template -> This scope permits access to all files and list content of top level directories in the `$TEMPLATE`folder.", - "type": "string", - "enum": [ - "fs:scope-template" - ] - }, - { - "description": "fs:scope-template-index -> This scope permits to list all files and folders in the `$TEMPLATE`folder.", - "type": "string", - "enum": [ - "fs:scope-template-index" - ] - }, - { - "description": "fs:scope-template-recursive -> This scope recursive access to the complete `$TEMPLATE` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-template-recursive" - ] - }, - { - "description": "fs:scope-video -> This scope permits access to all files and list content of top level directories in the `$VIDEO`folder.", - "type": "string", - "enum": [ - "fs:scope-video" - ] - }, - { - "description": "fs:scope-video-index -> This scope permits to list all files and folders in the `$VIDEO`folder.", - "type": "string", - "enum": [ - "fs:scope-video-index" - ] - }, - { - "description": "fs:scope-video-recursive -> This scope recursive access to the complete `$VIDEO` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-video-recursive" - ] - }, - { - "description": "fs:write-all -> This enables all write related commands without any pre-configured accessible paths.", - "type": "string", - "enum": [ - "fs:write-all" - ] - }, - { - "description": "fs:write-files -> This enables all file write related commands without any pre-configured accessible paths.", - "type": "string", - "enum": [ - "fs:write-files" - ] - }, - { - "description": "global-shortcut:allow-is-registered -> Enables the is_registered command without any pre-configured scope.", - "type": "string", - "enum": [ - "global-shortcut:allow-is-registered" - ] - }, - { - "description": "global-shortcut:allow-register -> Enables the register command without any pre-configured scope.", - "type": "string", - "enum": [ - "global-shortcut:allow-register" - ] - }, - { - "description": "global-shortcut:allow-register-all -> Enables the register_all command without any pre-configured scope.", - "type": "string", - "enum": [ - "global-shortcut:allow-register-all" - ] - }, - { - "description": "global-shortcut:allow-unregister -> Enables the unregister command without any pre-configured scope.", - "type": "string", - "enum": [ - "global-shortcut:allow-unregister" - ] - }, - { - "description": "global-shortcut:allow-unregister-all -> Enables the unregister_all command without any pre-configured scope.", - "type": "string", - "enum": [ - "global-shortcut:allow-unregister-all" - ] - }, - { - "description": "global-shortcut:deny-is-registered -> Denies the is_registered command without any pre-configured scope.", - "type": "string", - "enum": [ - "global-shortcut:deny-is-registered" - ] - }, - { - "description": "global-shortcut:deny-register -> Denies the register command without any pre-configured scope.", - "type": "string", - "enum": [ - "global-shortcut:deny-register" - ] - }, - { - "description": "global-shortcut:deny-register-all -> Denies the register_all command without any pre-configured scope.", - "type": "string", - "enum": [ - "global-shortcut:deny-register-all" - ] - }, - { - "description": "global-shortcut:deny-unregister -> Denies the unregister command without any pre-configured scope.", - "type": "string", - "enum": [ - "global-shortcut:deny-unregister" - ] - }, - { - "description": "global-shortcut:deny-unregister-all -> Denies the unregister_all command without any pre-configured scope.", - "type": "string", - "enum": [ - "global-shortcut:deny-unregister-all" - ] - }, - { - "description": "http:default -> Allows all fetch operations", - "type": "string", - "enum": [ - "http:default" - ] - }, - { - "description": "http:allow-fetch -> Enables the fetch command without any pre-configured scope.", - "type": "string", - "enum": [ - "http:allow-fetch" - ] - }, - { - "description": "http:allow-fetch-cancel -> Enables the fetch_cancel command without any pre-configured scope.", - "type": "string", - "enum": [ - "http:allow-fetch-cancel" - ] - }, - { - "description": "http:allow-fetch-read-body -> Enables the fetch_read_body command without any pre-configured scope.", - "type": "string", - "enum": [ - "http:allow-fetch-read-body" - ] - }, - { - "description": "http:allow-fetch-send -> Enables the fetch_send command without any pre-configured scope.", - "type": "string", - "enum": [ - "http:allow-fetch-send" - ] - }, - { - "description": "http:deny-fetch -> Denies the fetch command without any pre-configured scope.", - "type": "string", - "enum": [ - "http:deny-fetch" - ] - }, - { - "description": "http:deny-fetch-cancel -> Denies the fetch_cancel command without any pre-configured scope.", - "type": "string", - "enum": [ - "http:deny-fetch-cancel" - ] - }, - { - "description": "http:deny-fetch-read-body -> Denies the fetch_read_body command without any pre-configured scope.", - "type": "string", - "enum": [ - "http:deny-fetch-read-body" - ] - }, - { - "description": "http:deny-fetch-send -> Denies the fetch_send command without any pre-configured scope.", - "type": "string", - "enum": [ - "http:deny-fetch-send" - ] - }, - { - "description": "log:default -> Allows the log command", - "type": "string", - "enum": [ - "log:default" - ] - }, - { - "description": "log:allow-log -> Enables the log command without any pre-configured scope.", - "type": "string", - "enum": [ - "log:allow-log" - ] - }, - { - "description": "log:deny-log -> Denies the log command without any pre-configured scope.", - "type": "string", - "enum": [ - "log:deny-log" - ] - }, - { - "description": "menu:default -> Default permissions for the plugin.", - "type": "string", - "enum": [ - "menu:default" - ] - }, - { - "description": "menu:allow-append -> Enables the append command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-append" - ] - }, - { - "description": "menu:allow-create-default -> Enables the create_default command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-create-default" - ] - }, - { - "description": "menu:allow-get -> Enables the get command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-get" - ] - }, - { - "description": "menu:allow-insert -> Enables the insert command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-insert" - ] - }, - { - "description": "menu:allow-is-checked -> Enables the is_checked command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-is-checked" - ] - }, - { - "description": "menu:allow-is-enabled -> Enables the is_enabled command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-is-enabled" - ] - }, - { - "description": "menu:allow-items -> Enables the items command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-items" - ] - }, - { - "description": "menu:allow-new -> Enables the new command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-new" - ] - }, - { - "description": "menu:allow-popup -> Enables the popup command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-popup" - ] - }, - { - "description": "menu:allow-prepend -> Enables the prepend command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-prepend" - ] - }, - { - "description": "menu:allow-remove -> Enables the remove command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-remove" - ] - }, - { - "description": "menu:allow-remove-at -> Enables the remove_at command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-remove-at" - ] - }, - { - "description": "menu:allow-set-accelerator -> Enables the set_accelerator command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-set-accelerator" - ] - }, - { - "description": "menu:allow-set-as-app-menu -> Enables the set_as_app_menu command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-set-as-app-menu" - ] - }, - { - "description": "menu:allow-set-as-help-menu-for-nsapp -> Enables the set_as_help_menu_for_nsapp command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-set-as-help-menu-for-nsapp" - ] - }, - { - "description": "menu:allow-set-as-window-menu -> Enables the set_as_window_menu command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-set-as-window-menu" - ] - }, - { - "description": "menu:allow-set-as-windows-menu-for-nsapp -> Enables the set_as_windows_menu_for_nsapp command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-set-as-windows-menu-for-nsapp" - ] - }, - { - "description": "menu:allow-set-checked -> Enables the set_checked command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-set-checked" - ] - }, - { - "description": "menu:allow-set-enabled -> Enables the set_enabled command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-set-enabled" - ] - }, - { - "description": "menu:allow-set-icon -> Enables the set_icon command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-set-icon" - ] - }, - { - "description": "menu:allow-set-text -> Enables the set_text command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-set-text" - ] - }, - { - "description": "menu:allow-text -> Enables the text command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-text" - ] - }, - { - "description": "menu:deny-append -> Denies the append command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-append" - ] - }, - { - "description": "menu:deny-create-default -> Denies the create_default command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-create-default" - ] - }, - { - "description": "menu:deny-get -> Denies the get command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-get" - ] - }, - { - "description": "menu:deny-insert -> Denies the insert command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-insert" - ] - }, - { - "description": "menu:deny-is-checked -> Denies the is_checked command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-is-checked" - ] - }, - { - "description": "menu:deny-is-enabled -> Denies the is_enabled command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-is-enabled" - ] - }, - { - "description": "menu:deny-items -> Denies the items command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-items" - ] - }, - { - "description": "menu:deny-new -> Denies the new command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-new" - ] - }, - { - "description": "menu:deny-popup -> Denies the popup command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-popup" - ] - }, - { - "description": "menu:deny-prepend -> Denies the prepend command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-prepend" - ] - }, - { - "description": "menu:deny-remove -> Denies the remove command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-remove" - ] - }, - { - "description": "menu:deny-remove-at -> Denies the remove_at command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-remove-at" - ] - }, - { - "description": "menu:deny-set-accelerator -> Denies the set_accelerator command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-set-accelerator" - ] - }, - { - "description": "menu:deny-set-as-app-menu -> Denies the set_as_app_menu command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-set-as-app-menu" - ] - }, - { - "description": "menu:deny-set-as-help-menu-for-nsapp -> Denies the set_as_help_menu_for_nsapp command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-set-as-help-menu-for-nsapp" - ] - }, - { - "description": "menu:deny-set-as-window-menu -> Denies the set_as_window_menu command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-set-as-window-menu" - ] - }, - { - "description": "menu:deny-set-as-windows-menu-for-nsapp -> Denies the set_as_windows_menu_for_nsapp command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-set-as-windows-menu-for-nsapp" - ] - }, - { - "description": "menu:deny-set-checked -> Denies the set_checked command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-set-checked" - ] - }, - { - "description": "menu:deny-set-enabled -> Denies the set_enabled command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-set-enabled" - ] - }, - { - "description": "menu:deny-set-icon -> Denies the set_icon command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-set-icon" - ] - }, - { - "description": "menu:deny-set-text -> Denies the set_text command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-set-text" - ] - }, - { - "description": "menu:deny-text -> Denies the text command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-text" - ] - }, - { - "description": "notification:default -> Allows requesting permission, checking permission state and sending notifications", - "type": "string", - "enum": [ - "notification:default" - ] - }, - { - "description": "notification:allow-is-permission-granted -> Enables the is_permission_granted command without any pre-configured scope.", - "type": "string", - "enum": [ - "notification:allow-is-permission-granted" - ] - }, - { - "description": "notification:allow-notify -> Enables the notify command without any pre-configured scope.", - "type": "string", - "enum": [ - "notification:allow-notify" - ] - }, - { - "description": "notification:allow-request-permission -> Enables the request_permission command without any pre-configured scope.", - "type": "string", - "enum": [ - "notification:allow-request-permission" - ] - }, - { - "description": "notification:deny-is-permission-granted -> Denies the is_permission_granted command without any pre-configured scope.", - "type": "string", - "enum": [ - "notification:deny-is-permission-granted" - ] - }, - { - "description": "notification:deny-notify -> Denies the notify command without any pre-configured scope.", - "type": "string", - "enum": [ - "notification:deny-notify" - ] - }, - { - "description": "notification:deny-request-permission -> Denies the request_permission command without any pre-configured scope.", - "type": "string", - "enum": [ - "notification:deny-request-permission" - ] - }, - { - "description": "os:allow-arch -> Enables the arch command without any pre-configured scope.", - "type": "string", - "enum": [ - "os:allow-arch" - ] - }, - { - "description": "os:allow-exe-extension -> Enables the exe_extension command without any pre-configured scope.", - "type": "string", - "enum": [ - "os:allow-exe-extension" - ] - }, - { - "description": "os:allow-family -> Enables the family command without any pre-configured scope.", - "type": "string", - "enum": [ - "os:allow-family" - ] - }, - { - "description": "os:allow-hostname -> Enables the hostname command without any pre-configured scope.", - "type": "string", - "enum": [ - "os:allow-hostname" - ] - }, - { - "description": "os:allow-locale -> Enables the locale command without any pre-configured scope.", - "type": "string", - "enum": [ - "os:allow-locale" - ] - }, - { - "description": "os:allow-os-type -> Enables the os_type command without any pre-configured scope.", - "type": "string", - "enum": [ - "os:allow-os-type" - ] - }, - { - "description": "os:allow-platform -> Enables the platform command without any pre-configured scope.", - "type": "string", - "enum": [ - "os:allow-platform" - ] - }, - { - "description": "os:allow-version -> Enables the version command without any pre-configured scope.", - "type": "string", - "enum": [ - "os:allow-version" - ] - }, - { - "description": "os:deny-arch -> Denies the arch command without any pre-configured scope.", - "type": "string", - "enum": [ - "os:deny-arch" - ] - }, - { - "description": "os:deny-exe-extension -> Denies the exe_extension command without any pre-configured scope.", - "type": "string", - "enum": [ - "os:deny-exe-extension" - ] - }, - { - "description": "os:deny-family -> Denies the family command without any pre-configured scope.", - "type": "string", - "enum": [ - "os:deny-family" - ] - }, - { - "description": "os:deny-hostname -> Denies the hostname command without any pre-configured scope.", - "type": "string", - "enum": [ - "os:deny-hostname" - ] - }, - { - "description": "os:deny-locale -> Denies the locale command without any pre-configured scope.", - "type": "string", - "enum": [ - "os:deny-locale" - ] - }, - { - "description": "os:deny-os-type -> Denies the os_type command without any pre-configured scope.", - "type": "string", - "enum": [ - "os:deny-os-type" - ] - }, - { - "description": "os:deny-platform -> Denies the platform command without any pre-configured scope.", - "type": "string", - "enum": [ - "os:deny-platform" - ] - }, - { - "description": "os:deny-version -> Denies the version command without any pre-configured scope.", - "type": "string", - "enum": [ - "os:deny-version" - ] - }, - { - "description": "path:default -> Default permissions for the plugin.", - "type": "string", - "enum": [ - "path:default" - ] - }, - { - "description": "path:allow-basename -> Enables the basename command without any pre-configured scope.", - "type": "string", - "enum": [ - "path:allow-basename" - ] - }, - { - "description": "path:allow-dirname -> Enables the dirname command without any pre-configured scope.", - "type": "string", - "enum": [ - "path:allow-dirname" - ] - }, - { - "description": "path:allow-extname -> Enables the extname command without any pre-configured scope.", - "type": "string", - "enum": [ - "path:allow-extname" - ] - }, - { - "description": "path:allow-is-absolute -> Enables the is_absolute command without any pre-configured scope.", - "type": "string", - "enum": [ - "path:allow-is-absolute" - ] - }, - { - "description": "path:allow-join -> Enables the join command without any pre-configured scope.", - "type": "string", - "enum": [ - "path:allow-join" - ] - }, - { - "description": "path:allow-normalize -> Enables the normalize command without any pre-configured scope.", - "type": "string", - "enum": [ - "path:allow-normalize" - ] - }, - { - "description": "path:allow-resolve -> Enables the resolve command without any pre-configured scope.", - "type": "string", - "enum": [ - "path:allow-resolve" - ] - }, - { - "description": "path:allow-resolve-directory -> Enables the resolve_directory command without any pre-configured scope.", - "type": "string", - "enum": [ - "path:allow-resolve-directory" - ] - }, - { - "description": "path:deny-basename -> Denies the basename command without any pre-configured scope.", - "type": "string", - "enum": [ - "path:deny-basename" - ] - }, - { - "description": "path:deny-dirname -> Denies the dirname command without any pre-configured scope.", - "type": "string", - "enum": [ - "path:deny-dirname" - ] - }, - { - "description": "path:deny-extname -> Denies the extname command without any pre-configured scope.", - "type": "string", - "enum": [ - "path:deny-extname" - ] - }, - { - "description": "path:deny-is-absolute -> Denies the is_absolute command without any pre-configured scope.", - "type": "string", - "enum": [ - "path:deny-is-absolute" - ] - }, - { - "description": "path:deny-join -> Denies the join command without any pre-configured scope.", - "type": "string", - "enum": [ - "path:deny-join" - ] - }, - { - "description": "path:deny-normalize -> Denies the normalize command without any pre-configured scope.", - "type": "string", - "enum": [ - "path:deny-normalize" - ] - }, - { - "description": "path:deny-resolve -> Denies the resolve command without any pre-configured scope.", - "type": "string", - "enum": [ - "path:deny-resolve" - ] - }, - { - "description": "path:deny-resolve-directory -> Denies the resolve_directory command without any pre-configured scope.", - "type": "string", - "enum": [ - "path:deny-resolve-directory" - ] - }, - { - "description": "process:allow-exit -> Enables the exit command without any pre-configured scope.", - "type": "string", - "enum": [ - "process:allow-exit" - ] - }, - { - "description": "process:allow-restart -> Enables the restart command without any pre-configured scope.", - "type": "string", - "enum": [ - "process:allow-restart" - ] - }, - { - "description": "process:deny-exit -> Denies the exit command without any pre-configured scope.", - "type": "string", - "enum": [ - "process:deny-exit" - ] - }, - { - "description": "process:deny-restart -> Denies the restart command without any pre-configured scope.", - "type": "string", - "enum": [ - "process:deny-restart" - ] - }, - { - "description": "resources:default -> Default permissions for the plugin.", - "type": "string", - "enum": [ - "resources:default" - ] - }, - { - "description": "resources:allow-close -> Enables the close command without any pre-configured scope.", - "type": "string", - "enum": [ - "resources:allow-close" - ] - }, - { - "description": "resources:deny-close -> Denies the close command without any pre-configured scope.", - "type": "string", - "enum": [ - "resources:deny-close" - ] - }, - { - "description": "shell:allow-execute -> Enables the execute command without any pre-configured scope.", - "type": "string", - "enum": [ - "shell:allow-execute" - ] - }, - { - "description": "shell:allow-kill -> Enables the kill command without any pre-configured scope.", - "type": "string", - "enum": [ - "shell:allow-kill" - ] - }, - { - "description": "shell:allow-open -> Enables the open command without any pre-configured scope.", - "type": "string", - "enum": [ - "shell:allow-open" - ] - }, - { - "description": "shell:allow-stdin-write -> Enables the stdin_write command without any pre-configured scope.", - "type": "string", - "enum": [ - "shell:allow-stdin-write" - ] - }, - { - "description": "shell:deny-execute -> Denies the execute command without any pre-configured scope.", - "type": "string", - "enum": [ - "shell:deny-execute" - ] - }, - { - "description": "shell:deny-kill -> Denies the kill command without any pre-configured scope.", - "type": "string", - "enum": [ - "shell:deny-kill" - ] - }, - { - "description": "shell:deny-open -> Denies the open command without any pre-configured scope.", - "type": "string", - "enum": [ - "shell:deny-open" - ] - }, - { - "description": "shell:deny-stdin-write -> Denies the stdin_write command without any pre-configured scope.", - "type": "string", - "enum": [ - "shell:deny-stdin-write" - ] - }, - { - "description": "tray:default -> Default permissions for the plugin.", - "type": "string", - "enum": [ - "tray:default" - ] - }, - { - "description": "tray:allow-new -> Enables the new command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:allow-new" - ] - }, - { - "description": "tray:allow-set-icon -> Enables the set_icon command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:allow-set-icon" - ] - }, - { - "description": "tray:allow-set-icon-as-template -> Enables the set_icon_as_template command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:allow-set-icon-as-template" - ] - }, - { - "description": "tray:allow-set-menu -> Enables the set_menu command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:allow-set-menu" - ] - }, - { - "description": "tray:allow-set-show-menu-on-left-click -> Enables the set_show_menu_on_left_click command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:allow-set-show-menu-on-left-click" - ] - }, - { - "description": "tray:allow-set-temp-dir-path -> Enables the set_temp_dir_path command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:allow-set-temp-dir-path" - ] - }, - { - "description": "tray:allow-set-title -> Enables the set_title command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:allow-set-title" - ] - }, - { - "description": "tray:allow-set-tooltip -> Enables the set_tooltip command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:allow-set-tooltip" - ] - }, - { - "description": "tray:allow-set-visible -> Enables the set_visible command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:allow-set-visible" - ] - }, - { - "description": "tray:deny-new -> Denies the new command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:deny-new" - ] - }, - { - "description": "tray:deny-set-icon -> Denies the set_icon command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:deny-set-icon" - ] - }, - { - "description": "tray:deny-set-icon-as-template -> Denies the set_icon_as_template command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:deny-set-icon-as-template" - ] - }, - { - "description": "tray:deny-set-menu -> Denies the set_menu command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:deny-set-menu" - ] - }, - { - "description": "tray:deny-set-show-menu-on-left-click -> Denies the set_show_menu_on_left_click command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:deny-set-show-menu-on-left-click" - ] - }, - { - "description": "tray:deny-set-temp-dir-path -> Denies the set_temp_dir_path command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:deny-set-temp-dir-path" - ] - }, - { - "description": "tray:deny-set-title -> Denies the set_title command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:deny-set-title" - ] - }, - { - "description": "tray:deny-set-tooltip -> Denies the set_tooltip command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:deny-set-tooltip" - ] - }, - { - "description": "tray:deny-set-visible -> Denies the set_visible command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:deny-set-visible" - ] - }, - { - "description": "updater:default -> Allows checking for new updates and installing them", - "type": "string", - "enum": [ - "updater:default" - ] - }, - { - "description": "updater:allow-check -> Enables the check command without any pre-configured scope.", - "type": "string", - "enum": [ - "updater:allow-check" - ] - }, - { - "description": "updater:allow-download-and-install -> Enables the download_and_install command without any pre-configured scope.", - "type": "string", - "enum": [ - "updater:allow-download-and-install" - ] - }, - { - "description": "updater:deny-check -> Denies the check command without any pre-configured scope.", - "type": "string", - "enum": [ - "updater:deny-check" - ] - }, - { - "description": "updater:deny-download-and-install -> Denies the download_and_install command without any pre-configured scope.", - "type": "string", - "enum": [ - "updater:deny-download-and-install" - ] - }, - { - "description": "webview:default -> Default permissions for the plugin.", - "type": "string", - "enum": [ - "webview:default" - ] - }, - { - "description": "webview:allow-create-webview -> Enables the create_webview command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:allow-create-webview" - ] - }, - { - "description": "webview:allow-create-webview-window -> Enables the create_webview_window command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:allow-create-webview-window" - ] - }, - { - "description": "webview:allow-internal-toggle-devtools -> Enables the internal_toggle_devtools command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:allow-internal-toggle-devtools" - ] - }, - { - "description": "webview:allow-print -> Enables the print command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:allow-print" - ] - }, - { - "description": "webview:allow-set-webview-focus -> Enables the set_webview_focus command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:allow-set-webview-focus" - ] - }, - { - "description": "webview:allow-set-webview-position -> Enables the set_webview_position command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:allow-set-webview-position" - ] - }, - { - "description": "webview:allow-set-webview-size -> Enables the set_webview_size command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:allow-set-webview-size" - ] - }, - { - "description": "webview:allow-webview-close -> Enables the webview_close command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:allow-webview-close" - ] - }, - { - "description": "webview:allow-webview-position -> Enables the webview_position command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:allow-webview-position" - ] - }, - { - "description": "webview:allow-webview-size -> Enables the webview_size command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:allow-webview-size" - ] - }, - { - "description": "webview:deny-create-webview -> Denies the create_webview command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:deny-create-webview" - ] - }, - { - "description": "webview:deny-create-webview-window -> Denies the create_webview_window command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:deny-create-webview-window" - ] - }, - { - "description": "webview:deny-internal-toggle-devtools -> Denies the internal_toggle_devtools command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:deny-internal-toggle-devtools" - ] - }, - { - "description": "webview:deny-print -> Denies the print command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:deny-print" - ] - }, - { - "description": "webview:deny-set-webview-focus -> Denies the set_webview_focus command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:deny-set-webview-focus" - ] - }, - { - "description": "webview:deny-set-webview-position -> Denies the set_webview_position command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:deny-set-webview-position" - ] - }, - { - "description": "webview:deny-set-webview-size -> Denies the set_webview_size command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:deny-set-webview-size" - ] - }, - { - "description": "webview:deny-webview-close -> Denies the webview_close command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:deny-webview-close" - ] - }, - { - "description": "webview:deny-webview-position -> Denies the webview_position command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:deny-webview-position" - ] - }, - { - "description": "webview:deny-webview-size -> Denies the webview_size command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:deny-webview-size" - ] - }, - { - "description": "window:default -> Default permissions for the plugin.", - "type": "string", - "enum": [ - "window:default" - ] - }, - { - "description": "window:allow-available-monitors -> Enables the available_monitors command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-available-monitors" - ] - }, - { - "description": "window:allow-center -> Enables the center command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-center" - ] - }, - { - "description": "window:allow-close -> Enables the close command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-close" - ] - }, - { - "description": "window:allow-create -> Enables the create command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-create" - ] - }, - { - "description": "window:allow-current-monitor -> Enables the current_monitor command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-current-monitor" - ] - }, - { - "description": "window:allow-destroy -> Enables the destroy command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-destroy" - ] - }, - { - "description": "window:allow-hide -> Enables the hide command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-hide" - ] - }, - { - "description": "window:allow-inner-position -> Enables the inner_position command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-inner-position" - ] - }, - { - "description": "window:allow-inner-size -> Enables the inner_size command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-inner-size" - ] - }, - { - "description": "window:allow-internal-toggle-maximize -> Enables the internal_toggle_maximize command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-internal-toggle-maximize" - ] - }, - { - "description": "window:allow-is-closable -> Enables the is_closable command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-is-closable" - ] - }, - { - "description": "window:allow-is-decorated -> Enables the is_decorated command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-is-decorated" - ] - }, - { - "description": "window:allow-is-focused -> Enables the is_focused command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-is-focused" - ] - }, - { - "description": "window:allow-is-fullscreen -> Enables the is_fullscreen command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-is-fullscreen" - ] - }, - { - "description": "window:allow-is-maximizable -> Enables the is_maximizable command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-is-maximizable" - ] - }, - { - "description": "window:allow-is-maximized -> Enables the is_maximized command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-is-maximized" - ] - }, - { - "description": "window:allow-is-minimizable -> Enables the is_minimizable command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-is-minimizable" - ] - }, - { - "description": "window:allow-is-minimized -> Enables the is_minimized command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-is-minimized" - ] - }, - { - "description": "window:allow-is-resizable -> Enables the is_resizable command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-is-resizable" - ] - }, - { - "description": "window:allow-is-visible -> Enables the is_visible command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-is-visible" - ] - }, - { - "description": "window:allow-maximize -> Enables the maximize command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-maximize" - ] - }, - { - "description": "window:allow-minimize -> Enables the minimize command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-minimize" - ] - }, - { - "description": "window:allow-outer-position -> Enables the outer_position command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-outer-position" - ] - }, - { - "description": "window:allow-outer-size -> Enables the outer_size command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-outer-size" - ] - }, - { - "description": "window:allow-primary-monitor -> Enables the primary_monitor command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-primary-monitor" - ] - }, - { - "description": "window:allow-request-user-attention -> Enables the request_user_attention command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-request-user-attention" - ] - }, - { - "description": "window:allow-scale-factor -> Enables the scale_factor command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-scale-factor" - ] - }, - { - "description": "window:allow-set-always-on-bottom -> Enables the set_always_on_bottom command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-always-on-bottom" - ] - }, - { - "description": "window:allow-set-always-on-top -> Enables the set_always_on_top command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-always-on-top" - ] - }, - { - "description": "window:allow-set-closable -> Enables the set_closable command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-closable" - ] - }, - { - "description": "window:allow-set-content-protected -> Enables the set_content_protected command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-content-protected" - ] - }, - { - "description": "window:allow-set-cursor-grab -> Enables the set_cursor_grab command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-cursor-grab" - ] - }, - { - "description": "window:allow-set-cursor-icon -> Enables the set_cursor_icon command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-cursor-icon" - ] - }, - { - "description": "window:allow-set-cursor-position -> Enables the set_cursor_position command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-cursor-position" - ] - }, - { - "description": "window:allow-set-cursor-visible -> Enables the set_cursor_visible command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-cursor-visible" - ] - }, - { - "description": "window:allow-set-decorations -> Enables the set_decorations command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-decorations" - ] - }, - { - "description": "window:allow-set-effects -> Enables the set_effects command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-effects" - ] - }, - { - "description": "window:allow-set-focus -> Enables the set_focus command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-focus" - ] - }, - { - "description": "window:allow-set-fullscreen -> Enables the set_fullscreen command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-fullscreen" - ] - }, - { - "description": "window:allow-set-icon -> Enables the set_icon command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-icon" - ] - }, - { - "description": "window:allow-set-ignore-cursor-events -> Enables the set_ignore_cursor_events command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-ignore-cursor-events" - ] - }, - { - "description": "window:allow-set-max-size -> Enables the set_max_size command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-max-size" - ] - }, - { - "description": "window:allow-set-maximizable -> Enables the set_maximizable command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-maximizable" - ] - }, - { - "description": "window:allow-set-min-size -> Enables the set_min_size command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-min-size" - ] - }, - { - "description": "window:allow-set-minimizable -> Enables the set_minimizable command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-minimizable" - ] - }, - { - "description": "window:allow-set-position -> Enables the set_position command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-position" - ] - }, - { - "description": "window:allow-set-progress-bar -> Enables the set_progress_bar command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-progress-bar" - ] - }, - { - "description": "window:allow-set-resizable -> Enables the set_resizable command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-resizable" - ] - }, - { - "description": "window:allow-set-shadow -> Enables the set_shadow command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-shadow" - ] - }, - { - "description": "window:allow-set-size -> Enables the set_size command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-size" - ] - }, - { - "description": "window:allow-set-skip-taskbar -> Enables the set_skip_taskbar command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-skip-taskbar" - ] - }, - { - "description": "window:allow-set-title -> Enables the set_title command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-title" - ] - }, - { - "description": "window:allow-set-visible-on-all-workspaces -> Enables the set_visible_on_all_workspaces command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-visible-on-all-workspaces" - ] - }, - { - "description": "window:allow-show -> Enables the show command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-show" - ] - }, - { - "description": "window:allow-start-dragging -> Enables the start_dragging command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-start-dragging" - ] - }, - { - "description": "window:allow-theme -> Enables the theme command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-theme" - ] - }, - { - "description": "window:allow-title -> Enables the title command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-title" - ] - }, - { - "description": "window:allow-toggle-maximize -> Enables the toggle_maximize command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-toggle-maximize" - ] - }, - { - "description": "window:allow-unmaximize -> Enables the unmaximize command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-unmaximize" - ] - }, - { - "description": "window:allow-unminimize -> Enables the unminimize command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-unminimize" - ] - }, - { - "description": "window:deny-available-monitors -> Denies the available_monitors command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-available-monitors" - ] - }, - { - "description": "window:deny-center -> Denies the center command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-center" - ] - }, - { - "description": "window:deny-close -> Denies the close command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-close" - ] - }, - { - "description": "window:deny-create -> Denies the create command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-create" - ] - }, - { - "description": "window:deny-current-monitor -> Denies the current_monitor command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-current-monitor" - ] - }, - { - "description": "window:deny-destroy -> Denies the destroy command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-destroy" - ] - }, - { - "description": "window:deny-hide -> Denies the hide command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-hide" - ] - }, - { - "description": "window:deny-inner-position -> Denies the inner_position command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-inner-position" - ] - }, - { - "description": "window:deny-inner-size -> Denies the inner_size command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-inner-size" - ] - }, - { - "description": "window:deny-internal-toggle-maximize -> Denies the internal_toggle_maximize command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-internal-toggle-maximize" - ] - }, - { - "description": "window:deny-is-closable -> Denies the is_closable command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-is-closable" - ] - }, - { - "description": "window:deny-is-decorated -> Denies the is_decorated command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-is-decorated" - ] - }, - { - "description": "window:deny-is-focused -> Denies the is_focused command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-is-focused" - ] - }, - { - "description": "window:deny-is-fullscreen -> Denies the is_fullscreen command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-is-fullscreen" - ] - }, - { - "description": "window:deny-is-maximizable -> Denies the is_maximizable command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-is-maximizable" - ] - }, - { - "description": "window:deny-is-maximized -> Denies the is_maximized command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-is-maximized" - ] - }, - { - "description": "window:deny-is-minimizable -> Denies the is_minimizable command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-is-minimizable" - ] - }, - { - "description": "window:deny-is-minimized -> Denies the is_minimized command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-is-minimized" - ] - }, - { - "description": "window:deny-is-resizable -> Denies the is_resizable command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-is-resizable" - ] - }, - { - "description": "window:deny-is-visible -> Denies the is_visible command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-is-visible" - ] - }, - { - "description": "window:deny-maximize -> Denies the maximize command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-maximize" - ] - }, - { - "description": "window:deny-minimize -> Denies the minimize command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-minimize" - ] - }, - { - "description": "window:deny-outer-position -> Denies the outer_position command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-outer-position" - ] - }, - { - "description": "window:deny-outer-size -> Denies the outer_size command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-outer-size" - ] - }, - { - "description": "window:deny-primary-monitor -> Denies the primary_monitor command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-primary-monitor" - ] - }, - { - "description": "window:deny-request-user-attention -> Denies the request_user_attention command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-request-user-attention" - ] - }, - { - "description": "window:deny-scale-factor -> Denies the scale_factor command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-scale-factor" - ] - }, - { - "description": "window:deny-set-always-on-bottom -> Denies the set_always_on_bottom command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-always-on-bottom" - ] - }, - { - "description": "window:deny-set-always-on-top -> Denies the set_always_on_top command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-always-on-top" - ] - }, - { - "description": "window:deny-set-closable -> Denies the set_closable command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-closable" - ] - }, - { - "description": "window:deny-set-content-protected -> Denies the set_content_protected command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-content-protected" - ] - }, - { - "description": "window:deny-set-cursor-grab -> Denies the set_cursor_grab command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-cursor-grab" - ] - }, - { - "description": "window:deny-set-cursor-icon -> Denies the set_cursor_icon command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-cursor-icon" - ] - }, - { - "description": "window:deny-set-cursor-position -> Denies the set_cursor_position command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-cursor-position" - ] - }, - { - "description": "window:deny-set-cursor-visible -> Denies the set_cursor_visible command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-cursor-visible" - ] - }, - { - "description": "window:deny-set-decorations -> Denies the set_decorations command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-decorations" - ] - }, - { - "description": "window:deny-set-effects -> Denies the set_effects command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-effects" - ] - }, - { - "description": "window:deny-set-focus -> Denies the set_focus command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-focus" - ] - }, - { - "description": "window:deny-set-fullscreen -> Denies the set_fullscreen command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-fullscreen" - ] - }, - { - "description": "window:deny-set-icon -> Denies the set_icon command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-icon" - ] - }, - { - "description": "window:deny-set-ignore-cursor-events -> Denies the set_ignore_cursor_events command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-ignore-cursor-events" - ] - }, - { - "description": "window:deny-set-max-size -> Denies the set_max_size command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-max-size" - ] - }, - { - "description": "window:deny-set-maximizable -> Denies the set_maximizable command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-maximizable" - ] - }, - { - "description": "window:deny-set-min-size -> Denies the set_min_size command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-min-size" - ] - }, - { - "description": "window:deny-set-minimizable -> Denies the set_minimizable command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-minimizable" - ] - }, - { - "description": "window:deny-set-position -> Denies the set_position command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-position" - ] - }, - { - "description": "window:deny-set-progress-bar -> Denies the set_progress_bar command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-progress-bar" - ] - }, - { - "description": "window:deny-set-resizable -> Denies the set_resizable command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-resizable" - ] - }, - { - "description": "window:deny-set-shadow -> Denies the set_shadow command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-shadow" - ] - }, - { - "description": "window:deny-set-size -> Denies the set_size command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-size" - ] - }, - { - "description": "window:deny-set-skip-taskbar -> Denies the set_skip_taskbar command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-skip-taskbar" - ] - }, - { - "description": "window:deny-set-title -> Denies the set_title command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-title" - ] - }, - { - "description": "window:deny-set-visible-on-all-workspaces -> Denies the set_visible_on_all_workspaces command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-visible-on-all-workspaces" - ] - }, - { - "description": "window:deny-show -> Denies the show command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-show" - ] - }, - { - "description": "window:deny-start-dragging -> Denies the start_dragging command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-start-dragging" - ] - }, - { - "description": "window:deny-theme -> Denies the theme command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-theme" - ] - }, - { - "description": "window:deny-title -> Denies the title command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-title" - ] - }, - { - "description": "window:deny-toggle-maximize -> Denies the toggle_maximize command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-toggle-maximize" - ] - }, - { - "description": "window:deny-unmaximize -> Denies the unmaximize command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-unmaximize" - ] - }, - { - "description": "window:deny-unminimize -> Denies the unminimize command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-unminimize" - ] - } - ] - }, - "Value": { - "description": "All supported ACL values.", - "anyOf": [ - { - "description": "Represents a null JSON value.", - "type": "null" - }, - { - "description": "Represents a [`bool`].", - "type": "boolean" - }, - { - "description": "Represents a valid ACL [`Number`].", - "allOf": [ - { - "$ref": "#/definitions/Number" - } - ] - }, - { - "description": "Represents a [`String`].", - "type": "string" - }, - { - "description": "Represents a list of other [`Value`]s.", - "type": "array", - "items": { - "$ref": "#/definitions/Value" - } - }, - { - "description": "Represents a map of [`String`] keys to [`Value`]s.", - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/Value" - } - } - ] - }, - "Number": { - "description": "A valid ACL number.", - "anyOf": [ - { - "description": "Represents an [`i64`].", - "type": "integer", - "format": "int64" - }, - { - "description": "Represents a [`f64`].", - "type": "number", - "format": "double" - } - ] - }, - "Target": { - "description": "Platform target.", - "oneOf": [ - { - "description": "MacOS.", - "type": "string", - "enum": [ - "macOS" - ] - }, - { - "description": "Windows.", - "type": "string", - "enum": [ - "windows" - ] - }, - { - "description": "Linux.", - "type": "string", - "enum": [ - "linux" - ] - }, - { - "description": "Android.", - "type": "string", - "enum": [ - "android" - ] - }, - { - "description": "iOS.", - "type": "string", - "enum": [ - "iOS" - ] - } - ] - }, - "ShellAllowedArg": { - "description": "A command argument allowed to be executed by the webview API.", - "anyOf": [ - { - "description": "A non-configurable argument that is passed to the command in the order it was specified.", - "type": "string" - }, - { - "description": "A variable that is set while calling the command from the webview API.", - "type": "object", - "required": [ - "validator" - ], - "properties": { - "validator": { - "description": "[regex] validator to require passed values to conform to an expected input.\n\nThis will require the argument value passed to this variable to match the `validator` regex before it will be executed.\n\n[regex]: https://docs.rs/regex/latest/regex/#syntax", - "type": "string" - } - }, - "additionalProperties": false - } - ] - }, - "ShellAllowedArgs": { - "description": "A set of command arguments allowed to be executed by the webview API.\n\nA value of `true` will allow any arguments to be passed to the command. `false` will disable all arguments. A list of [`ShellAllowedArg`] will set those arguments as the only valid arguments to be passed to the attached command configuration.", - "anyOf": [ - { - "description": "Use a simple boolean to allow all or disable all arguments to this command configuration.", - "type": "boolean" - }, - { - "description": "A specific set of [`ShellAllowedArg`] that are valid to call for the command configuration.", - "type": "array", - "items": { - "$ref": "#/definitions/ShellAllowedArg" - } - } - ] - } - } -} \ No newline at end of file diff --git a/examples/api/src-tauri/gen/schemas/mobile-schema.json b/examples/api/src-tauri/gen/schemas/mobile-schema.json deleted file mode 100644 index 884d268f..00000000 --- a/examples/api/src-tauri/gen/schemas/mobile-schema.json +++ /dev/null @@ -1,6854 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "CapabilityFile", - "description": "Capability formats accepted in a capability file.", - "anyOf": [ - { - "description": "A single capability.", - "allOf": [ - { - "$ref": "#/definitions/Capability" - } - ] - }, - { - "description": "A list of capabilities.", - "type": "object", - "required": [ - "capabilities" - ], - "properties": { - "capabilities": { - "description": "The list of capabilities.", - "type": "array", - "items": { - "$ref": "#/definitions/Capability" - } - } - } - } - ], - "definitions": { - "Capability": { - "description": "a grouping and boundary mechanism developers can use to separate windows or plugins functionality from each other at runtime.\n\nIf a window is not matching any capability then it has no access to the IPC layer at all.\n\nThis can be done to create trust groups and reduce impact of vulnerabilities in certain plugins or windows. Windows can be added to a capability by exact name or glob patterns like *, admin-* or main-window.", - "type": "object", - "required": [ - "identifier", - "permissions", - "windows" - ], - "properties": { - "identifier": { - "description": "Identifier of the capability.", - "type": "string" - }, - "description": { - "description": "Description of the capability.", - "default": "", - "type": "string" - }, - "context": { - "description": "Execution context of the capability.\n\nAt runtime, Tauri filters the IPC command together with the context to determine whether it is allowed or not and its scope.", - "default": "local", - "allOf": [ - { - "$ref": "#/definitions/CapabilityContext" - } - ] - }, - "windows": { - "description": "List of windows that uses this capability. Can be a glob pattern.\n\nOn multiwebview windows, prefer [`Self::webviews`] for a fine grained access control.", - "type": "array", - "items": { - "type": "string" - } - }, - "webviews": { - "description": "List of webviews that uses this capability. Can be a glob pattern.\n\nThis is only required when using on multiwebview contexts, by default all child webviews of a window that matches [`Self::windows`] are linked.", - "type": "array", - "items": { - "type": "string" - } - }, - "permissions": { - "description": "List of permissions attached to this capability. Must include the plugin name as prefix in the form of `${plugin-name}:${permission-name}`.", - "type": "array", - "items": { - "$ref": "#/definitions/PermissionEntry" - } - }, - "platforms": { - "description": "Target platforms this capability applies. By default all platforms applies.", - "default": [ - "linux", - "macOS", - "windows", - "android", - "iOS" - ], - "type": "array", - "items": { - "$ref": "#/definitions/Target" - } - } - } - }, - "CapabilityContext": { - "description": "Context of the capability.", - "oneOf": [ - { - "description": "Capability refers to local URL usage.", - "type": "string", - "enum": [ - "local" - ] - }, - { - "description": "Capability refers to remote usage.", - "type": "object", - "required": [ - "remote" - ], - "properties": { - "remote": { - "type": "object", - "required": [ - "urls" - ], - "properties": { - "urls": { - "description": "Remote domains this capability refers to. Can use glob patterns.", - "type": "array", - "items": { - "type": "string" - } - } - } - } - }, - "additionalProperties": false - } - ] - }, - "PermissionEntry": { - "description": "An entry for a permission value in a [`Capability`] can be either a raw permission [`Identifier`] or an object that references a permission and extends its scope.", - "anyOf": [ - { - "description": "Reference a permission or permission set by identifier.", - "allOf": [ - { - "$ref": "#/definitions/Identifier" - } - ] - }, - { - "description": "Reference a permission or permission set by identifier and extends its scope.", - "type": "object", - "oneOf": [ - { - "type": "object", - "required": [ - "identifier" - ], - "properties": { - "identifier": { - "oneOf": [ - { - "description": "fs:default -> # Tauri `fs` default permissions\n\nThis configuration file defines the default permissions granted\nto the filesystem.\n\n### Granted Permissions\n\nThis default permission set enables all read-related commands and\nallows access to the `$APP` folder and sub directories created in it.\nThe location of the `$APP` folder depends on the operating system,\nwhere the application is run.\n\nIn general the `$APP` folder needs to be manually created\nby the application at runtime, before accessing files or folders\nin it is possible.\n\n### Denied Permissions\n\nThis default permission set prevents access to critical components\nof the Tauri application by default.\nOn Windows the webview data folder access is denied.\n\n", - "type": "string", - "enum": [ - "fs:default" - ] - }, - { - "description": "fs:allow-app-meta -> This allows read access to metadata of the `$APP` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-app-meta" - ] - }, - { - "description": "fs:allow-app-meta-recursive -> This allows read access to metadata of the `$APP` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-app-meta-recursive" - ] - }, - { - "description": "fs:allow-app-read -> This allows non-recursive read access to the `$APP` folder.", - "type": "string", - "enum": [ - "fs:allow-app-read" - ] - }, - { - "description": "fs:allow-app-read-recursive -> This allows full recursive read access to the complete `$APP` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-app-read-recursive" - ] - }, - { - "description": "fs:allow-app-write -> This allows non-recursive write access to the `$APP` folder.", - "type": "string", - "enum": [ - "fs:allow-app-write" - ] - }, - { - "description": "fs:allow-app-write-recursive -> This allows full recusrive write access to the complete `$APP` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-app-write-recursive" - ] - }, - { - "description": "fs:allow-appcache-meta -> This allows read access to metadata of the `$APPCACHE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-appcache-meta" - ] - }, - { - "description": "fs:allow-appcache-meta-recursive -> This allows read access to metadata of the `$APPCACHE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-appcache-meta-recursive" - ] - }, - { - "description": "fs:allow-appcache-read -> This allows non-recursive read access to the `$APPCACHE` folder.", - "type": "string", - "enum": [ - "fs:allow-appcache-read" - ] - }, - { - "description": "fs:allow-appcache-read-recursive -> This allows full recursive read access to the complete `$APPCACHE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-appcache-read-recursive" - ] - }, - { - "description": "fs:allow-appcache-write -> This allows non-recursive write access to the `$APPCACHE` folder.", - "type": "string", - "enum": [ - "fs:allow-appcache-write" - ] - }, - { - "description": "fs:allow-appcache-write-recursive -> This allows full recusrive write access to the complete `$APPCACHE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-appcache-write-recursive" - ] - }, - { - "description": "fs:allow-appconfig-meta -> This allows read access to metadata of the `$APPCONFIG` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-appconfig-meta" - ] - }, - { - "description": "fs:allow-appconfig-meta-recursive -> This allows read access to metadata of the `$APPCONFIG` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-appconfig-meta-recursive" - ] - }, - { - "description": "fs:allow-appconfig-read -> This allows non-recursive read access to the `$APPCONFIG` folder.", - "type": "string", - "enum": [ - "fs:allow-appconfig-read" - ] - }, - { - "description": "fs:allow-appconfig-read-recursive -> This allows full recursive read access to the complete `$APPCONFIG` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-appconfig-read-recursive" - ] - }, - { - "description": "fs:allow-appconfig-write -> This allows non-recursive write access to the `$APPCONFIG` folder.", - "type": "string", - "enum": [ - "fs:allow-appconfig-write" - ] - }, - { - "description": "fs:allow-appconfig-write-recursive -> This allows full recusrive write access to the complete `$APPCONFIG` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-appconfig-write-recursive" - ] - }, - { - "description": "fs:allow-appdata-meta -> This allows read access to metadata of the `$APPDATA` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-appdata-meta" - ] - }, - { - "description": "fs:allow-appdata-meta-recursive -> This allows read access to metadata of the `$APPDATA` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-appdata-meta-recursive" - ] - }, - { - "description": "fs:allow-appdata-read -> This allows non-recursive read access to the `$APPDATA` folder.", - "type": "string", - "enum": [ - "fs:allow-appdata-read" - ] - }, - { - "description": "fs:allow-appdata-read-recursive -> This allows full recursive read access to the complete `$APPDATA` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-appdata-read-recursive" - ] - }, - { - "description": "fs:allow-appdata-write -> This allows non-recursive write access to the `$APPDATA` folder.", - "type": "string", - "enum": [ - "fs:allow-appdata-write" - ] - }, - { - "description": "fs:allow-appdata-write-recursive -> This allows full recusrive write access to the complete `$APPDATA` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-appdata-write-recursive" - ] - }, - { - "description": "fs:allow-applocaldata-meta -> This allows read access to metadata of the `$APPLOCALDATA` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-applocaldata-meta" - ] - }, - { - "description": "fs:allow-applocaldata-meta-recursive -> This allows read access to metadata of the `$APPLOCALDATA` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-applocaldata-meta-recursive" - ] - }, - { - "description": "fs:allow-applocaldata-read -> This allows non-recursive read access to the `$APPLOCALDATA` folder.", - "type": "string", - "enum": [ - "fs:allow-applocaldata-read" - ] - }, - { - "description": "fs:allow-applocaldata-read-recursive -> This allows full recursive read access to the complete `$APPLOCALDATA` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-applocaldata-read-recursive" - ] - }, - { - "description": "fs:allow-applocaldata-write -> This allows non-recursive write access to the `$APPLOCALDATA` folder.", - "type": "string", - "enum": [ - "fs:allow-applocaldata-write" - ] - }, - { - "description": "fs:allow-applocaldata-write-recursive -> This allows full recusrive write access to the complete `$APPLOCALDATA` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-applocaldata-write-recursive" - ] - }, - { - "description": "fs:allow-applog-meta -> This allows read access to metadata of the `$APPLOG` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-applog-meta" - ] - }, - { - "description": "fs:allow-applog-meta-recursive -> This allows read access to metadata of the `$APPLOG` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-applog-meta-recursive" - ] - }, - { - "description": "fs:allow-applog-read -> This allows non-recursive read access to the `$APPLOG` folder.", - "type": "string", - "enum": [ - "fs:allow-applog-read" - ] - }, - { - "description": "fs:allow-applog-read-recursive -> This allows full recursive read access to the complete `$APPLOG` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-applog-read-recursive" - ] - }, - { - "description": "fs:allow-applog-write -> This allows non-recursive write access to the `$APPLOG` folder.", - "type": "string", - "enum": [ - "fs:allow-applog-write" - ] - }, - { - "description": "fs:allow-applog-write-recursive -> This allows full recusrive write access to the complete `$APPLOG` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-applog-write-recursive" - ] - }, - { - "description": "fs:allow-audio-meta -> This allows read access to metadata of the `$AUDIO` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-audio-meta" - ] - }, - { - "description": "fs:allow-audio-meta-recursive -> This allows read access to metadata of the `$AUDIO` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-audio-meta-recursive" - ] - }, - { - "description": "fs:allow-audio-read -> This allows non-recursive read access to the `$AUDIO` folder.", - "type": "string", - "enum": [ - "fs:allow-audio-read" - ] - }, - { - "description": "fs:allow-audio-read-recursive -> This allows full recursive read access to the complete `$AUDIO` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-audio-read-recursive" - ] - }, - { - "description": "fs:allow-audio-write -> This allows non-recursive write access to the `$AUDIO` folder.", - "type": "string", - "enum": [ - "fs:allow-audio-write" - ] - }, - { - "description": "fs:allow-audio-write-recursive -> This allows full recusrive write access to the complete `$AUDIO` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-audio-write-recursive" - ] - }, - { - "description": "fs:allow-cache-meta -> This allows read access to metadata of the `$CACHE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-cache-meta" - ] - }, - { - "description": "fs:allow-cache-meta-recursive -> This allows read access to metadata of the `$CACHE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-cache-meta-recursive" - ] - }, - { - "description": "fs:allow-cache-read -> This allows non-recursive read access to the `$CACHE` folder.", - "type": "string", - "enum": [ - "fs:allow-cache-read" - ] - }, - { - "description": "fs:allow-cache-read-recursive -> This allows full recursive read access to the complete `$CACHE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-cache-read-recursive" - ] - }, - { - "description": "fs:allow-cache-write -> This allows non-recursive write access to the `$CACHE` folder.", - "type": "string", - "enum": [ - "fs:allow-cache-write" - ] - }, - { - "description": "fs:allow-cache-write-recursive -> This allows full recusrive write access to the complete `$CACHE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-cache-write-recursive" - ] - }, - { - "description": "fs:allow-config-meta -> This allows read access to metadata of the `$CONFIG` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-config-meta" - ] - }, - { - "description": "fs:allow-config-meta-recursive -> This allows read access to metadata of the `$CONFIG` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-config-meta-recursive" - ] - }, - { - "description": "fs:allow-config-read -> This allows non-recursive read access to the `$CONFIG` folder.", - "type": "string", - "enum": [ - "fs:allow-config-read" - ] - }, - { - "description": "fs:allow-config-read-recursive -> This allows full recursive read access to the complete `$CONFIG` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-config-read-recursive" - ] - }, - { - "description": "fs:allow-config-write -> This allows non-recursive write access to the `$CONFIG` folder.", - "type": "string", - "enum": [ - "fs:allow-config-write" - ] - }, - { - "description": "fs:allow-config-write-recursive -> This allows full recusrive write access to the complete `$CONFIG` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-config-write-recursive" - ] - }, - { - "description": "fs:allow-data-meta -> This allows read access to metadata of the `$DATA` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-data-meta" - ] - }, - { - "description": "fs:allow-data-meta-recursive -> This allows read access to metadata of the `$DATA` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-data-meta-recursive" - ] - }, - { - "description": "fs:allow-data-read -> This allows non-recursive read access to the `$DATA` folder.", - "type": "string", - "enum": [ - "fs:allow-data-read" - ] - }, - { - "description": "fs:allow-data-read-recursive -> This allows full recursive read access to the complete `$DATA` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-data-read-recursive" - ] - }, - { - "description": "fs:allow-data-write -> This allows non-recursive write access to the `$DATA` folder.", - "type": "string", - "enum": [ - "fs:allow-data-write" - ] - }, - { - "description": "fs:allow-data-write-recursive -> This allows full recusrive write access to the complete `$DATA` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-data-write-recursive" - ] - }, - { - "description": "fs:allow-desktop-meta -> This allows read access to metadata of the `$DESKTOP` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-desktop-meta" - ] - }, - { - "description": "fs:allow-desktop-meta-recursive -> This allows read access to metadata of the `$DESKTOP` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-desktop-meta-recursive" - ] - }, - { - "description": "fs:allow-desktop-read -> This allows non-recursive read access to the `$DESKTOP` folder.", - "type": "string", - "enum": [ - "fs:allow-desktop-read" - ] - }, - { - "description": "fs:allow-desktop-read-recursive -> This allows full recursive read access to the complete `$DESKTOP` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-desktop-read-recursive" - ] - }, - { - "description": "fs:allow-desktop-write -> This allows non-recursive write access to the `$DESKTOP` folder.", - "type": "string", - "enum": [ - "fs:allow-desktop-write" - ] - }, - { - "description": "fs:allow-desktop-write-recursive -> This allows full recusrive write access to the complete `$DESKTOP` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-desktop-write-recursive" - ] - }, - { - "description": "fs:allow-document-meta -> This allows read access to metadata of the `$DOCUMENT` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-document-meta" - ] - }, - { - "description": "fs:allow-document-meta-recursive -> This allows read access to metadata of the `$DOCUMENT` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-document-meta-recursive" - ] - }, - { - "description": "fs:allow-document-read -> This allows non-recursive read access to the `$DOCUMENT` folder.", - "type": "string", - "enum": [ - "fs:allow-document-read" - ] - }, - { - "description": "fs:allow-document-read-recursive -> This allows full recursive read access to the complete `$DOCUMENT` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-document-read-recursive" - ] - }, - { - "description": "fs:allow-document-write -> This allows non-recursive write access to the `$DOCUMENT` folder.", - "type": "string", - "enum": [ - "fs:allow-document-write" - ] - }, - { - "description": "fs:allow-document-write-recursive -> This allows full recusrive write access to the complete `$DOCUMENT` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-document-write-recursive" - ] - }, - { - "description": "fs:allow-download-meta -> This allows read access to metadata of the `$DOWNLOAD` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-download-meta" - ] - }, - { - "description": "fs:allow-download-meta-recursive -> This allows read access to metadata of the `$DOWNLOAD` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-download-meta-recursive" - ] - }, - { - "description": "fs:allow-download-read -> This allows non-recursive read access to the `$DOWNLOAD` folder.", - "type": "string", - "enum": [ - "fs:allow-download-read" - ] - }, - { - "description": "fs:allow-download-read-recursive -> This allows full recursive read access to the complete `$DOWNLOAD` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-download-read-recursive" - ] - }, - { - "description": "fs:allow-download-write -> This allows non-recursive write access to the `$DOWNLOAD` folder.", - "type": "string", - "enum": [ - "fs:allow-download-write" - ] - }, - { - "description": "fs:allow-download-write-recursive -> This allows full recusrive write access to the complete `$DOWNLOAD` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-download-write-recursive" - ] - }, - { - "description": "fs:allow-exe-meta -> This allows read access to metadata of the `$EXE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-exe-meta" - ] - }, - { - "description": "fs:allow-exe-meta-recursive -> This allows read access to metadata of the `$EXE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-exe-meta-recursive" - ] - }, - { - "description": "fs:allow-exe-read -> This allows non-recursive read access to the `$EXE` folder.", - "type": "string", - "enum": [ - "fs:allow-exe-read" - ] - }, - { - "description": "fs:allow-exe-read-recursive -> This allows full recursive read access to the complete `$EXE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-exe-read-recursive" - ] - }, - { - "description": "fs:allow-exe-write -> This allows non-recursive write access to the `$EXE` folder.", - "type": "string", - "enum": [ - "fs:allow-exe-write" - ] - }, - { - "description": "fs:allow-exe-write-recursive -> This allows full recusrive write access to the complete `$EXE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-exe-write-recursive" - ] - }, - { - "description": "fs:allow-font-meta -> This allows read access to metadata of the `$FONT` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-font-meta" - ] - }, - { - "description": "fs:allow-font-meta-recursive -> This allows read access to metadata of the `$FONT` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-font-meta-recursive" - ] - }, - { - "description": "fs:allow-font-read -> This allows non-recursive read access to the `$FONT` folder.", - "type": "string", - "enum": [ - "fs:allow-font-read" - ] - }, - { - "description": "fs:allow-font-read-recursive -> This allows full recursive read access to the complete `$FONT` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-font-read-recursive" - ] - }, - { - "description": "fs:allow-font-write -> This allows non-recursive write access to the `$FONT` folder.", - "type": "string", - "enum": [ - "fs:allow-font-write" - ] - }, - { - "description": "fs:allow-font-write-recursive -> This allows full recusrive write access to the complete `$FONT` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-font-write-recursive" - ] - }, - { - "description": "fs:allow-home-meta -> This allows read access to metadata of the `$HOME` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-home-meta" - ] - }, - { - "description": "fs:allow-home-meta-recursive -> This allows read access to metadata of the `$HOME` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-home-meta-recursive" - ] - }, - { - "description": "fs:allow-home-read -> This allows non-recursive read access to the `$HOME` folder.", - "type": "string", - "enum": [ - "fs:allow-home-read" - ] - }, - { - "description": "fs:allow-home-read-recursive -> This allows full recursive read access to the complete `$HOME` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-home-read-recursive" - ] - }, - { - "description": "fs:allow-home-write -> This allows non-recursive write access to the `$HOME` folder.", - "type": "string", - "enum": [ - "fs:allow-home-write" - ] - }, - { - "description": "fs:allow-home-write-recursive -> This allows full recusrive write access to the complete `$HOME` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-home-write-recursive" - ] - }, - { - "description": "fs:allow-localdata-meta -> This allows read access to metadata of the `$LOCALDATA` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-localdata-meta" - ] - }, - { - "description": "fs:allow-localdata-meta-recursive -> This allows read access to metadata of the `$LOCALDATA` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-localdata-meta-recursive" - ] - }, - { - "description": "fs:allow-localdata-read -> This allows non-recursive read access to the `$LOCALDATA` folder.", - "type": "string", - "enum": [ - "fs:allow-localdata-read" - ] - }, - { - "description": "fs:allow-localdata-read-recursive -> This allows full recursive read access to the complete `$LOCALDATA` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-localdata-read-recursive" - ] - }, - { - "description": "fs:allow-localdata-write -> This allows non-recursive write access to the `$LOCALDATA` folder.", - "type": "string", - "enum": [ - "fs:allow-localdata-write" - ] - }, - { - "description": "fs:allow-localdata-write-recursive -> This allows full recusrive write access to the complete `$LOCALDATA` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-localdata-write-recursive" - ] - }, - { - "description": "fs:allow-log-meta -> This allows read access to metadata of the `$LOG` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-log-meta" - ] - }, - { - "description": "fs:allow-log-meta-recursive -> This allows read access to metadata of the `$LOG` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-log-meta-recursive" - ] - }, - { - "description": "fs:allow-log-read -> This allows non-recursive read access to the `$LOG` folder.", - "type": "string", - "enum": [ - "fs:allow-log-read" - ] - }, - { - "description": "fs:allow-log-read-recursive -> This allows full recursive read access to the complete `$LOG` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-log-read-recursive" - ] - }, - { - "description": "fs:allow-log-write -> This allows non-recursive write access to the `$LOG` folder.", - "type": "string", - "enum": [ - "fs:allow-log-write" - ] - }, - { - "description": "fs:allow-log-write-recursive -> This allows full recusrive write access to the complete `$LOG` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-log-write-recursive" - ] - }, - { - "description": "fs:allow-picture-meta -> This allows read access to metadata of the `$PICTURE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-picture-meta" - ] - }, - { - "description": "fs:allow-picture-meta-recursive -> This allows read access to metadata of the `$PICTURE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-picture-meta-recursive" - ] - }, - { - "description": "fs:allow-picture-read -> This allows non-recursive read access to the `$PICTURE` folder.", - "type": "string", - "enum": [ - "fs:allow-picture-read" - ] - }, - { - "description": "fs:allow-picture-read-recursive -> This allows full recursive read access to the complete `$PICTURE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-picture-read-recursive" - ] - }, - { - "description": "fs:allow-picture-write -> This allows non-recursive write access to the `$PICTURE` folder.", - "type": "string", - "enum": [ - "fs:allow-picture-write" - ] - }, - { - "description": "fs:allow-picture-write-recursive -> This allows full recusrive write access to the complete `$PICTURE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-picture-write-recursive" - ] - }, - { - "description": "fs:allow-public-meta -> This allows read access to metadata of the `$PUBLIC` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-public-meta" - ] - }, - { - "description": "fs:allow-public-meta-recursive -> This allows read access to metadata of the `$PUBLIC` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-public-meta-recursive" - ] - }, - { - "description": "fs:allow-public-read -> This allows non-recursive read access to the `$PUBLIC` folder.", - "type": "string", - "enum": [ - "fs:allow-public-read" - ] - }, - { - "description": "fs:allow-public-read-recursive -> This allows full recursive read access to the complete `$PUBLIC` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-public-read-recursive" - ] - }, - { - "description": "fs:allow-public-write -> This allows non-recursive write access to the `$PUBLIC` folder.", - "type": "string", - "enum": [ - "fs:allow-public-write" - ] - }, - { - "description": "fs:allow-public-write-recursive -> This allows full recusrive write access to the complete `$PUBLIC` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-public-write-recursive" - ] - }, - { - "description": "fs:allow-resource-meta -> This allows read access to metadata of the `$RESOURCE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-resource-meta" - ] - }, - { - "description": "fs:allow-resource-meta-recursive -> This allows read access to metadata of the `$RESOURCE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-resource-meta-recursive" - ] - }, - { - "description": "fs:allow-resource-read -> This allows non-recursive read access to the `$RESOURCE` folder.", - "type": "string", - "enum": [ - "fs:allow-resource-read" - ] - }, - { - "description": "fs:allow-resource-read-recursive -> This allows full recursive read access to the complete `$RESOURCE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-resource-read-recursive" - ] - }, - { - "description": "fs:allow-resource-write -> This allows non-recursive write access to the `$RESOURCE` folder.", - "type": "string", - "enum": [ - "fs:allow-resource-write" - ] - }, - { - "description": "fs:allow-resource-write-recursive -> This allows full recusrive write access to the complete `$RESOURCE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-resource-write-recursive" - ] - }, - { - "description": "fs:allow-runtime-meta -> This allows read access to metadata of the `$RUNTIME` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-runtime-meta" - ] - }, - { - "description": "fs:allow-runtime-meta-recursive -> This allows read access to metadata of the `$RUNTIME` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-runtime-meta-recursive" - ] - }, - { - "description": "fs:allow-runtime-read -> This allows non-recursive read access to the `$RUNTIME` folder.", - "type": "string", - "enum": [ - "fs:allow-runtime-read" - ] - }, - { - "description": "fs:allow-runtime-read-recursive -> This allows full recursive read access to the complete `$RUNTIME` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-runtime-read-recursive" - ] - }, - { - "description": "fs:allow-runtime-write -> This allows non-recursive write access to the `$RUNTIME` folder.", - "type": "string", - "enum": [ - "fs:allow-runtime-write" - ] - }, - { - "description": "fs:allow-runtime-write-recursive -> This allows full recusrive write access to the complete `$RUNTIME` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-runtime-write-recursive" - ] - }, - { - "description": "fs:allow-temp-meta -> This allows read access to metadata of the `$TEMP` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-temp-meta" - ] - }, - { - "description": "fs:allow-temp-meta-recursive -> This allows read access to metadata of the `$TEMP` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-temp-meta-recursive" - ] - }, - { - "description": "fs:allow-temp-read -> This allows non-recursive read access to the `$TEMP` folder.", - "type": "string", - "enum": [ - "fs:allow-temp-read" - ] - }, - { - "description": "fs:allow-temp-read-recursive -> This allows full recursive read access to the complete `$TEMP` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-temp-read-recursive" - ] - }, - { - "description": "fs:allow-temp-write -> This allows non-recursive write access to the `$TEMP` folder.", - "type": "string", - "enum": [ - "fs:allow-temp-write" - ] - }, - { - "description": "fs:allow-temp-write-recursive -> This allows full recusrive write access to the complete `$TEMP` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-temp-write-recursive" - ] - }, - { - "description": "fs:allow-template-meta -> This allows read access to metadata of the `$TEMPLATE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-template-meta" - ] - }, - { - "description": "fs:allow-template-meta-recursive -> This allows read access to metadata of the `$TEMPLATE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-template-meta-recursive" - ] - }, - { - "description": "fs:allow-template-read -> This allows non-recursive read access to the `$TEMPLATE` folder.", - "type": "string", - "enum": [ - "fs:allow-template-read" - ] - }, - { - "description": "fs:allow-template-read-recursive -> This allows full recursive read access to the complete `$TEMPLATE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-template-read-recursive" - ] - }, - { - "description": "fs:allow-template-write -> This allows non-recursive write access to the `$TEMPLATE` folder.", - "type": "string", - "enum": [ - "fs:allow-template-write" - ] - }, - { - "description": "fs:allow-template-write-recursive -> This allows full recusrive write access to the complete `$TEMPLATE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-template-write-recursive" - ] - }, - { - "description": "fs:allow-video-meta -> This allows read access to metadata of the `$VIDEO` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-video-meta" - ] - }, - { - "description": "fs:allow-video-meta-recursive -> This allows read access to metadata of the `$VIDEO` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-video-meta-recursive" - ] - }, - { - "description": "fs:allow-video-read -> This allows non-recursive read access to the `$VIDEO` folder.", - "type": "string", - "enum": [ - "fs:allow-video-read" - ] - }, - { - "description": "fs:allow-video-read-recursive -> This allows full recursive read access to the complete `$VIDEO` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-video-read-recursive" - ] - }, - { - "description": "fs:allow-video-write -> This allows non-recursive write access to the `$VIDEO` folder.", - "type": "string", - "enum": [ - "fs:allow-video-write" - ] - }, - { - "description": "fs:allow-video-write-recursive -> This allows full recusrive write access to the complete `$VIDEO` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-video-write-recursive" - ] - }, - { - "description": "fs:deny-default -> This denies access to dangerous Tauri relevant files and folders by default.", - "type": "string", - "enum": [ - "fs:deny-default" - ] - }, - { - "description": "fs:allow-copy-file -> Enables the copy_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-copy-file" - ] - }, - { - "description": "fs:allow-create -> Enables the create command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-create" - ] - }, - { - "description": "fs:allow-exists -> Enables the exists command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-exists" - ] - }, - { - "description": "fs:allow-fstat -> Enables the fstat command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-fstat" - ] - }, - { - "description": "fs:allow-ftruncate -> Enables the ftruncate command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-ftruncate" - ] - }, - { - "description": "fs:allow-lstat -> Enables the lstat command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-lstat" - ] - }, - { - "description": "fs:allow-mkdir -> Enables the mkdir command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-mkdir" - ] - }, - { - "description": "fs:allow-open -> Enables the open command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-open" - ] - }, - { - "description": "fs:allow-read -> Enables the read command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-read" - ] - }, - { - "description": "fs:allow-read-dir -> Enables the read_dir command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-read-dir" - ] - }, - { - "description": "fs:allow-read-file -> Enables the read_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-read-file" - ] - }, - { - "description": "fs:allow-read-text-file -> Enables the read_text_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-read-text-file" - ] - }, - { - "description": "fs:allow-read-text-file-lines -> Enables the read_text_file_lines command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-read-text-file-lines" - ] - }, - { - "description": "fs:allow-read-text-file-lines-next -> Enables the read_text_file_lines_next command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-read-text-file-lines-next" - ] - }, - { - "description": "fs:allow-remove -> Enables the remove command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-remove" - ] - }, - { - "description": "fs:allow-rename -> Enables the rename command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-rename" - ] - }, - { - "description": "fs:allow-seek -> Enables the seek command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-seek" - ] - }, - { - "description": "fs:allow-stat -> Enables the stat command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-stat" - ] - }, - { - "description": "fs:allow-truncate -> Enables the truncate command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-truncate" - ] - }, - { - "description": "fs:allow-unwatch -> Enables the unwatch command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-unwatch" - ] - }, - { - "description": "fs:allow-watch -> Enables the watch command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-watch" - ] - }, - { - "description": "fs:allow-write -> Enables the write command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-write" - ] - }, - { - "description": "fs:allow-write-file -> Enables the write_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-write-file" - ] - }, - { - "description": "fs:allow-write-text-file -> Enables the write_text_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-write-text-file" - ] - }, - { - "description": "fs:deny-copy-file -> Denies the copy_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-copy-file" - ] - }, - { - "description": "fs:deny-create -> Denies the create command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-create" - ] - }, - { - "description": "fs:deny-exists -> Denies the exists command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-exists" - ] - }, - { - "description": "fs:deny-fstat -> Denies the fstat command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-fstat" - ] - }, - { - "description": "fs:deny-ftruncate -> Denies the ftruncate command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-ftruncate" - ] - }, - { - "description": "fs:deny-lstat -> Denies the lstat command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-lstat" - ] - }, - { - "description": "fs:deny-mkdir -> Denies the mkdir command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-mkdir" - ] - }, - { - "description": "fs:deny-open -> Denies the open command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-open" - ] - }, - { - "description": "fs:deny-read -> Denies the read command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-read" - ] - }, - { - "description": "fs:deny-read-dir -> Denies the read_dir command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-read-dir" - ] - }, - { - "description": "fs:deny-read-file -> Denies the read_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-read-file" - ] - }, - { - "description": "fs:deny-read-text-file -> Denies the read_text_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-read-text-file" - ] - }, - { - "description": "fs:deny-read-text-file-lines -> Denies the read_text_file_lines command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-read-text-file-lines" - ] - }, - { - "description": "fs:deny-read-text-file-lines-next -> Denies the read_text_file_lines_next command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-read-text-file-lines-next" - ] - }, - { - "description": "fs:deny-remove -> Denies the remove command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-remove" - ] - }, - { - "description": "fs:deny-rename -> Denies the rename command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-rename" - ] - }, - { - "description": "fs:deny-seek -> Denies the seek command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-seek" - ] - }, - { - "description": "fs:deny-stat -> Denies the stat command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-stat" - ] - }, - { - "description": "fs:deny-truncate -> Denies the truncate command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-truncate" - ] - }, - { - "description": "fs:deny-unwatch -> Denies the unwatch command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-unwatch" - ] - }, - { - "description": "fs:deny-watch -> Denies the watch command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-watch" - ] - }, - { - "description": "fs:deny-webview-data-linux -> This denies read access to the\n`$APPLOCALDATA` folder on linux as the webview data and configuration values are stored here.\nAllowing access can lead to sensitive information disclosure and should be well considered.", - "type": "string", - "enum": [ - "fs:deny-webview-data-linux" - ] - }, - { - "description": "fs:deny-webview-data-windows -> This denies read access to the\n`$APPLOCALDATA/EBWebView` folder on windows as the webview data and configuration values are stored here.\nAllowing access can lead to sensitive information disclosure and should be well considered.", - "type": "string", - "enum": [ - "fs:deny-webview-data-windows" - ] - }, - { - "description": "fs:deny-write -> Denies the write command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-write" - ] - }, - { - "description": "fs:deny-write-file -> Denies the write_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-write-file" - ] - }, - { - "description": "fs:deny-write-text-file -> Denies the write_text_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-write-text-file" - ] - }, - { - "description": "fs:read-all -> This enables all read related commands without any pre-configured accessible paths.", - "type": "string", - "enum": [ - "fs:read-all" - ] - }, - { - "description": "fs:read-dirs -> This enables directory read and file metadata related commands without any pre-configured accessible paths.", - "type": "string", - "enum": [ - "fs:read-dirs" - ] - }, - { - "description": "fs:read-files -> This enables file read related commands without any pre-configured accessible paths.", - "type": "string", - "enum": [ - "fs:read-files" - ] - }, - { - "description": "fs:read-meta -> This enables all index or metadata related commands without any pre-configured accessible paths.", - "type": "string", - "enum": [ - "fs:read-meta" - ] - }, - { - "description": "fs:scope -> An empty permission you can use to modify the global scope.", - "type": "string", - "enum": [ - "fs:scope" - ] - }, - { - "description": "fs:scope-app -> This scope permits access to all files and list content of top level directories in the `$APP`folder.", - "type": "string", - "enum": [ - "fs:scope-app" - ] - }, - { - "description": "fs:scope-app-index -> This scope permits to list all files and folders in the `$APP`folder.", - "type": "string", - "enum": [ - "fs:scope-app-index" - ] - }, - { - "description": "fs:scope-app-recursive -> This scope recursive access to the complete `$APP` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-app-recursive" - ] - }, - { - "description": "fs:scope-appcache -> This scope permits access to all files and list content of top level directories in the `$APPCACHE`folder.", - "type": "string", - "enum": [ - "fs:scope-appcache" - ] - }, - { - "description": "fs:scope-appcache-index -> This scope permits to list all files and folders in the `$APPCACHE`folder.", - "type": "string", - "enum": [ - "fs:scope-appcache-index" - ] - }, - { - "description": "fs:scope-appcache-recursive -> This scope recursive access to the complete `$APPCACHE` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-appcache-recursive" - ] - }, - { - "description": "fs:scope-appconfig -> This scope permits access to all files and list content of top level directories in the `$APPCONFIG`folder.", - "type": "string", - "enum": [ - "fs:scope-appconfig" - ] - }, - { - "description": "fs:scope-appconfig-index -> This scope permits to list all files and folders in the `$APPCONFIG`folder.", - "type": "string", - "enum": [ - "fs:scope-appconfig-index" - ] - }, - { - "description": "fs:scope-appconfig-recursive -> This scope recursive access to the complete `$APPCONFIG` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-appconfig-recursive" - ] - }, - { - "description": "fs:scope-appdata -> This scope permits access to all files and list content of top level directories in the `$APPDATA`folder.", - "type": "string", - "enum": [ - "fs:scope-appdata" - ] - }, - { - "description": "fs:scope-appdata-index -> This scope permits to list all files and folders in the `$APPDATA`folder.", - "type": "string", - "enum": [ - "fs:scope-appdata-index" - ] - }, - { - "description": "fs:scope-appdata-recursive -> This scope recursive access to the complete `$APPDATA` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-appdata-recursive" - ] - }, - { - "description": "fs:scope-applocaldata -> This scope permits access to all files and list content of top level directories in the `$APPLOCALDATA`folder.", - "type": "string", - "enum": [ - "fs:scope-applocaldata" - ] - }, - { - "description": "fs:scope-applocaldata-index -> This scope permits to list all files and folders in the `$APPLOCALDATA`folder.", - "type": "string", - "enum": [ - "fs:scope-applocaldata-index" - ] - }, - { - "description": "fs:scope-applocaldata-recursive -> This scope recursive access to the complete `$APPLOCALDATA` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-applocaldata-recursive" - ] - }, - { - "description": "fs:scope-applog -> This scope permits access to all files and list content of top level directories in the `$APPLOG`folder.", - "type": "string", - "enum": [ - "fs:scope-applog" - ] - }, - { - "description": "fs:scope-applog-index -> This scope permits to list all files and folders in the `$APPLOG`folder.", - "type": "string", - "enum": [ - "fs:scope-applog-index" - ] - }, - { - "description": "fs:scope-applog-recursive -> This scope recursive access to the complete `$APPLOG` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-applog-recursive" - ] - }, - { - "description": "fs:scope-audio -> This scope permits access to all files and list content of top level directories in the `$AUDIO`folder.", - "type": "string", - "enum": [ - "fs:scope-audio" - ] - }, - { - "description": "fs:scope-audio-index -> This scope permits to list all files and folders in the `$AUDIO`folder.", - "type": "string", - "enum": [ - "fs:scope-audio-index" - ] - }, - { - "description": "fs:scope-audio-recursive -> This scope recursive access to the complete `$AUDIO` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-audio-recursive" - ] - }, - { - "description": "fs:scope-cache -> This scope permits access to all files and list content of top level directories in the `$CACHE`folder.", - "type": "string", - "enum": [ - "fs:scope-cache" - ] - }, - { - "description": "fs:scope-cache-index -> This scope permits to list all files and folders in the `$CACHE`folder.", - "type": "string", - "enum": [ - "fs:scope-cache-index" - ] - }, - { - "description": "fs:scope-cache-recursive -> This scope recursive access to the complete `$CACHE` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-cache-recursive" - ] - }, - { - "description": "fs:scope-config -> This scope permits access to all files and list content of top level directories in the `$CONFIG`folder.", - "type": "string", - "enum": [ - "fs:scope-config" - ] - }, - { - "description": "fs:scope-config-index -> This scope permits to list all files and folders in the `$CONFIG`folder.", - "type": "string", - "enum": [ - "fs:scope-config-index" - ] - }, - { - "description": "fs:scope-config-recursive -> This scope recursive access to the complete `$CONFIG` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-config-recursive" - ] - }, - { - "description": "fs:scope-data -> This scope permits access to all files and list content of top level directories in the `$DATA`folder.", - "type": "string", - "enum": [ - "fs:scope-data" - ] - }, - { - "description": "fs:scope-data-index -> This scope permits to list all files and folders in the `$DATA`folder.", - "type": "string", - "enum": [ - "fs:scope-data-index" - ] - }, - { - "description": "fs:scope-data-recursive -> This scope recursive access to the complete `$DATA` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-data-recursive" - ] - }, - { - "description": "fs:scope-desktop -> This scope permits access to all files and list content of top level directories in the `$DESKTOP`folder.", - "type": "string", - "enum": [ - "fs:scope-desktop" - ] - }, - { - "description": "fs:scope-desktop-index -> This scope permits to list all files and folders in the `$DESKTOP`folder.", - "type": "string", - "enum": [ - "fs:scope-desktop-index" - ] - }, - { - "description": "fs:scope-desktop-recursive -> This scope recursive access to the complete `$DESKTOP` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-desktop-recursive" - ] - }, - { - "description": "fs:scope-document -> This scope permits access to all files and list content of top level directories in the `$DOCUMENT`folder.", - "type": "string", - "enum": [ - "fs:scope-document" - ] - }, - { - "description": "fs:scope-document-index -> This scope permits to list all files and folders in the `$DOCUMENT`folder.", - "type": "string", - "enum": [ - "fs:scope-document-index" - ] - }, - { - "description": "fs:scope-document-recursive -> This scope recursive access to the complete `$DOCUMENT` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-document-recursive" - ] - }, - { - "description": "fs:scope-download -> This scope permits access to all files and list content of top level directories in the `$DOWNLOAD`folder.", - "type": "string", - "enum": [ - "fs:scope-download" - ] - }, - { - "description": "fs:scope-download-index -> This scope permits to list all files and folders in the `$DOWNLOAD`folder.", - "type": "string", - "enum": [ - "fs:scope-download-index" - ] - }, - { - "description": "fs:scope-download-recursive -> This scope recursive access to the complete `$DOWNLOAD` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-download-recursive" - ] - }, - { - "description": "fs:scope-exe -> This scope permits access to all files and list content of top level directories in the `$EXE`folder.", - "type": "string", - "enum": [ - "fs:scope-exe" - ] - }, - { - "description": "fs:scope-exe-index -> This scope permits to list all files and folders in the `$EXE`folder.", - "type": "string", - "enum": [ - "fs:scope-exe-index" - ] - }, - { - "description": "fs:scope-exe-recursive -> This scope recursive access to the complete `$EXE` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-exe-recursive" - ] - }, - { - "description": "fs:scope-font -> This scope permits access to all files and list content of top level directories in the `$FONT`folder.", - "type": "string", - "enum": [ - "fs:scope-font" - ] - }, - { - "description": "fs:scope-font-index -> This scope permits to list all files and folders in the `$FONT`folder.", - "type": "string", - "enum": [ - "fs:scope-font-index" - ] - }, - { - "description": "fs:scope-font-recursive -> This scope recursive access to the complete `$FONT` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-font-recursive" - ] - }, - { - "description": "fs:scope-home -> This scope permits access to all files and list content of top level directories in the `$HOME`folder.", - "type": "string", - "enum": [ - "fs:scope-home" - ] - }, - { - "description": "fs:scope-home-index -> This scope permits to list all files and folders in the `$HOME`folder.", - "type": "string", - "enum": [ - "fs:scope-home-index" - ] - }, - { - "description": "fs:scope-home-recursive -> This scope recursive access to the complete `$HOME` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-home-recursive" - ] - }, - { - "description": "fs:scope-localdata -> This scope permits access to all files and list content of top level directories in the `$LOCALDATA`folder.", - "type": "string", - "enum": [ - "fs:scope-localdata" - ] - }, - { - "description": "fs:scope-localdata-index -> This scope permits to list all files and folders in the `$LOCALDATA`folder.", - "type": "string", - "enum": [ - "fs:scope-localdata-index" - ] - }, - { - "description": "fs:scope-localdata-recursive -> This scope recursive access to the complete `$LOCALDATA` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-localdata-recursive" - ] - }, - { - "description": "fs:scope-log -> This scope permits access to all files and list content of top level directories in the `$LOG`folder.", - "type": "string", - "enum": [ - "fs:scope-log" - ] - }, - { - "description": "fs:scope-log-index -> This scope permits to list all files and folders in the `$LOG`folder.", - "type": "string", - "enum": [ - "fs:scope-log-index" - ] - }, - { - "description": "fs:scope-log-recursive -> This scope recursive access to the complete `$LOG` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-log-recursive" - ] - }, - { - "description": "fs:scope-picture -> This scope permits access to all files and list content of top level directories in the `$PICTURE`folder.", - "type": "string", - "enum": [ - "fs:scope-picture" - ] - }, - { - "description": "fs:scope-picture-index -> This scope permits to list all files and folders in the `$PICTURE`folder.", - "type": "string", - "enum": [ - "fs:scope-picture-index" - ] - }, - { - "description": "fs:scope-picture-recursive -> This scope recursive access to the complete `$PICTURE` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-picture-recursive" - ] - }, - { - "description": "fs:scope-public -> This scope permits access to all files and list content of top level directories in the `$PUBLIC`folder.", - "type": "string", - "enum": [ - "fs:scope-public" - ] - }, - { - "description": "fs:scope-public-index -> This scope permits to list all files and folders in the `$PUBLIC`folder.", - "type": "string", - "enum": [ - "fs:scope-public-index" - ] - }, - { - "description": "fs:scope-public-recursive -> This scope recursive access to the complete `$PUBLIC` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-public-recursive" - ] - }, - { - "description": "fs:scope-resource -> This scope permits access to all files and list content of top level directories in the `$RESOURCE`folder.", - "type": "string", - "enum": [ - "fs:scope-resource" - ] - }, - { - "description": "fs:scope-resource-index -> This scope permits to list all files and folders in the `$RESOURCE`folder.", - "type": "string", - "enum": [ - "fs:scope-resource-index" - ] - }, - { - "description": "fs:scope-resource-recursive -> This scope recursive access to the complete `$RESOURCE` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-resource-recursive" - ] - }, - { - "description": "fs:scope-runtime -> This scope permits access to all files and list content of top level directories in the `$RUNTIME`folder.", - "type": "string", - "enum": [ - "fs:scope-runtime" - ] - }, - { - "description": "fs:scope-runtime-index -> This scope permits to list all files and folders in the `$RUNTIME`folder.", - "type": "string", - "enum": [ - "fs:scope-runtime-index" - ] - }, - { - "description": "fs:scope-runtime-recursive -> This scope recursive access to the complete `$RUNTIME` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-runtime-recursive" - ] - }, - { - "description": "fs:scope-temp -> This scope permits access to all files and list content of top level directories in the `$TEMP`folder.", - "type": "string", - "enum": [ - "fs:scope-temp" - ] - }, - { - "description": "fs:scope-temp-index -> This scope permits to list all files and folders in the `$TEMP`folder.", - "type": "string", - "enum": [ - "fs:scope-temp-index" - ] - }, - { - "description": "fs:scope-temp-recursive -> This scope recursive access to the complete `$TEMP` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-temp-recursive" - ] - }, - { - "description": "fs:scope-template -> This scope permits access to all files and list content of top level directories in the `$TEMPLATE`folder.", - "type": "string", - "enum": [ - "fs:scope-template" - ] - }, - { - "description": "fs:scope-template-index -> This scope permits to list all files and folders in the `$TEMPLATE`folder.", - "type": "string", - "enum": [ - "fs:scope-template-index" - ] - }, - { - "description": "fs:scope-template-recursive -> This scope recursive access to the complete `$TEMPLATE` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-template-recursive" - ] - }, - { - "description": "fs:scope-video -> This scope permits access to all files and list content of top level directories in the `$VIDEO`folder.", - "type": "string", - "enum": [ - "fs:scope-video" - ] - }, - { - "description": "fs:scope-video-index -> This scope permits to list all files and folders in the `$VIDEO`folder.", - "type": "string", - "enum": [ - "fs:scope-video-index" - ] - }, - { - "description": "fs:scope-video-recursive -> This scope recursive access to the complete `$VIDEO` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-video-recursive" - ] - }, - { - "description": "fs:write-all -> This enables all write related commands without any pre-configured accessible paths.", - "type": "string", - "enum": [ - "fs:write-all" - ] - }, - { - "description": "fs:write-files -> This enables all file write related commands without any pre-configured accessible paths.", - "type": "string", - "enum": [ - "fs:write-files" - ] - } - ] - }, - "allow": { - "items": { - "title": "Entry", - "type": "object", - "required": [ - "path" - ], - "properties": { - "path": { - "type": "string" - } - } - } - }, - "deny": { - "items": { - "title": "Entry", - "type": "object", - "required": [ - "path" - ], - "properties": { - "path": { - "type": "string" - } - } - } - } - } - }, - { - "type": "object", - "required": [ - "identifier" - ], - "properties": { - "identifier": { - "oneOf": [ - { - "description": "http:default -> Allows all fetch operations", - "type": "string", - "enum": [ - "http:default" - ] - }, - { - "description": "http:allow-fetch -> Enables the fetch command without any pre-configured scope.", - "type": "string", - "enum": [ - "http:allow-fetch" - ] - }, - { - "description": "http:allow-fetch-cancel -> Enables the fetch_cancel command without any pre-configured scope.", - "type": "string", - "enum": [ - "http:allow-fetch-cancel" - ] - }, - { - "description": "http:allow-fetch-read-body -> Enables the fetch_read_body command without any pre-configured scope.", - "type": "string", - "enum": [ - "http:allow-fetch-read-body" - ] - }, - { - "description": "http:allow-fetch-send -> Enables the fetch_send command without any pre-configured scope.", - "type": "string", - "enum": [ - "http:allow-fetch-send" - ] - }, - { - "description": "http:deny-fetch -> Denies the fetch command without any pre-configured scope.", - "type": "string", - "enum": [ - "http:deny-fetch" - ] - }, - { - "description": "http:deny-fetch-cancel -> Denies the fetch_cancel command without any pre-configured scope.", - "type": "string", - "enum": [ - "http:deny-fetch-cancel" - ] - }, - { - "description": "http:deny-fetch-read-body -> Denies the fetch_read_body command without any pre-configured scope.", - "type": "string", - "enum": [ - "http:deny-fetch-read-body" - ] - }, - { - "description": "http:deny-fetch-send -> Denies the fetch_send command without any pre-configured scope.", - "type": "string", - "enum": [ - "http:deny-fetch-send" - ] - } - ] - }, - "allow": { - "items": { - "title": "ScopeEntry", - "description": "HTTP scope entry object definition.", - "type": "object", - "required": [ - "url" - ], - "properties": { - "url": { - "description": "A URL that can be accessed by the webview when using the HTTP APIs. The scoped URL is matched against the request URL using a glob pattern.\n\nExamples:\n\n- \"https://*\" or \"https://**\" : allows all HTTPS urls\n\n- \"https://*.github.com/tauri-apps/tauri\": allows any subdomain of \"github.com\" with the \"tauri-apps/api\" path\n\n- \"https://myapi.service.com/users/*\": allows access to any URLs that begins with \"https://myapi.service.com/users/\"", - "type": "string" - } - } - } - }, - "deny": { - "items": { - "title": "ScopeEntry", - "description": "HTTP scope entry object definition.", - "type": "object", - "required": [ - "url" - ], - "properties": { - "url": { - "description": "A URL that can be accessed by the webview when using the HTTP APIs. The scoped URL is matched against the request URL using a glob pattern.\n\nExamples:\n\n- \"https://*\" or \"https://**\" : allows all HTTPS urls\n\n- \"https://*.github.com/tauri-apps/tauri\": allows any subdomain of \"github.com\" with the \"tauri-apps/api\" path\n\n- \"https://myapi.service.com/users/*\": allows access to any URLs that begins with \"https://myapi.service.com/users/\"", - "type": "string" - } - } - } - } - } - }, - { - "type": "object", - "required": [ - "identifier" - ], - "properties": { - "identifier": { - "oneOf": [ - { - "description": "shell:allow-execute -> Enables the execute command without any pre-configured scope.", - "type": "string", - "enum": [ - "shell:allow-execute" - ] - }, - { - "description": "shell:allow-kill -> Enables the kill command without any pre-configured scope.", - "type": "string", - "enum": [ - "shell:allow-kill" - ] - }, - { - "description": "shell:allow-open -> Enables the open command without any pre-configured scope.", - "type": "string", - "enum": [ - "shell:allow-open" - ] - }, - { - "description": "shell:allow-stdin-write -> Enables the stdin_write command without any pre-configured scope.", - "type": "string", - "enum": [ - "shell:allow-stdin-write" - ] - }, - { - "description": "shell:deny-execute -> Denies the execute command without any pre-configured scope.", - "type": "string", - "enum": [ - "shell:deny-execute" - ] - }, - { - "description": "shell:deny-kill -> Denies the kill command without any pre-configured scope.", - "type": "string", - "enum": [ - "shell:deny-kill" - ] - }, - { - "description": "shell:deny-open -> Denies the open command without any pre-configured scope.", - "type": "string", - "enum": [ - "shell:deny-open" - ] - }, - { - "description": "shell:deny-stdin-write -> Denies the stdin_write command without any pre-configured scope.", - "type": "string", - "enum": [ - "shell:deny-stdin-write" - ] - } - ] - }, - "allow": { - "items": { - "title": "Entry", - "description": "A command allowed to be executed by the webview API.", - "type": "object", - "required": [ - "args", - "command", - "name", - "sidecar" - ], - "properties": { - "args": { - "description": "The allowed arguments for the command execution.", - "allOf": [ - { - "$ref": "#/definitions/ShellAllowedArgs" - } - ] - }, - "command": { - "description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.", - "type": "string" - }, - "name": { - "description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.", - "type": "string" - }, - "sidecar": { - "description": "If this command is a sidecar command.", - "type": "boolean" - } - } - } - }, - "deny": { - "items": { - "title": "Entry", - "description": "A command allowed to be executed by the webview API.", - "type": "object", - "required": [ - "args", - "command", - "name", - "sidecar" - ], - "properties": { - "args": { - "description": "The allowed arguments for the command execution.", - "allOf": [ - { - "$ref": "#/definitions/ShellAllowedArgs" - } - ] - }, - "command": { - "description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.", - "type": "string" - }, - "name": { - "description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.", - "type": "string" - }, - "sidecar": { - "description": "If this command is a sidecar command.", - "type": "boolean" - } - } - } - } - } - } - ] - } - ] - }, - "Identifier": { - "oneOf": [ - { - "description": "app:default -> Default permissions for the plugin.", - "type": "string", - "enum": [ - "app:default" - ] - }, - { - "description": "app:allow-app-hide -> Enables the app_hide command without any pre-configured scope.", - "type": "string", - "enum": [ - "app:allow-app-hide" - ] - }, - { - "description": "app:allow-app-show -> Enables the app_show command without any pre-configured scope.", - "type": "string", - "enum": [ - "app:allow-app-show" - ] - }, - { - "description": "app:allow-name -> Enables the name command without any pre-configured scope.", - "type": "string", - "enum": [ - "app:allow-name" - ] - }, - { - "description": "app:allow-tauri-version -> Enables the tauri_version command without any pre-configured scope.", - "type": "string", - "enum": [ - "app:allow-tauri-version" - ] - }, - { - "description": "app:allow-version -> Enables the version command without any pre-configured scope.", - "type": "string", - "enum": [ - "app:allow-version" - ] - }, - { - "description": "app:deny-app-hide -> Denies the app_hide command without any pre-configured scope.", - "type": "string", - "enum": [ - "app:deny-app-hide" - ] - }, - { - "description": "app:deny-app-show -> Denies the app_show command without any pre-configured scope.", - "type": "string", - "enum": [ - "app:deny-app-show" - ] - }, - { - "description": "app:deny-name -> Denies the name command without any pre-configured scope.", - "type": "string", - "enum": [ - "app:deny-name" - ] - }, - { - "description": "app:deny-tauri-version -> Denies the tauri_version command without any pre-configured scope.", - "type": "string", - "enum": [ - "app:deny-tauri-version" - ] - }, - { - "description": "app:deny-version -> Denies the version command without any pre-configured scope.", - "type": "string", - "enum": [ - "app:deny-version" - ] - }, - { - "description": "barcode-scanner:allow-cancel -> Enables the cancel command without any pre-configured scope.", - "type": "string", - "enum": [ - "barcode-scanner:allow-cancel" - ] - }, - { - "description": "barcode-scanner:allow-check-permissions -> Enables the check_permissions command without any pre-configured scope.", - "type": "string", - "enum": [ - "barcode-scanner:allow-check-permissions" - ] - }, - { - "description": "barcode-scanner:allow-open-app-settings -> Enables the open_app_settings command without any pre-configured scope.", - "type": "string", - "enum": [ - "barcode-scanner:allow-open-app-settings" - ] - }, - { - "description": "barcode-scanner:allow-request-permissions -> Enables the request_permissions command without any pre-configured scope.", - "type": "string", - "enum": [ - "barcode-scanner:allow-request-permissions" - ] - }, - { - "description": "barcode-scanner:allow-scan -> Enables the scan command without any pre-configured scope.", - "type": "string", - "enum": [ - "barcode-scanner:allow-scan" - ] - }, - { - "description": "barcode-scanner:allow-vibrate -> Enables the vibrate command without any pre-configured scope.", - "type": "string", - "enum": [ - "barcode-scanner:allow-vibrate" - ] - }, - { - "description": "barcode-scanner:deny-cancel -> Denies the cancel command without any pre-configured scope.", - "type": "string", - "enum": [ - "barcode-scanner:deny-cancel" - ] - }, - { - "description": "barcode-scanner:deny-check-permissions -> Denies the check_permissions command without any pre-configured scope.", - "type": "string", - "enum": [ - "barcode-scanner:deny-check-permissions" - ] - }, - { - "description": "barcode-scanner:deny-open-app-settings -> Denies the open_app_settings command without any pre-configured scope.", - "type": "string", - "enum": [ - "barcode-scanner:deny-open-app-settings" - ] - }, - { - "description": "barcode-scanner:deny-request-permissions -> Denies the request_permissions command without any pre-configured scope.", - "type": "string", - "enum": [ - "barcode-scanner:deny-request-permissions" - ] - }, - { - "description": "barcode-scanner:deny-scan -> Denies the scan command without any pre-configured scope.", - "type": "string", - "enum": [ - "barcode-scanner:deny-scan" - ] - }, - { - "description": "barcode-scanner:deny-vibrate -> Denies the vibrate command without any pre-configured scope.", - "type": "string", - "enum": [ - "barcode-scanner:deny-vibrate" - ] - }, - { - "description": "biometric:allow-authenticate -> Enables the authenticate command without any pre-configured scope.", - "type": "string", - "enum": [ - "biometric:allow-authenticate" - ] - }, - { - "description": "biometric:allow-status -> Enables the status command without any pre-configured scope.", - "type": "string", - "enum": [ - "biometric:allow-status" - ] - }, - { - "description": "biometric:deny-authenticate -> Denies the authenticate command without any pre-configured scope.", - "type": "string", - "enum": [ - "biometric:deny-authenticate" - ] - }, - { - "description": "biometric:deny-status -> Denies the status command without any pre-configured scope.", - "type": "string", - "enum": [ - "biometric:deny-status" - ] - }, - { - "description": "clipboard-manager:allow-read -> Enables the read command without any pre-configured scope.", - "type": "string", - "enum": [ - "clipboard-manager:allow-read" - ] - }, - { - "description": "clipboard-manager:allow-write -> Enables the write command without any pre-configured scope.", - "type": "string", - "enum": [ - "clipboard-manager:allow-write" - ] - }, - { - "description": "clipboard-manager:deny-read -> Denies the read command without any pre-configured scope.", - "type": "string", - "enum": [ - "clipboard-manager:deny-read" - ] - }, - { - "description": "clipboard-manager:deny-write -> Denies the write command without any pre-configured scope.", - "type": "string", - "enum": [ - "clipboard-manager:deny-write" - ] - }, - { - "description": "dialog:allow-ask -> Enables the ask command without any pre-configured scope.", - "type": "string", - "enum": [ - "dialog:allow-ask" - ] - }, - { - "description": "dialog:allow-confirm -> Enables the confirm command without any pre-configured scope.", - "type": "string", - "enum": [ - "dialog:allow-confirm" - ] - }, - { - "description": "dialog:allow-message -> Enables the message command without any pre-configured scope.", - "type": "string", - "enum": [ - "dialog:allow-message" - ] - }, - { - "description": "dialog:allow-open -> Enables the open command without any pre-configured scope.", - "type": "string", - "enum": [ - "dialog:allow-open" - ] - }, - { - "description": "dialog:allow-save -> Enables the save command without any pre-configured scope.", - "type": "string", - "enum": [ - "dialog:allow-save" - ] - }, - { - "description": "dialog:deny-ask -> Denies the ask command without any pre-configured scope.", - "type": "string", - "enum": [ - "dialog:deny-ask" - ] - }, - { - "description": "dialog:deny-confirm -> Denies the confirm command without any pre-configured scope.", - "type": "string", - "enum": [ - "dialog:deny-confirm" - ] - }, - { - "description": "dialog:deny-message -> Denies the message command without any pre-configured scope.", - "type": "string", - "enum": [ - "dialog:deny-message" - ] - }, - { - "description": "dialog:deny-open -> Denies the open command without any pre-configured scope.", - "type": "string", - "enum": [ - "dialog:deny-open" - ] - }, - { - "description": "dialog:deny-save -> Denies the save command without any pre-configured scope.", - "type": "string", - "enum": [ - "dialog:deny-save" - ] - }, - { - "description": "event:default -> Default permissions for the plugin.", - "type": "string", - "enum": [ - "event:default" - ] - }, - { - "description": "event:allow-emit -> Enables the emit command without any pre-configured scope.", - "type": "string", - "enum": [ - "event:allow-emit" - ] - }, - { - "description": "event:allow-emit-to -> Enables the emit_to command without any pre-configured scope.", - "type": "string", - "enum": [ - "event:allow-emit-to" - ] - }, - { - "description": "event:allow-listen -> Enables the listen command without any pre-configured scope.", - "type": "string", - "enum": [ - "event:allow-listen" - ] - }, - { - "description": "event:allow-unlisten -> Enables the unlisten command without any pre-configured scope.", - "type": "string", - "enum": [ - "event:allow-unlisten" - ] - }, - { - "description": "event:deny-emit -> Denies the emit command without any pre-configured scope.", - "type": "string", - "enum": [ - "event:deny-emit" - ] - }, - { - "description": "event:deny-emit-to -> Denies the emit_to command without any pre-configured scope.", - "type": "string", - "enum": [ - "event:deny-emit-to" - ] - }, - { - "description": "event:deny-listen -> Denies the listen command without any pre-configured scope.", - "type": "string", - "enum": [ - "event:deny-listen" - ] - }, - { - "description": "event:deny-unlisten -> Denies the unlisten command without any pre-configured scope.", - "type": "string", - "enum": [ - "event:deny-unlisten" - ] - }, - { - "description": "fs:allow-app-meta -> This allows read access to metadata of the `$APP` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-app-meta" - ] - }, - { - "description": "fs:allow-app-meta-recursive -> This allows read access to metadata of the `$APP` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-app-meta-recursive" - ] - }, - { - "description": "fs:allow-app-read -> This allows non-recursive read access to the `$APP` folder.", - "type": "string", - "enum": [ - "fs:allow-app-read" - ] - }, - { - "description": "fs:allow-app-read-recursive -> This allows full recursive read access to the complete `$APP` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-app-read-recursive" - ] - }, - { - "description": "fs:allow-app-write -> This allows non-recursive write access to the `$APP` folder.", - "type": "string", - "enum": [ - "fs:allow-app-write" - ] - }, - { - "description": "fs:allow-app-write-recursive -> This allows full recusrive write access to the complete `$APP` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-app-write-recursive" - ] - }, - { - "description": "fs:allow-appcache-meta -> This allows read access to metadata of the `$APPCACHE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-appcache-meta" - ] - }, - { - "description": "fs:allow-appcache-meta-recursive -> This allows read access to metadata of the `$APPCACHE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-appcache-meta-recursive" - ] - }, - { - "description": "fs:allow-appcache-read -> This allows non-recursive read access to the `$APPCACHE` folder.", - "type": "string", - "enum": [ - "fs:allow-appcache-read" - ] - }, - { - "description": "fs:allow-appcache-read-recursive -> This allows full recursive read access to the complete `$APPCACHE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-appcache-read-recursive" - ] - }, - { - "description": "fs:allow-appcache-write -> This allows non-recursive write access to the `$APPCACHE` folder.", - "type": "string", - "enum": [ - "fs:allow-appcache-write" - ] - }, - { - "description": "fs:allow-appcache-write-recursive -> This allows full recusrive write access to the complete `$APPCACHE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-appcache-write-recursive" - ] - }, - { - "description": "fs:allow-appconfig-meta -> This allows read access to metadata of the `$APPCONFIG` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-appconfig-meta" - ] - }, - { - "description": "fs:allow-appconfig-meta-recursive -> This allows read access to metadata of the `$APPCONFIG` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-appconfig-meta-recursive" - ] - }, - { - "description": "fs:allow-appconfig-read -> This allows non-recursive read access to the `$APPCONFIG` folder.", - "type": "string", - "enum": [ - "fs:allow-appconfig-read" - ] - }, - { - "description": "fs:allow-appconfig-read-recursive -> This allows full recursive read access to the complete `$APPCONFIG` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-appconfig-read-recursive" - ] - }, - { - "description": "fs:allow-appconfig-write -> This allows non-recursive write access to the `$APPCONFIG` folder.", - "type": "string", - "enum": [ - "fs:allow-appconfig-write" - ] - }, - { - "description": "fs:allow-appconfig-write-recursive -> This allows full recusrive write access to the complete `$APPCONFIG` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-appconfig-write-recursive" - ] - }, - { - "description": "fs:allow-appdata-meta -> This allows read access to metadata of the `$APPDATA` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-appdata-meta" - ] - }, - { - "description": "fs:allow-appdata-meta-recursive -> This allows read access to metadata of the `$APPDATA` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-appdata-meta-recursive" - ] - }, - { - "description": "fs:allow-appdata-read -> This allows non-recursive read access to the `$APPDATA` folder.", - "type": "string", - "enum": [ - "fs:allow-appdata-read" - ] - }, - { - "description": "fs:allow-appdata-read-recursive -> This allows full recursive read access to the complete `$APPDATA` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-appdata-read-recursive" - ] - }, - { - "description": "fs:allow-appdata-write -> This allows non-recursive write access to the `$APPDATA` folder.", - "type": "string", - "enum": [ - "fs:allow-appdata-write" - ] - }, - { - "description": "fs:allow-appdata-write-recursive -> This allows full recusrive write access to the complete `$APPDATA` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-appdata-write-recursive" - ] - }, - { - "description": "fs:allow-applocaldata-meta -> This allows read access to metadata of the `$APPLOCALDATA` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-applocaldata-meta" - ] - }, - { - "description": "fs:allow-applocaldata-meta-recursive -> This allows read access to metadata of the `$APPLOCALDATA` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-applocaldata-meta-recursive" - ] - }, - { - "description": "fs:allow-applocaldata-read -> This allows non-recursive read access to the `$APPLOCALDATA` folder.", - "type": "string", - "enum": [ - "fs:allow-applocaldata-read" - ] - }, - { - "description": "fs:allow-applocaldata-read-recursive -> This allows full recursive read access to the complete `$APPLOCALDATA` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-applocaldata-read-recursive" - ] - }, - { - "description": "fs:allow-applocaldata-write -> This allows non-recursive write access to the `$APPLOCALDATA` folder.", - "type": "string", - "enum": [ - "fs:allow-applocaldata-write" - ] - }, - { - "description": "fs:allow-applocaldata-write-recursive -> This allows full recusrive write access to the complete `$APPLOCALDATA` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-applocaldata-write-recursive" - ] - }, - { - "description": "fs:allow-applog-meta -> This allows read access to metadata of the `$APPLOG` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-applog-meta" - ] - }, - { - "description": "fs:allow-applog-meta-recursive -> This allows read access to metadata of the `$APPLOG` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-applog-meta-recursive" - ] - }, - { - "description": "fs:allow-applog-read -> This allows non-recursive read access to the `$APPLOG` folder.", - "type": "string", - "enum": [ - "fs:allow-applog-read" - ] - }, - { - "description": "fs:allow-applog-read-recursive -> This allows full recursive read access to the complete `$APPLOG` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-applog-read-recursive" - ] - }, - { - "description": "fs:allow-applog-write -> This allows non-recursive write access to the `$APPLOG` folder.", - "type": "string", - "enum": [ - "fs:allow-applog-write" - ] - }, - { - "description": "fs:allow-applog-write-recursive -> This allows full recusrive write access to the complete `$APPLOG` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-applog-write-recursive" - ] - }, - { - "description": "fs:allow-audio-meta -> This allows read access to metadata of the `$AUDIO` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-audio-meta" - ] - }, - { - "description": "fs:allow-audio-meta-recursive -> This allows read access to metadata of the `$AUDIO` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-audio-meta-recursive" - ] - }, - { - "description": "fs:allow-audio-read -> This allows non-recursive read access to the `$AUDIO` folder.", - "type": "string", - "enum": [ - "fs:allow-audio-read" - ] - }, - { - "description": "fs:allow-audio-read-recursive -> This allows full recursive read access to the complete `$AUDIO` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-audio-read-recursive" - ] - }, - { - "description": "fs:allow-audio-write -> This allows non-recursive write access to the `$AUDIO` folder.", - "type": "string", - "enum": [ - "fs:allow-audio-write" - ] - }, - { - "description": "fs:allow-audio-write-recursive -> This allows full recusrive write access to the complete `$AUDIO` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-audio-write-recursive" - ] - }, - { - "description": "fs:allow-cache-meta -> This allows read access to metadata of the `$CACHE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-cache-meta" - ] - }, - { - "description": "fs:allow-cache-meta-recursive -> This allows read access to metadata of the `$CACHE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-cache-meta-recursive" - ] - }, - { - "description": "fs:allow-cache-read -> This allows non-recursive read access to the `$CACHE` folder.", - "type": "string", - "enum": [ - "fs:allow-cache-read" - ] - }, - { - "description": "fs:allow-cache-read-recursive -> This allows full recursive read access to the complete `$CACHE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-cache-read-recursive" - ] - }, - { - "description": "fs:allow-cache-write -> This allows non-recursive write access to the `$CACHE` folder.", - "type": "string", - "enum": [ - "fs:allow-cache-write" - ] - }, - { - "description": "fs:allow-cache-write-recursive -> This allows full recusrive write access to the complete `$CACHE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-cache-write-recursive" - ] - }, - { - "description": "fs:allow-config-meta -> This allows read access to metadata of the `$CONFIG` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-config-meta" - ] - }, - { - "description": "fs:allow-config-meta-recursive -> This allows read access to metadata of the `$CONFIG` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-config-meta-recursive" - ] - }, - { - "description": "fs:allow-config-read -> This allows non-recursive read access to the `$CONFIG` folder.", - "type": "string", - "enum": [ - "fs:allow-config-read" - ] - }, - { - "description": "fs:allow-config-read-recursive -> This allows full recursive read access to the complete `$CONFIG` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-config-read-recursive" - ] - }, - { - "description": "fs:allow-config-write -> This allows non-recursive write access to the `$CONFIG` folder.", - "type": "string", - "enum": [ - "fs:allow-config-write" - ] - }, - { - "description": "fs:allow-config-write-recursive -> This allows full recusrive write access to the complete `$CONFIG` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-config-write-recursive" - ] - }, - { - "description": "fs:allow-data-meta -> This allows read access to metadata of the `$DATA` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-data-meta" - ] - }, - { - "description": "fs:allow-data-meta-recursive -> This allows read access to metadata of the `$DATA` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-data-meta-recursive" - ] - }, - { - "description": "fs:allow-data-read -> This allows non-recursive read access to the `$DATA` folder.", - "type": "string", - "enum": [ - "fs:allow-data-read" - ] - }, - { - "description": "fs:allow-data-read-recursive -> This allows full recursive read access to the complete `$DATA` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-data-read-recursive" - ] - }, - { - "description": "fs:allow-data-write -> This allows non-recursive write access to the `$DATA` folder.", - "type": "string", - "enum": [ - "fs:allow-data-write" - ] - }, - { - "description": "fs:allow-data-write-recursive -> This allows full recusrive write access to the complete `$DATA` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-data-write-recursive" - ] - }, - { - "description": "fs:allow-desktop-meta -> This allows read access to metadata of the `$DESKTOP` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-desktop-meta" - ] - }, - { - "description": "fs:allow-desktop-meta-recursive -> This allows read access to metadata of the `$DESKTOP` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-desktop-meta-recursive" - ] - }, - { - "description": "fs:allow-desktop-read -> This allows non-recursive read access to the `$DESKTOP` folder.", - "type": "string", - "enum": [ - "fs:allow-desktop-read" - ] - }, - { - "description": "fs:allow-desktop-read-recursive -> This allows full recursive read access to the complete `$DESKTOP` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-desktop-read-recursive" - ] - }, - { - "description": "fs:allow-desktop-write -> This allows non-recursive write access to the `$DESKTOP` folder.", - "type": "string", - "enum": [ - "fs:allow-desktop-write" - ] - }, - { - "description": "fs:allow-desktop-write-recursive -> This allows full recusrive write access to the complete `$DESKTOP` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-desktop-write-recursive" - ] - }, - { - "description": "fs:allow-document-meta -> This allows read access to metadata of the `$DOCUMENT` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-document-meta" - ] - }, - { - "description": "fs:allow-document-meta-recursive -> This allows read access to metadata of the `$DOCUMENT` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-document-meta-recursive" - ] - }, - { - "description": "fs:allow-document-read -> This allows non-recursive read access to the `$DOCUMENT` folder.", - "type": "string", - "enum": [ - "fs:allow-document-read" - ] - }, - { - "description": "fs:allow-document-read-recursive -> This allows full recursive read access to the complete `$DOCUMENT` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-document-read-recursive" - ] - }, - { - "description": "fs:allow-document-write -> This allows non-recursive write access to the `$DOCUMENT` folder.", - "type": "string", - "enum": [ - "fs:allow-document-write" - ] - }, - { - "description": "fs:allow-document-write-recursive -> This allows full recusrive write access to the complete `$DOCUMENT` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-document-write-recursive" - ] - }, - { - "description": "fs:allow-download-meta -> This allows read access to metadata of the `$DOWNLOAD` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-download-meta" - ] - }, - { - "description": "fs:allow-download-meta-recursive -> This allows read access to metadata of the `$DOWNLOAD` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-download-meta-recursive" - ] - }, - { - "description": "fs:allow-download-read -> This allows non-recursive read access to the `$DOWNLOAD` folder.", - "type": "string", - "enum": [ - "fs:allow-download-read" - ] - }, - { - "description": "fs:allow-download-read-recursive -> This allows full recursive read access to the complete `$DOWNLOAD` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-download-read-recursive" - ] - }, - { - "description": "fs:allow-download-write -> This allows non-recursive write access to the `$DOWNLOAD` folder.", - "type": "string", - "enum": [ - "fs:allow-download-write" - ] - }, - { - "description": "fs:allow-download-write-recursive -> This allows full recusrive write access to the complete `$DOWNLOAD` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-download-write-recursive" - ] - }, - { - "description": "fs:allow-exe-meta -> This allows read access to metadata of the `$EXE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-exe-meta" - ] - }, - { - "description": "fs:allow-exe-meta-recursive -> This allows read access to metadata of the `$EXE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-exe-meta-recursive" - ] - }, - { - "description": "fs:allow-exe-read -> This allows non-recursive read access to the `$EXE` folder.", - "type": "string", - "enum": [ - "fs:allow-exe-read" - ] - }, - { - "description": "fs:allow-exe-read-recursive -> This allows full recursive read access to the complete `$EXE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-exe-read-recursive" - ] - }, - { - "description": "fs:allow-exe-write -> This allows non-recursive write access to the `$EXE` folder.", - "type": "string", - "enum": [ - "fs:allow-exe-write" - ] - }, - { - "description": "fs:allow-exe-write-recursive -> This allows full recusrive write access to the complete `$EXE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-exe-write-recursive" - ] - }, - { - "description": "fs:allow-font-meta -> This allows read access to metadata of the `$FONT` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-font-meta" - ] - }, - { - "description": "fs:allow-font-meta-recursive -> This allows read access to metadata of the `$FONT` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-font-meta-recursive" - ] - }, - { - "description": "fs:allow-font-read -> This allows non-recursive read access to the `$FONT` folder.", - "type": "string", - "enum": [ - "fs:allow-font-read" - ] - }, - { - "description": "fs:allow-font-read-recursive -> This allows full recursive read access to the complete `$FONT` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-font-read-recursive" - ] - }, - { - "description": "fs:allow-font-write -> This allows non-recursive write access to the `$FONT` folder.", - "type": "string", - "enum": [ - "fs:allow-font-write" - ] - }, - { - "description": "fs:allow-font-write-recursive -> This allows full recusrive write access to the complete `$FONT` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-font-write-recursive" - ] - }, - { - "description": "fs:allow-home-meta -> This allows read access to metadata of the `$HOME` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-home-meta" - ] - }, - { - "description": "fs:allow-home-meta-recursive -> This allows read access to metadata of the `$HOME` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-home-meta-recursive" - ] - }, - { - "description": "fs:allow-home-read -> This allows non-recursive read access to the `$HOME` folder.", - "type": "string", - "enum": [ - "fs:allow-home-read" - ] - }, - { - "description": "fs:allow-home-read-recursive -> This allows full recursive read access to the complete `$HOME` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-home-read-recursive" - ] - }, - { - "description": "fs:allow-home-write -> This allows non-recursive write access to the `$HOME` folder.", - "type": "string", - "enum": [ - "fs:allow-home-write" - ] - }, - { - "description": "fs:allow-home-write-recursive -> This allows full recusrive write access to the complete `$HOME` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-home-write-recursive" - ] - }, - { - "description": "fs:allow-localdata-meta -> This allows read access to metadata of the `$LOCALDATA` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-localdata-meta" - ] - }, - { - "description": "fs:allow-localdata-meta-recursive -> This allows read access to metadata of the `$LOCALDATA` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-localdata-meta-recursive" - ] - }, - { - "description": "fs:allow-localdata-read -> This allows non-recursive read access to the `$LOCALDATA` folder.", - "type": "string", - "enum": [ - "fs:allow-localdata-read" - ] - }, - { - "description": "fs:allow-localdata-read-recursive -> This allows full recursive read access to the complete `$LOCALDATA` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-localdata-read-recursive" - ] - }, - { - "description": "fs:allow-localdata-write -> This allows non-recursive write access to the `$LOCALDATA` folder.", - "type": "string", - "enum": [ - "fs:allow-localdata-write" - ] - }, - { - "description": "fs:allow-localdata-write-recursive -> This allows full recusrive write access to the complete `$LOCALDATA` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-localdata-write-recursive" - ] - }, - { - "description": "fs:allow-log-meta -> This allows read access to metadata of the `$LOG` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-log-meta" - ] - }, - { - "description": "fs:allow-log-meta-recursive -> This allows read access to metadata of the `$LOG` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-log-meta-recursive" - ] - }, - { - "description": "fs:allow-log-read -> This allows non-recursive read access to the `$LOG` folder.", - "type": "string", - "enum": [ - "fs:allow-log-read" - ] - }, - { - "description": "fs:allow-log-read-recursive -> This allows full recursive read access to the complete `$LOG` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-log-read-recursive" - ] - }, - { - "description": "fs:allow-log-write -> This allows non-recursive write access to the `$LOG` folder.", - "type": "string", - "enum": [ - "fs:allow-log-write" - ] - }, - { - "description": "fs:allow-log-write-recursive -> This allows full recusrive write access to the complete `$LOG` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-log-write-recursive" - ] - }, - { - "description": "fs:allow-picture-meta -> This allows read access to metadata of the `$PICTURE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-picture-meta" - ] - }, - { - "description": "fs:allow-picture-meta-recursive -> This allows read access to metadata of the `$PICTURE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-picture-meta-recursive" - ] - }, - { - "description": "fs:allow-picture-read -> This allows non-recursive read access to the `$PICTURE` folder.", - "type": "string", - "enum": [ - "fs:allow-picture-read" - ] - }, - { - "description": "fs:allow-picture-read-recursive -> This allows full recursive read access to the complete `$PICTURE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-picture-read-recursive" - ] - }, - { - "description": "fs:allow-picture-write -> This allows non-recursive write access to the `$PICTURE` folder.", - "type": "string", - "enum": [ - "fs:allow-picture-write" - ] - }, - { - "description": "fs:allow-picture-write-recursive -> This allows full recusrive write access to the complete `$PICTURE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-picture-write-recursive" - ] - }, - { - "description": "fs:allow-public-meta -> This allows read access to metadata of the `$PUBLIC` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-public-meta" - ] - }, - { - "description": "fs:allow-public-meta-recursive -> This allows read access to metadata of the `$PUBLIC` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-public-meta-recursive" - ] - }, - { - "description": "fs:allow-public-read -> This allows non-recursive read access to the `$PUBLIC` folder.", - "type": "string", - "enum": [ - "fs:allow-public-read" - ] - }, - { - "description": "fs:allow-public-read-recursive -> This allows full recursive read access to the complete `$PUBLIC` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-public-read-recursive" - ] - }, - { - "description": "fs:allow-public-write -> This allows non-recursive write access to the `$PUBLIC` folder.", - "type": "string", - "enum": [ - "fs:allow-public-write" - ] - }, - { - "description": "fs:allow-public-write-recursive -> This allows full recusrive write access to the complete `$PUBLIC` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-public-write-recursive" - ] - }, - { - "description": "fs:allow-resource-meta -> This allows read access to metadata of the `$RESOURCE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-resource-meta" - ] - }, - { - "description": "fs:allow-resource-meta-recursive -> This allows read access to metadata of the `$RESOURCE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-resource-meta-recursive" - ] - }, - { - "description": "fs:allow-resource-read -> This allows non-recursive read access to the `$RESOURCE` folder.", - "type": "string", - "enum": [ - "fs:allow-resource-read" - ] - }, - { - "description": "fs:allow-resource-read-recursive -> This allows full recursive read access to the complete `$RESOURCE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-resource-read-recursive" - ] - }, - { - "description": "fs:allow-resource-write -> This allows non-recursive write access to the `$RESOURCE` folder.", - "type": "string", - "enum": [ - "fs:allow-resource-write" - ] - }, - { - "description": "fs:allow-resource-write-recursive -> This allows full recusrive write access to the complete `$RESOURCE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-resource-write-recursive" - ] - }, - { - "description": "fs:allow-runtime-meta -> This allows read access to metadata of the `$RUNTIME` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-runtime-meta" - ] - }, - { - "description": "fs:allow-runtime-meta-recursive -> This allows read access to metadata of the `$RUNTIME` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-runtime-meta-recursive" - ] - }, - { - "description": "fs:allow-runtime-read -> This allows non-recursive read access to the `$RUNTIME` folder.", - "type": "string", - "enum": [ - "fs:allow-runtime-read" - ] - }, - { - "description": "fs:allow-runtime-read-recursive -> This allows full recursive read access to the complete `$RUNTIME` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-runtime-read-recursive" - ] - }, - { - "description": "fs:allow-runtime-write -> This allows non-recursive write access to the `$RUNTIME` folder.", - "type": "string", - "enum": [ - "fs:allow-runtime-write" - ] - }, - { - "description": "fs:allow-runtime-write-recursive -> This allows full recusrive write access to the complete `$RUNTIME` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-runtime-write-recursive" - ] - }, - { - "description": "fs:allow-temp-meta -> This allows read access to metadata of the `$TEMP` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-temp-meta" - ] - }, - { - "description": "fs:allow-temp-meta-recursive -> This allows read access to metadata of the `$TEMP` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-temp-meta-recursive" - ] - }, - { - "description": "fs:allow-temp-read -> This allows non-recursive read access to the `$TEMP` folder.", - "type": "string", - "enum": [ - "fs:allow-temp-read" - ] - }, - { - "description": "fs:allow-temp-read-recursive -> This allows full recursive read access to the complete `$TEMP` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-temp-read-recursive" - ] - }, - { - "description": "fs:allow-temp-write -> This allows non-recursive write access to the `$TEMP` folder.", - "type": "string", - "enum": [ - "fs:allow-temp-write" - ] - }, - { - "description": "fs:allow-temp-write-recursive -> This allows full recusrive write access to the complete `$TEMP` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-temp-write-recursive" - ] - }, - { - "description": "fs:allow-template-meta -> This allows read access to metadata of the `$TEMPLATE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-template-meta" - ] - }, - { - "description": "fs:allow-template-meta-recursive -> This allows read access to metadata of the `$TEMPLATE` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-template-meta-recursive" - ] - }, - { - "description": "fs:allow-template-read -> This allows non-recursive read access to the `$TEMPLATE` folder.", - "type": "string", - "enum": [ - "fs:allow-template-read" - ] - }, - { - "description": "fs:allow-template-read-recursive -> This allows full recursive read access to the complete `$TEMPLATE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-template-read-recursive" - ] - }, - { - "description": "fs:allow-template-write -> This allows non-recursive write access to the `$TEMPLATE` folder.", - "type": "string", - "enum": [ - "fs:allow-template-write" - ] - }, - { - "description": "fs:allow-template-write-recursive -> This allows full recusrive write access to the complete `$TEMPLATE` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-template-write-recursive" - ] - }, - { - "description": "fs:allow-video-meta -> This allows read access to metadata of the `$VIDEO` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-video-meta" - ] - }, - { - "description": "fs:allow-video-meta-recursive -> This allows read access to metadata of the `$VIDEO` folder, including file listing and statistics.", - "type": "string", - "enum": [ - "fs:allow-video-meta-recursive" - ] - }, - { - "description": "fs:allow-video-read -> This allows non-recursive read access to the `$VIDEO` folder.", - "type": "string", - "enum": [ - "fs:allow-video-read" - ] - }, - { - "description": "fs:allow-video-read-recursive -> This allows full recursive read access to the complete `$VIDEO` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-video-read-recursive" - ] - }, - { - "description": "fs:allow-video-write -> This allows non-recursive write access to the `$VIDEO` folder.", - "type": "string", - "enum": [ - "fs:allow-video-write" - ] - }, - { - "description": "fs:allow-video-write-recursive -> This allows full recusrive write access to the complete `$VIDEO` folder, files and subdirectories.", - "type": "string", - "enum": [ - "fs:allow-video-write-recursive" - ] - }, - { - "description": "fs:deny-default -> This denies access to dangerous Tauri relevant files and folders by default.", - "type": "string", - "enum": [ - "fs:deny-default" - ] - }, - { - "description": "fs:default -> # Tauri `fs` default permissions\n\nThis configuration file defines the default permissions granted\nto the filesystem.\n\n### Granted Permissions\n\nThis default permission set enables all read-related commands and\nallows access to the `$APP` folder and sub directories created in it.\nThe location of the `$APP` folder depends on the operating system,\nwhere the application is run.\n\nIn general the `$APP` folder needs to be manually created\nby the application at runtime, before accessing files or folders\nin it is possible.\n\n### Denied Permissions\n\nThis default permission set prevents access to critical components\nof the Tauri application by default.\nOn Windows the webview data folder access is denied.\n\n", - "type": "string", - "enum": [ - "fs:default" - ] - }, - { - "description": "fs:allow-copy-file -> Enables the copy_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-copy-file" - ] - }, - { - "description": "fs:allow-create -> Enables the create command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-create" - ] - }, - { - "description": "fs:allow-exists -> Enables the exists command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-exists" - ] - }, - { - "description": "fs:allow-fstat -> Enables the fstat command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-fstat" - ] - }, - { - "description": "fs:allow-ftruncate -> Enables the ftruncate command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-ftruncate" - ] - }, - { - "description": "fs:allow-lstat -> Enables the lstat command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-lstat" - ] - }, - { - "description": "fs:allow-mkdir -> Enables the mkdir command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-mkdir" - ] - }, - { - "description": "fs:allow-open -> Enables the open command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-open" - ] - }, - { - "description": "fs:allow-read -> Enables the read command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-read" - ] - }, - { - "description": "fs:allow-read-dir -> Enables the read_dir command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-read-dir" - ] - }, - { - "description": "fs:allow-read-file -> Enables the read_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-read-file" - ] - }, - { - "description": "fs:allow-read-text-file -> Enables the read_text_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-read-text-file" - ] - }, - { - "description": "fs:allow-read-text-file-lines -> Enables the read_text_file_lines command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-read-text-file-lines" - ] - }, - { - "description": "fs:allow-read-text-file-lines-next -> Enables the read_text_file_lines_next command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-read-text-file-lines-next" - ] - }, - { - "description": "fs:allow-remove -> Enables the remove command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-remove" - ] - }, - { - "description": "fs:allow-rename -> Enables the rename command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-rename" - ] - }, - { - "description": "fs:allow-seek -> Enables the seek command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-seek" - ] - }, - { - "description": "fs:allow-stat -> Enables the stat command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-stat" - ] - }, - { - "description": "fs:allow-truncate -> Enables the truncate command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-truncate" - ] - }, - { - "description": "fs:allow-unwatch -> Enables the unwatch command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-unwatch" - ] - }, - { - "description": "fs:allow-watch -> Enables the watch command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-watch" - ] - }, - { - "description": "fs:allow-write -> Enables the write command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-write" - ] - }, - { - "description": "fs:allow-write-file -> Enables the write_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-write-file" - ] - }, - { - "description": "fs:allow-write-text-file -> Enables the write_text_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:allow-write-text-file" - ] - }, - { - "description": "fs:deny-copy-file -> Denies the copy_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-copy-file" - ] - }, - { - "description": "fs:deny-create -> Denies the create command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-create" - ] - }, - { - "description": "fs:deny-exists -> Denies the exists command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-exists" - ] - }, - { - "description": "fs:deny-fstat -> Denies the fstat command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-fstat" - ] - }, - { - "description": "fs:deny-ftruncate -> Denies the ftruncate command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-ftruncate" - ] - }, - { - "description": "fs:deny-lstat -> Denies the lstat command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-lstat" - ] - }, - { - "description": "fs:deny-mkdir -> Denies the mkdir command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-mkdir" - ] - }, - { - "description": "fs:deny-open -> Denies the open command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-open" - ] - }, - { - "description": "fs:deny-read -> Denies the read command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-read" - ] - }, - { - "description": "fs:deny-read-dir -> Denies the read_dir command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-read-dir" - ] - }, - { - "description": "fs:deny-read-file -> Denies the read_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-read-file" - ] - }, - { - "description": "fs:deny-read-text-file -> Denies the read_text_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-read-text-file" - ] - }, - { - "description": "fs:deny-read-text-file-lines -> Denies the read_text_file_lines command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-read-text-file-lines" - ] - }, - { - "description": "fs:deny-read-text-file-lines-next -> Denies the read_text_file_lines_next command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-read-text-file-lines-next" - ] - }, - { - "description": "fs:deny-remove -> Denies the remove command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-remove" - ] - }, - { - "description": "fs:deny-rename -> Denies the rename command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-rename" - ] - }, - { - "description": "fs:deny-seek -> Denies the seek command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-seek" - ] - }, - { - "description": "fs:deny-stat -> Denies the stat command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-stat" - ] - }, - { - "description": "fs:deny-truncate -> Denies the truncate command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-truncate" - ] - }, - { - "description": "fs:deny-unwatch -> Denies the unwatch command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-unwatch" - ] - }, - { - "description": "fs:deny-watch -> Denies the watch command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-watch" - ] - }, - { - "description": "fs:deny-webview-data-linux -> This denies read access to the\n`$APPLOCALDATA` folder on linux as the webview data and configuration values are stored here.\nAllowing access can lead to sensitive information disclosure and should be well considered.", - "type": "string", - "enum": [ - "fs:deny-webview-data-linux" - ] - }, - { - "description": "fs:deny-webview-data-windows -> This denies read access to the\n`$APPLOCALDATA/EBWebView` folder on windows as the webview data and configuration values are stored here.\nAllowing access can lead to sensitive information disclosure and should be well considered.", - "type": "string", - "enum": [ - "fs:deny-webview-data-windows" - ] - }, - { - "description": "fs:deny-write -> Denies the write command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-write" - ] - }, - { - "description": "fs:deny-write-file -> Denies the write_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-write-file" - ] - }, - { - "description": "fs:deny-write-text-file -> Denies the write_text_file command without any pre-configured scope.", - "type": "string", - "enum": [ - "fs:deny-write-text-file" - ] - }, - { - "description": "fs:read-all -> This enables all read related commands without any pre-configured accessible paths.", - "type": "string", - "enum": [ - "fs:read-all" - ] - }, - { - "description": "fs:read-dirs -> This enables directory read and file metadata related commands without any pre-configured accessible paths.", - "type": "string", - "enum": [ - "fs:read-dirs" - ] - }, - { - "description": "fs:read-files -> This enables file read related commands without any pre-configured accessible paths.", - "type": "string", - "enum": [ - "fs:read-files" - ] - }, - { - "description": "fs:read-meta -> This enables all index or metadata related commands without any pre-configured accessible paths.", - "type": "string", - "enum": [ - "fs:read-meta" - ] - }, - { - "description": "fs:scope -> An empty permission you can use to modify the global scope.", - "type": "string", - "enum": [ - "fs:scope" - ] - }, - { - "description": "fs:scope-app -> This scope permits access to all files and list content of top level directories in the `$APP`folder.", - "type": "string", - "enum": [ - "fs:scope-app" - ] - }, - { - "description": "fs:scope-app-index -> This scope permits to list all files and folders in the `$APP`folder.", - "type": "string", - "enum": [ - "fs:scope-app-index" - ] - }, - { - "description": "fs:scope-app-recursive -> This scope recursive access to the complete `$APP` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-app-recursive" - ] - }, - { - "description": "fs:scope-appcache -> This scope permits access to all files and list content of top level directories in the `$APPCACHE`folder.", - "type": "string", - "enum": [ - "fs:scope-appcache" - ] - }, - { - "description": "fs:scope-appcache-index -> This scope permits to list all files and folders in the `$APPCACHE`folder.", - "type": "string", - "enum": [ - "fs:scope-appcache-index" - ] - }, - { - "description": "fs:scope-appcache-recursive -> This scope recursive access to the complete `$APPCACHE` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-appcache-recursive" - ] - }, - { - "description": "fs:scope-appconfig -> This scope permits access to all files and list content of top level directories in the `$APPCONFIG`folder.", - "type": "string", - "enum": [ - "fs:scope-appconfig" - ] - }, - { - "description": "fs:scope-appconfig-index -> This scope permits to list all files and folders in the `$APPCONFIG`folder.", - "type": "string", - "enum": [ - "fs:scope-appconfig-index" - ] - }, - { - "description": "fs:scope-appconfig-recursive -> This scope recursive access to the complete `$APPCONFIG` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-appconfig-recursive" - ] - }, - { - "description": "fs:scope-appdata -> This scope permits access to all files and list content of top level directories in the `$APPDATA`folder.", - "type": "string", - "enum": [ - "fs:scope-appdata" - ] - }, - { - "description": "fs:scope-appdata-index -> This scope permits to list all files and folders in the `$APPDATA`folder.", - "type": "string", - "enum": [ - "fs:scope-appdata-index" - ] - }, - { - "description": "fs:scope-appdata-recursive -> This scope recursive access to the complete `$APPDATA` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-appdata-recursive" - ] - }, - { - "description": "fs:scope-applocaldata -> This scope permits access to all files and list content of top level directories in the `$APPLOCALDATA`folder.", - "type": "string", - "enum": [ - "fs:scope-applocaldata" - ] - }, - { - "description": "fs:scope-applocaldata-index -> This scope permits to list all files and folders in the `$APPLOCALDATA`folder.", - "type": "string", - "enum": [ - "fs:scope-applocaldata-index" - ] - }, - { - "description": "fs:scope-applocaldata-recursive -> This scope recursive access to the complete `$APPLOCALDATA` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-applocaldata-recursive" - ] - }, - { - "description": "fs:scope-applog -> This scope permits access to all files and list content of top level directories in the `$APPLOG`folder.", - "type": "string", - "enum": [ - "fs:scope-applog" - ] - }, - { - "description": "fs:scope-applog-index -> This scope permits to list all files and folders in the `$APPLOG`folder.", - "type": "string", - "enum": [ - "fs:scope-applog-index" - ] - }, - { - "description": "fs:scope-applog-recursive -> This scope recursive access to the complete `$APPLOG` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-applog-recursive" - ] - }, - { - "description": "fs:scope-audio -> This scope permits access to all files and list content of top level directories in the `$AUDIO`folder.", - "type": "string", - "enum": [ - "fs:scope-audio" - ] - }, - { - "description": "fs:scope-audio-index -> This scope permits to list all files and folders in the `$AUDIO`folder.", - "type": "string", - "enum": [ - "fs:scope-audio-index" - ] - }, - { - "description": "fs:scope-audio-recursive -> This scope recursive access to the complete `$AUDIO` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-audio-recursive" - ] - }, - { - "description": "fs:scope-cache -> This scope permits access to all files and list content of top level directories in the `$CACHE`folder.", - "type": "string", - "enum": [ - "fs:scope-cache" - ] - }, - { - "description": "fs:scope-cache-index -> This scope permits to list all files and folders in the `$CACHE`folder.", - "type": "string", - "enum": [ - "fs:scope-cache-index" - ] - }, - { - "description": "fs:scope-cache-recursive -> This scope recursive access to the complete `$CACHE` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-cache-recursive" - ] - }, - { - "description": "fs:scope-config -> This scope permits access to all files and list content of top level directories in the `$CONFIG`folder.", - "type": "string", - "enum": [ - "fs:scope-config" - ] - }, - { - "description": "fs:scope-config-index -> This scope permits to list all files and folders in the `$CONFIG`folder.", - "type": "string", - "enum": [ - "fs:scope-config-index" - ] - }, - { - "description": "fs:scope-config-recursive -> This scope recursive access to the complete `$CONFIG` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-config-recursive" - ] - }, - { - "description": "fs:scope-data -> This scope permits access to all files and list content of top level directories in the `$DATA`folder.", - "type": "string", - "enum": [ - "fs:scope-data" - ] - }, - { - "description": "fs:scope-data-index -> This scope permits to list all files and folders in the `$DATA`folder.", - "type": "string", - "enum": [ - "fs:scope-data-index" - ] - }, - { - "description": "fs:scope-data-recursive -> This scope recursive access to the complete `$DATA` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-data-recursive" - ] - }, - { - "description": "fs:scope-desktop -> This scope permits access to all files and list content of top level directories in the `$DESKTOP`folder.", - "type": "string", - "enum": [ - "fs:scope-desktop" - ] - }, - { - "description": "fs:scope-desktop-index -> This scope permits to list all files and folders in the `$DESKTOP`folder.", - "type": "string", - "enum": [ - "fs:scope-desktop-index" - ] - }, - { - "description": "fs:scope-desktop-recursive -> This scope recursive access to the complete `$DESKTOP` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-desktop-recursive" - ] - }, - { - "description": "fs:scope-document -> This scope permits access to all files and list content of top level directories in the `$DOCUMENT`folder.", - "type": "string", - "enum": [ - "fs:scope-document" - ] - }, - { - "description": "fs:scope-document-index -> This scope permits to list all files and folders in the `$DOCUMENT`folder.", - "type": "string", - "enum": [ - "fs:scope-document-index" - ] - }, - { - "description": "fs:scope-document-recursive -> This scope recursive access to the complete `$DOCUMENT` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-document-recursive" - ] - }, - { - "description": "fs:scope-download -> This scope permits access to all files and list content of top level directories in the `$DOWNLOAD`folder.", - "type": "string", - "enum": [ - "fs:scope-download" - ] - }, - { - "description": "fs:scope-download-index -> This scope permits to list all files and folders in the `$DOWNLOAD`folder.", - "type": "string", - "enum": [ - "fs:scope-download-index" - ] - }, - { - "description": "fs:scope-download-recursive -> This scope recursive access to the complete `$DOWNLOAD` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-download-recursive" - ] - }, - { - "description": "fs:scope-exe -> This scope permits access to all files and list content of top level directories in the `$EXE`folder.", - "type": "string", - "enum": [ - "fs:scope-exe" - ] - }, - { - "description": "fs:scope-exe-index -> This scope permits to list all files and folders in the `$EXE`folder.", - "type": "string", - "enum": [ - "fs:scope-exe-index" - ] - }, - { - "description": "fs:scope-exe-recursive -> This scope recursive access to the complete `$EXE` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-exe-recursive" - ] - }, - { - "description": "fs:scope-font -> This scope permits access to all files and list content of top level directories in the `$FONT`folder.", - "type": "string", - "enum": [ - "fs:scope-font" - ] - }, - { - "description": "fs:scope-font-index -> This scope permits to list all files and folders in the `$FONT`folder.", - "type": "string", - "enum": [ - "fs:scope-font-index" - ] - }, - { - "description": "fs:scope-font-recursive -> This scope recursive access to the complete `$FONT` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-font-recursive" - ] - }, - { - "description": "fs:scope-home -> This scope permits access to all files and list content of top level directories in the `$HOME`folder.", - "type": "string", - "enum": [ - "fs:scope-home" - ] - }, - { - "description": "fs:scope-home-index -> This scope permits to list all files and folders in the `$HOME`folder.", - "type": "string", - "enum": [ - "fs:scope-home-index" - ] - }, - { - "description": "fs:scope-home-recursive -> This scope recursive access to the complete `$HOME` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-home-recursive" - ] - }, - { - "description": "fs:scope-localdata -> This scope permits access to all files and list content of top level directories in the `$LOCALDATA`folder.", - "type": "string", - "enum": [ - "fs:scope-localdata" - ] - }, - { - "description": "fs:scope-localdata-index -> This scope permits to list all files and folders in the `$LOCALDATA`folder.", - "type": "string", - "enum": [ - "fs:scope-localdata-index" - ] - }, - { - "description": "fs:scope-localdata-recursive -> This scope recursive access to the complete `$LOCALDATA` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-localdata-recursive" - ] - }, - { - "description": "fs:scope-log -> This scope permits access to all files and list content of top level directories in the `$LOG`folder.", - "type": "string", - "enum": [ - "fs:scope-log" - ] - }, - { - "description": "fs:scope-log-index -> This scope permits to list all files and folders in the `$LOG`folder.", - "type": "string", - "enum": [ - "fs:scope-log-index" - ] - }, - { - "description": "fs:scope-log-recursive -> This scope recursive access to the complete `$LOG` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-log-recursive" - ] - }, - { - "description": "fs:scope-picture -> This scope permits access to all files and list content of top level directories in the `$PICTURE`folder.", - "type": "string", - "enum": [ - "fs:scope-picture" - ] - }, - { - "description": "fs:scope-picture-index -> This scope permits to list all files and folders in the `$PICTURE`folder.", - "type": "string", - "enum": [ - "fs:scope-picture-index" - ] - }, - { - "description": "fs:scope-picture-recursive -> This scope recursive access to the complete `$PICTURE` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-picture-recursive" - ] - }, - { - "description": "fs:scope-public -> This scope permits access to all files and list content of top level directories in the `$PUBLIC`folder.", - "type": "string", - "enum": [ - "fs:scope-public" - ] - }, - { - "description": "fs:scope-public-index -> This scope permits to list all files and folders in the `$PUBLIC`folder.", - "type": "string", - "enum": [ - "fs:scope-public-index" - ] - }, - { - "description": "fs:scope-public-recursive -> This scope recursive access to the complete `$PUBLIC` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-public-recursive" - ] - }, - { - "description": "fs:scope-resource -> This scope permits access to all files and list content of top level directories in the `$RESOURCE`folder.", - "type": "string", - "enum": [ - "fs:scope-resource" - ] - }, - { - "description": "fs:scope-resource-index -> This scope permits to list all files and folders in the `$RESOURCE`folder.", - "type": "string", - "enum": [ - "fs:scope-resource-index" - ] - }, - { - "description": "fs:scope-resource-recursive -> This scope recursive access to the complete `$RESOURCE` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-resource-recursive" - ] - }, - { - "description": "fs:scope-runtime -> This scope permits access to all files and list content of top level directories in the `$RUNTIME`folder.", - "type": "string", - "enum": [ - "fs:scope-runtime" - ] - }, - { - "description": "fs:scope-runtime-index -> This scope permits to list all files and folders in the `$RUNTIME`folder.", - "type": "string", - "enum": [ - "fs:scope-runtime-index" - ] - }, - { - "description": "fs:scope-runtime-recursive -> This scope recursive access to the complete `$RUNTIME` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-runtime-recursive" - ] - }, - { - "description": "fs:scope-temp -> This scope permits access to all files and list content of top level directories in the `$TEMP`folder.", - "type": "string", - "enum": [ - "fs:scope-temp" - ] - }, - { - "description": "fs:scope-temp-index -> This scope permits to list all files and folders in the `$TEMP`folder.", - "type": "string", - "enum": [ - "fs:scope-temp-index" - ] - }, - { - "description": "fs:scope-temp-recursive -> This scope recursive access to the complete `$TEMP` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-temp-recursive" - ] - }, - { - "description": "fs:scope-template -> This scope permits access to all files and list content of top level directories in the `$TEMPLATE`folder.", - "type": "string", - "enum": [ - "fs:scope-template" - ] - }, - { - "description": "fs:scope-template-index -> This scope permits to list all files and folders in the `$TEMPLATE`folder.", - "type": "string", - "enum": [ - "fs:scope-template-index" - ] - }, - { - "description": "fs:scope-template-recursive -> This scope recursive access to the complete `$TEMPLATE` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-template-recursive" - ] - }, - { - "description": "fs:scope-video -> This scope permits access to all files and list content of top level directories in the `$VIDEO`folder.", - "type": "string", - "enum": [ - "fs:scope-video" - ] - }, - { - "description": "fs:scope-video-index -> This scope permits to list all files and folders in the `$VIDEO`folder.", - "type": "string", - "enum": [ - "fs:scope-video-index" - ] - }, - { - "description": "fs:scope-video-recursive -> This scope recursive access to the complete `$VIDEO` folder, including sub directories and files.", - "type": "string", - "enum": [ - "fs:scope-video-recursive" - ] - }, - { - "description": "fs:write-all -> This enables all write related commands without any pre-configured accessible paths.", - "type": "string", - "enum": [ - "fs:write-all" - ] - }, - { - "description": "fs:write-files -> This enables all file write related commands without any pre-configured accessible paths.", - "type": "string", - "enum": [ - "fs:write-files" - ] - }, - { - "description": "http:default -> Allows all fetch operations", - "type": "string", - "enum": [ - "http:default" - ] - }, - { - "description": "http:allow-fetch -> Enables the fetch command without any pre-configured scope.", - "type": "string", - "enum": [ - "http:allow-fetch" - ] - }, - { - "description": "http:allow-fetch-cancel -> Enables the fetch_cancel command without any pre-configured scope.", - "type": "string", - "enum": [ - "http:allow-fetch-cancel" - ] - }, - { - "description": "http:allow-fetch-read-body -> Enables the fetch_read_body command without any pre-configured scope.", - "type": "string", - "enum": [ - "http:allow-fetch-read-body" - ] - }, - { - "description": "http:allow-fetch-send -> Enables the fetch_send command without any pre-configured scope.", - "type": "string", - "enum": [ - "http:allow-fetch-send" - ] - }, - { - "description": "http:deny-fetch -> Denies the fetch command without any pre-configured scope.", - "type": "string", - "enum": [ - "http:deny-fetch" - ] - }, - { - "description": "http:deny-fetch-cancel -> Denies the fetch_cancel command without any pre-configured scope.", - "type": "string", - "enum": [ - "http:deny-fetch-cancel" - ] - }, - { - "description": "http:deny-fetch-read-body -> Denies the fetch_read_body command without any pre-configured scope.", - "type": "string", - "enum": [ - "http:deny-fetch-read-body" - ] - }, - { - "description": "http:deny-fetch-send -> Denies the fetch_send command without any pre-configured scope.", - "type": "string", - "enum": [ - "http:deny-fetch-send" - ] - }, - { - "description": "log:default -> Allows the log command", - "type": "string", - "enum": [ - "log:default" - ] - }, - { - "description": "log:allow-log -> Enables the log command without any pre-configured scope.", - "type": "string", - "enum": [ - "log:allow-log" - ] - }, - { - "description": "log:deny-log -> Denies the log command without any pre-configured scope.", - "type": "string", - "enum": [ - "log:deny-log" - ] - }, - { - "description": "menu:default -> Default permissions for the plugin.", - "type": "string", - "enum": [ - "menu:default" - ] - }, - { - "description": "menu:allow-append -> Enables the append command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-append" - ] - }, - { - "description": "menu:allow-create-default -> Enables the create_default command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-create-default" - ] - }, - { - "description": "menu:allow-get -> Enables the get command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-get" - ] - }, - { - "description": "menu:allow-insert -> Enables the insert command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-insert" - ] - }, - { - "description": "menu:allow-is-checked -> Enables the is_checked command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-is-checked" - ] - }, - { - "description": "menu:allow-is-enabled -> Enables the is_enabled command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-is-enabled" - ] - }, - { - "description": "menu:allow-items -> Enables the items command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-items" - ] - }, - { - "description": "menu:allow-new -> Enables the new command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-new" - ] - }, - { - "description": "menu:allow-popup -> Enables the popup command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-popup" - ] - }, - { - "description": "menu:allow-prepend -> Enables the prepend command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-prepend" - ] - }, - { - "description": "menu:allow-remove -> Enables the remove command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-remove" - ] - }, - { - "description": "menu:allow-remove-at -> Enables the remove_at command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-remove-at" - ] - }, - { - "description": "menu:allow-set-accelerator -> Enables the set_accelerator command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-set-accelerator" - ] - }, - { - "description": "menu:allow-set-as-app-menu -> Enables the set_as_app_menu command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-set-as-app-menu" - ] - }, - { - "description": "menu:allow-set-as-help-menu-for-nsapp -> Enables the set_as_help_menu_for_nsapp command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-set-as-help-menu-for-nsapp" - ] - }, - { - "description": "menu:allow-set-as-window-menu -> Enables the set_as_window_menu command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-set-as-window-menu" - ] - }, - { - "description": "menu:allow-set-as-windows-menu-for-nsapp -> Enables the set_as_windows_menu_for_nsapp command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-set-as-windows-menu-for-nsapp" - ] - }, - { - "description": "menu:allow-set-checked -> Enables the set_checked command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-set-checked" - ] - }, - { - "description": "menu:allow-set-enabled -> Enables the set_enabled command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-set-enabled" - ] - }, - { - "description": "menu:allow-set-icon -> Enables the set_icon command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-set-icon" - ] - }, - { - "description": "menu:allow-set-text -> Enables the set_text command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-set-text" - ] - }, - { - "description": "menu:allow-text -> Enables the text command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:allow-text" - ] - }, - { - "description": "menu:deny-append -> Denies the append command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-append" - ] - }, - { - "description": "menu:deny-create-default -> Denies the create_default command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-create-default" - ] - }, - { - "description": "menu:deny-get -> Denies the get command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-get" - ] - }, - { - "description": "menu:deny-insert -> Denies the insert command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-insert" - ] - }, - { - "description": "menu:deny-is-checked -> Denies the is_checked command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-is-checked" - ] - }, - { - "description": "menu:deny-is-enabled -> Denies the is_enabled command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-is-enabled" - ] - }, - { - "description": "menu:deny-items -> Denies the items command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-items" - ] - }, - { - "description": "menu:deny-new -> Denies the new command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-new" - ] - }, - { - "description": "menu:deny-popup -> Denies the popup command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-popup" - ] - }, - { - "description": "menu:deny-prepend -> Denies the prepend command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-prepend" - ] - }, - { - "description": "menu:deny-remove -> Denies the remove command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-remove" - ] - }, - { - "description": "menu:deny-remove-at -> Denies the remove_at command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-remove-at" - ] - }, - { - "description": "menu:deny-set-accelerator -> Denies the set_accelerator command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-set-accelerator" - ] - }, - { - "description": "menu:deny-set-as-app-menu -> Denies the set_as_app_menu command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-set-as-app-menu" - ] - }, - { - "description": "menu:deny-set-as-help-menu-for-nsapp -> Denies the set_as_help_menu_for_nsapp command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-set-as-help-menu-for-nsapp" - ] - }, - { - "description": "menu:deny-set-as-window-menu -> Denies the set_as_window_menu command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-set-as-window-menu" - ] - }, - { - "description": "menu:deny-set-as-windows-menu-for-nsapp -> Denies the set_as_windows_menu_for_nsapp command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-set-as-windows-menu-for-nsapp" - ] - }, - { - "description": "menu:deny-set-checked -> Denies the set_checked command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-set-checked" - ] - }, - { - "description": "menu:deny-set-enabled -> Denies the set_enabled command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-set-enabled" - ] - }, - { - "description": "menu:deny-set-icon -> Denies the set_icon command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-set-icon" - ] - }, - { - "description": "menu:deny-set-text -> Denies the set_text command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-set-text" - ] - }, - { - "description": "menu:deny-text -> Denies the text command without any pre-configured scope.", - "type": "string", - "enum": [ - "menu:deny-text" - ] - }, - { - "description": "nfc:allow-is-available -> Enables the is_available command without any pre-configured scope.", - "type": "string", - "enum": [ - "nfc:allow-is-available" - ] - }, - { - "description": "nfc:allow-scan -> Enables the scan command without any pre-configured scope.", - "type": "string", - "enum": [ - "nfc:allow-scan" - ] - }, - { - "description": "nfc:allow-write -> Enables the write command without any pre-configured scope.", - "type": "string", - "enum": [ - "nfc:allow-write" - ] - }, - { - "description": "nfc:deny-is-available -> Denies the is_available command without any pre-configured scope.", - "type": "string", - "enum": [ - "nfc:deny-is-available" - ] - }, - { - "description": "nfc:deny-scan -> Denies the scan command without any pre-configured scope.", - "type": "string", - "enum": [ - "nfc:deny-scan" - ] - }, - { - "description": "nfc:deny-write -> Denies the write command without any pre-configured scope.", - "type": "string", - "enum": [ - "nfc:deny-write" - ] - }, - { - "description": "notification:default -> Allows requesting permission, checking permission state and sending notifications", - "type": "string", - "enum": [ - "notification:default" - ] - }, - { - "description": "notification:allow-is-permission-granted -> Enables the is_permission_granted command without any pre-configured scope.", - "type": "string", - "enum": [ - "notification:allow-is-permission-granted" - ] - }, - { - "description": "notification:allow-notify -> Enables the notify command without any pre-configured scope.", - "type": "string", - "enum": [ - "notification:allow-notify" - ] - }, - { - "description": "notification:allow-request-permission -> Enables the request_permission command without any pre-configured scope.", - "type": "string", - "enum": [ - "notification:allow-request-permission" - ] - }, - { - "description": "notification:deny-is-permission-granted -> Denies the is_permission_granted command without any pre-configured scope.", - "type": "string", - "enum": [ - "notification:deny-is-permission-granted" - ] - }, - { - "description": "notification:deny-notify -> Denies the notify command without any pre-configured scope.", - "type": "string", - "enum": [ - "notification:deny-notify" - ] - }, - { - "description": "notification:deny-request-permission -> Denies the request_permission command without any pre-configured scope.", - "type": "string", - "enum": [ - "notification:deny-request-permission" - ] - }, - { - "description": "os:allow-arch -> Enables the arch command without any pre-configured scope.", - "type": "string", - "enum": [ - "os:allow-arch" - ] - }, - { - "description": "os:allow-exe-extension -> Enables the exe_extension command without any pre-configured scope.", - "type": "string", - "enum": [ - "os:allow-exe-extension" - ] - }, - { - "description": "os:allow-family -> Enables the family command without any pre-configured scope.", - "type": "string", - "enum": [ - "os:allow-family" - ] - }, - { - "description": "os:allow-hostname -> Enables the hostname command without any pre-configured scope.", - "type": "string", - "enum": [ - "os:allow-hostname" - ] - }, - { - "description": "os:allow-locale -> Enables the locale command without any pre-configured scope.", - "type": "string", - "enum": [ - "os:allow-locale" - ] - }, - { - "description": "os:allow-os-type -> Enables the os_type command without any pre-configured scope.", - "type": "string", - "enum": [ - "os:allow-os-type" - ] - }, - { - "description": "os:allow-platform -> Enables the platform command without any pre-configured scope.", - "type": "string", - "enum": [ - "os:allow-platform" - ] - }, - { - "description": "os:allow-version -> Enables the version command without any pre-configured scope.", - "type": "string", - "enum": [ - "os:allow-version" - ] - }, - { - "description": "os:deny-arch -> Denies the arch command without any pre-configured scope.", - "type": "string", - "enum": [ - "os:deny-arch" - ] - }, - { - "description": "os:deny-exe-extension -> Denies the exe_extension command without any pre-configured scope.", - "type": "string", - "enum": [ - "os:deny-exe-extension" - ] - }, - { - "description": "os:deny-family -> Denies the family command without any pre-configured scope.", - "type": "string", - "enum": [ - "os:deny-family" - ] - }, - { - "description": "os:deny-hostname -> Denies the hostname command without any pre-configured scope.", - "type": "string", - "enum": [ - "os:deny-hostname" - ] - }, - { - "description": "os:deny-locale -> Denies the locale command without any pre-configured scope.", - "type": "string", - "enum": [ - "os:deny-locale" - ] - }, - { - "description": "os:deny-os-type -> Denies the os_type command without any pre-configured scope.", - "type": "string", - "enum": [ - "os:deny-os-type" - ] - }, - { - "description": "os:deny-platform -> Denies the platform command without any pre-configured scope.", - "type": "string", - "enum": [ - "os:deny-platform" - ] - }, - { - "description": "os:deny-version -> Denies the version command without any pre-configured scope.", - "type": "string", - "enum": [ - "os:deny-version" - ] - }, - { - "description": "path:default -> Default permissions for the plugin.", - "type": "string", - "enum": [ - "path:default" - ] - }, - { - "description": "path:allow-basename -> Enables the basename command without any pre-configured scope.", - "type": "string", - "enum": [ - "path:allow-basename" - ] - }, - { - "description": "path:allow-dirname -> Enables the dirname command without any pre-configured scope.", - "type": "string", - "enum": [ - "path:allow-dirname" - ] - }, - { - "description": "path:allow-extname -> Enables the extname command without any pre-configured scope.", - "type": "string", - "enum": [ - "path:allow-extname" - ] - }, - { - "description": "path:allow-is-absolute -> Enables the is_absolute command without any pre-configured scope.", - "type": "string", - "enum": [ - "path:allow-is-absolute" - ] - }, - { - "description": "path:allow-join -> Enables the join command without any pre-configured scope.", - "type": "string", - "enum": [ - "path:allow-join" - ] - }, - { - "description": "path:allow-normalize -> Enables the normalize command without any pre-configured scope.", - "type": "string", - "enum": [ - "path:allow-normalize" - ] - }, - { - "description": "path:allow-resolve -> Enables the resolve command without any pre-configured scope.", - "type": "string", - "enum": [ - "path:allow-resolve" - ] - }, - { - "description": "path:allow-resolve-directory -> Enables the resolve_directory command without any pre-configured scope.", - "type": "string", - "enum": [ - "path:allow-resolve-directory" - ] - }, - { - "description": "path:deny-basename -> Denies the basename command without any pre-configured scope.", - "type": "string", - "enum": [ - "path:deny-basename" - ] - }, - { - "description": "path:deny-dirname -> Denies the dirname command without any pre-configured scope.", - "type": "string", - "enum": [ - "path:deny-dirname" - ] - }, - { - "description": "path:deny-extname -> Denies the extname command without any pre-configured scope.", - "type": "string", - "enum": [ - "path:deny-extname" - ] - }, - { - "description": "path:deny-is-absolute -> Denies the is_absolute command without any pre-configured scope.", - "type": "string", - "enum": [ - "path:deny-is-absolute" - ] - }, - { - "description": "path:deny-join -> Denies the join command without any pre-configured scope.", - "type": "string", - "enum": [ - "path:deny-join" - ] - }, - { - "description": "path:deny-normalize -> Denies the normalize command without any pre-configured scope.", - "type": "string", - "enum": [ - "path:deny-normalize" - ] - }, - { - "description": "path:deny-resolve -> Denies the resolve command without any pre-configured scope.", - "type": "string", - "enum": [ - "path:deny-resolve" - ] - }, - { - "description": "path:deny-resolve-directory -> Denies the resolve_directory command without any pre-configured scope.", - "type": "string", - "enum": [ - "path:deny-resolve-directory" - ] - }, - { - "description": "process:allow-exit -> Enables the exit command without any pre-configured scope.", - "type": "string", - "enum": [ - "process:allow-exit" - ] - }, - { - "description": "process:allow-restart -> Enables the restart command without any pre-configured scope.", - "type": "string", - "enum": [ - "process:allow-restart" - ] - }, - { - "description": "process:deny-exit -> Denies the exit command without any pre-configured scope.", - "type": "string", - "enum": [ - "process:deny-exit" - ] - }, - { - "description": "process:deny-restart -> Denies the restart command without any pre-configured scope.", - "type": "string", - "enum": [ - "process:deny-restart" - ] - }, - { - "description": "resources:default -> Default permissions for the plugin.", - "type": "string", - "enum": [ - "resources:default" - ] - }, - { - "description": "resources:allow-close -> Enables the close command without any pre-configured scope.", - "type": "string", - "enum": [ - "resources:allow-close" - ] - }, - { - "description": "resources:deny-close -> Denies the close command without any pre-configured scope.", - "type": "string", - "enum": [ - "resources:deny-close" - ] - }, - { - "description": "shell:allow-execute -> Enables the execute command without any pre-configured scope.", - "type": "string", - "enum": [ - "shell:allow-execute" - ] - }, - { - "description": "shell:allow-kill -> Enables the kill command without any pre-configured scope.", - "type": "string", - "enum": [ - "shell:allow-kill" - ] - }, - { - "description": "shell:allow-open -> Enables the open command without any pre-configured scope.", - "type": "string", - "enum": [ - "shell:allow-open" - ] - }, - { - "description": "shell:allow-stdin-write -> Enables the stdin_write command without any pre-configured scope.", - "type": "string", - "enum": [ - "shell:allow-stdin-write" - ] - }, - { - "description": "shell:deny-execute -> Denies the execute command without any pre-configured scope.", - "type": "string", - "enum": [ - "shell:deny-execute" - ] - }, - { - "description": "shell:deny-kill -> Denies the kill command without any pre-configured scope.", - "type": "string", - "enum": [ - "shell:deny-kill" - ] - }, - { - "description": "shell:deny-open -> Denies the open command without any pre-configured scope.", - "type": "string", - "enum": [ - "shell:deny-open" - ] - }, - { - "description": "shell:deny-stdin-write -> Denies the stdin_write command without any pre-configured scope.", - "type": "string", - "enum": [ - "shell:deny-stdin-write" - ] - }, - { - "description": "tray:default -> Default permissions for the plugin.", - "type": "string", - "enum": [ - "tray:default" - ] - }, - { - "description": "tray:allow-new -> Enables the new command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:allow-new" - ] - }, - { - "description": "tray:allow-set-icon -> Enables the set_icon command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:allow-set-icon" - ] - }, - { - "description": "tray:allow-set-icon-as-template -> Enables the set_icon_as_template command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:allow-set-icon-as-template" - ] - }, - { - "description": "tray:allow-set-menu -> Enables the set_menu command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:allow-set-menu" - ] - }, - { - "description": "tray:allow-set-show-menu-on-left-click -> Enables the set_show_menu_on_left_click command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:allow-set-show-menu-on-left-click" - ] - }, - { - "description": "tray:allow-set-temp-dir-path -> Enables the set_temp_dir_path command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:allow-set-temp-dir-path" - ] - }, - { - "description": "tray:allow-set-title -> Enables the set_title command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:allow-set-title" - ] - }, - { - "description": "tray:allow-set-tooltip -> Enables the set_tooltip command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:allow-set-tooltip" - ] - }, - { - "description": "tray:allow-set-visible -> Enables the set_visible command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:allow-set-visible" - ] - }, - { - "description": "tray:deny-new -> Denies the new command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:deny-new" - ] - }, - { - "description": "tray:deny-set-icon -> Denies the set_icon command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:deny-set-icon" - ] - }, - { - "description": "tray:deny-set-icon-as-template -> Denies the set_icon_as_template command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:deny-set-icon-as-template" - ] - }, - { - "description": "tray:deny-set-menu -> Denies the set_menu command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:deny-set-menu" - ] - }, - { - "description": "tray:deny-set-show-menu-on-left-click -> Denies the set_show_menu_on_left_click command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:deny-set-show-menu-on-left-click" - ] - }, - { - "description": "tray:deny-set-temp-dir-path -> Denies the set_temp_dir_path command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:deny-set-temp-dir-path" - ] - }, - { - "description": "tray:deny-set-title -> Denies the set_title command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:deny-set-title" - ] - }, - { - "description": "tray:deny-set-tooltip -> Denies the set_tooltip command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:deny-set-tooltip" - ] - }, - { - "description": "tray:deny-set-visible -> Denies the set_visible command without any pre-configured scope.", - "type": "string", - "enum": [ - "tray:deny-set-visible" - ] - }, - { - "description": "webview:default -> Default permissions for the plugin.", - "type": "string", - "enum": [ - "webview:default" - ] - }, - { - "description": "webview:allow-create-webview -> Enables the create_webview command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:allow-create-webview" - ] - }, - { - "description": "webview:allow-create-webview-window -> Enables the create_webview_window command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:allow-create-webview-window" - ] - }, - { - "description": "webview:allow-internal-toggle-devtools -> Enables the internal_toggle_devtools command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:allow-internal-toggle-devtools" - ] - }, - { - "description": "webview:allow-print -> Enables the print command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:allow-print" - ] - }, - { - "description": "webview:allow-set-webview-focus -> Enables the set_webview_focus command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:allow-set-webview-focus" - ] - }, - { - "description": "webview:allow-set-webview-position -> Enables the set_webview_position command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:allow-set-webview-position" - ] - }, - { - "description": "webview:allow-set-webview-size -> Enables the set_webview_size command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:allow-set-webview-size" - ] - }, - { - "description": "webview:allow-webview-close -> Enables the webview_close command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:allow-webview-close" - ] - }, - { - "description": "webview:allow-webview-position -> Enables the webview_position command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:allow-webview-position" - ] - }, - { - "description": "webview:allow-webview-size -> Enables the webview_size command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:allow-webview-size" - ] - }, - { - "description": "webview:deny-create-webview -> Denies the create_webview command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:deny-create-webview" - ] - }, - { - "description": "webview:deny-create-webview-window -> Denies the create_webview_window command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:deny-create-webview-window" - ] - }, - { - "description": "webview:deny-internal-toggle-devtools -> Denies the internal_toggle_devtools command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:deny-internal-toggle-devtools" - ] - }, - { - "description": "webview:deny-print -> Denies the print command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:deny-print" - ] - }, - { - "description": "webview:deny-set-webview-focus -> Denies the set_webview_focus command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:deny-set-webview-focus" - ] - }, - { - "description": "webview:deny-set-webview-position -> Denies the set_webview_position command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:deny-set-webview-position" - ] - }, - { - "description": "webview:deny-set-webview-size -> Denies the set_webview_size command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:deny-set-webview-size" - ] - }, - { - "description": "webview:deny-webview-close -> Denies the webview_close command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:deny-webview-close" - ] - }, - { - "description": "webview:deny-webview-position -> Denies the webview_position command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:deny-webview-position" - ] - }, - { - "description": "webview:deny-webview-size -> Denies the webview_size command without any pre-configured scope.", - "type": "string", - "enum": [ - "webview:deny-webview-size" - ] - }, - { - "description": "window:default -> Default permissions for the plugin.", - "type": "string", - "enum": [ - "window:default" - ] - }, - { - "description": "window:allow-available-monitors -> Enables the available_monitors command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-available-monitors" - ] - }, - { - "description": "window:allow-center -> Enables the center command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-center" - ] - }, - { - "description": "window:allow-close -> Enables the close command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-close" - ] - }, - { - "description": "window:allow-create -> Enables the create command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-create" - ] - }, - { - "description": "window:allow-current-monitor -> Enables the current_monitor command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-current-monitor" - ] - }, - { - "description": "window:allow-destroy -> Enables the destroy command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-destroy" - ] - }, - { - "description": "window:allow-hide -> Enables the hide command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-hide" - ] - }, - { - "description": "window:allow-inner-position -> Enables the inner_position command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-inner-position" - ] - }, - { - "description": "window:allow-inner-size -> Enables the inner_size command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-inner-size" - ] - }, - { - "description": "window:allow-internal-toggle-maximize -> Enables the internal_toggle_maximize command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-internal-toggle-maximize" - ] - }, - { - "description": "window:allow-is-closable -> Enables the is_closable command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-is-closable" - ] - }, - { - "description": "window:allow-is-decorated -> Enables the is_decorated command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-is-decorated" - ] - }, - { - "description": "window:allow-is-focused -> Enables the is_focused command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-is-focused" - ] - }, - { - "description": "window:allow-is-fullscreen -> Enables the is_fullscreen command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-is-fullscreen" - ] - }, - { - "description": "window:allow-is-maximizable -> Enables the is_maximizable command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-is-maximizable" - ] - }, - { - "description": "window:allow-is-maximized -> Enables the is_maximized command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-is-maximized" - ] - }, - { - "description": "window:allow-is-minimizable -> Enables the is_minimizable command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-is-minimizable" - ] - }, - { - "description": "window:allow-is-minimized -> Enables the is_minimized command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-is-minimized" - ] - }, - { - "description": "window:allow-is-resizable -> Enables the is_resizable command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-is-resizable" - ] - }, - { - "description": "window:allow-is-visible -> Enables the is_visible command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-is-visible" - ] - }, - { - "description": "window:allow-maximize -> Enables the maximize command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-maximize" - ] - }, - { - "description": "window:allow-minimize -> Enables the minimize command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-minimize" - ] - }, - { - "description": "window:allow-outer-position -> Enables the outer_position command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-outer-position" - ] - }, - { - "description": "window:allow-outer-size -> Enables the outer_size command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-outer-size" - ] - }, - { - "description": "window:allow-primary-monitor -> Enables the primary_monitor command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-primary-monitor" - ] - }, - { - "description": "window:allow-request-user-attention -> Enables the request_user_attention command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-request-user-attention" - ] - }, - { - "description": "window:allow-scale-factor -> Enables the scale_factor command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-scale-factor" - ] - }, - { - "description": "window:allow-set-always-on-bottom -> Enables the set_always_on_bottom command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-always-on-bottom" - ] - }, - { - "description": "window:allow-set-always-on-top -> Enables the set_always_on_top command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-always-on-top" - ] - }, - { - "description": "window:allow-set-closable -> Enables the set_closable command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-closable" - ] - }, - { - "description": "window:allow-set-content-protected -> Enables the set_content_protected command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-content-protected" - ] - }, - { - "description": "window:allow-set-cursor-grab -> Enables the set_cursor_grab command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-cursor-grab" - ] - }, - { - "description": "window:allow-set-cursor-icon -> Enables the set_cursor_icon command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-cursor-icon" - ] - }, - { - "description": "window:allow-set-cursor-position -> Enables the set_cursor_position command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-cursor-position" - ] - }, - { - "description": "window:allow-set-cursor-visible -> Enables the set_cursor_visible command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-cursor-visible" - ] - }, - { - "description": "window:allow-set-decorations -> Enables the set_decorations command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-decorations" - ] - }, - { - "description": "window:allow-set-effects -> Enables the set_effects command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-effects" - ] - }, - { - "description": "window:allow-set-focus -> Enables the set_focus command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-focus" - ] - }, - { - "description": "window:allow-set-fullscreen -> Enables the set_fullscreen command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-fullscreen" - ] - }, - { - "description": "window:allow-set-icon -> Enables the set_icon command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-icon" - ] - }, - { - "description": "window:allow-set-ignore-cursor-events -> Enables the set_ignore_cursor_events command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-ignore-cursor-events" - ] - }, - { - "description": "window:allow-set-max-size -> Enables the set_max_size command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-max-size" - ] - }, - { - "description": "window:allow-set-maximizable -> Enables the set_maximizable command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-maximizable" - ] - }, - { - "description": "window:allow-set-min-size -> Enables the set_min_size command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-min-size" - ] - }, - { - "description": "window:allow-set-minimizable -> Enables the set_minimizable command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-minimizable" - ] - }, - { - "description": "window:allow-set-position -> Enables the set_position command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-position" - ] - }, - { - "description": "window:allow-set-progress-bar -> Enables the set_progress_bar command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-progress-bar" - ] - }, - { - "description": "window:allow-set-resizable -> Enables the set_resizable command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-resizable" - ] - }, - { - "description": "window:allow-set-shadow -> Enables the set_shadow command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-shadow" - ] - }, - { - "description": "window:allow-set-size -> Enables the set_size command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-size" - ] - }, - { - "description": "window:allow-set-skip-taskbar -> Enables the set_skip_taskbar command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-skip-taskbar" - ] - }, - { - "description": "window:allow-set-title -> Enables the set_title command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-title" - ] - }, - { - "description": "window:allow-set-visible-on-all-workspaces -> Enables the set_visible_on_all_workspaces command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-set-visible-on-all-workspaces" - ] - }, - { - "description": "window:allow-show -> Enables the show command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-show" - ] - }, - { - "description": "window:allow-start-dragging -> Enables the start_dragging command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-start-dragging" - ] - }, - { - "description": "window:allow-theme -> Enables the theme command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-theme" - ] - }, - { - "description": "window:allow-title -> Enables the title command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-title" - ] - }, - { - "description": "window:allow-toggle-maximize -> Enables the toggle_maximize command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-toggle-maximize" - ] - }, - { - "description": "window:allow-unmaximize -> Enables the unmaximize command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-unmaximize" - ] - }, - { - "description": "window:allow-unminimize -> Enables the unminimize command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:allow-unminimize" - ] - }, - { - "description": "window:deny-available-monitors -> Denies the available_monitors command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-available-monitors" - ] - }, - { - "description": "window:deny-center -> Denies the center command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-center" - ] - }, - { - "description": "window:deny-close -> Denies the close command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-close" - ] - }, - { - "description": "window:deny-create -> Denies the create command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-create" - ] - }, - { - "description": "window:deny-current-monitor -> Denies the current_monitor command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-current-monitor" - ] - }, - { - "description": "window:deny-destroy -> Denies the destroy command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-destroy" - ] - }, - { - "description": "window:deny-hide -> Denies the hide command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-hide" - ] - }, - { - "description": "window:deny-inner-position -> Denies the inner_position command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-inner-position" - ] - }, - { - "description": "window:deny-inner-size -> Denies the inner_size command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-inner-size" - ] - }, - { - "description": "window:deny-internal-toggle-maximize -> Denies the internal_toggle_maximize command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-internal-toggle-maximize" - ] - }, - { - "description": "window:deny-is-closable -> Denies the is_closable command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-is-closable" - ] - }, - { - "description": "window:deny-is-decorated -> Denies the is_decorated command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-is-decorated" - ] - }, - { - "description": "window:deny-is-focused -> Denies the is_focused command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-is-focused" - ] - }, - { - "description": "window:deny-is-fullscreen -> Denies the is_fullscreen command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-is-fullscreen" - ] - }, - { - "description": "window:deny-is-maximizable -> Denies the is_maximizable command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-is-maximizable" - ] - }, - { - "description": "window:deny-is-maximized -> Denies the is_maximized command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-is-maximized" - ] - }, - { - "description": "window:deny-is-minimizable -> Denies the is_minimizable command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-is-minimizable" - ] - }, - { - "description": "window:deny-is-minimized -> Denies the is_minimized command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-is-minimized" - ] - }, - { - "description": "window:deny-is-resizable -> Denies the is_resizable command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-is-resizable" - ] - }, - { - "description": "window:deny-is-visible -> Denies the is_visible command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-is-visible" - ] - }, - { - "description": "window:deny-maximize -> Denies the maximize command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-maximize" - ] - }, - { - "description": "window:deny-minimize -> Denies the minimize command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-minimize" - ] - }, - { - "description": "window:deny-outer-position -> Denies the outer_position command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-outer-position" - ] - }, - { - "description": "window:deny-outer-size -> Denies the outer_size command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-outer-size" - ] - }, - { - "description": "window:deny-primary-monitor -> Denies the primary_monitor command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-primary-monitor" - ] - }, - { - "description": "window:deny-request-user-attention -> Denies the request_user_attention command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-request-user-attention" - ] - }, - { - "description": "window:deny-scale-factor -> Denies the scale_factor command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-scale-factor" - ] - }, - { - "description": "window:deny-set-always-on-bottom -> Denies the set_always_on_bottom command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-always-on-bottom" - ] - }, - { - "description": "window:deny-set-always-on-top -> Denies the set_always_on_top command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-always-on-top" - ] - }, - { - "description": "window:deny-set-closable -> Denies the set_closable command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-closable" - ] - }, - { - "description": "window:deny-set-content-protected -> Denies the set_content_protected command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-content-protected" - ] - }, - { - "description": "window:deny-set-cursor-grab -> Denies the set_cursor_grab command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-cursor-grab" - ] - }, - { - "description": "window:deny-set-cursor-icon -> Denies the set_cursor_icon command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-cursor-icon" - ] - }, - { - "description": "window:deny-set-cursor-position -> Denies the set_cursor_position command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-cursor-position" - ] - }, - { - "description": "window:deny-set-cursor-visible -> Denies the set_cursor_visible command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-cursor-visible" - ] - }, - { - "description": "window:deny-set-decorations -> Denies the set_decorations command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-decorations" - ] - }, - { - "description": "window:deny-set-effects -> Denies the set_effects command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-effects" - ] - }, - { - "description": "window:deny-set-focus -> Denies the set_focus command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-focus" - ] - }, - { - "description": "window:deny-set-fullscreen -> Denies the set_fullscreen command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-fullscreen" - ] - }, - { - "description": "window:deny-set-icon -> Denies the set_icon command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-icon" - ] - }, - { - "description": "window:deny-set-ignore-cursor-events -> Denies the set_ignore_cursor_events command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-ignore-cursor-events" - ] - }, - { - "description": "window:deny-set-max-size -> Denies the set_max_size command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-max-size" - ] - }, - { - "description": "window:deny-set-maximizable -> Denies the set_maximizable command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-maximizable" - ] - }, - { - "description": "window:deny-set-min-size -> Denies the set_min_size command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-min-size" - ] - }, - { - "description": "window:deny-set-minimizable -> Denies the set_minimizable command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-minimizable" - ] - }, - { - "description": "window:deny-set-position -> Denies the set_position command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-position" - ] - }, - { - "description": "window:deny-set-progress-bar -> Denies the set_progress_bar command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-progress-bar" - ] - }, - { - "description": "window:deny-set-resizable -> Denies the set_resizable command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-resizable" - ] - }, - { - "description": "window:deny-set-shadow -> Denies the set_shadow command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-shadow" - ] - }, - { - "description": "window:deny-set-size -> Denies the set_size command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-size" - ] - }, - { - "description": "window:deny-set-skip-taskbar -> Denies the set_skip_taskbar command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-skip-taskbar" - ] - }, - { - "description": "window:deny-set-title -> Denies the set_title command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-title" - ] - }, - { - "description": "window:deny-set-visible-on-all-workspaces -> Denies the set_visible_on_all_workspaces command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-set-visible-on-all-workspaces" - ] - }, - { - "description": "window:deny-show -> Denies the show command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-show" - ] - }, - { - "description": "window:deny-start-dragging -> Denies the start_dragging command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-start-dragging" - ] - }, - { - "description": "window:deny-theme -> Denies the theme command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-theme" - ] - }, - { - "description": "window:deny-title -> Denies the title command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-title" - ] - }, - { - "description": "window:deny-toggle-maximize -> Denies the toggle_maximize command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-toggle-maximize" - ] - }, - { - "description": "window:deny-unmaximize -> Denies the unmaximize command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-unmaximize" - ] - }, - { - "description": "window:deny-unminimize -> Denies the unminimize command without any pre-configured scope.", - "type": "string", - "enum": [ - "window:deny-unminimize" - ] - } - ] - }, - "Value": { - "description": "All supported ACL values.", - "anyOf": [ - { - "description": "Represents a null JSON value.", - "type": "null" - }, - { - "description": "Represents a [`bool`].", - "type": "boolean" - }, - { - "description": "Represents a valid ACL [`Number`].", - "allOf": [ - { - "$ref": "#/definitions/Number" - } - ] - }, - { - "description": "Represents a [`String`].", - "type": "string" - }, - { - "description": "Represents a list of other [`Value`]s.", - "type": "array", - "items": { - "$ref": "#/definitions/Value" - } - }, - { - "description": "Represents a map of [`String`] keys to [`Value`]s.", - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/Value" - } - } - ] - }, - "Number": { - "description": "A valid ACL number.", - "anyOf": [ - { - "description": "Represents an [`i64`].", - "type": "integer", - "format": "int64" - }, - { - "description": "Represents a [`f64`].", - "type": "number", - "format": "double" - } - ] - }, - "Target": { - "description": "Platform target.", - "oneOf": [ - { - "description": "MacOS.", - "type": "string", - "enum": [ - "macOS" - ] - }, - { - "description": "Windows.", - "type": "string", - "enum": [ - "windows" - ] - }, - { - "description": "Linux.", - "type": "string", - "enum": [ - "linux" - ] - }, - { - "description": "Android.", - "type": "string", - "enum": [ - "android" - ] - }, - { - "description": "iOS.", - "type": "string", - "enum": [ - "iOS" - ] - } - ] - }, - "ShellAllowedArg": { - "description": "A command argument allowed to be executed by the webview API.", - "anyOf": [ - { - "description": "A non-configurable argument that is passed to the command in the order it was specified.", - "type": "string" - }, - { - "description": "A variable that is set while calling the command from the webview API.", - "type": "object", - "required": [ - "validator" - ], - "properties": { - "validator": { - "description": "[regex] validator to require passed values to conform to an expected input.\n\nThis will require the argument value passed to this variable to match the `validator` regex before it will be executed.\n\n[regex]: https://docs.rs/regex/latest/regex/#syntax", - "type": "string" - } - }, - "additionalProperties": false - } - ] - }, - "ShellAllowedArgs": { - "description": "A set of command arguments allowed to be executed by the webview API.\n\nA value of `true` will allow any arguments to be passed to the command. `false` will disable all arguments. A list of [`ShellAllowedArg`] will set those arguments as the only valid arguments to be passed to the attached command configuration.", - "anyOf": [ - { - "description": "Use a simple boolean to allow all or disable all arguments to this command configuration.", - "type": "boolean" - }, - { - "description": "A specific set of [`ShellAllowedArg`] that are valid to call for the command configuration.", - "type": "array", - "items": { - "$ref": "#/definitions/ShellAllowedArg" - } - } - ] - } - } -} \ No newline at end of file diff --git a/examples/api/src-tauri/src/lib.rs b/examples/api/src-tauri/src/lib.rs index b40290bd..a19992b0 100644 --- a/examples/api/src-tauri/src/lib.rs +++ b/examples/api/src-tauri/src/lib.rs @@ -7,7 +7,10 @@ mod cmd; mod tray; use serde::Serialize; -use tauri::{webview::WebviewWindowBuilder, App, AppHandle, Manager, RunEvent, WebviewUrl}; +use tauri::{ + webview::{PageLoadEvent, WebviewWindowBuilder}, + App, AppHandle, Emitter, Listener, RunEvent, WebviewUrl, +}; #[derive(Clone, Serialize)] struct Reply { @@ -33,7 +36,9 @@ pub fn run() { .plugin(tauri_plugin_notification::init()) .plugin(tauri_plugin_os::init()) .plugin(tauri_plugin_process::init()) + .plugin(tauri_plugin_opener::init()) .plugin(tauri_plugin_shell::init()) + .plugin(tauri_plugin_store::Builder::default().build()) .setup(move |app| { #[cfg(desktop)] { @@ -41,6 +46,8 @@ pub fn run() { app.handle().plugin(tauri_plugin_cli::init())?; app.handle() .plugin(tauri_plugin_global_shortcut::Builder::new().build())?; + app.handle() + .plugin(tauri_plugin_window_state::Builder::new().build())?; app.handle() .plugin(tauri_plugin_updater::Builder::new().build())?; } @@ -49,6 +56,8 @@ pub fn run() { app.handle().plugin(tauri_plugin_barcode_scanner::init())?; app.handle().plugin(tauri_plugin_nfc::init())?; app.handle().plugin(tauri_plugin_biometric::init())?; + app.handle().plugin(tauri_plugin_geolocation::init())?; + app.handle().plugin(tauri_plugin_haptics::init())?; } let mut webview_window_builder = @@ -60,7 +69,7 @@ pub fn run() { .title("Tauri API Validation") .inner_size(1000., 800.) .min_inner_size(600., 400.) - .content_protected(true); + .visible(false); } #[cfg(target_os = "windows")] @@ -93,9 +102,28 @@ pub fn run() { if let Ok(mut request) = server.recv() { let mut body = Vec::new(); let _ = request.as_reader().read_to_end(&mut body); + let mut headers = request.headers().to_vec(); + + if !headers.iter().any(|header| header.field == tiny_http::HeaderField::from_bytes(b"Cookie").unwrap()) { + let expires = time::OffsetDateTime::now_utc() + time::Duration::days(1); + // RFC 1123 format + let format = time::macros::format_description!( + "[weekday repr:short], [day] [month repr:short] [year] [hour]:[minute]:[second] GMT" + ); + let expires_str = expires.format(format).unwrap(); + headers.push( + tiny_http::Header::from_bytes( + &b"Set-Cookie"[..], + format!("session-token=test-value; Secure; Path=/; Expires={expires_str}") + .as_bytes(), + ) + .unwrap(), + ); + } + let response = tiny_http::Response::new( tiny_http::StatusCode(200), - request.headers().to_vec(), + headers, std::io::Cursor::new(body), request.body_length(), None, @@ -107,18 +135,20 @@ pub fn run() { Ok(()) }) - .on_page_load(|webview, _| { - let webview_ = webview.clone(); - webview.listen("js-event", move |event| { - println!("got js-event with message '{:?}'", event.payload()); - let reply = Reply { - data: "something else".to_string(), - }; - - webview_ - .emit("rust-event", Some(reply)) - .expect("failed to emit"); - }); + .on_page_load(|webview, payload| { + if payload.event() == PageLoadEvent::Finished { + let webview_ = webview.clone(); + webview.listen("js-event", move |event| { + println!("got js-event with message '{:?}'", event.payload()); + let reply = Reply { + data: "something else".to_string(), + }; + + webview_ + .emit("rust-event", Some(reply)) + .expect("failed to emit"); + }); + } }); #[cfg(target_os = "macos")] @@ -132,7 +162,7 @@ pub fn run() { cmd::log_operation, cmd::perform_request, ]) - .build(tauri::tauri_build_context!()) + .build(tauri::generate_context!()) .expect("error while building tauri application"); #[cfg(target_os = "macos")] @@ -140,10 +170,12 @@ pub fn run() { app.run(move |_app_handle, _event| { #[cfg(desktop)] - if let RunEvent::ExitRequested { api, .. } = &_event { - // Keep the event loop running even if all windows are closed - // This allow us to catch system tray events when there is no window - api.prevent_exit(); + if let RunEvent::ExitRequested { code, api, .. } = &_event { + if code.is_none() { + // Keep the event loop running even if all windows are closed + // This allow us to catch system tray events when there is no window + api.prevent_exit(); + } } }) } diff --git a/examples/api/src-tauri/src/tray.rs b/examples/api/src-tauri/src/tray.rs index 470764f8..7b1321a5 100644 --- a/examples/api/src-tauri/src/tray.rs +++ b/examples/api/src-tauri/src/tray.rs @@ -5,7 +5,7 @@ use std::sync::atomic::{AtomicBool, Ordering}; use tauri::{ menu::{Menu, MenuItem}, - tray::{ClickType, TrayIconBuilder}, + tray::{MouseButton, MouseButtonState, TrayIconBuilder, TrayIconEvent}, Manager, Runtime, WebviewUrl, WebviewWindowBuilder, }; @@ -45,7 +45,7 @@ pub fn create_tray(app: &tauri::AppHandle) -> tauri::Result<()> { .tooltip("Tauri") .icon(app.default_window_icon().unwrap().clone()) .menu(&menu1) - .menu_on_left_click(false) + .show_menu_on_left_click(false) .on_menu_event(move |app, event| match event.id.as_ref() { "quit" => { app.exit(0); @@ -79,11 +79,15 @@ pub fn create_tray(app: &tauri::AppHandle) -> tauri::Result<()> { } i @ "icon-1" | i @ "icon-2" => { if let Some(tray) = app.tray_by_id("tray-1") { - let _ = tray.set_icon(Some(tauri::Icon::Raw(if i == "icon-1" { - include_bytes!("../icons/icon.ico").to_vec() + let _ = tray.set_icon(Some(if i == "icon-1" { + tauri::image::Image::from_bytes(include_bytes!("../icons/icon.ico")) + .unwrap() } else { - include_bytes!("../icons/tray_icon_with_transparency.png").to_vec() - }))); + tauri::image::Image::from_bytes(include_bytes!( + "../icons/tray_icon_with_transparency.png" + )) + .unwrap() + })); } } "switch-menu" => { @@ -103,7 +107,12 @@ pub fn create_tray(app: &tauri::AppHandle) -> tauri::Result<()> { _ => {} }) .on_tray_icon_event(|tray, event| { - if event.click_type == ClickType::Left { + if let TrayIconEvent::Click { + button_state: MouseButtonState::Down, + button: MouseButton::Left, + .. + } = event + { let app = tray.app_handle(); if let Some(window) = app.get_webview_window("main") { let _ = window.show(); diff --git a/examples/api/src-tauri/tauri.conf.json b/examples/api/src-tauri/tauri.conf.json index ec3190ef..00b095be 100644 --- a/examples/api/src-tauri/tauri.conf.json +++ b/examples/api/src-tauri/tauri.conf.json @@ -1,13 +1,13 @@ { - "$schema": "../node_modules/@tauri-apps/cli/schema.json", + "$schema": "../node_modules/@tauri-apps/cli/config.schema.json", "productName": "Tauri API", "version": "2.0.0", "identifier": "com.tauri.api", "build": { "devUrl": "http://localhost:5173", "frontendDist": "../dist", - "beforeDevCommand": "yarn dev", - "beforeBuildCommand": "yarn build" + "beforeDevCommand": "pnpm dev", + "beforeBuildCommand": "pnpm build" }, "app": { "withGlobalTauri": true, @@ -100,6 +100,9 @@ } } } + }, + "iOS": { + "minimumSystemVersion": "14.0" } } } diff --git a/examples/api/src/App.svelte b/examples/api/src/App.svelte index 117afa22..9396f6f9 100644 --- a/examples/api/src/App.svelte +++ b/examples/api/src/App.svelte @@ -1,200 +1,222 @@ @@ -325,42 +345,46 @@ children:h-100% children:w-12 children:inline-flex children:items-center children:justify-center" > - {#if isDark} -
+
{:else} -
+
{/if} - - + +
{/if} @@ -368,13 +392,13 @@ @@ -386,24 +410,21 @@ class="lt-sm:h-screen lt-sm:shadow-lg lt-sm:shadow lt-sm:transition-transform lt-sm:absolute lt-sm:z-1999 bg-darkPrimaryLighter transition-colors-250 overflow-hidden grid select-none px-2" > - open("https://tauri.app/")} - class="self-center p-7 cursor-pointer" - src="tauri_logo.png" - alt="Tauri logo" - /> + + Tauri logo + {#if !isWindows} {#if isDark} Switch to Light mode -
+
{:else} Switch to Dark mode -
+
{/if}

-
+

{/if} @@ -413,7 +434,7 @@ href="https://tauri.app/v1/guides/" > Documentation - + GitHub - + Source - +
-
+

{ - select(view); - isSideBarOpen = false; + select(view) + isSideBarOpen = false }} > -
+

{view.label}

{/if} @@ -476,23 +497,28 @@ id="console" class="select-none h-15rem grid grid-rows-[2px_2rem_1fr] gap-1 overflow-hidden" > +
+ >

Console

-
-
-
+
+
-
+
{#each $messages as r} {@html r.html} {/each} diff --git a/examples/api/src/app.css b/examples/api/src/app.css index 6987e423..6e8ae62d 100644 --- a/examples/api/src/app.css +++ b/examples/api/src/app.css @@ -5,7 +5,7 @@ * { box-sizing: border-box; - font-family: "Rubik", sans-serif; + font-family: 'Rubik', sans-serif; } ::-webkit-scrollbar { diff --git a/examples/api/src/lib/utils.js b/examples/api/src/lib/utils.js new file mode 100644 index 00000000..a5ddc058 --- /dev/null +++ b/examples/api/src/lib/utils.js @@ -0,0 +1,15 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +export function arrayBufferToBase64(buffer, callback) { + const blob = new Blob([buffer], { + type: 'application/octet-binary' + }) + const reader = new FileReader() + reader.onload = function (evt) { + const dataurl = evt.target.result + callback(dataurl.substr(dataurl.indexOf(',') + 1)) + } + reader.readAsDataURL(blob) +} diff --git a/examples/api/src/main.js b/examples/api/src/main.js index f9785b74..5b7473f6 100644 --- a/examples/api/src/main.js +++ b/examples/api/src/main.js @@ -2,12 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import "uno.css"; -import "./app.css"; -import App from "./App.svelte"; +import 'uno.css' +import './app.css' +import App from './App.svelte' +import { mount } from 'svelte' -const app = new App({ - target: document.querySelector("#app"), -}); +const app = mount(App, { + target: document.querySelector('#app') +}) -export default app; +export default app diff --git a/examples/api/src/views/Cli.svelte b/examples/api/src/views/Cli.svelte index 53c3ee36..06f38e02 100644 --- a/examples/api/src/views/Cli.svelte +++ b/examples/api/src/views/Cli.svelte @@ -1,14 +1,14 @@ -

+

This binary can be run from the terminal and takes the following arguments:
@@ -17,7 +17,7 @@
   --verbose
Additionally, it has a update --background subcommand. -

+

Note that the arguments are only parsed, not implemented. diff --git a/examples/api/src/views/Clipboard.svelte b/examples/api/src/views/Clipboard.svelte index f571b2ee..f16a7d71 100644 --- a/examples/api/src/views/Clipboard.svelte +++ b/examples/api/src/views/Clipboard.svelte @@ -1,23 +1,59 @@ @@ -27,6 +63,7 @@ placeholder="Text to write to the clipboard" bind:value={text} /> - + +
diff --git a/examples/api/src/views/Communication.svelte b/examples/api/src/views/Communication.svelte index a9f4826f..f34dcd3e 100644 --- a/examples/api/src/views/Communication.svelte +++ b/examples/api/src/views/Communication.svelte @@ -1,15 +1,15 @@ diff --git a/examples/api/src/views/Dialog.svelte b/examples/api/src/views/Dialog.svelte index 3e594c90..462eecff 100644 --- a/examples/api/src/views/Dialog.svelte +++ b/examples/api/src/views/Dialog.svelte @@ -23,11 +23,7 @@ async function prompt() { confirm("Do you want to do something?") - .then((res) => - onMessage( - res ? "Yes" : "No" - ) - ) + .then((res) => onMessage(res ? "Yes" : "No")) .catch(onMessage); } @@ -67,14 +63,15 @@ if (Array.isArray(res)) { onMessage(res); } else { - var pathToRead = typeof res === "string" ? res : res.path; + var pathToRead = res; var isFile = pathToRead.match(/\S+\.\S+$/g); readFile(pathToRead) .then(function (response) { if (isFile) { if ( pathToRead.includes(".png") || - pathToRead.includes(".jpg") + pathToRead.includes(".jpg") || + pathToRead.includes(".jpeg") ) { arrayBufferToBase64( new Uint8Array(response), @@ -144,5 +141,7 @@ >Open save dialog - + diff --git a/examples/api/src/views/FileSystem.svelte b/examples/api/src/views/FileSystem.svelte index dce83663..baf9f607 100644 --- a/examples/api/src/views/FileSystem.svelte +++ b/examples/api/src/views/FileSystem.svelte @@ -1,16 +1,19 @@
@@ -215,7 +215,7 @@
{/if} - +

Watch


- + + import { + checkPermissions, + requestPermissions, + getCurrentPosition + } from '@tauri-apps/plugin-geolocation' + + export let onMessage + + async function getPosition() { + let permissions = await checkPermissions() + if ( + permissions.location === 'prompt' || + permissions.location === 'prompt-with-rationale' + ) { + permissions = await requestPermissions(['location']) + } + + if (permissions.location === 'granted') { + getCurrentPosition().then(onMessage).catch(onMessage) + } else { + onMessage('permission denied') + } + } + + + diff --git a/examples/api/src/views/Haptics.svelte b/examples/api/src/views/Haptics.svelte new file mode 100644 index 00000000..9ddf15c1 --- /dev/null +++ b/examples/api/src/views/Haptics.svelte @@ -0,0 +1,46 @@ + + +
+ + + + + +
+ +
+ +

+ Depending on your device settings for haptic feedback some of the buttons may + not work. +

diff --git a/examples/api/src/views/Http.svelte b/examples/api/src/views/Http.svelte index 842816b8..5c7c3c49 100644 --- a/examples/api/src/views/Http.svelte +++ b/examples/api/src/views/Http.svelte @@ -1,69 +1,69 @@ @@ -82,7 +82,7 @@ placeholder="Request body" rows="5" bind:value={httpBody} - /> + >
diff --git a/examples/api/src/views/Opener.svelte b/examples/api/src/views/Opener.svelte new file mode 100644 index 00000000..eca634ac --- /dev/null +++ b/examples/api/src/views/Opener.svelte @@ -0,0 +1,66 @@ + + +
+
+ + + with + +
+ +
+ + + with + +
+ +
+ + +
+
diff --git a/examples/api/src/views/Scanner.svelte b/examples/api/src/views/Scanner.svelte index 57ff904c..ea0609e3 100644 --- a/examples/api/src/views/Scanner.svelte +++ b/examples/api/src/views/Scanner.svelte @@ -1,38 +1,44 @@ @@ -59,11 +65,12 @@

Aim your camera at a QR code

- +
-
+
@@ -111,7 +118,7 @@ transition: 0.3s; } .square:after { - content: ""; + content: ''; top: 0; display: block; padding-bottom: 100%; @@ -141,7 +148,8 @@ width: 100%; margin: 1rem; border: 2px solid #fff; - box-shadow: 0px 0px 2px 1px rgb(0 0 0 / 0.5), + box-shadow: + 0px 0px 2px 1px rgb(0 0 0 / 0.5), inset 0px 0px 2px 1px rgb(0 0 0 / 0.5); border-radius: 1rem; } diff --git a/examples/api/src/views/Shell.svelte b/examples/api/src/views/Shell.svelte index 5f5e2d25..faaa8c4c 100644 --- a/examples/api/src/views/Shell.svelte +++ b/examples/api/src/views/Shell.svelte @@ -59,7 +59,7 @@ } function writeToStdin() { - child.write(stdin).catch(onMessage); + child.write(`${stdin}\n`).catch(onMessage); } diff --git a/examples/api/src/views/Shortcuts.svelte b/examples/api/src/views/Shortcuts.svelte index cdcc9066..41d0271d 100644 --- a/examples/api/src/views/Shortcuts.svelte +++ b/examples/api/src/views/Shortcuts.svelte @@ -1,9 +1,8 @@ + +
+
+
+ Key: + +
+ +
+ Value: + +
+ +
+ + + + +
+
+ +
+ {#each Object.entries(cache) as [k, v]} +
{k} = {v}
+ {/each} +
+
diff --git a/examples/api/src/views/Updater.svelte b/examples/api/src/views/Updater.svelte index 808e5868..26d074a6 100644 --- a/examples/api/src/views/Updater.svelte +++ b/examples/api/src/views/Updater.svelte @@ -1,56 +1,60 @@
@@ -61,7 +65,7 @@ {:else}
{progress}% -
+
{/if}
diff --git a/examples/api/unocss.config.js b/examples/api/unocss.config.js index 44d926cd..d2069a49 100644 --- a/examples/api/unocss.config.js +++ b/examples/api/unocss.config.js @@ -2,43 +2,43 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { defineConfig, presetIcons, presetUno, presetWebFonts } from "unocss"; -import extractorSvelte from "@unocss/extractor-svelte"; +import { defineConfig, presetIcons, presetUno, presetWebFonts } from 'unocss' +import extractorSvelte from '@unocss/extractor-svelte' export default defineConfig({ theme: { colors: { - primary: "#FFFFFF", - primaryLighter: "#e9ecef", - darkPrimary: "#1B1B1D", - darkPrimaryLighter: "#242526", - primaryText: "#1C1E21", - darkPrimaryText: "#E3E3E3", - secondaryText: "#858A91", - darkSecondaryText: "#C2C5CA", - accent: "#3578E5", - accentDark: "#306cce", - accentDarker: "#2d66c3", - accentDarkest: "#2554a0", - accentLight: "#538ce9", - accentLighter: "#72a1ed", - accentLightest: "#9abcf2", - accentText: "#FFFFFF", - darkAccent: "#67d6ed", - darkAccentDark: "#49cee9", - darkAccentDarker: "#39cae8", - darkAccentDarkest: "#19b5d5", - darkAccentLight: "#85def1", - darkAccentLighter: "#95e2f2", - darkAccentLightest: "#c2eff8", - darkAccentText: "#1C1E21", - code: "#d6d8da", - codeDark: "#282a2e", - hoverOverlay: "rgba(0,0,0,.05)", - hoverOverlayDarker: "rgba(0,0,0,.1)", - darkHoverOverlay: "hsla(0,0%,100%,.05)", - darkHoverOverlayDarker: "hsla(0,0%,100%,.1)", - }, + primary: '#FFFFFF', + primaryLighter: '#e9ecef', + darkPrimary: '#1B1B1D', + darkPrimaryLighter: '#242526', + primaryText: '#1C1E21', + darkPrimaryText: '#E3E3E3', + secondaryText: '#858A91', + darkSecondaryText: '#C2C5CA', + accent: '#3578E5', + accentDark: '#306cce', + accentDarker: '#2d66c3', + accentDarkest: '#2554a0', + accentLight: '#538ce9', + accentLighter: '#72a1ed', + accentLightest: '#9abcf2', + accentText: '#FFFFFF', + darkAccent: '#67d6ed', + darkAccentDark: '#49cee9', + darkAccentDarker: '#39cae8', + darkAccentDarkest: '#19b5d5', + darkAccentLight: '#85def1', + darkAccentLighter: '#95e2f2', + darkAccentLightest: '#c2eff8', + darkAccentText: '#1C1E21', + code: '#d6d8da', + codeDark: '#282a2e', + hoverOverlay: 'rgba(0,0,0,.05)', + hoverOverlayDarker: 'rgba(0,0,0,.1)', + darkHoverOverlay: 'hsla(0,0%,100%,.05)', + darkHoverOverlayDarker: 'hsla(0,0%,100%,.1)' + } }, preflights: [ { @@ -54,7 +54,7 @@ export default defineConfig({ code { font-size: ${theme.fontSize.xs[0]}; font-family: ${theme.fontFamily.mono}; - border-radius: ${theme.borderRadius["DEFAULT"]}; + border-radius: ${theme.borderRadius['DEFAULT']}; background-color: ${theme.colors.code}; } @@ -66,8 +66,8 @@ export default defineConfig({ .dark code { background-color: ${theme.colors.codeDark}; } - `, - }, + ` + } ], shortcuts: { btn: `select-none outline-none shadow-md p-2 rd-1 text-primaryText border-none font-400 dark:font-600 @@ -81,20 +81,20 @@ export default defineConfig({ note: `decoration-none flex-inline items-center relative p-2 rd-1 border-l-4 border-accent dark:border-darkAccent bg-accent/10 dark:bg-darkAccent/10`, - "note-red": - "note bg-red-700/10 dark:bg-red-700/10 after:bg-red-700 dark:after:bg-red-700", + 'note-red': + 'note bg-red-700/10 dark:bg-red-700/10 after:bg-red-700 dark:after:bg-red-700', input: - "h-10 flex items-center outline-none border-none p-2 rd-1 shadow-md bg-primaryLighter dark:bg-darkPrimaryLighter text-primaryText dark:text-darkPrimaryText", + 'h-10 flex items-center outline-none border-none p-2 rd-1 shadow-md bg-primaryLighter dark:bg-darkPrimaryLighter text-primaryText dark:text-darkPrimaryText' }, presets: [ presetUno(), presetIcons(), presetWebFonts({ fonts: { - sans: "Rubik", - mono: ["Fira Code", "Fira Mono:400,700"], - }, - }), + sans: 'Rubik', + mono: ['Fira Code', 'Fira Mono:400,700'] + } + }) ], - extractors: [extractorSvelte], -}); + extractors: [extractorSvelte] +}) diff --git a/examples/api/vite.config.js b/examples/api/vite.config.js index e86960b4..f7d87db8 100644 --- a/examples/api/vite.config.js +++ b/examples/api/vite.config.js @@ -2,19 +2,15 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { defineConfig } from "vite"; -import Unocss from "unocss/vite"; -import { svelte } from "@sveltejs/vite-plugin-svelte"; -import { internalIpV4 } from "internal-ip"; -import process from "process"; +import { defineConfig } from 'vite' +import Unocss from 'unocss/vite' +import { svelte } from '@sveltejs/vite-plugin-svelte' +import process from 'process' + +const host = process.env.TAURI_DEV_HOST // https://vitejs.dev/config/ export default defineConfig(async () => { - const host = - process.env.TAURI_ENV_PLATFORM === "android" || - process.env.TAURI_ENV_PLATFORM === "ios" - ? await internalIpV4() - : "localhost"; return { plugins: [Unocss(), svelte()], build: { @@ -22,22 +18,17 @@ export default defineConfig(async () => { output: { entryFileNames: `assets/[name].js`, chunkFileNames: `assets/[name].js`, - assetFileNames: `assets/[name].[ext]`, - }, - }, + assetFileNames: `assets/[name].[ext]` + } + } }, server: { - host: "0.0.0.0", + host: host || false, port: 5173, strictPort: true, - hmr: { - protocol: "ws", - host, - port: 5183, - }, fs: { - allow: [".", "../../tooling/api/dist"], - }, - }, - }; -}); + allow: ['.', '../../tooling/api/dist'] + } + } + } +}) diff --git a/package.json b/package.json index 90d7d6de..1bf5058f 100644 --- a/package.json +++ b/package.json @@ -1,44 +1,39 @@ { "name": "plugins-workspace", "private": true, - "license": "MIT or APACHE-2.0", + "license": "MIT OR Apache-2.0", "type": "module", "scripts": { "build": "pnpm run -r --parallel --filter !plugins-workspace --filter !\"./plugins/*/examples/**\" --filter !\"./examples/*\" build", "lint": "eslint .", - "format": "prettier --write \"./**/*.{cjs,mjs,js,jsx,mts,ts,tsx,html,css,json}\" --ignore-path .prettierignore", - "format-check": "prettier --check \"./**/*.{cjs,mjs,js,jsx,mts,ts,tsx,html,css,json}\" --ignore-path .prettierignore" + "format": "prettier --write .", + "format:check": "prettier --check .", + "example:api:dev": "pnpm run --filter \"api\" tauri dev" }, "devDependencies": { - "@rollup/plugin-node-resolve": "15.2.3", + "@eslint/js": "9.25.1", + "@rollup/plugin-node-resolve": "16.0.1", "@rollup/plugin-terser": "0.4.4", - "@rollup/plugin-typescript": "11.1.6", - "@typescript-eslint/eslint-plugin": "6.20.0", - "@typescript-eslint/parser": "6.20.0", - "covector": "^0.10.2", - "eslint": "8.56.0", - "eslint-config-prettier": "9.1.0", - "eslint-config-standard-with-typescript": "43.0.1", - "eslint-plugin-import": "2.29.1", - "eslint-plugin-n": "16.6.2", - "eslint-plugin-promise": "6.1.1", - "eslint-plugin-security": "2.1.0", - "prettier": "3.2.2", - "rollup": "4.9.6", - "typescript": "5.3.3" + "@rollup/plugin-typescript": "12.1.2", + "covector": "^0.12.4", + "eslint": "9.25.1", + "eslint-config-prettier": "10.1.2", + "eslint-plugin-security": "3.0.1", + "prettier": "3.5.3", + "rollup": "4.40.1", + "tslib": "2.8.1", + "typescript": "5.8.3", + "typescript-eslint": "8.31.0" }, - "resolutions": { - "semver": ">=7.5.2", - "optionator": ">=0.9.3" + "pnpm": { + "overrides": { + "esbuild@<0.25.0": ">=0.25.0" + }, + "onlyBuiltDependencies": [ + "esbuild" + ] }, "engines": { - "pnpm": ">=7.33.1" - }, - "pnpm": { - "auditConfig": { - "ignoreCves": [ - "CVE-2023-46115" - ] - } + "pnpm": "^10.0.0" } } diff --git a/plugins/authenticator/.gitignore b/plugins/authenticator/.gitignore deleted file mode 100644 index b512c09d..00000000 --- a/plugins/authenticator/.gitignore +++ /dev/null @@ -1 +0,0 @@ -node_modules \ No newline at end of file diff --git a/plugins/authenticator/CHANGELOG.md b/plugins/authenticator/CHANGELOG.md deleted file mode 100644 index 84b71e6f..00000000 --- a/plugins/authenticator/CHANGELOG.md +++ /dev/null @@ -1,44 +0,0 @@ -# Changelog - -## \[2.0.0-beta.1] - -- [`569defb`](https://github.com/tauri-apps/plugins-workspace/commit/569defbe9492e38938554bb7bdc1be9151456d21) Update to tauri beta.4. - -## \[2.0.0-beta.0] - -- [`d198c01`](https://github.com/tauri-apps/plugins-workspace/commit/d198c014863ee260cb0de88a14b7fc4356ef7474)([#862](https://github.com/tauri-apps/plugins-workspace/pull/862)) Update to tauri beta. - -## \[2.0.0-alpha.5] - -- [`387c2f9`](https://github.com/tauri-apps/plugins-workspace/commit/387c2f9e0ce4c75c07ffa3fd76391a25b58f5daf)([#802](https://github.com/tauri-apps/plugins-workspace/pull/802)) Update to @tauri-apps/api v2.0.0-alpha.13. - -## \[2.0.0-alpha.4] - -- [`387c2f9`](https://github.com/tauri-apps/plugins-workspace/commit/387c2f9e0ce4c75c07ffa3fd76391a25b58f5daf)([#802](https://github.com/tauri-apps/plugins-workspace/pull/802)) Update to @tauri-apps/api v2.0.0-alpha.12. - -## \[2.0.0-alpha.3] - -- [`e438e0a`](https://github.com/tauri-apps/plugins-workspace/commit/e438e0a62d4b430a5159f05f13ecd397dd891a0d)([#676](https://github.com/tauri-apps/plugins-workspace/pull/676)) Update to @tauri-apps/api v2.0.0-alpha.11. - -## \[2.0.0-alpha.2] - -- [`5c13736`](https://github.com/tauri-apps/plugins-workspace/commit/5c137365c60790e8d4037d449e8237aa3fffdab0)([#673](https://github.com/tauri-apps/plugins-workspace/pull/673)) Update to @tauri-apps/api v2.0.0-alpha.9. - -## \[2.0.0-alpha.2] - -- [`4e2cef9`](https://github.com/tauri-apps/plugins-workspace/commit/4e2cef9b702bbbb9cf4ee17de50791cb21f1b2a4)([#593](https://github.com/tauri-apps/plugins-workspace/pull/593)) Update to alpha.12. - -## \[2.0.0-alpha.1] - -- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11. - -## \[2.0.0-alpha.0] - -- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - te to alpha.11. - -## \[2.0.0-alpha.0] - -- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - ae67\`]\(https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! -717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/authenticator/Cargo.toml b/plugins/authenticator/Cargo.toml deleted file mode 100644 index 9963b63e..00000000 --- a/plugins/authenticator/Cargo.toml +++ /dev/null @@ -1,37 +0,0 @@ -[package] -name = "tauri-plugin-authenticator" -version = "2.0.0-beta.1" -description = "Use hardware security-keys in your Tauri App." -authors = { workspace = true } -license = { workspace = true } -edition = { workspace = true } -rust-version = { workspace = true } -links = "tauri-plugin-authenticator" - -[package.metadata.docs.rs] -rustc-args = [ "--cfg", "docsrs" ] -rustdoc-args = [ "--cfg", "docsrs" ] - -[build-dependencies] -tauri-plugin = { workspace = true, features = [ "build" ] } - -[dependencies] -serde = { workspace = true } -serde_json = { workspace = true } -tauri = { workspace = true } -log = { workspace = true } -thiserror = { workspace = true } - -[target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies] -authenticator = "0.3.1" -once_cell = "1" -sha2 = "0.10" -base64 = "0.21" -chrono = "0.4" -bytes = "1" -byteorder = "1" -openssl = "0.10" - -[dev-dependencies] -rand = "0.8" -rusty-fork = "0.3" diff --git a/plugins/authenticator/README.md b/plugins/authenticator/README.md deleted file mode 100644 index 13c75a5f..00000000 --- a/plugins/authenticator/README.md +++ /dev/null @@ -1,143 +0,0 @@ -![plugin-authenticator](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/authenticator/banner.png) - -Use hardware security-keys in your Tauri App. - -- Supported platforms: Windows, Linux, FreeBSD, NetBSD, OpenBSD, and macOS. - -## Install - -_This plugin requires a Rust version of at least **1.75**_ - -There are three general methods of installation that we can recommend. - -1. Use crates.io and npm (easiest and requires you to trust that our publishing pipeline worked) -2. Pull sources directly from Github using git tags / revision hashes (most secure) -3. Git submodule install this repo in your tauri project and then use the file protocol to ingest the source (most secure, but inconvenient to use) - -Install the authenticator plugin by adding the following lines to your `Cargo.toml` file: - -`src-tauri/Cargo.toml` - -```toml -# you can add the dependencies on the `[dependencies]` section if you do not target mobile -[target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies] -tauri-plugin-authenticator = "2.0.0-beta" -# alternatively with Git: -tauri-plugin-authenticator = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } -``` - -You can install the JavaScript Guest bindings using your preferred JavaScript package manager: - -> Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use. - -```sh -pnpm add @tauri-apps/plugin-authenticator -# or -npm add @tauri-apps/plugin-authenticator -# or -yarn add @tauri-apps/plugin-authenticator -``` - -Alternatively with Git: - -```sh -pnpm add https://github.com/tauri-apps/tauri-plugin-authenticator#v2 -# or -npm add https://github.com/tauri-apps/tauri-plugin-authenticator#v2 -# or -yarn add https://github.com/tauri-apps/tauri-plugin-authenticator#v2 -``` - -## Usage - -First, you need to register the authenticator plugin with Tauri: - -`src-tauri/src/main.rs` - -```rust -fn main() { - tauri::Builder::default() - .setup(|app| { - #[cfg(desktop)] - app.handle().plugin(tauri_plugin_authenticator::init())?; - Ok(()) - }) - .run(tauri::generate_context!()) - .expect("error while running tauri application"); -} -``` - -Afterwards, all the plugin's APIs are available through the JavaScript guest bindings: - -```javascript -import { Authenticator } from "@tauri-apps/plugin-authenticator"; - -const auth = new Authenticator(); -auth.init(); // initialize transports - -// generate a 32-bytes long random challenge -const arr = new Uint32Array(32); -window.crypto.getRandomValues(arr); -const b64 = btoa(String.fromCharCode.apply(null, arr)); -// web-safe base64 -const challenge = b64.replace(/\+/g, "-").replace(/\//g, "_"); - -const domain = "https://tauri.app"; - -// attempt to register with the security key -const json = await auth.register(challenge, domain); -const registerResult = JSON.parse(json); - -// verify the registration was successful -const r2 = await auth.verifyRegistration( - challenge, - app, - registerResult.registerData, - registerResult.clientData, -); -const j2 = JSON.parse(r2); - -// sign some data -const json = await auth.sign(challenge, app, keyHandle); -const signData = JSON.parse(json); - -// verify the signature again -const counter = await auth.verifySignature( - challenge, - app, - signData.signData, - clientData, - keyHandle, - pubkey, -); - -if (counter && counter > 0) { - console.log("SUCCESS!"); -} -``` - -## Contributing - -PRs accepted. Please make sure to read the Contributing Guide before making a pull request. - -## Partners - - - - - - - -
- - CrabNebula - -
- -For the complete list of sponsors please visit our [website](https://tauri.app#sponsors) and [Open Collective](https://opencollective.com/tauri). - -## License - -Code: (c) 2015 - Present - The Tauri Programme within The Commons Conservancy. - -MIT or MIT/Apache 2.0 where applicable. diff --git a/plugins/authenticator/banner.png b/plugins/authenticator/banner.png deleted file mode 100644 index 405dc601..00000000 Binary files a/plugins/authenticator/banner.png and /dev/null differ diff --git a/plugins/authenticator/build.rs b/plugins/authenticator/build.rs deleted file mode 100644 index 993df57a..00000000 --- a/plugins/authenticator/build.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 - -const COMMANDS: &[&str] = &[ - "init_auth", - "register", - "verify_registration", - "sign", - "verify_signature", -]; - -fn main() { - tauri_plugin::Builder::new(COMMANDS).build(); -} diff --git a/plugins/authenticator/guest-js/index.ts b/plugins/authenticator/guest-js/index.ts deleted file mode 100644 index b1446eea..00000000 --- a/plugins/authenticator/guest-js/index.ts +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2019-2023 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT - -import { invoke } from "@tauri-apps/api/core"; - -export class Authenticator { - async init(): Promise { - return await invoke("plugin:authenticator|init_auth"); - } - - async register(challenge: string, application: string): Promise { - return await invoke("plugin:authenticator|register", { - timeout: 10000, - challenge, - application, - }); - } - - async verifyRegistration( - challenge: string, - application: string, - registerData: string, - clientData: string, - ): Promise { - return await invoke("plugin:authenticator|verify_registration", { - challenge, - application, - registerData, - clientData, - }); - } - - async sign( - challenge: string, - application: string, - keyHandle: string, - ): Promise { - return await invoke("plugin:authenticator|sign", { - timeout: 10000, - challenge, - application, - keyHandle, - }); - } - - async verifySignature( - challenge: string, - application: string, - signData: string, - clientData: string, - keyHandle: string, - pubkey: string, - ): Promise { - return await invoke("plugin:authenticator|verify_signature", { - challenge, - application, - signData, - clientData, - keyHandle, - pubkey, - }); - } -} diff --git a/plugins/authenticator/permissions/autogenerated/commands/init_auth.toml b/plugins/authenticator/permissions/autogenerated/commands/init_auth.toml deleted file mode 100644 index 4781773e..00000000 --- a/plugins/authenticator/permissions/autogenerated/commands/init_auth.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-init-auth" -description = "Enables the init_auth command without any pre-configured scope." -commands.allow = ["init_auth"] - -[[permission]] -identifier = "deny-init-auth" -description = "Denies the init_auth command without any pre-configured scope." -commands.deny = ["init_auth"] diff --git a/plugins/authenticator/permissions/autogenerated/commands/sign.toml b/plugins/authenticator/permissions/autogenerated/commands/sign.toml deleted file mode 100644 index f8b6a778..00000000 --- a/plugins/authenticator/permissions/autogenerated/commands/sign.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-sign" -description = "Enables the sign command without any pre-configured scope." -commands.allow = ["sign"] - -[[permission]] -identifier = "deny-sign" -description = "Denies the sign command without any pre-configured scope." -commands.deny = ["sign"] diff --git a/plugins/authenticator/permissions/autogenerated/commands/verify_registration.toml b/plugins/authenticator/permissions/autogenerated/commands/verify_registration.toml deleted file mode 100644 index f6b15d58..00000000 --- a/plugins/authenticator/permissions/autogenerated/commands/verify_registration.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-verify-registration" -description = "Enables the verify_registration command without any pre-configured scope." -commands.allow = ["verify_registration"] - -[[permission]] -identifier = "deny-verify-registration" -description = "Denies the verify_registration command without any pre-configured scope." -commands.deny = ["verify_registration"] diff --git a/plugins/authenticator/permissions/autogenerated/commands/verify_signature.toml b/plugins/authenticator/permissions/autogenerated/commands/verify_signature.toml deleted file mode 100644 index 90b24095..00000000 --- a/plugins/authenticator/permissions/autogenerated/commands/verify_signature.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-verify-signature" -description = "Enables the verify_signature command without any pre-configured scope." -commands.allow = ["verify_signature"] - -[[permission]] -identifier = "deny-verify-signature" -description = "Denies the verify_signature command without any pre-configured scope." -commands.deny = ["verify_signature"] diff --git a/plugins/authenticator/permissions/autogenerated/reference.md b/plugins/authenticator/permissions/autogenerated/reference.md deleted file mode 100644 index 8e3cbb52..00000000 --- a/plugins/authenticator/permissions/autogenerated/reference.md +++ /dev/null @@ -1,42 +0,0 @@ -# Permissions - -## allow-init-auth - -Enables the init_auth command without any pre-configured scope. - -## deny-init-auth - -Denies the init_auth command without any pre-configured scope. - -## allow-register - -Enables the register command without any pre-configured scope. - -## deny-register - -Denies the register command without any pre-configured scope. - -## allow-sign - -Enables the sign command without any pre-configured scope. - -## deny-sign - -Denies the sign command without any pre-configured scope. - -## allow-verify-registration - -Enables the verify_registration command without any pre-configured scope. - -## deny-verify-registration - -Denies the verify_registration command without any pre-configured scope. - -## allow-verify-signature - -Enables the verify_signature command without any pre-configured scope. - -## deny-verify-signature - -Denies the verify_signature command without any pre-configured scope. - diff --git a/plugins/authenticator/src/api-iife.js b/plugins/authenticator/src/api-iife.js deleted file mode 100644 index 5a3ceb7d..00000000 --- a/plugins/authenticator/src/api-iife.js +++ /dev/null @@ -1 +0,0 @@ -if("__TAURI__"in window){var __TAURI_PLUGIN_AUTHENTICATOR__=function(t){"use strict";async function i(t,i={},a){return window.__TAURI_INTERNALS__.invoke(t,i,a)}"function"==typeof SuppressedError&&SuppressedError;return t.Authenticator=class{async init(){return await i("plugin:authenticator|init_auth")}async register(t,a){return await i("plugin:authenticator|register",{timeout:1e4,challenge:t,application:a})}async verifyRegistration(t,a,e,n){return await i("plugin:authenticator|verify_registration",{challenge:t,application:a,registerData:e,clientData:n})}async sign(t,a,e){return await i("plugin:authenticator|sign",{timeout:1e4,challenge:t,application:a,keyHandle:e})}async verifySignature(t,a,e,n,r,u){return await i("plugin:authenticator|verify_signature",{challenge:t,application:a,signData:e,clientData:n,keyHandle:r,pubkey:u})}},t}({});Object.defineProperty(window.__TAURI__,"authenticator",{value:__TAURI_PLUGIN_AUTHENTICATOR__})} diff --git a/plugins/authenticator/src/auth.rs b/plugins/authenticator/src/auth.rs deleted file mode 100644 index 34bc332b..00000000 --- a/plugins/authenticator/src/auth.rs +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright 2019-2023 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT - -use authenticator::{ - authenticatorservice::AuthenticatorService, statecallback::StateCallback, - AuthenticatorTransports, KeyHandle, RegisterFlags, SignFlags, StatusUpdate, -}; -use base64::{engine::general_purpose::URL_SAFE_NO_PAD, Engine}; -use once_cell::sync::Lazy; -use serde::Serialize; -use sha2::{Digest, Sha256}; -use std::io; -use std::sync::mpsc::channel; -use std::{convert::Into, sync::Mutex}; - -static MANAGER: Lazy> = Lazy::new(|| { - let manager = AuthenticatorService::new().expect("The auth service should initialize safely"); - Mutex::new(manager) -}); - -pub fn init_usb() { - let mut manager = MANAGER.lock().unwrap(); - // theres also "add_detected_transports()" in the docs? - manager.add_u2f_usb_hid_platform_transports(); -} - -#[derive(Serialize, Clone)] -#[serde(rename_all = "camelCase")] -pub struct Registration { - pub key_handle: String, - pub pubkey: String, - pub register_data: String, - pub client_data: String, -} - -pub fn register(application: String, timeout: u64, challenge: String) -> crate::Result { - let (chall_bytes, app_bytes, client_data_string) = - format_client_data(application.as_str(), challenge.as_str()); - - // log the status rx? - let (status_tx, _status_rx) = channel::(); - - let mut manager = MANAGER.lock().unwrap(); - - let (register_tx, register_rx) = channel(); - let callback = StateCallback::new(Box::new(move |rv| { - register_tx.send(rv).unwrap(); - })); - - let res = manager.register( - RegisterFlags::empty(), - timeout, - chall_bytes, - app_bytes, - vec![], - status_tx, - callback, - ); - - match res { - Ok(_r) => { - let register_result = register_rx - .recv() - .expect("Problem receiving, unable to continue"); - - if let Err(e) = register_result { - return Err(e.into()); - } - - let (register_data, device_info) = register_result.unwrap(); // error already has been checked - - // println!("Register result: {}", base64::encode(®ister_data)); - println!("Device info: {}", &device_info); - - let (key_handle, public_key) = - _u2f_get_key_handle_and_public_key_from_register_response(®ister_data).unwrap(); - let key_handle_base64 = URL_SAFE_NO_PAD.encode(key_handle); - let public_key_base64 = URL_SAFE_NO_PAD.encode(public_key); - let register_data_base64 = URL_SAFE_NO_PAD.encode(®ister_data); - println!("Key Handle: {}", &key_handle_base64); - println!("Public Key: {}", &public_key_base64); - - // Ok(base64::encode(®ister_data)) - // Ok(key_handle_base64) - let res = serde_json::to_string(&Registration { - key_handle: key_handle_base64, - pubkey: public_key_base64, - register_data: register_data_base64, - client_data: client_data_string, - })?; - Ok(res) - } - Err(e) => Err(e.into()), - } -} - -#[derive(Serialize, Clone)] -#[serde(rename_all = "camelCase")] -pub struct Signature { - pub key_handle: String, - pub sign_data: String, -} - -pub fn sign( - application: String, - timeout: u64, - challenge: String, - key_handle: String, -) -> crate::Result { - let credential = match URL_SAFE_NO_PAD.decode(key_handle) { - Ok(v) => v, - Err(e) => { - return Err(e.into()); - } - }; - let key_handle = KeyHandle { - credential, - transports: AuthenticatorTransports::empty(), - }; - - let (chall_bytes, app_bytes, _) = format_client_data(application.as_str(), challenge.as_str()); - - let (sign_tx, sign_rx) = channel(); - let callback = StateCallback::new(Box::new(move |rv| { - sign_tx.send(rv).unwrap(); - })); - - // log the status rx? - let (status_tx, _status_rx) = channel::(); - - let mut manager = MANAGER.lock().unwrap(); - - let res = manager.sign( - SignFlags::empty(), - timeout, - chall_bytes, - vec![app_bytes], - vec![key_handle], - status_tx, - callback, - ); - match res { - Ok(_v) => { - let sign_result = sign_rx - .recv() - .expect("Problem receiving, unable to continue"); - - if let Err(e) = sign_result { - return Err(e.into()); - } - - let (_, handle_used, sign_data, device_info) = sign_result.unwrap(); - - let sig = URL_SAFE_NO_PAD.encode(sign_data); - - println!("Sign result: {sig}"); - println!("Key handle used: {}", URL_SAFE_NO_PAD.encode(&handle_used)); - println!("Device info: {}", &device_info); - println!("Done."); - - let res = serde_json::to_string(&Signature { - sign_data: sig, - key_handle: URL_SAFE_NO_PAD.encode(&handle_used), - })?; - Ok(res) - } - Err(e) => Err(e.into()), - } -} - -fn format_client_data(application: &str, challenge: &str) -> (Vec, Vec, String) { - let d = - format!(r#"{{"challenge": "{challenge}", "version": "U2F_V2", "appId": "{application}"}}"#); - let mut challenge = Sha256::new(); - challenge.update(d.as_bytes()); - let chall_bytes = challenge.finalize().to_vec(); - - let mut app = Sha256::new(); - app.update(application.as_bytes()); - let app_bytes = app.finalize().to_vec(); - - (chall_bytes, app_bytes, d) -} - -fn _u2f_get_key_handle_and_public_key_from_register_response( - register_response: &[u8], -) -> io::Result<(Vec, Vec)> { - if register_response[0] != 0x05 { - return Err(io::Error::new( - io::ErrorKind::InvalidData, - "Reserved byte not set correctly", - )); - } - - // 1: reserved - // 65: public key - // 1: key handle length - // key handle - // x.509 cert - // sig - - let key_handle_len = register_response[66] as usize; - let mut public_key = register_response.to_owned(); - let mut key_handle = public_key.split_off(67); - let _attestation = key_handle.split_off(key_handle_len); - - // remove fist (reserved) and last (handle len) bytes - let pk: Vec = public_key[1..public_key.len() - 1].to_vec(); - - Ok((key_handle, pk)) -} diff --git a/plugins/authenticator/src/lib.rs b/plugins/authenticator/src/lib.rs deleted file mode 100644 index b9979b7f..00000000 --- a/plugins/authenticator/src/lib.rs +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2019-2023 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT - -//! [![](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/authenticator/banner.png)](https://github.com/tauri-apps/plugins-workspace/tree/v2/plugins/authenticator) -//! -//! Use hardware security-keys in your Tauri App. -//! -//! - Supported platforms: Windows, Linux, FreeBSD, NetBSD, OpenBSD, and macOS. - -#![doc( - html_logo_url = "https://github.com/tauri-apps/tauri/raw/dev/app-icon.png", - html_favicon_url = "https://github.com/tauri-apps/tauri/raw/dev/app-icon.png" -)] -#![cfg(not(any(target_os = "android", target_os = "ios")))] - -mod auth; -mod error; -mod u2f; -mod u2f_crate; - -use tauri::{ - plugin::{Builder as PluginBuilder, TauriPlugin}, - Runtime, -}; - -pub use error::Error; -type Result = std::result::Result; - -#[tauri::command] -fn init_auth() { - auth::init_usb(); -} - -#[tauri::command] -fn register(timeout: u64, challenge: String, application: String) -> crate::Result { - auth::register(application, timeout, challenge) -} - -#[tauri::command] -fn verify_registration( - challenge: String, - application: String, - register_data: String, - client_data: String, -) -> crate::Result { - u2f::verify_registration(application, challenge, register_data, client_data) -} - -#[tauri::command] -fn sign( - timeout: u64, - challenge: String, - application: String, - key_handle: String, -) -> crate::Result { - auth::sign(application, timeout, challenge, key_handle) -} - -#[tauri::command] -fn verify_signature( - challenge: String, - application: String, - sign_data: String, - client_data: String, - key_handle: String, - pubkey: String, -) -> crate::Result { - u2f::verify_signature( - application, - challenge, - sign_data, - client_data, - key_handle, - pubkey, - ) -} - -pub fn init() -> TauriPlugin { - PluginBuilder::new("authenticator") - .js_init_script(include_str!("api-iife.js").to_string()) - .invoke_handler(tauri::generate_handler![ - init_auth, - register, - verify_registration, - sign, - verify_signature - ]) - .build() -} diff --git a/plugins/authenticator/src/u2f.rs b/plugins/authenticator/src/u2f.rs deleted file mode 100644 index 9e246094..00000000 --- a/plugins/authenticator/src/u2f.rs +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright 2019-2023 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT - -use crate::u2f_crate::messages::*; -use crate::u2f_crate::protocol::*; -use crate::u2f_crate::register::*; -use base64::{engine::general_purpose::URL_SAFE_NO_PAD, Engine}; -use chrono::prelude::*; -use serde::Serialize; -use std::convert::Into; - -static VERSION: &str = "U2F_V2"; - -pub fn make_challenge(app_id: &str, challenge_bytes: Vec) -> Challenge { - let utc: DateTime = Utc::now(); - Challenge { - challenge: URL_SAFE_NO_PAD.encode(challenge_bytes), - timestamp: format!("{utc:?}"), - app_id: app_id.to_string(), - } -} - -#[derive(Serialize, Clone)] -#[serde(rename_all = "camelCase")] -pub struct RegistrationVerification { - pub key_handle: String, - pub pubkey: String, - pub device_name: Option, -} - -pub fn verify_registration( - app_id: String, - challenge: String, - register_data: String, - client_data: String, -) -> crate::Result { - let challenge_bytes = URL_SAFE_NO_PAD.decode(challenge)?; - let challenge = make_challenge(&app_id, challenge_bytes); - let client_data_bytes: Vec = client_data.as_bytes().into(); - let client_data_base64 = URL_SAFE_NO_PAD.encode(client_data_bytes); - let client = U2f::new(app_id); - match client.register_response( - challenge, - RegisterResponse { - registration_data: register_data, - client_data: client_data_base64, - version: VERSION.to_string(), - }, - ) { - Ok(v) => { - let rv = RegistrationVerification { - key_handle: URL_SAFE_NO_PAD.encode(&v.key_handle), - pubkey: URL_SAFE_NO_PAD.encode(&v.pub_key), - device_name: v.device_name, - }; - Ok(serde_json::to_string(&rv)?) - } - Err(e) => Err(e.into()), - } -} - -#[derive(Serialize, Clone)] -#[serde(rename_all = "camelCase")] -pub struct SignatureVerification { - pub counter: u8, -} - -pub fn verify_signature( - app_id: String, - challenge: String, - sign_data: String, - client_data: String, - key_handle: String, - pub_key: String, -) -> crate::Result { - let challenge_bytes = URL_SAFE_NO_PAD.decode(challenge)?; - let chal = make_challenge(&app_id, challenge_bytes); - let client_data_bytes: Vec = client_data.as_bytes().into(); - let client_data_base64 = URL_SAFE_NO_PAD.encode(client_data_bytes); - let key_handle_bytes = URL_SAFE_NO_PAD.decode(&key_handle)?; - let pubkey_bytes = URL_SAFE_NO_PAD.decode(pub_key)?; - let client = U2f::new(app_id); - let mut _counter: u32 = 0; - match client.sign_response( - chal, - Registration { - // here only needs pubkey and keyhandle - key_handle: key_handle_bytes, - pub_key: pubkey_bytes, - attestation_cert: None, - device_name: None, - }, - SignResponse { - // here needs client data and sig data and key_handle - signature_data: sign_data, - client_data: client_data_base64, - key_handle, - }, - _counter, - ) { - Ok(v) => Ok(v), - Err(e) => Err(e.into()), - } -} diff --git a/plugins/authenticator/src/u2f_crate/LICENSE b/plugins/authenticator/src/u2f_crate/LICENSE deleted file mode 100644 index d26d5f6c..00000000 --- a/plugins/authenticator/src/u2f_crate/LICENSE +++ /dev/null @@ -1,8 +0,0 @@ -Copyright (c) 2017 - -Licensed under either of - - * Apache License, Version 2.0, (http://www.apache.org/licenses/LICENSE-2.0) - * MIT license (http://opensource.org/licenses/MIT) - -at your option. \ No newline at end of file diff --git a/plugins/authenticator/src/u2f_crate/authorization.rs b/plugins/authenticator/src/u2f_crate/authorization.rs deleted file mode 100644 index 0e667ea6..00000000 --- a/plugins/authenticator/src/u2f_crate/authorization.rs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2021 Flavio Oliveira -// Copyright 2019-2023 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT - -use bytes::{Buf, BufMut}; -use openssl::sha::sha256; -use serde::Serialize; -use std::io::Cursor; - -use crate::u2f_crate::u2ferror::U2fError; - -/// The `Result` type used in this crate. -type Result = ::std::result::Result; - -#[derive(Serialize, Clone)] -#[serde(rename_all = "camelCase")] -pub struct Authorization { - pub counter: u32, - pub user_presence: bool, -} - -pub fn parse_sign_response( - app_id: String, - client_data: Vec, - public_key: Vec, - sign_data: Vec, -) -> Result { - if sign_data.len() <= 5 { - return Err(U2fError::InvalidSignatureData); - } - - let user_presence_flag = &sign_data[0]; - let counter = &sign_data[1..=4]; - let signature = &sign_data[5..]; - - // Let's build the msg to verify the signature - let app_id_hash = sha256(&app_id.into_bytes()); - let client_data_hash = sha256(&client_data[..]); - - let mut msg = vec![]; - msg.put(app_id_hash.as_ref()); - msg.put_u8(*user_presence_flag); - msg.put(counter); - msg.put(client_data_hash.as_ref()); - - let public_key = super::crypto::NISTP256Key::from_bytes(&public_key)?; - - // The signature is to be verified by the relying party using the public key obtained during registration. - let verified = public_key.verify_signature(signature, msg.as_ref())?; - if !verified { - return Err(U2fError::BadSignature); - } - - let authorization = Authorization { - counter: get_counter(counter), - user_presence: true, - }; - - Ok(authorization) -} - -fn get_counter(counter: &[u8]) -> u32 { - let mut buf = Cursor::new(counter); - buf.get_u32() -} diff --git a/plugins/authenticator/src/u2f_crate/crypto.rs b/plugins/authenticator/src/u2f_crate/crypto.rs deleted file mode 100644 index ddcdf1b6..00000000 --- a/plugins/authenticator/src/u2f_crate/crypto.rs +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright 2021 Flavio Oliveira -// Copyright 2019-2023 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT - -//! Cryptographic operation wrapper for Webauthn. This module exists to -//! allow ease of auditing, safe operation wrappers for the webauthn library, -//! and cryptographic provider abstraction. This module currently uses OpenSSL -//! as the cryptographic primitive provider. - -// Source can be found here: https://github.com/Firstyear/webauthn-rs/blob/master/src/crypto.rs - -#![allow(non_camel_case_types)] - -use openssl::{bn, ec, hash, nid, sign, x509}; -use std::convert::TryFrom; - -// use super::constants::*; -use crate::u2f_crate::u2ferror::U2fError; -use openssl::pkey::Public; - -// use super::proto::*; - -// Why OpenSSL over another rust crate? -// - Well, the openssl crate allows us to reconstruct a public key from the -// x/y group coords, where most others want a pkcs formatted structure. As -// a result, it's easiest to use openssl as it gives us exactly what we need -// for these operations, and despite it's many challenges as a library, it -// has resources and investment into it's maintenance, so we can a least -// assert a higher level of confidence in it that . - -// Object({Integer(-3): Bytes([48, 185, 178, 204, 113, 186, 105, 138, 190, 33, 160, 46, 131, 253, 100, 177, 91, 243, 126, 128, 245, 119, 209, 59, 186, 41, 215, 196, 24, 222, 46, 102]), Integer(-2): Bytes([158, 212, 171, 234, 165, 197, 86, 55, 141, 122, 253, 6, 92, 242, 242, 114, 158, 221, 238, 163, 127, 214, 120, 157, 145, 226, 232, 250, 144, 150, 218, 138]), Integer(-1): U64(1), Integer(1): U64(2), Integer(3): I64(-7)}) -// - -/// An X509PublicKey. This is what is otherwise known as a public certificate -/// which comprises a public key and other signed metadata related to the issuer -/// of the key. -pub struct X509PublicKey { - pubk: x509::X509, -} - -impl std::fmt::Debug for X509PublicKey { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - write!(f, "X509PublicKey") - } -} - -impl TryFrom<&[u8]> for X509PublicKey { - type Error = U2fError; - - // Must be DER bytes. If you have PEM, base64decode first! - fn try_from(d: &[u8]) -> Result { - let pubk = x509::X509::from_der(d)?; - Ok(X509PublicKey { pubk }) - } -} - -impl X509PublicKey { - pub(crate) fn common_name(&self) -> Option { - let cert = &self.pubk; - - let subject = cert.subject_name(); - let common = subject - .entries_by_nid(openssl::nid::Nid::COMMONNAME) - .next() - .map(|b| b.data().as_slice()); - - if let Some(common) = common { - std::str::from_utf8(common).ok().map(|s| s.to_string()) - } else { - None - } - } - - pub(crate) fn is_secp256r1(&self) -> Result { - // Can we get the public key? - let pk = self.pubk.public_key()?; - - let ec_key = pk.ec_key()?; - - ec_key.check_key()?; - - let ec_grpref = ec_key.group(); - - let ec_curve = ec_grpref.curve_name().ok_or(U2fError::OpenSSLNoCurveName)?; - - Ok(ec_curve == nid::Nid::X9_62_PRIME256V1) - } - - pub(crate) fn verify_signature( - &self, - signature: &[u8], - verification_data: &[u8], - ) -> Result { - let pkey = self.pubk.public_key()?; - - // TODO: Should this determine the hash type from the x509 cert? Or other? - let mut verifier = sign::Verifier::new(hash::MessageDigest::sha256(), &pkey)?; - verifier.update(verification_data)?; - Ok(verifier.verify(signature)?) - } -} - -pub struct NISTP256Key { - /// The key's public X coordinate. - pub x: [u8; 32], - /// The key's public Y coordinate. - pub y: [u8; 32], -} - -impl NISTP256Key { - pub fn from_bytes(public_key_bytes: &[u8]) -> Result { - if public_key_bytes.len() != 65 { - return Err(U2fError::InvalidPublicKey); - } - - if public_key_bytes[0] != 0x04 { - return Err(U2fError::InvalidPublicKey); - } - - let mut x: [u8; 32] = Default::default(); - x.copy_from_slice(&public_key_bytes[1..=32]); - - let mut y: [u8; 32] = Default::default(); - y.copy_from_slice(&public_key_bytes[33..=64]); - - Ok(NISTP256Key { x, y }) - } - - fn get_key(&self) -> Result, U2fError> { - let ec_group = ec::EcGroup::from_curve_name(openssl::nid::Nid::X9_62_PRIME256V1)?; - - let xbn = bn::BigNum::from_slice(&self.x)?; - let ybn = bn::BigNum::from_slice(&self.y)?; - - let ec_key = openssl::ec::EcKey::from_public_key_affine_coordinates(&ec_group, &xbn, &ybn)?; - - // Validate the key is sound. IIRC this actually checks the values - // are correctly on the curve as specified - ec_key.check_key()?; - - Ok(ec_key) - } - - pub fn verify_signature( - &self, - signature: &[u8], - verification_data: &[u8], - ) -> Result { - let pkey = self.get_key()?; - - let signature = openssl::ecdsa::EcdsaSig::from_der(signature)?; - let hash = openssl::sha::sha256(verification_data); - - Ok(signature.verify(hash.as_ref(), &pkey)?) - } -} diff --git a/plugins/authenticator/src/u2f_crate/messages.rs b/plugins/authenticator/src/u2f_crate/messages.rs deleted file mode 100644 index be22f965..00000000 --- a/plugins/authenticator/src/u2f_crate/messages.rs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2021 Flavio Oliveira -// Copyright 2019-2023 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT - -// As defined by FIDO U2F Javascript API. -// https://fidoalliance.org/specs/fido-u2f-v1.0-nfc-bt-amendment-20150514/fido-u2f-javascript-api.html#registration - -use serde::{Deserialize, Serialize}; - -#[derive(Serialize)] -#[serde(rename_all = "camelCase")] -pub struct U2fRegisterRequest { - pub app_id: String, - pub register_requests: Vec, - pub registered_keys: Vec, -} - -#[derive(Serialize)] -pub struct RegisterRequest { - pub version: String, - pub challenge: String, -} - -#[derive(Serialize)] -#[serde(rename_all = "camelCase")] -pub struct RegisteredKey { - pub version: String, - pub key_handle: Option, - pub app_id: String, -} - -#[derive(Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct RegisterResponse { - pub registration_data: String, - pub version: String, - pub client_data: String, -} - -#[derive(Serialize)] -#[serde(rename_all = "camelCase")] -pub struct U2fSignRequest { - pub app_id: String, - pub challenge: String, - pub registered_keys: Vec, -} - -#[derive(Clone, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SignResponse { - pub key_handle: String, - pub signature_data: String, - pub client_data: String, -} diff --git a/plugins/authenticator/src/u2f_crate/mod.rs b/plugins/authenticator/src/u2f_crate/mod.rs deleted file mode 100644 index ab2a1e0c..00000000 --- a/plugins/authenticator/src/u2f_crate/mod.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2021 Flavio Oliveira -// Copyright 2019-2023 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT - -mod util; - -pub mod authorization; -mod crypto; -pub mod messages; -pub mod protocol; -pub mod register; -pub mod u2ferror; diff --git a/plugins/authenticator/src/u2f_crate/protocol.rs b/plugins/authenticator/src/u2f_crate/protocol.rs deleted file mode 100644 index 94ebce6f..00000000 --- a/plugins/authenticator/src/u2f_crate/protocol.rs +++ /dev/null @@ -1,192 +0,0 @@ -// Copyright 2021 Flavio Oliveira -// Copyright 2019-2023 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT - -use crate::u2f_crate::authorization::*; -use crate::u2f_crate::messages::*; -use crate::u2f_crate::register::*; -use crate::u2f_crate::u2ferror::U2fError; -use crate::u2f_crate::util::*; - -use base64::{engine::general_purpose::URL_SAFE_NO_PAD, Engine}; -use chrono::prelude::*; -use chrono::Duration; -use serde::{Deserialize, Serialize}; - -type Result = ::std::result::Result; - -#[derive(Clone)] -pub struct U2f { - app_id: String, -} - -#[derive(Deserialize, Serialize, Clone)] -#[serde(rename_all = "camelCase")] -pub struct Challenge { - pub app_id: String, - pub challenge: String, - pub timestamp: String, -} - -impl Challenge { - // Not used in this plugin. - #[allow(dead_code)] - pub fn new() -> Self { - Challenge { - app_id: String::new(), - challenge: String::new(), - timestamp: String::new(), - } - } -} - -impl U2f { - // The app ID is a string used to uniquely identify an U2F app - pub fn new(app_id: String) -> Self { - U2f { app_id } - } - - // Not used in this plugin. - #[allow(dead_code)] - pub fn generate_challenge(&self) -> Result { - let utc: DateTime = Utc::now(); - - let challenge_bytes = generate_challenge(32)?; - let challenge = Challenge { - challenge: URL_SAFE_NO_PAD.encode(challenge_bytes), - timestamp: format!("{:?}", utc), - app_id: self.app_id.clone(), - }; - - Ok(challenge.clone()) - } - - // Not used in this plugin. - #[allow(dead_code)] - pub fn request( - &self, - challenge: Challenge, - registrations: Vec, - ) -> Result { - let u2f_request = U2fRegisterRequest { - app_id: self.app_id.clone(), - register_requests: self.register_request(challenge), - registered_keys: self.registered_keys(registrations), - }; - - Ok(u2f_request) - } - - fn register_request(&self, challenge: Challenge) -> Vec { - let mut requests: Vec = vec![]; - - let request = RegisterRequest { - version: U2F_V2.into(), - challenge: challenge.challenge, - }; - requests.push(request); - - requests - } - - pub fn register_response( - &self, - challenge: Challenge, - response: RegisterResponse, - ) -> Result { - if expiration(challenge.timestamp) > Duration::seconds(300) { - return Err(U2fError::ChallengeExpired); - } - - let registration_data: Vec = URL_SAFE_NO_PAD - .decode(&response.registration_data[..]) - .unwrap(); - let client_data: Vec = URL_SAFE_NO_PAD.decode(&response.client_data[..]).unwrap(); - - parse_registration(challenge.app_id, client_data, registration_data) - } - - fn registered_keys(&self, registrations: Vec) -> Vec { - let mut keys: Vec = vec![]; - - for registration in registrations { - keys.push(get_registered_key( - self.app_id.clone(), - registration.key_handle, - )); - } - - keys - } - - // Not used in this plugin. - #[allow(dead_code)] - pub fn sign_request( - &self, - challenge: Challenge, - registrations: Vec, - ) -> U2fSignRequest { - let mut keys: Vec = vec![]; - - for registration in registrations { - keys.push(get_registered_key( - self.app_id.clone(), - registration.key_handle, - )); - } - - let signed_request = U2fSignRequest { - app_id: self.app_id.clone(), - challenge: URL_SAFE_NO_PAD.encode(challenge.challenge.as_bytes()), - registered_keys: keys, - }; - - signed_request - } - - pub fn sign_response( - &self, - challenge: Challenge, - reg: Registration, - sign_resp: SignResponse, - counter: u32, - ) -> Result { - if expiration(challenge.timestamp) > Duration::seconds(300) { - return Err(U2fError::ChallengeExpired); - } - - if sign_resp.key_handle != get_encoded(®.key_handle[..]) { - return Err(U2fError::WrongKeyHandler); - } - - let client_data: Vec = URL_SAFE_NO_PAD - .decode(&sign_resp.client_data[..]) - .map_err(|_e| U2fError::InvalidClientData)?; - let sign_data: Vec = URL_SAFE_NO_PAD - .decode(&sign_resp.signature_data[..]) - .map_err(|_e| U2fError::InvalidSignatureData)?; - - let public_key = reg.pub_key; - - let auth = parse_sign_response( - self.app_id.clone(), - client_data.clone(), - public_key, - sign_data.clone(), - ); - - match auth { - Ok(ref res) => { - // CounterTooLow is raised when the counter value received from the device is - // lower than last stored counter value. - if res.counter < counter { - Err(U2fError::CounterTooLow) - } else { - Ok(res.counter) - } - } - Err(e) => Err(e), - } - } -} diff --git a/plugins/authenticator/src/u2f_crate/register.rs b/plugins/authenticator/src/u2f_crate/register.rs deleted file mode 100644 index 6b47817d..00000000 --- a/plugins/authenticator/src/u2f_crate/register.rs +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2021 Flavio Oliveira -// Copyright 2019-2023 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT - -use byteorder::{BigEndian, ByteOrder}; -use bytes::{BufMut, Bytes}; -use openssl::sha::sha256; -use serde::Serialize; - -use crate::u2f_crate::messages::RegisteredKey; -use crate::u2f_crate::u2ferror::U2fError; -use crate::u2f_crate::util::*; -use std::convert::TryFrom; - -/// The `Result` type used in this crate. -type Result = ::std::result::Result; - -// Single enrolment or pairing between an application and a token. -#[derive(Serialize, Clone)] -#[serde(rename_all = "camelCase")] -pub struct Registration { - pub key_handle: Vec, - pub pub_key: Vec, - - // AttestationCert can be null for Authenticate requests. - pub attestation_cert: Option>, - pub device_name: Option, -} - -pub fn parse_registration( - app_id: String, - client_data: Vec, - registration_data: Vec, -) -> Result { - let reserved_byte = registration_data[0]; - if reserved_byte != 0x05 { - return Err(U2fError::InvalidReservedByte); - } - - let mut mem = Bytes::from(registration_data); - - //Start parsing ... advance the reserved byte. - let _ = mem.split_to(1); - - // P-256 NIST elliptic curve - let public_key = mem.split_to(65); - - // Key Handle - let key_handle_size = mem.split_to(1); - let key_len = BigEndian::read_uint(&key_handle_size[..], 1); - let key_handle = mem.split_to(key_len as usize); - - // The certificate length needs to be inferred by parsing. - let cert_len = asn_length(mem.clone()).unwrap(); - let attestation_certificate = mem.split_to(cert_len); - - // Remaining data corresponds to the signature - let signature = mem; - - // Let's build the msg to verify the signature - let app_id_hash = sha256(&app_id.into_bytes()); - let client_data_hash = sha256(&client_data[..]); - - let mut msg = vec![0x00]; // A byte reserved for future use [1 byte] with the value 0x00 - msg.put(app_id_hash.as_ref()); - msg.put(client_data_hash.as_ref()); - msg.put(key_handle.clone()); - msg.put(public_key.clone()); - - // The signature is to be verified by the relying party using the public key certified - // in the attestation certificate. - let cerificate_public_key = - super::crypto::X509PublicKey::try_from(&attestation_certificate[..])?; - - if !(cerificate_public_key.is_secp256r1()?) { - return Err(U2fError::BadCertificate); - } - - let verified = cerificate_public_key.verify_signature(&signature[..], &msg[..])?; - - if !verified { - return Err(U2fError::BadCertificate); - } - - let registration = Registration { - key_handle: key_handle[..].to_vec(), - pub_key: public_key[..].to_vec(), - attestation_cert: Some(attestation_certificate[..].to_vec()), - device_name: cerificate_public_key.common_name(), - }; - - Ok(registration) -} - -pub fn get_registered_key(app_id: String, key_handle: Vec) -> RegisteredKey { - RegisteredKey { - app_id, - version: U2F_V2.into(), - key_handle: Some(get_encoded(key_handle.as_slice())), - } -} diff --git a/plugins/authenticator/src/u2f_crate/u2ferror.rs b/plugins/authenticator/src/u2f_crate/u2ferror.rs deleted file mode 100644 index 377af9d8..00000000 --- a/plugins/authenticator/src/u2f_crate/u2ferror.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2021 Flavio Oliveira -// Copyright 2019-2023 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT - -use thiserror::Error; - -#[derive(Debug, Error)] -pub enum U2fError { - #[error("ASM1 Decoder error")] - Asm1DecoderError, - #[error("Not able to verify signature")] - BadSignature, - #[error("Not able to generate random bytes")] - RandomSecureBytesError, - #[error("Invalid Reserved Byte")] - InvalidReservedByte, - #[error("Challenge Expired")] - ChallengeExpired, - #[error("Wrong Key Handler")] - WrongKeyHandler, - #[error("Invalid Client Data")] - InvalidClientData, - #[error("Invalid Signature Data")] - InvalidSignatureData, - #[error("Invalid User Presence Byte")] - InvalidUserPresenceByte, - #[error("Failed to parse certificate")] - BadCertificate, - #[error("Not Trusted Anchor")] - NotTrustedAnchor, - #[error("Counter too low")] - CounterTooLow, - #[error("Invalid public key")] - OpenSSLNoCurveName, - #[error("OpenSSL no curve name")] - InvalidPublicKey, - #[error(transparent)] - OpenSSLError(#[from] openssl::error::ErrorStack), -} diff --git a/plugins/authenticator/src/u2f_crate/util.rs b/plugins/authenticator/src/u2f_crate/util.rs deleted file mode 100644 index 6a7e3fbd..00000000 --- a/plugins/authenticator/src/u2f_crate/util.rs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2021 Flavio Oliveira -// Copyright 2019-2023 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT - -use crate::u2f_crate::u2ferror::U2fError; -use base64::{engine::general_purpose::URL_SAFE_NO_PAD, Engine}; -use bytes::Bytes; -use chrono::prelude::*; -use chrono::Duration; -use openssl::rand; - -/// The `Result` type used in this crate. -type Result = ::std::result::Result; - -pub const U2F_V2: &str = "U2F_V2"; - -// Generates a challenge from a secure, random source. -pub fn generate_challenge(size: usize) -> Result> { - let mut bytes: Vec = vec![0; size]; - rand::rand_bytes(&mut bytes).map_err(|_e| U2fError::RandomSecureBytesError)?; - Ok(bytes) -} - -pub fn expiration(timestamp: String) -> Duration { - let now: DateTime = Utc::now(); - - let ts = timestamp.parse::>(); - - now.signed_duration_since(ts.unwrap()) -} - -// Decode initial bytes of buffer as ASN and return the length of the encoded structure. -// http://en.wikipedia.org/wiki/X.690 -pub fn asn_length(mem: Bytes) -> Result { - let buffer: &[u8] = &mem[..]; - - if mem.len() < 2 || buffer[0] != 0x30 { - // Type - return Err(U2fError::Asm1DecoderError); - } - - let len = buffer[1]; // Len - if len & 0x80 == 0 { - return Ok((len & 0x7f) as usize); - } - - let numbem_of_bytes = len & 0x7f; - if numbem_of_bytes == 0 { - return Err(U2fError::Asm1DecoderError); - } - - let mut length: usize = 0; - for num in 0..numbem_of_bytes { - length = length * 0x100 + (buffer[(2 + num) as usize] as usize); - } - - length += numbem_of_bytes as usize; - - Ok(length + 2) // Add the 2 initial bytes: type and length. -} - -pub fn get_encoded(data: &[u8]) -> String { - let encoded: String = URL_SAFE_NO_PAD.encode(data); - - encoded.trim_end_matches('=').to_string() -} diff --git a/plugins/autostart/.gitignore b/plugins/autostart/.gitignore deleted file mode 100644 index b512c09d..00000000 --- a/plugins/autostart/.gitignore +++ /dev/null @@ -1 +0,0 @@ -node_modules \ No newline at end of file diff --git a/plugins/autostart/CHANGELOG.md b/plugins/autostart/CHANGELOG.md index 84b71e6f..2a2f31e5 100644 --- a/plugins/autostart/CHANGELOG.md +++ b/plugins/autostart/CHANGELOG.md @@ -1,5 +1,66 @@ # Changelog +## \[2.3.0] + +- [`8ecb418a`](https://github.com/tauri-apps/plugins-workspace/commit/8ecb418a1a35d7f234dc5d833746ac2d8e062aec) ([#2569](https://github.com/tauri-apps/plugins-workspace/pull/2569)) Add a `Builder` for more flexible settings + +## \[2.2.0] + +- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other. + +## \[2.0.1] + +- [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7. + +## \[2.0.0] + +- [`e2c4dfb6`](https://github.com/tauri-apps/plugins-workspace/commit/e2c4dfb6af43e5dd8d9ceba232c315f5febd55c1) Update to tauri v2 stable release. + +## \[2.0.0-rc.1] + +- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri 2.0.0-rc.8 + +## \[2.0.0-rc.0] + +- [`9887d1`](https://github.com/tauri-apps/plugins-workspace/commit/9887d14bd0e971c4c0f5c1188fc4005d3fc2e29e) Update to tauri RC. + +## \[2.0.0-beta.8] + +- [`99d6ac0f`](https://github.com/tauri-apps/plugins-workspace/commit/99d6ac0f9506a6a4a1aa59c728157190a7441af6) ([#1606](https://github.com/tauri-apps/plugins-workspace/pull/1606) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) The JS packages now specify the *minimum* `@tauri-apps/api` version instead of a single exact version. +- [`6de87966`](https://github.com/tauri-apps/plugins-workspace/commit/6de87966ecc00ad9d91c25be452f1f46bd2b7e1f) ([#1597](https://github.com/tauri-apps/plugins-workspace/pull/1597) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Update to tauri beta.25. + +## \[2.0.0-beta.7] + +- [`22a17980`](https://github.com/tauri-apps/plugins-workspace/commit/22a17980ff4f6f8c40adb1b8f4ffc6dae2fe7e30) ([#1537](https://github.com/tauri-apps/plugins-workspace/pull/1537) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri beta.24. + +## \[2.0.0-beta.6] + +- [`76daee7a`](https://github.com/tauri-apps/plugins-workspace/commit/76daee7aafece34de3092c86e531cf9eb1138989) ([#1512](https://github.com/tauri-apps/plugins-workspace/pull/1512) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Update to tauri beta.23. + +## \[2.0.0-beta.5] + +- [`9013854f`](https://github.com/tauri-apps/plugins-workspace/commit/9013854f42a49a230b9dbb9d02774765528a923f)([#1382](https://github.com/tauri-apps/plugins-workspace/pull/1382)) Update to tauri beta.22. + +## \[2.0.0-beta.4] + +- [`430bd6f4`](https://github.com/tauri-apps/plugins-workspace/commit/430bd6f4f379bee5d232ae6b098ae131db7f178a)([#1363](https://github.com/tauri-apps/plugins-workspace/pull/1363)) Update to tauri beta.20. + +## \[2.0.0-beta.3] + +- [`bd1ed590`](https://github.com/tauri-apps/plugins-workspace/commit/bd1ed5903ffcce5500310dac1e59e8c67674ef1e)([#1237](https://github.com/tauri-apps/plugins-workspace/pull/1237)) Update to tauri beta.17. + +## \[2.0.0-beta.4] + +- [`a233919`](https://github.com/tauri-apps/plugins-workspace/commit/a2339195aa940bff86d76375fd05087595bf06ce)([#1118](https://github.com/tauri-apps/plugins-workspace/pull/1118)) Fix LaunchAgent-based autostart for macOS. + +## \[2.0.0-beta.3] + +- [`a04ea2f`](https://github.com/tauri-apps/plugins-workspace/commit/a04ea2f38294d5a3987578283badc8eec87a7752)([#1071](https://github.com/tauri-apps/plugins-workspace/pull/1071)) The global API script is now only added to the binary when the `withGlobalTauri` config is true. + +## \[2.0.0-beta.2] + +- [`99bea25`](https://github.com/tauri-apps/plugins-workspace/commit/99bea2559c2c0648c2519c50a18cd124dacef57b)([#1005](https://github.com/tauri-apps/plugins-workspace/pull/1005)) Update to tauri beta.8. + ## \[2.0.0-beta.1] - [`569defb`](https://github.com/tauri-apps/plugins-workspace/commit/569defbe9492e38938554bb7bdc1be9151456d21) Update to tauri beta.4. @@ -35,10 +96,3 @@ ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - te to alpha.11. - -## \[2.0.0-alpha.0] - -- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - ae67\`]\(https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! -717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/autostart/Cargo.toml b/plugins/autostart/Cargo.toml index f9c4fc86..9a30eff9 100644 --- a/plugins/autostart/Cargo.toml +++ b/plugins/autostart/Cargo.toml @@ -1,24 +1,31 @@ [package] name = "tauri-plugin-autostart" -version = "2.0.0-beta.1" +version = "2.3.0" description = "Automatically launch your application at startup." authors = { workspace = true } license = { workspace = true } edition = { workspace = true } rust-version = { workspace = true } +repository = { workspace = true } links = "tauri-plugin-autostart" [package.metadata.docs.rs] -rustc-args = [ "--cfg", "docsrs" ] -rustdoc-args = [ "--cfg", "docsrs" ] +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs"] + +[package.metadata.platforms.support] +windows = { level = "full", notes = "" } +linux = { level = "full", notes = "" } +macos = { level = "full", notes = "" } +android = { level = "none", notes = "" } +ios = { level = "none", notes = "" } [build-dependencies] -tauri-plugin = { workspace = true, features = [ "build" ] } +tauri-plugin = { workspace = true, features = ["build"] } [dependencies] serde = { workspace = true } serde_json = { workspace = true } tauri = { workspace = true } -log = { workspace = true } thiserror = { workspace = true } auto-launch = "0.5" diff --git a/plugins/autostart/README.md b/plugins/autostart/README.md index 01f385ab..bae2802a 100644 --- a/plugins/autostart/README.md +++ b/plugins/autostart/README.md @@ -1,10 +1,18 @@ ![plugin-autostart](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/autostart/banner.png) -Automatically launch your application at startup. Supports Windows, Mac (via AppleScript or Launch Agent), and Linux. +Automatically launch your application at startup. + +| Platform | Supported | +| -------- | --------- | +| Linux | ✓ | +| Windows | ✓ | +| macOS | ✓ | +| Android | x | +| iOS | x | ## Install -_This plugin requires a Rust version of at least **1.75**_ +_This plugin requires a Rust version of at least **1.77.2**_ There are three general methods of installation that we can recommend. @@ -18,7 +26,7 @@ Install the Core plugin by adding the following to your `Cargo.toml` file: ```toml [dependencies] -tauri-plugin-autostart = "2.0.0-beta" +tauri-plugin-autostart = "2.0.0" # alternatively with Git: tauri-plugin-autostart = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` @@ -46,14 +54,12 @@ yarn add https://github.com/tauri-apps/tauri-plugin-autostart#v2 First you need to register the core plugin with Tauri: -`src-tauri/src/main.rs` +`src-tauri/src/lib.rs` ```rust -use tauri_plugin_autostart::MacosLauncher; - fn main() { tauri::Builder::default() - .plugin(tauri_plugin_autostart::init(MacosLauncher::LaunchAgent, Some(vec!["--flag1", "--flag2"]) /* arbitrary number of args to pass to your app */)) + .plugin(tauri_plugin_autostart::Builder::new().args((["--flag1", "--flag2"])).build())) .run(tauri::generate_context!()) .expect("error while running tauri application"); } @@ -62,13 +68,13 @@ fn main() { Afterwards all the plugin's APIs are available through the JavaScript guest bindings: ```javascript -import { enable, isEnabled, disable } from "@tauri-apps/plugin-autostart"; +import { enable, isEnabled, disable } from '@tauri-apps/plugin-autostart' -await enable(); +await enable() -console.log(`registered for autostart? ${await isEnabled()}`); +console.log(`registered for autostart? ${await isEnabled()}`) -disable(); +disable() ``` ## Contributing diff --git a/plugins/autostart/SECURITY.md b/plugins/autostart/SECURITY.md new file mode 100644 index 00000000..4f09bbac --- /dev/null +++ b/plugins/autostart/SECURITY.md @@ -0,0 +1,23 @@ +# Security Policy + +**Do not report security vulnerabilities through public GitHub issues.** + +**Please use the [Private Vulnerability Disclosure](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability) feature of GitHub.** + +Include as much of the following information: + +- Type of issue (e.g. improper input parsing, privilege escalation, etc.) +- The location of the affected source code (tag/branch/commit or direct URL) +- Any special configuration required to reproduce the issue +- The distribution affected or used to help us with reproduction of the issue +- Step-by-step instructions to reproduce the issue +- Ideally a reproduction repository +- Impact of the issue, including how an attacker might exploit the issue + +We prefer to receive reports in English. + +## Contact + +Please disclose a vulnerability or security relevant issue here: [https://github.com/tauri-apps/plugins-workspace/security/advisories/new](https://github.com/tauri-apps/plugins-workspace/security/advisories/new). + +Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app). diff --git a/plugins/autostart/src/api-iife.js b/plugins/autostart/api-iife.js similarity index 100% rename from plugins/autostart/src/api-iife.js rename to plugins/autostart/api-iife.js diff --git a/plugins/autostart/build.rs b/plugins/autostart/build.rs index 2b27eff0..1460469b 100644 --- a/plugins/autostart/build.rs +++ b/plugins/autostart/build.rs @@ -5,5 +5,7 @@ const COMMANDS: &[&str] = &["enable", "disable", "is_enabled"]; fn main() { - tauri_plugin::Builder::new(COMMANDS).build(); + tauri_plugin::Builder::new(COMMANDS) + .global_api_script_path("./api-iife.js") + .build(); } diff --git a/plugins/autostart/guest-js/index.ts b/plugins/autostart/guest-js/index.ts index 81471b74..fca8344f 100644 --- a/plugins/autostart/guest-js/index.ts +++ b/plugins/autostart/guest-js/index.ts @@ -2,16 +2,16 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { invoke } from "@tauri-apps/api/core"; +import { invoke } from '@tauri-apps/api/core' export async function isEnabled(): Promise { - return await invoke("plugin:autostart|is_enabled"); + return await invoke('plugin:autostart|is_enabled') } export async function enable(): Promise { - await invoke("plugin:autostart|enable"); + await invoke('plugin:autostart|enable') } export async function disable(): Promise { - await invoke("plugin:autostart|disable"); + await invoke('plugin:autostart|disable') } diff --git a/plugins/autostart/package.json b/plugins/autostart/package.json index ad33dd84..c2840616 100644 --- a/plugins/autostart/package.json +++ b/plugins/autostart/package.json @@ -1,10 +1,11 @@ { "name": "@tauri-apps/plugin-autostart", - "version": "2.0.0-beta.1", - "license": "MIT or APACHE-2.0", + "version": "2.3.0", + "license": "MIT OR Apache-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" ], + "repository": "https://github.com/tauri-apps/plugins-workspace", "type": "module", "types": "./dist-js/index.d.ts", "main": "./dist-js/index.cjs", @@ -23,6 +24,6 @@ "LICENSE" ], "dependencies": { - "@tauri-apps/api": "2.0.0-beta.2" + "@tauri-apps/api": "^2.0.0" } } diff --git a/plugins/autostart/permissions/autogenerated/reference.md b/plugins/autostart/permissions/autogenerated/reference.md index e129ae02..6adb2be4 100644 --- a/plugins/autostart/permissions/autogenerated/reference.md +++ b/plugins/autostart/permissions/autogenerated/reference.md @@ -1,26 +1,106 @@ -# Permissions +## Default Permission -## allow-disable +This permission set configures if your +application can enable or disable auto +starting the application on boot. + +#### Granted Permissions + +It allows all to check, enable and +disable the automatic start on boot. + + + +#### This default permission set includes the following: + +- `allow-enable` +- `allow-disable` +- `allow-is-enabled` + +## Permission Table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IdentifierDescription
+ +`autostart:allow-disable` + + Enables the disable command without any pre-configured scope. -## deny-disable +
+ +`autostart:deny-disable` + + Denies the disable command without any pre-configured scope. -## allow-enable +
+ +`autostart:allow-enable` + + Enables the enable command without any pre-configured scope. -## deny-enable +
+ +`autostart:deny-enable` + + Denies the enable command without any pre-configured scope. -## allow-is-enabled +
+ +`autostart:allow-is-enabled` + + Enables the is_enabled command without any pre-configured scope. -## deny-is-enabled +
+ +`autostart:deny-is-enabled` + + Denies the is_enabled command without any pre-configured scope. +
diff --git a/plugins/autostart/permissions/default.toml b/plugins/autostart/permissions/default.toml new file mode 100644 index 00000000..a2ac766f --- /dev/null +++ b/plugins/autostart/permissions/default.toml @@ -0,0 +1,15 @@ +"$schema" = "schemas/schema.json" +[default] +description = """ +This permission set configures if your +application can enable or disable auto +starting the application on boot. + +#### Granted Permissions + +It allows all to check, enable and +disable the automatic start on boot. + +""" + +permissions = ["allow-enable", "allow-disable", "allow-is-enabled"] diff --git a/plugins/autostart/permissions/schemas/schema.json b/plugins/autostart/permissions/schemas/schema.json index 9a471e09..af681221 100644 --- a/plugins/autostart/permissions/schemas/schema.json +++ b/plugins/autostart/permissions/schemas/schema.json @@ -17,7 +17,6 @@ }, "set": { "description": "A list of permissions sets defined", - "default": [], "type": "array", "items": { "$ref": "#/definitions/PermissionSet" @@ -50,7 +49,7 @@ "minimum": 1.0 }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -112,7 +111,7 @@ "type": "string" }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri internal convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -132,12 +131,21 @@ }, "scope": { "description": "Allowed or denied scoped when using this permission.", - "default": {}, "allOf": [ { "$ref": "#/definitions/Scopes" } ] + }, + "platforms": { + "description": "Target platforms this permission applies. By default all platforms are affected by this permission.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Target" + } } } }, @@ -164,7 +172,7 @@ } }, "Scopes": { - "description": "A restriction of the command/endpoint functionality.\n\nIt can be of any serde serializable type and is used for allowing or preventing certain actions inside a Tauri command.\n\nThe scope is passed to the command and handled/enforced by the command itself.", + "description": "An argument for fine grained behavior control of Tauri commands.\n\nIt can be of any serde serializable type and is used to allow or prevent certain actions inside a Tauri command. The configured scope is passed to the command and will be enforced by the command implementation.\n\n## Example\n\n```json { \"allow\": [{ \"path\": \"$HOME/**\" }], \"deny\": [{ \"path\": \"$HOME/secret.txt\" }] } ```", "type": "object", "properties": { "allow": { @@ -178,7 +186,7 @@ } }, "deny": { - "description": "Data that defines what is denied by the scope.", + "description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.", "type": [ "array", "null" @@ -243,50 +251,90 @@ } ] }, - "PermissionKind": { - "type": "string", + "Target": { + "description": "Platform target.", "oneOf": [ { - "description": "allow-disable -> Enables the disable command without any pre-configured scope.", + "description": "MacOS.", "type": "string", "enum": [ - "allow-disable" + "macOS" ] }, { - "description": "deny-disable -> Denies the disable command without any pre-configured scope.", + "description": "Windows.", "type": "string", "enum": [ - "deny-disable" + "windows" ] }, { - "description": "allow-enable -> Enables the enable command without any pre-configured scope.", + "description": "Linux.", "type": "string", "enum": [ - "allow-enable" + "linux" ] }, { - "description": "deny-enable -> Denies the enable command without any pre-configured scope.", + "description": "Android.", "type": "string", "enum": [ - "deny-enable" + "android" ] }, { - "description": "allow-is-enabled -> Enables the is_enabled command without any pre-configured scope.", + "description": "iOS.", "type": "string", "enum": [ - "allow-is-enabled" + "iOS" ] + } + ] + }, + "PermissionKind": { + "type": "string", + "oneOf": [ + { + "description": "Enables the disable command without any pre-configured scope.", + "type": "string", + "const": "allow-disable", + "markdownDescription": "Enables the disable command without any pre-configured scope." }, { - "description": "deny-is-enabled -> Denies the is_enabled command without any pre-configured scope.", + "description": "Denies the disable command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-is-enabled" - ] + "const": "deny-disable", + "markdownDescription": "Denies the disable command without any pre-configured scope." + }, + { + "description": "Enables the enable command without any pre-configured scope.", + "type": "string", + "const": "allow-enable", + "markdownDescription": "Enables the enable command without any pre-configured scope." + }, + { + "description": "Denies the enable command without any pre-configured scope.", + "type": "string", + "const": "deny-enable", + "markdownDescription": "Denies the enable command without any pre-configured scope." + }, + { + "description": "Enables the is_enabled command without any pre-configured scope.", + "type": "string", + "const": "allow-is-enabled", + "markdownDescription": "Enables the is_enabled command without any pre-configured scope." + }, + { + "description": "Denies the is_enabled command without any pre-configured scope.", + "type": "string", + "const": "deny-is-enabled", + "markdownDescription": "Denies the is_enabled command without any pre-configured scope." + }, + { + "description": "This permission set configures if your\napplication can enable or disable auto\nstarting the application on boot.\n\n#### Granted Permissions\n\nIt allows all to check, enable and\ndisable the automatic start on boot.\n\n\n#### This default permission set includes:\n\n- `allow-enable`\n- `allow-disable`\n- `allow-is-enabled`", + "type": "string", + "const": "default", + "markdownDescription": "This permission set configures if your\napplication can enable or disable auto\nstarting the application on boot.\n\n#### Granted Permissions\n\nIt allows all to check, enable and\ndisable the automatic start on boot.\n\n\n#### This default permission set includes:\n\n- `allow-enable`\n- `allow-disable`\n- `allow-is-enabled`" } ] } diff --git a/plugins/autostart/rollup.config.js b/plugins/autostart/rollup.config.js index 977dfac8..1f349ec8 100644 --- a/plugins/autostart/rollup.config.js +++ b/plugins/autostart/rollup.config.js @@ -2,6 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { createConfig } from "../../shared/rollup.config.js"; +import { createConfig } from '../../shared/rollup.config.js' -export default createConfig(); +export default createConfig() diff --git a/plugins/autostart/src/lib.rs b/plugins/autostart/src/lib.rs index b4338208..83cac89c 100644 --- a/plugins/autostart/src/lib.rs +++ b/plugins/autostart/src/lib.rs @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -//! [![](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/autostart/banner.png)](https://github.com/tauri-apps/plugins-workspace/tree/v2/plugins/autostart) -//! //! Automatically launch your application at startup. Supports Windows, Mac (via AppleScript or Launch Agent), and Linux. #![doc( @@ -13,12 +11,10 @@ #![cfg(not(any(target_os = "android", target_os = "ios")))] use auto_launch::{AutoLaunch, AutoLaunchBuilder}; -#[cfg(target_os = "macos")] -use log::info; use serde::{ser::Serializer, Serialize}; use tauri::{ command, - plugin::{Builder, TauriPlugin}, + plugin::{Builder as PluginBuilder, TauriPlugin}, Manager, Runtime, State, }; @@ -26,8 +22,9 @@ use std::env::current_exe; type Result = std::result::Result; -#[derive(Debug, Copy, Clone)] +#[derive(Debug, Default, Copy, Clone)] pub enum MacosLauncher { + #[default] LaunchAgent, AppleScript, } @@ -75,10 +72,12 @@ impl AutoLaunchManager { } pub trait ManagerExt { + /// TODO: Rename these to `autostart` or `auto_start` in v3 fn autolaunch(&self) -> State<'_, AutoLaunchManager>; } impl> ManagerExt for T { + /// TODO: Rename these to `autostart` or `auto_start` in v3 fn autolaunch(&self) -> State<'_, AutoLaunchManager> { self.state::() } @@ -99,60 +98,132 @@ async fn is_enabled(manager: State<'_, AutoLaunchManager>) -> Result { manager.is_enabled() } +#[derive(Default)] +pub struct Builder { + #[cfg(target_os = "macos")] + macos_launcher: MacosLauncher, + args: Vec, +} + +impl Builder { + /// Create a new auto start builder with default settings + pub fn new() -> Self { + Self::default() + } + + /// Adds an argument to pass to your app on startup. + /// + /// ## Examples + /// + /// ```no_run + /// Builder::new() + /// .arg("--from-autostart") + /// .arg("--hey") + /// .build(); + /// ``` + pub fn arg>(mut self, arg: S) -> Self { + self.args.push(arg.into()); + self + } + + /// Adds multiple arguments to pass to your app on startup. + /// + /// ## Examples + /// + /// ```no_run + /// Builder::new() + /// .args(["--from-autostart", "--hey"]) + /// .build(); + /// ``` + pub fn args(mut self, args: I) -> Self + where + I: IntoIterator, + S: Into, + { + for arg in args { + self = self.arg(arg); + } + self + } + + /// Sets whether to use launch agent or apple script to be used to enable auto start, + /// the builder's default is [`MacosLauncher::LaunchAgent`] + #[cfg(target_os = "macos")] + pub fn macos_launcher(mut self, macos_launcher: MacosLauncher) -> Self { + self.macos_launcher = macos_launcher; + self + } + + pub fn build(self) -> TauriPlugin { + PluginBuilder::new("autostart") + .invoke_handler(tauri::generate_handler![enable, disable, is_enabled]) + .setup(move |app, _api| { + let mut builder = AutoLaunchBuilder::new(); + builder.set_app_name(&app.package_info().name); + builder.set_args(&self.args); + + let current_exe = current_exe()?; + + #[cfg(windows)] + builder.set_app_path(¤t_exe.display().to_string()); + + #[cfg(target_os = "macos")] + { + builder.set_use_launch_agent(matches!( + self.macos_launcher, + MacosLauncher::LaunchAgent + )); + // on macOS, current_exe gives path to /Applications/Example.app/MacOS/Example + // but this results in seeing a Unix Executable in macOS login items + // It must be: /Applications/Example.app + // If it didn't find exactly a single occurance of .app, it will default to + // exe path to not break it. + let exe_path = current_exe.canonicalize()?.display().to_string(); + let parts: Vec<&str> = exe_path.split(".app/").collect(); + let app_path = if parts.len() == 2 + && matches!(self.macos_launcher, MacosLauncher::AppleScript) + { + format!("{}.app", parts.first().unwrap()) + } else { + exe_path + }; + builder.set_app_path(&app_path); + } + + #[cfg(target_os = "linux")] + if let Some(appimage) = app + .env() + .appimage + .and_then(|p| p.to_str().map(|s| s.to_string())) + { + builder.set_app_path(&appimage); + } else { + builder.set_app_path(¤t_exe.display().to_string()); + } + + app.manage(AutoLaunchManager( + builder.build().map_err(|e| e.to_string())?, + )); + Ok(()) + }) + .build() + } +} + /// Initializes the plugin. /// /// `args` - are passed to your app on startup. pub fn init( - macos_launcher: MacosLauncher, + #[allow(unused)] macos_launcher: MacosLauncher, args: Option>, ) -> TauriPlugin { - Builder::new("autostart") - .js_init_script(include_str!("api-iife.js").to_string()) - .invoke_handler(tauri::generate_handler![enable, disable, is_enabled]) - .setup(move |app, _api| { - let mut builder = AutoLaunchBuilder::new(); - builder.set_app_name(&app.package_info().name); - if let Some(args) = args { - builder.set_args(&args); - } - builder.set_use_launch_agent(matches!(macos_launcher, MacosLauncher::LaunchAgent)); - - let current_exe = current_exe()?; - - #[cfg(windows)] - builder.set_app_path(¤t_exe.display().to_string()); - #[cfg(target_os = "macos")] - { - // on macOS, current_exe gives path to /Applications/Example.app/MacOS/Example - // but this results in seeing a Unix Executable in macOS login items - // It must be: /Applications/Example.app - // If it didn't find exactly a single occurance of .app, it will default to - // exe path to not break it. - let exe_path = current_exe.canonicalize()?.display().to_string(); - let parts: Vec<&str> = exe_path.split(".app/").collect(); - let app_path = if parts.len() == 2 { - format!("{}.app", parts.first().unwrap()) - } else { - exe_path - }; - info!("auto_start path {}", &app_path); - builder.set_app_path(&app_path); - } - #[cfg(target_os = "linux")] - if let Some(appimage) = app - .env() - .appimage - .and_then(|p| p.to_str().map(|s| s.to_string())) - { - builder.set_app_path(&appimage); - } else { - builder.set_app_path(¤t_exe.display().to_string()); - } - - app.manage(AutoLaunchManager( - builder.build().map_err(|e| e.to_string())?, - )); - Ok(()) - }) - .build() + let mut builder = Builder::new(); + if let Some(args) = args { + builder = builder.args(args) + } + #[cfg(target_os = "macos")] + { + builder = builder.macos_launcher(macos_launcher); + } + builder.build() } diff --git a/plugins/barcode-scanner/CHANGELOG.md b/plugins/barcode-scanner/CHANGELOG.md index 01a59b61..3fa878fd 100644 --- a/plugins/barcode-scanner/CHANGELOG.md +++ b/plugins/barcode-scanner/CHANGELOG.md @@ -1,5 +1,84 @@ # Changelog +## \[2.2.0] + +- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other. + +## \[2.0.1] + +- [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7. + +## \[2.0.0] + +- [`e2c4dfb6`](https://github.com/tauri-apps/plugins-workspace/commit/e2c4dfb6af43e5dd8d9ceba232c315f5febd55c1) Update to tauri v2 stable release. + +## \[2.0.0-rc.2] + +- [`79d6e19c`](https://github.com/tauri-apps/plugins-workspace/commit/79d6e19c4b38bae0cab29eb88df379e2237d9aac) ([#1777](https://github.com/tauri-apps/plugins-workspace/pull/1777)) Fixed an issue which caused checkPermission and requestPermission to be mixed up. + +## \[2.0.0-rc.4] + +- [`713c54ef`](https://github.com/tauri-apps/plugins-workspace/commit/713c54ef8365d36afd84585dcabed2fbb751223d) ([#1749](https://github.com/tauri-apps/plugins-workspace/pull/1749) by [@olivierlemasle](https://github.com/tauri-apps/plugins-workspace/../../olivierlemasle)) Remove unused Android dependencies. +- [`8c3a6a25`](https://github.com/tauri-apps/plugins-workspace/commit/8c3a6a253d7029d370659d2102f91a458745d345) ([#1758](https://github.com/tauri-apps/plugins-workspace/pull/1758) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Validate missing `NSCameraUsageDescription` Info.plist value. + +## \[2.0.0-rc.1] + +- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Use `PermissionState` from the `tauri` crate, which now also includes a "prompt with rationale" variant for Android (returned when your app must explain to the user why it needs the permission). +- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri 2.0.0-rc.8 + +## \[2.0.0-rc.2] + +- [`b9147758`](https://github.com/tauri-apps/plugins-workspace/commit/b914775898c2bee7ceb20bd17ee595005cd17a64) ([#1679](https://github.com/tauri-apps/plugins-workspace/pull/1679) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Explicitly set a minimum macOS version for the Swift package. + +## \[2.0.0-rc.1] + +- [`2c00c029`](https://github.com/tauri-apps/plugins-workspace/commit/2c00c0292c9127b81567de46691e8c0f73557261) ([#1630](https://github.com/tauri-apps/plugins-workspace/pull/1630) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Fixed an issue that caused multi-word IIFE names to not be formatted correctly. For example the `barcode-scanner` was defined as `window.__TAURI_PLUGIN_CLIPBOARDMANAGER__` instead of `window.__TAURI_PLUGIN_CLIPBOARD_MANAGER__`. + +### changes + +- [`6b079cfd`](https://github.com/tauri-apps/plugins-workspace/commit/6b079cfdd107c94abc2c7300f6af00bac3ff4040) ([#1649](https://github.com/tauri-apps/plugins-workspace/pull/1649) by [@ahqsoftwares](https://github.com/tauri-apps/plugins-workspace/../../ahqsoftwares)) Remove targetSdk from build.kts files as it is deprecated and will be removed from DSL v9.0 + +## \[2.0.0-rc.0] + +- [`9887d1`](https://github.com/tauri-apps/plugins-workspace/commit/9887d14bd0e971c4c0f5c1188fc4005d3fc2e29e) Update to tauri RC. + +## \[2.0.0-beta.8] + +- [`99d6ac0f`](https://github.com/tauri-apps/plugins-workspace/commit/99d6ac0f9506a6a4a1aa59c728157190a7441af6) ([#1606](https://github.com/tauri-apps/plugins-workspace/pull/1606) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) The JS packages now specify the *minimum* `@tauri-apps/api` version instead of a single exact version. +- [`6de87966`](https://github.com/tauri-apps/plugins-workspace/commit/6de87966ecc00ad9d91c25be452f1f46bd2b7e1f) ([#1597](https://github.com/tauri-apps/plugins-workspace/pull/1597) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Update to tauri beta.25. + +## \[2.0.0-beta.7] + +- [`22a17980`](https://github.com/tauri-apps/plugins-workspace/commit/22a17980ff4f6f8c40adb1b8f4ffc6dae2fe7e30) ([#1537](https://github.com/tauri-apps/plugins-workspace/pull/1537) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri beta.24. + +## \[2.0.0-beta.6] + +- [`76daee7a`](https://github.com/tauri-apps/plugins-workspace/commit/76daee7aafece34de3092c86e531cf9eb1138989) ([#1512](https://github.com/tauri-apps/plugins-workspace/pull/1512) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Update to tauri beta.23. + +## \[2.0.0-beta.5] + +- [`9013854f`](https://github.com/tauri-apps/plugins-workspace/commit/9013854f42a49a230b9dbb9d02774765528a923f)([#1382](https://github.com/tauri-apps/plugins-workspace/pull/1382)) Update to tauri beta.22. + +## \[2.0.0-beta.4] + +- [`430bd6f4`](https://github.com/tauri-apps/plugins-workspace/commit/430bd6f4f379bee5d232ae6b098ae131db7f178a)([#1363](https://github.com/tauri-apps/plugins-workspace/pull/1363)) Update to tauri beta.20. + +## \[2.0.0-beta.3] + +- [`bd1ed590`](https://github.com/tauri-apps/plugins-workspace/commit/bd1ed5903ffcce5500310dac1e59e8c67674ef1e)([#1237](https://github.com/tauri-apps/plugins-workspace/pull/1237)) Update to tauri beta.17. + +## \[2.0.0-beta.4] + +- [`326df688`](https://github.com/tauri-apps/plugins-workspace/commit/326df6883998d416fc0837583ed972854628bb52)([#1236](https://github.com/tauri-apps/plugins-workspace/pull/1236)) Fixes command argument parsing on iOS. + +## \[2.0.0-beta.3] + +- [`a04ea2f`](https://github.com/tauri-apps/plugins-workspace/commit/a04ea2f38294d5a3987578283badc8eec87a7752)([#1071](https://github.com/tauri-apps/plugins-workspace/pull/1071)) The global API script is now only added to the binary when the `withGlobalTauri` config is true. + +## \[2.0.0-beta.2] + +- [`99bea25`](https://github.com/tauri-apps/plugins-workspace/commit/99bea2559c2c0648c2519c50a18cd124dacef57b)([#1005](https://github.com/tauri-apps/plugins-workspace/pull/1005)) Update to tauri beta.8. + ## \[2.0.0-beta.1] - [`569defb`](https://github.com/tauri-apps/plugins-workspace/commit/569defbe9492e38938554bb7bdc1be9151456d21) Update to tauri beta.4. @@ -28,4 +107,9 @@ ## \[2.0.0-alpha.0] - [`454428c`](https://github.com/tauri-apps/plugins-workspace/commit/454428cd50ce4962f0bad8e355aebc68af8cc61f)([#536](https://github.com/tauri-apps/plugins-workspace/pull/536)) Initial release. -commit/454428cd50ce4962f0bad8e355aebc68af8cc61f)([#536](https://github.com/tauri-apps/plugins-workspace/pull/536)) Initial release. + commit/454428cd50ce4962f0bad8e355aebc68af8cc61f)([#536](https://github.com/tauri-apps/plugins-workspace/pull/536)) Initial release. + 36]\(https://github.com/tauri-apps/plugins-workspace/pull/536)) Initial release. + commit/454428cd50ce4962f0bad8e355aebc68af8cc61f)([#536](https://github.com/tauri-apps/plugins-workspace/pull/536)) Initial release. + . + commit/454428cd50ce4962f0bad8e355aebc68af8cc61f)([#536](https://github.com/tauri-apps/plugins-workspace/pull/536)) Initial release. + github.com/tauri-apps/plugins-workspace/pull/536)) Initial release. diff --git a/plugins/barcode-scanner/Cargo.toml b/plugins/barcode-scanner/Cargo.toml index 81f8e4f1..018b4908 100644 --- a/plugins/barcode-scanner/Cargo.toml +++ b/plugins/barcode-scanner/Cargo.toml @@ -1,20 +1,29 @@ [package] name = "tauri-plugin-barcode-scanner" -version = "2.0.0-beta.1" +version = "2.2.0" description = "Scan QR codes, EAN-13 and other kinds of barcodes on Android and iOS" edition = { workspace = true } authors = { workspace = true } license = { workspace = true } rust-version = { workspace = true } +repository = { workspace = true } links = "tauri-plugin-barcode-scanner" [package.metadata.docs.rs] -rustc-args = [ "--cfg", "docsrs" ] -rustdoc-args = [ "--cfg", "docsrs" ] -targets = [ "x86_64-linux-android" ] +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs"] +targets = ["x86_64-linux-android"] + +[package.metadata.platforms.support] +windows = { level = "none", notes = "" } +linux = { level = "none", notes = "" } +macos = { level = "none", notes = "" } +android = { level = "full", notes = "" } +ios = { level = "full", notes = "" } + [build-dependencies] -tauri-plugin = { workspace = true, features = [ "build" ] } +tauri-plugin = { workspace = true, features = ["build"] } [dependencies] serde = { workspace = true } @@ -22,3 +31,6 @@ serde_json = { workspace = true } tauri = { workspace = true } log = { workspace = true } thiserror = { workspace = true } + +[target.'cfg(target_os = "ios")'.dependencies] +tauri = { workspace = true, features = ["wry"] } diff --git a/plugins/barcode-scanner/README.md b/plugins/barcode-scanner/README.md index 1a7d59e6..4abbef0a 100644 --- a/plugins/barcode-scanner/README.md +++ b/plugins/barcode-scanner/README.md @@ -1,7 +1,15 @@ -![Barcode Scanner](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/scanner/banner.png) +![Barcode Scanner](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/barcode-scanner/banner.png) Allows your mobile application to use the camera to scan QR codes, EAN-13 and other kinds of barcodes. +| Platform | Supported | +| -------- | --------- | +| Linux | x | +| Windows | x | +| macOS | x | +| Android | ✓ | +| iOS | ✓ | + ## Install _This plugin requires a Rust version of at least **1.64**_ @@ -18,7 +26,7 @@ Install the Core plugin by adding the following to your `Cargo.toml` file: ```toml [dependencies] -tauri-plugin-barcode-scanner = "2.0.0-beta" +tauri-plugin-barcode-scanner = "2.0.0" # alternatively with Git: tauri-plugin-barcode-scanner = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` @@ -46,7 +54,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-barcode-scanner#v2 First you need to register the core plugin with Tauri: -`src-tauri/src/main.rs` +`src-tauri/src/lib.rs` ```rust fn main() { @@ -60,12 +68,12 @@ fn main() { Afterwards all the plugin's APIs are available through the JavaScript guest bindings: ```javascript -import { scan } from "@tauri-apps/plugin-barcode-scanner"; +import { scan } from '@tauri-apps/plugin-barcode-scanner' // `windowed: true` actually sets the webview to transparent // instead of opening a separate view for the camera // make sure your user interface is ready to show what is underneath with a transparent element -scan({ windowed: true, formats: [""] }) +scan({ windowed: true, formats: [''] }) ``` ## Contributing diff --git a/plugins/barcode-scanner/SECURITY.md b/plugins/barcode-scanner/SECURITY.md index 36a863c6..135504ec 100644 --- a/plugins/barcode-scanner/SECURITY.md +++ b/plugins/barcode-scanner/SECURITY.md @@ -54,7 +54,6 @@ The camera has two modes. The first one is where the user can see the background The second mode allows the developer to assist the user and add a transparent overlay to the image, providing hints or additional information (like a link preview). The overlay could be made non-transparent by the application frontend and as long as the app is open (and in some cases) it could read QR codes in range of the camera lense. - #### Out Of Scope - Exploits in the operating system QR code parsing functionality diff --git a/plugins/barcode-scanner/android/build.gradle.kts b/plugins/barcode-scanner/android/build.gradle.kts index 8b060f64..f3ecd6c7 100644 --- a/plugins/barcode-scanner/android/build.gradle.kts +++ b/plugins/barcode-scanner/android/build.gradle.kts @@ -5,11 +5,10 @@ plugins { android { namespace = "app.tauri.barcodescanner" - compileSdk = 32 + compileSdk = 34 defaultConfig { - minSdk = 24 - targetSdk = 32 + minSdk = 24 testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles("consumer-rules.pro") @@ -48,9 +47,5 @@ dependencies { testImplementation("junit:junit:4.13.2") androidTestImplementation("androidx.test.ext:junit:1.1.5") androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1") - implementation("com.journeyapps:zxing-android-embedded:4.3.0") { - isTransitive = false - } - implementation("com.google.zxing:core:3.3.0") implementation(project(":tauri-android")) } diff --git a/plugins/barcode-scanner/android/src/main/AndroidManifest.xml b/plugins/barcode-scanner/android/src/main/AndroidManifest.xml index b4050b4f..750a724b 100644 --- a/plugins/barcode-scanner/android/src/main/AndroidManifest.xml +++ b/plugins/barcode-scanner/android/src/main/AndroidManifest.xml @@ -2,10 +2,8 @@ xmlns:tools="http://schemas.android.com/tools" android:hardwareAccelerated="true"> - - - - - + + + diff --git a/plugins/barcode-scanner/android/src/main/java/BarcodeScannerPlugin.kt b/plugins/barcode-scanner/android/src/main/java/BarcodeScannerPlugin.kt index 4728bad0..ef2eeb34 100644 --- a/plugins/barcode-scanner/android/src/main/java/BarcodeScannerPlugin.kt +++ b/plugins/barcode-scanner/android/src/main/java/BarcodeScannerPlugin.kt @@ -42,7 +42,6 @@ import app.tauri.annotation.Permission import app.tauri.annotation.PermissionCallback import app.tauri.annotation.TauriPlugin import app.tauri.plugin.Invoke -import app.tauri.plugin.JSArray import app.tauri.plugin.JSObject import app.tauri.plugin.Plugin import com.google.common.util.concurrent.ListenableFuture @@ -50,7 +49,6 @@ import com.google.mlkit.vision.barcode.BarcodeScannerOptions import com.google.mlkit.vision.barcode.BarcodeScanning import com.google.mlkit.vision.barcode.common.Barcode import com.google.mlkit.vision.common.InputImage -import org.json.JSONException import java.util.Collections import java.util.concurrent.ExecutionException diff --git a/plugins/barcode-scanner/android/src/main/java/GraphicOverlay.kt b/plugins/barcode-scanner/android/src/main/java/GraphicOverlay.kt index 76817540..1b1d3b2c 100644 --- a/plugins/barcode-scanner/android/src/main/java/GraphicOverlay.kt +++ b/plugins/barcode-scanner/android/src/main/java/GraphicOverlay.kt @@ -91,22 +91,10 @@ class GraphicOverlay: View { return } - val zLowerBoundInScreenPixel: Float - val zUpperBoundInScreenPixel: Float - if (rescaleZForVisualization) { - zLowerBoundInScreenPixel = (-0.001f).coerceAtMost(scale(zMin)) - zUpperBoundInScreenPixel = 0.001f.coerceAtLeast(scale(zMax)) - } else { - val defaultRangeFactor = 1f - zLowerBoundInScreenPixel = -defaultRangeFactor * canvas.width - zUpperBoundInScreenPixel = defaultRangeFactor * canvas.width - } val zInScreenPixel = scale(zInImagePixel) if (zInScreenPixel < 0) { - val v = (zInScreenPixel / zLowerBoundInScreenPixel * 255).toInt() paint.setARGB(0, 0, 255, 0) } else { - val v = (zInScreenPixel / zUpperBoundInScreenPixel * 255).toInt() paint.setARGB(0, 0, 255, 0) } } @@ -180,7 +168,7 @@ class GraphicOverlay: View { needUpdateTransformation = false } - override fun onDraw(canvas: Canvas?) { + override fun onDraw(canvas: Canvas) { super.onDraw(canvas) synchronized(lock) { updateTransformationIfNeeded() diff --git a/plugins/barcode-scanner/api-iife.js b/plugins/barcode-scanner/api-iife.js new file mode 100644 index 00000000..620b59a7 --- /dev/null +++ b/plugins/barcode-scanner/api-iife.js @@ -0,0 +1 @@ +if("__TAURI__"in window){var __TAURI_PLUGIN_BARCODE_SCANNER__=function(n){"use strict";async function e(n,e={},r){return window.__TAURI_INTERNALS__.invoke(n,e,r)}var r;return"function"==typeof SuppressedError&&SuppressedError,n.Format=void 0,(r=n.Format||(n.Format={})).QRCode="QR_CODE",r.UPC_A="UPC_A",r.UPC_E="UPC_E",r.EAN8="EAN_8",r.EAN13="EAN_13",r.Code39="CODE_39",r.Code93="CODE_93",r.Code128="CODE_128",r.Codabar="CODABAR",r.ITF="ITF",r.Aztec="AZTEC",r.DataMatrix="DATA_MATRIX",r.PDF417="PDF_417",n.cancel=async function(){await e("plugin:barcode-scanner|cancel")},n.checkPermissions=async function(){return await async function(n){return e(`plugin:${n}|check_permissions`)}("barcode-scanner").then((n=>n.camera))},n.openAppSettings=async function(){await e("plugin:barcode-scanner|open_app_settings")},n.requestPermissions=async function(){return await async function(n){return e(`plugin:${n}|request_permissions`)}("barcode-scanner").then((n=>n.camera))},n.scan=async function(n){return await e("plugin:barcode-scanner|scan",{...n})},n}({});Object.defineProperty(window.__TAURI__,"barcodeScanner",{value:__TAURI_PLUGIN_BARCODE_SCANNER__})} diff --git a/plugins/barcode-scanner/build.rs b/plugins/barcode-scanner/build.rs index 9239a404..25896b57 100644 --- a/plugins/barcode-scanner/build.rs +++ b/plugins/barcode-scanner/build.rs @@ -12,15 +12,14 @@ const COMMANDS: &[&str] = &[ ]; fn main() { - if let Err(error) = tauri_plugin::Builder::new(COMMANDS) + let result = tauri_plugin::Builder::new(COMMANDS) + .global_api_script_path("./api-iife.js") .android_path("android") .ios_path("ios") - .try_build() - { - println!("{error:#}"); - // when building documentation for Android the plugin build result is irrelevant to the crate itself - if !(cfg!(docsrs) && std::env::var("TARGET").unwrap().contains("android")) { - std::process::exit(1); - } + .try_build(); + + // when building documentation for Android the plugin build result is always Err() and is irrelevant to the crate documentation build + if !(cfg!(docsrs) && std::env::var("TARGET").unwrap().contains("android")) { + result.unwrap(); } } diff --git a/plugins/barcode-scanner/guest-js/index.ts b/plugins/barcode-scanner/guest-js/index.ts index 8e964420..2f2361be 100644 --- a/plugins/barcode-scanner/guest-js/index.ts +++ b/plugins/barcode-scanner/guest-js/index.ts @@ -2,36 +2,40 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { invoke } from "@tauri-apps/api/core"; +import { + invoke, + requestPermissions as requestPermissions_, + checkPermissions as checkPermissions_ +} from '@tauri-apps/api/core' -export type PermissionState = "granted" | "denied" | "prompt"; +export type { PermissionState } from '@tauri-apps/api/core' export enum Format { - QRCode = "QR_CODE", - UPC_A = "UPC_A", - UPC_E = "UPC_E", - EAN8 = "EAN_8", - EAN13 = "EAN_13", - Code39 = "CODE_39", - Code93 = "CODE_93", - Code128 = "CODE_128", - Codabar = "CODABAR", - ITF = "ITF", - Aztec = "AZTEC", - DataMatrix = "DATA_MATRIX", - PDF417 = "PDF_417", + QRCode = 'QR_CODE', + UPC_A = 'UPC_A', + UPC_E = 'UPC_E', + EAN8 = 'EAN_8', + EAN13 = 'EAN_13', + Code39 = 'CODE_39', + Code93 = 'CODE_93', + Code128 = 'CODE_128', + Codabar = 'CODABAR', + ITF = 'ITF', + Aztec = 'AZTEC', + DataMatrix = 'DATA_MATRIX', + PDF417 = 'PDF_417' } export interface ScanOptions { - cameraDirection?: "back" | "front"; - formats?: Format[]; - windowed?: boolean; + cameraDirection?: 'back' | 'front' + formats?: Format[] + windowed?: boolean } export interface Scanned { - content: string; - format: Format; - bounds: unknown; + content: string + format: Format + bounds: unknown } /** @@ -39,37 +43,37 @@ export interface Scanned { * @param options */ export async function scan(options?: ScanOptions): Promise { - return await invoke("plugin:barcode-scanner|scan", { ...options }); + return await invoke('plugin:barcode-scanner|scan', { ...options }) } /** * Cancel the current scan process. */ export async function cancel(): Promise { - return await invoke("plugin:barcode-scanner|cancel"); + await invoke('plugin:barcode-scanner|cancel') } /** * Get permission state. */ export async function checkPermissions(): Promise { - return await invoke<{ camera: PermissionState }>( - "plugin:barcode-scanner|check_permissions", - ).then((r) => r.camera); + return await checkPermissions_<{ camera: PermissionState }>( + 'barcode-scanner' + ).then((r) => r.camera) } /** * Request permissions to use the camera. */ export async function requestPermissions(): Promise { - return await invoke<{ camera: PermissionState }>( - "plugin:barcode-scanner|request_permissions", - ).then((r) => r.camera); + return await requestPermissions_<{ camera: PermissionState }>( + 'barcode-scanner' + ).then((r) => r.camera) } /** * Open application settings. Useful if permission was denied and the user must manually enable it. */ export async function openAppSettings(): Promise { - return await invoke("plugin:barcode-scanner|open_app_settings"); + await invoke('plugin:barcode-scanner|open_app_settings') } diff --git a/plugins/barcode-scanner/ios/Package.swift b/plugins/barcode-scanner/ios/Package.swift index aafb41c3..cf39b812 100644 --- a/plugins/barcode-scanner/ios/Package.swift +++ b/plugins/barcode-scanner/ios/Package.swift @@ -10,7 +10,8 @@ import PackageDescription let package = Package( name: "tauri-plugin-barcode-scanner", platforms: [ - .iOS(.v13) + .macOS(.v10_13), + .iOS(.v13), ], products: [ // Products define the executables and libraries a package produces, and make them visible to other packages. diff --git a/plugins/barcode-scanner/ios/Sources/BarcodeScannerPlugin.swift b/plugins/barcode-scanner/ios/Sources/BarcodeScannerPlugin.swift index 7a329e37..cde8d680 100644 --- a/plugins/barcode-scanner/ios/Sources/BarcodeScannerPlugin.swift +++ b/plugins/barcode-scanner/ios/Sources/BarcodeScannerPlugin.swift @@ -8,9 +8,9 @@ import UIKit import WebKit struct ScanOptions: Decodable { - var formats: [SupportedFormat] = [] - let windowed: Bool? - let cameraDirection: String? + var formats: [SupportedFormat]? + var windowed: Bool? + var cameraDirection: String? } enum SupportedFormat: String, CaseIterable, Decodable { @@ -241,7 +241,7 @@ class BarcodeScannerPlugin: Plugin, AVCaptureMetadataOutputObjectsDelegate { private func runScanner(_ invoke: Invoke, args: ScanOptions) { scanFormats = [AVMetadataObject.ObjectType]() - args.formats.forEach { format in + (args.formats ?? []).forEach { format in scanFormats.append(format.value) } @@ -262,6 +262,13 @@ class BarcodeScannerPlugin: Plugin, AVCaptureMetadataOutputObjectsDelegate { self.invoke = invoke + let entry = Bundle.main.infoDictionary?["NSCameraUsageDescription"] as? String + + if entry == nil || entry?.count == 0 { + invoke.reject("NSCameraUsageDescription is not in the app Info.plist") + return + } + var iOS14min: Bool = false if #available(iOS 14.0, *) { iOS14min = true } if !iOS14min && self.getPermissionState() != "granted" { diff --git a/plugins/barcode-scanner/package.json b/plugins/barcode-scanner/package.json index e1fe29bd..9e8c8b56 100644 --- a/plugins/barcode-scanner/package.json +++ b/plugins/barcode-scanner/package.json @@ -1,11 +1,12 @@ { "name": "@tauri-apps/plugin-barcode-scanner", - "version": "2.0.0-beta.1", + "version": "2.2.0", "description": "Scan QR codes, EAN-13 and other kinds of barcodes on Android and iOS", - "license": "MIT or APACHE-2.0", + "license": "MIT OR Apache-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" ], + "repository": "https://github.com/tauri-apps/plugins-workspace", "type": "module", "types": "./dist-js/index.d.ts", "main": "./dist-js/index.cjs", @@ -24,6 +25,6 @@ "LICENSE" ], "dependencies": { - "@tauri-apps/api": "2.0.0-beta.2" + "@tauri-apps/api": "^2.0.0" } } diff --git a/plugins/barcode-scanner/permissions/autogenerated/reference.md b/plugins/barcode-scanner/permissions/autogenerated/reference.md index d20ff148..9cc9f3c6 100644 --- a/plugins/barcode-scanner/permissions/autogenerated/reference.md +++ b/plugins/barcode-scanner/permissions/autogenerated/reference.md @@ -1,50 +1,185 @@ -# Permissions +## Default Permission -## allow-cancel +This permission set configures which +barcode scanning features are by default exposed. + +#### Granted Permissions + +It allows all barcode related features. + + + +#### This default permission set includes the following: + +- `allow-cancel` +- `allow-check-permissions` +- `allow-open-app-settings` +- `allow-request-permissions` +- `allow-scan` +- `allow-vibrate` + +## Permission Table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IdentifierDescription
+ +`barcode-scanner:allow-cancel` + + Enables the cancel command without any pre-configured scope. -## deny-cancel +
+ +`barcode-scanner:deny-cancel` + + Denies the cancel command without any pre-configured scope. -## allow-check-permissions +
+ +`barcode-scanner:allow-check-permissions` + + Enables the check_permissions command without any pre-configured scope. -## deny-check-permissions +
+ +`barcode-scanner:deny-check-permissions` + + Denies the check_permissions command without any pre-configured scope. -## allow-open-app-settings +
+ +`barcode-scanner:allow-open-app-settings` + + Enables the open_app_settings command without any pre-configured scope. -## deny-open-app-settings +
+ +`barcode-scanner:deny-open-app-settings` + + Denies the open_app_settings command without any pre-configured scope. -## allow-request-permissions +
+ +`barcode-scanner:allow-request-permissions` + + Enables the request_permissions command without any pre-configured scope. -## deny-request-permissions +
+ +`barcode-scanner:deny-request-permissions` + + Denies the request_permissions command without any pre-configured scope. -## allow-scan +
+ +`barcode-scanner:allow-scan` + + Enables the scan command without any pre-configured scope. -## deny-scan +
+ +`barcode-scanner:deny-scan` + + Denies the scan command without any pre-configured scope. -## allow-vibrate +
+ +`barcode-scanner:allow-vibrate` + + Enables the vibrate command without any pre-configured scope. -## deny-vibrate +
+ +`barcode-scanner:deny-vibrate` + + Denies the vibrate command without any pre-configured scope. +
diff --git a/plugins/barcode-scanner/permissions/default.toml b/plugins/barcode-scanner/permissions/default.toml new file mode 100644 index 00000000..3b5a2dfd --- /dev/null +++ b/plugins/barcode-scanner/permissions/default.toml @@ -0,0 +1,20 @@ +"$schema" = "schemas/schema.json" +[default] +description = """ +This permission set configures which +barcode scanning features are by default exposed. + +#### Granted Permissions + +It allows all barcode related features. + +""" + +permissions = [ + "allow-cancel", + "allow-check-permissions", + "allow-open-app-settings", + "allow-request-permissions", + "allow-scan", + "allow-vibrate", +] diff --git a/plugins/barcode-scanner/permissions/schemas/schema.json b/plugins/barcode-scanner/permissions/schemas/schema.json index 1fd55fd1..69fb0d5d 100644 --- a/plugins/barcode-scanner/permissions/schemas/schema.json +++ b/plugins/barcode-scanner/permissions/schemas/schema.json @@ -17,7 +17,6 @@ }, "set": { "description": "A list of permissions sets defined", - "default": [], "type": "array", "items": { "$ref": "#/definitions/PermissionSet" @@ -50,7 +49,7 @@ "minimum": 1.0 }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -112,7 +111,7 @@ "type": "string" }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri internal convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -132,12 +131,21 @@ }, "scope": { "description": "Allowed or denied scoped when using this permission.", - "default": {}, "allOf": [ { "$ref": "#/definitions/Scopes" } ] + }, + "platforms": { + "description": "Target platforms this permission applies. By default all platforms are affected by this permission.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Target" + } } } }, @@ -164,7 +172,7 @@ } }, "Scopes": { - "description": "A restriction of the command/endpoint functionality.\n\nIt can be of any serde serializable type and is used for allowing or preventing certain actions inside a Tauri command.\n\nThe scope is passed to the command and handled/enforced by the command itself.", + "description": "An argument for fine grained behavior control of Tauri commands.\n\nIt can be of any serde serializable type and is used to allow or prevent certain actions inside a Tauri command. The configured scope is passed to the command and will be enforced by the command implementation.\n\n## Example\n\n```json { \"allow\": [{ \"path\": \"$HOME/**\" }], \"deny\": [{ \"path\": \"$HOME/secret.txt\" }] } ```", "type": "object", "properties": { "allow": { @@ -178,7 +186,7 @@ } }, "deny": { - "description": "Data that defines what is denied by the scope.", + "description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.", "type": [ "array", "null" @@ -243,92 +251,126 @@ } ] }, - "PermissionKind": { - "type": "string", + "Target": { + "description": "Platform target.", "oneOf": [ { - "description": "allow-cancel -> Enables the cancel command without any pre-configured scope.", + "description": "MacOS.", "type": "string", "enum": [ - "allow-cancel" + "macOS" ] }, { - "description": "deny-cancel -> Denies the cancel command without any pre-configured scope.", + "description": "Windows.", "type": "string", "enum": [ - "deny-cancel" + "windows" ] }, { - "description": "allow-check-permissions -> Enables the check_permissions command without any pre-configured scope.", + "description": "Linux.", "type": "string", "enum": [ - "allow-check-permissions" + "linux" ] }, { - "description": "deny-check-permissions -> Denies the check_permissions command without any pre-configured scope.", + "description": "Android.", "type": "string", "enum": [ - "deny-check-permissions" + "android" ] }, { - "description": "allow-open-app-settings -> Enables the open_app_settings command without any pre-configured scope.", + "description": "iOS.", "type": "string", "enum": [ - "allow-open-app-settings" + "iOS" ] + } + ] + }, + "PermissionKind": { + "type": "string", + "oneOf": [ + { + "description": "Enables the cancel command without any pre-configured scope.", + "type": "string", + "const": "allow-cancel", + "markdownDescription": "Enables the cancel command without any pre-configured scope." }, { - "description": "deny-open-app-settings -> Denies the open_app_settings command without any pre-configured scope.", + "description": "Denies the cancel command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-open-app-settings" - ] + "const": "deny-cancel", + "markdownDescription": "Denies the cancel command without any pre-configured scope." }, { - "description": "allow-request-permissions -> Enables the request_permissions command without any pre-configured scope.", + "description": "Enables the check_permissions command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-request-permissions" - ] + "const": "allow-check-permissions", + "markdownDescription": "Enables the check_permissions command without any pre-configured scope." }, { - "description": "deny-request-permissions -> Denies the request_permissions command without any pre-configured scope.", + "description": "Denies the check_permissions command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-request-permissions" - ] + "const": "deny-check-permissions", + "markdownDescription": "Denies the check_permissions command without any pre-configured scope." }, { - "description": "allow-scan -> Enables the scan command without any pre-configured scope.", + "description": "Enables the open_app_settings command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-scan" - ] + "const": "allow-open-app-settings", + "markdownDescription": "Enables the open_app_settings command without any pre-configured scope." }, { - "description": "deny-scan -> Denies the scan command without any pre-configured scope.", + "description": "Denies the open_app_settings command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-scan" - ] + "const": "deny-open-app-settings", + "markdownDescription": "Denies the open_app_settings command without any pre-configured scope." }, { - "description": "allow-vibrate -> Enables the vibrate command without any pre-configured scope.", + "description": "Enables the request_permissions command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-vibrate" - ] + "const": "allow-request-permissions", + "markdownDescription": "Enables the request_permissions command without any pre-configured scope." }, { - "description": "deny-vibrate -> Denies the vibrate command without any pre-configured scope.", + "description": "Denies the request_permissions command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-vibrate" - ] + "const": "deny-request-permissions", + "markdownDescription": "Denies the request_permissions command without any pre-configured scope." + }, + { + "description": "Enables the scan command without any pre-configured scope.", + "type": "string", + "const": "allow-scan", + "markdownDescription": "Enables the scan command without any pre-configured scope." + }, + { + "description": "Denies the scan command without any pre-configured scope.", + "type": "string", + "const": "deny-scan", + "markdownDescription": "Denies the scan command without any pre-configured scope." + }, + { + "description": "Enables the vibrate command without any pre-configured scope.", + "type": "string", + "const": "allow-vibrate", + "markdownDescription": "Enables the vibrate command without any pre-configured scope." + }, + { + "description": "Denies the vibrate command without any pre-configured scope.", + "type": "string", + "const": "deny-vibrate", + "markdownDescription": "Denies the vibrate command without any pre-configured scope." + }, + { + "description": "This permission set configures which\nbarcode scanning features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all barcode related features.\n\n\n#### This default permission set includes:\n\n- `allow-cancel`\n- `allow-check-permissions`\n- `allow-open-app-settings`\n- `allow-request-permissions`\n- `allow-scan`\n- `allow-vibrate`", + "type": "string", + "const": "default", + "markdownDescription": "This permission set configures which\nbarcode scanning features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all barcode related features.\n\n\n#### This default permission set includes:\n\n- `allow-cancel`\n- `allow-check-permissions`\n- `allow-open-app-settings`\n- `allow-request-permissions`\n- `allow-scan`\n- `allow-vibrate`" } ] } diff --git a/plugins/barcode-scanner/rollup.config.js b/plugins/barcode-scanner/rollup.config.js index 977dfac8..1f349ec8 100644 --- a/plugins/barcode-scanner/rollup.config.js +++ b/plugins/barcode-scanner/rollup.config.js @@ -2,6 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { createConfig } from "../../shared/rollup.config.js"; +import { createConfig } from '../../shared/rollup.config.js' -export default createConfig(); +export default createConfig() diff --git a/plugins/barcode-scanner/src/api-iife.js b/plugins/barcode-scanner/src/api-iife.js deleted file mode 100644 index 77c9d45c..00000000 --- a/plugins/barcode-scanner/src/api-iife.js +++ /dev/null @@ -1 +0,0 @@ -if("__TAURI__"in window){var __TAURI_PLUGIN_BARCODESCANNER__=function(n){"use strict";async function e(n,e={},r){return window.__TAURI_INTERNALS__.invoke(n,e,r)}var r;return"function"==typeof SuppressedError&&SuppressedError,n.Format=void 0,(r=n.Format||(n.Format={})).QRCode="QR_CODE",r.UPC_A="UPC_A",r.UPC_E="UPC_E",r.EAN8="EAN_8",r.EAN13="EAN_13",r.Code39="CODE_39",r.Code93="CODE_93",r.Code128="CODE_128",r.Codabar="CODABAR",r.ITF="ITF",r.Aztec="AZTEC",r.DataMatrix="DATA_MATRIX",r.PDF417="PDF_417",n.cancel=async function(){return await e("plugin:barcode-scanner|cancel")},n.checkPermissions=async function(){return await e("plugin:barcode-scanner|check_permissions").then((n=>n.camera))},n.openAppSettings=async function(){return await e("plugin:barcode-scanner|open_app_settings")},n.requestPermissions=async function(){return await e("plugin:barcode-scanner|request_permissions").then((n=>n.camera))},n.scan=async function(n){return await e("plugin:barcode-scanner|scan",{...n})},n}({});Object.defineProperty(window.__TAURI__,"barcodeScanner",{value:__TAURI_PLUGIN_BARCODESCANNER__})} diff --git a/plugins/barcode-scanner/src/lib.rs b/plugins/barcode-scanner/src/lib.rs index 1b6fcff4..2f2e7ee9 100644 --- a/plugins/barcode-scanner/src/lib.rs +++ b/plugins/barcode-scanner/src/lib.rs @@ -27,7 +27,7 @@ pub struct BarcodeScanner(PluginHandle); impl BarcodeScanner {} -/// Extensions to [`tauri::App`], [`tauri::AppHandle`] and [`tauri::Window`] to access the barcode scanner APIs. +/// Extensions to [`tauri::App`], [`tauri::AppHandle`], [`tauri::WebviewWindow`], [`tauri::Webview`] and [`tauri::Window`] to access the barcode scanner APIs. pub trait BarcodeScannerExt { fn barcode_scanner(&self) -> &BarcodeScanner; } diff --git a/plugins/biometric/CHANGELOG.md b/plugins/biometric/CHANGELOG.md index 67aa19f9..5ebbe50f 100644 --- a/plugins/biometric/CHANGELOG.md +++ b/plugins/biometric/CHANGELOG.md @@ -1,5 +1,74 @@ # Changelog +## \[2.2.1] + +### bug + +- [`10f9e66e`](https://github.com/tauri-apps/plugins-workspace/commit/10f9e66e32141dd35f4bf884fbf9102691187e92) ([#2633](https://github.com/tauri-apps/plugins-workspace/pull/2633) by [@pjf-dev](https://github.com/tauri-apps/plugins-workspace/../../pjf-dev)) Fix biometric plugin ignoring fallback logic when biometry status is unavailable or not enrolled on iOS. + +## \[2.2.0] + +- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other. + +## \[2.0.1] + +- [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7. + +## \[2.0.0] + +- [`e2c4dfb6`](https://github.com/tauri-apps/plugins-workspace/commit/e2c4dfb6af43e5dd8d9ceba232c315f5febd55c1) Update to tauri v2 stable release. + +## \[2.0.0-rc.1] + +- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri 2.0.0-rc.8 + +## \[2.0.0-rc.2] + +- [`b9147758`](https://github.com/tauri-apps/plugins-workspace/commit/b914775898c2bee7ceb20bd17ee595005cd17a64) ([#1679](https://github.com/tauri-apps/plugins-workspace/pull/1679) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Explicitly set a minimum macOS version for the Swift package. + +## \[2.0.0-rc.1] + +### changes + +- [`6b079cfd`](https://github.com/tauri-apps/plugins-workspace/commit/6b079cfdd107c94abc2c7300f6af00bac3ff4040) ([#1649](https://github.com/tauri-apps/plugins-workspace/pull/1649) by [@ahqsoftwares](https://github.com/tauri-apps/plugins-workspace/../../ahqsoftwares)) Remove targetSdk from build.kts files as it is deprecated and will be removed from DSL v9.0 + +## \[2.0.0-rc.0] + +- [`9887d1`](https://github.com/tauri-apps/plugins-workspace/commit/9887d14bd0e971c4c0f5c1188fc4005d3fc2e29e) Update to tauri RC. + +## \[2.0.0-beta.8] + +- [`99d6ac0f`](https://github.com/tauri-apps/plugins-workspace/commit/99d6ac0f9506a6a4a1aa59c728157190a7441af6) ([#1606](https://github.com/tauri-apps/plugins-workspace/pull/1606) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) The JS packages now specify the *minimum* `@tauri-apps/api` version instead of a single exact version. +- [`6de87966`](https://github.com/tauri-apps/plugins-workspace/commit/6de87966ecc00ad9d91c25be452f1f46bd2b7e1f) ([#1597](https://github.com/tauri-apps/plugins-workspace/pull/1597) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Update to tauri beta.25. + +## \[2.0.0-beta.7] + +- [`22a17980`](https://github.com/tauri-apps/plugins-workspace/commit/22a17980ff4f6f8c40adb1b8f4ffc6dae2fe7e30) ([#1537](https://github.com/tauri-apps/plugins-workspace/pull/1537) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri beta.24. + +## \[2.0.0-beta.6] + +- [`76daee7a`](https://github.com/tauri-apps/plugins-workspace/commit/76daee7aafece34de3092c86e531cf9eb1138989) ([#1512](https://github.com/tauri-apps/plugins-workspace/pull/1512) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Update to tauri beta.23. + +## \[2.0.0-beta.5] + +- [`9013854f`](https://github.com/tauri-apps/plugins-workspace/commit/9013854f42a49a230b9dbb9d02774765528a923f)([#1382](https://github.com/tauri-apps/plugins-workspace/pull/1382)) Update to tauri beta.22. + +## \[2.0.0-beta.4] + +- [`430bd6f4`](https://github.com/tauri-apps/plugins-workspace/commit/430bd6f4f379bee5d232ae6b098ae131db7f178a)([#1363](https://github.com/tauri-apps/plugins-workspace/pull/1363)) Update to tauri beta.20. + +## \[2.0.0-beta.3] + +- [`bd1ed590`](https://github.com/tauri-apps/plugins-workspace/commit/bd1ed5903ffcce5500310dac1e59e8c67674ef1e)([#1237](https://github.com/tauri-apps/plugins-workspace/pull/1237)) Update to tauri beta.17. + +## \[2.0.0-beta.3] + +- [`a04ea2f`](https://github.com/tauri-apps/plugins-workspace/commit/a04ea2f38294d5a3987578283badc8eec87a7752)([#1071](https://github.com/tauri-apps/plugins-workspace/pull/1071)) The global API script is now only added to the binary when the `withGlobalTauri` config is true. + +## \[2.0.0-beta.2] + +- [`99bea25`](https://github.com/tauri-apps/plugins-workspace/commit/99bea2559c2c0648c2519c50a18cd124dacef57b)([#1005](https://github.com/tauri-apps/plugins-workspace/pull/1005)) Update to tauri beta.8. + ## \[2.0.0-beta.1] - [`569defb`](https://github.com/tauri-apps/plugins-workspace/commit/569defbe9492e38938554bb7bdc1be9151456d21) Update to tauri beta.4. @@ -12,4 +81,14 @@ - [`8df28a9`](https://github.com/tauri-apps/plugins-workspace/commit/8df28a987519ecfa03dcb8635443025f8d010362)([#829](https://github.com/tauri-apps/plugins-workspace/pull/829)) Initial release. - [`8df28a9`](https://github.com/tauri-apps/plugins-workspace/commit/8df28a987519ecfa03dcb8635443025f8d010362)([#829](https://github.com/tauri-apps/plugins-workspace/pull/829)) Initial release. -commit/8df28a987519ecfa03dcb8635443025f8d010362)([#829](https://github.com/tauri-apps/plugins-workspace/pull/829)) Initial release. + commit/8df28a987519ecfa03dcb8635443025f8d010362)([#829](https://github.com/tauri-apps/plugins-workspace/pull/829)) Initial release. + 29]\(https://github.com/tauri-apps/plugins-workspace/pull/829)) Initial release. + commit/8df28a987519ecfa03dcb8635443025f8d010362)([#829](https://github.com/tauri-apps/plugins-workspace/pull/829)) Initial release. + . + commit/8df28a987519ecfa03dcb8635443025f8d010362)([#829](https://github.com/tauri-apps/plugins-workspace/pull/829)) Initial release. + itial release. + 29]\(https://github.com/tauri-apps/plugins-workspace/pull/829)) Initial release. + commit/8df28a987519ecfa03dcb8635443025f8d010362)([#829](https://github.com/tauri-apps/plugins-workspace/pull/829)) Initial release. + . + commit/8df28a987519ecfa03dcb8635443025f8d010362)([#829](https://github.com/tauri-apps/plugins-workspace/pull/829)) Initial release. + ithub.com/tauri-apps/plugins-workspace/pull/829)) Initial release. diff --git a/plugins/biometric/Cargo.toml b/plugins/biometric/Cargo.toml index c1699fd4..2b76fea4 100644 --- a/plugins/biometric/Cargo.toml +++ b/plugins/biometric/Cargo.toml @@ -1,18 +1,28 @@ [package] name = "tauri-plugin-biometric" -version = "2.0.0-beta.1" +version = "2.2.1" description = "Prompt the user for biometric authentication on Android and iOS." edition = { workspace = true } authors = { workspace = true } license = { workspace = true } +repository = { workspace = true } links = "tauri-plugin-biometric" [package.metadata.docs.rs] -rustc-args = [ "--cfg", "docsrs" ] -rustdoc-args = [ "--cfg", "docsrs" ] +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs"] +targets = ["x86_64-linux-android"] + +[package.metadata.platforms.support] +windows = { level = "none", notes = "" } +linux = { level = "none", notes = "" } +macos = { level = "none", notes = "" } +android = { level = "full", notes = "" } +ios = { level = "full", notes = "" } + [build-dependencies] -tauri-plugin = { workspace = true, features = [ "build" ] } +tauri-plugin = { workspace = true, features = ["build"] } [dependencies] serde = { workspace = true } diff --git a/plugins/biometric/README.md b/plugins/biometric/README.md index 459441eb..c7844f7b 100644 --- a/plugins/biometric/README.md +++ b/plugins/biometric/README.md @@ -2,6 +2,14 @@ Prompt the user for biometric authentication on Android and iOS. +| Platform | Supported | +| -------- | --------- | +| Linux | x | +| Windows | x | +| macOS | x | +| Android | ✓ | +| iOS | ✓ | + ## Install _This plugin requires a Rust version of at least **1.65**_ @@ -18,7 +26,7 @@ Install the Core plugin by adding the following to your `Cargo.toml` file: ```toml [dependencies] -tauri-plugin-biometric = "2.0.0-beta" +tauri-plugin-biometric = "2.0.0" # alternatively with Git: tauri-plugin-biometric = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` @@ -48,7 +56,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-biometric#v2 First you need to register the core plugin with Tauri: -`src-tauri/src/main.rs` +`src-tauri/src/lib.rs` ```rust fn main() { @@ -62,8 +70,8 @@ fn main() { Afterwards all the plugin's APIs are available through the JavaScript guest bindings: ```javascript -import { authenticate } from "@tauri-apps/plugin-biometric"; -await authenticate('Open your wallet'); +import { authenticate } from '@tauri-apps/plugin-biometric' +await authenticate('Open your wallet') ``` ## Contributing diff --git a/plugins/biometric/SECURITY.md b/plugins/biometric/SECURITY.md new file mode 100644 index 00000000..4f09bbac --- /dev/null +++ b/plugins/biometric/SECURITY.md @@ -0,0 +1,23 @@ +# Security Policy + +**Do not report security vulnerabilities through public GitHub issues.** + +**Please use the [Private Vulnerability Disclosure](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability) feature of GitHub.** + +Include as much of the following information: + +- Type of issue (e.g. improper input parsing, privilege escalation, etc.) +- The location of the affected source code (tag/branch/commit or direct URL) +- Any special configuration required to reproduce the issue +- The distribution affected or used to help us with reproduction of the issue +- Step-by-step instructions to reproduce the issue +- Ideally a reproduction repository +- Impact of the issue, including how an attacker might exploit the issue + +We prefer to receive reports in English. + +## Contact + +Please disclose a vulnerability or security relevant issue here: [https://github.com/tauri-apps/plugins-workspace/security/advisories/new](https://github.com/tauri-apps/plugins-workspace/security/advisories/new). + +Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app). diff --git a/plugins/biometric/android/build.gradle.kts b/plugins/biometric/android/build.gradle.kts index 81d4f70e..d8833662 100644 --- a/plugins/biometric/android/build.gradle.kts +++ b/plugins/biometric/android/build.gradle.kts @@ -5,11 +5,10 @@ plugins { android { namespace = "app.tauri.biometric" - compileSdk = 32 + compileSdk = 34 defaultConfig { - minSdk = 24 - targetSdk = 32 + minSdk = 24 testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles("consumer-rules.pro") diff --git a/plugins/biometric/android/src/main/java/BiometricPlugin.kt b/plugins/biometric/android/src/main/java/BiometricPlugin.kt index 11e3ddf5..b3436fd4 100644 --- a/plugins/biometric/android/src/main/java/BiometricPlugin.kt +++ b/plugins/biometric/android/src/main/java/BiometricPlugin.kt @@ -115,6 +115,7 @@ class BiometricPlugin(private val activity: Activity): Plugin(activity) { val biometryResult = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { manager.canAuthenticate(BiometricManager.Authenticators.BIOMETRIC_WEAK) } else { + @Suppress("DEPRECATION") manager.canAuthenticate() } val ret = JSObject() diff --git a/plugins/biometric/api-iife.js b/plugins/biometric/api-iife.js new file mode 100644 index 00000000..3da2296b --- /dev/null +++ b/plugins/biometric/api-iife.js @@ -0,0 +1 @@ +if("__TAURI__"in window){var __TAURI_PLUGIN_BIOMETRIC__=function(e){"use strict";async function i(e,i={},t){return window.__TAURI_INTERNALS__.invoke(e,i,t)}var t;return"function"==typeof SuppressedError&&SuppressedError,e.BiometryType=void 0,(t=e.BiometryType||(e.BiometryType={}))[t.None=0]="None",t[t.TouchID=1]="TouchID",t[t.FaceID=2]="FaceID",t[t.Iris=3]="Iris",e.authenticate=async function(e,t){await i("plugin:biometric|authenticate",{reason:e,...t})},e.checkStatus=async function(){return await i("plugin:biometric|status")},e}({});Object.defineProperty(window.__TAURI__,"biometric",{value:__TAURI_PLUGIN_BIOMETRIC__})} diff --git a/plugins/biometric/build.rs b/plugins/biometric/build.rs index 3df01ac9..070986b2 100644 --- a/plugins/biometric/build.rs +++ b/plugins/biometric/build.rs @@ -5,8 +5,14 @@ const COMMANDS: &[&str] = &["authenticate", "status"]; fn main() { - tauri_plugin::Builder::new(COMMANDS) + let result = tauri_plugin::Builder::new(COMMANDS) + .global_api_script_path("./api-iife.js") .android_path("android") .ios_path("ios") - .build(); + .try_build(); + + // when building documentation for Android the plugin build result is always Err() and is irrelevant to the crate documentation build + if !(cfg!(docsrs) && std::env::var("TARGET").unwrap().contains("android")) { + result.unwrap(); + } } diff --git a/plugins/biometric/guest-js/index.ts b/plugins/biometric/guest-js/index.ts index 16ab3807..5c3eb8df 100644 --- a/plugins/biometric/guest-js/index.ts +++ b/plugins/biometric/guest-js/index.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { invoke } from "@tauri-apps/api/core"; +import { invoke } from '@tauri-apps/api/core' export enum BiometryType { None = 0, @@ -11,39 +11,39 @@ export enum BiometryType { // Apple FaceID or Android face authentication FaceID = 2, // Android iris authentication - Iris = 3, + Iris = 3 } export interface Status { - isAvailable: boolean; - biometryType: BiometryType; - error?: string; + isAvailable: boolean + biometryType: BiometryType + error?: string errorCode?: - | "appCancel" - | "authenticationFailed" - | "invalidContext" - | "notInteractive" - | "passcodeNotSet" - | "systemCancel" - | "userCancel" - | "userFallback" - | "biometryLockout" - | "biometryNotAvailable" - | "biometryNotEnrolled"; + | 'appCancel' + | 'authenticationFailed' + | 'invalidContext' + | 'notInteractive' + | 'passcodeNotSet' + | 'systemCancel' + | 'userCancel' + | 'userFallback' + | 'biometryLockout' + | 'biometryNotAvailable' + | 'biometryNotEnrolled' } export interface AuthOptions { - allowDeviceCredential?: boolean; - cancelTitle?: string; + allowDeviceCredential?: boolean + cancelTitle?: string // iOS options - fallbackTitle?: string; + fallbackTitle?: string // android options - title?: string; - subtitle?: string; - confirmationRequired?: boolean; - maxAttemps?: number; + title?: string + subtitle?: string + confirmationRequired?: boolean + maxAttemps?: number } /** @@ -51,7 +51,7 @@ export interface AuthOptions { * @returns a promise resolving to an object containing all the information about the status of the biometry. */ export async function checkStatus(): Promise { - return invoke("plugin:biometric|status"); + return await invoke('plugin:biometric|status') } /** @@ -68,10 +68,10 @@ export async function checkStatus(): Promise { */ export async function authenticate( reason: string, - options?: AuthOptions, + options?: AuthOptions ): Promise { - return invoke("plugin:biometric|authenticate", { + await invoke('plugin:biometric|authenticate', { reason, - ...options, - }); + ...options + }) } diff --git a/plugins/biometric/ios/Package.swift b/plugins/biometric/ios/Package.swift index 34c9f87e..7860f476 100644 --- a/plugins/biometric/ios/Package.swift +++ b/plugins/biometric/ios/Package.swift @@ -8,7 +8,8 @@ import PackageDescription let package = Package( name: "tauri-plugin-biometric", platforms: [ - .iOS(.v13) + .macOS(.v10_13), + .iOS(.v13), ], products: [ // Products define the executables and libraries a package produces, and make them visible to other packages. diff --git a/plugins/biometric/ios/Sources/BiometricPlugin.swift b/plugins/biometric/ios/Sources/BiometricPlugin.swift index 7e3e8bbd..c295904a 100644 --- a/plugins/biometric/ios/Sources/BiometricPlugin.swift +++ b/plugins/biometric/ios/Sources/BiometricPlugin.swift @@ -25,8 +25,8 @@ class BiometricStatus { struct AuthOptions: Decodable { let reason: String var allowDeviceCredential: Bool? - let fallbackTitle: String? - let cancelTitle: String? + var fallbackTitle: String? + var cancelTitle: String? } class BiometricPlugin: Plugin { @@ -98,7 +98,12 @@ class BiometricPlugin: Plugin { } @objc func authenticate(_ invoke: Invoke) throws { - guard self.status.available else { + let args = try invoke.parseArgs(AuthOptions.self) + + let allowDeviceCredential = args.allowDeviceCredential ?? false + + guard self.status.available || allowDeviceCredential else { + // Biometry unavailable, fallback disabled invoke.reject( self.status.errorReason ?? "", code: self.status.errorCode ?? "" @@ -106,15 +111,11 @@ class BiometricPlugin: Plugin { return } - let args = try invoke.parseArgs(AuthOptions.self) - let context = LAContext() context.localizedFallbackTitle = args.fallbackTitle context.localizedCancelTitle = args.cancelTitle context.touchIDAuthenticationAllowableReuseDuration = 0 - let allowDeviceCredential = args.allowDeviceCredential ?? false - // force system default fallback title if an empty string is provided (the OS hides the fallback button in this case) if allowDeviceCredential, let fallbackTitle = context.localizedFallbackTitle, diff --git a/plugins/biometric/package.json b/plugins/biometric/package.json index 82578b0a..2307d67b 100644 --- a/plugins/biometric/package.json +++ b/plugins/biometric/package.json @@ -1,10 +1,11 @@ { "name": "@tauri-apps/plugin-biometric", - "version": "2.0.0-beta.1", - "license": "MIT or APACHE-2.0", + "version": "2.2.1", + "license": "MIT OR Apache-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" ], + "repository": "https://github.com/tauri-apps/plugins-workspace", "type": "module", "types": "./dist-js/index.d.ts", "main": "./dist-js/index.cjs", @@ -23,10 +24,7 @@ "README.md", "LICENSE" ], - "devDependencies": { - "tslib": "2.6.0" - }, "dependencies": { - "@tauri-apps/api": "2.0.0-beta.2" + "@tauri-apps/api": "^2.0.0" } } diff --git a/plugins/biometric/permissions/autogenerated/reference.md b/plugins/biometric/permissions/autogenerated/reference.md index ef091dfa..8f085093 100644 --- a/plugins/biometric/permissions/autogenerated/reference.md +++ b/plugins/biometric/permissions/autogenerated/reference.md @@ -1,18 +1,77 @@ -# Permissions +## Default Permission -## allow-authenticate +This permission set configures which +biometric features are by default exposed. + +#### Granted Permissions + +It allows acccess to all biometric commands. + + + +#### This default permission set includes the following: + +- `allow-authenticate` +- `allow-status` + +## Permission Table + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IdentifierDescription
+ +`biometric:allow-authenticate` + + Enables the authenticate command without any pre-configured scope. -## deny-authenticate +
+ +`biometric:deny-authenticate` + + Denies the authenticate command without any pre-configured scope. -## allow-status +
+ +`biometric:allow-status` + + Enables the status command without any pre-configured scope. -## deny-status +
+ +`biometric:deny-status` + + Denies the status command without any pre-configured scope. +
diff --git a/plugins/biometric/permissions/default.toml b/plugins/biometric/permissions/default.toml new file mode 100644 index 00000000..651990ef --- /dev/null +++ b/plugins/biometric/permissions/default.toml @@ -0,0 +1,13 @@ +"$schema" = "schemas/schema.json" +[default] +description = """ +This permission set configures which +biometric features are by default exposed. + +#### Granted Permissions + +It allows acccess to all biometric commands. + +""" + +permissions = ["allow-authenticate", "allow-status"] diff --git a/plugins/biometric/permissions/schemas/schema.json b/plugins/biometric/permissions/schemas/schema.json index 8a83e483..416759b5 100644 --- a/plugins/biometric/permissions/schemas/schema.json +++ b/plugins/biometric/permissions/schemas/schema.json @@ -17,7 +17,6 @@ }, "set": { "description": "A list of permissions sets defined", - "default": [], "type": "array", "items": { "$ref": "#/definitions/PermissionSet" @@ -50,7 +49,7 @@ "minimum": 1.0 }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -112,7 +111,7 @@ "type": "string" }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri internal convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -132,12 +131,21 @@ }, "scope": { "description": "Allowed or denied scoped when using this permission.", - "default": {}, "allOf": [ { "$ref": "#/definitions/Scopes" } ] + }, + "platforms": { + "description": "Target platforms this permission applies. By default all platforms are affected by this permission.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Target" + } } } }, @@ -164,7 +172,7 @@ } }, "Scopes": { - "description": "A restriction of the command/endpoint functionality.\n\nIt can be of any serde serializable type and is used for allowing or preventing certain actions inside a Tauri command.\n\nThe scope is passed to the command and handled/enforced by the command itself.", + "description": "An argument for fine grained behavior control of Tauri commands.\n\nIt can be of any serde serializable type and is used to allow or prevent certain actions inside a Tauri command. The configured scope is passed to the command and will be enforced by the command implementation.\n\n## Example\n\n```json { \"allow\": [{ \"path\": \"$HOME/**\" }], \"deny\": [{ \"path\": \"$HOME/secret.txt\" }] } ```", "type": "object", "properties": { "allow": { @@ -178,7 +186,7 @@ } }, "deny": { - "description": "Data that defines what is denied by the scope.", + "description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.", "type": [ "array", "null" @@ -243,36 +251,78 @@ } ] }, - "PermissionKind": { - "type": "string", + "Target": { + "description": "Platform target.", "oneOf": [ { - "description": "allow-authenticate -> Enables the authenticate command without any pre-configured scope.", + "description": "MacOS.", "type": "string", "enum": [ - "allow-authenticate" + "macOS" ] }, { - "description": "deny-authenticate -> Denies the authenticate command without any pre-configured scope.", + "description": "Windows.", "type": "string", "enum": [ - "deny-authenticate" + "windows" ] }, { - "description": "allow-status -> Enables the status command without any pre-configured scope.", + "description": "Linux.", "type": "string", "enum": [ - "allow-status" + "linux" ] }, { - "description": "deny-status -> Denies the status command without any pre-configured scope.", + "description": "Android.", "type": "string", "enum": [ - "deny-status" + "android" ] + }, + { + "description": "iOS.", + "type": "string", + "enum": [ + "iOS" + ] + } + ] + }, + "PermissionKind": { + "type": "string", + "oneOf": [ + { + "description": "Enables the authenticate command without any pre-configured scope.", + "type": "string", + "const": "allow-authenticate", + "markdownDescription": "Enables the authenticate command without any pre-configured scope." + }, + { + "description": "Denies the authenticate command without any pre-configured scope.", + "type": "string", + "const": "deny-authenticate", + "markdownDescription": "Denies the authenticate command without any pre-configured scope." + }, + { + "description": "Enables the status command without any pre-configured scope.", + "type": "string", + "const": "allow-status", + "markdownDescription": "Enables the status command without any pre-configured scope." + }, + { + "description": "Denies the status command without any pre-configured scope.", + "type": "string", + "const": "deny-status", + "markdownDescription": "Denies the status command without any pre-configured scope." + }, + { + "description": "This permission set configures which\nbiometric features are by default exposed.\n\n#### Granted Permissions\n\nIt allows acccess to all biometric commands.\n\n\n#### This default permission set includes:\n\n- `allow-authenticate`\n- `allow-status`", + "type": "string", + "const": "default", + "markdownDescription": "This permission set configures which\nbiometric features are by default exposed.\n\n#### Granted Permissions\n\nIt allows acccess to all biometric commands.\n\n\n#### This default permission set includes:\n\n- `allow-authenticate`\n- `allow-status`" } ] } diff --git a/plugins/biometric/rollup.config.js b/plugins/biometric/rollup.config.js index 977dfac8..1f349ec8 100644 --- a/plugins/biometric/rollup.config.js +++ b/plugins/biometric/rollup.config.js @@ -2,6 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { createConfig } from "../../shared/rollup.config.js"; +import { createConfig } from '../../shared/rollup.config.js' -export default createConfig(); +export default createConfig() diff --git a/plugins/biometric/src/api-iife.js b/plugins/biometric/src/api-iife.js deleted file mode 100644 index 450585b5..00000000 --- a/plugins/biometric/src/api-iife.js +++ /dev/null @@ -1 +0,0 @@ -if("__TAURI__"in window){var __TAURI_PLUGIN_BIOMETRIC__=function(e){"use strict";async function n(e,n={},r){return window.__TAURI_INTERNALS__.invoke(e,n,r)}var r;return"function"==typeof SuppressedError&&SuppressedError,e.BiometryType=void 0,(r=e.BiometryType||(e.BiometryType={}))[r.None=0]="None",r[r.TouchID=1]="TouchID",r[r.FaceID=2]="FaceID",r[r.Iris=3]="Iris",e.authenticate=async function(e,r){return n("plugin:biometric|authenticate",{reason:e,...r})},e.checkStatus=async function(){return n("plugin:biometric|status")},e}({});Object.defineProperty(window.__TAURI__,"biometric",{value:__TAURI_PLUGIN_BIOMETRIC__})} diff --git a/plugins/biometric/src/lib.rs b/plugins/biometric/src/lib.rs index 8b0d472d..f79a104d 100644 --- a/plugins/biometric/src/lib.rs +++ b/plugins/biometric/src/lib.rs @@ -45,7 +45,7 @@ impl Biometric { } } -/// Extensions to [`tauri::App`], [`tauri::AppHandle`] and [`tauri::Window`] to access the biometric APIs. +/// Extensions to [`tauri::App`], [`tauri::AppHandle`], [`tauri::WebviewWindow`], [`tauri::Webview`] and [`tauri::Window`] to access the biometric APIs. pub trait BiometricExt { fn biometric(&self) -> &Biometric; } @@ -59,7 +59,6 @@ impl> crate::BiometricExt for T { /// Initializes the plugin. pub fn init() -> TauriPlugin { Builder::new("biometric") - .js_init_script(include_str!("api-iife.js").to_string()) .setup(|app, api| { #[cfg(target_os = "android")] let handle = api.register_android_plugin(PLUGIN_IDENTIFIER, "BiometricPlugin")?; diff --git a/plugins/biometric/src/models.rs b/plugins/biometric/src/models.rs index e4fceedc..49c84300 100644 --- a/plugins/biometric/src/models.rs +++ b/plugins/biometric/src/models.rs @@ -7,16 +7,17 @@ use serde::{Deserialize, Serialize}; #[derive(Debug, Default, Serialize)] #[serde(rename_all = "camelCase")] pub struct AuthOptions { + /// Enables authentication using the device's password. This feature is available on both Android and iOS. pub allow_device_credential: bool, - /// iOS only. - pub fallback_title: Option, - /// iOS only. + /// Label for the Cancel button. This feature is available on both Android and iOS. pub cancel_title: Option, - /// Android only. + /// Specifies the text displayed on the fallback button if biometric authentication fails. This feature is available iOS only. + pub fallback_title: Option, + /// Title indicating the purpose of biometric verification. This feature is available Android only. pub title: Option, - /// Android only. + /// SubTitle providing contextual information of biometric verification. This feature is available Android only. pub subtitle: Option, - /// Android only. + /// Specifies whether additional user confirmation is required, such as pressing a button after successful biometric authentication. This feature is available Android only. pub confirmation_required: Option, } diff --git a/plugins/cli/CHANGELOG.md b/plugins/cli/CHANGELOG.md index 84b71e6f..c2c011e2 100644 --- a/plugins/cli/CHANGELOG.md +++ b/plugins/cli/CHANGELOG.md @@ -1,5 +1,62 @@ # Changelog +## \[2.2.0] + +- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other. + +## \[2.0.1] + +- [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7. + +## \[2.0.0] + +- [`e2c4dfb6`](https://github.com/tauri-apps/plugins-workspace/commit/e2c4dfb6af43e5dd8d9ceba232c315f5febd55c1) Update to tauri v2 stable release. + +## \[2.0.0-rc.2] + +- [`68579934`](https://github.com/tauri-apps/plugins-workspace/commit/68579934c93f6ed2edbc97474560d6a8a00e8f70) ([#1856](https://github.com/tauri-apps/plugins-workspace/pull/1856) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Expose `Matches`, `SubcommandMatches` and `ArgData` structs. + +## \[2.0.0-rc.1] + +- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri 2.0.0-rc.8 + +## \[2.0.0-rc.0] + +- [`9887d1`](https://github.com/tauri-apps/plugins-workspace/commit/9887d14bd0e971c4c0f5c1188fc4005d3fc2e29e) Update to tauri RC. + +## \[2.0.0-beta.8] + +- [`99d6ac0f`](https://github.com/tauri-apps/plugins-workspace/commit/99d6ac0f9506a6a4a1aa59c728157190a7441af6) ([#1606](https://github.com/tauri-apps/plugins-workspace/pull/1606) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) The JS packages now specify the *minimum* `@tauri-apps/api` version instead of a single exact version. +- [`6de87966`](https://github.com/tauri-apps/plugins-workspace/commit/6de87966ecc00ad9d91c25be452f1f46bd2b7e1f) ([#1597](https://github.com/tauri-apps/plugins-workspace/pull/1597) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Update to tauri beta.25. + +## \[2.0.0-beta.7] + +- [`22a17980`](https://github.com/tauri-apps/plugins-workspace/commit/22a17980ff4f6f8c40adb1b8f4ffc6dae2fe7e30) ([#1537](https://github.com/tauri-apps/plugins-workspace/pull/1537) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri beta.24. + +## \[2.0.0-beta.6] + +- [`76daee7a`](https://github.com/tauri-apps/plugins-workspace/commit/76daee7aafece34de3092c86e531cf9eb1138989) ([#1512](https://github.com/tauri-apps/plugins-workspace/pull/1512) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Update to tauri beta.23. + +## \[2.0.0-beta.5] + +- [`9013854f`](https://github.com/tauri-apps/plugins-workspace/commit/9013854f42a49a230b9dbb9d02774765528a923f)([#1382](https://github.com/tauri-apps/plugins-workspace/pull/1382)) Update to tauri beta.22. + +## \[2.0.0-beta.4] + +- [`430bd6f4`](https://github.com/tauri-apps/plugins-workspace/commit/430bd6f4f379bee5d232ae6b098ae131db7f178a)([#1363](https://github.com/tauri-apps/plugins-workspace/pull/1363)) Update to tauri beta.20. + +## \[2.0.0-beta.3] + +- [`bd1ed590`](https://github.com/tauri-apps/plugins-workspace/commit/bd1ed5903ffcce5500310dac1e59e8c67674ef1e)([#1237](https://github.com/tauri-apps/plugins-workspace/pull/1237)) Update to tauri beta.17. + +## \[2.0.0-beta.3] + +- [`a04ea2f`](https://github.com/tauri-apps/plugins-workspace/commit/a04ea2f38294d5a3987578283badc8eec87a7752)([#1071](https://github.com/tauri-apps/plugins-workspace/pull/1071)) The global API script is now only added to the binary when the `withGlobalTauri` config is true. + +## \[2.0.0-beta.2] + +- [`99bea25`](https://github.com/tauri-apps/plugins-workspace/commit/99bea2559c2c0648c2519c50a18cd124dacef57b)([#1005](https://github.com/tauri-apps/plugins-workspace/pull/1005)) Update to tauri beta.8. + ## \[2.0.0-beta.1] - [`569defb`](https://github.com/tauri-apps/plugins-workspace/commit/569defbe9492e38938554bb7bdc1be9151456d21) Update to tauri beta.4. @@ -36,9 +93,3 @@ - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! te to alpha.11. - -## \[2.0.0-alpha.0] - -- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - ae67\`]\(https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! -717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/cli/Cargo.toml b/plugins/cli/Cargo.toml index 478d6b47..500ba957 100644 --- a/plugins/cli/Cargo.toml +++ b/plugins/cli/Cargo.toml @@ -1,19 +1,28 @@ [package] name = "tauri-plugin-cli" -version = "2.0.0-beta.1" +version = "2.2.0" description = "Parse arguments from your Tauri application's command line interface." edition = { workspace = true } authors = { workspace = true } license = { workspace = true } rust-version = { workspace = true } +repository = { workspace = true } links = "tauri-plugin-cli" [package.metadata.docs.rs] -rustc-args = [ "--cfg", "docsrs" ] -rustdoc-args = [ "--cfg", "docsrs" ] +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs"] + +[package.metadata.platforms.support] +windows = { level = "full", notes = "" } +linux = { level = "full", notes = "" } +macos = { level = "full", notes = "" } +android = { level = "none", notes = "" } +ios = { level = "none", notes = "" } + [build-dependencies] -tauri-plugin = { workspace = true, features = [ "build" ] } +tauri-plugin = { workspace = true, features = ["build"] } [dependencies] serde = { workspace = true } @@ -21,4 +30,4 @@ serde_json = { workspace = true } tauri = { workspace = true } log = { workspace = true } thiserror = { workspace = true } -clap = { version = "4", features = [ "string" ] } +clap = { version = "4", features = ["string"] } diff --git a/plugins/cli/README.md b/plugins/cli/README.md index c58a6f31..91a8080b 100644 --- a/plugins/cli/README.md +++ b/plugins/cli/README.md @@ -2,11 +2,17 @@ Parse arguments from your Command Line Interface. -- Supported platforms: Windows, Linux and macOS. +| Platform | Supported | +| -------- | --------- | +| Linux | ✓ | +| Windows | ✓ | +| macOS | ✓ | +| Android | x | +| iOS | x | ## Install -_This plugin requires a Rust version of at least **1.75**_ +_This plugin requires a Rust version of at least **1.77.2**_ There are three general methods of installation that we can recommend. @@ -21,7 +27,7 @@ Install the Core plugin by adding the following to your `Cargo.toml` file: ```toml # you can add the dependencies on the `[dependencies]` section if you do not target mobile [target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies] -tauri-plugin-cli = "2.0.0-beta" +tauri-plugin-cli = "2.0.0" # alternatively with Git: tauri-plugin-cli = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` @@ -49,7 +55,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-cli#v2 First you need to register the core plugin with Tauri: -`src-tauri/src/main.rs` +`src-tauri/src/lib.rs` ```rust fn main() { @@ -67,16 +73,16 @@ fn main() { Afterwards all the plugin's APIs are available through the JavaScript guest bindings: ```javascript -import { getMatches } from "@tauri-apps/plugin-cli"; -const matches = await getMatches(); -if (matches.subcommand?.name === "run") { +import { getMatches } from '@tauri-apps/plugin-cli' +const matches = await getMatches() +if (matches.subcommand?.name === 'run') { // `./your-app run $ARGS` was executed - const args = matches.subcommand?.matches.args; - if ("debug" in args) { + const args = matches.subcommand?.matches.args + if ('debug' in args) { // `./your-app run --debug` was executed } } else { - const args = matches.args; + const args = matches.args // `./your-app $ARGS` was executed } ``` diff --git a/plugins/cli/SECURITY.md b/plugins/cli/SECURITY.md new file mode 100644 index 00000000..4f09bbac --- /dev/null +++ b/plugins/cli/SECURITY.md @@ -0,0 +1,23 @@ +# Security Policy + +**Do not report security vulnerabilities through public GitHub issues.** + +**Please use the [Private Vulnerability Disclosure](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability) feature of GitHub.** + +Include as much of the following information: + +- Type of issue (e.g. improper input parsing, privilege escalation, etc.) +- The location of the affected source code (tag/branch/commit or direct URL) +- Any special configuration required to reproduce the issue +- The distribution affected or used to help us with reproduction of the issue +- Step-by-step instructions to reproduce the issue +- Ideally a reproduction repository +- Impact of the issue, including how an attacker might exploit the issue + +We prefer to receive reports in English. + +## Contact + +Please disclose a vulnerability or security relevant issue here: [https://github.com/tauri-apps/plugins-workspace/security/advisories/new](https://github.com/tauri-apps/plugins-workspace/security/advisories/new). + +Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app). diff --git a/plugins/cli/src/api-iife.js b/plugins/cli/api-iife.js similarity index 100% rename from plugins/cli/src/api-iife.js rename to plugins/cli/api-iife.js diff --git a/plugins/cli/build.rs b/plugins/cli/build.rs index 15ff656f..50d88849 100644 --- a/plugins/cli/build.rs +++ b/plugins/cli/build.rs @@ -5,5 +5,7 @@ const COMMANDS: &[&str] = &["cli_matches"]; fn main() { - tauri_plugin::Builder::new(COMMANDS).build(); + tauri_plugin::Builder::new(COMMANDS) + .global_api_script_path("./api-iife.js") + .build(); } diff --git a/plugins/cli/guest-js/index.ts b/plugins/cli/guest-js/index.ts index 0ab7868e..7a7f4acf 100644 --- a/plugins/cli/guest-js/index.ts +++ b/plugins/cli/guest-js/index.ts @@ -8,7 +8,7 @@ * @module */ -import { invoke } from "@tauri-apps/api/core"; +import { invoke } from '@tauri-apps/api/core' /** * @since 2.0.0 @@ -19,27 +19,27 @@ interface ArgMatch { * boolean if flag * string[] or null if takes multiple values */ - value: string | boolean | string[] | null; + value: string | boolean | string[] | null /** * Number of occurrences */ - occurrences: number; + occurrences: number } /** * @since 2.0.0 */ interface SubcommandMatch { - name: string; - matches: CliMatches; + name: string + matches: CliMatches } /** * @since 2.0.0 */ interface CliMatches { - args: Record; - subcommand: SubcommandMatch | null; + args: Record + subcommand: SubcommandMatch | null } /** @@ -64,9 +64,9 @@ interface CliMatches { * @since 2.0.0 */ async function getMatches(): Promise { - return await invoke("plugin:cli|cli_matches"); + return await invoke('plugin:cli|cli_matches') } -export type { ArgMatch, SubcommandMatch, CliMatches }; +export type { ArgMatch, SubcommandMatch, CliMatches } -export { getMatches }; +export { getMatches } diff --git a/plugins/cli/package.json b/plugins/cli/package.json index be8cebba..e5ff8b73 100644 --- a/plugins/cli/package.json +++ b/plugins/cli/package.json @@ -1,10 +1,11 @@ { "name": "@tauri-apps/plugin-cli", - "version": "2.0.0-beta.1", - "license": "MIT or APACHE-2.0", + "version": "2.2.0", + "license": "MIT OR Apache-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" ], + "repository": "https://github.com/tauri-apps/plugins-workspace", "type": "module", "types": "./dist-js/index.d.ts", "main": "./dist-js/index.cjs", @@ -23,6 +24,6 @@ "LICENSE" ], "dependencies": { - "@tauri-apps/api": "2.0.0-beta.2" + "@tauri-apps/api": "^2.0.0" } } diff --git a/plugins/cli/permissions/autogenerated/reference.md b/plugins/cli/permissions/autogenerated/reference.md index 0f231dc3..cfa83f0a 100644 --- a/plugins/cli/permissions/autogenerated/reference.md +++ b/plugins/cli/permissions/autogenerated/reference.md @@ -1,14 +1,43 @@ -# Permissions +## Default Permission -## allow-cli-matches +Allows reading the CLI matches + +#### This default permission set includes the following: + +- `allow-cli-matches` + +## Permission Table + + + + + + + + + + + + -Denies the cli_matches command without any pre-configured scope. + + + + +
IdentifierDescription
+ +`cli:allow-cli-matches` + + Enables the cli_matches command without any pre-configured scope. -## deny-cli-matches +
-## default +`cli:deny-cli-matches` -Allows reading the CLI matches + + +Denies the cli_matches command without any pre-configured scope. +
diff --git a/plugins/cli/permissions/schemas/schema.json b/plugins/cli/permissions/schemas/schema.json index 47519c42..45941514 100644 --- a/plugins/cli/permissions/schemas/schema.json +++ b/plugins/cli/permissions/schemas/schema.json @@ -17,7 +17,6 @@ }, "set": { "description": "A list of permissions sets defined", - "default": [], "type": "array", "items": { "$ref": "#/definitions/PermissionSet" @@ -50,7 +49,7 @@ "minimum": 1.0 }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -112,7 +111,7 @@ "type": "string" }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri internal convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -132,12 +131,21 @@ }, "scope": { "description": "Allowed or denied scoped when using this permission.", - "default": {}, "allOf": [ { "$ref": "#/definitions/Scopes" } ] + }, + "platforms": { + "description": "Target platforms this permission applies. By default all platforms are affected by this permission.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Target" + } } } }, @@ -164,7 +172,7 @@ } }, "Scopes": { - "description": "A restriction of the command/endpoint functionality.\n\nIt can be of any serde serializable type and is used for allowing or preventing certain actions inside a Tauri command.\n\nThe scope is passed to the command and handled/enforced by the command itself.", + "description": "An argument for fine grained behavior control of Tauri commands.\n\nIt can be of any serde serializable type and is used to allow or prevent certain actions inside a Tauri command. The configured scope is passed to the command and will be enforced by the command implementation.\n\n## Example\n\n```json { \"allow\": [{ \"path\": \"$HOME/**\" }], \"deny\": [{ \"path\": \"$HOME/secret.txt\" }] } ```", "type": "object", "properties": { "allow": { @@ -178,7 +186,7 @@ } }, "deny": { - "description": "Data that defines what is denied by the scope.", + "description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.", "type": [ "array", "null" @@ -243,31 +251,68 @@ } ] }, - "PermissionKind": { - "type": "string", + "Target": { + "description": "Platform target.", "oneOf": [ { - "description": "allow-cli-matches -> Enables the cli_matches command without any pre-configured scope.", + "description": "MacOS.", + "type": "string", + "enum": [ + "macOS" + ] + }, + { + "description": "Windows.", + "type": "string", + "enum": [ + "windows" + ] + }, + { + "description": "Linux.", "type": "string", "enum": [ - "allow-cli-matches" + "linux" ] }, { - "description": "deny-cli-matches -> Denies the cli_matches command without any pre-configured scope.", + "description": "Android.", "type": "string", "enum": [ - "deny-cli-matches" + "android" ] }, { - "description": "default -> Allows reading the CLI matches", + "description": "iOS.", "type": "string", "enum": [ - "default" + "iOS" ] } ] + }, + "PermissionKind": { + "type": "string", + "oneOf": [ + { + "description": "Enables the cli_matches command without any pre-configured scope.", + "type": "string", + "const": "allow-cli-matches", + "markdownDescription": "Enables the cli_matches command without any pre-configured scope." + }, + { + "description": "Denies the cli_matches command without any pre-configured scope.", + "type": "string", + "const": "deny-cli-matches", + "markdownDescription": "Denies the cli_matches command without any pre-configured scope." + }, + { + "description": "Allows reading the CLI matches\n#### This default permission set includes:\n\n- `allow-cli-matches`", + "type": "string", + "const": "default", + "markdownDescription": "Allows reading the CLI matches\n#### This default permission set includes:\n\n- `allow-cli-matches`" + } + ] } } } \ No newline at end of file diff --git a/plugins/cli/rollup.config.js b/plugins/cli/rollup.config.js index 977dfac8..1f349ec8 100644 --- a/plugins/cli/rollup.config.js +++ b/plugins/cli/rollup.config.js @@ -2,6 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { createConfig } from "../../shared/rollup.config.js"; +import { createConfig } from '../../shared/rollup.config.js' -export default createConfig(); +export default createConfig() diff --git a/plugins/cli/src/error.rs b/plugins/cli/src/error.rs index b4bd2872..2b5e1602 100644 --- a/plugins/cli/src/error.rs +++ b/plugins/cli/src/error.rs @@ -18,3 +18,5 @@ impl Serialize for Error { serializer.serialize_str(self.to_string().as_ref()) } } + +pub type Result = std::result::Result; diff --git a/plugins/cli/src/lib.rs b/plugins/cli/src/lib.rs index c666874c..3e144376 100644 --- a/plugins/cli/src/lib.rs +++ b/plugins/cli/src/lib.rs @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -//! [![](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/cli/banner.png)](https://github.com/tauri-apps/plugins-workspace/tree/v2/plugins/cli) -//! //! Parse arguments from your Command Line Interface. //! //! - Supported platforms: Windows, Linux and macOS. @@ -23,8 +21,9 @@ mod error; mod parser; use config::{Arg, Config}; -pub use error::Error; -type Result = std::result::Result; + +pub use error::{Error, Result}; +pub use parser::{ArgData, Matches, SubcommandMatches}; pub struct Cli(PluginApi); @@ -51,7 +50,6 @@ fn cli_matches(_app: AppHandle, cli: State<'_, Cli>) -> Result pub fn init() -> TauriPlugin { Builder::new("cli") - .js_init_script(include_str!("api-iife.js").to_string()) .invoke_handler(tauri::generate_handler![cli_matches]) .setup(|app, api| { app.manage(Cli(api)); diff --git a/plugins/clipboard-manager/CHANGELOG.md b/plugins/clipboard-manager/CHANGELOG.md index 46f2509a..895d8c71 100644 --- a/plugins/clipboard-manager/CHANGELOG.md +++ b/plugins/clipboard-manager/CHANGELOG.md @@ -1,5 +1,99 @@ # Changelog +## \[2.2.2] + +### bug + +- [`d37bbdef`](https://github.com/tauri-apps/plugins-workspace/commit/d37bbdef8dc70e61e59f9fe0bb8b2a48999d0aa1) ([#2507](https://github.com/tauri-apps/plugins-workspace/pull/2507) by [@SquitchYT](https://github.com/tauri-apps/plugins-workspace/../../SquitchYT)) Fix clipboard-manager Wayland support. + +## \[2.2.1] + +- [`ce11079f`](https://github.com/tauri-apps/plugins-workspace/commit/ce11079f19852fbefdecf0e4c7d947af3624fee0) ([#2280](https://github.com/tauri-apps/plugins-workspace/pull/2280) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Explicitly drop `arboard::Clipboard` on exit. Add recommendation to not use read methods on the mainthread. + +## \[2.2.0] + +- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other. + +## \[2.0.1] + +- [`3fa0fc09`](https://github.com/tauri-apps/plugins-workspace/commit/3fa0fc09bbee0d619801e5757af9fb3c09883c97) ([#2099](https://github.com/tauri-apps/plugins-workspace/pull/2099) by [@rasteiner](https://github.com/tauri-apps/plugins-workspace/../../rasteiner)) Fix clipboard manager client side api not copying fallback alternative text when calling `writeHtml`. + +## \[2.0.2] + +- [`d57df4de`](https://github.com/tauri-apps/plugins-workspace/commit/d57df4debe7c75cfbd6d6558fff1beb07dbee54c) ([#1986](https://github.com/tauri-apps/plugins-workspace/pull/1986) by [@RikaKagurasaka](https://github.com/tauri-apps/plugins-workspace/../../RikaKagurasaka)) Fix that `read_image` wrongly set the image rgba data with binary PNG data. + +## \[2.0.1] + +- [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7. + +## \[2.0.0] + +- [`e2c4dfb6`](https://github.com/tauri-apps/plugins-workspace/commit/e2c4dfb6af43e5dd8d9ceba232c315f5febd55c1) Update to tauri v2 stable release. + +## \[2.0.0-rc.2] + +- [`341a5320`](https://github.com/tauri-apps/plugins-workspace/commit/341a5320c33d3c7b041abf7eb0ab7ad8009e6c3f) ([#1771](https://github.com/tauri-apps/plugins-workspace/pull/1771)) Fix warnings and clear implementation on Android below SDK 28. + +## \[2.0.0-rc.1] + +- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri 2.0.0-rc.8 + +## \[2.0.0-rc.2] + +- [`b9147758`](https://github.com/tauri-apps/plugins-workspace/commit/b914775898c2bee7ceb20bd17ee595005cd17a64) ([#1679](https://github.com/tauri-apps/plugins-workspace/pull/1679) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Explicitly set a minimum macOS version for the Swift package. + +## \[2.0.0-rc.1] + +- [`2c00c029`](https://github.com/tauri-apps/plugins-workspace/commit/2c00c0292c9127b81567de46691e8c0f73557261) ([#1630](https://github.com/tauri-apps/plugins-workspace/pull/1630) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Fixed an issue that caused multi-word IIFE names to not be formatted correctly. For example the `barcode-scanner` was defined as `window.__TAURI_PLUGIN_CLIPBOARDMANAGER__` instead of `window.__TAURI_PLUGIN_CLIPBOARD_MANAGER__`. + +### changes + +- [`6b079cfd`](https://github.com/tauri-apps/plugins-workspace/commit/6b079cfdd107c94abc2c7300f6af00bac3ff4040) ([#1649](https://github.com/tauri-apps/plugins-workspace/pull/1649) by [@ahqsoftwares](https://github.com/tauri-apps/plugins-workspace/../../ahqsoftwares)) Remove targetSdk from build.kts files as it is deprecated and will be removed from DSL v9.0 + +## \[2.0.0-rc.0] + +- [`9887d1`](https://github.com/tauri-apps/plugins-workspace/commit/9887d14bd0e971c4c0f5c1188fc4005d3fc2e29e) Update to tauri RC. + +## \[2.1.0-beta.6] + +- [`99d6ac0f`](https://github.com/tauri-apps/plugins-workspace/commit/99d6ac0f9506a6a4a1aa59c728157190a7441af6) ([#1606](https://github.com/tauri-apps/plugins-workspace/pull/1606) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) The JS packages now specify the *minimum* `@tauri-apps/api` version instead of a single exact version. +- [`6de87966`](https://github.com/tauri-apps/plugins-workspace/commit/6de87966ecc00ad9d91c25be452f1f46bd2b7e1f) ([#1597](https://github.com/tauri-apps/plugins-workspace/pull/1597) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Update to tauri beta.25. + +## \[2.1.0-beta.5] + +- [`22a17980`](https://github.com/tauri-apps/plugins-workspace/commit/22a17980ff4f6f8c40adb1b8f4ffc6dae2fe7e30) ([#1537](https://github.com/tauri-apps/plugins-workspace/pull/1537) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri beta.24. + +## \[2.1.0-beta.4] + +- [`76daee7a`](https://github.com/tauri-apps/plugins-workspace/commit/76daee7aafece34de3092c86e531cf9eb1138989) ([#1512](https://github.com/tauri-apps/plugins-workspace/pull/1512) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Update to tauri beta.23. + +## \[2.1.0-beta.3] + +- [`9013854f`](https://github.com/tauri-apps/plugins-workspace/commit/9013854f42a49a230b9dbb9d02774765528a923f)([#1382](https://github.com/tauri-apps/plugins-workspace/pull/1382)) Update to tauri beta.22. + +## \[2.1.0-beta.2] + +- [`430bd6f4`](https://github.com/tauri-apps/plugins-workspace/commit/430bd6f4f379bee5d232ae6b098ae131db7f178a)([#1363](https://github.com/tauri-apps/plugins-workspace/pull/1363)) Update to tauri beta.20. + +## \[2.1.0-beta.1] + +- [`bd1ed590`](https://github.com/tauri-apps/plugins-workspace/commit/bd1ed5903ffcce5500310dac1e59e8c67674ef1e)([#1237](https://github.com/tauri-apps/plugins-workspace/pull/1237)) Update to tauri beta.17. + +## \[2.1.0-beta.1] + +- [`27b258c`](https://github.com/tauri-apps/plugins-workspace/commit/27b258cf31ae5557c99ae66537fb9196368d4d8b)([#1185](https://github.com/tauri-apps/plugins-workspace/pull/1185)) Expose `Clipboard` struct +- [`e3d41f4`](https://github.com/tauri-apps/plugins-workspace/commit/e3d41f4011bd3ea3ce281bb38bbe31d3709f8e0f)([#1191](https://github.com/tauri-apps/plugins-workspace/pull/1191)) Internally use the webview scoped resources table instead of the app one, so other webviews can't access other webviews resources. +- [`e3d41f4`](https://github.com/tauri-apps/plugins-workspace/commit/e3d41f4011bd3ea3ce281bb38bbe31d3709f8e0f)([#1191](https://github.com/tauri-apps/plugins-workspace/pull/1191)) Update for tauri 2.0.0-beta.15. + +## \[2.1.0-beta.0] + +- [`9dec960`](https://github.com/tauri-apps/plugins-workspace/commit/9dec9605ed1ce19dbef697e55debddf9008ecba1)([#845](https://github.com/tauri-apps/plugins-workspace/pull/845)) Add support for `read_image` and `write_image` to the clipboard plugin (desktop). + +## \[2.0.0-beta.2] + +- [`dc6d332`](https://github.com/tauri-apps/plugins-workspace/commit/dc6d3321e5305fa8b7250553bd179cbee995998a)([#977](https://github.com/tauri-apps/plugins-workspace/pull/977)) Add support for writing HTML content to the clipboard. +- [`99bea25`](https://github.com/tauri-apps/plugins-workspace/commit/99bea2559c2c0648c2519c50a18cd124dacef57b)([#1005](https://github.com/tauri-apps/plugins-workspace/pull/1005)) Update to tauri beta.8. + ## \[2.0.0-beta.1] - [`569defb`](https://github.com/tauri-apps/plugins-workspace/commit/569defbe9492e38938554bb7bdc1be9151456d21) Update to tauri beta.4. @@ -36,9 +130,3 @@ ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - te to alpha.11. - -## \[2.0.0-alpha.0] - -- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! -717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/clipboard-manager/Cargo.toml b/plugins/clipboard-manager/Cargo.toml index cd032ac1..0c35e591 100644 --- a/plugins/clipboard-manager/Cargo.toml +++ b/plugins/clipboard-manager/Cargo.toml @@ -1,20 +1,29 @@ [package] name = "tauri-plugin-clipboard-manager" -version = "2.0.0-beta.1" +version = "2.2.2" description = "Read and write to the system clipboard." edition = { workspace = true } authors = { workspace = true } license = { workspace = true } rust-version = { workspace = true } +repository = { workspace = true } links = "tauri-plugin-clipboard-manager" [package.metadata.docs.rs] -rustc-args = [ "--cfg", "docsrs" ] -rustdoc-args = [ "--cfg", "docsrs" ] -targets = [ "x86_64-unknown-linux-gnu", "x86_64-linux-android" ] +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs"] +targets = ["x86_64-unknown-linux-gnu", "x86_64-linux-android"] + +[package.metadata.platforms.support] +windows = { level = "full", notes = "" } +linux = { level = "full", notes = "" } +macos = { level = "full", notes = "" } +android = { level = "partial", notes = "Only plain-text content support" } +ios = { level = "partial", notes = "Only plain-text content support" } + [build-dependencies] -tauri-plugin = { workspace = true, features = [ "build" ] } +tauri-plugin = { workspace = true, features = ["build"] } [dependencies] serde = { workspace = true } @@ -23,5 +32,8 @@ tauri = { workspace = true } log = { workspace = true } thiserror = { workspace = true } +[target.'cfg(target_os = "ios")'.dependencies] +tauri = { workspace = true, features = ["wry"] } + [target."cfg(any(target_os = \"macos\", windows, target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies] -arboard = "3" +arboard = { version = "3", features = ["wayland-data-control"] } diff --git a/plugins/clipboard-manager/README.md b/plugins/clipboard-manager/README.md index 02b26b3c..57b89526 100644 --- a/plugins/clipboard-manager/README.md +++ b/plugins/clipboard-manager/README.md @@ -2,9 +2,17 @@ Read and write to the system clipboard. +| Platform | Supported | +| -------- | --------- | +| Linux | ✓ | +| Windows | ✓ | +| macOS | ✓ | +| Android | ✓ | +| iOS | ✓ | + ## Install -_This plugin requires a Rust version of at least **1.75**_ +_This plugin requires a Rust version of at least **1.77.2**_ There are three general methods of installation that we can recommend. @@ -18,7 +26,7 @@ Install the Core plugin by adding the following to your `Cargo.toml` file: ```toml [dependencies] -tauri-plugin-clipboard-manager = "2.0.0-beta" +tauri-plugin-clipboard-manager = "2.0.0" # alternatively with Git: tauri-plugin-clipboard-manager = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` @@ -46,7 +54,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-clipboard-manager#v2 First you need to register the core plugin with Tauri: -`src-tauri/src/main.rs` +`src-tauri/src/lib.rs` ```rust fn main() { @@ -60,9 +68,14 @@ fn main() { Afterwards all the plugin's APIs are available through the JavaScript guest bindings: ```javascript -import { writeText, readText } from "@tauri-apps/plugin-clipboard-manager"; -await writeText("Tauri is awesome!"); -assert(await readText(), "Tauri is awesome!"); +import { + writeText, + readText, + writeHtml, + clear +} from '@tauri-apps/plugin-clipboard-manager' +await writeText('Tauri is awesome!') +assert(await readText(), 'Tauri is awesome!') ``` ## Contributing diff --git a/plugins/clipboard-manager/SECURITY.md b/plugins/clipboard-manager/SECURITY.md new file mode 100644 index 00000000..4f09bbac --- /dev/null +++ b/plugins/clipboard-manager/SECURITY.md @@ -0,0 +1,23 @@ +# Security Policy + +**Do not report security vulnerabilities through public GitHub issues.** + +**Please use the [Private Vulnerability Disclosure](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability) feature of GitHub.** + +Include as much of the following information: + +- Type of issue (e.g. improper input parsing, privilege escalation, etc.) +- The location of the affected source code (tag/branch/commit or direct URL) +- Any special configuration required to reproduce the issue +- The distribution affected or used to help us with reproduction of the issue +- Step-by-step instructions to reproduce the issue +- Ideally a reproduction repository +- Impact of the issue, including how an attacker might exploit the issue + +We prefer to receive reports in English. + +## Contact + +Please disclose a vulnerability or security relevant issue here: [https://github.com/tauri-apps/plugins-workspace/security/advisories/new](https://github.com/tauri-apps/plugins-workspace/security/advisories/new). + +Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app). diff --git a/plugins/clipboard-manager/android/build.gradle.kts b/plugins/clipboard-manager/android/build.gradle.kts index b3caf13e..b12a7482 100644 --- a/plugins/clipboard-manager/android/build.gradle.kts +++ b/plugins/clipboard-manager/android/build.gradle.kts @@ -5,11 +5,10 @@ plugins { android { namespace = "app.tauri.clipboard" - compileSdk = 32 + compileSdk = 34 defaultConfig { - minSdk = 24 - targetSdk = 32 + minSdk = 24 testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles("consumer-rules.pro") diff --git a/plugins/clipboard-manager/android/src/main/java/ClipboardPlugin.kt b/plugins/clipboard-manager/android/src/main/java/ClipboardPlugin.kt index 432e337e..ebb931b4 100644 --- a/plugins/clipboard-manager/android/src/main/java/ClipboardPlugin.kt +++ b/plugins/clipboard-manager/android/src/main/java/ClipboardPlugin.kt @@ -4,12 +4,12 @@ package app.tauri.clipboard -import android.R.attr.value import android.app.Activity import android.content.ClipData import android.content.ClipDescription import android.content.ClipboardManager import android.content.Context +import android.os.Build import app.tauri.annotation.Command import app.tauri.annotation.InvokeArg import app.tauri.annotation.TauriPlugin @@ -59,7 +59,9 @@ internal class ReadClipDataSerializer @JvmOverloads constructor(t: Class {} + else -> { + throw Exception("unimplemented ReadClipData") + } } jgen.writeEndObject() @@ -87,17 +89,17 @@ class ClipboardPlugin(private val activity: Activity) : Plugin(activity) { @Command @Suppress("MoveVariableDeclarationIntoWhen") - fun write(invoke: Invoke) { + fun writeText(invoke: Invoke) { val args = invoke.parseArgs(WriteOptions::class.java) val clipData = when (args) { is WriteOptions.PlainText -> { ClipData.newPlainText(args.label, args.text) - } - else -> { - invoke.reject("unimplemented clip data") + } else -> { + invoke.reject("unimplemented WriteOptions") return } + } manager.setPrimaryClip(clipData) @@ -106,7 +108,7 @@ class ClipboardPlugin(private val activity: Activity) : Plugin(activity) { } @Command - fun read(invoke: Invoke) { + fun readText(invoke: Invoke) { val data = if (manager.hasPrimaryClip()) { if (manager.primaryClipDescription?.hasMimeType(ClipDescription.MIMETYPE_TEXT_PLAIN) == true) { val item: ClipData.Item = manager.primaryClip!!.getItemAt(0) @@ -125,4 +127,16 @@ class ClipboardPlugin(private val activity: Activity) : Plugin(activity) { invoke.resolveObject(data) } + + @Command + fun clear(invoke: Invoke) { + if (manager.hasPrimaryClip()) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { + manager.clearPrimaryClip() + } else { + manager.setPrimaryClip(ClipData.newPlainText("", "")) + } + } + invoke.resolve() + } } diff --git a/plugins/clipboard-manager/api-iife.js b/plugins/clipboard-manager/api-iife.js new file mode 100644 index 00000000..f3e28be5 --- /dev/null +++ b/plugins/clipboard-manager/api-iife.js @@ -0,0 +1 @@ +if("__TAURI__"in window){var __TAURI_PLUGIN_CLIPBOARD_MANAGER__=function(e){"use strict";var n;async function t(e,n={},t){return window.__TAURI_INTERNALS__.invoke(e,n,t)}"function"==typeof SuppressedError&&SuppressedError;class r{get rid(){return function(e,n,t,r){if("function"==typeof n||!n.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===t?r:"a"===t?r.call(e):r?r.value:n.get(e)}(this,n,"f")}constructor(e){n.set(this,void 0),function(e,n,t){if("function"==typeof n||!n.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");n.set(e,t)}(this,n,e)}async close(){return t("plugin:resources|close",{rid:this.rid})}}n=new WeakMap;class a extends r{constructor(e){super(e)}static async new(e,n,r){return t("plugin:image|new",{rgba:i(e),width:n,height:r}).then((e=>new a(e)))}static async fromBytes(e){return t("plugin:image|from_bytes",{bytes:i(e)}).then((e=>new a(e)))}static async fromPath(e){return t("plugin:image|from_path",{path:e}).then((e=>new a(e)))}async rgba(){return t("plugin:image|rgba",{rid:this.rid}).then((e=>new Uint8Array(e)))}async size(){return t("plugin:image|size",{rid:this.rid})}}function i(e){return null==e?null:"string"==typeof e?e:e instanceof a?e.rid:e}return e.clear=async function(){await t("plugin:clipboard-manager|clear")},e.readImage=async function(){return await t("plugin:clipboard-manager|read_image").then((e=>new a(e)))},e.readText=async function(){return await t("plugin:clipboard-manager|read_text")},e.writeHtml=async function(e,n){await t("plugin:clipboard-manager|write_html",{html:e,altText:n})},e.writeImage=async function(e){await t("plugin:clipboard-manager|write_image",{image:i(e)})},e.writeText=async function(e,n){await t("plugin:clipboard-manager|write_text",{label:n?.label,text:e})},e}({});Object.defineProperty(window.__TAURI__,"clipboardManager",{value:__TAURI_PLUGIN_CLIPBOARD_MANAGER__})} diff --git a/plugins/clipboard-manager/build.rs b/plugins/clipboard-manager/build.rs index 758d64f3..9bbeddfc 100644 --- a/plugins/clipboard-manager/build.rs +++ b/plugins/clipboard-manager/build.rs @@ -2,18 +2,24 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -const COMMANDS: &[&str] = &["write", "read"]; +const COMMANDS: &[&str] = &[ + "write_text", + "read_text", + "write_image", + "read_image", + "write_html", + "clear", +]; fn main() { - if let Err(error) = tauri_plugin::Builder::new(COMMANDS) + let result = tauri_plugin::Builder::new(COMMANDS) + .global_api_script_path("./api-iife.js") .android_path("android") .ios_path("ios") - .try_build() - { - println!("{error:#}"); - // when building documentation for Android the plugin build result is irrelevant to the crate itself - if !(cfg!(docsrs) && std::env::var("TARGET").unwrap().contains("android")) { - std::process::exit(1); - } + .try_build(); + + // when building documentation for Android the plugin build result is always Err() and is irrelevant to the crate documentation build + if !(cfg!(docsrs) && std::env::var("TARGET").unwrap().contains("android")) { + result.unwrap(); } } diff --git a/plugins/clipboard-manager/guest-js/index.ts b/plugins/clipboard-manager/guest-js/index.ts index 4a9d10a0..a37bbfab 100644 --- a/plugins/clipboard-manager/guest-js/index.ts +++ b/plugins/clipboard-manager/guest-js/index.ts @@ -8,9 +8,8 @@ * @module */ -import { invoke } from "@tauri-apps/api/core"; - -type ClipResponse = Record<"plainText", { text: string }>; +import { invoke } from '@tauri-apps/api/core' +import { Image, transformImage } from '@tauri-apps/api/image' /** * Writes plain text to the clipboard. @@ -27,16 +26,12 @@ type ClipResponse = Record<"plainText", { text: string }>; */ async function writeText( text: string, - opts?: { label?: string }, + opts?: { label?: string } ): Promise { - return invoke("plugin:clipboard-manager|write", { - data: { - plainText: { - label: opts?.label, - text, - }, - }, - }); + await invoke('plugin:clipboard-manager|write_text', { + label: opts?.label, + text + }) } /** @@ -49,8 +44,108 @@ async function writeText( * @since 2.0.0 */ async function readText(): Promise { - const kind: ClipResponse = await invoke("plugin:clipboard-manager|read"); - return kind.plainText.text; + return await invoke('plugin:clipboard-manager|read_text') +} + +/** + * Writes image buffer to the clipboard. + * + * #### Platform-specific + * + * - **Android / iOS:** Not supported. + * + * @example + * ```typescript + * import { writeImage } from '@tauri-apps/plugin-clipboard-manager'; + * const buffer = [ + * // A red pixel + * 255, 0, 0, 255, + * + * // A green pixel + * 0, 255, 0, 255, + * ]; + * await writeImage(buffer); + * ``` + * + * @returns A promise indicating the success or failure of the operation. + * + * @since 2.0.0 + */ +async function writeImage( + image: string | Image | Uint8Array | ArrayBuffer | number[] +): Promise { + await invoke('plugin:clipboard-manager|write_image', { + image: transformImage(image) + }) +} + +/** + * Gets the clipboard content as Uint8Array image. + * + * #### Platform-specific + * + * - **Android / iOS:** Not supported. + * + * @example + * ```typescript + * import { readImage } from '@tauri-apps/plugin-clipboard-manager'; + * + * const clipboardImage = await readImage(); + * const blob = new Blob([await clipboardImage.rgba()], { type: 'image' }) + * const url = URL.createObjectURL(blob) + * ``` + * @since 2.0.0 + */ +async function readImage(): Promise { + return await invoke('plugin:clipboard-manager|read_image').then( + (rid) => new Image(rid) + ) +} + +/** + * * Writes HTML or fallbacks to write provided plain text to the clipboard. + * + * #### Platform-specific + * + * - **Android / iOS:** Not supported. + * + * @example + * ```typescript + * import { writeHtml } from '@tauri-apps/plugin-clipboard-manager'; + * await writeHtml('

Tauri is awesome!

', 'plaintext'); + * // The following will write "

Tauri is awesome

" as plain text + * await writeHtml('

Tauri is awesome!

', '

Tauri is awesome

'); + * // we can read html data only as a string so there's just readText(), no readHtml() + * assert(await readText(), '

Tauri is awesome!

'); + * ``` + * + * @returns A promise indicating the success or failure of the operation. + * + * @since 2.0.0 + */ +async function writeHtml(html: string, altText?: string): Promise { + await invoke('plugin:clipboard-manager|write_html', { + html, + altText + }) +} + +/** + * Clears the clipboard. + * + * #### Platform-specific + * + * - **Android:** Only supported on SDK 28+. For older releases we write an empty string to the clipboard instead. + * + * @example + * ```typescript + * import { clear } from '@tauri-apps/plugin-clipboard-manager'; + * await clear(); + * ``` + * @since 2.0.0 + */ +async function clear(): Promise { + await invoke('plugin:clipboard-manager|clear') } -export { writeText, readText }; +export { writeText, readText, writeHtml, clear, readImage, writeImage } diff --git a/plugins/clipboard-manager/ios/Package.swift b/plugins/clipboard-manager/ios/Package.swift index f6200857..6da5303e 100644 --- a/plugins/clipboard-manager/ios/Package.swift +++ b/plugins/clipboard-manager/ios/Package.swift @@ -6,28 +6,29 @@ import PackageDescription let package = Package( - name: "tauri-plugin-clipboard-manager", - platforms: [ - .iOS(.v13), - ], - products: [ - // Products define the executables and libraries a package produces, and make them visible to other packages. - .library( - name: "tauri-plugin-clipboard-manager", - type: .static, - targets: ["tauri-plugin-clipboard-manager"]), - ], - dependencies: [ - .package(name: "Tauri", path: "../.tauri/tauri-api") - ], - targets: [ - // Targets are the basic building blocks of a package. A target can define a module or a test suite. - // Targets can depend on other targets in this package, and on products in packages this package depends on. - .target( - name: "tauri-plugin-clipboard-manager", - dependencies: [ - .byName(name: "Tauri") - ], - path: "Sources") - ] + name: "tauri-plugin-clipboard-manager", + platforms: [ + .macOS(.v10_13), + .iOS(.v13), + ], + products: [ + // Products define the executables and libraries a package produces, and make them visible to other packages. + .library( + name: "tauri-plugin-clipboard-manager", + type: .static, + targets: ["tauri-plugin-clipboard-manager"]) + ], + dependencies: [ + .package(name: "Tauri", path: "../.tauri/tauri-api") + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages this package depends on. + .target( + name: "tauri-plugin-clipboard-manager", + dependencies: [ + .byName(name: "Tauri") + ], + path: "Sources") + ] ) diff --git a/plugins/clipboard-manager/ios/Sources/ClipboardPlugin.swift b/plugins/clipboard-manager/ios/Sources/ClipboardPlugin.swift index 30729d53..cb4fc9b2 100644 --- a/plugins/clipboard-manager/ios/Sources/ClipboardPlugin.swift +++ b/plugins/clipboard-manager/ios/Sources/ClipboardPlugin.swift @@ -16,7 +16,7 @@ enum ReadClipData: Codable { } class ClipboardPlugin: Plugin { - @objc public func write(_ invoke: Invoke) throws { + @objc public func writeText(_ invoke: Invoke) throws { let options = try invoke.parseArgs(WriteOptions.self) let clipboard = UIPasteboard.general switch options { @@ -30,7 +30,7 @@ class ClipboardPlugin: Plugin { } - @objc public func read(_ invoke: Invoke) throws { + @objc public func readText(_ invoke: Invoke) throws { let clipboard = UIPasteboard.general if let text = clipboard.string { invoke.resolve(ReadClipData.plainText(text: text)) @@ -38,6 +38,12 @@ class ClipboardPlugin: Plugin { invoke.reject("Clipboard is empty") } } + + @objc public func clear(_ invoke: Invoke) throws { + let clipboard = UIPasteboard.general + clipboard.items = [] + invoke.resolve() + } } @_cdecl("init_plugin_clipboard") diff --git a/plugins/clipboard-manager/package.json b/plugins/clipboard-manager/package.json index 038613cc..9b78843b 100644 --- a/plugins/clipboard-manager/package.json +++ b/plugins/clipboard-manager/package.json @@ -1,10 +1,11 @@ { "name": "@tauri-apps/plugin-clipboard-manager", - "version": "2.0.0-beta.1", - "license": "MIT or APACHE-2.0", + "version": "2.2.2", + "license": "MIT OR Apache-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" ], + "repository": "https://github.com/tauri-apps/plugins-workspace", "type": "module", "types": "./dist-js/index.d.ts", "main": "./dist-js/index.cjs", @@ -23,6 +24,6 @@ "LICENSE" ], "dependencies": { - "@tauri-apps/api": "2.0.0-beta.2" + "@tauri-apps/api": "^2.0.0" } } diff --git a/plugins/clipboard-manager/permissions/autogenerated/commands/clear.toml b/plugins/clipboard-manager/permissions/autogenerated/commands/clear.toml new file mode 100644 index 00000000..83de1819 --- /dev/null +++ b/plugins/clipboard-manager/permissions/autogenerated/commands/clear.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-clear" +description = "Enables the clear command without any pre-configured scope." +commands.allow = ["clear"] + +[[permission]] +identifier = "deny-clear" +description = "Denies the clear command without any pre-configured scope." +commands.deny = ["clear"] diff --git a/plugins/clipboard-manager/permissions/autogenerated/commands/read.toml b/plugins/clipboard-manager/permissions/autogenerated/commands/read.toml deleted file mode 100644 index 20fa10c6..00000000 --- a/plugins/clipboard-manager/permissions/autogenerated/commands/read.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-read" -description = "Enables the read command without any pre-configured scope." -commands.allow = ["read"] - -[[permission]] -identifier = "deny-read" -description = "Denies the read command without any pre-configured scope." -commands.deny = ["read"] diff --git a/plugins/clipboard-manager/permissions/autogenerated/commands/read_image.toml b/plugins/clipboard-manager/permissions/autogenerated/commands/read_image.toml new file mode 100644 index 00000000..cfed86db --- /dev/null +++ b/plugins/clipboard-manager/permissions/autogenerated/commands/read_image.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-read-image" +description = "Enables the read_image command without any pre-configured scope." +commands.allow = ["read_image"] + +[[permission]] +identifier = "deny-read-image" +description = "Denies the read_image command without any pre-configured scope." +commands.deny = ["read_image"] diff --git a/plugins/clipboard-manager/permissions/autogenerated/commands/read_text.toml b/plugins/clipboard-manager/permissions/autogenerated/commands/read_text.toml new file mode 100644 index 00000000..29844892 --- /dev/null +++ b/plugins/clipboard-manager/permissions/autogenerated/commands/read_text.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-read-text" +description = "Enables the read_text command without any pre-configured scope." +commands.allow = ["read_text"] + +[[permission]] +identifier = "deny-read-text" +description = "Denies the read_text command without any pre-configured scope." +commands.deny = ["read_text"] diff --git a/plugins/clipboard-manager/permissions/autogenerated/commands/write.toml b/plugins/clipboard-manager/permissions/autogenerated/commands/write.toml deleted file mode 100644 index 73d1d387..00000000 --- a/plugins/clipboard-manager/permissions/autogenerated/commands/write.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-write" -description = "Enables the write command without any pre-configured scope." -commands.allow = ["write"] - -[[permission]] -identifier = "deny-write" -description = "Denies the write command without any pre-configured scope." -commands.deny = ["write"] diff --git a/plugins/clipboard-manager/permissions/autogenerated/commands/write_html.toml b/plugins/clipboard-manager/permissions/autogenerated/commands/write_html.toml new file mode 100644 index 00000000..5e292808 --- /dev/null +++ b/plugins/clipboard-manager/permissions/autogenerated/commands/write_html.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-write-html" +description = "Enables the write_html command without any pre-configured scope." +commands.allow = ["write_html"] + +[[permission]] +identifier = "deny-write-html" +description = "Denies the write_html command without any pre-configured scope." +commands.deny = ["write_html"] diff --git a/plugins/clipboard-manager/permissions/autogenerated/commands/write_image.toml b/plugins/clipboard-manager/permissions/autogenerated/commands/write_image.toml new file mode 100644 index 00000000..12e8e235 --- /dev/null +++ b/plugins/clipboard-manager/permissions/autogenerated/commands/write_image.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-write-image" +description = "Enables the write_image command without any pre-configured scope." +commands.allow = ["write_image"] + +[[permission]] +identifier = "deny-write-image" +description = "Denies the write_image command without any pre-configured scope." +commands.deny = ["write_image"] diff --git a/plugins/clipboard-manager/permissions/autogenerated/commands/write_text.toml b/plugins/clipboard-manager/permissions/autogenerated/commands/write_text.toml new file mode 100644 index 00000000..ebff875a --- /dev/null +++ b/plugins/clipboard-manager/permissions/autogenerated/commands/write_text.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-write-text" +description = "Enables the write_text command without any pre-configured scope." +commands.allow = ["write_text"] + +[[permission]] +identifier = "deny-write-text" +description = "Denies the write_text command without any pre-configured scope." +commands.deny = ["write_text"] diff --git a/plugins/clipboard-manager/permissions/autogenerated/reference.md b/plugins/clipboard-manager/permissions/autogenerated/reference.md index 02d3e533..f8bed009 100644 --- a/plugins/clipboard-manager/permissions/autogenerated/reference.md +++ b/plugins/clipboard-manager/permissions/autogenerated/reference.md @@ -1,18 +1,177 @@ -# Permissions +## Default Permission -## allow-read +No features are enabled by default, as we believe +the clipboard can be inherently dangerous and it is +application specific if read and/or write access is needed. -Enables the read command without any pre-configured scope. +Clipboard interaction needs to be explicitly enabled. -## deny-read -Denies the read command without any pre-configured scope. +#### This default permission set includes the following: -## allow-write -Enables the write command without any pre-configured scope. +## Permission Table -## deny-write + + + + + -Denies the write command without any pre-configured scope. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IdentifierDescription
+ +`clipboard-manager:allow-clear` + + + +Enables the clear command without any pre-configured scope. + +
+ +`clipboard-manager:deny-clear` + + + +Denies the clear command without any pre-configured scope. + +
+ +`clipboard-manager:allow-read-image` + + + +Enables the read_image command without any pre-configured scope. + +
+ +`clipboard-manager:deny-read-image` + + + +Denies the read_image command without any pre-configured scope. + +
+ +`clipboard-manager:allow-read-text` + + + +Enables the read_text command without any pre-configured scope. + +
+ +`clipboard-manager:deny-read-text` + + + +Denies the read_text command without any pre-configured scope. + +
+ +`clipboard-manager:allow-write-html` + + + +Enables the write_html command without any pre-configured scope. + +
+ +`clipboard-manager:deny-write-html` + + + +Denies the write_html command without any pre-configured scope. + +
+ +`clipboard-manager:allow-write-image` + + + +Enables the write_image command without any pre-configured scope. + +
+ +`clipboard-manager:deny-write-image` + + + +Denies the write_image command without any pre-configured scope. + +
+ +`clipboard-manager:allow-write-text` + + + +Enables the write_text command without any pre-configured scope. + +
+ +`clipboard-manager:deny-write-text` + + + +Denies the write_text command without any pre-configured scope. + +
diff --git a/plugins/clipboard-manager/permissions/default.toml b/plugins/clipboard-manager/permissions/default.toml new file mode 100644 index 00000000..d6f65195 --- /dev/null +++ b/plugins/clipboard-manager/permissions/default.toml @@ -0,0 +1,11 @@ +"$schema" = "schemas/schema.json" +[default] +description = """ +No features are enabled by default, as we believe +the clipboard can be inherently dangerous and it is +application specific if read and/or write access is needed. + +Clipboard interaction needs to be explicitly enabled. +""" + +permissions = [] diff --git a/plugins/clipboard-manager/permissions/schemas/schema.json b/plugins/clipboard-manager/permissions/schemas/schema.json index 9691ab99..891c6f0d 100644 --- a/plugins/clipboard-manager/permissions/schemas/schema.json +++ b/plugins/clipboard-manager/permissions/schemas/schema.json @@ -17,7 +17,6 @@ }, "set": { "description": "A list of permissions sets defined", - "default": [], "type": "array", "items": { "$ref": "#/definitions/PermissionSet" @@ -50,7 +49,7 @@ "minimum": 1.0 }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -112,7 +111,7 @@ "type": "string" }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri internal convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -132,12 +131,21 @@ }, "scope": { "description": "Allowed or denied scoped when using this permission.", - "default": {}, "allOf": [ { "$ref": "#/definitions/Scopes" } ] + }, + "platforms": { + "description": "Target platforms this permission applies. By default all platforms are affected by this permission.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Target" + } } } }, @@ -164,7 +172,7 @@ } }, "Scopes": { - "description": "A restriction of the command/endpoint functionality.\n\nIt can be of any serde serializable type and is used for allowing or preventing certain actions inside a Tauri command.\n\nThe scope is passed to the command and handled/enforced by the command itself.", + "description": "An argument for fine grained behavior control of Tauri commands.\n\nIt can be of any serde serializable type and is used to allow or prevent certain actions inside a Tauri command. The configured scope is passed to the command and will be enforced by the command implementation.\n\n## Example\n\n```json { \"allow\": [{ \"path\": \"$HOME/**\" }], \"deny\": [{ \"path\": \"$HOME/secret.txt\" }] } ```", "type": "object", "properties": { "allow": { @@ -178,7 +186,7 @@ } }, "deny": { - "description": "Data that defines what is denied by the scope.", + "description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.", "type": [ "array", "null" @@ -243,36 +251,126 @@ } ] }, - "PermissionKind": { - "type": "string", + "Target": { + "description": "Platform target.", "oneOf": [ { - "description": "allow-read -> Enables the read command without any pre-configured scope.", + "description": "MacOS.", "type": "string", "enum": [ - "allow-read" + "macOS" ] }, { - "description": "deny-read -> Denies the read command without any pre-configured scope.", + "description": "Windows.", "type": "string", "enum": [ - "deny-read" + "windows" ] }, { - "description": "allow-write -> Enables the write command without any pre-configured scope.", + "description": "Linux.", "type": "string", "enum": [ - "allow-write" + "linux" ] }, { - "description": "deny-write -> Denies the write command without any pre-configured scope.", + "description": "Android.", "type": "string", "enum": [ - "deny-write" + "android" ] + }, + { + "description": "iOS.", + "type": "string", + "enum": [ + "iOS" + ] + } + ] + }, + "PermissionKind": { + "type": "string", + "oneOf": [ + { + "description": "Enables the clear command without any pre-configured scope.", + "type": "string", + "const": "allow-clear", + "markdownDescription": "Enables the clear command without any pre-configured scope." + }, + { + "description": "Denies the clear command without any pre-configured scope.", + "type": "string", + "const": "deny-clear", + "markdownDescription": "Denies the clear command without any pre-configured scope." + }, + { + "description": "Enables the read_image command without any pre-configured scope.", + "type": "string", + "const": "allow-read-image", + "markdownDescription": "Enables the read_image command without any pre-configured scope." + }, + { + "description": "Denies the read_image command without any pre-configured scope.", + "type": "string", + "const": "deny-read-image", + "markdownDescription": "Denies the read_image command without any pre-configured scope." + }, + { + "description": "Enables the read_text command without any pre-configured scope.", + "type": "string", + "const": "allow-read-text", + "markdownDescription": "Enables the read_text command without any pre-configured scope." + }, + { + "description": "Denies the read_text command without any pre-configured scope.", + "type": "string", + "const": "deny-read-text", + "markdownDescription": "Denies the read_text command without any pre-configured scope." + }, + { + "description": "Enables the write_html command without any pre-configured scope.", + "type": "string", + "const": "allow-write-html", + "markdownDescription": "Enables the write_html command without any pre-configured scope." + }, + { + "description": "Denies the write_html command without any pre-configured scope.", + "type": "string", + "const": "deny-write-html", + "markdownDescription": "Denies the write_html command without any pre-configured scope." + }, + { + "description": "Enables the write_image command without any pre-configured scope.", + "type": "string", + "const": "allow-write-image", + "markdownDescription": "Enables the write_image command without any pre-configured scope." + }, + { + "description": "Denies the write_image command without any pre-configured scope.", + "type": "string", + "const": "deny-write-image", + "markdownDescription": "Denies the write_image command without any pre-configured scope." + }, + { + "description": "Enables the write_text command without any pre-configured scope.", + "type": "string", + "const": "allow-write-text", + "markdownDescription": "Enables the write_text command without any pre-configured scope." + }, + { + "description": "Denies the write_text command without any pre-configured scope.", + "type": "string", + "const": "deny-write-text", + "markdownDescription": "Denies the write_text command without any pre-configured scope." + }, + { + "description": "No features are enabled by default, as we believe\nthe clipboard can be inherently dangerous and it is \napplication specific if read and/or write access is needed.\n\nClipboard interaction needs to be explicitly enabled.\n", + "type": "string", + "const": "default", + "markdownDescription": "No features are enabled by default, as we believe\nthe clipboard can be inherently dangerous and it is \napplication specific if read and/or write access is needed.\n\nClipboard interaction needs to be explicitly enabled.\n" } ] } diff --git a/plugins/clipboard-manager/rollup.config.js b/plugins/clipboard-manager/rollup.config.js index 977dfac8..1f349ec8 100644 --- a/plugins/clipboard-manager/rollup.config.js +++ b/plugins/clipboard-manager/rollup.config.js @@ -2,6 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { createConfig } from "../../shared/rollup.config.js"; +import { createConfig } from '../../shared/rollup.config.js' -export default createConfig(); +export default createConfig() diff --git a/plugins/clipboard-manager/src/api-iife.js b/plugins/clipboard-manager/src/api-iife.js deleted file mode 100644 index 8dc51655..00000000 --- a/plugins/clipboard-manager/src/api-iife.js +++ /dev/null @@ -1 +0,0 @@ -if("__TAURI__"in window){var __TAURI_PLUGIN_CLIPBOARDMANAGER__=function(e){"use strict";async function n(e,n={},r){return window.__TAURI_INTERNALS__.invoke(e,n,r)}return"function"==typeof SuppressedError&&SuppressedError,e.readText=async function(){return(await n("plugin:clipboard-manager|read")).plainText.text},e.writeText=async function(e,r){return n("plugin:clipboard-manager|write",{data:{plainText:{label:r?.label,text:e}}})},e}({});Object.defineProperty(window.__TAURI__,"clipboardManager",{value:__TAURI_PLUGIN_CLIPBOARDMANAGER__})} diff --git a/plugins/clipboard-manager/src/commands.rs b/plugins/clipboard-manager/src/commands.rs index eec868a8..a8dd94ac 100644 --- a/plugins/clipboard-manager/src/commands.rs +++ b/plugins/clipboard-manager/src/commands.rs @@ -2,23 +2,79 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -use tauri::{command, AppHandle, Runtime, State}; +use tauri::{command, image::JsImage, AppHandle, Manager, ResourceId, Runtime, State, Webview}; -use crate::{ClipKind, Clipboard, ClipboardContents, Result}; +use crate::{Clipboard, Result}; #[command] -pub(crate) async fn write( +#[cfg(desktop)] +pub(crate) async fn write_text( _app: AppHandle, clipboard: State<'_, Clipboard>, - data: ClipKind, + text: &str, + #[allow(unused)] label: Option, ) -> Result<()> { - clipboard.write(data) + clipboard.write_text(text) } #[command] -pub(crate) async fn read( +#[cfg(not(desktop))] +pub(crate) async fn write_text( _app: AppHandle, clipboard: State<'_, Clipboard>, -) -> Result { - clipboard.read() + text: &str, + #[allow(unused)] label: Option<&str>, +) -> Result<()> { + match label { + Some(label) => clipboard.write_text_with_label(text, label), + None => clipboard.write_text(text), + } +} + +#[command] +pub(crate) async fn read_text( + _app: AppHandle, + clipboard: State<'_, Clipboard>, +) -> Result { + clipboard.read_text() +} + +#[command] +pub(crate) async fn write_image( + webview: Webview, + clipboard: State<'_, Clipboard>, + image: JsImage, +) -> Result<()> { + let resources_table = webview.resources_table(); + let image = image.into_img(&resources_table)?; + clipboard.write_image(&image) +} + +#[command] +pub(crate) async fn read_image( + webview: Webview, + clipboard: State<'_, Clipboard>, +) -> Result { + let image = clipboard.read_image()?.to_owned(); + let mut resources_table = webview.resources_table(); + let rid = resources_table.add(image); + Ok(rid) +} + +#[command] +pub(crate) async fn write_html( + _app: AppHandle, + clipboard: State<'_, Clipboard>, + html: &str, + alt_text: Option<&str>, +) -> Result<()> { + clipboard.write_html(html, alt_text) +} + +#[command] +pub(crate) async fn clear( + _app: AppHandle, + clipboard: State<'_, Clipboard>, +) -> Result<()> { + clipboard.clear() } diff --git a/plugins/clipboard-manager/src/desktop.rs b/plugins/clipboard-manager/src/desktop.rs index 555321dc..f3570cc0 100644 --- a/plugins/clipboard-manager/src/desktop.rs +++ b/plugins/clipboard-manager/src/desktop.rs @@ -2,12 +2,11 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT +use arboard::ImageData; use serde::de::DeserializeOwned; -use tauri::{plugin::PluginApi, AppHandle, Runtime}; +use tauri::{image::Image, plugin::PluginApi, AppHandle, Runtime}; -use crate::models::*; - -use std::sync::Mutex; +use std::{borrow::Cow, sync::Mutex}; pub fn init( app: &AppHandle, @@ -15,7 +14,7 @@ pub fn init( ) -> crate::Result> { Ok(Clipboard { app: app.clone(), - clipboard: arboard::Clipboard::new().map(Mutex::new), + clipboard: arboard::Clipboard::new().map(|c| Mutex::new(Some(c))), }) } @@ -23,25 +22,102 @@ pub fn init( pub struct Clipboard { #[allow(dead_code)] app: AppHandle, - clipboard: Result, arboard::Error>, + // According to arboard docs the clipboard must be dropped before exit. + // Since tauri doesn't call drop on exit we'll use an Option to take() on RunEvent::Exit. + clipboard: Result>, arboard::Error>, } impl Clipboard { - pub fn write(&self, kind: ClipKind) -> crate::Result<()> { - let ClipKind::PlainText { text, .. } = kind; + pub fn write_text<'a, T: Into>>(&self, text: T) -> crate::Result<()> { + match &self.clipboard { + Ok(clipboard) => clipboard + .lock() + .unwrap() + .as_mut() + .unwrap() + .set_text(text) + .map_err(Into::into), + Err(e) => Err(crate::Error::Clipboard(e.to_string())), + } + } + + pub fn write_image(&self, image: &Image<'_>) -> crate::Result<()> { + match &self.clipboard { + Ok(clipboard) => clipboard + .lock() + .unwrap() + .as_mut() + .unwrap() + .set_image(ImageData { + bytes: Cow::Borrowed(image.rgba()), + width: image.width() as usize, + height: image.height() as usize, + }) + .map_err(Into::into), + Err(e) => Err(crate::Error::Clipboard(e.to_string())), + } + } + + /// Warning: This method should not be used on the main thread! Otherwise the underlying libraries may deadlock on Linux, freezing the whole app, when trying to copy data copied from this app, for example if the user copies text from the WebView. + pub fn read_text(&self) -> crate::Result { + match &self.clipboard { + Ok(clipboard) => { + let text = clipboard.lock().unwrap().as_mut().unwrap().get_text()?; + Ok(text) + } + Err(e) => Err(crate::Error::Clipboard(e.to_string())), + } + } + + pub fn write_html<'a, T: Into>>( + &self, + html: T, + alt_text: Option, + ) -> crate::Result<()> { match &self.clipboard { - Ok(clipboard) => clipboard.lock().unwrap().set_text(text).map_err(Into::into), + Ok(clipboard) => clipboard + .lock() + .unwrap() + .as_mut() + .unwrap() + .set_html(html, alt_text) + .map_err(Into::into), Err(e) => Err(crate::Error::Clipboard(e.to_string())), } } - pub fn read(&self) -> crate::Result { + pub fn clear(&self) -> crate::Result<()> { + match &self.clipboard { + Ok(clipboard) => clipboard + .lock() + .unwrap() + .as_mut() + .unwrap() + .clear() + .map_err(Into::into), + Err(e) => Err(crate::Error::Clipboard(e.to_string())), + } + } + + /// Warning: This method should not be used on the main thread! Otherwise the underlying libraries may deadlock on Linux, freezing the whole app, when trying to copy data copied from this app, for example if the user copies text from the WebView. + pub fn read_image(&self) -> crate::Result> { match &self.clipboard { Ok(clipboard) => { - let text = clipboard.lock().unwrap().get_text()?; - Ok(ClipboardContents::PlainText { text }) + let image = clipboard.lock().unwrap().as_mut().unwrap().get_image()?; + let image = Image::new_owned( + image.bytes.to_vec(), + image.width as u32, + image.height as u32, + ); + Ok(image) } Err(e) => Err(crate::Error::Clipboard(e.to_string())), } } + + pub(crate) fn cleanup(&self) { + if let Ok(clipboard) = &self.clipboard { + clipboard.lock().unwrap().take(); + } + } } diff --git a/plugins/clipboard-manager/src/error.rs b/plugins/clipboard-manager/src/error.rs index bf71802f..1b8cf482 100644 --- a/plugins/clipboard-manager/src/error.rs +++ b/plugins/clipboard-manager/src/error.rs @@ -11,9 +11,10 @@ pub enum Error { #[cfg(mobile)] #[error(transparent)] PluginInvoke(#[from] tauri::plugin::mobile::PluginInvokeError), - #[cfg(desktop)] #[error("{0}")] Clipboard(String), + #[error(transparent)] + Tauri(#[from] tauri::Error), } impl Serialize for Error { diff --git a/plugins/clipboard-manager/src/lib.rs b/plugins/clipboard-manager/src/lib.rs index 2b7934ab..0cbb4e41 100644 --- a/plugins/clipboard-manager/src/lib.rs +++ b/plugins/clipboard-manager/src/lib.rs @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -//! [![](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/clipboard-manager/banner.png)](https://github.com/tauri-apps/plugins-workspace/tree/v2/plugins/clipboard-manager) -//! //! Read and write to the system clipboard. #![doc( @@ -13,11 +11,9 @@ use tauri::{ plugin::{Builder, TauriPlugin}, - Manager, Runtime, + Manager, RunEvent, Runtime, }; -pub use models::*; - #[cfg(desktop)] mod desktop; #[cfg(mobile)] @@ -25,16 +21,15 @@ mod mobile; mod commands; mod error; -mod models; pub use error::{Error, Result}; #[cfg(desktop)] -use desktop::Clipboard; +pub use desktop::Clipboard; #[cfg(mobile)] -use mobile::Clipboard; +pub use mobile::Clipboard; -/// Extensions to [`tauri::App`], [`tauri::AppHandle`] and [`tauri::Window`] to access the clipboard APIs. +/// Extensions to [`tauri::App`], [`tauri::AppHandle`], [`tauri::WebviewWindow`], [`tauri::Webview`] and [`tauri::Window`] to access the clipboard APIs. pub trait ClipboardExt { fn clipboard(&self) -> &Clipboard; } @@ -48,8 +43,14 @@ impl> crate::ClipboardExt for T { /// Initializes the plugin. pub fn init() -> TauriPlugin { Builder::new("clipboard-manager") - .js_init_script(include_str!("api-iife.js").to_string()) - .invoke_handler(tauri::generate_handler![commands::write, commands::read]) + .invoke_handler(tauri::generate_handler![ + commands::write_text, + commands::read_text, + commands::read_image, + commands::write_image, + commands::write_html, + commands::clear + ]) .setup(|app, api| { #[cfg(mobile)] let clipboard = mobile::init(app, api)?; @@ -58,5 +59,11 @@ pub fn init() -> TauriPlugin { app.manage(clipboard); Ok(()) }) + .on_event(|_app, _event| { + #[cfg(desktop)] + if let RunEvent::Exit = _event { + _app.clipboard().cleanup(); + } + }) .build() } diff --git a/plugins/clipboard-manager/src/mobile.rs b/plugins/clipboard-manager/src/mobile.rs index 07964711..72d5f6e0 100644 --- a/plugins/clipboard-manager/src/mobile.rs +++ b/plugins/clipboard-manager/src/mobile.rs @@ -3,12 +3,14 @@ // SPDX-License-Identifier: MIT use serde::de::DeserializeOwned; +use serde::{Deserialize, Serialize}; use tauri::{ + image::Image, plugin::{PluginApi, PluginHandle}, AppHandle, Runtime, }; -use crate::models::*; +use std::borrow::Cow; #[cfg(target_os = "android")] const PLUGIN_IDENTIFIER: &str = "app.tauri.clipboard"; @@ -32,11 +34,76 @@ pub fn init( pub struct Clipboard(PluginHandle); impl Clipboard { - pub fn write(&self, kind: ClipKind) -> crate::Result<()> { - self.0.run_mobile_plugin("write", kind).map_err(Into::into) + pub fn write_text<'a, T: Into>>(&self, text: T) -> crate::Result<()> { + let text = text.into().to_string(); + self.0 + .run_mobile_plugin("writeText", ClipKind::PlainText { text, label: None }) + .map_err(Into::into) } - pub fn read(&self) -> crate::Result { - self.0.run_mobile_plugin("read", ()).map_err(Into::into) + pub fn write_text_with_label<'a, T: Into>>( + &self, + text: T, + label: T, + ) -> crate::Result<()> { + let text = text.into().to_string(); + let label = label.into().to_string(); + self.0 + .run_mobile_plugin( + "writeText", + ClipKind::PlainText { + text, + label: Some(label), + }, + ) + .map_err(Into::into) } + + pub fn write_image(&self, _image: &Image<'_>) -> crate::Result<()> { + Err(crate::Error::Clipboard( + "Unsupported on this platform".to_string(), + )) + } + + pub fn read_text(&self) -> crate::Result { + self.0 + .run_mobile_plugin("readText", ()) + .map(|c| match c { + ClipboardContents::PlainText { text } => text, + }) + .map_err(Into::into) + } + + pub fn read_image(&self) -> crate::Result> { + Err(crate::Error::Clipboard( + "Unsupported on this platform".to_string(), + )) + } + + // Treat HTML as unsupported on mobile until tested + pub fn write_html<'a, T: Into>>( + &self, + _html: T, + _alt_text: Option, + ) -> crate::Result<()> { + Err(crate::Error::Clipboard( + "Unsupported on this platform".to_string(), + )) + } + + pub fn clear(&self) -> crate::Result<()> { + self.0.run_mobile_plugin("clear", ()).map_err(Into::into) + } +} + +#[derive(Debug, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +enum ClipKind { + PlainText { label: Option, text: String }, +} + +#[derive(Debug, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +enum ClipboardContents { + PlainText { text: String }, } diff --git a/plugins/clipboard-manager/src/models.rs b/plugins/clipboard-manager/src/models.rs deleted file mode 100644 index a223a679..00000000 --- a/plugins/clipboard-manager/src/models.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2019-2023 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT - -use serde::{Deserialize, Serialize}; - -#[derive(Debug, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub enum ClipKind { - PlainText { label: Option, text: String }, -} - -#[derive(Debug, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub enum ClipboardContents { - PlainText { text: String }, -} diff --git a/plugins/deep-link/.test-server/.well-known/apple-app-site-association b/plugins/deep-link/.test-server/.well-known/apple-app-site-association new file mode 100644 index 00000000..da5d0a77 --- /dev/null +++ b/plugins/deep-link/.test-server/.well-known/apple-app-site-association @@ -0,0 +1,17 @@ +{ + "applinks": { + "details": [ + { + "appIDs": [ + "Q93MBH6S2F.com.tauri.deep-link-example" + ], + "components": [ + { + "/": "/open/*", + "comment": "Matches any URL whose path starts with /open/" + } + ] + } + ] + } +} diff --git a/plugins/deep-link/.test-server/server.js b/plugins/deep-link/.test-server/server.js new file mode 100644 index 00000000..0e2fec50 --- /dev/null +++ b/plugins/deep-link/.test-server/server.js @@ -0,0 +1,27 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +import http from 'http' +import fs from 'fs' + +const hostname = 'localhost' +const port = 8080 + +const server = http.createServer(function (req, res) { + console.log(req.url) + if (req.url == '/.well-known/apple-app-site-association') { + const association = fs.readFileSync( + '.well-known/apple-app-site-association' + ) + res.writeHead(200, { 'Content-Type': 'application/json' }) + res.end(association) + } else { + res.writeHead(404) + res.end('404 NOT FOUND') + } +}) + +server.listen(port, hostname, () => { + console.log('Server started on port', port) +}) diff --git a/plugins/deep-link/CHANGELOG.md b/plugins/deep-link/CHANGELOG.md index 3f711d80..325970da 100644 --- a/plugins/deep-link/CHANGELOG.md +++ b/plugins/deep-link/CHANGELOG.md @@ -1,5 +1,108 @@ # Changelog +## \[2.2.1] + +### bug + +- [`38deef43`](https://github.com/tauri-apps/plugins-workspace/commit/38deef43dca9d5a09a38ed2da45b0f86c6afa1c5) ([#2483](https://github.com/tauri-apps/plugins-workspace/pull/2483)) Fix `is_registered` not being able to pickup deep link registered in `HKEY_LOCAL_MACHINE` on Windows +- [`38deef43`](https://github.com/tauri-apps/plugins-workspace/commit/38deef43dca9d5a09a38ed2da45b0f86c6afa1c5) ([#2483](https://github.com/tauri-apps/plugins-workspace/pull/2483)) Fix `unregister` not being able to remove deep link registered in `HKEY_LOCAL_MACHINE` on Windows + +## \[2.2.0] + +- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other. + +## \[2.0.1] + +- [`b2aea045`](https://github.com/tauri-apps/plugins-workspace/commit/b2aea0456799775a7243706fdd7a5abf9a193992) ([#2008](https://github.com/tauri-apps/plugins-workspace/pull/2008) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) `onOpenUrl()` will now not call `getCurrent()` anymore, matching the documented behavior. + +## \[2.0.1] + +- [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7. + +## \[2.0.0] + +- [`e2c4dfb6`](https://github.com/tauri-apps/plugins-workspace/commit/e2c4dfb6af43e5dd8d9ceba232c315f5febd55c1) Update to tauri v2 stable release. + +## \[2.0.0-rc.7] + +- [`3168e176`](https://github.com/tauri-apps/plugins-workspace/commit/3168e176031a61215be542595ba90ca51f8f2d97) ([#1806](https://github.com/tauri-apps/plugins-workspace/pull/1806) by [@auggiebennett](https://github.com/tauri-apps/plugins-workspace/../../auggiebennett)) Fix fails to start when having spaces in the main binary path on Windows + +## \[2.0.0-rc.6] + +- [`6f3f6679`](https://github.com/tauri-apps/plugins-workspace/commit/6f3f66794a87ef9d1c16667c425d5ad7091a9c2f) ([#1780](https://github.com/tauri-apps/plugins-workspace/pull/1780)) Added `DeepLink::on_open_url` function to match the JavaScript API implementation, + which wraps the `deep-link://new-url` event and also send the current deep link if there's any. + +## \[2.0.0-rc.5] + +- [`984110a9`](https://github.com/tauri-apps/plugins-workspace/commit/984110a978774712bad4d746ed06134d54debcd0) ([#1770](https://github.com/tauri-apps/plugins-workspace/pull/1770) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Emit the `deep-link://new-url` event on Linux and Windows when the app is executed with a deep link CLI argument, + matching the iOS and macOS behavior. + +## \[2.0.0-rc.2] + +- [`64a6240f`](https://github.com/tauri-apps/plugins-workspace/commit/64a6240f79fcd52267c8d721b727ae695055d7ff) ([#1759](https://github.com/tauri-apps/plugins-workspace/pull/1759) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Implement `get_current` on Linux and Windows. + +## \[2.0.0-rc.3] + +- [`4654591d`](https://github.com/tauri-apps/plugins-workspace/commit/4654591d820403d6fa1a007fd55bb0d85947a6cc) ([#1732](https://github.com/tauri-apps/plugins-workspace/pull/1732) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Allow empty configuration values. + +## \[2.0.0-rc.1] + +- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri 2.0.0-rc.8 + +## \[2.0.0-rc.1] + +- [`2c00c029`](https://github.com/tauri-apps/plugins-workspace/commit/2c00c0292c9127b81567de46691e8c0f73557261) ([#1630](https://github.com/tauri-apps/plugins-workspace/pull/1630) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Fixed an issue that caused multi-word IIFE names to not be formatted correctly. For example the `barcode-scanner` was defined as `window.__TAURI_PLUGIN_CLIPBOARDMANAGER__` instead of `window.__TAURI_PLUGIN_CLIPBOARD_MANAGER__`. +- [`5d170a54`](https://github.com/tauri-apps/plugins-workspace/commit/5d170a5444982dcc14135f6f1fc3e5da359f0eb0) ([#1671](https://github.com/tauri-apps/plugins-workspace/pull/1671) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri 2.0.0-rc.3. + +### changes + +- [`6b079cfd`](https://github.com/tauri-apps/plugins-workspace/commit/6b079cfdd107c94abc2c7300f6af00bac3ff4040) ([#1649](https://github.com/tauri-apps/plugins-workspace/pull/1649) by [@ahqsoftwares](https://github.com/tauri-apps/plugins-workspace/../../ahqsoftwares)) Remove targetSdk from build.kts files as it is deprecated and will be removed from DSL v9.0 + +## \[2.0.0-rc.0] + +- [`9887d1`](https://github.com/tauri-apps/plugins-workspace/commit/9887d14bd0e971c4c0f5c1188fc4005d3fc2e29e) Update to tauri RC. + +## \[2.0.0-beta.10] + +- [`99d6ac0f`](https://github.com/tauri-apps/plugins-workspace/commit/99d6ac0f9506a6a4a1aa59c728157190a7441af6) ([#1606](https://github.com/tauri-apps/plugins-workspace/pull/1606) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) The JS packages now specify the *minimum* `@tauri-apps/api` version instead of a single exact version. +- [`6de87966`](https://github.com/tauri-apps/plugins-workspace/commit/6de87966ecc00ad9d91c25be452f1f46bd2b7e1f) ([#1597](https://github.com/tauri-apps/plugins-workspace/pull/1597) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Update to tauri beta.25. + +## \[2.0.0-beta.9] + +- [`22a17980`](https://github.com/tauri-apps/plugins-workspace/commit/22a17980ff4f6f8c40adb1b8f4ffc6dae2fe7e30) ([#1537](https://github.com/tauri-apps/plugins-workspace/pull/1537) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri beta.24. + +## \[2.0.0-beta.8] + +- [`76daee7a`](https://github.com/tauri-apps/plugins-workspace/commit/76daee7aafece34de3092c86e531cf9eb1138989) ([#1512](https://github.com/tauri-apps/plugins-workspace/pull/1512) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Update to tauri beta.23. + +## \[2.0.0-beta.7] + +- [`0b008882`](https://github.com/tauri-apps/plugins-workspace/commit/0b0088821e50e33825f7d573b1c826cfeb38dda0) ([#1404](https://github.com/tauri-apps/plugins-workspace/pull/1404) by [@simonhyll](https://github.com/tauri-apps/plugins-workspace/../../simonhyll)) Fixed a typo in the `deep-link` js bindings causing `isRegistered` to not work. + +## \[2.0.0-beta.6] + +- [`9013854f`](https://github.com/tauri-apps/plugins-workspace/commit/9013854f42a49a230b9dbb9d02774765528a923f)([#1382](https://github.com/tauri-apps/plugins-workspace/pull/1382)) Update to tauri beta.22. + +## \[2.0.0-beta.5] + +- [`430bd6f4`](https://github.com/tauri-apps/plugins-workspace/commit/430bd6f4f379bee5d232ae6b098ae131db7f178a)([#1363](https://github.com/tauri-apps/plugins-workspace/pull/1363)) Update to tauri beta.20. + +## \[2.0.0-beta.4] + +- [`021d23be`](https://github.com/tauri-apps/plugins-workspace/commit/021d23bef330de4ce001993e0ef2c7ab7815f044)([#916](https://github.com/tauri-apps/plugins-workspace/pull/916)) Added desktop support. + +## \[2.0.0-beta.3] + +- [`bd1ed590`](https://github.com/tauri-apps/plugins-workspace/commit/bd1ed5903ffcce5500310dac1e59e8c67674ef1e)([#1237](https://github.com/tauri-apps/plugins-workspace/pull/1237)) Update to tauri beta.17. + +## \[2.0.0-beta.3] + +- [`a04ea2f`](https://github.com/tauri-apps/plugins-workspace/commit/a04ea2f38294d5a3987578283badc8eec87a7752)([#1071](https://github.com/tauri-apps/plugins-workspace/pull/1071)) The global API script is now only added to the binary when the `withGlobalTauri` config is true. + +## \[2.0.0-beta.2] + +- [`99bea25`](https://github.com/tauri-apps/plugins-workspace/commit/99bea2559c2c0648c2519c50a18cd124dacef57b)([#1005](https://github.com/tauri-apps/plugins-workspace/pull/1005)) Update to tauri beta.8. + ## \[2.0.0-beta.1] - [`569defb`](https://github.com/tauri-apps/plugins-workspace/commit/569defbe9492e38938554bb7bdc1be9151456d21) Update to tauri beta.4. @@ -36,4 +139,12 @@ - [`eccd6f9`](https://github.com/tauri-apps/plugins-workspace/commit/eccd6f977af7629255b6f5a5205666c9079a86ed)([#504](https://github.com/tauri-apps/plugins-workspace/pull/504)) Initial release. - [`eccd6f9`](https://github.com/tauri-apps/plugins-workspace/commit/eccd6f977af7629255b6f5a5205666c9079a86ed)([#504](https://github.com/tauri-apps/plugins-workspace/pull/504)) Initial release. -commit/eccd6f977af7629255b6f5a5205666c9079a86ed)([#504](https://github.com/tauri-apps/plugins-workspace/pull/504)) Initial release. + commit/eccd6f977af7629255b6f5a5205666c9079a86ed)([#504](https://github.com/tauri-apps/plugins-workspace/pull/504)) Initial release. + om/tauri-apps/plugins-workspace/commit/eccd6f977af7629255b6f5a5205666c9079a86ed)([#504](https://github.com/tauri-apps/plugins-workspace/pull/504)) Initial release. + +- [`eccd6f9`](https://github.com/tauri-apps/plugins-workspace/commit/eccd6f977af7629255b6f5a5205666c9079a86ed)([#504](https://github.com/tauri-apps/plugins-workspace/pull/504)) Initial release. + commit/eccd6f977af7629255b6f5a5205666c9079a86ed)([#504](https://github.com/tauri-apps/plugins-workspace/pull/504)) Initial release. + ithub.com/tauri-apps/plugins-workspace/pull/504)) Initial release. + ]\(https://github.com/tauri-apps/plugins-workspace/commit/eccd6f977af7629255b6f5a5205666c9079a86ed)([#504](https://github.com/tauri-apps/plugins-workspace/pull/504)) Initial release. + commit/eccd6f977af7629255b6f5a5205666c9079a86ed)([#504](https://github.com/tauri-apps/plugins-workspace/pull/504)) Initial release. + ithub.com/tauri-apps/plugins-workspace/pull/504)) Initial release. diff --git a/plugins/deep-link/Cargo.toml b/plugins/deep-link/Cargo.toml index 95c49557..8b3d069d 100644 --- a/plugins/deep-link/Cargo.toml +++ b/plugins/deep-link/Cargo.toml @@ -1,27 +1,45 @@ [package] name = "tauri-plugin-deep-link" -version = "2.0.0-beta.1" +version = "2.2.1" description = "Set your Tauri application as the default handler for an URL" authors = { workspace = true } license = { workspace = true } edition = { workspace = true } rust-version = { workspace = true } +repository = { workspace = true } links = "tauri-plugin-deep-link" [package.metadata.docs.rs] -rustc-args = [ "--cfg", "docsrs" ] -rustdoc-args = [ "--cfg", "docsrs" ] -targets = [ "x86_64-linux-android" ] +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs"] +targets = ["x86_64-linux-android"] + +[package.metadata.platforms.support] +windows = { level = "full", notes = "" } +linux = { level = "full", notes = "" } +macos = { level = "partial", notes = "Runtime deep link registration is not supported" } +android = { level = "partial", notes = "Runtime deep link registration is not supported" } +ios = { level = "partial", notes = "Runtime deep link registration is not supported" } [build-dependencies] serde = { workspace = true } serde_json = { workspace = true } -tauri-plugin = { workspace = true, features = [ "build" ] } +tauri-utils = { workspace = true } +tauri-plugin = { workspace = true, features = ["build"] } [dependencies] serde = { workspace = true } serde_json = { workspace = true } tauri = { workspace = true } -log = { workspace = true } +tauri-utils = { workspace = true } +tracing = { workspace = true } thiserror = { workspace = true } url = { workspace = true } + +[target."cfg(windows)".dependencies] +dunce = "1" +windows-registry = "0.5" +windows-result = "0.3" + +[target."cfg(target_os = \"linux\")".dependencies] +rust-ini = "0.21" diff --git a/plugins/deep-link/README.md b/plugins/deep-link/README.md index d014040c..61a36a80 100644 --- a/plugins/deep-link/README.md +++ b/plugins/deep-link/README.md @@ -2,9 +2,17 @@ Set your Tauri application as the default handler for an URL. +| Platform | Supported | +| -------- | --------- | +| Linux | ✓ | +| Windows | ✓ | +| macOS | ✓ | +| Android | ✓ | +| iOS | ✓ | + ## Install -_This plugin requires a Rust version of at least **1.75**_ +_This plugin requires a Rust version of at least **1.77.2**_ There are three general methods of installation that we can recommend. @@ -18,7 +26,7 @@ Install the Core plugin by adding the following to your `Cargo.toml` file: ```toml [dependencies] -tauri-plugin-deep-link = "2.0.0-beta" +tauri-plugin-deep-link = "2.0.0" # alternatively with Git: tauri-plugin-deep-link = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` @@ -63,7 +71,7 @@ For [app links](https://developer.android.com/training/app-links#android-app-lin ] ``` -Where `$APP_BUNDLE_ID` is the value defined on `tauri.conf.json > tauri > bundle > identifier` with `-` replaced with `_` and `$CERT_FINGERPRINT` is a list of SHA256 fingerprints of your app's signing certificates, see [verify android applinks](https://developer.android.com/training/app-links/verify-android-applinks#web-assoc) for more information. +Where `$APP_BUNDLE_ID` is the value defined on `tauri.conf.json > identifier` with `-` replaced with `_` and `$CERT_FINGERPRINT` is a list of SHA256 fingerprints of your app's signing certificates, see [verify android applinks](https://developer.android.com/training/app-links/verify-android-applinks#web-assoc) for more information. ### iOS @@ -87,22 +95,35 @@ For [universal links](https://developer.apple.com/documentation/xcode/allowing-a } ``` -Where `$DEVELOPMENT_TEAM_ID` is the value defined on `tauri.conf.json > tauri > bundle > iOS > developmentTeam` or the `TAURI_APPLE_DEVELOPMENT_TEAM` environment variable and `$APP_BUNDLE_ID` is the value defined on `tauri.conf.json > tauri > bundle > identifier`. See [applinks.details](https://developer.apple.com/documentation/bundleresources/applinks/details) for more information. +Where `$DEVELOPMENT_TEAM_ID` is the value defined on `tauri.conf.json > bundle > iOS > developmentTeam` or the `APPLE_DEVELOPMENT_TEAM` environment variable and `$APP_BUNDLE_ID` is the value defined on `tauri.conf.json > identifier`. See [applinks.details](https://developer.apple.com/documentation/bundleresources/applinks/details) for more information. + +To verify if your domain has been properly configured to expose the app associations, you can run the following command: + +```sh +curl -v https://app-site-association.cdn-apple.com/a/v1/ +``` + +**The apple-app-site-association file must be served over HTTPS and the response must include the `Content-Type: application/json` header.** + +To quickly open an app link on the iOS simulator you can execute `xcrun simctl openurl booted `. See [supporting associated domains](https://developer.apple.com/documentation/xcode/supporting-associated-domains?language=objc) for more information. ## Configuration -Under `tauri.conf.json > plugins > deep-link`, configure the domains you want to associate with your application: +Under `tauri.conf.json > plugins > deep-link`, configure the domains (mobile) and schemes (desktop) you want to associate with your application: ```json { "plugins": { "deep-link": { - "domains": [ + "mobile": [ { "host": "your.website.com", "pathPrefix": ["/open"] }, { "host": "another.site.br" } - ] + ], + "desktop": { + "schemes": ["something", "my-tauri-app"] + } } } } @@ -112,7 +133,7 @@ Under `tauri.conf.json > plugins > deep-link`, configure the domains you want to First you need to register the core plugin with Tauri: -`src-tauri/src/main.rs` +`src-tauri/src/lib.rs` ```rust fn main() { @@ -126,12 +147,14 @@ fn main() { Afterwards all the plugin's APIs are available through the JavaScript guest bindings: ```javascript -import { onOpenUrl } from "@tauri-apps/plugin-deep-link"; +import { onOpenUrl } from '@tauri-apps/plugin-deep-link' await onOpenUrl((urls) => { - console.log('deep link:', urls); -}); + console.log('deep link:', urls) +}) ``` +Note that the Plugin will only emit events on macOS, iOS and Android. On Windows and Linux the OS will spawn a new instance of your app with the URL as a CLI argument. If you want your app to behave on Windows & Linux similar to the other platforms you can use the [single-instance](../single-instance/) plugin with the `deep-link` feature enabled. + ## Contributing PRs accepted. Please make sure to read the Contributing Guide before making a pull request. diff --git a/plugins/deep-link/SECURITY.md b/plugins/deep-link/SECURITY.md new file mode 100644 index 00000000..4f09bbac --- /dev/null +++ b/plugins/deep-link/SECURITY.md @@ -0,0 +1,23 @@ +# Security Policy + +**Do not report security vulnerabilities through public GitHub issues.** + +**Please use the [Private Vulnerability Disclosure](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability) feature of GitHub.** + +Include as much of the following information: + +- Type of issue (e.g. improper input parsing, privilege escalation, etc.) +- The location of the affected source code (tag/branch/commit or direct URL) +- Any special configuration required to reproduce the issue +- The distribution affected or used to help us with reproduction of the issue +- Step-by-step instructions to reproduce the issue +- Ideally a reproduction repository +- Impact of the issue, including how an attacker might exploit the issue + +We prefer to receive reports in English. + +## Contact + +Please disclose a vulnerability or security relevant issue here: [https://github.com/tauri-apps/plugins-workspace/security/advisories/new](https://github.com/tauri-apps/plugins-workspace/security/advisories/new). + +Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app). diff --git a/plugins/deep-link/android/build.gradle.kts b/plugins/deep-link/android/build.gradle.kts index 97bb133e..671ee8b7 100644 --- a/plugins/deep-link/android/build.gradle.kts +++ b/plugins/deep-link/android/build.gradle.kts @@ -5,11 +5,10 @@ plugins { android { namespace = "app.tauri.deep_link" - compileSdk = 32 + compileSdk = 34 defaultConfig { - minSdk = 24 - targetSdk = 32 + minSdk = 24 testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles("consumer-rules.pro") diff --git a/plugins/deep-link/android/src/main/java/DeepLinkPlugin.kt b/plugins/deep-link/android/src/main/java/DeepLinkPlugin.kt index 58bc70c7..db4e79af 100644 --- a/plugins/deep-link/android/src/main/java/DeepLinkPlugin.kt +++ b/plugins/deep-link/android/src/main/java/DeepLinkPlugin.kt @@ -40,6 +40,8 @@ class DeepLinkPlugin(private val activity: Activity): Plugin(activity) { invoke.resolve(ret) } + // This command should not be added to the `build.rs` and exposed as it is only + // used internally from the rust backend. @Command fun setEventHandler(invoke: Invoke) { val args = invoke.parseArgs(SetEventHandlerArgs::class.java) diff --git a/plugins/deep-link/api-iife.js b/plugins/deep-link/api-iife.js new file mode 100644 index 00000000..6d9e3e18 --- /dev/null +++ b/plugins/deep-link/api-iife.js @@ -0,0 +1 @@ +if("__TAURI__"in window){var __TAURI_PLUGIN_DEEP_LINK__=function(e){"use strict";function n(e,n=!1){return window.__TAURI_INTERNALS__.transformCallback(e,n)}async function r(e,n={},r){return window.__TAURI_INTERNALS__.invoke(e,n,r)}var t;async function i(e,t,i){const a={kind:"Any"};return r("plugin:event|listen",{event:e,target:a,handler:n(t)}).then((n=>async()=>async function(e,n){await r("plugin:event|unlisten",{event:e,eventId:n})}(e,n)))}return"function"==typeof SuppressedError&&SuppressedError,function(e){e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_CREATED="tauri://window-created",e.WEBVIEW_CREATED="tauri://webview-created",e.DRAG_ENTER="tauri://drag-enter",e.DRAG_OVER="tauri://drag-over",e.DRAG_DROP="tauri://drag-drop",e.DRAG_LEAVE="tauri://drag-leave"}(t||(t={})),e.getCurrent=async function(){return await r("plugin:deep-link|get_current")},e.isRegistered=async function(e){return await r("plugin:deep-link|is_registered",{protocol:e})},e.onOpenUrl=async function(e){return await i("deep-link://new-url",(n=>{e(n.payload)}))},e.register=async function(e){return await r("plugin:deep-link|register",{protocol:e})},e.unregister=async function(e){return await r("plugin:deep-link|unregister",{protocol:e})},e}({});Object.defineProperty(window.__TAURI__,"deepLink",{value:__TAURI_PLUGIN_DEEP_LINK__})} diff --git a/plugins/deep-link/build.rs b/plugins/deep-link/build.rs index ce2da418..418746b2 100644 --- a/plugins/deep-link/build.rs +++ b/plugins/deep-link/build.rs @@ -6,7 +6,7 @@ mod config; use config::{AssociatedDomain, Config}; -const COMMANDS: &[&str] = &["get_current"]; +const COMMANDS: &[&str] = &["get_current", "register", "unregister", "is_registered"]; // TODO: Consider using activity-alias in case users may have multiple activities in their app. fn intent_filter(domain: &AssociatedDomain) -> String { @@ -57,14 +57,14 @@ fn intent_filter(domain: &AssociatedDomain) -> String { } fn main() { - if let Err(error) = tauri_plugin::Builder::new(COMMANDS) + let result = tauri_plugin::Builder::new(COMMANDS) + .global_api_script_path("./api-iife.js") .android_path("android") - .try_build() - { - println!("{error:#}"); - if !(cfg!(docsrs) && std::env::var("TARGET").unwrap().contains("android")) { - std::process::exit(1); - } + .try_build(); + + // when building documentation for Android the plugin build result is always Err() and is irrelevant to the crate documentation build + if !(cfg!(docsrs) && std::env::var("TARGET").unwrap().contains("android")) { + result.unwrap(); } if let Some(config) = tauri_plugin::plugin_config::("deep-link") { @@ -72,7 +72,7 @@ fn main() { "DEEP LINK PLUGIN", "activity", config - .domains + .mobile .iter() .map(intent_filter) .collect::>() @@ -86,7 +86,7 @@ fn main() { entitlements.insert( "com.apple.developer.associated-domains".into(), config - .domains + .mobile .into_iter() .map(|d| format!("applinks:{}", d.host).into()) .collect::>() diff --git a/plugins/deep-link/examples/app/.gitignore b/plugins/deep-link/examples/app/.gitignore index a547bf36..c9b61864 100644 --- a/plugins/deep-link/examples/app/.gitignore +++ b/plugins/deep-link/examples/app/.gitignore @@ -8,7 +8,6 @@ pnpm-debug.log* lerna-debug.log* node_modules -dist dist-ssr *.local @@ -22,3 +21,5 @@ dist-ssr *.njsproj *.sln *.sw? + +dist/ diff --git a/plugins/deep-link/examples/app/CHANGELOG.md b/plugins/deep-link/examples/app/CHANGELOG.md index 7277d85a..06e931d0 100644 --- a/plugins/deep-link/examples/app/CHANGELOG.md +++ b/plugins/deep-link/examples/app/CHANGELOG.md @@ -1,5 +1,103 @@ # Changelog +## \[2.2.1] + +### Dependencies + +- Upgraded to `deep-link-js@2.2.1` + +## \[2.2.0] + +### Dependencies + +- Upgraded to `deep-link-js@2.1.0` + +## \[2.0.1] + +### Dependencies + +- Upgraded to `deep-link-js@2.0.1` + +## \[2.0.0] + +- [`e2c4dfb6`](https://github.com/tauri-apps/plugins-workspace/commit/e2c4dfb6af43e5dd8d9ceba232c315f5febd55c1) Update to tauri v2 stable release. + +### Dependencies + +- Upgraded to `deep-link-js@2.0.0` + +## \[2.0.0-rc.1] + +### Dependencies + +- Upgraded to `deep-link-js@2.0.0-rc.2` + +## \[2.0.0-rc.0] + +### Dependencies + +- Upgraded to `deep-link-js@2.0.0-rc.1` + +## \[2.0.0-beta.11] + +### Dependencies + +- Upgraded to `deep-link-js@2.0.0-rc.0` + +## \[2.0.0-beta.10] + +### Dependencies + +- Upgraded to `deep-link-js@2.0.0-beta.10` + +## \[2.0.0-beta.9] + +### Dependencies + +- Upgraded to `deep-link-js@2.0.0-beta.9` + +## \[2.0.0-beta.8] + +### Dependencies + +- Upgraded to `deep-link-js@2.0.0-beta.8` + +## \[2.0.0-beta.7] + +### Dependencies + +- Upgraded to `deep-link-js@2.0.0-beta.7` + +## \[2.0.0-beta.6] + +### Dependencies + +- Upgraded to `deep-link-js@2.0.0-beta.6` + +## \[2.0.0-beta.5] + +### Dependencies + +- Upgraded to `deep-link-js@2.0.0-beta.5` + +## \[2.0.0-beta.4] + +### Dependencies + +- Upgraded to `deep-link-js@2.0.0-beta.4` + +## \[2.0.0-beta.3] + +### Dependencies + +- Upgraded to `deep-link-js@2.0.0-beta.3` + +## \[2.0.0-beta.2] + +### Dependencies + +- Upgraded to `deep-link-js@2.0.0-beta.2` + ## \[2.0.0-beta.1] ### Dependencies diff --git a/plugins/deep-link/examples/app/package.json b/plugins/deep-link/examples/app/package.json index d9d4ea34..15d12a52 100644 --- a/plugins/deep-link/examples/app/package.json +++ b/plugins/deep-link/examples/app/package.json @@ -1,7 +1,7 @@ { "name": "deep-link-example", "private": true, - "version": "2.0.0-beta.1", + "version": "2.2.1", "type": "module", "scripts": { "dev": "vite", @@ -10,13 +10,12 @@ "tauri": "tauri" }, "dependencies": { - "@tauri-apps/api": "2.0.0-beta.2", - "@tauri-apps/plugin-deep-link": "2.0.0-beta.1" + "@tauri-apps/api": "2.5.0", + "@tauri-apps/plugin-deep-link": "2.2.1" }, "devDependencies": { - "@tauri-apps/cli": "2.0.0-beta.3", - "internal-ip": "^8.0.0", - "typescript": "^5.2.2", - "vite": "^5.0.12" + "@tauri-apps/cli": "2.5.0", + "typescript": "^5.7.3", + "vite": "^6.2.6" } } diff --git a/plugins/deep-link/examples/app/src-tauri/Cargo.toml b/plugins/deep-link/examples/app/src-tauri/Cargo.toml index 9d1eb501..11e7c41f 100644 --- a/plugins/deep-link/examples/app/src-tauri/Cargo.toml +++ b/plugins/deep-link/examples/app/src-tauri/Cargo.toml @@ -6,7 +6,7 @@ authors = ["you"] license = "" repository = "" edition = "2021" -rust-version = "1.75" +rust-version = "1.77.2" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -19,11 +19,16 @@ tauri-build = { workspace = true } [dependencies] serde = { workspace = true } serde_json = { workspace = true } -tauri = { workspace = true } +tauri = { workspace = true, features = ["wry", "compression"] } tauri-plugin-deep-link = { path = "../../../" } +tauri-plugin-log = { path = "../../../../log" } +tauri-plugin-single-instance = { path = "../../../../single-instance", features = [ + "deep-link", +] } +log = "0.4" [features] # this feature is used for production builds or when `devUrl` points to the filesystem and the built-in dev server is disabled. # If you use cargo directly instead of tauri's cli you can use this feature flag to switch between tauri's `dev` and `build` modes. # DO NOT REMOVE!! -custom-protocol = [ "tauri/custom-protocol" ] +prod = ["tauri/custom-protocol"] diff --git a/plugins/deep-link/examples/app/src-tauri/capabilities/app.json b/plugins/deep-link/examples/app/src-tauri/capabilities/app.json new file mode 100644 index 00000000..a4bc7b4c --- /dev/null +++ b/plugins/deep-link/examples/app/src-tauri/capabilities/app.json @@ -0,0 +1,11 @@ +{ + "$schema": "../gen/schemas/desktop-schema.json", + "identifier": "run-app-base", + "description": "Base permissions to run the app", + "windows": ["main"], + "permissions": [ + "core:default", + "deep-link:allow-get-current", + "deep-link:default" + ] +} diff --git a/plugins/deep-link/examples/app/src-tauri/gen/android/app/.gitignore b/plugins/deep-link/examples/app/src-tauri/gen/android/app/.gitignore index 6d888c10..1efb55bd 100644 --- a/plugins/deep-link/examples/app/src-tauri/gen/android/app/.gitignore +++ b/plugins/deep-link/examples/app/src-tauri/gen/android/app/.gitignore @@ -2,4 +2,5 @@ /src/main/jniLibs/**/*.so /src/main/assets/tauri.conf.json /tauri.build.gradle.kts -/proguard-tauri.pro \ No newline at end of file +/proguard-tauri.pro +/tauri.properties \ No newline at end of file diff --git a/plugins/deep-link/examples/app/src-tauri/gen/android/app/build.gradle.kts b/plugins/deep-link/examples/app/src-tauri/gen/android/app/build.gradle.kts index f26cb2a5..f434bbfb 100644 --- a/plugins/deep-link/examples/app/src-tauri/gen/android/app/build.gradle.kts +++ b/plugins/deep-link/examples/app/src-tauri/gen/android/app/build.gradle.kts @@ -1,19 +1,28 @@ +import java.util.Properties + plugins { id("com.android.application") id("org.jetbrains.kotlin.android") id("rust") } +val tauriProperties = Properties().apply { + val propFile = file("tauri.properties") + if (propFile.exists()) { + propFile.inputStream().use { load(it) } + } +} + android { - compileSdk = 33 + compileSdk = 34 namespace = "com.tauri.deep_link_example" defaultConfig { manifestPlaceholders["usesCleartextTraffic"] = "false" applicationId = "com.tauri.deep_link_example" minSdk = 24 - targetSdk = 33 - versionCode = 1 - versionName = "1.0" + targetSdk = 34 + versionCode = tauriProperties.getProperty("tauri.android.versionCode", "1").toInt() + versionName = tauriProperties.getProperty("tauri.android.versionName", "1.0") } buildTypes { getByName("debug") { @@ -39,6 +48,9 @@ android { kotlinOptions { jvmTarget = "1.8" } + buildFeatures { + buildConfig = true + } } rust { @@ -54,4 +66,4 @@ dependencies { androidTestImplementation("androidx.test.espresso:espresso-core:3.5.0") } -apply(from = "tauri.build.gradle.kts") +apply(from = "tauri.build.gradle.kts") \ No newline at end of file diff --git a/plugins/deep-link/examples/app/src-tauri/gen/android/app/src/main/AndroidManifest.xml b/plugins/deep-link/examples/app/src-tauri/gen/android/app/src/main/AndroidManifest.xml index 68c05a37..05265e32 100644 --- a/plugins/deep-link/examples/app/src-tauri/gen/android/app/src/main/AndroidManifest.xml +++ b/plugins/deep-link/examples/app/src-tauri/gen/android/app/src/main/AndroidManifest.xml @@ -1,6 +1,10 @@ + + + + + + diff --git a/plugins/deep-link/examples/app/src-tauri/gen/android/build.gradle.kts b/plugins/deep-link/examples/app/src-tauri/gen/android/build.gradle.kts index 5ce764e3..c5ef452a 100644 --- a/plugins/deep-link/examples/app/src-tauri/gen/android/build.gradle.kts +++ b/plugins/deep-link/examples/app/src-tauri/gen/android/build.gradle.kts @@ -4,8 +4,8 @@ buildscript { mavenCentral() } dependencies { - classpath("com.android.tools.build:gradle:8.0.0") - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21") + classpath("com.android.tools.build:gradle:8.5.1") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.25") } } diff --git a/plugins/deep-link/examples/app/src-tauri/gen/android/buildSrc/build.gradle.kts b/plugins/deep-link/examples/app/src-tauri/gen/android/buildSrc/build.gradle.kts index 099feff7..39e90b05 100644 --- a/plugins/deep-link/examples/app/src-tauri/gen/android/buildSrc/build.gradle.kts +++ b/plugins/deep-link/examples/app/src-tauri/gen/android/buildSrc/build.gradle.kts @@ -18,6 +18,6 @@ repositories { dependencies { compileOnly(gradleApi()) - implementation("com.android.tools.build:gradle:8.0.0") + implementation("com.android.tools.build:gradle:8.5.1") } diff --git a/plugins/deep-link/examples/app/src-tauri/gen/android/buildSrc/src/main/java/com/tauri/deep_link_example/kotlin/BuildTask.kt b/plugins/deep-link/examples/app/src-tauri/gen/android/buildSrc/src/main/java/com/tauri/deep_link_example/kotlin/BuildTask.kt index b9e83018..f9874825 100644 --- a/plugins/deep-link/examples/app/src-tauri/gen/android/buildSrc/src/main/java/com/tauri/deep_link_example/kotlin/BuildTask.kt +++ b/plugins/deep-link/examples/app/src-tauri/gen/android/buildSrc/src/main/java/com/tauri/deep_link_example/kotlin/BuildTask.kt @@ -1,7 +1,3 @@ -// Copyright 2019-2023 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT - import java.io.File import org.apache.tools.ant.taskdefs.condition.Os import org.gradle.api.DefaultTask diff --git a/plugins/deep-link/examples/app/src-tauri/gen/android/buildSrc/src/main/java/com/tauri/deep_link_example/kotlin/RustPlugin.kt b/plugins/deep-link/examples/app/src-tauri/gen/android/buildSrc/src/main/java/com/tauri/deep_link_example/kotlin/RustPlugin.kt index cad2d877..4aa7fcaf 100644 --- a/plugins/deep-link/examples/app/src-tauri/gen/android/buildSrc/src/main/java/com/tauri/deep_link_example/kotlin/RustPlugin.kt +++ b/plugins/deep-link/examples/app/src-tauri/gen/android/buildSrc/src/main/java/com/tauri/deep_link_example/kotlin/RustPlugin.kt @@ -1,7 +1,3 @@ -// Copyright 2019-2023 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT - import com.android.build.api.dsl.ApplicationExtension import org.gradle.api.DefaultTask import org.gradle.api.Plugin diff --git a/plugins/deep-link/examples/app/src-tauri/gen/android/gradle.properties b/plugins/deep-link/examples/app/src-tauri/gen/android/gradle.properties index 022338b7..2a7ec695 100644 --- a/plugins/deep-link/examples/app/src-tauri/gen/android/gradle.properties +++ b/plugins/deep-link/examples/app/src-tauri/gen/android/gradle.properties @@ -21,5 +21,4 @@ kotlin.code.style=official # resources declared in the library itself and none from the library's dependencies, # thereby reducing the size of the R class for that library android.nonTransitiveRClass=true -android.defaults.buildfeatures.buildconfig=true android.nonFinalResIds=false \ No newline at end of file diff --git a/plugins/deep-link/examples/app/src-tauri/gen/android/gradle/wrapper/gradle-wrapper.properties b/plugins/deep-link/examples/app/src-tauri/gen/android/gradle/wrapper/gradle-wrapper.properties index 40a43506..0df10d55 100644 --- a/plugins/deep-link/examples/app/src-tauri/gen/android/gradle/wrapper/gradle-wrapper.properties +++ b/plugins/deep-link/examples/app/src-tauri/gen/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Tue May 10 19:22:52 CST 2022 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/plugins/deep-link/examples/app/src-tauri/gen/android/gradlew.bat b/plugins/deep-link/examples/app/src-tauri/gen/android/gradlew.bat index ac1b06f9..107acd32 100644 --- a/plugins/deep-link/examples/app/src-tauri/gen/android/gradlew.bat +++ b/plugins/deep-link/examples/app/src-tauri/gen/android/gradlew.bat @@ -1,89 +1,89 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@1x.png b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@1x.png index f8b128e3..a6ac2a8c 100644 Binary files a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@1x.png and b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@1x.png differ diff --git a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x-1.png b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x-1.png index 6bbd9e3c..2869541f 100644 Binary files a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x-1.png and b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x-1.png differ diff --git a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x.png b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x.png index 6bbd9e3c..2869541f 100644 Binary files a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x.png and b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x.png differ diff --git a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@3x.png b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@3x.png index f702cc04..cf265a45 100644 Binary files a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@3x.png and b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@3x.png differ diff --git a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@1x.png b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@1x.png index c5e92f78..29c9746c 100644 Binary files a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@1x.png and b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@1x.png differ diff --git a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x-1.png b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x-1.png index 1c607d5c..a4e68c8d 100644 Binary files a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x-1.png and b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x-1.png differ diff --git a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x.png b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x.png index 1c607d5c..a4e68c8d 100644 Binary files a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x.png and b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x.png differ diff --git a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@3x.png b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@3x.png index 60e93a6a..e4adcbce 100644 Binary files a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@3x.png and b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@3x.png differ diff --git a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@1x.png b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@1x.png index 6bbd9e3c..2869541f 100644 Binary files a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@1x.png and b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@1x.png differ diff --git a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x-1.png b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x-1.png index 819410f9..a414e65b 100644 Binary files a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x-1.png and b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x-1.png differ diff --git a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x.png b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x.png index 819410f9..a414e65b 100644 Binary files a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x.png and b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x.png differ diff --git a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@3x.png b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@3x.png index e00ae5a6..a0807e5d 100644 Binary files a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@3x.png and b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@3x.png differ diff --git a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png index f5301f37..704c9291 100644 Binary files a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png and b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png differ diff --git a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-512x512@2x.png b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-512x512@2x.png deleted file mode 100644 index 5e9add73..00000000 Binary files a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-512x512@2x.png and /dev/null differ diff --git a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@2x.png b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@2x.png index e00ae5a6..a0807e5d 100644 Binary files a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@2x.png and b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@2x.png differ diff --git a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@3x.png b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@3x.png index 3546ca10..2a9fbc26 100644 Binary files a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@3x.png and b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@3x.png differ diff --git a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@1x.png b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@1x.png index d8367101..2cdf1848 100644 Binary files a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@1x.png and b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@1x.png differ diff --git a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@2x.png b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@2x.png index 29925f2a..4723e4b4 100644 Binary files a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@2x.png and b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@2x.png differ diff --git a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-83.5x83.5@2x.png b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-83.5x83.5@2x.png index dfd22619..f26fee45 100644 Binary files a/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-83.5x83.5@2x.png and b/plugins/deep-link/examples/app/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-83.5x83.5@2x.png differ diff --git a/plugins/deep-link/examples/app/src-tauri/gen/apple/ExportOptions.plist b/plugins/deep-link/examples/app/src-tauri/gen/apple/ExportOptions.plist index b69cf1de..0428a171 100644 --- a/plugins/deep-link/examples/app/src-tauri/gen/apple/ExportOptions.plist +++ b/plugins/deep-link/examples/app/src-tauri/gen/apple/ExportOptions.plist @@ -3,6 +3,6 @@ method - development + debugging diff --git a/plugins/deep-link/examples/app/src-tauri/gen/apple/LaunchScreen.storyboard b/plugins/deep-link/examples/app/src-tauri/gen/apple/LaunchScreen.storyboard new file mode 100644 index 00000000..dd79351e --- /dev/null +++ b/plugins/deep-link/examples/app/src-tauri/gen/apple/LaunchScreen.storyboard @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/deep-link/examples/app/src-tauri/gen/apple/deep-link-example.xcodeproj/project.pbxproj b/plugins/deep-link/examples/app/src-tauri/gen/apple/deep-link-example.xcodeproj/project.pbxproj index c2e4090c..450bd847 100644 --- a/plugins/deep-link/examples/app/src-tauri/gen/apple/deep-link-example.xcodeproj/project.pbxproj +++ b/plugins/deep-link/examples/app/src-tauri/gen/apple/deep-link-example.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 51; + objectVersion = 56; objects = { /* Begin PBXBuildFile section */ @@ -17,26 +17,28 @@ D01EC573029B7BEC701F6012 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6BDF5DBBA740DA7D86791DEC /* WebKit.framework */; }; D4D232DBB85C5C1594FACC3D /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = D99665C1C3247732C6BF25F4 /* main.mm */; }; D7A9EBD47413746EDE96BDF8 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B18865218362A4BE07527DBD /* CoreGraphics.framework */; }; - FBB3FE3EDDEAF717E61F2AD4 /* libdeep_link_example.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DCAEEC42BAB5E4A4757C89C2 /* libdeep_link_example.a */; }; + E26F7FA923DA1EABEE42B63A /* libapp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 403FB4BAE59F74EE98EF1EC6 /* libapp.a */; }; + E6992F2651B864B15ED14925 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1846ADCEDC2C208E1037ADC6 /* LaunchScreen.storyboard */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 1846ADCEDC2C208E1037ADC6 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = ""; }; 1C21C8B4A18EC7D0B5808C10 /* MetalKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MetalKit.framework; path = System/Library/Frameworks/MetalKit.framework; sourceTree = SDKROOT; }; - 1CAAFA750FD735A285DC1238 /* deep-link-example_iOS.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = "deep-link-example_iOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 1CAAFA750FD735A285DC1238 /* deep-link-example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "deep-link-example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 2F316D1CD78DD2E070DA5C17 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 3DD32303BEC377C10162CF69 /* bindings.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = bindings.h; sourceTree = ""; }; + 403FB4BAE59F74EE98EF1EC6 /* libapp.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libapp.a; sourceTree = ""; }; 486CAFD81CB14F9A2DF72FDF /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 4A33212233BFAA738F6A46FC /* lib.rs */ = {isa = PBXFileReference; path = lib.rs; sourceTree = ""; }; + 4A33212233BFAA738F6A46FC /* lib.rs */ = {isa = PBXFileReference; lastKnownFileType = text; path = lib.rs; sourceTree = ""; }; 4BDECB1ED2EEEB5A6A8B8372 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; 6BDF5DBBA740DA7D86791DEC /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; 8AB0099573FE8BF1DC82CDBA /* deep-link-example_iOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "deep-link-example_iOS.entitlements"; sourceTree = ""; }; 9435FC7E183EA6260CE76637 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; - AEA78299D25FEC31E2988090 /* main.rs */ = {isa = PBXFileReference; path = main.rs; sourceTree = ""; }; + AEA78299D25FEC31E2988090 /* main.rs */ = {isa = PBXFileReference; lastKnownFileType = text; path = main.rs; sourceTree = ""; }; B005488D1B56B657AB52E28C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; B18865218362A4BE07527DBD /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; BF7ECB9AB55B71692A21D5F7 /* assets */ = {isa = PBXFileReference; lastKnownFileType = folder; path = assets; sourceTree = SOURCE_ROOT; }; D99665C1C3247732C6BF25F4 /* main.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = ""; }; - DCAEEC42BAB5E4A4757C89C2 /* libdeep_link_example.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libdeep_link_example.a; sourceTree = ""; }; ED2B1BC06DFE0498ECDEEE51 /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = System/Library/Frameworks/Metal.framework; sourceTree = SDKROOT; }; /* End PBXFileReference section */ @@ -45,7 +47,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FBB3FE3EDDEAF717E61F2AD4 /* libdeep_link_example.a in Frameworks */, + E26F7FA923DA1EABEE42B63A /* libapp.a in Frameworks */, D7A9EBD47413746EDE96BDF8 /* CoreGraphics.framework in Frameworks */, 017AE826151E36372534A964 /* Metal.framework in Frameworks */, BC36958BBBA7FE61066213D7 /* MetalKit.framework in Frameworks */, @@ -81,6 +83,7 @@ children = ( BF7ECB9AB55B71692A21D5F7 /* assets */, 486CAFD81CB14F9A2DF72FDF /* Assets.xcassets */, + 1846ADCEDC2C208E1037ADC6 /* LaunchScreen.storyboard */, 7D12035C470ED9DAF55A709E /* deep-link-example_iOS */, 84EADC52DA26583ACE816A6D /* Externals */, 146BAF1D709F8A0FE5B07709 /* Sources */, @@ -94,7 +97,7 @@ isa = PBXGroup; children = ( B18865218362A4BE07527DBD /* CoreGraphics.framework */, - DCAEEC42BAB5E4A4757C89C2 /* libdeep_link_example.a */, + 403FB4BAE59F74EE98EF1EC6 /* libapp.a */, ED2B1BC06DFE0498ECDEEE51 /* Metal.framework */, 1C21C8B4A18EC7D0B5808C10 /* MetalKit.framework */, 9435FC7E183EA6260CE76637 /* QuartzCore.framework */, @@ -142,7 +145,7 @@ F9EEBB3248B74B1D6CDA4D84 /* Products */ = { isa = PBXGroup; children = ( - 1CAAFA750FD735A285DC1238 /* deep-link-example_iOS.app */, + 1CAAFA750FD735A285DC1238 /* deep-link-example.app */, ); name = Products; sourceTree = ""; @@ -165,7 +168,7 @@ ); name = "deep-link-example_iOS"; productName = "deep-link-example_iOS"; - productReference = 1CAAFA750FD735A285DC1238 /* deep-link-example_iOS.app */; + productReference = 1CAAFA750FD735A285DC1238 /* deep-link-example.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ @@ -174,15 +177,11 @@ BCB4BA6E81088C5B470E3436 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1200; - TargetAttributes = { - A1C635908C823A89928264CD = { - DevelopmentTeam = Q93MBH6S2F; - }; - }; + BuildIndependentTargetsInParallel = YES; + LastUpgradeCheck = 1430; }; buildConfigurationList = 8FCB58B8ADB9F9CB9ECE01FA /* Build configuration list for PBXProject "deep-link-example" */; - compatibilityVersion = "Xcode 11.0"; + compatibilityVersion = "Xcode 14.0"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( @@ -204,6 +203,7 @@ buildActionMask = 2147483647; files = ( 65A8D948440EDAA7F62BA1F4 /* Assets.xcassets in Resources */, + E6992F2651B864B15ED14925 /* LaunchScreen.storyboard in Resources */, C384FB77F116B05F8E642CA8 /* assets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -225,8 +225,9 @@ outputFileListPaths = ( ); outputPaths = ( - "$(SRCROOT)/target/aarch64-apple-ios/${CONFIGURATION}/deps/libdeep_link_example.a", - "$(SRCROOT)/target/x86_64-apple-ios/${CONFIGURATION}/deps/libdeep_link_example.a", + "$(SRCROOT)/Externals/x86_64/${CONFIGURATION}/libapp.a", + "$(SRCROOT)/Externals/arm64/${CONFIGURATION}/libapp.a", + "$(SRCROOT)/Externals/arm64-sim/${CONFIGURATION}/libapp.a", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -320,8 +321,11 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = "deep-link-example_iOS/deep-link-example_iOS.entitlements"; CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = Q93MBH6S2F; ENABLE_BITCODE = NO; + "EXCLUDED_ARCHS[sdk=iphoneos*]" = "arm64-sim x86_64"; + "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\".\"", @@ -331,10 +335,28 @@ "$(inherited)", "@executable_path/Frameworks", ); - "LIBRARY_SEARCH_PATHS[arch=arm64-sim]" = "$(inherited) $(PROJECT_DIR)/Externals/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)"; - "LIBRARY_SEARCH_PATHS[arch=arm64]" = "$(inherited) $(PROJECT_DIR)/Externals/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)"; - "LIBRARY_SEARCH_PATHS[arch=x86_64]" = "$(inherited) $(PROJECT_DIR)/Externals/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)"; - PRODUCT_BUNDLE_IDENTIFIER = "com.tauri.deep-link-example"; + "LIBRARY_SEARCH_PATHS[arch=arm64-sim]" = ( + "$(inherited)", + "$(PROJECT_DIR)/Externals/arm64-sim/$(CONFIGURATION)", + "$(SDKROOT)/usr/lib/swift", + "$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)", + "$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)", + ); + "LIBRARY_SEARCH_PATHS[arch=arm64]" = ( + "$(inherited)", + "$(PROJECT_DIR)/Externals/arm64/$(CONFIGURATION)", + "$(SDKROOT)/usr/lib/swift", + "$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)", + "$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)", + ); + "LIBRARY_SEARCH_PATHS[arch=x86_64]" = ( + "$(inherited)", + "$(PROJECT_DIR)/Externals/x86_64/$(CONFIGURATION)", + "$(SDKROOT)/usr/lib/swift", + "$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)", + "$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.tauri.deep-link-example; PRODUCT_NAME = "deep-link-example"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -409,8 +431,11 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = "deep-link-example_iOS/deep-link-example_iOS.entitlements"; CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = Q93MBH6S2F; ENABLE_BITCODE = NO; + "EXCLUDED_ARCHS[sdk=iphoneos*]" = "arm64-sim x86_64"; + "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\".\"", @@ -420,10 +445,28 @@ "$(inherited)", "@executable_path/Frameworks", ); - "LIBRARY_SEARCH_PATHS[arch=arm64-sim]" = "$(inherited) $(PROJECT_DIR)/Externals/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)"; - "LIBRARY_SEARCH_PATHS[arch=arm64]" = "$(inherited) $(PROJECT_DIR)/Externals/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)"; - "LIBRARY_SEARCH_PATHS[arch=x86_64]" = "$(inherited) $(PROJECT_DIR)/Externals/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)"; - PRODUCT_BUNDLE_IDENTIFIER = "com.tauri.deep-link-example"; + "LIBRARY_SEARCH_PATHS[arch=arm64-sim]" = ( + "$(inherited)", + "$(PROJECT_DIR)/Externals/arm64-sim/$(CONFIGURATION)", + "$(SDKROOT)/usr/lib/swift", + "$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)", + "$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)", + ); + "LIBRARY_SEARCH_PATHS[arch=arm64]" = ( + "$(inherited)", + "$(PROJECT_DIR)/Externals/arm64/$(CONFIGURATION)", + "$(SDKROOT)/usr/lib/swift", + "$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)", + "$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)", + ); + "LIBRARY_SEARCH_PATHS[arch=x86_64]" = ( + "$(inherited)", + "$(PROJECT_DIR)/Externals/x86_64/$(CONFIGURATION)", + "$(SDKROOT)/usr/lib/swift", + "$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)", + "$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.tauri.deep-link-example; PRODUCT_NAME = "deep-link-example"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; diff --git a/plugins/deep-link/examples/app/src-tauri/gen/apple/deep-link-example.xcodeproj/xcshareddata/xcschemes/deep-link-example_iOS.xcscheme b/plugins/deep-link/examples/app/src-tauri/gen/apple/deep-link-example.xcodeproj/xcshareddata/xcschemes/deep-link-example_iOS.xcscheme index 7c19e933..a8fbc97e 100644 --- a/plugins/deep-link/examples/app/src-tauri/gen/apple/deep-link-example.xcodeproj/xcshareddata/xcschemes/deep-link-example_iOS.xcscheme +++ b/plugins/deep-link/examples/app/src-tauri/gen/apple/deep-link-example.xcodeproj/xcshareddata/xcschemes/deep-link-example_iOS.xcscheme @@ -1,6 +1,6 @@ CFBundleShortVersionString 0.0.0 CFBundleVersion - 0.0.0 + 0.1.0 LSRequiresIPhoneOS UILaunchStoryboardName @@ -41,4 +41,4 @@ UIInterfaceOrientationLandscapeRight - + \ No newline at end of file diff --git a/plugins/deep-link/examples/app/src-tauri/gen/apple/project.yml b/plugins/deep-link/examples/app/src-tauri/gen/apple/project.yml index d369b8dc..c924ca77 100644 --- a/plugins/deep-link/examples/app/src-tauri/gen/apple/project.yml +++ b/plugins/deep-link/examples/app/src-tauri/gen/apple/project.yml @@ -4,7 +4,7 @@ name: deep-link-example options: - bundleIdPrefix: com.tauri + bundleIdPrefix: com.tauri.deep-link-example deploymentTarget: iOS: 13.0 fileGroups: [../../src] @@ -40,6 +40,7 @@ targets: - path: assets buildPhase: resources type: folder + - path: LaunchScreen.storyboard info: path: deep-link-example_iOS/Info.plist properties: @@ -68,13 +69,15 @@ targets: ENABLE_BITCODE: false ARCHS: [arm64, arm64-sim] VALID_ARCHS: arm64 arm64-sim - LIBRARY_SEARCH_PATHS[arch=x86_64]: $(inherited) $(PROJECT_DIR)/Externals/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME) - LIBRARY_SEARCH_PATHS[arch=arm64]: $(inherited) $(PROJECT_DIR)/Externals/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME) - LIBRARY_SEARCH_PATHS[arch=arm64-sim]: $(inherited) $(PROJECT_DIR)/Externals/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME) + LIBRARY_SEARCH_PATHS[arch=x86_64]: $(inherited) $(PROJECT_DIR)/Externals/x86_64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME) + LIBRARY_SEARCH_PATHS[arch=arm64]: $(inherited) $(PROJECT_DIR)/Externals/arm64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME) + LIBRARY_SEARCH_PATHS[arch=arm64-sim]: $(inherited) $(PROJECT_DIR)/Externals/arm64-sim/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME) ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES: true + EXCLUDED_ARCHS[sdk=iphonesimulator*]: arm64 + EXCLUDED_ARCHS[sdk=iphoneos*]: arm64-sim x86_64 groups: [app] dependencies: - - framework: libdeep_link_example.a + - framework: libapp.a embed: false - sdk: CoreGraphics.framework - sdk: Metal.framework @@ -88,5 +91,6 @@ targets: name: Build Rust Code basedOnDependencyAnalysis: false outputFiles: - - $(SRCROOT)/target/aarch64-apple-ios/${CONFIGURATION}/deps/libdeep_link_example.a - - $(SRCROOT)/target/x86_64-apple-ios/${CONFIGURATION}/deps/libdeep_link_example.a + - $(SRCROOT)/Externals/x86_64/${CONFIGURATION}/libapp.a + - $(SRCROOT)/Externals/arm64/${CONFIGURATION}/libapp.a + - $(SRCROOT)/Externals/arm64-sim/${CONFIGURATION}/libapp.a diff --git a/plugins/deep-link/examples/app/src-tauri/server.js b/plugins/deep-link/examples/app/src-tauri/server.js index c8686631..24a6ac6f 100644 --- a/plugins/deep-link/examples/app/src-tauri/server.js +++ b/plugins/deep-link/examples/app/src-tauri/server.js @@ -2,30 +2,30 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import http from "http"; -import fs from "fs"; -import path from "path"; -import * as url from "url"; -const __dirname = url.fileURLToPath(new URL(".", import.meta.url)); +import http from 'http' +import fs from 'fs' +import path from 'path' +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) -const port = 8125; +const port = 8125 http .createServer(function (request, response) { - if (request.url === "/.well-known/apple-app-site-association") { + if (request.url === '/.well-known/apple-app-site-association') { // eslint-disable-next-line fs.readFile( - path.resolve(__dirname, "apple-app-site-association"), + path.resolve(__dirname, 'apple-app-site-association'), function (_error, content) { - response.writeHead(200); - response.end(content, "utf-8"); - }, - ); + response.writeHead(200) + response.end(content, 'utf-8') + } + ) } else { - response.writeHead(404); - response.end(); + response.writeHead(404) + response.end() } }) - .listen(port); + .listen(port) -console.log(`Server running at http://127.0.0.1:${port}/`); +console.log(`Server running at http://127.0.0.1:${port}/`) diff --git a/plugins/deep-link/examples/app/src-tauri/src/lib.rs b/plugins/deep-link/examples/app/src-tauri/src/lib.rs index 5fcb3b23..f85527d9 100644 --- a/plugins/deep-link/examples/app/src-tauri/src/lib.rs +++ b/plugins/deep-link/examples/app/src-tauri/src/lib.rs @@ -2,20 +2,45 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT +use tauri_plugin_deep_link::DeepLinkExt; + // Learn more about Tauri commands at https://tauri.app/v1/guides/features/command #[tauri::command] fn greet(name: &str) -> String { - format!("Hello, {}! You've been greeted from Rust!", name) + format!("Hello, {name}! You've been greeted from Rust!") } #[cfg_attr(mobile, tauri::mobile_entry_point)] pub fn run() { - tauri::Builder::default() + #[allow(unused_mut)] + let mut builder = tauri::Builder::default(); + + #[cfg(desktop)] + { + builder = builder.plugin(tauri_plugin_single_instance::init(|_app, argv, _cwd| { + println!("single instance triggered: {argv:?}"); + })); + } + + builder .plugin(tauri_plugin_deep_link::init()) + .plugin( + tauri_plugin_log::Builder::default() + .level(log::LevelFilter::Info) + .build(), + ) .setup(|app| { - app.listen("deep-link://new-url", |url| { - dbg!(url); + // ensure deep links are registered on the system + // this is useful because AppImages requires additional setup to be available in the system + // and calling register() makes the deep links immediately available - without any user input + // additionally, we manually register on Windows on debug builds for development + #[cfg(any(target_os = "linux", all(debug_assertions, windows)))] + app.deep_link().register_all()?; + + app.deep_link().on_open_url(|event| { + dbg!(event.urls()); }); + Ok(()) }) .invoke_handler(tauri::generate_handler![greet]) diff --git a/plugins/deep-link/examples/app/src-tauri/tauri.conf.json b/plugins/deep-link/examples/app/src-tauri/tauri.conf.json index bec5fb76..ac1c292b 100644 --- a/plugins/deep-link/examples/app/src-tauri/tauri.conf.json +++ b/plugins/deep-link/examples/app/src-tauri/tauri.conf.json @@ -1,6 +1,6 @@ { "productName": "deep-link-example", - "version": "0.0.0", + "version": "0.1.0", "identifier": "com.tauri.deep-link-example", "build": { "devUrl": "http://localhost:1420", @@ -28,7 +28,7 @@ "hello": "world" }, "deep-link": { - "domains": [ + "mobile": [ { "host": "fabianlars.de", "pathPrefix": ["/intent"] @@ -36,7 +36,10 @@ { "host": "tauri.app" } - ] + ], + "desktop": { + "schemes": ["fabianlars", "my-tauri-app"] + } } }, "bundle": { diff --git a/plugins/deep-link/examples/app/src/main.ts b/plugins/deep-link/examples/app/src/main.ts index f87a6afd..550e0aaa 100644 --- a/plugins/deep-link/examples/app/src/main.ts +++ b/plugins/deep-link/examples/app/src/main.ts @@ -4,35 +4,35 @@ import { onOpenUrl, - getCurrent as getCurrentDeepLinkUrls, -} from "@tauri-apps/plugin-deep-link"; + getCurrent as getCurrentDeepLinkUrls +} from '@tauri-apps/plugin-deep-link' function handler(urls: string[]) { - console.log(urls); + console.log(urls) // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const updateIntentEl = document.querySelector("#event-intent")!; - updateIntentEl.textContent = JSON.stringify(urls); + const updateIntentEl = document.querySelector('#event-intent')! + updateIntentEl.textContent = JSON.stringify(urls) } -window.addEventListener("DOMContentLoaded", () => { - onOpenUrl(handler); +window.addEventListener('DOMContentLoaded', () => { + onOpenUrl(handler) - document.querySelector("#intent-form")?.addEventListener("submit", (e) => { - e.preventDefault(); + document.querySelector('#intent-form')?.addEventListener('submit', (e) => { + e.preventDefault() getCurrentDeepLinkUrls() .then((res) => { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const updateIntentEl = document.querySelector("#update-intent")!; - updateIntentEl.textContent = res ? JSON.stringify(res) : "none"; + const updateIntentEl = document.querySelector('#update-intent')! + updateIntentEl.textContent = res ? JSON.stringify(res) : 'none' }) - .catch(console.error); - }); + .catch(console.error) + }) getCurrentDeepLinkUrls() .then((res) => { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const initialIntentEl = document.querySelector("#initial-intent")!; - initialIntentEl.textContent = res ? JSON.stringify(res) : "none"; + const initialIntentEl = document.querySelector('#initial-intent')! + initialIntentEl.textContent = res ? JSON.stringify(res) : 'none' }) - .catch(console.error); -}); + .catch(console.error) +}) diff --git a/plugins/deep-link/examples/app/tsconfig.json b/plugins/deep-link/examples/app/tsconfig.json index 43d4bc70..c0f337a2 100644 --- a/plugins/deep-link/examples/app/tsconfig.json +++ b/plugins/deep-link/examples/app/tsconfig.json @@ -3,7 +3,7 @@ "target": "ESNext", "module": "ESNext", "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", + "moduleResolution": "bundler", "strict": true, "sourceMap": true, "resolveJsonModule": true, diff --git a/plugins/deep-link/examples/app/vite.config.ts b/plugins/deep-link/examples/app/vite.config.ts index 4bf452bc..b54dc99a 100644 --- a/plugins/deep-link/examples/app/vite.config.ts +++ b/plugins/deep-link/examples/app/vite.config.ts @@ -2,40 +2,37 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { defineConfig } from "vite"; -import { internalIpV4 } from "internal-ip"; +import { defineConfig } from 'vite' -const mobile = - process.env.TAURI_PLATFORM === "android" || - process.env.TAURI_PLATFORM === "ios"; +const host = process.env.TAURI_DEV_HOST // https://vitejs.dev/config/ -export default defineConfig(async () => ({ +export default defineConfig({ // Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build` // prevent vite from obscuring rust errors clearScreen: false, // tauri expects a fixed port, fail if that port is not available server: { - host: mobile ? "0.0.0.0" : false, + host: host || false, port: 1420, - hmr: mobile + hmr: host ? { - protocol: "ws", - host: await internalIpV4(), - port: 1421, + protocol: 'ws', + host, + port: 1421 } : undefined, - strictPort: true, + strictPort: true }, // to make use of `TAURI_DEBUG` and other env variables // https://tauri.studio/v1/api/config#buildconfig.beforedevcommand - envPrefix: ["VITE_", "TAURI_"], + envPrefix: ['VITE_', 'TAURI_'], build: { // Tauri supports es2021 - target: process.env.TAURI_PLATFORM == "windows" ? "chrome105" : "safari13", + target: process.env.TAURI_PLATFORM == 'windows' ? 'chrome105' : 'safari13', // don't minify for debug builds - minify: !process.env.TAURI_DEBUG ? "esbuild" : false, + minify: !process.env.TAURI_DEBUG ? 'esbuild' : false, // produce sourcemaps for debug builds - sourcemap: !!process.env.TAURI_DEBUG, - }, -})); + sourcemap: !!process.env.TAURI_DEBUG + } +}) diff --git a/plugins/deep-link/guest-js/index.ts b/plugins/deep-link/guest-js/index.ts index c855ffcf..461bec8a 100644 --- a/plugins/deep-link/guest-js/index.ts +++ b/plugins/deep-link/guest-js/index.ts @@ -2,24 +2,104 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { invoke } from "@tauri-apps/api/core"; -import { UnlistenFn, listen } from "@tauri-apps/api/event"; +import { invoke } from '@tauri-apps/api/core' +import { type UnlistenFn, listen } from '@tauri-apps/api/event' +/** + * Get the current URLs that triggered the deep link. Use this on app load to check whether your app was started via a deep link. + * + * @example + * ```typescript + * import { getCurrent } from '@tauri-apps/plugin-deep-link'; + * const urls = await getCurrent(); + * ``` + * + * #### - **Windows / Linux**: This function reads the command line arguments and checks if there's only one value, which must be an URL with scheme matching one of the configured values. + * Note that you must manually check the arguments when registering deep link schemes dynamically with [`Self::register`]. + * Additionally, the deep link might have been provided as a CLI argument so you should check if its format matches what you expect.. + * + * @since 2.0.0 + */ export async function getCurrent(): Promise { - return await invoke("plugin:deep-link|get_current"); + return await invoke('plugin:deep-link|get_current') +} + +/** + * Register the app as the default handler for the specified protocol. + * + * @param protocol The name of the protocol without `://`. For example, if you want your app to handle `tauri://` links, call this method with `tauri` as the protocol. + * + * @example + * ```typescript + * import { register } from '@tauri-apps/plugin-deep-link'; + * await register("my-scheme"); + * ``` + * + * #### - **macOS / Android / iOS**: Unsupported. + * + * @since 2.0.0 + */ +export async function register(protocol: string): Promise { + return await invoke('plugin:deep-link|register', { protocol }) +} - // return await invoke("plugin:deep-link|get_current"); +/** + * Unregister the app as the default handler for the specified protocol. + * + * @param protocol The name of the protocol without `://`. + * + * @example + * ```typescript + * import { unregister } from '@tauri-apps/plugin-deep-link'; + * await unregister("my-scheme"); + * ``` + * + * #### - **macOS / Linux / Android / iOS**: Unsupported. + * + * @since 2.0.0 + */ +export async function unregister(protocol: string): Promise { + return await invoke('plugin:deep-link|unregister', { protocol }) } +/** + * Check whether the app is the default handler for the specified protocol. + * + * @param protocol The name of the protocol without `://`. + * + * @example + * ```typescript + * import { isRegistered } from '@tauri-apps/plugin-deep-link'; + * await isRegistered("my-scheme"); + * ``` + * + * #### - **macOS / Android / iOS**: Unsupported. + * + * @since 2.0.0 + */ +export async function isRegistered(protocol: string): Promise { + return await invoke('plugin:deep-link|is_registered', { protocol }) +} + +/** + * Helper function for the `deep-link://new-url` event to run a function each time the protocol is triggered while the app is running. Use `getCurrent` on app load to check whether your app was started via a deep link. + * + * @param protocol The name of the protocol without `://`. + * + * @example + * ```typescript + * import { onOpenUrl } from '@tauri-apps/plugin-deep-link'; + * await onOpenUrl((urls) => { console.log(urls) }); + * ``` + * + * #### - **Windows / Linux**: Unsupported without the single-instance plugin. The OS will spawn a new app instance passing the URL as a CLI argument. + * + * @since 2.0.0 + */ export async function onOpenUrl( - handler: (urls: string[]) => void, + handler: (urls: string[]) => void ): Promise { - const current = await getCurrent(); - if (current != null) { - handler(current); - } - - return await listen("deep-link://new-url", (event) => - handler(event.payload), - ); + return await listen('deep-link://new-url', (event) => { + handler(event.payload) + }) } diff --git a/plugins/deep-link/package.json b/plugins/deep-link/package.json index f1e57422..15eff738 100644 --- a/plugins/deep-link/package.json +++ b/plugins/deep-link/package.json @@ -1,11 +1,12 @@ { "name": "@tauri-apps/plugin-deep-link", - "version": "2.0.0-beta.1", + "version": "2.2.1", "description": "Set your Tauri application as the default handler for an URL", - "license": "MIT or APACHE-2.0", + "license": "MIT OR Apache-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" ], + "repository": "https://github.com/tauri-apps/plugins-workspace", "type": "module", "types": "./dist-js/index.d.ts", "main": "./dist-js/index.cjs", @@ -24,6 +25,6 @@ "LICENSE" ], "dependencies": { - "@tauri-apps/api": "2.0.0-beta.2" + "@tauri-apps/api": "^2.0.0" } } diff --git a/plugins/deep-link/permissions/autogenerated/commands/is_registered.toml b/plugins/deep-link/permissions/autogenerated/commands/is_registered.toml new file mode 100644 index 00000000..2dd73ace --- /dev/null +++ b/plugins/deep-link/permissions/autogenerated/commands/is_registered.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-is-registered" +description = "Enables the is_registered command without any pre-configured scope." +commands.allow = ["is_registered"] + +[[permission]] +identifier = "deny-is-registered" +description = "Denies the is_registered command without any pre-configured scope." +commands.deny = ["is_registered"] diff --git a/plugins/authenticator/permissions/autogenerated/commands/register.toml b/plugins/deep-link/permissions/autogenerated/commands/register.toml similarity index 100% rename from plugins/authenticator/permissions/autogenerated/commands/register.toml rename to plugins/deep-link/permissions/autogenerated/commands/register.toml diff --git a/plugins/deep-link/permissions/autogenerated/commands/unregister.toml b/plugins/deep-link/permissions/autogenerated/commands/unregister.toml new file mode 100644 index 00000000..5d33c97c --- /dev/null +++ b/plugins/deep-link/permissions/autogenerated/commands/unregister.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-unregister" +description = "Enables the unregister command without any pre-configured scope." +commands.allow = ["unregister"] + +[[permission]] +identifier = "deny-unregister" +description = "Denies the unregister command without any pre-configured scope." +commands.deny = ["unregister"] diff --git a/plugins/deep-link/permissions/autogenerated/reference.md b/plugins/deep-link/permissions/autogenerated/reference.md index d0791ef9..a8ef1874 100644 --- a/plugins/deep-link/permissions/autogenerated/reference.md +++ b/plugins/deep-link/permissions/autogenerated/reference.md @@ -1,14 +1,121 @@ -# Permissions +## Default Permission + +Allows reading the opened deep link via the get_current command + +#### This default permission set includes the following: + +- `allow-get-current` + +## Permission Table + + + + + + -## allow-get-current + + + + + + + + + + -Allows reading the opened deep link via the get_current command + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IdentifierDescription
+ +`deep-link:allow-get-current` + + Enables the get_current command without any pre-configured scope. -## deny-get-current +
+ +`deep-link:deny-get-current` + + Denies the get_current command without any pre-configured scope. -## default +
+ +`deep-link:allow-is-registered` + + + +Enables the is_registered command without any pre-configured scope. + +
+ +`deep-link:deny-is-registered` + + + +Denies the is_registered command without any pre-configured scope. + +
+ +`deep-link:allow-register` + + + +Enables the register command without any pre-configured scope. + +
+ +`deep-link:deny-register` + + + +Denies the register command without any pre-configured scope. + +
+ +`deep-link:allow-unregister` + + + +Enables the unregister command without any pre-configured scope. + +
+ +`deep-link:deny-unregister` + + + +Denies the unregister command without any pre-configured scope. +
diff --git a/plugins/deep-link/permissions/schemas/schema.json b/plugins/deep-link/permissions/schemas/schema.json index 54b3e650..c9fc2ceb 100644 --- a/plugins/deep-link/permissions/schemas/schema.json +++ b/plugins/deep-link/permissions/schemas/schema.json @@ -17,7 +17,6 @@ }, "set": { "description": "A list of permissions sets defined", - "default": [], "type": "array", "items": { "$ref": "#/definitions/PermissionSet" @@ -50,7 +49,7 @@ "minimum": 1.0 }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -112,7 +111,7 @@ "type": "string" }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri internal convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -132,12 +131,21 @@ }, "scope": { "description": "Allowed or denied scoped when using this permission.", - "default": {}, "allOf": [ { "$ref": "#/definitions/Scopes" } ] + }, + "platforms": { + "description": "Target platforms this permission applies. By default all platforms are affected by this permission.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Target" + } } } }, @@ -164,7 +172,7 @@ } }, "Scopes": { - "description": "A restriction of the command/endpoint functionality.\n\nIt can be of any serde serializable type and is used for allowing or preventing certain actions inside a Tauri command.\n\nThe scope is passed to the command and handled/enforced by the command itself.", + "description": "An argument for fine grained behavior control of Tauri commands.\n\nIt can be of any serde serializable type and is used to allow or prevent certain actions inside a Tauri command. The configured scope is passed to the command and will be enforced by the command implementation.\n\n## Example\n\n```json { \"allow\": [{ \"path\": \"$HOME/**\" }], \"deny\": [{ \"path\": \"$HOME/secret.txt\" }] } ```", "type": "object", "properties": { "allow": { @@ -178,7 +186,7 @@ } }, "deny": { - "description": "Data that defines what is denied by the scope.", + "description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.", "type": [ "array", "null" @@ -243,29 +251,102 @@ } ] }, - "PermissionKind": { - "type": "string", + "Target": { + "description": "Platform target.", "oneOf": [ { - "description": "allow-get-current -> Enables the get_current command without any pre-configured scope.", + "description": "MacOS.", "type": "string", "enum": [ - "allow-get-current" + "macOS" ] }, { - "description": "deny-get-current -> Denies the get_current command without any pre-configured scope.", + "description": "Windows.", "type": "string", "enum": [ - "deny-get-current" + "windows" ] }, { - "description": "default -> Allows reading the opened deep link via the get_current command", + "description": "Linux.", "type": "string", "enum": [ - "default" + "linux" ] + }, + { + "description": "Android.", + "type": "string", + "enum": [ + "android" + ] + }, + { + "description": "iOS.", + "type": "string", + "enum": [ + "iOS" + ] + } + ] + }, + "PermissionKind": { + "type": "string", + "oneOf": [ + { + "description": "Enables the get_current command without any pre-configured scope.", + "type": "string", + "const": "allow-get-current", + "markdownDescription": "Enables the get_current command without any pre-configured scope." + }, + { + "description": "Denies the get_current command without any pre-configured scope.", + "type": "string", + "const": "deny-get-current", + "markdownDescription": "Denies the get_current command without any pre-configured scope." + }, + { + "description": "Enables the is_registered command without any pre-configured scope.", + "type": "string", + "const": "allow-is-registered", + "markdownDescription": "Enables the is_registered command without any pre-configured scope." + }, + { + "description": "Denies the is_registered command without any pre-configured scope.", + "type": "string", + "const": "deny-is-registered", + "markdownDescription": "Denies the is_registered command without any pre-configured scope." + }, + { + "description": "Enables the register command without any pre-configured scope.", + "type": "string", + "const": "allow-register", + "markdownDescription": "Enables the register command without any pre-configured scope." + }, + { + "description": "Denies the register command without any pre-configured scope.", + "type": "string", + "const": "deny-register", + "markdownDescription": "Denies the register command without any pre-configured scope." + }, + { + "description": "Enables the unregister command without any pre-configured scope.", + "type": "string", + "const": "allow-unregister", + "markdownDescription": "Enables the unregister command without any pre-configured scope." + }, + { + "description": "Denies the unregister command without any pre-configured scope.", + "type": "string", + "const": "deny-unregister", + "markdownDescription": "Denies the unregister command without any pre-configured scope." + }, + { + "description": "Allows reading the opened deep link via the get_current command\n#### This default permission set includes:\n\n- `allow-get-current`", + "type": "string", + "const": "default", + "markdownDescription": "Allows reading the opened deep link via the get_current command\n#### This default permission set includes:\n\n- `allow-get-current`" } ] } diff --git a/plugins/deep-link/rollup.config.js b/plugins/deep-link/rollup.config.js index 977dfac8..1f349ec8 100644 --- a/plugins/deep-link/rollup.config.js +++ b/plugins/deep-link/rollup.config.js @@ -2,6 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { createConfig } from "../../shared/rollup.config.js"; +import { createConfig } from '../../shared/rollup.config.js' -export default createConfig(); +export default createConfig() diff --git a/plugins/deep-link/src/api-iife.js b/plugins/deep-link/src/api-iife.js deleted file mode 100644 index 6a37d748..00000000 --- a/plugins/deep-link/src/api-iife.js +++ /dev/null @@ -1 +0,0 @@ -if("__TAURI__"in window){var __TAURI_PLUGIN_DEEPLINK__=function(e){"use strict";function n(e,n=!1){return window.__TAURI_INTERNALS__.transformCallback(e,n)}async function t(e,n={},t){return window.__TAURI_INTERNALS__.invoke(e,n,t)}var r;async function _(e,r,_){const i="string"==typeof _?.target?{kind:"AnyLabel",label:_.target}:_?.target??{kind:"Any"};return t("plugin:event|listen",{event:e,target:i,handler:n(r)}).then((n=>async()=>async function(e,n){await t("plugin:event|unlisten",{event:e,eventId:n})}(e,n)))}async function i(){return await t("plugin:deep-link|get_current")}return"function"==typeof SuppressedError&&SuppressedError,function(e){e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WEBVIEW_CREATED="tauri://webview-created",e.WEBVIEW_FILE_DROP="tauri://file-drop",e.WEBVIEW_FILE_DROP_HOVER="tauri://file-drop-hover",e.WEBVIEW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled"}(r||(r={})),e.getCurrent=i,e.onOpenUrl=async function(e){const n=await i();return null!=n&&e(n),await _("deep-link://new-url",(n=>e(n.payload)))},e}({});Object.defineProperty(window.__TAURI__,"deepLink",{value:__TAURI_PLUGIN_DEEPLINK__})} diff --git a/plugins/deep-link/src/commands.rs b/plugins/deep-link/src/commands.rs index 4b228e4c..078adfb1 100644 --- a/plugins/deep-link/src/commands.rs +++ b/plugins/deep-link/src/commands.rs @@ -14,3 +14,33 @@ pub(crate) async fn get_current( ) -> Result>> { deep_link.get_current() } + +#[command] +pub(crate) async fn register( + _app: AppHandle, + _window: Window, + deep_link: State<'_, DeepLink>, + protocol: String, +) -> Result<()> { + deep_link.register(protocol) +} + +#[command] +pub(crate) async fn unregister( + _app: AppHandle, + _window: Window, + deep_link: State<'_, DeepLink>, + protocol: String, +) -> Result<()> { + deep_link.unregister(protocol) +} + +#[command] +pub(crate) async fn is_registered( + _app: AppHandle, + _window: Window, + deep_link: State<'_, DeepLink>, + protocol: String, +) -> Result { + deep_link.is_registered(protocol) +} diff --git a/plugins/deep-link/src/config.rs b/plugins/deep-link/src/config.rs index d94ed7c0..88222a24 100644 --- a/plugins/deep-link/src/config.rs +++ b/plugins/deep-link/src/config.rs @@ -4,11 +4,10 @@ // This module is also imported in build.rs! -#![allow(dead_code)] - use serde::{Deserialize, Deserializer}; +use tauri_utils::config::DeepLinkProtocol; -#[derive(Deserialize)] +#[derive(Deserialize, Clone)] pub struct AssociatedDomain { #[serde(default = "default_schemes")] pub scheme: Vec, @@ -45,7 +44,51 @@ where } } -#[derive(Deserialize)] +#[derive(Deserialize, Clone)] pub struct Config { - pub domains: Vec, + /// Mobile requires `https://` urls. + #[serde(default)] + pub mobile: Vec, + /// Desktop requires urls starting with `://`. + /// These urls are also active in dev mode on Android. + #[allow(unused)] // Used in tauri-bundler + #[serde(default)] + pub desktop: DesktopProtocol, +} + +#[derive(Deserialize, Clone)] +#[serde(untagged)] +#[allow(unused)] // Used in tauri-bundler +pub enum DesktopProtocol { + One(DeepLinkProtocol), + List(Vec), +} + +impl Default for DesktopProtocol { + fn default() -> Self { + Self::List(Vec::new()) + } +} + +impl DesktopProtocol { + #[allow(dead_code)] + pub fn contains_scheme(&self, scheme: &String) -> bool { + match self { + Self::One(protocol) => protocol.schemes.contains(scheme), + Self::List(protocols) => protocols + .iter() + .any(|protocol| protocol.schemes.contains(scheme)), + } + } + + #[allow(dead_code)] + pub fn schemes(&self) -> Vec { + match self { + Self::One(protocol) => protocol.schemes.clone(), + Self::List(protocols) => protocols + .iter() + .flat_map(|protocol| protocol.schemes.clone()) + .collect(), + } + } } diff --git a/plugins/deep-link/src/error.rs b/plugins/deep-link/src/error.rs index 339e763b..88c71e8a 100644 --- a/plugins/deep-link/src/error.rs +++ b/plugins/deep-link/src/error.rs @@ -8,8 +8,21 @@ pub type Result = std::result::Result; #[derive(Debug, thiserror::Error)] pub enum Error { + #[error("unsupported platform")] + UnsupportedPlatform, #[error(transparent)] Io(#[from] std::io::Error), + #[error(transparent)] + Tauri(#[from] tauri::Error), + #[cfg(target_os = "windows")] + #[error(transparent)] + Windows(#[from] windows_result::Error), + #[cfg(target_os = "linux")] + #[error(transparent)] + Ini(#[from] ini::Error), + #[cfg(target_os = "linux")] + #[error(transparent)] + ParseIni(#[from] ini::ParseError), #[cfg(mobile)] #[error(transparent)] PluginInvoke(#[from] tauri::plugin::mobile::PluginInvokeError), diff --git a/plugins/deep-link/src/lib.rs b/plugins/deep-link/src/lib.rs index 5fa4b907..d74864db 100644 --- a/plugins/deep-link/src/lib.rs +++ b/plugins/deep-link/src/lib.rs @@ -2,10 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -use serde::de::DeserializeOwned; use tauri::{ plugin::{Builder, PluginApi, TauriPlugin}, - AppHandle, Manager, Runtime, + AppHandle, EventId, Listener, Manager, Runtime, }; mod commands; @@ -17,28 +16,37 @@ pub use error::{Error, Result}; #[cfg(target_os = "android")] const PLUGIN_IDENTIFIER: &str = "app.tauri.deep_link"; -fn init_deep_link( +fn init_deep_link( app: &AppHandle, - _api: PluginApi, + api: PluginApi>, ) -> crate::Result> { #[cfg(target_os = "android")] { - use tauri::ipc::{Channel, InvokeBody}; + let _api = api; + + use tauri::{ + ipc::{Channel, InvokeResponseBody}, + Emitter, + }; let handle = _api.register_android_plugin(PLUGIN_IDENTIFIER, "DeepLinkPlugin")?; + #[derive(serde::Deserialize)] + struct Event { + url: String, + } + let app_handle = app.clone(); handle.run_mobile_plugin::<()>( "setEventHandler", imp::EventHandler { handler: Channel::new(move |event| { - println!("got channel event: {:?}", &event); - let url = match event { - InvokeBody::Json(payload) => payload - .get("url") - .and_then(|v| v.as_str()) - .map(|s| s.to_owned()), + InvokeResponseBody::Json(payload) => { + serde_json::from_str::(&payload) + .ok() + .map(|payload| payload.url) + } _ => None, }; @@ -49,22 +57,38 @@ fn init_deep_link( }, )?; - return Ok(DeepLink(handle)); + return Ok(DeepLink { + app: app.clone(), + plugin_handle: handle, + }); } - #[cfg(not(target_os = "android"))] - Ok(DeepLink { + #[cfg(target_os = "ios")] + return Ok(DeepLink { app: app.clone(), current: Default::default(), - }) + config: api.config().clone(), + }); + + #[cfg(desktop)] + { + let args = std::env::args(); + let deep_link = DeepLink { + app: app.clone(), + current: Default::default(), + config: api.config().clone(), + }; + deep_link.handle_cli_arguments(args); + + Ok(deep_link) + } } #[cfg(target_os = "android")] mod imp { - use tauri::{plugin::PluginHandle, Runtime}; + use tauri::{ipc::Channel, plugin::PluginHandle, AppHandle, Runtime}; use serde::{Deserialize, Serialize}; - use tauri::ipc::Channel; #[derive(Serialize)] #[serde(rename_all = "camelCase")] @@ -79,42 +103,355 @@ mod imp { } /// Access to the deep-link APIs. - pub struct DeepLink(pub(crate) PluginHandle); + pub struct DeepLink { + pub(crate) app: AppHandle, + pub(crate) plugin_handle: PluginHandle, + } impl DeepLink { - /// Get the current URLs that triggered the deep link. + /// Get the current URLs that triggered the deep link. Use this on app load to check whether your app was started via a deep link. + /// + /// ## Platform-specific: + /// + /// - **Windows / Linux**: This function reads the command line arguments and checks if there's only one value, which must be an URL with scheme matching one of the configured values. + /// Note that you must manually check the arguments when registering deep link schemes dynamically with [`Self::register`]. + /// Additionally, the deep link might have been provided as a CLI argument so you should check if its format matches what you expect. pub fn get_current(&self) -> crate::Result>> { - self.0 + self.plugin_handle .run_mobile_plugin::("getCurrent", ()) .map(|v| v.url.map(|url| vec![url])) .map_err(Into::into) } + + /// Register the app as the default handler for the specified protocol. + /// + /// - `protocol`: The name of the protocol without `://`. For example, if you want your app to handle `tauri://` links, call this method with `tauri` as the protocol. + /// + /// ## Platform-specific: + /// + /// - **macOS / Android / iOS**: Unsupported, will return [`Error::UnsupportedPlatform`](`crate::Error::UnsupportedPlatform`). + pub fn register>(&self, _protocol: S) -> crate::Result<()> { + Err(crate::Error::UnsupportedPlatform) + } + + /// Unregister the app as the default handler for the specified protocol. + /// + /// - `protocol`: The name of the protocol without `://`. + /// + /// ## Platform-specific: + /// + /// - **Linux**: Can only unregister the scheme if it was initially registered with [`register`](`Self::register`). May not work on older distros. + /// - **macOS / Android / iOS**: Unsupported, will return [`Error::UnsupportedPlatform`](`crate::Error::UnsupportedPlatform`). + pub fn unregister>(&self, _protocol: S) -> crate::Result<()> { + Err(crate::Error::UnsupportedPlatform) + } + + /// Check whether the app is the default handler for the specified protocol. + /// + /// - `protocol`: The name of the protocol without `://`. + /// + /// ## Platform-specific: + /// + /// - **macOS / Android / iOS**: Unsupported, will return [`Error::UnsupportedPlatform`](`crate::Error::UnsupportedPlatform`). + pub fn is_registered>(&self, _protocol: S) -> crate::Result { + Err(crate::Error::UnsupportedPlatform) + } } } #[cfg(not(target_os = "android"))] mod imp { use std::sync::Mutex; + #[cfg(target_os = "linux")] + use std::{ + fs::{create_dir_all, File}, + io::Write, + process::Command, + }; + #[cfg(target_os = "linux")] + use tauri::Manager; use tauri::{AppHandle, Runtime}; + #[cfg(windows)] + use windows_registry::{CLASSES_ROOT, CURRENT_USER, LOCAL_MACHINE}; /// Access to the deep-link APIs. pub struct DeepLink { - #[allow(dead_code)] pub(crate) app: AppHandle, pub(crate) current: Mutex>>, + pub(crate) config: Option, } impl DeepLink { - /// Get the current URLs that triggered the deep link. + /// Checks if the provided list of arguments (which should match [`std::env::args`]) + /// contains a deep link argument (for Linux and Windows). + /// + /// On Linux and Windows the deep links trigger a new app instance with the deep link URL as its only argument. + /// + /// This function does what it can to verify if the argument is actually a deep link, though it could also be a regular CLI argument. + /// To enhance its checks, we only match deep links against the schemes defined in the Tauri configuration + /// i.e. dynamic schemes WON'T be processed. + /// + /// This function updates the [`Self::get_current`] value and emits a `deep-link://new-url` event. + #[cfg(desktop)] + pub fn handle_cli_arguments, I: Iterator>(&self, mut args: I) { + use tauri::Emitter; + + let Some(config) = &self.config else { + return; + }; + + if cfg!(windows) || cfg!(target_os = "linux") { + args.next(); // bin name + let arg = args.next(); + + let maybe_deep_link = args.next().is_none(); // single argument + if !maybe_deep_link { + return; + } + + if let Some(url) = arg.and_then(|arg| arg.as_ref().parse::().ok()) { + if config.desktop.contains_scheme(&url.scheme().to_string()) { + let mut current = self.current.lock().unwrap(); + current.replace(vec![url.clone()]); + let _ = self.app.emit("deep-link://new-url", vec![url]); + } else if cfg!(debug_assertions) { + tracing::warn!("argument {url} does not match any configured deep link scheme; skipping it"); + } + } + } + } + + /// Get the current URLs that triggered the deep link. Use this on app load to check whether your app was started via a deep link. + /// + /// ## Platform-specific: + /// + /// - **Windows / Linux**: This function reads the command line arguments and checks if there's only one value, which must be an URL with scheme matching one of the configured values. + /// Note that you must manually check the arguments when registering deep link schemes dynamically with [`Self::register`]. + /// Additionally, the deep link might have been provided as a CLI argument so you should check if its format matches what you expect. pub fn get_current(&self) -> crate::Result>> { - Ok(self.current.lock().unwrap().clone()) + return Ok(self.current.lock().unwrap().clone()); + } + + /// Registers all schemes defined in the configuration file. + /// + /// This is useful to ensure the schemes are registered even if the user did not install the app properly + /// (e.g. an AppImage that was not properly registered with an AppImage launcher). + pub fn register_all(&self) -> crate::Result<()> { + let Some(config) = &self.config else { + return Ok(()); + }; + + for scheme in config.desktop.schemes() { + self.register(scheme)?; + } + + Ok(()) + } + + /// Register the app as the default handler for the specified protocol. + /// + /// - `protocol`: The name of the protocol without `://`. For example, if you want your app to handle `tauri://` links, call this method with `tauri` as the protocol. + /// + /// ## Platform-specific: + /// + /// - **macOS / Android / iOS**: Unsupported, will return [`Error::UnsupportedPlatform`](`crate::Error::UnsupportedPlatform`). + pub fn register>(&self, _protocol: S) -> crate::Result<()> { + #[cfg(windows)] + { + let protocol = _protocol.as_ref(); + let key_base = format!("Software\\Classes\\{protocol}"); + + let exe = dunce::simplified(&tauri::utils::platform::current_exe()?) + .display() + .to_string(); + + let key_reg = CURRENT_USER.create(&key_base)?; + key_reg.set_string("", format!("URL:{} protocol", self.app.config().identifier))?; + key_reg.set_string("URL Protocol", "")?; + + let icon_reg = CURRENT_USER.create(format!("{key_base}\\DefaultIcon"))?; + icon_reg.set_string("", format!("{exe},0"))?; + + let cmd_reg = CURRENT_USER.create(format!("{key_base}\\shell\\open\\command"))?; + + cmd_reg.set_string("", format!("\"{exe}\" \"%1\""))?; + + Ok(()) + } + + #[cfg(target_os = "linux")] + { + let bin = tauri::utils::platform::current_exe()?; + let file_name = format!( + "{}-handler.desktop", + bin.file_name().unwrap().to_string_lossy() + ); + let appimage = self.app.env().appimage; + let exec = appimage + .clone() + .unwrap_or_else(|| bin.into_os_string()) + .to_string_lossy() + .to_string(); + + let target = self.app.path().data_dir()?.join("applications"); + + create_dir_all(&target)?; + + let target_file = target.join(&file_name); + + let mime_type = format!("x-scheme-handler/{}", _protocol.as_ref()); + + if let Ok(mut desktop_file) = ini::Ini::load_from_file(&target_file) { + if let Some(section) = desktop_file.section_mut(Some("Desktop Entry")) { + let old_mimes = section.remove("MimeType"); + section.append( + "MimeType", + format!("{mime_type};{}", old_mimes.unwrap_or_default()), + ); + desktop_file.write_to_file(&target_file)?; + } + } else { + let mut file = File::create(target_file)?; + file.write_all( + format!( + include_str!("template.desktop"), + name = self + .app + .config() + .product_name + .clone() + .unwrap_or_else(|| file_name.clone()), + exec = exec, + mime_type = mime_type + ) + .as_bytes(), + )?; + } + + Command::new("update-desktop-database") + .arg(target) + .status()?; + + Command::new("xdg-mime") + .args(["default", &file_name, _protocol.as_ref()]) + .status()?; + + Ok(()) + } + + #[cfg(not(any(windows, target_os = "linux")))] + Err(crate::Error::UnsupportedPlatform) + } + + /// Unregister the app as the default handler for the specified protocol. + /// + /// - `protocol`: The name of the protocol without `://`. + /// + /// ## Platform-specific: + /// + /// - **Windows**: Requires admin rights if the protocol is registered on local machine + /// (this can happen when registered from the NSIS installer when the install mode is set to both or per machine) + /// - **Linux**: Can only unregister the scheme if it was initially registered with [`register`](`Self::register`). May not work on older distros. + /// - **macOS / Android / iOS**: Unsupported, will return [`Error::UnsupportedPlatform`](`crate::Error::UnsupportedPlatform`). + pub fn unregister>(&self, _protocol: S) -> crate::Result<()> { + #[cfg(windows)] + { + let protocol = _protocol.as_ref(); + let path = format!("Software\\Classes\\{protocol}"); + if LOCAL_MACHINE.open(&path).is_ok() { + LOCAL_MACHINE.remove_tree(&path)?; + } + if CURRENT_USER.open(&path).is_ok() { + CURRENT_USER.remove_tree(&path)?; + } + Ok(()) + } + + #[cfg(target_os = "linux")] + { + let mimeapps_path = self.app.path().config_dir()?.join("mimeapps.list"); + let mut mimeapps = ini::Ini::load_from_file(&mimeapps_path)?; + + let file_name = format!( + "{}-handler.desktop", + tauri::utils::platform::current_exe()? + .file_name() + .unwrap() + .to_string_lossy() + ); + + if let Some(section) = mimeapps.section_mut(Some("Default Applications")) { + let scheme = format!("x-scheme-handler/{}", _protocol.as_ref()); + + if section.get(&scheme).unwrap_or_default() == file_name { + section.remove(scheme); + } + } + + mimeapps.write_to_file(mimeapps_path)?; + + Ok(()) + } + + #[cfg(not(any(windows, target_os = "linux")))] + Err(crate::Error::UnsupportedPlatform) + } + + /// Check whether the app is the default handler for the specified protocol. + /// + /// - `protocol`: The name of the protocol without `://`. + /// + /// ## Platform-specific: + /// + /// - **macOS / Android / iOS**: Unsupported, will return [`Error::UnsupportedPlatform`](`crate::Error::UnsupportedPlatform`). + pub fn is_registered>(&self, _protocol: S) -> crate::Result { + #[cfg(windows)] + { + let protocol = _protocol.as_ref(); + let Ok(cmd_reg) = CLASSES_ROOT.open(format!("{protocol}\\shell\\open\\command")) + else { + return Ok(false); + }; + + let registered_cmd = cmd_reg.get_string("")?; + + let exe = dunce::simplified(&tauri::utils::platform::current_exe()?) + .display() + .to_string(); + + Ok(registered_cmd == format!("\"{exe}\" \"%1\"")) + } + #[cfg(target_os = "linux")] + { + let file_name = format!( + "{}-handler.desktop", + tauri::utils::platform::current_exe()? + .file_name() + .unwrap() + .to_string_lossy() + ); + + let output = Command::new("xdg-mime") + .args([ + "query", + "default", + &format!("x-scheme-handler/{}", _protocol.as_ref()), + ]) + .output()?; + + Ok(String::from_utf8_lossy(&output.stdout).contains(&file_name)) + } + + #[cfg(not(any(windows, target_os = "linux")))] + Err(crate::Error::UnsupportedPlatform) } } } pub use imp::DeepLink; +use url::Url; -/// Extensions to [`tauri::App`], [`tauri::AppHandle`] and [`tauri::Window`] to access the deep-link APIs. +/// Extensions to [`tauri::App`], [`tauri::AppHandle`], [`tauri::WebviewWindow`], [`tauri::Webview`] and [`tauri::Window`] to access the deep-link APIs. pub trait DeepLinkExt { fn deep_link(&self) -> &DeepLink; } @@ -125,11 +462,53 @@ impl> crate::DeepLinkExt for T { } } +/// Event that is triggered when the app was requested to open a new URL. +/// +/// Typed [`tauri::Event`]. +pub struct OpenUrlEvent { + id: EventId, + urls: Vec, +} + +impl OpenUrlEvent { + /// The event ID which can be used to stop listening to the event via [`tauri::Listener::unlisten`]. + pub fn id(&self) -> EventId { + self.id + } + + /// The event URLs. + pub fn urls(self) -> Vec { + self.urls + } +} + +impl DeepLink { + /// Helper function for the `deep-link://new-url` event to run a function each time the protocol is triggered while the app is running. + /// + /// Use `get_current` on app load to check whether your app was started via a deep link. + pub fn on_open_url(&self, f: F) -> EventId { + let event_id = self.app.listen("deep-link://new-url", move |event| { + if let Ok(urls) = serde_json::from_str(event.payload()) { + f(OpenUrlEvent { + id: event.id(), + urls, + }) + } + }); + + event_id + } +} + /// Initializes the plugin. pub fn init() -> TauriPlugin> { Builder::new("deep-link") - .js_init_script(include_str!("api-iife.js").to_string()) - .invoke_handler(tauri::generate_handler![commands::get_current]) + .invoke_handler(tauri::generate_handler![ + commands::get_current, + commands::register, + commands::unregister, + commands::is_registered + ]) .setup(|app, api| { app.manage(init_deep_link(app, api)?); Ok(()) @@ -137,6 +516,8 @@ pub fn init() -> TauriPlugin> { .on_event(|_app, _event| { #[cfg(any(target_os = "macos", target_os = "ios"))] if let tauri::RunEvent::Opened { urls } = _event { + use tauri::Emitter; + let _ = _app.emit("deep-link://new-url", urls); _app.state::>() .current diff --git a/plugins/deep-link/src/template.desktop b/plugins/deep-link/src/template.desktop new file mode 100644 index 00000000..0fb89abb --- /dev/null +++ b/plugins/deep-link/src/template.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Type=Application +Name={name} +Exec={exec} %u +Terminal=false +MimeType={mime_type} +NoDisplay=true \ No newline at end of file diff --git a/plugins/dialog/.gitignore b/plugins/dialog/.gitignore deleted file mode 100644 index 24ae1280..00000000 --- a/plugins/dialog/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.tauri diff --git a/plugins/dialog/CHANGELOG.md b/plugins/dialog/CHANGELOG.md index 39b3bbf3..3ef0db82 100644 --- a/plugins/dialog/CHANGELOG.md +++ b/plugins/dialog/CHANGELOG.md @@ -1,5 +1,202 @@ # Changelog +## \[2.2.1] + +### Dependencies + +- Upgraded to `fs-js@2.2.1` + +## \[2.2.0] + +- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other. + +### Dependencies + +- Upgraded to `fs-js@2.1.0` + +## \[2.0.2] + +### Dependencies + +- Upgraded to `fs-js@2.0.4` + +## \[2.0.4] + +- [`76f99ce9`](https://github.com/tauri-apps/plugins-workspace/commit/76f99ce999a2ff9e40235c1675e3eb6570b5e1e2) ([#2108](https://github.com/tauri-apps/plugins-workspace/pull/2108) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) The `Dialog` struct is now correctly exported, primarily to fix the documentation on `docs.rs`. + +### Dependencies + +- Upgraded to `fs@2.1.0` + +## \[2.0.3] + +### Dependencies + +- Upgraded to `fs@2.0.3` + +## \[2.0.1] + +- [`2302c2db`](https://github.com/tauri-apps/plugins-workspace/commit/2302c2db1c49673e61dcbda8cdb01b2c57e9ba6f) ([#1910](https://github.com/tauri-apps/plugins-workspace/pull/1910) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Fix `ask` and `confirm` not using system button texts +- [`aee14ed4`](https://github.com/tauri-apps/plugins-workspace/commit/aee14ed4261cdedc4ed7cc2686f01f437859a5c7) ([#1892](https://github.com/tauri-apps/plugins-workspace/pull/1892) by [@nashaofu](https://github.com/tauri-apps/plugins-workspace/../../nashaofu)) Set `save` dialog mime type from the `filters` extensions on Android. + +## \[2.0.1] + +- [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7. + +### Dependencies + +- Upgraded to `fs@2.0.1` + +## \[2.0.0] + +- [`e2c4dfb6`](https://github.com/tauri-apps/plugins-workspace/commit/e2c4dfb6af43e5dd8d9ceba232c315f5febd55c1) Update to tauri v2 stable release. + +### Dependencies + +- Upgraded to `fs@2.0.0` + +## \[2.0.0-rc.8] + +- [`6bf1bd8d`](https://github.com/tauri-apps/plugins-workspace/commit/6bf1bd8d44bb95618590aa066e638509b014e0f9) ([#1805](https://github.com/tauri-apps/plugins-workspace/pull/1805) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Update rfd to 0.15 + +### Dependencies + +- Upgraded to `fs@2.0.0-rc.6` + +### breaking + +- [`04459afb`](https://github.com/tauri-apps/plugins-workspace/commit/04459afbb67aafa5cd57e6a148c2beb0a8d3e04a) ([#1842](https://github.com/tauri-apps/plugins-workspace/pull/1842) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Changed `MessageDialogBuilder::ok_button_label` and `MessageDialogBuilder::cancel_button_label` to `MessageDialogBuilder::buttons` which takes an enum now + +## \[2.0.0-rc.7] + +### Dependencies + +- Upgraded to `fs@2.0.0-rc.5` + +## \[2.0.0-rc.6] + +- [`2b898f07`](https://github.com/tauri-apps/plugins-workspace/commit/2b898f078688c57309ca17962bf02e665c406514) ([#1769](https://github.com/tauri-apps/plugins-workspace/pull/1769) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update Tauri scopes (asset protocol) when using the `open()` command to select directories. + +### Dependencies + +- Upgraded to `fs@2.0.0-rc.4` + +## \[2.0.0-rc.5] + +- [`a2fe5551`](https://github.com/tauri-apps/plugins-workspace/commit/a2fe55512f908dd11c814ce021d164f01677572a) ([#1727](https://github.com/tauri-apps/plugins-workspace/pull/1727) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Add utility methods on `FilePath` and `SafeFilePath` enums which are: + + - `path` + - `simplified` + - `into_path` +- [`a2fe5551`](https://github.com/tauri-apps/plugins-workspace/commit/a2fe55512f908dd11c814ce021d164f01677572a) ([#1727](https://github.com/tauri-apps/plugins-workspace/pull/1727) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Implement `Serialize`, `Deserialize`, `From`, `TryFrom` and `FromStr` traits for `FilePath` and `SafeFilePath` enums. +- [`a2fe5551`](https://github.com/tauri-apps/plugins-workspace/commit/a2fe55512f908dd11c814ce021d164f01677572a) ([#1727](https://github.com/tauri-apps/plugins-workspace/pull/1727) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Mark `Error` enum as `#[non_exhuastive]`. +- [`a2fe5551`](https://github.com/tauri-apps/plugins-workspace/commit/a2fe55512f908dd11c814ce021d164f01677572a) ([#1727](https://github.com/tauri-apps/plugins-workspace/pull/1727) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Add `SafeFilePath` enum. + +### Dependencies + +- Upgraded to `fs@2.0.0-rc.3` + +## \[2.0.0-rc.4] + +### Dependencies + +- Upgraded to `fs@2.0.0-rc.2` + +### breaking + +- [`0cb99bda`](https://github.com/tauri-apps/plugins-workspace/commit/0cb99bdaf11b5a9bb66b80bdf40b085d87c3066d) ([#1706](https://github.com/tauri-apps/plugins-workspace/pull/1706) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) If no filters are specified, the file picker dialog now defaults to a file selection instead of photos. + +### feat + +- [`feb1e93f`](https://github.com/tauri-apps/plugins-workspace/commit/feb1e93fcb9a913c002daa29e3b709f24b97c664) ([#1707](https://github.com/tauri-apps/plugins-workspace/pull/1707) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Implement `save` API on iOS. + +## \[2.0.0-rc.1] + +- [`448846b8`](https://github.com/tauri-apps/plugins-workspace/commit/448846b834d23df6e7c5dc66c5dd9aa0cb01846d) ([#1658](https://github.com/tauri-apps/plugins-workspace/pull/1658) by [@mikoto2000](https://github.com/tauri-apps/plugins-workspace/../../mikoto2000)) The `open` function now returns a string representing either the file path or URI instead of an object. + To read the file data, use the `fs` APIs. +- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri 2.0.0-rc.8 + +## \[2.0.0-rc.2] + +- [`b9147758`](https://github.com/tauri-apps/plugins-workspace/commit/b914775898c2bee7ceb20bd17ee595005cd17a64) ([#1679](https://github.com/tauri-apps/plugins-workspace/pull/1679) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Explicitly set a minimum macOS version for the Swift package. + +## \[2.0.0-rc.1] + +### feat + +- [`bc7eecf4`](https://github.com/tauri-apps/plugins-workspace/commit/bc7eecf4202e7d23b987440c1cbd2da0f68c8bef) ([#1657](https://github.com/tauri-apps/plugins-workspace/pull/1657) by [@mikoto2000](https://github.com/tauri-apps/plugins-workspace/../../mikoto2000)) Implement `save` API on Android. + +### changes + +- [`6b079cfd`](https://github.com/tauri-apps/plugins-workspace/commit/6b079cfdd107c94abc2c7300f6af00bac3ff4040) ([#1649](https://github.com/tauri-apps/plugins-workspace/pull/1649) by [@ahqsoftwares](https://github.com/tauri-apps/plugins-workspace/../../ahqsoftwares)) Remove targetSdk from build.kts files as it is deprecated and will be removed from DSL v9.0 + +## \[2.0.0-rc.0] + +- [`9887d1`](https://github.com/tauri-apps/plugins-workspace/commit/9887d14bd0e971c4c0f5c1188fc4005d3fc2e29e) Update to tauri RC. + +## \[2.0.0-beta.8] + +- [`99d6ac0f`](https://github.com/tauri-apps/plugins-workspace/commit/99d6ac0f9506a6a4a1aa59c728157190a7441af6) ([#1606](https://github.com/tauri-apps/plugins-workspace/pull/1606) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) The JS packages now specify the *minimum* `@tauri-apps/api` version instead of a single exact version. +- [`6de87966`](https://github.com/tauri-apps/plugins-workspace/commit/6de87966ecc00ad9d91c25be452f1f46bd2b7e1f) ([#1597](https://github.com/tauri-apps/plugins-workspace/pull/1597) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Update to tauri beta.25. + +## \[2.0.0-beta.7] + +- [`22a17980`](https://github.com/tauri-apps/plugins-workspace/commit/22a17980ff4f6f8c40adb1b8f4ffc6dae2fe7e30) ([#1537](https://github.com/tauri-apps/plugins-workspace/pull/1537) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri beta.24. + +## \[2.0.0-beta.6] + +- [`76daee7a`](https://github.com/tauri-apps/plugins-workspace/commit/76daee7aafece34de3092c86e531cf9eb1138989) ([#1512](https://github.com/tauri-apps/plugins-workspace/pull/1512) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Update to tauri beta.23. + +## \[2.0.0-beta.5] + +- [`9013854f`](https://github.com/tauri-apps/plugins-workspace/commit/9013854f42a49a230b9dbb9d02774765528a923f)([#1382](https://github.com/tauri-apps/plugins-workspace/pull/1382)) Update to tauri beta.22. + +## \[2.0.0-beta.4] + +- [`430bd6f4`](https://github.com/tauri-apps/plugins-workspace/commit/430bd6f4f379bee5d232ae6b098ae131db7f178a)([#1363](https://github.com/tauri-apps/plugins-workspace/pull/1363)) Update to tauri beta.20. + +## \[2.0.0-beta.3] + +- [`bd1ed590`](https://github.com/tauri-apps/plugins-workspace/commit/bd1ed5903ffcce5500310dac1e59e8c67674ef1e)([#1237](https://github.com/tauri-apps/plugins-workspace/pull/1237)) Update to tauri beta.17. + +## \[2.0.0-beta.6] + +- [`326df688`](https://github.com/tauri-apps/plugins-workspace/commit/326df6883998d416fc0837583ed972854628bb52)([#1236](https://github.com/tauri-apps/plugins-workspace/pull/1236)) Fixes command argument parsing on iOS. + +### Dependencies + +- Upgraded to `fs@2.0.0-beta.6` + +## \[2.0.0-beta.5] + +- [`bb51a41`](https://github.com/tauri-apps/plugins-workspace/commit/bb51a41d67ebf989e8aedf10c4b1a7f9514d1bdf)([#1168](https://github.com/tauri-apps/plugins-workspace/pull/1168)) **Breaking Change:** All apis that return paths to the frontend will now remove the `\\?\` UNC prefix on Windows. + +### Dependencies + +- Upgraded to `fs@2.0.0-beta.5` + +## \[2.0.0-beta.4] + +- [`4cd8112`](https://github.com/tauri-apps/plugins-workspace/commit/4cd81126fdf25e1847546f8fdbd924aa4bfeabb5)([#1056](https://github.com/tauri-apps/plugins-workspace/pull/1056)) Fixed an issue where dialogs on android would return the Content URI instead of the file path + +### Dependencies + +- Upgraded to `fs@2.0.0-beta.4` + +## \[2.0.0-beta.3] + +- [`35ea595`](https://github.com/tauri-apps/plugins-workspace/commit/35ea5956d060f0bdafd140f2541c607bb811805b)([#1073](https://github.com/tauri-apps/plugins-workspace/pull/1073)) Fixed an issue where the dialog apis panicked when they were called with no application windows open. +- [`a04ea2f`](https://github.com/tauri-apps/plugins-workspace/commit/a04ea2f38294d5a3987578283badc8eec87a7752)([#1071](https://github.com/tauri-apps/plugins-workspace/pull/1071)) The global API script is now only added to the binary when the `withGlobalTauri` config is true. + +### Dependencies + +- Upgraded to `fs@2.0.0-beta.3` + +## \[2.0.0-beta.2] + +- [`aa25c91`](https://github.com/tauri-apps/plugins-workspace/commit/aa25c91bb01e957872fb2b606a3acaf2f2c4ef3a)([#978](https://github.com/tauri-apps/plugins-workspace/pull/978)) Allow configuring `canCreateDirectories` for open and save dialogs on macOS, if not configured, it will be set to `true` by default. +- [`99bea25`](https://github.com/tauri-apps/plugins-workspace/commit/99bea2559c2c0648c2519c50a18cd124dacef57b)([#1005](https://github.com/tauri-apps/plugins-workspace/pull/1005)) Update to tauri beta.8. + ## \[2.0.0-beta.1] - [`569defb`](https://github.com/tauri-apps/plugins-workspace/commit/569defbe9492e38938554bb7bdc1be9151456d21) Update to tauri beta.4. @@ -47,45 +244,3 @@ - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! d6e80b)([#545](https://github.com/tauri-apps/plugins-workspace/pull/545)) Fixes docs.rs build by enabling the `tauri/dox` feature flag. -- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11. - -### Dependencies - -- Upgraded to `fs@2.0.0-alpha.1` - -## \[2.0.0-alpha.0] - -- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - \` - -## \[2.0.0-alpha.0] - -- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - pull/371)) First v2 alpha release! - ri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - \` - -## \[2.0.0-alpha.0] - -- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - pull/371)) First v2 alpha release! - hub.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - pull/371)) First v2 alpha release! - ri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - \` - -## \[2.0.0-alpha.0] - -- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - pull/371)) First v2 alpha release! - alpha release! - pull/371)) First v2 alpha release! - ri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - \` - -## \[2.0.0-alpha.0] - -- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - pull/371)) First v2 alpha release! -kspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - pull/371)) First v2 alpha release! diff --git a/plugins/dialog/Cargo.toml b/plugins/dialog/Cargo.toml index eb40f6a1..0ee6841d 100644 --- a/plugins/dialog/Cargo.toml +++ b/plugins/dialog/Cargo.toml @@ -1,20 +1,31 @@ [package] name = "tauri-plugin-dialog" -version = "2.0.0-beta.1" +version = "2.2.1" description = "Native system dialogs for opening and saving files along with message dialogs on your Tauri application." edition = { workspace = true } authors = { workspace = true } license = { workspace = true } rust-version = { workspace = true } +repository = { workspace = true } links = "tauri-plugin-dialog" [package.metadata.docs.rs] -rustc-args = [ "--cfg", "docsrs" ] -rustdoc-args = [ "--cfg", "docsrs" ] -targets = [ "x86_64-unknown-linux-gnu", "x86_64-linux-android" ] +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs"] +targets = ["x86_64-unknown-linux-gnu", "x86_64-linux-android"] + +[package.metadata.platforms.support] +windows = { level = "full", notes = "" } +linux = { level = "full", notes = "" } +macos = { level = "full", notes = "" } +android = { level = "partial", notes = "Does not support folder picker" } +ios = { level = "partial", notes = "Does not support folder picker" } [build-dependencies] -tauri-plugin = { workspace = true, features = [ "build" ] } +tauri-plugin = { workspace = true, features = ["build"] } + +[dev-dependencies] +tauri = { workspace = true, features = ["wry"] } [dependencies] serde = { workspace = true } @@ -22,11 +33,16 @@ serde_json = { workspace = true } tauri = { workspace = true } log = { workspace = true } thiserror = { workspace = true } -tauri-plugin-fs = { path = "../fs", version = "2.0.0-beta.1" } +url = { workspace = true } +tauri-plugin-fs = { path = "../fs", version = "2.2.1" } -[target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies] -glib = "0.16" +[target.'cfg(target_os = "ios")'.dependencies] +tauri = { workspace = true, features = ["wry"] } [target."cfg(any(target_os = \"macos\", windows, target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies] -rfd = { version = "0.14", default-features = false, features = [ "tokio", "gtk3", "common-controls-v6" ] } +rfd = { version = "0.15", default-features = false, features = [ + "tokio", + "gtk3", + "common-controls-v6", +] } raw-window-handle = "0.6" diff --git a/plugins/dialog/README.md b/plugins/dialog/README.md index 0fbd529c..63d71767 100644 --- a/plugins/dialog/README.md +++ b/plugins/dialog/README.md @@ -2,9 +2,17 @@ Native system dialogs for opening and saving files along with message dialogs. +| Platform | Supported | +| -------- | --------- | +| Linux | ✓ | +| Windows | ✓ | +| macOS | ✓ | +| Android | ✓ | +| iOS | ✓ | + ## Install -_This plugin requires a Rust version of at least **1.75**_ +_This plugin requires a Rust version of at least **1.77.2**_ There are three general methods of installation that we can recommend. @@ -18,7 +26,7 @@ Install the Core plugin by adding the following to your `Cargo.toml` file: ```toml [dependencies] -tauri-plugin-dialog = "2.0.0-beta" +tauri-plugin-dialog = "2.0.0" # alternatively with Git: tauri-plugin-dialog = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` @@ -46,7 +54,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-dialog#v2 First you need to register the core plugin with Tauri: -`src-tauri/src/main.rs` +`src-tauri/src/lib.rs` ```rust fn main() { diff --git a/plugins/dialog/SECURITY.md b/plugins/dialog/SECURITY.md new file mode 100644 index 00000000..4f09bbac --- /dev/null +++ b/plugins/dialog/SECURITY.md @@ -0,0 +1,23 @@ +# Security Policy + +**Do not report security vulnerabilities through public GitHub issues.** + +**Please use the [Private Vulnerability Disclosure](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability) feature of GitHub.** + +Include as much of the following information: + +- Type of issue (e.g. improper input parsing, privilege escalation, etc.) +- The location of the affected source code (tag/branch/commit or direct URL) +- Any special configuration required to reproduce the issue +- The distribution affected or used to help us with reproduction of the issue +- Step-by-step instructions to reproduce the issue +- Ideally a reproduction repository +- Impact of the issue, including how an attacker might exploit the issue + +We prefer to receive reports in English. + +## Contact + +Please disclose a vulnerability or security relevant issue here: [https://github.com/tauri-apps/plugins-workspace/security/advisories/new](https://github.com/tauri-apps/plugins-workspace/security/advisories/new). + +Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app). diff --git a/plugins/dialog/android/build.gradle.kts b/plugins/dialog/android/build.gradle.kts index a205eab1..e824cff9 100644 --- a/plugins/dialog/android/build.gradle.kts +++ b/plugins/dialog/android/build.gradle.kts @@ -5,11 +5,10 @@ plugins { android { namespace = "app.tauri.dialog" - compileSdk = 32 + compileSdk = 34 defaultConfig { - minSdk = 24 - targetSdk = 32 + minSdk = 24 testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles("consumer-rules.pro") diff --git a/plugins/dialog/android/src/main/java/DialogPlugin.kt b/plugins/dialog/android/src/main/java/DialogPlugin.kt index 462e22bb..af0467d8 100644 --- a/plugins/dialog/android/src/main/java/DialogPlugin.kt +++ b/plugins/dialog/android/src/main/java/DialogPlugin.kt @@ -10,6 +10,7 @@ import android.content.Intent import android.net.Uri import android.os.Handler import android.os.Looper +import android.webkit.MimeTypeMap import androidx.activity.result.ActivityResult import app.tauri.Logger import app.tauri.annotation.ActivityCallback @@ -30,7 +31,6 @@ class Filter { class FilePickerOptions { lateinit var filters: Array var multiple: Boolean? = null - var readData: Boolean? = null } @InvokeArg @@ -41,6 +41,12 @@ class MessageOptions { var cancelButtonLabel: String? = null } +@InvokeArg +class SaveFileDialogOptions { + var fileName: String? = null + lateinit var filters: Array +} + @TauriPlugin class DialogPlugin(private val activity: Activity): Plugin(activity) { var filePickerOptions: FilePickerOptions? = null @@ -53,20 +59,7 @@ class DialogPlugin(private val activity: Activity): Plugin(activity) { val intent = if (parsedTypes.isNotEmpty()) { val intent = Intent(Intent.ACTION_PICK) - intent.putExtra(Intent.EXTRA_MIME_TYPES, parsedTypes) - - var uniqueMimeType = true - var mimeKind: String? = null - for (mime in parsedTypes) { - val kind = mime.split("/")[0] - if (mimeKind == null) { - mimeKind = kind - } else if (mimeKind != kind) { - uniqueMimeType = false - } - } - - intent.type = if (uniqueMimeType) Intent.normalizeMimeType("$mimeKind/*") else "*/*" + setIntentMimeTypes(intent, parsedTypes) intent } else { val intent = Intent(Intent.ACTION_GET_CONTENT) @@ -90,7 +83,7 @@ class DialogPlugin(private val activity: Activity): Plugin(activity) { try { when (result.resultCode) { Activity.RESULT_OK -> { - val callResult = createPickFilesResult(result.data, filePickerOptions?.readData ?: false) + val callResult = createPickFilesResult(result.data) invoke.resolve(callResult) } Activity.RESULT_CANCELED -> invoke.reject("File picker cancelled") @@ -103,61 +96,69 @@ class DialogPlugin(private val activity: Activity): Plugin(activity) { } } - private fun createPickFilesResult(data: Intent?, readData: Boolean): JSObject { + private fun createPickFilesResult(data: Intent?): JSObject { val callResult = JSObject() - val filesResultList: MutableList = ArrayList() if (data == null) { - callResult.put("files", JSArray.from(filesResultList)) + callResult.put("files", null) return callResult } - val uris: MutableList = ArrayList() + val uris: MutableList = ArrayList() if (data.clipData == null) { val uri: Uri? = data.data - uris.add(uri) + uris.add(uri?.toString()) } else { for (i in 0 until data.clipData!!.itemCount) { val uri: Uri = data.clipData!!.getItemAt(i).uri - uris.add(uri) + uris.add(uri.toString()) } } - for (i in uris.indices) { - val uri = uris[i] ?: continue - val fileResult = JSObject() - if (readData) { - fileResult.put("base64Data", FilePickerUtils.getDataFromUri(activity, uri)) - } - val duration = FilePickerUtils.getDurationFromUri(activity, uri) - if (duration != null) { - fileResult.put("duration", duration) - } - val resolution = FilePickerUtils.getHeightAndWidthFromUri(activity, uri) - if (resolution != null) { - fileResult.put("height", resolution.height) - fileResult.put("width", resolution.width) - } - fileResult.put("mimeType", FilePickerUtils.getMimeTypeFromUri(activity, uri)) - val modifiedAt = FilePickerUtils.getModifiedAtFromUri(activity, uri) - if (modifiedAt != null) { - fileResult.put("modifiedAt", modifiedAt) - } - fileResult.put("name", FilePickerUtils.getNameFromUri(activity, uri)) - fileResult.put("path", FilePickerUtils.getPathFromUri(uri)) - fileResult.put("size", FilePickerUtils.getSizeFromUri(activity, uri)) - filesResultList.add(fileResult) - } - callResult.put("files", JSArray.from(filesResultList.toTypedArray())) + callResult.put("files", JSArray.from(uris.toTypedArray())) return callResult } private fun parseFiltersOption(filters: Array): Array { val mimeTypes = mutableListOf() for (filter in filters) { - for (mime in filter.extensions) { - mimeTypes.add(if (mime == "text/csv") "text/comma-separated-values" else mime) + for (ext in filter.extensions) { + if (ext.contains('/')) { + mimeTypes.add(if (ext == "text/csv") "text/comma-separated-values" else ext) + } else { + MimeTypeMap.getSingleton().getMimeTypeFromExtension(ext)?.let { + mimeTypes.add(it) + } + } } } return mimeTypes.toTypedArray() } + + private fun setIntentMimeTypes(intent: Intent, mimeTypes: Array) { + if (mimeTypes.isNotEmpty()) { + var uniqueMimeKind = true + var mimeKind: String? = null + for (mime in mimeTypes) { + val kind = mime.split("/")[0] + if (mimeKind == null) { + mimeKind = kind + } else if (mimeKind != kind) { + uniqueMimeKind = false + } + } + + if (uniqueMimeKind) { + if (mimeTypes.size > 1) { + intent.putExtra(Intent.EXTRA_MIME_TYPES, mimeTypes) + intent.type = Intent.normalizeMimeType("$mimeKind/*") + } else { + intent.type = mimeTypes[0] + } + } else { + intent.type = "*/*" + } + } else { + intent.type = "*/*" + } + } @Command fun showMessageDialog(invoke: Invoke) { @@ -204,4 +205,48 @@ class DialogPlugin(private val activity: Activity): Plugin(activity) { dialog.show() } } + + @Command + fun saveFileDialog(invoke: Invoke) { + try { + val args = invoke.parseArgs(SaveFileDialogOptions::class.java) + val parsedTypes = parseFiltersOption(args.filters) + + val intent = Intent(Intent.ACTION_CREATE_DOCUMENT) + setIntentMimeTypes(intent, parsedTypes) + + intent.addCategory(Intent.CATEGORY_OPENABLE) + intent.putExtra(Intent.EXTRA_TITLE, args.fileName ?: "") + startActivityForResult(invoke, intent, "saveFileDialogResult") + } catch (ex: Exception) { + val message = ex.message ?: "Failed to pick save file" + Logger.error(message) + invoke.reject(message) + } + } + + @ActivityCallback + fun saveFileDialogResult(invoke: Invoke, result: ActivityResult) { + try { + when (result.resultCode) { + Activity.RESULT_OK -> { + val callResult = JSObject() + val intent: Intent? = result.data + if (intent != null) { + val uri = intent.data + if (uri != null) { + callResult.put("file", uri.toString()) + } + } + invoke.resolve(callResult) + } + Activity.RESULT_CANCELED -> invoke.reject("File picker cancelled") + else -> invoke.reject("Failed to pick files") + } + } catch (ex: java.lang.Exception) { + val message = ex.message ?: "Failed to read file pick result" + Logger.error(message) + invoke.reject(message) + } + } } \ No newline at end of file diff --git a/plugins/dialog/android/src/main/java/FilePickerUtils.kt b/plugins/dialog/android/src/main/java/FilePickerUtils.kt index 5f0854a1..7029d4c6 100644 --- a/plugins/dialog/android/src/main/java/FilePickerUtils.kt +++ b/plugins/dialog/android/src/main/java/FilePickerUtils.kt @@ -4,10 +4,15 @@ package app.tauri.dialog + +import android.content.ContentUris +import android.database.Cursor +import android.provider.MediaStore import android.content.Context import android.graphics.BitmapFactory import android.media.MediaMetadataRetriever import android.net.Uri +import android.os.Environment import android.provider.DocumentsContract import android.provider.OpenableColumns import android.util.Base64 @@ -21,8 +26,40 @@ class FilePickerUtils { class FileResolution(var height: Int, var width: Int) companion object { - fun getPathFromUri(uri: Uri): String { - return uri.toString() + fun getPathFromUri(context: Context, uri: Uri): String? { + if (DocumentsContract.isDocumentUri(context, uri)) { + if (isExternalStorageDocument(uri)) { + val docId = DocumentsContract.getDocumentId(uri) + val split = docId.split(":") + return if ("primary".equals(split[0], ignoreCase = true)) { + "${Environment.getExternalStorageDirectory()}/${split[1]}" + } else { + null + } + } else if (isDownloadsDocument(uri)) { + val id = DocumentsContract.getDocumentId(uri) + val contentUri = ContentUris.withAppendedId( + Uri.parse("content://downloads/public_downloads"), java.lang.Long.valueOf(id)) + return getDataColumn(context, contentUri, null, null) + } else if (isMediaDocument(uri)) { + val docId = DocumentsContract.getDocumentId(uri) + val split = docId.split(":") + val contentUri: Uri? = when (split[0]) { + "image" -> MediaStore.Images.Media.EXTERNAL_CONTENT_URI + "video" -> MediaStore.Video.Media.EXTERNAL_CONTENT_URI + "audio" -> MediaStore.Audio.Media.EXTERNAL_CONTENT_URI + else -> null + } + val selection = "_id=?" + val selectionArgs = arrayOf(split[1]) + return getDataColumn(context, contentUri, selection, selectionArgs) + } + } else if ("content".equals(uri.scheme, ignoreCase = true)) { + return getDataColumn(context, uri, null, null) + } else if ("file".equals(uri.scheme, ignoreCase = true)) { + return uri.path + } + return null } fun getNameFromUri(context: Context, uri: Uri): String? { @@ -36,7 +73,7 @@ class FilePickerUtils { displayName = cursor.getString(columnIdx) cursor.close() } - if (displayName == null || displayName.isEmpty()) { + if (displayName.isNullOrEmpty()) { displayName = uri.lastPathSegment } return displayName @@ -162,4 +199,32 @@ class FilePickerUtils { return os.toByteArray() } } -} \ No newline at end of file +} + +private fun getDataColumn(context: Context, uri: Uri?, selection: String?, selectionArgs: Array?): String? { + var cursor: Cursor? = null + val column = "_data" + val projection = arrayOf(column) + try { + cursor = context.contentResolver.query(uri!!, projection, selection, selectionArgs, null) + if (cursor != null && cursor.moveToFirst()) { + val columnIndex = cursor.getColumnIndexOrThrow(column) + return cursor.getString(columnIndex) + } + } finally { + cursor?.close() + } + return null +} + +private fun isExternalStorageDocument(uri: Uri): Boolean { + return "com.android.externalstorage.documents" == uri.authority +} + +private fun isDownloadsDocument(uri: Uri): Boolean { + return "com.android.providers.downloads.documents" == uri.authority +} + +private fun isMediaDocument(uri: Uri): Boolean { + return "com.android.providers.media.documents" == uri.authority +} diff --git a/plugins/dialog/api-iife.js b/plugins/dialog/api-iife.js new file mode 100644 index 00000000..c2e0870c --- /dev/null +++ b/plugins/dialog/api-iife.js @@ -0,0 +1 @@ +if("__TAURI__"in window){var __TAURI_PLUGIN_DIALOG__=function(t){"use strict";async function n(t,n={},e){return window.__TAURI_INTERNALS__.invoke(t,n,e)}return"function"==typeof SuppressedError&&SuppressedError,t.ask=async function(t,e){const i="string"==typeof e?{title:e}:e;return await n("plugin:dialog|ask",{message:t.toString(),title:i?.title?.toString(),kind:i?.kind,yesButtonLabel:i?.okLabel?.toString(),noButtonLabel:i?.cancelLabel?.toString()})},t.confirm=async function(t,e){const i="string"==typeof e?{title:e}:e;return await n("plugin:dialog|confirm",{message:t.toString(),title:i?.title?.toString(),kind:i?.kind,okButtonLabel:i?.okLabel?.toString(),cancelButtonLabel:i?.cancelLabel?.toString()})},t.message=async function(t,e){const i="string"==typeof e?{title:e}:e;await n("plugin:dialog|message",{message:t.toString(),title:i?.title?.toString(),kind:i?.kind,okButtonLabel:i?.okLabel?.toString()})},t.open=async function(t={}){return"object"==typeof t&&Object.freeze(t),await n("plugin:dialog|open",{options:t})},t.save=async function(t={}){return"object"==typeof t&&Object.freeze(t),await n("plugin:dialog|save",{options:t})},t}({});Object.defineProperty(window.__TAURI__,"dialog",{value:__TAURI_PLUGIN_DIALOG__})} diff --git a/plugins/dialog/build.rs b/plugins/dialog/build.rs index d692f66d..4b3bb871 100644 --- a/plugins/dialog/build.rs +++ b/plugins/dialog/build.rs @@ -5,15 +5,14 @@ const COMMANDS: &[&str] = &["open", "save", "message", "ask", "confirm"]; fn main() { - if let Err(error) = tauri_plugin::Builder::new(COMMANDS) + let result = tauri_plugin::Builder::new(COMMANDS) + .global_api_script_path("./api-iife.js") .android_path("android") .ios_path("ios") - .try_build() - { - println!("{error:#}"); - // when building documentation for Android the plugin build result is irrelevant to the crate itself - if !(cfg!(docsrs) && std::env::var("TARGET").unwrap().contains("android")) { - std::process::exit(1); - } + .try_build(); + + // when building documentation for Android the plugin build result is always Err() and is irrelevant to the crate documentation build + if !(cfg!(docsrs) && std::env::var("TARGET").unwrap().contains("android")) { + result.unwrap(); } } diff --git a/plugins/dialog/guest-js/index.ts b/plugins/dialog/guest-js/index.ts index 5aa440a6..150be95a 100644 --- a/plugins/dialog/guest-js/index.ts +++ b/plugins/dialog/guest-js/index.ts @@ -2,19 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { invoke } from "@tauri-apps/api/core"; - -interface FileResponse { - base64Data?: string; - duration?: number; - height?: number; - width?: number; - mimeType?: string; - modifiedAt?: number; - name?: string; - path: string; - size: number; -} +import { invoke } from '@tauri-apps/api/core' /** * Extension filters for the file dialog. @@ -23,7 +11,7 @@ interface FileResponse { */ interface DialogFilter { /** Filter name. */ - name: string; + name: string /** * Extensions to filter, without a `.` prefix. * @example @@ -31,7 +19,7 @@ interface DialogFilter { * extensions: ['svg', 'png'] * ``` */ - extensions: string[]; + extensions: string[] } /** @@ -40,23 +28,30 @@ interface DialogFilter { * @since 2.0.0 */ interface OpenDialogOptions { - /** The title of the dialog window. */ - title?: string; + /** The title of the dialog window (desktop only). */ + title?: string /** The filters of the dialog. */ - filters?: DialogFilter[]; - /** Initial directory or file path. */ - defaultPath?: string; + filters?: DialogFilter[] + /** + * Initial directory or file path. + * If it's a directory path, the dialog interface will change to that folder. + * If it's not an existing directory, the file name will be set to the dialog's file name input and the dialog will be set to the parent folder. + * + * On mobile the file name is always used on the dialog's file name input. + * If not provided, Android uses `(invalid).txt` as default file name. + */ + defaultPath?: string /** Whether the dialog allows multiple selection or not. */ - multiple?: boolean; + multiple?: boolean /** Whether the dialog is a directory selection or not. */ - directory?: boolean; + directory?: boolean /** * If `directory` is true, indicates that it will be read recursively later. * Defines whether subdirectories will be allowed on the scope or not. */ - recursive?: boolean; + recursive?: boolean /** Whether to allow creating directories in the dialog. Enabled by default. **macOS Only** */ - canCreateDirectories?: boolean; + canCreateDirectories?: boolean } /** @@ -65,18 +60,21 @@ interface OpenDialogOptions { * @since 2.0.0 */ interface SaveDialogOptions { - /** The title of the dialog window. */ - title?: string; + /** The title of the dialog window (desktop only). */ + title?: string /** The filters of the dialog. */ - filters?: DialogFilter[]; + filters?: DialogFilter[] /** * Initial directory or file path. * If it's a directory path, the dialog interface will change to that folder. * If it's not an existing directory, the file name will be set to the dialog's file name input and the dialog will be set to the parent folder. + * + * On mobile the file name is always used on the dialog's file name input. + * If not provided, Android uses `(invalid).txt` as default file name. */ - defaultPath?: string; + defaultPath?: string /** Whether to allow creating directories in the dialog. Enabled by default. **macOS Only** */ - canCreateDirectories?: boolean; + canCreateDirectories?: boolean } /** @@ -84,31 +82,31 @@ interface SaveDialogOptions { */ interface MessageDialogOptions { /** The title of the dialog. Defaults to the app name. */ - title?: string; + title?: string /** The kind of the dialog. Defaults to `info`. */ - kind?: "info" | "warning" | "error"; + kind?: 'info' | 'warning' | 'error' /** The label of the confirm button. */ - okLabel?: string; + okLabel?: string } interface ConfirmDialogOptions { /** The title of the dialog. Defaults to the app name. */ - title?: string; + title?: string /** The kind of the dialog. Defaults to `info`. */ - kind?: "info" | "warning" | "error"; + kind?: 'info' | 'warning' | 'error' /** The label of the confirm button. */ - okLabel?: string; + okLabel?: string /** The label of the cancel button. */ - cancelLabel?: string; + cancelLabel?: string } -type OpenDialogReturn = T["directory"] extends true - ? T["multiple"] extends true +type OpenDialogReturn = T['directory'] extends true + ? T['multiple'] extends true + ? string[] | null + : string | null + : T['multiple'] extends true ? string[] | null : string | null - : T["multiple"] extends true - ? FileResponse[] | null - : FileResponse | null; /** * Open a file/directory selection dialog. @@ -163,13 +161,13 @@ type OpenDialogReturn = T["directory"] extends true * @since 2.0.0 */ async function open( - options: T = {} as T, + options: T = {} as T ): Promise> { - if (typeof options === "object") { - Object.freeze(options); + if (typeof options === 'object') { + Object.freeze(options) } - return invoke("plugin:dialog|open", { options }); + return await invoke('plugin:dialog|open', { options }) } /** @@ -197,11 +195,11 @@ async function open( * @since 2.0.0 */ async function save(options: SaveDialogOptions = {}): Promise { - if (typeof options === "object") { - Object.freeze(options); + if (typeof options === 'object') { + Object.freeze(options) } - return invoke("plugin:dialog|save", { options }); + return await invoke('plugin:dialog|save', { options }) } /** @@ -223,15 +221,15 @@ async function save(options: SaveDialogOptions = {}): Promise { */ async function message( message: string, - options?: string | MessageDialogOptions, + options?: string | MessageDialogOptions ): Promise { - const opts = typeof options === "string" ? { title: options } : options; - return invoke("plugin:dialog|message", { + const opts = typeof options === 'string' ? { title: options } : options + await invoke('plugin:dialog|message', { message: message.toString(), title: opts?.title?.toString(), kind: opts?.kind, - okButtonLabel: opts?.okLabel?.toString(), - }); + okButtonLabel: opts?.okLabel?.toString() + }) } /** @@ -252,16 +250,16 @@ async function message( */ async function ask( message: string, - options?: string | ConfirmDialogOptions, + options?: string | ConfirmDialogOptions ): Promise { - const opts = typeof options === "string" ? { title: options } : options; - return invoke("plugin:dialog|ask", { + const opts = typeof options === 'string' ? { title: options } : options + return await invoke('plugin:dialog|ask', { message: message.toString(), title: opts?.title?.toString(), kind: opts?.kind, - okButtonLabel: opts?.okLabel?.toString() ?? "Yes", - cancelButtonLabel: opts?.cancelLabel?.toString() ?? "No", - }); + yesButtonLabel: opts?.okLabel?.toString(), + noButtonLabel: opts?.cancelLabel?.toString() + }) } /** @@ -282,26 +280,25 @@ async function ask( */ async function confirm( message: string, - options?: string | ConfirmDialogOptions, + options?: string | ConfirmDialogOptions ): Promise { - const opts = typeof options === "string" ? { title: options } : options; - return invoke("plugin:dialog|confirm", { + const opts = typeof options === 'string' ? { title: options } : options + return await invoke('plugin:dialog|confirm', { message: message.toString(), title: opts?.title?.toString(), kind: opts?.kind, - okButtonLabel: opts?.okLabel?.toString() ?? "Ok", - cancelButtonLabel: opts?.cancelLabel?.toString() ?? "Cancel", - }); + okButtonLabel: opts?.okLabel?.toString(), + cancelButtonLabel: opts?.cancelLabel?.toString() + }) } export type { DialogFilter, - FileResponse, OpenDialogOptions, OpenDialogReturn, SaveDialogOptions, MessageDialogOptions, - ConfirmDialogOptions, -}; + ConfirmDialogOptions +} -export { open, save, message, ask, confirm }; +export { open, save, message, ask, confirm } diff --git a/plugins/dialog/guest-js/init.ts b/plugins/dialog/guest-js/init.ts index 35ac29c0..520a469a 100644 --- a/plugins/dialog/guest-js/init.ts +++ b/plugins/dialog/guest-js/init.ts @@ -2,17 +2,17 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { invoke } from "@tauri-apps/api/core"; +import { invoke } from '@tauri-apps/api/core' window.alert = function (message: string) { - invoke("plugin:dialog|message", { - message: message.toString(), - }); -}; + void invoke('plugin:dialog|message', { + message: message.toString() + }) +} // @ts-expect-error tauri does not have sync IPC :( -window.confirm = function (message: string) { - return invoke("plugin:dialog|confirm", { - message: message.toString(), - }); -}; +window.confirm = async function (message: string) { + return await invoke('plugin:dialog|confirm', { + message: message.toString() + }) +} diff --git a/plugins/dialog/ios/Package.swift b/plugins/dialog/ios/Package.swift index 45a58a43..f8983f14 100644 --- a/plugins/dialog/ios/Package.swift +++ b/plugins/dialog/ios/Package.swift @@ -6,28 +6,29 @@ import PackageDescription let package = Package( - name: "tauri-plugin-dialog", - platforms: [ - .iOS(.v13), - ], - products: [ - // Products define the executables and libraries a package produces, and make them visible to other packages. - .library( - name: "tauri-plugin-dialog", - type: .static, - targets: ["tauri-plugin-dialog"]), - ], - dependencies: [ - .package(name: "Tauri", path: "../.tauri/tauri-api") - ], - targets: [ - // Targets are the basic building blocks of a package. A target can define a module or a test suite. - // Targets can depend on other targets in this package, and on products in packages this package depends on. - .target( - name: "tauri-plugin-dialog", - dependencies: [ - .byName(name: "Tauri") - ], - path: "Sources") - ] + name: "tauri-plugin-dialog", + platforms: [ + .macOS(.v10_13), + .iOS(.v13), + ], + products: [ + // Products define the executables and libraries a package produces, and make them visible to other packages. + .library( + name: "tauri-plugin-dialog", + type: .static, + targets: ["tauri-plugin-dialog"]) + ], + dependencies: [ + .package(name: "Tauri", path: "../.tauri/tauri-api") + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages this package depends on. + .target( + name: "tauri-plugin-dialog", + dependencies: [ + .byName(name: "Tauri") + ], + path: "Sources") + ] ) diff --git a/plugins/dialog/ios/Sources/DialogPlugin.swift b/plugins/dialog/ios/Sources/DialogPlugin.swift index 40f51571..b3f7e7da 100644 --- a/plugins/dialog/ios/Sources/DialogPlugin.swift +++ b/plugins/dialog/ios/Sources/DialogPlugin.swift @@ -17,27 +17,31 @@ enum FilePickerEvent { } struct MessageDialogOptions: Decodable { - let title: String? + var title: String? let message: String - var okButtonLabel = "OK" - var cancelButtonLabel = "Cancel" + var okButtonLabel: String? + var cancelButtonLabel: String? } struct Filter: Decodable { - var extensions: [String] = [] + var extensions: [String]? } struct FilePickerOptions: Decodable { - var multiple = false - var readData = false - var filters: [Filter] = [] + var multiple: Bool? + var filters: [Filter]? + var defaultPath: String? +} + +struct SaveFileDialogOptions: Decodable { + var fileName: String? + var defaultPath: String? } class DialogPlugin: Plugin { var filePickerController: FilePickerController! - var pendingInvoke: Invoke? = nil - var pendingInvokeArgs: FilePickerOptions? = nil + var onFilePickerResult: ((FilePickerEvent) -> Void)? = nil override init() { super.init() @@ -47,9 +51,9 @@ class DialogPlugin: Plugin { @objc public func showFilePicker(_ invoke: Invoke) throws { let args = try invoke.parseArgs(FilePickerOptions.self) - let parsedTypes = parseFiltersOption(args.filters) + let parsedTypes = parseFiltersOption(args.filters ?? []) - var isMedia = true + var isMedia = !parsedTypes.isEmpty var uniqueMimeType: Bool? = nil var mimeKind: String? = nil if !parsedTypes.isEmpty { @@ -67,14 +71,22 @@ class DialogPlugin: Plugin { } } - pendingInvoke = invoke - pendingInvokeArgs = args + onFilePickerResult = { (event: FilePickerEvent) -> Void in + switch event { + case .selected(let urls): + invoke.resolve(["files": urls]) + case .cancelled: + invoke.resolve(["files": nil]) + case .error(let error): + invoke.reject(error) + } + } if uniqueMimeType == true || isMedia { DispatchQueue.main.async { if #available(iOS 14, *) { var configuration = PHPickerConfiguration(photoLibrary: PHPhotoLibrary.shared()) - configuration.selectionLimit = args.multiple ? 0 : 1 + configuration.selectionLimit = (args.multiple ?? false) ? 0 : 1 if uniqueMimeType == true { if mimeKind == "image" { @@ -105,14 +117,57 @@ class DialogPlugin: Plugin { let documentTypes = parsedTypes.isEmpty ? ["public.data"] : parsedTypes DispatchQueue.main.async { let picker = UIDocumentPickerViewController(documentTypes: documentTypes, in: .import) + if let defaultPath = args.defaultPath { + picker.directoryURL = URL(string: defaultPath) + } picker.delegate = self.filePickerController - picker.allowsMultipleSelection = args.multiple + picker.allowsMultipleSelection = args.multiple ?? false picker.modalPresentationStyle = .fullScreen self.presentViewController(picker) } } } + @objc public func saveFileDialog(_ invoke: Invoke) throws { + let args = try invoke.parseArgs(SaveFileDialogOptions.self) + + // The Tauri save dialog API prompts the user to select a path where a file must be saved + // This behavior maps to the operating system interfaces on all platforms except iOS, + // which only exposes a mechanism to "move file `srcPath` to a location defined by the user" + // + // so we have to work around it by creating an empty file matching the requested `args.fileName`, + // and using it as `srcPath` for the operation - returning the path the user selected + // so the app dev can write to it later - matching cross platform behavior as mentioned above + let fileManager = FileManager.default + let srcFolder = fileManager.urls(for: .documentDirectory, in: .userDomainMask).first! + let srcPath = srcFolder.appendingPathComponent(args.fileName ?? "file") + if !fileManager.fileExists(atPath: srcPath.path) { + // the file contents must be actually provided by the tauri dev after the path is resolved by the save API + try "".write(to: srcPath, atomically: true, encoding: .utf8) + } + + onFilePickerResult = { (event: FilePickerEvent) -> Void in + switch event { + case .selected(let urls): + invoke.resolve(["file": urls.first!]) + case .cancelled: + invoke.resolve(["file": nil]) + case .error(let error): + invoke.reject(error) + } + } + + DispatchQueue.main.async { + let picker = UIDocumentPickerViewController(url: srcPath, in: .exportToService) + if let defaultPath = args.defaultPath { + picker.directoryURL = URL(string: defaultPath) + } + picker.delegate = self.filePickerController + picker.modalPresentationStyle = .fullScreen + self.presentViewController(picker) + } + } + private func presentViewController(_ viewControllerToPresent: UIViewController) { self.manager.viewController?.present(viewControllerToPresent, animated: true, completion: nil) } @@ -120,7 +175,7 @@ class DialogPlugin: Plugin { private func parseFiltersOption(_ filters: [Filter]) -> [String] { var parsedTypes: [String] = [] for filter in filters { - for ext in filter.extensions { + for ext in filter.extensions ?? [] { guard let utType: String = UTTypeCreatePreferredIdentifierForTag( kUTTagClassMIMEType, ext as CFString, nil)?.takeRetainedValue() as String? @@ -134,60 +189,7 @@ class DialogPlugin: Plugin { } public func onFilePickerEvent(_ event: FilePickerEvent) { - switch event { - case .selected(let urls): - let readData = pendingInvokeArgs?.readData ?? false - do { - let filesResult = try urls.map { (url: URL) -> JSObject in - var file = JSObject() - - let mimeType = filePickerController.getMimeTypeFromUrl(url) - let isVideo = mimeType.hasPrefix("video") - let isImage = mimeType.hasPrefix("image") - - if readData { - file["data"] = try Data(contentsOf: url).base64EncodedString() - } - - if isVideo { - file["duration"] = filePickerController.getVideoDuration(url) - let (height, width) = filePickerController.getVideoDimensions(url) - if let height = height { - file["height"] = height - } - if let width = width { - file["width"] = width - } - } else if isImage { - let (height, width) = filePickerController.getImageDimensions(url) - if let height = height { - file["height"] = height - } - if let width = width { - file["width"] = width - } - } - - file["modifiedAt"] = filePickerController.getModifiedAtFromUrl(url) - file["mimeType"] = mimeType - file["name"] = url.lastPathComponent - file["path"] = url.absoluteString - file["size"] = try filePickerController.getSizeFromUrl(url) - return file - } - pendingInvoke?.resolve(["files": filesResult]) - } catch let error as NSError { - pendingInvoke?.reject(error.localizedDescription, error: error) - return - } - - pendingInvoke?.resolve(["files": urls]) - case .cancelled: - let files: JSArray = [] - pendingInvoke?.resolve(["files": files]) - case .error(let error): - pendingInvoke?.reject(error) - } + self.onFilePickerResult?(event) } @objc public func showMessageDialog(_ invoke: Invoke) throws { @@ -197,24 +199,36 @@ class DialogPlugin: Plugin { DispatchQueue.main.async { [] in let alert = UIAlertController( title: args.title, message: args.message, preferredStyle: UIAlertController.Style.alert) - alert.addAction( - UIAlertAction( - title: args.cancelButtonLabel, style: UIAlertAction.Style.default, - handler: { (_) -> Void in - invoke.resolve([ - "value": false, - "cancelled": false, - ]) - })) - alert.addAction( - UIAlertAction( - title: args.okButtonLabel, style: UIAlertAction.Style.default, - handler: { (_) -> Void in - invoke.resolve([ - "value": true, - "cancelled": false, - ]) - })) + + let cancelButtonLabel = args.cancelButtonLabel ?? "" + if !cancelButtonLabel.isEmpty { + alert.addAction( + UIAlertAction( + title: cancelButtonLabel, style: UIAlertAction.Style.default, + handler: { (_) -> Void in + Logger.error("cancel") + + invoke.resolve([ + "value": false, + "cancelled": false, + ]) + })) + } + + let okButtonLabel = args.okButtonLabel ?? (cancelButtonLabel.isEmpty ? "OK" : "") + if !okButtonLabel.isEmpty { + alert.addAction( + UIAlertAction( + title: okButtonLabel, style: UIAlertAction.Style.default, + handler: { (_) -> Void in + Logger.error("ok") + + invoke.resolve([ + "value": true, + "cancelled": false, + ]) + })) + } manager.viewController?.present(alert, animated: true, completion: nil) } diff --git a/plugins/dialog/package.json b/plugins/dialog/package.json index 76ec3b1e..31ecdc3e 100644 --- a/plugins/dialog/package.json +++ b/plugins/dialog/package.json @@ -1,10 +1,11 @@ { "name": "@tauri-apps/plugin-dialog", - "version": "2.0.0-beta.1", - "license": "MIT or APACHE-2.0", + "version": "2.2.1", + "license": "MIT OR Apache-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" ], + "repository": "https://github.com/tauri-apps/plugins-workspace", "type": "module", "types": "./dist-js/index.d.ts", "main": "./dist-js/index.cjs", @@ -23,6 +24,6 @@ "LICENSE" ], "dependencies": { - "@tauri-apps/api": "2.0.0-beta.2" + "@tauri-apps/api": "^2.0.0" } } diff --git a/plugins/dialog/permissions/autogenerated/reference.md b/plugins/dialog/permissions/autogenerated/reference.md index 9c000f9e..246c7733 100644 --- a/plugins/dialog/permissions/autogenerated/reference.md +++ b/plugins/dialog/permissions/autogenerated/reference.md @@ -1,42 +1,159 @@ -# Permissions +## Default Permission -## allow-ask +This permission set configures the types of dialogs +available from the dialog plugin. + +#### Granted Permissions + +All dialog types are enabled. + + + + +#### This default permission set includes the following: + +- `allow-ask` +- `allow-confirm` +- `allow-message` +- `allow-save` +- `allow-open` + +## Permission Table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IdentifierDescription
+ +`dialog:allow-ask` + + Enables the ask command without any pre-configured scope. -## deny-ask +
+ +`dialog:deny-ask` + + Denies the ask command without any pre-configured scope. -## allow-confirm +
+ +`dialog:allow-confirm` + + Enables the confirm command without any pre-configured scope. -## deny-confirm +
+ +`dialog:deny-confirm` + + Denies the confirm command without any pre-configured scope. -## allow-message +
+ +`dialog:allow-message` + + Enables the message command without any pre-configured scope. -## deny-message +
+ +`dialog:deny-message` + + Denies the message command without any pre-configured scope. -## allow-open +
+ +`dialog:allow-open` + + Enables the open command without any pre-configured scope. -## deny-open +
+ +`dialog:deny-open` + + Denies the open command without any pre-configured scope. -## allow-save +
+ +`dialog:allow-save` + + Enables the save command without any pre-configured scope. -## deny-save +
+ +`dialog:deny-save` + + Denies the save command without any pre-configured scope. +
diff --git a/plugins/dialog/permissions/default.toml b/plugins/dialog/permissions/default.toml new file mode 100644 index 00000000..cc936d90 --- /dev/null +++ b/plugins/dialog/permissions/default.toml @@ -0,0 +1,20 @@ +"$schema" = "schemas/schema.json" + +[default] +description = """ +This permission set configures the types of dialogs +available from the dialog plugin. + +#### Granted Permissions + +All dialog types are enabled. + + +""" +permissions = [ + "allow-ask", + "allow-confirm", + "allow-message", + "allow-save", + "allow-open", +] diff --git a/plugins/dialog/permissions/schemas/schema.json b/plugins/dialog/permissions/schemas/schema.json index 44d05f82..b47417ec 100644 --- a/plugins/dialog/permissions/schemas/schema.json +++ b/plugins/dialog/permissions/schemas/schema.json @@ -17,7 +17,6 @@ }, "set": { "description": "A list of permissions sets defined", - "default": [], "type": "array", "items": { "$ref": "#/definitions/PermissionSet" @@ -50,7 +49,7 @@ "minimum": 1.0 }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -112,7 +111,7 @@ "type": "string" }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri internal convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -132,12 +131,21 @@ }, "scope": { "description": "Allowed or denied scoped when using this permission.", - "default": {}, "allOf": [ { "$ref": "#/definitions/Scopes" } ] + }, + "platforms": { + "description": "Target platforms this permission applies. By default all platforms are affected by this permission.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Target" + } } } }, @@ -164,7 +172,7 @@ } }, "Scopes": { - "description": "A restriction of the command/endpoint functionality.\n\nIt can be of any serde serializable type and is used for allowing or preventing certain actions inside a Tauri command.\n\nThe scope is passed to the command and handled/enforced by the command itself.", + "description": "An argument for fine grained behavior control of Tauri commands.\n\nIt can be of any serde serializable type and is used to allow or prevent certain actions inside a Tauri command. The configured scope is passed to the command and will be enforced by the command implementation.\n\n## Example\n\n```json { \"allow\": [{ \"path\": \"$HOME/**\" }], \"deny\": [{ \"path\": \"$HOME/secret.txt\" }] } ```", "type": "object", "properties": { "allow": { @@ -178,7 +186,7 @@ } }, "deny": { - "description": "Data that defines what is denied by the scope.", + "description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.", "type": [ "array", "null" @@ -243,78 +251,114 @@ } ] }, - "PermissionKind": { - "type": "string", + "Target": { + "description": "Platform target.", "oneOf": [ { - "description": "allow-ask -> Enables the ask command without any pre-configured scope.", + "description": "MacOS.", "type": "string", "enum": [ - "allow-ask" + "macOS" ] }, { - "description": "deny-ask -> Denies the ask command without any pre-configured scope.", + "description": "Windows.", "type": "string", "enum": [ - "deny-ask" + "windows" ] }, { - "description": "allow-confirm -> Enables the confirm command without any pre-configured scope.", + "description": "Linux.", "type": "string", "enum": [ - "allow-confirm" + "linux" ] }, { - "description": "deny-confirm -> Denies the confirm command without any pre-configured scope.", + "description": "Android.", "type": "string", "enum": [ - "deny-confirm" + "android" ] }, { - "description": "allow-message -> Enables the message command without any pre-configured scope.", + "description": "iOS.", "type": "string", "enum": [ - "allow-message" + "iOS" ] + } + ] + }, + "PermissionKind": { + "type": "string", + "oneOf": [ + { + "description": "Enables the ask command without any pre-configured scope.", + "type": "string", + "const": "allow-ask", + "markdownDescription": "Enables the ask command without any pre-configured scope." }, { - "description": "deny-message -> Denies the message command without any pre-configured scope.", + "description": "Denies the ask command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-message" - ] + "const": "deny-ask", + "markdownDescription": "Denies the ask command without any pre-configured scope." }, { - "description": "allow-open -> Enables the open command without any pre-configured scope.", + "description": "Enables the confirm command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-open" - ] + "const": "allow-confirm", + "markdownDescription": "Enables the confirm command without any pre-configured scope." }, { - "description": "deny-open -> Denies the open command without any pre-configured scope.", + "description": "Denies the confirm command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-open" - ] + "const": "deny-confirm", + "markdownDescription": "Denies the confirm command without any pre-configured scope." }, { - "description": "allow-save -> Enables the save command without any pre-configured scope.", + "description": "Enables the message command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-save" - ] + "const": "allow-message", + "markdownDescription": "Enables the message command without any pre-configured scope." }, { - "description": "deny-save -> Denies the save command without any pre-configured scope.", + "description": "Denies the message command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-save" - ] + "const": "deny-message", + "markdownDescription": "Denies the message command without any pre-configured scope." + }, + { + "description": "Enables the open command without any pre-configured scope.", + "type": "string", + "const": "allow-open", + "markdownDescription": "Enables the open command without any pre-configured scope." + }, + { + "description": "Denies the open command without any pre-configured scope.", + "type": "string", + "const": "deny-open", + "markdownDescription": "Denies the open command without any pre-configured scope." + }, + { + "description": "Enables the save command without any pre-configured scope.", + "type": "string", + "const": "allow-save", + "markdownDescription": "Enables the save command without any pre-configured scope." + }, + { + "description": "Denies the save command without any pre-configured scope.", + "type": "string", + "const": "deny-save", + "markdownDescription": "Denies the save command without any pre-configured scope." + }, + { + "description": "This permission set configures the types of dialogs\navailable from the dialog plugin.\n\n#### Granted Permissions\n\nAll dialog types are enabled.\n\n\n\n#### This default permission set includes:\n\n- `allow-ask`\n- `allow-confirm`\n- `allow-message`\n- `allow-save`\n- `allow-open`", + "type": "string", + "const": "default", + "markdownDescription": "This permission set configures the types of dialogs\navailable from the dialog plugin.\n\n#### Granted Permissions\n\nAll dialog types are enabled.\n\n\n\n#### This default permission set includes:\n\n- `allow-ask`\n- `allow-confirm`\n- `allow-message`\n- `allow-save`\n- `allow-open`" } ] } diff --git a/plugins/dialog/rollup.config.js b/plugins/dialog/rollup.config.js index 0aed70d6..a7dbd4f6 100644 --- a/plugins/dialog/rollup.config.js +++ b/plugins/dialog/rollup.config.js @@ -2,21 +2,21 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { createConfig } from "../../shared/rollup.config.js"; -import { nodeResolve } from "@rollup/plugin-node-resolve"; -import typescript from "@rollup/plugin-typescript"; -import terser from "@rollup/plugin-terser"; +import { createConfig } from '../../shared/rollup.config.js' +import { nodeResolve } from '@rollup/plugin-node-resolve' +import typescript from '@rollup/plugin-typescript' +import terser from '@rollup/plugin-terser' export default createConfig({ additionalConfigs: { - input: "guest-js/init.ts", + input: 'guest-js/init.ts', output: { - file: "src/init-iife.js", - format: "iife", + file: 'src/init-iife.js', + format: 'iife' }, plugins: [typescript(), terser(), nodeResolve()], onwarn: (warning) => { - throw Object.assign(new Error(), warning); - }, - }, -}); + throw Object.assign(new Error(), warning) + } + } +}) diff --git a/plugins/dialog/src/api-iife.js b/plugins/dialog/src/api-iife.js deleted file mode 100644 index 7aa97582..00000000 --- a/plugins/dialog/src/api-iife.js +++ /dev/null @@ -1 +0,0 @@ -if("__TAURI__"in window){var __TAURI_PLUGIN_DIALOG__=function(t){"use strict";async function n(t,n={},e){return window.__TAURI_INTERNALS__.invoke(t,n,e)}return"function"==typeof SuppressedError&&SuppressedError,t.ask=async function(t,e){const o="string"==typeof e?{title:e}:e;return n("plugin:dialog|ask",{message:t.toString(),title:o?.title?.toString(),kind:o?.kind,okButtonLabel:o?.okLabel?.toString()??"Yes",cancelButtonLabel:o?.cancelLabel?.toString()??"No"})},t.confirm=async function(t,e){const o="string"==typeof e?{title:e}:e;return n("plugin:dialog|confirm",{message:t.toString(),title:o?.title?.toString(),kind:o?.kind,okButtonLabel:o?.okLabel?.toString()??"Ok",cancelButtonLabel:o?.cancelLabel?.toString()??"Cancel"})},t.message=async function(t,e){const o="string"==typeof e?{title:e}:e;return n("plugin:dialog|message",{message:t.toString(),title:o?.title?.toString(),kind:o?.kind,okButtonLabel:o?.okLabel?.toString()})},t.open=async function(t={}){return"object"==typeof t&&Object.freeze(t),n("plugin:dialog|open",{options:t})},t.save=async function(t={}){return"object"==typeof t&&Object.freeze(t),n("plugin:dialog|save",{options:t})},t}({});Object.defineProperty(window.__TAURI__,"dialog",{value:__TAURI_PLUGIN_DIALOG__})} diff --git a/plugins/dialog/src/commands.rs b/plugins/dialog/src/commands.rs index f0dfb092..c3caf027 100644 --- a/plugins/dialog/src/commands.rs +++ b/plugins/dialog/src/commands.rs @@ -8,17 +8,20 @@ use serde::{Deserialize, Serialize}; use tauri::{command, Manager, Runtime, State, Window}; use tauri_plugin_fs::FsExt; -use crate::{Dialog, FileDialogBuilder, FileResponse, MessageDialogKind, Result}; +use crate::{ + Dialog, FileDialogBuilder, FilePath, MessageDialogButtons, MessageDialogKind, Result, CANCEL, + NO, OK, YES, +}; #[derive(Serialize)] #[serde(untagged)] pub enum OpenResponse { #[cfg(desktop)] - Folders(Option>), + Folders(Option>), #[cfg(desktop)] - Folder(Option), - Files(Option>), - File(Option), + Folder(Option), + Files(Option>), + File(Option), } #[allow(dead_code)] @@ -71,6 +74,18 @@ pub struct SaveDialogOptions { can_create_directories: Option, } +#[cfg(mobile)] +fn set_default_path( + mut dialog_builder: FileDialogBuilder, + default_path: PathBuf, +) -> FileDialogBuilder { + if let Some(file_name) = default_path.file_name() { + dialog_builder = dialog_builder.set_file_name(file_name.to_string_lossy()); + } + dialog_builder +} + +#[cfg(desktop)] fn set_default_path( mut dialog_builder: FileDialogBuilder, default_path: PathBuf, @@ -120,52 +135,67 @@ pub(crate) async fn open( let res = if options.directory { #[cfg(desktop)] { + let tauri_scope = window.state::(); + if options.multiple { let folders = dialog_builder.blocking_pick_folders(); if let Some(folders) = &folders { for folder in folders { - if let Some(s) = window.try_fs_scope() { - s.allow_directory(folder, options.recursive); + if let Ok(path) = folder.clone().into_path() { + if let Some(s) = window.try_fs_scope() { + s.allow_directory(&path, options.recursive)?; + } + tauri_scope.allow_directory(&path, options.directory)?; } } } - OpenResponse::Folders(folders) + OpenResponse::Folders( + folders.map(|folders| folders.into_iter().map(|p| p.simplified()).collect()), + ) } else { let folder = dialog_builder.blocking_pick_folder(); - if let Some(path) = &folder { - if let Some(s) = window.try_fs_scope() { - s.allow_directory(path, options.recursive); + if let Some(folder) = &folder { + if let Ok(path) = folder.clone().into_path() { + if let Some(s) = window.try_fs_scope() { + s.allow_directory(&path, options.recursive)?; + } + tauri_scope.allow_directory(&path, options.directory)?; } } - OpenResponse::Folder(folder) + OpenResponse::Folder(folder.map(|p| p.simplified())) } } #[cfg(mobile)] return Err(crate::Error::FolderPickerNotImplemented); } else if options.multiple { + let tauri_scope = window.state::(); + let files = dialog_builder.blocking_pick_files(); if let Some(files) = &files { for file in files { - if let Some(s) = window.try_fs_scope() { - s.allow_file(&file.path); + if let Ok(path) = file.clone().into_path() { + if let Some(s) = window.try_fs_scope() { + s.allow_file(&path)?; + } + + tauri_scope.allow_file(&path)?; } - window - .state::() - .allow_file(&file.path)?; } } - OpenResponse::Files(files) + OpenResponse::Files(files.map(|files| files.into_iter().map(|f| f.simplified()).collect())) } else { + let tauri_scope = window.state::(); let file = dialog_builder.blocking_pick_file(); + if let Some(file) = &file { - if let Some(s) = window.try_fs_scope() { - s.allow_file(&file.path); + if let Ok(path) = file.clone().into_path() { + if let Some(s) = window.try_fs_scope() { + s.allow_file(&path)?; + } + tauri_scope.allow_file(&path)?; } - window - .state::() - .allow_file(&file.path)?; } - OpenResponse::File(file) + OpenResponse::File(file.map(|f| f.simplified())) }; Ok(res) } @@ -176,40 +206,39 @@ pub(crate) async fn save( window: Window, dialog: State<'_, Dialog>, options: SaveDialogOptions, -) -> Result> { - #[cfg(mobile)] - return Err(crate::Error::FileSaveDialogNotImplemented); +) -> Result> { + let mut dialog_builder = dialog.file(); #[cfg(desktop)] { - let mut dialog_builder = dialog.file(); - #[cfg(any(windows, target_os = "macos"))] - { - dialog_builder = dialog_builder.set_parent(&window); - } - if let Some(title) = options.title { - dialog_builder = dialog_builder.set_title(title); - } - if let Some(default_path) = options.default_path { - dialog_builder = set_default_path(dialog_builder, default_path); - } - if let Some(can) = options.can_create_directories { - dialog_builder = dialog_builder.set_can_create_directories(can); - } - for filter in options.filters { - let extensions: Vec<&str> = filter.extensions.iter().map(|s| &**s).collect(); - dialog_builder = dialog_builder.add_filter(filter.name, &extensions); - } + dialog_builder = dialog_builder.set_parent(&window); + } + if let Some(title) = options.title { + dialog_builder = dialog_builder.set_title(title); + } + if let Some(default_path) = options.default_path { + dialog_builder = set_default_path(dialog_builder, default_path); + } + if let Some(can) = options.can_create_directories { + dialog_builder = dialog_builder.set_can_create_directories(can); + } + for filter in options.filters { + let extensions: Vec<&str> = filter.extensions.iter().map(|s| &**s).collect(); + dialog_builder = dialog_builder.add_filter(filter.name, &extensions); + } + + let tauri_scope = window.state::(); - let path = dialog_builder.blocking_save_file(); - if let Some(p) = &path { + let path = dialog_builder.blocking_save_file(); + if let Some(p) = &path { + if let Ok(path) = p.clone().into_path() { if let Some(s) = window.try_fs_scope() { - s.allow_file(p); + s.allow_file(&path)?; } - window.state::().allow_file(p)?; + tauri_scope.allow_file(&path)?; } - - Ok(path) } + + Ok(path.map(|p| p.simplified())) } fn message_dialog( @@ -218,16 +247,17 @@ fn message_dialog( title: Option, message: String, kind: Option, - ok_button_label: Option, - cancel_button_label: Option, + buttons: MessageDialogButtons, ) -> bool { let mut builder = dialog.message(message); + builder = builder.buttons(buttons); + if let Some(title) = title { builder = builder.title(title); } - #[cfg(any(windows, target_os = "macos"))] + #[cfg(desktop)] { builder = builder.parent(&window); } @@ -236,14 +266,6 @@ fn message_dialog( builder = builder.kind(kind); } - if let Some(ok) = ok_button_label { - builder = builder.ok_button_label(ok); - } - - if let Some(cancel) = cancel_button_label { - builder = builder.cancel_button_label(cancel); - } - builder.blocking_show() } @@ -262,8 +284,11 @@ pub(crate) async fn message( title, message, kind, - ok_button_label, - None, + if let Some(ok_button_label) = ok_button_label { + MessageDialogButtons::OkCustom(ok_button_label) + } else { + MessageDialogButtons::Ok + }, )) } @@ -274,8 +299,8 @@ pub(crate) async fn ask( title: Option, message: String, kind: Option, - ok_button_label: Option, - cancel_button_label: Option, + yes_button_label: Option, + no_button_label: Option, ) -> Result { Ok(message_dialog( window, @@ -283,8 +308,16 @@ pub(crate) async fn ask( title, message, kind, - Some(ok_button_label.unwrap_or_else(|| "Yes".into())), - Some(cancel_button_label.unwrap_or_else(|| "No".into())), + if let Some(yes_button_label) = yes_button_label { + MessageDialogButtons::OkCancelCustom( + yes_button_label, + no_button_label.unwrap_or(NO.to_string()), + ) + } else if let Some(no_button_label) = no_button_label { + MessageDialogButtons::OkCancelCustom(YES.to_string(), no_button_label) + } else { + MessageDialogButtons::YesNo + }, )) } @@ -304,7 +337,15 @@ pub(crate) async fn confirm( title, message, kind, - Some(ok_button_label.unwrap_or_else(|| "Ok".into())), - Some(cancel_button_label.unwrap_or_else(|| "Cancel".into())), + if let Some(ok_button_label) = ok_button_label { + MessageDialogButtons::OkCancelCustom( + ok_button_label, + cancel_button_label.unwrap_or(CANCEL.to_string()), + ) + } else if let Some(cancel_button_label) = cancel_button_label { + MessageDialogButtons::OkCancelCustom(OK.to_string(), cancel_button_label) + } else { + MessageDialogButtons::OkCancel + }, )) } diff --git a/plugins/dialog/src/desktop.rs b/plugins/dialog/src/desktop.rs index 7843f3b5..d1a3e8b2 100644 --- a/plugins/dialog/src/desktop.rs +++ b/plugins/dialog/src/desktop.rs @@ -8,25 +8,12 @@ //! to give results back. This is particularly useful when running dialogs from the main thread. //! When using on asynchronous contexts such as async commands, the [`blocking`] APIs are recommended. -use std::path::PathBuf; - -use raw_window_handle::{HasWindowHandle, RawWindowHandle}; +use raw_window_handle::{HasDisplayHandle, HasWindowHandle, RawDisplayHandle, RawWindowHandle}; +use rfd::{AsyncFileDialog, AsyncMessageDialog}; use serde::de::DeserializeOwned; use tauri::{plugin::PluginApi, AppHandle, Runtime}; -use crate::{models::*, FileDialogBuilder, MessageDialogBuilder}; - -const OK: &str = "Ok"; - -#[cfg(target_os = "linux")] -type FileDialog = rfd::FileDialog; -#[cfg(not(target_os = "linux"))] -type FileDialog = rfd::AsyncFileDialog; - -#[cfg(target_os = "linux")] -type MessageDialog = rfd::MessageDialog; -#[cfg(not(target_os = "linux"))] -type MessageDialog = rfd::AsyncMessageDialog; +use crate::{models::*, FileDialogBuilder, FilePath, MessageDialogBuilder, OK}; pub fn init( app: &AppHandle, @@ -51,40 +38,6 @@ impl Dialog { } } -#[cfg(not(target_os = "linux"))] -macro_rules! run_dialog { - ($e:expr, $h: expr) => {{ - std::thread::spawn(move || $h(tauri::async_runtime::block_on($e))); - }}; -} - -#[cfg(target_os = "linux")] -macro_rules! run_dialog { - ($e:expr, $h: ident) => {{ - std::thread::spawn(move || { - let context = glib::MainContext::default(); - context.invoke_with_priority(glib::PRIORITY_HIGH, move || $h($e)); - }); - }}; -} - -#[cfg(not(target_os = "linux"))] -macro_rules! run_file_dialog { - ($e:expr, $h: ident) => {{ - std::thread::spawn(move || $h(tauri::async_runtime::block_on($e))); - }}; -} - -#[cfg(target_os = "linux")] -macro_rules! run_file_dialog { - ($e:expr, $h: ident) => {{ - std::thread::spawn(move || { - let context = glib::MainContext::default(); - context.invoke_with_priority(glib::PRIORITY_HIGH, move || $h($e)); - }); - }}; -} - impl From for rfd::MessageLevel { fn from(kind: MessageDialogKind) -> Self { match kind { @@ -95,19 +48,40 @@ impl From for rfd::MessageLevel { } } -struct WindowHandle(RawWindowHandle); +#[derive(Debug)] +pub(crate) struct WindowHandle { + window_handle: RawWindowHandle, + display_handle: RawDisplayHandle, +} + +impl WindowHandle { + pub(crate) fn new(window_handle: RawWindowHandle, display_handle: RawDisplayHandle) -> Self { + Self { + window_handle, + display_handle, + } + } +} impl HasWindowHandle for WindowHandle { fn window_handle( &self, ) -> Result, raw_window_handle::HandleError> { - Ok(unsafe { raw_window_handle::WindowHandle::borrow_raw(self.0) }) + Ok(unsafe { raw_window_handle::WindowHandle::borrow_raw(self.window_handle) }) } } -impl From> for FileDialog { +impl HasDisplayHandle for WindowHandle { + fn display_handle( + &self, + ) -> Result, raw_window_handle::HandleError> { + Ok(unsafe { raw_window_handle::DisplayHandle::borrow_raw(self.display_handle) }) + } +} + +impl From> for AsyncFileDialog { fn from(d: FileDialogBuilder) -> Self { - let mut builder = FileDialog::new(); + let mut builder = AsyncFileDialog::new(); if let Some(title) = d.title { builder = builder.set_title(title); @@ -124,7 +98,7 @@ impl From> for FileDialog { } #[cfg(desktop)] if let Some(parent) = d.parent { - builder = builder.set_parent(&WindowHandle(parent)); + builder = builder.set_parent(&parent); } builder = builder.set_can_create_directories(d.can_create_directories.unwrap_or(true)); @@ -133,78 +107,104 @@ impl From> for FileDialog { } } -impl From> for MessageDialog { +impl From for rfd::MessageButtons { + fn from(value: MessageDialogButtons) -> Self { + match value { + MessageDialogButtons::Ok => Self::Ok, + MessageDialogButtons::OkCancel => Self::OkCancel, + MessageDialogButtons::YesNo => Self::YesNo, + MessageDialogButtons::OkCustom(ok) => Self::OkCustom(ok), + MessageDialogButtons::OkCancelCustom(ok, cancel) => Self::OkCancelCustom(ok, cancel), + } + } +} + +impl From> for AsyncMessageDialog { fn from(d: MessageDialogBuilder) -> Self { - let mut dialog = MessageDialog::new() + let mut dialog = AsyncMessageDialog::new() .set_title(&d.title) .set_description(&d.message) - .set_level(d.kind.into()); - - let buttons = match (d.ok_button_label, d.cancel_button_label) { - (Some(ok), Some(cancel)) => Some(rfd::MessageButtons::OkCancelCustom(ok, cancel)), - (Some(ok), None) => Some(rfd::MessageButtons::OkCustom(ok)), - (None, Some(cancel)) => Some(rfd::MessageButtons::OkCancelCustom(OK.into(), cancel)), - (None, None) => None, - }; - if let Some(buttons) = buttons { - dialog = dialog.set_buttons(buttons); - } + .set_level(d.kind.into()) + .set_buttons(d.buttons.into()); if let Some(parent) = d.parent { - dialog = dialog.set_parent(&WindowHandle(parent)); + dialog = dialog.set_parent(&parent); } dialog } } -pub fn pick_file) + Send + 'static>( +pub fn pick_file) + Send + 'static>( dialog: FileDialogBuilder, f: F, ) { - #[cfg(not(target_os = "linux"))] - let f = |path: Option| f(path.map(|p| p.path().to_path_buf())); - run_file_dialog!(FileDialog::from(dialog).pick_file(), f) + let f = |path: Option| f(path.map(|p| p.path().to_path_buf().into())); + let handle = dialog.dialog.app_handle().to_owned(); + let _ = handle.run_on_main_thread(move || { + let dialog = AsyncFileDialog::from(dialog).pick_file(); + std::thread::spawn(move || f(tauri::async_runtime::block_on(dialog))); + }); } -pub fn pick_files>) + Send + 'static>( +pub fn pick_files>) + Send + 'static>( dialog: FileDialogBuilder, f: F, ) { - #[cfg(not(target_os = "linux"))] let f = |paths: Option>| { - f(paths.map(|list| list.into_iter().map(|p| p.path().to_path_buf()).collect())) + f(paths.map(|list| { + list.into_iter() + .map(|p| p.path().to_path_buf().into()) + .collect() + })) }; - run_file_dialog!(FileDialog::from(dialog).pick_files(), f) + let handle = dialog.dialog.app_handle().to_owned(); + let _ = handle.run_on_main_thread(move || { + let dialog = AsyncFileDialog::from(dialog).pick_files(); + std::thread::spawn(move || f(tauri::async_runtime::block_on(dialog))); + }); } -pub fn pick_folder) + Send + 'static>( +pub fn pick_folder) + Send + 'static>( dialog: FileDialogBuilder, f: F, ) { - #[cfg(not(target_os = "linux"))] - let f = |path: Option| f(path.map(|p| p.path().to_path_buf())); - run_file_dialog!(FileDialog::from(dialog).pick_folder(), f) + let f = |path: Option| f(path.map(|p| p.path().to_path_buf().into())); + let handle = dialog.dialog.app_handle().to_owned(); + let _ = handle.run_on_main_thread(move || { + let dialog = AsyncFileDialog::from(dialog).pick_folder(); + std::thread::spawn(move || f(tauri::async_runtime::block_on(dialog))); + }); } -pub fn pick_folders>) + Send + 'static>( +pub fn pick_folders>) + Send + 'static>( dialog: FileDialogBuilder, f: F, ) { - #[cfg(not(target_os = "linux"))] let f = |paths: Option>| { - f(paths.map(|list| list.into_iter().map(|p| p.path().to_path_buf()).collect())) + f(paths.map(|list| { + list.into_iter() + .map(|p| p.path().to_path_buf().into()) + .collect() + })) }; - run_file_dialog!(FileDialog::from(dialog).pick_folders(), f) + let handle = dialog.dialog.app_handle().to_owned(); + let _ = handle.run_on_main_thread(move || { + let dialog = AsyncFileDialog::from(dialog).pick_folders(); + std::thread::spawn(move || f(tauri::async_runtime::block_on(dialog))); + }); } -pub fn save_file) + Send + 'static>( +pub fn save_file) + Send + 'static>( dialog: FileDialogBuilder, f: F, ) { - #[cfg(not(target_os = "linux"))] - let f = |path: Option| f(path.map(|p| p.path().to_path_buf())); - run_file_dialog!(FileDialog::from(dialog).save_file(), f) + let f = |path: Option| f(path.map(|p| p.path().to_path_buf().into())); + let handle = dialog.dialog.app_handle().to_owned(); + let _ = handle.run_on_main_thread(move || { + let dialog = AsyncFileDialog::from(dialog).save_file(); + std::thread::spawn(move || f(tauri::async_runtime::block_on(dialog))); + }); } /// Shows a message dialog @@ -214,7 +214,11 @@ pub fn show_message_dialog( ) { use rfd::MessageDialogResult; - let ok_label = dialog.ok_button_label.clone(); + let ok_label = match &dialog.buttons { + MessageDialogButtons::OkCustom(ok) => Some(ok.clone()), + MessageDialogButtons::OkCancelCustom(ok, _) => Some(ok.clone()), + _ => None, + }; let f = move |res| { f(match res { MessageDialogResult::Ok | MessageDialogResult::Yes => true, @@ -223,5 +227,9 @@ pub fn show_message_dialog( }); }; - run_dialog!(MessageDialog::from(dialog).show(), f); + let handle = dialog.dialog.app_handle().to_owned(); + let _ = handle.run_on_main_thread(move || { + let dialog = AsyncMessageDialog::from(dialog).show(); + std::thread::spawn(move || f(tauri::async_runtime::block_on(dialog))); + }); } diff --git a/plugins/dialog/src/error.rs b/plugins/dialog/src/error.rs index 069cd55c..0c3ed5b8 100644 --- a/plugins/dialog/src/error.rs +++ b/plugins/dialog/src/error.rs @@ -7,6 +7,7 @@ use serde::{ser::Serializer, Serialize}; pub type Result = std::result::Result; #[derive(Debug, thiserror::Error)] +#[non_exhaustive] pub enum Error { #[error(transparent)] Tauri(#[from] tauri::Error), @@ -18,9 +19,6 @@ pub enum Error { #[cfg(mobile)] #[error("Folder picker is not implemented on mobile")] FolderPickerNotImplemented, - #[cfg(mobile)] - #[error("File save dialog is not implemented on mobile")] - FileSaveDialogNotImplemented, #[error(transparent)] Fs(#[from] tauri_plugin_fs::Error), } diff --git a/plugins/dialog/src/init-iife.js b/plugins/dialog/src/init-iife.js index f51830fd..bcdf3f56 100644 --- a/plugins/dialog/src/init-iife.js +++ b/plugins/dialog/src/init-iife.js @@ -1 +1 @@ -!function(){"use strict";async function n(n,i={},o){return window.__TAURI_INTERNALS__.invoke(n,i,o)}"function"==typeof SuppressedError&&SuppressedError,window.alert=function(i){n("plugin:dialog|message",{message:i.toString()})},window.confirm=function(i){return n("plugin:dialog|confirm",{message:i.toString()})}}(); +!function(){"use strict";async function n(n,i={},o){return window.__TAURI_INTERNALS__.invoke(n,i,o)}"function"==typeof SuppressedError&&SuppressedError,window.alert=function(i){n("plugin:dialog|message",{message:i.toString()})},window.confirm=async function(i){return await n("plugin:dialog|confirm",{message:i.toString()})}}(); diff --git a/plugins/dialog/src/lib.rs b/plugins/dialog/src/lib.rs index 0e9aa9db..2ef1c1ea 100644 --- a/plugins/dialog/src/lib.rs +++ b/plugins/dialog/src/lib.rs @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -//! [![](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/dialog/banner.png)](https://github.com/tauri-apps/plugins-workspace/tree/v2/plugins/dialog) -//! //! Native system dialogs for opening and saving files along with message dialogs. #![doc( @@ -11,7 +9,7 @@ html_favicon_url = "https://github.com/tauri-apps/tauri/raw/dev/app-icon.png" )] -use serde::{Deserialize, Serialize}; +use serde::Serialize; use tauri::{ plugin::{Builder, TauriPlugin}, Manager, Runtime, @@ -24,6 +22,7 @@ use std::{ pub use models::*; +pub use tauri_plugin_fs::FilePath; #[cfg(desktop)] mod desktop; #[cfg(mobile)] @@ -40,6 +39,16 @@ use desktop::*; #[cfg(mobile)] use mobile::*; +#[cfg(desktop)] +pub use desktop::Dialog; +#[cfg(mobile)] +pub use mobile::Dialog; + +pub(crate) const OK: &str = "Ok"; +pub(crate) const CANCEL: &str = "Cancel"; +pub(crate) const YES: &str = "Yes"; +pub(crate) const NO: &str = "No"; + macro_rules! blocking_fn { ($self:ident, $fn:ident) => {{ let (tx, rx) = sync_channel(0); @@ -51,7 +60,7 @@ macro_rules! blocking_fn { }}; } -/// Extensions to [`tauri::App`], [`tauri::AppHandle`] and [`tauri::Window`] to access the dialog APIs. +/// Extensions to [`tauri::App`], [`tauri::AppHandle`], [`tauri::WebviewWindow`], [`tauri::Webview`] and [`tauri::Window`] to access the dialog APIs. pub trait DialogExt { fn dialog(&self) -> &Dialog; } @@ -63,6 +72,85 @@ impl> crate::DialogExt for T { } impl Dialog { + /// Create a new messaging dialog builder. + /// The dialog can optionally ask the user for confirmation or include an OK button. + /// + /// # Examples + /// + /// - Message dialog: + /// + /// ``` + /// use tauri_plugin_dialog::DialogExt; + /// + /// tauri::Builder::default() + /// .setup(|app| { + /// app + /// .dialog() + /// .message("Tauri is Awesome!") + /// .show(|_| { + /// println!("dialog closed"); + /// }); + /// Ok(()) + /// }); + /// ``` + /// + /// - Ask dialog: + /// + /// ``` + /// use tauri_plugin_dialog::{DialogExt, MessageDialogButtons}; + /// + /// tauri::Builder::default() + /// .setup(|app| { + /// app.dialog() + /// .message("Are you sure?") + /// .buttons(MessageDialogButtons::OkCancelCustom("Yes", "No")) + /// .show(|yes| { + /// println!("user said {}", if yes { "yes" } else { "no" }); + /// }); + /// Ok(()) + /// }); + /// ``` + /// + /// - Message dialog with OK button: + /// + /// ``` + /// use tauri_plugin_dialog::{DialogExt, MessageDialogButtons}; + /// + /// tauri::Builder::default() + /// .setup(|app| { + /// app.dialog() + /// .message("Job completed successfully") + /// .buttons(MessageDialogButtons::Ok) + /// .show(|_| { + /// println!("dialog closed"); + /// }); + /// Ok(()) + /// }); + /// ``` + /// + /// # `show` vs `blocking_show` + /// + /// The dialog builder includes two separate APIs for rendering the dialog: `show` and `blocking_show`. + /// The `show` function is asynchronous and takes a closure to be executed when the dialog is closed. + /// To block the current thread until the user acted on the dialog, you can use `blocking_show`, + /// but note that it cannot be executed on the main thread as it will freeze your application. + /// + /// ``` + /// use tauri_plugin_dialog::{DialogExt, MessageDialogButtons}; + /// + /// tauri::Builder::default() + /// .setup(|app| { + /// let handle = app.handle().clone(); + /// std::thread::spawn(move || { + /// let yes = handle.dialog() + /// .message("Are you sure?") + /// .buttons(MessageDialogButtons::OkCancelCustom("Yes", "No")) + /// .blocking_show(); + /// }); + /// + /// Ok(()) + /// }); + /// ``` pub fn message(&self, message: impl Into) -> MessageDialogBuilder { MessageDialogBuilder::new( self.clone(), @@ -71,6 +159,7 @@ impl Dialog { ) } + /// Creates a new builder for dialogs that lets the user select file(s) or folder(s). pub fn file(&self) -> FileDialogBuilder { FileDialogBuilder::new(self.clone()) } @@ -84,13 +173,7 @@ pub fn init() -> TauriPlugin { // Dialogs are implemented natively on Android #[cfg(not(target_os = "android"))] { - let mut init_script = include_str!("init-iife.js").to_string(); - init_script.push_str(include_str!("api-iife.js")); - builder = builder.js_init_script(init_script); - } - #[cfg(target_os = "android")] - { - builder = builder.js_init_script(include_str!("api-iife.js").to_string()); + builder = builder.js_init_script(include_str!("init-iife.js").to_string()); } builder @@ -119,10 +202,9 @@ pub struct MessageDialogBuilder { pub(crate) title: String, pub(crate) message: String, pub(crate) kind: MessageDialogKind, - pub(crate) ok_button_label: Option, - pub(crate) cancel_button_label: Option, + pub(crate) buttons: MessageDialogButtons, #[cfg(desktop)] - pub(crate) parent: Option, + pub(crate) parent: Option, } /// Payload for the message dialog mobile API. @@ -133,8 +215,8 @@ pub(crate) struct MessageDialogPayload<'a> { title: &'a String, message: &'a String, kind: &'a MessageDialogKind, - ok_button_label: &'a Option, - cancel_button_label: &'a Option, + ok_button_label: Option<&'a str>, + cancel_button_label: Option<&'a str>, } // raw window handle :( @@ -148,8 +230,7 @@ impl MessageDialogBuilder { title: title.into(), message: message.into(), kind: Default::default(), - ok_button_label: None, - cancel_button_label: None, + buttons: Default::default(), #[cfg(desktop)] parent: None, } @@ -157,12 +238,21 @@ impl MessageDialogBuilder { #[cfg(mobile)] pub(crate) fn payload(&self) -> MessageDialogPayload<'_> { + let (ok_button_label, cancel_button_label) = match &self.buttons { + MessageDialogButtons::Ok => (Some(OK), None), + MessageDialogButtons::OkCancel => (Some(OK), Some(CANCEL)), + MessageDialogButtons::YesNo => (Some(YES), Some(NO)), + MessageDialogButtons::OkCustom(ok) => (Some(ok.as_str()), Some(CANCEL)), + MessageDialogButtons::OkCancelCustom(ok, cancel) => { + (Some(ok.as_str()), Some(cancel.as_str())) + } + }; MessageDialogPayload { title: &self.title, message: &self.message, kind: &self.kind, - ok_button_label: &self.ok_button_label, - cancel_button_label: &self.cancel_button_label, + ok_button_label, + cancel_button_label, } } @@ -173,27 +263,25 @@ impl MessageDialogBuilder { } /// Set parent windows explicitly (optional) - /// - /// ## Platform-specific - /// - /// - **Linux:** Unsupported. #[cfg(desktop)] - pub fn parent(mut self, parent: &W) -> Self { - if let Ok(h) = parent.window_handle() { - self.parent.replace(h.as_raw()); + pub fn parent( + mut self, + parent: &W, + ) -> Self { + if let (Ok(window_handle), Ok(display_handle)) = + (parent.window_handle(), parent.display_handle()) + { + self.parent.replace(crate::desktop::WindowHandle::new( + window_handle.as_raw(), + display_handle.as_raw(), + )); } self } - /// Sets the label for the OK button. - pub fn ok_button_label(mut self, label: impl Into) -> Self { - self.ok_button_label.replace(label.into()); - self - } - - /// Sets the label for the Cancel button. - pub fn cancel_button_label(mut self, label: impl Into) -> Self { - self.cancel_button_label.replace(label.into()); + /// Sets the dialog buttons. + pub fn buttons(mut self, buttons: MessageDialogButtons) -> Self { + self.buttons = buttons; self } @@ -218,38 +306,6 @@ impl MessageDialogBuilder { blocking_fn!(self, show) } } - -#[derive(Debug, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct FileResponse { - pub base64_data: Option, - pub duration: Option, - pub height: Option, - pub width: Option, - pub mime_type: Option, - pub modified_at: Option, - pub name: Option, - pub path: PathBuf, - pub size: u64, -} - -impl FileResponse { - #[cfg(desktop)] - fn new(path: PathBuf) -> Self { - Self { - base64_data: None, - duration: None, - height: None, - width: None, - mime_type: None, - modified_at: None, - name: path.file_name().map(|f| f.to_string_lossy().into_owned()), - path, - size: 0, - } - } -} - #[derive(Debug, Serialize)] pub(crate) struct Filter { pub name: String, @@ -269,13 +325,14 @@ pub struct FileDialogBuilder { pub(crate) title: Option, pub(crate) can_create_directories: Option, #[cfg(desktop)] - pub(crate) parent: Option, + pub(crate) parent: Option, } #[cfg(mobile)] #[derive(Serialize)] #[serde(rename_all = "camelCase")] pub(crate) struct FileDialogPayload<'a> { + file_name: &'a Option, filters: &'a Vec, multiple: bool, } @@ -301,6 +358,7 @@ impl FileDialogBuilder { #[cfg(mobile)] pub(crate) fn payload(&self, multiple: bool) -> FileDialogPayload<'_> { FileDialogPayload { + file_name: &self.file_name, filters: &self.filters, multiple, } @@ -333,9 +391,19 @@ impl FileDialogBuilder { /// Sets the parent window of the dialog. #[cfg(desktop)] #[must_use] - pub fn set_parent(mut self, parent: &W) -> Self { - if let Ok(h) = parent.window_handle() { - self.parent.replace(h.as_raw()); + pub fn set_parent< + W: raw_window_handle::HasWindowHandle + raw_window_handle::HasDisplayHandle, + >( + mut self, + parent: &W, + ) -> Self { + if let (Ok(window_handle), Ok(display_handle)) = + (parent.window_handle(), parent.display_handle()) + { + self.parent.replace(crate::desktop::WindowHandle::new( + window_handle.as_raw(), + display_handle.as_raw(), + )); } self } @@ -361,21 +429,18 @@ impl FileDialogBuilder { /// /// # Examples /// - /// ```rust,no_run + /// ``` /// use tauri_plugin_dialog::DialogExt; /// tauri::Builder::default() - /// .build(tauri::generate_context!("test/tauri.conf.json")) - /// .expect("failed to build tauri app") - /// .run(|app, _event| { + /// .setup(|app| { /// app.dialog().file().pick_file(|file_path| { /// // do something with the optional file path here /// // the file path is `None` if the user closed the dialog - /// }) - /// }) + /// }); + /// Ok(()) + /// }); /// ``` - pub fn pick_file) + Send + 'static>(self, f: F) { - #[cfg(desktop)] - let f = |path: Option| f(path.map(FileResponse::new)); + pub fn pick_file) + Send + 'static>(self, f: F) { pick_file(self, f) } @@ -383,29 +448,44 @@ impl FileDialogBuilder { /// This is not a blocking operation, /// and should be used when running on the main thread to avoid deadlocks with the event loop. /// + /// # Reading the files + /// + /// The file paths cannot be read directly on Android as they are behind a content URI. + /// The recommended way to read the files is using the [`fs`](https://v2.tauri.app/plugin/file-system/) plugin: + /// + /// ``` + /// use tauri_plugin_dialog::DialogExt; + /// use tauri_plugin_fs::FsExt; + /// tauri::Builder::default() + /// .setup(|app| { + /// let handle = app.handle().clone(); + /// app.dialog().file().pick_file(move |file_path| { + /// let Some(path) = file_path else { return }; + /// let Ok(contents) = handle.fs().read_to_string(path) else { + /// eprintln!("failed to read file, "); + /// return; + /// }; + /// }); + /// Ok(()) + /// }); + /// ``` + /// + /// See for more information. + /// /// # Examples /// - /// ```rust,no_run + /// ``` /// use tauri_plugin_dialog::DialogExt; /// tauri::Builder::default() - /// .build(tauri::generate_context!("test/tauri.conf.json")) - /// .expect("failed to build tauri app") - /// .run(|app, _event| { + /// .setup(|app| { /// app.dialog().file().pick_files(|file_paths| { /// // do something with the optional file paths here /// // the file paths value is `None` if the user closed the dialog - /// }) - /// }) + /// }); + /// Ok(()) + /// }); /// ``` - pub fn pick_files>) + Send + 'static>(self, f: F) { - #[cfg(desktop)] - let f = |paths: Option>| { - f(paths.map(|p| { - p.into_iter() - .map(FileResponse::new) - .collect::>() - })) - }; + pub fn pick_files>) + Send + 'static>(self, f: F) { pick_files(self, f) } @@ -415,20 +495,19 @@ impl FileDialogBuilder { /// /// # Examples /// - /// ```rust,no_run + /// ``` /// use tauri_plugin_dialog::DialogExt; /// tauri::Builder::default() - /// .build(tauri::generate_context!("test/tauri.conf.json")) - /// .expect("failed to build tauri app") - /// .run(|app, _event| { + /// .setup(|app| { /// app.dialog().file().pick_folder(|folder_path| { /// // do something with the optional folder path here /// // the folder path is `None` if the user closed the dialog - /// }) - /// }) + /// }); + /// Ok(()) + /// }); /// ``` #[cfg(desktop)] - pub fn pick_folder) + Send + 'static>(self, f: F) { + pub fn pick_folder) + Send + 'static>(self, f: F) { pick_folder(self, f) } @@ -438,20 +517,19 @@ impl FileDialogBuilder { /// /// # Examples /// - /// ```rust,no_run + /// ``` /// use tauri_plugin_dialog::DialogExt; /// tauri::Builder::default() - /// .build(tauri::generate_context!("test/tauri.conf.json")) - /// .expect("failed to build tauri app") - /// .run(|app, _event| { + /// .setup(|app| { /// app.dialog().file().pick_folders(|file_paths| { /// // do something with the optional folder paths here /// // the folder paths value is `None` if the user closed the dialog - /// }) - /// }) + /// }); + /// Ok(()) + /// }); /// ``` #[cfg(desktop)] - pub fn pick_folders>) + Send + 'static>(self, f: F) { + pub fn pick_folders>) + Send + 'static>(self, f: F) { pick_folders(self, f) } @@ -462,20 +540,18 @@ impl FileDialogBuilder { /// /// # Examples /// - /// ```rust,no_run + /// ``` /// use tauri_plugin_dialog::DialogExt; /// tauri::Builder::default() - /// .build(tauri::generate_context!("test/tauri.conf.json")) - /// .expect("failed to build tauri app") - /// .run(|app, _event| { + /// .setup(|app| { /// app.dialog().file().save_file(|file_path| { /// // do something with the optional file path here /// // the file path is `None` if the user closed the dialog - /// }) - /// }) + /// }); + /// Ok(()) + /// }); /// ``` - #[cfg(desktop)] - pub fn save_file) + Send + 'static>(self, f: F) { + pub fn save_file) + Send + 'static>(self, f: F) { save_file(self, f) } } @@ -488,7 +564,7 @@ impl FileDialogBuilder { /// /// # Examples /// - /// ```rust,no_run + /// ``` /// use tauri_plugin_dialog::DialogExt; /// #[tauri::command] /// async fn my_command(app: tauri::AppHandle) { @@ -497,7 +573,7 @@ impl FileDialogBuilder { /// // the file path is `None` if the user closed the dialog /// } /// ``` - pub fn blocking_pick_file(self) -> Option { + pub fn blocking_pick_file(self) -> Option { blocking_fn!(self, pick_file) } @@ -507,7 +583,7 @@ impl FileDialogBuilder { /// /// # Examples /// - /// ```rust,no_run + /// ``` /// use tauri_plugin_dialog::DialogExt; /// #[tauri::command] /// async fn my_command(app: tauri::AppHandle) { @@ -516,7 +592,7 @@ impl FileDialogBuilder { /// // the file paths value is `None` if the user closed the dialog /// } /// ``` - pub fn blocking_pick_files(self) -> Option> { + pub fn blocking_pick_files(self) -> Option> { blocking_fn!(self, pick_files) } @@ -526,7 +602,7 @@ impl FileDialogBuilder { /// /// # Examples /// - /// ```rust,no_run + /// ``` /// use tauri_plugin_dialog::DialogExt; /// #[tauri::command] /// async fn my_command(app: tauri::AppHandle) { @@ -536,7 +612,7 @@ impl FileDialogBuilder { /// } /// ``` #[cfg(desktop)] - pub fn blocking_pick_folder(self) -> Option { + pub fn blocking_pick_folder(self) -> Option { blocking_fn!(self, pick_folder) } @@ -546,7 +622,7 @@ impl FileDialogBuilder { /// /// # Examples /// - /// ```rust,no_run + /// ``` /// use tauri_plugin_dialog::DialogExt; /// #[tauri::command] /// async fn my_command(app: tauri::AppHandle) { @@ -556,7 +632,7 @@ impl FileDialogBuilder { /// } /// ``` #[cfg(desktop)] - pub fn blocking_pick_folders(self) -> Option> { + pub fn blocking_pick_folders(self) -> Option> { blocking_fn!(self, pick_folders) } @@ -566,7 +642,7 @@ impl FileDialogBuilder { /// /// # Examples /// - /// ```rust,no_run + /// ``` /// use tauri_plugin_dialog::DialogExt; /// #[tauri::command] /// async fn my_command(app: tauri::AppHandle) { @@ -575,8 +651,7 @@ impl FileDialogBuilder { /// // the file path is `None` if the user closed the dialog /// } /// ``` - #[cfg(desktop)] - pub fn blocking_save_file(self) -> Option { + pub fn blocking_save_file(self) -> Option { blocking_fn!(self, save_file) } } diff --git a/plugins/dialog/src/mobile.rs b/plugins/dialog/src/mobile.rs index 289cbb7e..b73def4f 100644 --- a/plugins/dialog/src/mobile.rs +++ b/plugins/dialog/src/mobile.rs @@ -8,7 +8,7 @@ use tauri::{ AppHandle, Runtime, }; -use crate::{FileDialogBuilder, FileResponse, MessageDialogBuilder}; +use crate::{FileDialogBuilder, FilePath, MessageDialogBuilder}; #[cfg(target_os = "android")] const PLUGIN_IDENTIFIER: &str = "app.tauri.dialog"; @@ -46,10 +46,15 @@ impl Dialog { #[derive(Debug, Deserialize)] struct FilePickerResponse { - files: Vec, + files: Vec, } -pub fn pick_file) + Send + 'static>( +#[derive(Debug, Deserialize)] +struct SaveFileResponse { + file: FilePath, +} + +pub fn pick_file) + Send + 'static>( dialog: FileDialogBuilder, f: F, ) { @@ -66,7 +71,7 @@ pub fn pick_file) + Send + 'static>( }); } -pub fn pick_files>) + Send + 'static>( +pub fn pick_files>) + Send + 'static>( dialog: FileDialogBuilder, f: F, ) { @@ -83,6 +88,23 @@ pub fn pick_files>) + Send + 'sta }); } +pub fn save_file) + Send + 'static>( + dialog: FileDialogBuilder, + f: F, +) { + std::thread::spawn(move || { + let res = dialog + .dialog + .0 + .run_mobile_plugin::("saveFileDialog", dialog.payload(false)); + if let Ok(response) = res { + f(Some(response.file)) + } else { + f(None) + } + }); +} + #[derive(Debug, Deserialize)] struct ShowMessageDialogResponse { #[allow(dead_code)] diff --git a/plugins/dialog/src/models.rs b/plugins/dialog/src/models.rs index fa9224e1..d6452bce 100644 --- a/plugins/dialog/src/models.rs +++ b/plugins/dialog/src/models.rs @@ -49,3 +49,20 @@ impl Serialize for MessageDialogKind { } } } + +/// Set of button that will be displayed on the dialog +#[non_exhaustive] +#[derive(Debug, Default, Clone)] +pub enum MessageDialogButtons { + #[default] + /// A single `Ok` button with OS default dialog text + Ok, + /// 2 buttons `Ok` and `Cancel` with OS default dialog texts + OkCancel, + /// 2 buttons `Yes` and `No` with OS default dialog texts + YesNo, + /// A single `Ok` button with custom text + OkCustom(String), + /// 2 buttons `Ok` and `Cancel` with custom texts + OkCancelCustom(String, String), +} diff --git a/plugins/fs/.gitignore b/plugins/fs/.gitignore deleted file mode 100644 index b512c09d..00000000 --- a/plugins/fs/.gitignore +++ /dev/null @@ -1 +0,0 @@ -node_modules \ No newline at end of file diff --git a/plugins/fs/CHANGELOG.md b/plugins/fs/CHANGELOG.md index c4e8e6d3..a8b72fc7 100644 --- a/plugins/fs/CHANGELOG.md +++ b/plugins/fs/CHANGELOG.md @@ -1,5 +1,138 @@ # Changelog +## \[2.2.1] + +### bug + +- [`831c35ff`](https://github.com/tauri-apps/plugins-workspace/commit/831c35ff3940e841fe4418bb4cb104038b03304b) ([#2550](https://github.com/tauri-apps/plugins-workspace/pull/2550)) Fix `writeFile` ReadableStream handling due to missing async iterator support on macOS platform + +## \[2.2.0] + +- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other. + +## \[2.0.4] + +- [`77b85507`](https://github.com/tauri-apps/plugins-workspace/commit/77b855074aad612f2b28e6a3b5881fac767a05ae) ([#2171](https://github.com/tauri-apps/plugins-workspace/pull/2171) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Fixed docs.rs build. + +## \[2.0.3] + +- [`ed981027`](https://github.com/tauri-apps/plugins-workspace/commit/ed981027dd4fba7d0e2f836eb5db34d344388d73) ([#1962](https://github.com/tauri-apps/plugins-workspace/pull/1962) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Improve performance of `readTextFile` and `readTextFileLines` APIs +- [`3e78173d`](https://github.com/tauri-apps/plugins-workspace/commit/3e78173df9ce90aa3b19e1f36d1f8712c5020fb6) ([#2018](https://github.com/tauri-apps/plugins-workspace/pull/2018) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Fix `readDir` function failing to read directories that contain broken symlinks. +- [`5092ea5e`](https://github.com/tauri-apps/plugins-workspace/commit/5092ea5e89817c0550d09b0a4ad17bf1253b23df) ([#1964](https://github.com/tauri-apps/plugins-workspace/pull/1964) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Add support for using `ReadableStream` with `writeFile` API. + +## \[2.0.2] + +- [`77149dc4`](https://github.com/tauri-apps/plugins-workspace/commit/77149dc4320d26b413e4a6bbe82c654367c51b32) ([#1965](https://github.com/tauri-apps/plugins-workspace/pull/1965) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Fix `writeTextFile` converting UTF-8 characters (for example `äöü`) in the given path into replacement character (`�`) + +## \[2.0.3] + +- [`14cee64c`](https://github.com/tauri-apps/plugins-workspace/commit/14cee64c82a72655ae6a4ac0892736a2959dbda5) ([#1958](https://github.com/tauri-apps/plugins-workspace/pull/1958) by [@bWanShiTong](https://github.com/tauri-apps/plugins-workspace/../../bWanShiTong)) Fix compilation on targets with pointer width of `16` or `32` + +## \[2.0.1] + +- [`ae802456`](https://github.com/tauri-apps/plugins-workspace/commit/ae8024565f074f313084777c8b10d1b5e3bbe220) ([#1950](https://github.com/tauri-apps/plugins-workspace/pull/1950) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Improve performance of the `FileHandle.read` and `writeTextFile` APIs. + +## \[2.0.1] + +- [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7. + +## \[2.0.0] + +- [`e2c4dfb6`](https://github.com/tauri-apps/plugins-workspace/commit/e2c4dfb6af43e5dd8d9ceba232c315f5febd55c1) Update to tauri v2 stable release. + +## \[2.0.0-rc.6] + +- [`fc9b189e`](https://github.com/tauri-apps/plugins-workspace/commit/fc9b189e83a29bd750714ec6336133c6eabdfa20) ([#1837](https://github.com/tauri-apps/plugins-workspace/pull/1837) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Fix failing to deserialize capability file when using an OS specific path in the scope that is not available on the current OS. + +## \[2.0.0-rc.5] + +- [`cc03ccf5`](https://github.com/tauri-apps/plugins-workspace/commit/cc03ccf5e0e4be8bbf50bbdebe957c84be7f779b) ([#1774](https://github.com/tauri-apps/plugins-workspace/pull/1774)) Fix `scope-app`, `scope-app-recursive` and `scope-index` not properly enabling the application paths. + +## \[2.0.0-rc.4] + +- [`9291e4d2`](https://github.com/tauri-apps/plugins-workspace/commit/9291e4d2caa31c883c71e55f2193bd8754d72f03) ([#1640](https://github.com/tauri-apps/plugins-workspace/pull/1640) by [@SRutile](https://github.com/tauri-apps/plugins-workspace/../../SRutile)) Support any UTF-8 character in the writeFile API. + +## \[2.0.0-rc.3] + +- [`a2fe5551`](https://github.com/tauri-apps/plugins-workspace/commit/a2fe55512f908dd11c814ce021d164f01677572a) ([#1727](https://github.com/tauri-apps/plugins-workspace/pull/1727) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Add utility methods on `FilePath` and `SafeFilePath` enums which are: + + - `path` + - `simplified` + - `into_path` +- [`a2fe5551`](https://github.com/tauri-apps/plugins-workspace/commit/a2fe55512f908dd11c814ce021d164f01677572a) ([#1727](https://github.com/tauri-apps/plugins-workspace/pull/1727) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Implement `Serialize`, `Deserialize`, `From`, `TryFrom` and `FromStr` traits for `FilePath` and `SafeFilePath` enums. +- [`a2fe5551`](https://github.com/tauri-apps/plugins-workspace/commit/a2fe55512f908dd11c814ce021d164f01677572a) ([#1727](https://github.com/tauri-apps/plugins-workspace/pull/1727) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Mark `Error` enum as `#[non_exhuastive]`. +- [`a2fe5551`](https://github.com/tauri-apps/plugins-workspace/commit/a2fe55512f908dd11c814ce021d164f01677572a) ([#1727](https://github.com/tauri-apps/plugins-workspace/pull/1727) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Add `SafeFilePath` enum. + +## \[2.0.0-rc.2] + +- [`f7280c88`](https://github.com/tauri-apps/plugins-workspace/commit/f7280c88309cdf1f2330574fec31e26e01e9cdbd) ([#1710](https://github.com/tauri-apps/plugins-workspace/pull/1710) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Fix can't use Windows paths like `C:/Users/UserName/file.txt` + +### bug + +- [`51819c60`](https://github.com/tauri-apps/plugins-workspace/commit/51819c601f863cbfbd11809a1c4cf9df5a20b1e0) ([#1708](https://github.com/tauri-apps/plugins-workspace/pull/1708) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Fixes `writeFile` command implementation on Android. + +## \[2.0.0-rc.2] + +- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri 2.0.0-rc.8 + +## \[2.0.0-rc.1] + +- [`5f689902`](https://github.com/tauri-apps/plugins-workspace/commit/5f68990297f2cefac4220649a469adb7fa94fe1b) ([#1645](https://github.com/tauri-apps/plugins-workspace/pull/1645) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update documentation. + +## \[2.0.0-rc.0] + +- [`9887d1`](https://github.com/tauri-apps/plugins-workspace/commit/9887d14bd0e971c4c0f5c1188fc4005d3fc2e29e) Update to tauri RC. + +## \[2.0.0-beta.8] + +- [`99d6ac0f`](https://github.com/tauri-apps/plugins-workspace/commit/99d6ac0f9506a6a4a1aa59c728157190a7441af6) ([#1606](https://github.com/tauri-apps/plugins-workspace/pull/1606) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) The JS packages now specify the *minimum* `@tauri-apps/api` version instead of a single exact version. +- [`6de87966`](https://github.com/tauri-apps/plugins-workspace/commit/6de87966ecc00ad9d91c25be452f1f46bd2b7e1f) ([#1597](https://github.com/tauri-apps/plugins-workspace/pull/1597) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Update to tauri beta.25. + +## \[2.0.0-beta.7] + +- [`22a17980`](https://github.com/tauri-apps/plugins-workspace/commit/22a17980ff4f6f8c40adb1b8f4ffc6dae2fe7e30) ([#1537](https://github.com/tauri-apps/plugins-workspace/pull/1537) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri beta.24. + +## \[2.0.0-beta.6] + +- [`76daee7a`](https://github.com/tauri-apps/plugins-workspace/commit/76daee7aafece34de3092c86e531cf9eb1138989) ([#1512](https://github.com/tauri-apps/plugins-workspace/pull/1512) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Update to tauri beta.23. + +## \[2.0.0-beta.5] + +- [`9013854f`](https://github.com/tauri-apps/plugins-workspace/commit/9013854f42a49a230b9dbb9d02774765528a923f)([#1382](https://github.com/tauri-apps/plugins-workspace/pull/1382)) Update to tauri beta.22. + +## \[2.0.0-beta.4] + +- [`430bd6f4`](https://github.com/tauri-apps/plugins-workspace/commit/430bd6f4f379bee5d232ae6b098ae131db7f178a)([#1363](https://github.com/tauri-apps/plugins-workspace/pull/1363)) Update to tauri beta.20. + +## \[2.0.0-beta.3] + +- [`bd1ed590`](https://github.com/tauri-apps/plugins-workspace/commit/bd1ed5903ffcce5500310dac1e59e8c67674ef1e)([#1237](https://github.com/tauri-apps/plugins-workspace/pull/1237)) Update to tauri beta.17. + +## \[2.0.0-beta.6] + +- [`b115fd22`](https://github.com/tauri-apps/plugins-workspace/commit/b115fd22e0da073f5d758c13474ec2106cf78163)([#1221](https://github.com/tauri-apps/plugins-workspace/pull/1221)) Fixes an issue that caused the app to freeze when the `dialog`, `fs`, and `persisted-scope` plugins were used together. + +## \[2.0.0-beta.5] + +- [`bb51a41`](https://github.com/tauri-apps/plugins-workspace/commit/bb51a41d67ebf989e8aedf10c4b1a7f9514d1bdf)([#1168](https://github.com/tauri-apps/plugins-workspace/pull/1168)) **Breaking Change:** All apis that return paths to the frontend will now remove the `\\?\` UNC prefix on Windows. +- [`e3d41f4`](https://github.com/tauri-apps/plugins-workspace/commit/e3d41f4011bd3ea3ce281bb38bbe31d3709f8e0f)([#1191](https://github.com/tauri-apps/plugins-workspace/pull/1191)) Internally use the webview scoped resources table instead of the app one, so other webviews can't access other webviews resources. +- [`e3d41f4`](https://github.com/tauri-apps/plugins-workspace/commit/e3d41f4011bd3ea3ce281bb38bbe31d3709f8e0f)([#1191](https://github.com/tauri-apps/plugins-workspace/pull/1191)) Update for tauri 2.0.0-beta.15. + +## \[2.0.0-beta.4] + +- [`9c2fb93`](https://github.com/tauri-apps/plugins-workspace/commit/9c2fb9306ecd3936a2aef56b3c012899036db098) Enhance the scope type to also allow a plain string representing the path to allow or deny. +- [`772f2bc`](https://github.com/tauri-apps/plugins-workspace/commit/772f2bc3495a4f83f1c3e538cbac6d29cbd7d5ef)([#1136](https://github.com/tauri-apps/plugins-workspace/pull/1136)) Update for tauri 2.0.0-beta.14. + +## \[2.0.0-beta.3] + +- [`cb96aa0`](https://github.com/tauri-apps/plugins-workspace/commit/cb96aa06277f7b864952827ec9fb1e74c8a1f761)([#1082](https://github.com/tauri-apps/plugins-workspace/pull/1082)) Fixes `watch` and `watchImmediate` which previously ignored the `baseDir` parameter. +- [`a04ea2f`](https://github.com/tauri-apps/plugins-workspace/commit/a04ea2f38294d5a3987578283badc8eec87a7752)([#1071](https://github.com/tauri-apps/plugins-workspace/pull/1071)) The global API script is now only added to the binary when the `withGlobalTauri` config is true. + +## \[2.0.0-beta.2] + +- [`7358102`](https://github.com/tauri-apps/plugins-workspace/commit/735810237e21504a027a65a7b3c25fd7e594288a)([#1029](https://github.com/tauri-apps/plugins-workspace/pull/1029)) Fix infinite loop on cargo build operations +- [`99bea25`](https://github.com/tauri-apps/plugins-workspace/commit/99bea2559c2c0648c2519c50a18cd124dacef57b)([#1005](https://github.com/tauri-apps/plugins-workspace/pull/1005)) Update to tauri beta.8. + ## \[2.0.0-beta.1] - [`569defb`](https://github.com/tauri-apps/plugins-workspace/commit/569defbe9492e38938554bb7bdc1be9151456d21) Update to tauri beta.4. @@ -48,11 +181,3 @@ ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - /pull/454)) Fix `writeBinaryFile` crashing with `command 'write_binary_file' not found` -- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11. - -## \[2.0.0-alpha.0] - -- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - ae67\`]\(https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! -717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/fs/Cargo.toml b/plugins/fs/Cargo.toml index 3f7cdbf7..b64052b8 100644 --- a/plugins/fs/Cargo.toml +++ b/plugins/fs/Cargo.toml @@ -1,34 +1,49 @@ [package] name = "tauri-plugin-fs" -version = "2.0.0-beta.1" +version = "2.2.1" description = "Access the file system." authors = { workspace = true } license = { workspace = true } edition = { workspace = true } rust-version = { workspace = true } +repository = { workspace = true } links = "tauri-plugin-fs" [package.metadata.docs.rs] -rustc-args = [ "--cfg", "docsrs" ] -rustdoc-args = [ "--cfg", "docsrs" ] +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs"] + +[package.metadata.platforms.support] +windows = { level = "full", notes = "Apps installed via MSI or NSIS in `perMachine` and `both` mode require admin permissions for write access in `$RESOURCES` folder" } +linux = { level = "full", notes = "No write access to `$RESOURCES` folder" } +macos = { level = "full", notes = "No write access to `$RESOURCES` folder" } +android = { level = "partial", notes = "Access is restricted to Application folder by default" } +ios = { level = "partial", notes = "Access is restricted to Application folder by default" } [build-dependencies] -tauri-plugin = { workspace = true, features = [ "build" ] } +tauri-plugin = { workspace = true, features = ["build"] } schemars = { workspace = true } +serde = { workspace = true } +toml = "0.8" +tauri-utils = { workspace = true, features = ["build"] } [dependencies] serde = { workspace = true } serde_json = { workspace = true } -schemars = { workspace = true } serde_repr = "0.1" tauri = { workspace = true } thiserror = { workspace = true } url = { workspace = true } anyhow = "1" -uuid = { version = "1", features = [ "v4" ] } -glob = "0.3" -notify = { version = "6", optional = true, features = [ "serde" ] } -notify-debouncer-full = { version = "0.3", optional = true } +glob = { workspace = true } +# TODO: Remove `serialization-compat-6` in v3 +notify = { version = "8", optional = true, features = [ + "serde", + "serialization-compat-6", +] } +notify-debouncer-full = { version = "0.5", optional = true } +dunce = { workspace = true } +percent-encoding = "2" [features] -watch = [ "notify", "notify-debouncer-full" ] +watch = ["notify", "notify-debouncer-full"] diff --git a/plugins/fs/README.md b/plugins/fs/README.md index 239ff04c..33031177 100644 --- a/plugins/fs/README.md +++ b/plugins/fs/README.md @@ -2,9 +2,17 @@ Access the file system. +| Platform | Supported | +| -------- | --------- | +| Linux | ✓ | +| Windows | ✓ | +| macOS | ✓ | +| Android | ✓ | +| iOS | ✓ | + ## Install -_This plugin requires a Rust version of at least **1.75**_ +_This plugin requires a Rust version of at least **1.77.2**_ There are three general methods of installation that we can recommend. @@ -18,7 +26,7 @@ Install the Core plugin by adding the following to your `Cargo.toml` file: ```toml [dependencies] -tauri-plugin-fs = "2.0.0-beta" +tauri-plugin-fs = "2.0.0" # alternatively with Git: tauri-plugin-fs = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` @@ -46,7 +54,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-fs#v2 First you need to register the core plugin with Tauri: -`src-tauri/src/main.rs` +`src-tauri/src/lib.rs` ```rust fn main() { @@ -60,9 +68,9 @@ fn main() { Afterwards all the plugin's APIs are available through the JavaScript guest bindings: ```javascript -import { metadata } from "@tauri-apps/plugin-fs"; +import { stat } from '@tauri-apps/plugin-fs' -await metadata("/path/to/file"); +await stat('/path/to/file') ``` ## Contributing diff --git a/plugins/fs/SECURITY.md b/plugins/fs/SECURITY.md index 1adc7ebb..838ed670 100644 --- a/plugins/fs/SECURITY.md +++ b/plugins/fs/SECURITY.md @@ -36,7 +36,6 @@ the restrictions imposed by the scope. The scope is defined at compile time in the used permissions but the user or application developer can grant or revoke access to specific files or folders at runtime by modifying the scope state through the runtime authority, if configured during plugin initialization. - ### Security Assumptions - The filesystem access is limited by user permissions @@ -44,7 +43,6 @@ The scope is defined at compile time in the used permissions but the user or app - The scoping mechanism of the Tauri `fs` commands work as intended and has no bypasses - The user or application developer can grant or revoke access to specific files at runtime by modifying the scope - #### Out Of Scope - Exploits in underlying filesystems diff --git a/plugins/barcode-scanner/.gitignore b/plugins/fs/android/.gitignore similarity index 53% rename from plugins/barcode-scanner/.gitignore rename to plugins/fs/android/.gitignore index 1b0b469d..c0f21ec2 100644 --- a/plugins/barcode-scanner/.gitignore +++ b/plugins/fs/android/.gitignore @@ -1 +1,2 @@ +/build /.tauri diff --git a/plugins/fs/android/build.gradle.kts b/plugins/fs/android/build.gradle.kts new file mode 100644 index 00000000..575040aa --- /dev/null +++ b/plugins/fs/android/build.gradle.kts @@ -0,0 +1,45 @@ +plugins { + id("com.android.library") + id("org.jetbrains.kotlin.android") +} + +android { + namespace = "com.plugin.fs" + compileSdk = 34 + + defaultConfig { + minSdk = 21 + targetSdk = 34 + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles("consumer-rules.pro") + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = "1.8" + } +} + +dependencies { + + implementation("androidx.core:core-ktx:1.9.0") + implementation("androidx.appcompat:appcompat:1.6.0") + implementation("com.google.android.material:material:1.7.0") + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test.ext:junit:1.1.5") + androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1") + implementation(project(":tauri-android")) +} diff --git a/plugins/fs/android/proguard-rules.pro b/plugins/fs/android/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/plugins/fs/android/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/plugins/fs/android/settings.gradle b/plugins/fs/android/settings.gradle new file mode 100644 index 00000000..d7782a40 --- /dev/null +++ b/plugins/fs/android/settings.gradle @@ -0,0 +1,31 @@ +pluginManagement { + repositories { + mavenCentral() + gradlePluginPortal() + google() + } + resolutionStrategy { + eachPlugin { + switch (requested.id.id) { + case "com.android.library": + useVersion("8.0.2") + break + case "org.jetbrains.kotlin.android": + useVersion("1.8.20") + break + } + } + } +} + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + mavenCentral() + google() + + } +} + +include ':tauri-android' +project(':tauri-android').projectDir = new File('./.tauri/tauri-api') diff --git a/plugins/fs/android/src/androidTest/java/ExampleInstrumentedTest.kt b/plugins/fs/android/src/androidTest/java/ExampleInstrumentedTest.kt new file mode 100644 index 00000000..c3b473f7 --- /dev/null +++ b/plugins/fs/android/src/androidTest/java/ExampleInstrumentedTest.kt @@ -0,0 +1,28 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +package com.plugin.fs + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("com.plugin.fs", appContext.packageName) + } +} diff --git a/plugins/fs/android/src/main/AndroidManifest.xml b/plugins/fs/android/src/main/AndroidManifest.xml new file mode 100644 index 00000000..9a40236b --- /dev/null +++ b/plugins/fs/android/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/plugins/fs/android/src/main/java/FsPlugin.kt b/plugins/fs/android/src/main/java/FsPlugin.kt new file mode 100644 index 00000000..877fbf4a --- /dev/null +++ b/plugins/fs/android/src/main/java/FsPlugin.kt @@ -0,0 +1,93 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +package com.plugin.fs + +import android.annotation.SuppressLint +import android.app.Activity +import android.content.res.AssetManager.ACCESS_BUFFER +import android.net.Uri +import android.os.ParcelFileDescriptor +import app.tauri.annotation.Command +import app.tauri.annotation.InvokeArg +import app.tauri.annotation.TauriPlugin +import app.tauri.plugin.Invoke +import app.tauri.plugin.JSObject +import app.tauri.plugin.Plugin +import java.io.File +import java.io.FileOutputStream +import java.io.IOException +import java.io.InputStream +import java.io.OutputStream + +@InvokeArg +class WriteTextFileArgs { + val uri: String = "" + val content: String = "" +} + +@InvokeArg +class GetFileDescriptorArgs { + lateinit var uri: String + lateinit var mode: String +} + +@TauriPlugin +class FsPlugin(private val activity: Activity): Plugin(activity) { + @SuppressLint("Recycle") + @Command + fun getFileDescriptor(invoke: Invoke) { + val args = invoke.parseArgs(GetFileDescriptorArgs::class.java) + + val res = JSObject() + + if (args.uri.startsWith(app.tauri.TAURI_ASSETS_DIRECTORY_URI)) { + val path = args.uri.substring(app.tauri.TAURI_ASSETS_DIRECTORY_URI.length) + try { + val fd = activity.assets.openFd(path).parcelFileDescriptor?.detachFd() + res.put("fd", fd) + } catch (e: IOException) { + // if the asset is compressed, we cannot open a file descriptor directly + // so we copy it to the cache and get a fd from there + // this is a lot faster than serializing the file and sending it as invoke response + // because on the Rust side we can leverage the custom protocol IPC and read the file directly + val cacheFile = File(activity.cacheDir, "_assets/$path") + cacheFile.parentFile?.mkdirs() + copyAsset(path, cacheFile) + + val fd = ParcelFileDescriptor.open(cacheFile, ParcelFileDescriptor.parseMode(args.mode)).detachFd() + res.put("fd", fd) + } + } else { + val fd = activity.contentResolver.openAssetFileDescriptor( + Uri.parse(args.uri), + args.mode + )?.parcelFileDescriptor?.detachFd() + res.put("fd", fd) + } + + invoke.resolve(res) + } + + @Throws(IOException::class) + private fun copy(input: InputStream, output: OutputStream) { + val buf = ByteArray(1024) + var len: Int + while ((input.read(buf).also { len = it }) > 0) { + output.write(buf, 0, len) + } + } + + @Throws(IOException::class) + private fun copyAsset(assetPath: String, cacheFile: File) { + val input = activity.assets.open(assetPath, ACCESS_BUFFER) + input.use { i -> + val output = FileOutputStream(cacheFile, false) + output.use { o -> + copy(i, o) + } + } + } +} + diff --git a/plugins/fs/android/src/test/java/ExampleUnitTest.kt b/plugins/fs/android/src/test/java/ExampleUnitTest.kt new file mode 100644 index 00000000..340839a5 --- /dev/null +++ b/plugins/fs/android/src/test/java/ExampleUnitTest.kt @@ -0,0 +1,21 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +package com.plugin.fs + +import org.junit.Test + +import org.junit.Assert.* + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class ExampleUnitTest { + @Test + fun addition_isCorrect() { + assertEquals(4, 2 + 2) + } +} diff --git a/plugins/fs/api-iife.js b/plugins/fs/api-iife.js new file mode 100644 index 00000000..02063a22 --- /dev/null +++ b/plugins/fs/api-iife.js @@ -0,0 +1 @@ +if("__TAURI__"in window){var __TAURI_PLUGIN_FS__=function(t){"use strict";function e(t,e,n,i){if("function"==typeof e||!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(t):i?i.value:e.get(t)}function n(t,e,n,i,o){if("function"==typeof e||!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}var i,o,r,a,s;"function"==typeof SuppressedError&&SuppressedError;const c="__TAURI_TO_IPC_KEY__";class f{constructor(t){i.set(this,void 0),o.set(this,0),r.set(this,[]),a.set(this,void 0),n(this,i,t||(()=>{})),this.id=function(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}((t=>{const s=t.index;if("end"in t)return void(s==e(this,o,"f")?this.cleanupCallback():n(this,a,s));const c=t.message;if(s==e(this,o,"f")){for(e(this,i,"f").call(this,c),n(this,o,e(this,o,"f")+1);e(this,o,"f")in e(this,r,"f");){const t=e(this,r,"f")[e(this,o,"f")];e(this,i,"f").call(this,t),delete e(this,r,"f")[e(this,o,"f")],n(this,o,e(this,o,"f")+1)}e(this,o,"f")===e(this,a,"f")&&this.cleanupCallback()}else e(this,r,"f")[s]=c}))}cleanupCallback(){Reflect.deleteProperty(window,`_${this.id}`)}set onmessage(t){n(this,i,t)}get onmessage(){return e(this,i,"f")}[(i=new WeakMap,o=new WeakMap,r=new WeakMap,a=new WeakMap,c)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[c]()}}async function l(t,e={},n){return window.__TAURI_INTERNALS__.invoke(t,e,n)}class u{get rid(){return e(this,s,"f")}constructor(t){s.set(this,void 0),n(this,s,t)}async close(){return l("plugin:resources|close",{rid:this.rid})}}var p,w;function d(t){return{isFile:t.isFile,isDirectory:t.isDirectory,isSymlink:t.isSymlink,size:t.size,mtime:null!==t.mtime?new Date(t.mtime):null,atime:null!==t.atime?new Date(t.atime):null,birthtime:null!==t.birthtime?new Date(t.birthtime):null,readonly:t.readonly,fileAttributes:t.fileAttributes,dev:t.dev,ino:t.ino,mode:t.mode,nlink:t.nlink,uid:t.uid,gid:t.gid,rdev:t.rdev,blksize:t.blksize,blocks:t.blocks}}s=new WeakMap,t.BaseDirectory=void 0,(p=t.BaseDirectory||(t.BaseDirectory={}))[p.Audio=1]="Audio",p[p.Cache=2]="Cache",p[p.Config=3]="Config",p[p.Data=4]="Data",p[p.LocalData=5]="LocalData",p[p.Document=6]="Document",p[p.Download=7]="Download",p[p.Picture=8]="Picture",p[p.Public=9]="Public",p[p.Video=10]="Video",p[p.Resource=11]="Resource",p[p.Temp=12]="Temp",p[p.AppConfig=13]="AppConfig",p[p.AppData=14]="AppData",p[p.AppLocalData=15]="AppLocalData",p[p.AppCache=16]="AppCache",p[p.AppLog=17]="AppLog",p[p.Desktop=18]="Desktop",p[p.Executable=19]="Executable",p[p.Font=20]="Font",p[p.Home=21]="Home",p[p.Runtime=22]="Runtime",p[p.Template=23]="Template",t.SeekMode=void 0,(w=t.SeekMode||(t.SeekMode={}))[w.Start=0]="Start",w[w.Current=1]="Current",w[w.End=2]="End";class h extends u{async read(t){if(0===t.byteLength)return 0;const e=await l("plugin:fs|read",{rid:this.rid,len:t.byteLength}),n=function(t){const e=new Uint8ClampedArray(t),n=e.byteLength;let i=0;for(let t=0;tt instanceof URL?t.toString():t)),options:n,onEvent:o}),a=new L(r);return()=>{a.close()}}return t.FileHandle=h,t.copyFile=async function(t,e,n){if(t instanceof URL&&"file:"!==t.protocol||e instanceof URL&&"file:"!==e.protocol)throw new TypeError("Must be a file URL.");await l("plugin:fs|copy_file",{fromPath:t instanceof URL?t.toString():t,toPath:e instanceof URL?e.toString():e,options:n})},t.create=async function(t,e){if(t instanceof URL&&"file:"!==t.protocol)throw new TypeError("Must be a file URL.");const n=await l("plugin:fs|create",{path:t instanceof URL?t.toString():t,options:e});return new h(n)},t.exists=async function(t,e){if(t instanceof URL&&"file:"!==t.protocol)throw new TypeError("Must be a file URL.");return await l("plugin:fs|exists",{path:t instanceof URL?t.toString():t,options:e})},t.lstat=async function(t,e){return d(await l("plugin:fs|lstat",{path:t instanceof URL?t.toString():t,options:e}))},t.mkdir=async function(t,e){if(t instanceof URL&&"file:"!==t.protocol)throw new TypeError("Must be a file URL.");await l("plugin:fs|mkdir",{path:t instanceof URL?t.toString():t,options:e})},t.open=y,t.readDir=async function(t,e){if(t instanceof URL&&"file:"!==t.protocol)throw new TypeError("Must be a file URL.");return await l("plugin:fs|read_dir",{path:t instanceof URL?t.toString():t,options:e})},t.readFile=async function(t,e){if(t instanceof URL&&"file:"!==t.protocol)throw new TypeError("Must be a file URL.");const n=await l("plugin:fs|read_file",{path:t instanceof URL?t.toString():t,options:e});return n instanceof ArrayBuffer?new Uint8Array(n):Uint8Array.from(n)},t.readTextFile=async function(t,e){if(t instanceof URL&&"file:"!==t.protocol)throw new TypeError("Must be a file URL.");const n=await l("plugin:fs|read_text_file",{path:t instanceof URL?t.toString():t,options:e}),i=n instanceof ArrayBuffer?n:Uint8Array.from(n);return(new TextDecoder).decode(i)},t.readTextFileLines=async function(t,e){if(t instanceof URL&&"file:"!==t.protocol)throw new TypeError("Must be a file URL.");const n=t instanceof URL?t.toString():t;return await Promise.resolve({path:n,rid:null,async next(){null===this.rid&&(this.rid=await l("plugin:fs|read_text_file_lines",{path:n,options:e}));const t=await l("plugin:fs|read_text_file_lines_next",{rid:this.rid}),i=t instanceof ArrayBuffer?new Uint8Array(t):Uint8Array.from(t),o=1===i[i.byteLength-1];if(o)return this.rid=null,{value:null,done:o};return{value:(new TextDecoder).decode(i.slice(0,i.byteLength)),done:o}},[Symbol.asyncIterator](){return this}})},t.remove=async function(t,e){if(t instanceof URL&&"file:"!==t.protocol)throw new TypeError("Must be a file URL.");await l("plugin:fs|remove",{path:t instanceof URL?t.toString():t,options:e})},t.rename=async function(t,e,n){if(t instanceof URL&&"file:"!==t.protocol||e instanceof URL&&"file:"!==e.protocol)throw new TypeError("Must be a file URL.");await l("plugin:fs|rename",{oldPath:t instanceof URL?t.toString():t,newPath:e instanceof URL?e.toString():e,options:n})},t.size=async function(t){if(t instanceof URL&&"file:"!==t.protocol)throw new TypeError("Must be a file URL.");return await l("plugin:fs|size",{path:t instanceof URL?t.toString():t})},t.stat=async function(t,e){return d(await l("plugin:fs|stat",{path:t instanceof URL?t.toString():t,options:e}))},t.truncate=async function(t,e,n){if(t instanceof URL&&"file:"!==t.protocol)throw new TypeError("Must be a file URL.");await l("plugin:fs|truncate",{path:t instanceof URL?t.toString():t,len:e,options:n})},t.watch=async function(t,e,n){return await R(t,e,{delayMs:2e3,...n})},t.watchImmediate=async function(t,e,n){return await R(t,e,{...n,delayMs:void 0})},t.writeFile=async function(t,e,n){if(t instanceof URL&&"file:"!==t.protocol)throw new TypeError("Must be a file URL.");if(e instanceof ReadableStream){const i=await y(t,n),o=e.getReader();try{for(;;){const{done:t,value:e}=await o.read();if(t)break;await i.write(e)}}finally{o.releaseLock(),await i.close()}}else await l("plugin:fs|write_file",e,{headers:{path:encodeURIComponent(t instanceof URL?t.toString():t),options:JSON.stringify(n)}})},t.writeTextFile=async function(t,e,n){if(t instanceof URL&&"file:"!==t.protocol)throw new TypeError("Must be a file URL.");const i=new TextEncoder;await l("plugin:fs|write_text_file",i.encode(e),{headers:{path:encodeURIComponent(t instanceof URL?t.toString():t),options:JSON.stringify(n)}})},t}({});Object.defineProperty(window.__TAURI__,"fs",{value:__TAURI_PLUGIN_FS__})} diff --git a/plugins/fs/build.rs b/plugins/fs/build.rs index 1901f3a4..47e27003 100644 --- a/plugins/fs/build.rs +++ b/plugins/fs/build.rs @@ -2,12 +2,55 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -use std::{fs::create_dir_all, path::Path}; +use std::{ + fs::create_dir_all, + path::{Path, PathBuf}, +}; + +use tauri_utils::acl::manifest::PermissionFile; #[path = "src/scope.rs"] #[allow(dead_code)] mod scope; +/// FS scope entry. +#[derive(schemars::JsonSchema)] +#[serde(untagged)] +#[allow(unused)] +enum FsScopeEntry { + /// A path that can be accessed by the webview when using the fs APIs. + /// FS scope path pattern. + /// + /// The pattern can start with a variable that resolves to a system base directory. + /// The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, + /// `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, + /// `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, + /// `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`. + Value(PathBuf), + Object { + /// A path that can be accessed by the webview when using the fs APIs. + /// + /// The pattern can start with a variable that resolves to a system base directory. + /// The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, + /// `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, + /// `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, + /// `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`. + path: PathBuf, + }, +} + +// Ensure `FsScopeEntry` and `scope::EntryRaw` is kept in sync +fn _f() { + match scope::EntryRaw::Value(PathBuf::new()) { + scope::EntryRaw::Value(path) => FsScopeEntry::Value(path), + scope::EntryRaw::Object { path } => FsScopeEntry::Object { path }, + }; + match FsScopeEntry::Value(PathBuf::new()) { + FsScopeEntry::Value(path) => scope::EntryRaw::Value(path), + FsScopeEntry::Object { path } => scope::EntryRaw::Object { path }, + }; +} + const BASE_DIR_VARS: &[&str] = &[ "AUDIO", "CACHE", @@ -26,7 +69,6 @@ const BASE_DIR_VARS: &[&str] = &[ "TEMPLATE", "VIDEO", "RESOURCE", - "APP", "LOG", "TEMP", "APPCONFIG", @@ -35,31 +77,33 @@ const BASE_DIR_VARS: &[&str] = &[ "APPCACHE", "APPLOG", ]; -const COMMANDS: &[&str] = &[ - "mkdir", - "create", - "copy_file", - "remove", - "rename", - "truncate", - "ftruncate", - "write", - "write_file", - "write_text_file", - "read_dir", - "read_file", - "read", - "open", - "read_text_file", - "read_text_file_lines", - "read_text_file_lines_next", - "seek", - "stat", - "lstat", - "fstat", - "exists", - "watch", - "unwatch", +const COMMANDS: &[(&str, &[&str])] = &[ + ("mkdir", &[]), + ("create", &[]), + ("copy_file", &[]), + ("remove", &[]), + ("rename", &[]), + ("truncate", &[]), + ("ftruncate", &[]), + ("write", &[]), + ("write_file", &["open", "write"]), + ("write_text_file", &[]), + ("read_dir", &[]), + ("read_file", &[]), + ("read", &[]), + ("open", &[]), + ("read_text_file", &[]), + ("read_text_file_lines", &["read_text_file_lines_next"]), + ("read_text_file_lines_next", &[]), + ("seek", &[]), + ("stat", &[]), + ("lstat", &[]), + ("fstat", &[]), + ("exists", &[]), + ("watch", &[]), + // TODO: Remove this in v3 + ("unwatch", &[]), + ("size", &[]), ]; fn main() { @@ -83,15 +127,19 @@ fn main() { [[permission]] identifier = "scope-{lower}-recursive" -description = "This scope recursive access to the complete `${upper}` folder, including sub directories and files." +description = "This scope permits recursive access to the complete `${upper}` folder, including sub directories and files." +[[permission.scope.allow]] +path = "${upper}" [[permission.scope.allow]] path = "${upper}/**" [[permission]] identifier = "scope-{lower}" -description = "This scope permits access to all files and list content of top level directories in the `${upper}`folder." +description = "This scope permits access to all files and list content of top level directories in the `${upper}` folder." +[[permission.scope.allow]] +path = "${upper}" [[permission.scope.allow]] path = "${upper}/*" @@ -100,7 +148,7 @@ identifier = "scope-{lower}-index" description = "This scope permits to list all files and folders in the `${upper}`folder." [[permission.scope.allow]] -path = "${upper}/" +path = "${upper}" # Sets Section # This section combines the scope elements with enablement of commands @@ -115,7 +163,7 @@ permissions = [ [[set]] identifier = "allow-{lower}-write-recursive" -description = "This allows full recusrive write access to the complete `${upper}` folder, files and subdirectories." +description = "This allows full recursive write access to the complete `${upper}` folder, files and subdirectories." permissions = [ "write-all", "scope-{lower}-recursive" @@ -139,7 +187,7 @@ permissions = [ [[set]] identifier = "allow-{lower}-meta-recursive" -description = "This allows read access to metadata of the `${upper}` folder, including file listing and statistics." +description = "This allows full recursive read access to metadata of the `${upper}` folder, including file listing and statistics." permissions = [ "read-meta", "scope-{lower}-recursive" @@ -147,18 +195,73 @@ permissions = [ [[set]] identifier = "allow-{lower}-meta" -description = "This allows read access to metadata of the `${upper}` folder, including file listing and statistics." +description = "This allows non-recursive read access to metadata of the `${upper}` folder, including file listing and statistics." permissions = [ "read-meta", "scope-{lower}-index" ]"### ); - std::fs::write(base_dirs.join(format!("{lower}.toml")), toml) - .unwrap_or_else(|e| panic!("unable to autogenerate ${upper}: {e}")); + let permission_path = base_dirs.join(format!("{lower}.toml")); + if toml != std::fs::read_to_string(&permission_path).unwrap_or_default() { + std::fs::write(permission_path, toml) + .unwrap_or_else(|e| panic!("unable to autogenerate ${lower}: {e}")); + } } - tauri_plugin::Builder::new(COMMANDS) - .global_scope_schema(schemars::schema_for!(scope::Entry)) - .build(); + tauri_plugin::Builder::new( + &COMMANDS + .iter() + // FIXME: https://docs.rs/crate/tauri-plugin-fs/2.1.0/builds/1571296 + .filter(|c| c.1.is_empty()) + .map(|c| c.0) + .collect::>(), + ) + .global_api_script_path("./api-iife.js") + .global_scope_schema(schemars::schema_for!(FsScopeEntry)) + .android_path("android") + .build(); + + // workaround to include nested permissions as `tauri_plugin` doesn't support it + let permissions_dir = autogenerated.join("commands"); + for (command, nested_commands) in COMMANDS { + if nested_commands.is_empty() { + continue; + } + + let permission_path = permissions_dir.join(format!("{command}.toml")); + + let content = std::fs::read_to_string(&permission_path) + .unwrap_or_else(|_| panic!("failed to read {command}.toml")); + + let mut permission_file = toml::from_str::(&content) + .unwrap_or_else(|_| panic!("failed to deserialize {command}.toml")); + + for p in permission_file + .permission + .iter_mut() + .filter(|p| p.identifier.starts_with("allow")) + { + for c in nested_commands.iter().map(|s| s.to_string()) { + if !p.commands.allow.contains(&c) { + p.commands.allow.push(c); + } + } + } + + let out = toml::to_string_pretty(&permission_file) + .unwrap_or_else(|_| panic!("failed to serialize {command}.toml")); + let out = format!( + r#"# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +{out}"# + ); + + if content != out { + std::fs::write(permission_path, out) + .unwrap_or_else(|_| panic!("failed to write {command}.toml")); + } + } } diff --git a/plugins/fs/guest-js/index.ts b/plugins/fs/guest-js/index.ts index 3d9aca34..b3e49e5c 100644 --- a/plugins/fs/guest-js/index.ts +++ b/plugins/fs/guest-js/index.ts @@ -7,67 +7,78 @@ * * ## Security * - * This module prevents path traversal, not allowing absolute paths or parent dir components - * (i.e. "/usr/path/to/file" or "../path/to/file" paths are not allowed). - * Paths accessed with this API must be relative to one of the {@link BaseDirectory | base directories} - * so if you need access to arbitrary filesystem paths, you must write such logic on the core layer instead. + * This module prevents path traversal, not allowing parent directory accessors to be used + * (i.e. "/usr/path/to/../file" or "../path/to/file" paths are not allowed). + * Paths accessed with this API must be either relative to one of the {@link BaseDirectory | base directories} + * or created with the {@link https://v2.tauri.app/reference/javascript/api/namespacepath/ | path API}. * * The API has a scope configuration that forces you to restrict the paths that can be accessed using glob patterns. * - * The scope configuration is an array of glob patterns describing folder paths that are allowed. - * For instance, this scope configuration only allows accessing files on the - * *databases* folder of the {@link https://beta.tauri.app/2/reference/js/core/namespacepath/#appdatadir | `$APPDATA` directory}: + * The scope configuration is an array of glob patterns describing file/directory paths that are allowed. + * For instance, this scope configuration allows **all** enabled `fs` APIs to (only) access files in the + * *databases* directory of the {@link https://v2.tauri.app/reference/javascript/api/namespacepath/#appdatadir | `$APPDATA` directory}: * ```json * { - * "plugins": { - * "fs": { - * "scope": ["$APPDATA/databases/*"] + * "permissions": [ + * { + * "identifier": "fs:scope", + * "allow": [{ "path": "$APPDATA/databases/*" }] * } - * } + * ] + * } + * ``` + * + * Scopes can also be applied to specific `fs` APIs by using the API's identifier instead of `fs:scope`: + * ```json + * { + * "permissions": [ + * { + * "identifier": "fs:allow-exists", + * "allow": [{ "path": "$APPDATA/databases/*" }] + * } + * ] * } * ``` * - * Notice the use of the `$APPDATA` variable. The value is injected at runtime, resolving to the {@link https://beta.tauri.app/2/reference/js/core/namespacepath/#appdatadir | app data directory}. + * Notice the use of the `$APPDATA` variable. The value is injected at runtime, resolving to the {@link https://v2.tauri.app/reference/javascript/api/namespacepath/#appdatadir | app data directory}. * * The available variables are: - * {@linkcode https://beta.tauri.app/2/reference/js/core/namespacepath/#appconfigdir | $APPCONFIG}, - * {@linkcode https://beta.tauri.app/2/reference/js/core/namespacepath/#appdatadir | $APPDATA}, - * {@linkcode https://beta.tauri.app/2/reference/js/core/namespacepath/#appLocaldatadir | $APPLOCALDATA}, - * {@linkcode https://beta.tauri.app/2/reference/js/core/namespacepath/#appcachedir | $APPCACHE}, - * {@linkcode https://beta.tauri.app/2/reference/js/core/namespacepath/#applogdir | $APPLOG}, - * {@linkcode https://beta.tauri.app/2/reference/js/core/namespacepath/#audiodir | $AUDIO}, - * {@linkcode https://beta.tauri.app/2/reference/js/core/namespacepath/#cachedir | $CACHE}, - * {@linkcode https://beta.tauri.app/2/reference/js/core/namespacepath/#configdir | $CONFIG}, - * {@linkcode https://beta.tauri.app/2/reference/js/core/namespacepath/#datadir | $DATA}, - * {@linkcode https://beta.tauri.app/2/reference/js/core/namespacepath/#localdatadir | $LOCALDATA}, - * {@linkcode https://beta.tauri.app/2/reference/js/core/namespacepath/#desktopdir | $DESKTOP}, - * {@linkcode https://beta.tauri.app/2/reference/js/core/namespacepath/#documentdir | $DOCUMENT}, - * {@linkcode https://beta.tauri.app/2/reference/js/core/namespacepath/#downloaddir | $DOWNLOAD}, - * {@linkcode https://beta.tauri.app/2/reference/js/core/namespacepath/#executabledir | $EXE}, - * {@linkcode https://beta.tauri.app/2/reference/js/core/namespacepath/#fontdir | $FONT}, - * {@linkcode https://beta.tauri.app/2/reference/js/core/namespacepath/#homedir | $HOME}, - * {@linkcode https://beta.tauri.app/2/reference/js/core/namespacepath/#picturedir | $PICTURE}, - * {@linkcode https://beta.tauri.app/2/reference/js/core/namespacepath/#publicdir | $PUBLIC}, - * {@linkcode https://beta.tauri.app/2/reference/js/core/namespacepath/#runtimedir | $RUNTIME}, - * {@linkcode https://beta.tauri.app/2/reference/js/core/namespacepath/#templatedir | $TEMPLATE}, - * {@linkcode https://beta.tauri.app/2/reference/js/core/namespacepath/#videodir | $VIDEO}, - * {@linkcode https://beta.tauri.app/2/reference/js/core/namespacepath/#resourcedir | $RESOURCE}, - * {@linkcode https://beta.tauri.app/2/reference/js/core/namespacepath/#tempdir | $TEMP}. + * {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#appconfigdir | $APPCONFIG}, + * {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#appdatadir | $APPDATA}, + * {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#applocaldatadir | $APPLOCALDATA}, + * {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#appcachedir | $APPCACHE}, + * {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#applogdir | $APPLOG}, + * {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#audiodir | $AUDIO}, + * {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#cachedir | $CACHE}, + * {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#configdir | $CONFIG}, + * {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#datadir | $DATA}, + * {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#localdatadir | $LOCALDATA}, + * {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#desktopdir | $DESKTOP}, + * {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#documentdir | $DOCUMENT}, + * {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#downloaddir | $DOWNLOAD}, + * {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#executabledir | $EXE}, + * {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#fontdir | $FONT}, + * {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#homedir | $HOME}, + * {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#picturedir | $PICTURE}, + * {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#publicdir | $PUBLIC}, + * {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#runtimedir | $RUNTIME}, + * {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#templatedir | $TEMPLATE}, + * {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#videodir | $VIDEO}, + * {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#resourcedir | $RESOURCE}, + * {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#tempdir | $TEMP}. * * Trying to execute any API with a URL not configured on the scope results in a promise rejection due to denied access. * - * Note that this scope applies to **all** APIs on this module. - * * @module */ -import { BaseDirectory } from "@tauri-apps/api/path"; -import { Channel, invoke, Resource } from "@tauri-apps/api/core"; +import { BaseDirectory } from '@tauri-apps/api/path' +import { Channel, invoke, Resource } from '@tauri-apps/api/core' enum SeekMode { Start = 0, Current = 1, - End = 2, + End = 2 } /** @@ -80,41 +91,41 @@ interface FileInfo { * True if this is info for a regular file. Mutually exclusive to * `FileInfo.isDirectory` and `FileInfo.isSymlink`. */ - isFile: boolean; + isFile: boolean /** * True if this is info for a regular directory. Mutually exclusive to * `FileInfo.isFile` and `FileInfo.isSymlink`. */ - isDirectory: boolean; + isDirectory: boolean /** * True if this is info for a symlink. Mutually exclusive to * `FileInfo.isFile` and `FileInfo.isDirectory`. */ - isSymlink: boolean; + isSymlink: boolean /** * The size of the file, in bytes. */ - size: number; + size: number /** * The last modification time of the file. This corresponds to the `mtime` * field from `stat` on Linux/Mac OS and `ftLastWriteTime` on Windows. This * may not be available on all platforms. */ - mtime: Date | null; + mtime: Date | null /** * The last access time of the file. This corresponds to the `atime` * field from `stat` on Unix and `ftLastAccessTime` on Windows. This may not * be available on all platforms. */ - atime: Date | null; + atime: Date | null /** * The creation time of the file. This corresponds to the `birthtime` * field from `stat` on Mac/BSD and `ftCreationTime` on Windows. This may * not be available on all platforms. */ - birthtime: Date | null; + birthtime: Date | null /** Whether this is a readonly (unwritable) file. */ - readonly: boolean; + readonly: boolean /** * This field contains the file system attribute information for a file * or directory. For possible values and their descriptions, see @@ -124,7 +135,7 @@ interface FileInfo { * * - **macOS / Linux / Android / iOS:** Unsupported. */ - fileAttributes: number | null; + fileAttributes: number | null /** * ID of the device containing the file. * @@ -132,7 +143,7 @@ interface FileInfo { * * - **Windows:** Unsupported. */ - dev: number | null; + dev: number | null /** * Inode number. * @@ -140,7 +151,7 @@ interface FileInfo { * * - **Windows:** Unsupported. */ - ino: number | null; + ino: number | null /** * The underlying raw `st_mode` bits that contain the standard Unix * permissions for this file/directory. @@ -149,7 +160,7 @@ interface FileInfo { * * - **Windows:** Unsupported. */ - mode: number | null; + mode: number | null /** * Number of hard links pointing to this file. * @@ -157,7 +168,7 @@ interface FileInfo { * * - **Windows:** Unsupported. */ - nlink: number | null; + nlink: number | null /** * User ID of the owner of this file. * @@ -165,7 +176,7 @@ interface FileInfo { * * - **Windows:** Unsupported. */ - uid: number | null; + uid: number | null /** * Group ID of the owner of this file. * @@ -173,7 +184,7 @@ interface FileInfo { * * - **Windows:** Unsupported. */ - gid: number | null; + gid: number | null /** * Device ID of this file. * @@ -181,7 +192,7 @@ interface FileInfo { * * - **Windows:** Unsupported. */ - rdev: number | null; + rdev: number | null /** * Blocksize for filesystem I/O. * @@ -189,7 +200,7 @@ interface FileInfo { * * - **Windows:** Unsupported. */ - blksize: number | null; + blksize: number | null /** * Number of blocks allocated to the file, in 512-byte units. * @@ -197,28 +208,28 @@ interface FileInfo { * * - **Windows:** Unsupported. */ - blocks: number | null; + blocks: number | null } interface UnparsedFileInfo { - isFile: boolean; - isDirectory: boolean; - isSymlink: boolean; - size: number; - mtime: number | null; - atime: number | null; - birthtime: number | null; - readonly: boolean; - fileAttributes: number; - dev: number | null; - ino: number | null; - mode: number | null; - nlink: number | null; - uid: number | null; - gid: number | null; - rdev: number | null; - blksize: number | null; - blocks: number | null; + isFile: boolean + isDirectory: boolean + isSymlink: boolean + size: number + mtime: number | null + atime: number | null + birthtime: number | null + readonly: boolean + fileAttributes: number + dev: number | null + ino: number | null + mode: number | null + nlink: number | null + uid: number | null + gid: number | null + rdev: number | null + blksize: number | null + blocks: number | null } function parseFileInfo(r: UnparsedFileInfo): FileInfo { return { @@ -226,9 +237,9 @@ function parseFileInfo(r: UnparsedFileInfo): FileInfo { isDirectory: r.isDirectory, isSymlink: r.isSymlink, size: r.size, - mtime: r.mtime != null ? new Date(r.mtime) : null, - atime: r.atime != null ? new Date(r.atime) : null, - birthtime: r.birthtime != null ? new Date(r.birthtime) : null, + mtime: r.mtime !== null ? new Date(r.mtime) : null, + atime: r.atime !== null ? new Date(r.atime) : null, + birthtime: r.birthtime !== null ? new Date(r.birthtime) : null, readonly: r.readonly, fileAttributes: r.fileAttributes, dev: r.dev, @@ -239,8 +250,28 @@ function parseFileInfo(r: UnparsedFileInfo): FileInfo { gid: r.gid, rdev: r.rdev, blksize: r.blksize, - blocks: r.blocks, - }; + blocks: r.blocks + } +} + +// https://mstn.github.io/2018/06/08/fixed-size-arrays-in-typescript/ +type FixedSizeArray = ReadonlyArray & { + length: N +} + +// https://gist.github.com/zapthedingbat/38ebfbedd98396624e5b5f2ff462611d +/** Converts a big-endian eight byte array to number */ +function fromBytes(buffer: FixedSizeArray): number { + const bytes = new Uint8ClampedArray(buffer) + const size = bytes.byteLength + let x = 0 + for (let i = 0; i < size; i++) { + // eslint-disable-next-line security/detect-object-injection + const byte = bytes[i] + x *= 0x100 + x += byte + } + return x } /** @@ -249,10 +280,6 @@ function parseFileInfo(r: UnparsedFileInfo): FileInfo { * @since 2.0.0 */ class FileHandle extends Resource { - constructor(rid: number) { - super(rid); - } - /** * Reads up to `p.byteLength` bytes into `p`. It resolves to the number of * bytes read (`0` < `n` <= `p.byteLength`) and rejects if any error @@ -273,30 +300,38 @@ class FileHandle extends Resource { * * @example * ```typescript - * import { open, read, close, BaseDirectory } from "@tauri-apps/plugin-fs" - * // if "$APP/foo/bar.txt" contains the text "hello world": - * const file = await open("foo/bar.txt", { baseDir: BaseDirectory.App }); + * import { open, BaseDirectory } from "@tauri-apps/plugin-fs" + * // if "$APPCONFIG/foo/bar.txt" contains the text "hello world": + * const file = await open("foo/bar.txt", { baseDir: BaseDirectory.AppConfig }); * const buf = new Uint8Array(100); * const numberOfBytesRead = await file.read(buf); // 11 bytes * const text = new TextDecoder().decode(buf); // "hello world" - * await close(file.rid); + * await file.close(); * ``` * * @since 2.0.0 */ async read(buffer: Uint8Array): Promise { if (buffer.byteLength === 0) { - return 0; + return 0 } - const [data, nread] = await invoke<[number[], number]>("plugin:fs|read", { + const data = await invoke('plugin:fs|read', { rid: this.rid, - len: buffer.byteLength, - }); + len: buffer.byteLength + }) + + // Rust side will never return an empty array for this command and + // ensure there is at least 8 elements there. + // + // This is an optimization to include the number of read bytes (as bigendian bytes) + // at the end of returned array to avoid serialization overhead of separate values. + const nread = fromBytes(data.slice(-8) as FixedSizeArray) - buffer.set(data); + const bytes = data instanceof ArrayBuffer ? new Uint8Array(data) : data + buffer.set(bytes.slice(0, bytes.length - 8)) - return nread === 0 ? null : nread; + return nread === 0 ? null : nread } /** @@ -313,11 +348,11 @@ class FileHandle extends Resource { * * @example * ```typescript - * import { open, seek, write, SeekMode, BaseDirectory } from '@tauri-apps/plugin-fs'; + * import { open, SeekMode, BaseDirectory } from '@tauri-apps/plugin-fs'; * * // Given hello.txt pointing to file with "Hello world", which is 11 bytes long: - * const file = await open('hello.txt', { read: true, write: true, truncate: true, create: true, baseDir: BaseDirectory.App }); - * await file.write(new TextEncoder().encode("Hello world"), { baseDir: BaseDirectory.App }); + * const file = await open('hello.txt', { read: true, write: true, truncate: true, create: true, baseDir: BaseDirectory.AppLocalData }); + * await file.write(new TextEncoder().encode("Hello world")); * * // Seek 6 bytes from the start of the file * console.log(await file.seek(6, SeekMode.Start)); // "6" @@ -325,16 +360,18 @@ class FileHandle extends Resource { * console.log(await file.seek(2, SeekMode.Current)); // "8" * // Seek backwards 2 bytes from the end of the file * console.log(await file.seek(-2, SeekMode.End)); // "9" (e.g. 11-2) + * + * await file.close(); * ``` * * @since 2.0.0 */ async seek(offset: number, whence: SeekMode): Promise { - return invoke("plugin:fs|seek", { + return await invoke('plugin:fs|seek', { rid: this.rid, offset, - whence, - }); + whence + }) } /** @@ -342,20 +379,21 @@ class FileHandle extends Resource { * * @example * ```typescript - * import { open, fstat, BaseDirectory } from '@tauri-apps/plugin-fs'; - * const file = await open("file.txt", { read: true, baseDir: BaseDirectory.App }); - * const fileInfo = await fstat(file.rid); + * import { open, BaseDirectory } from '@tauri-apps/plugin-fs'; + * const file = await open("file.txt", { read: true, baseDir: BaseDirectory.AppLocalData }); + * const fileInfo = await file.stat(); * console.log(fileInfo.isFile); // true + * await file.close(); * ``` * * @since 2.0.0 */ async stat(): Promise { - const res = await invoke("plugin:fs|fstat", { - rid: this.rid, - }); + const res = await invoke('plugin:fs|fstat', { + rid: this.rid + }) - return parseFileInfo(res); + return parseFileInfo(res) } /** @@ -364,55 +402,56 @@ class FileHandle extends Resource { * * @example * ```typescript - * import { ftruncate, open, write, read, BaseDirectory } from '@tauri-apps/plugin-fs'; + * import { open, BaseDirectory } from '@tauri-apps/plugin-fs'; * * // truncate the entire file - * const file = await open("my_file.txt", { read: true, write: true, create: true, baseDir: BaseDirectory.App }); - * await ftruncate(file.rid); + * const file = await open("my_file.txt", { read: true, write: true, create: true, baseDir: BaseDirectory.AppLocalData }); + * await file.truncate(); * * // truncate part of the file - * const file = await open("my_file.txt", { read: true, write: true, create: true, baseDir: BaseDirectory.App }); - * await write(file.rid, new TextEncoder().encode("Hello World")); - * await ftruncate(file.rid, 7); + * const file = await open("my_file.txt", { read: true, write: true, create: true, baseDir: BaseDirectory.AppLocalData }); + * await file.write(new TextEncoder().encode("Hello World")); + * await file.truncate(7); * const data = new Uint8Array(32); - * await read(file.rid, data); + * await file.read(data); * console.log(new TextDecoder().decode(data)); // Hello W + * await file.close(); * ``` * * @since 2.0.0 */ async truncate(len?: number): Promise { - return invoke("plugin:fs|ftruncate", { + await invoke('plugin:fs|ftruncate', { rid: this.rid, - len, - }); + len + }) } /** - * Writes `p.byteLength` bytes from `p` to the underlying data stream. It - * resolves to the number of bytes written from `p` (`0` <= `n` <= - * `p.byteLength`) or reject with the error encountered that caused the + * Writes `data.byteLength` bytes from `data` to the underlying data stream. It + * resolves to the number of bytes written from `data` (`0` <= `n` <= + * `data.byteLength`) or reject with the error encountered that caused the * write to stop early. `write()` must reject with a non-null error if - * would resolve to `n` < `p.byteLength`. `write()` must not modify the + * would resolve to `n` < `data.byteLength`. `write()` must not modify the * slice data, even temporarily. * * @example * ```typescript - * import { open, write, close, BaseDirectory } from '@tauri-apps/plugin-fs'; + * import { open, write, BaseDirectory } from '@tauri-apps/plugin-fs'; * const encoder = new TextEncoder(); * const data = encoder.encode("Hello world"); - * const file = await open("bar.txt", { write: true, baseDir: BaseDirectory.App }); - * const bytesWritten = await write(file.rid, data); // 11 - * await close(file.rid); + * const file = await open("bar.txt", { write: true, baseDir: BaseDirectory.AppLocalData }); + * const bytesWritten = await file.write(data); // 11 + * await file.close(); * ``` * * @since 2.0.0 */ async write(data: Uint8Array): Promise { - return invoke("plugin:fs|write", { + return await invoke('plugin:fs|write', { rid: this.rid, - data: Array.from(data), - }); + data + }) } } @@ -421,7 +460,7 @@ class FileHandle extends Resource { */ interface CreateOptions { /** Base directory for `path` */ - baseDir?: BaseDirectory; + baseDir?: BaseDirectory } /** @@ -431,25 +470,27 @@ interface CreateOptions { * @example * ```typescript * import { create, BaseDirectory } from "@tauri-apps/plugin-fs" - * const file = await create("foo/bar.txt", { baseDir: BaseDirectory.App }); + * const file = await create("foo/bar.txt", { baseDir: BaseDirectory.AppConfig }); + * await file.write(new TextEncoder().encode("Hello world")); + * await file.close(); * ``` * * @since 2.0.0 */ async function create( path: string | URL, - options?: CreateOptions, + options?: CreateOptions ): Promise { - if (path instanceof URL && path.protocol !== "file:") { - throw new TypeError("Must be a file URL."); + if (path instanceof URL && path.protocol !== 'file:') { + throw new TypeError('Must be a file URL.') } - const rid = await invoke("plugin:fs|create", { + const rid = await invoke('plugin:fs|create', { path: path instanceof URL ? path.toString() : path, - options, - }); + options + }) - return new FileHandle(rid); + return new FileHandle(rid) } /** @@ -460,49 +501,49 @@ interface OpenOptions { * Sets the option for read access. This option, when `true`, means that the * file should be read-able if opened. */ - read?: boolean; + read?: boolean /** * Sets the option for write access. This option, when `true`, means that * the file should be write-able if opened. If the file already exists, * any write calls on it will overwrite its contents, by default without * truncating it. */ - write?: boolean; + write?: boolean /** * Sets the option for the append mode. This option, when `true`, means that * writes will append to a file instead of overwriting previous contents. * Note that setting `{ write: true, append: true }` has the same effect as * setting only `{ append: true }`. */ - append?: boolean; + append?: boolean /** * Sets the option for truncating a previous file. If a file is * successfully opened with this option set it will truncate the file to `0` * size if it already exists. The file must be opened with write access * for truncate to work. */ - truncate?: boolean; + truncate?: boolean /** * Sets the option to allow creating a new file, if one doesn't already * exist at the specified path. Requires write or append access to be * used. */ - create?: boolean; + create?: boolean /** * Defaults to `false`. If set to `true`, no file, directory, or symlink is * allowed to exist at the target location. Requires write or append * access to be used. When createNew is set to `true`, create and truncate * are ignored. */ - createNew?: boolean; + createNew?: boolean /** * Permissions to use if creating the file (defaults to `0o666`, before * the process's umask). * Ignored on Windows. */ - mode?: number; + mode?: number /** Base directory for `path` */ - baseDir?: BaseDirectory; + baseDir?: BaseDirectory } /** @@ -514,27 +555,27 @@ interface OpenOptions { * @example * ```typescript * import { open, BaseDirectory } from "@tauri-apps/plugin-fs" - * const file = await open("foo/bar.txt", { read: true, write: true, baseDir: BaseDirectory.App }); + * const file = await open("foo/bar.txt", { read: true, write: true, baseDir: BaseDirectory.AppLocalData }); * // Do work with file - * await close(file.rid); + * await file.close(); * ``` * * @since 2.0.0 */ async function open( path: string | URL, - options?: OpenOptions, + options?: OpenOptions ): Promise { - if (path instanceof URL && path.protocol !== "file:") { - throw new TypeError("Must be a file URL."); + if (path instanceof URL && path.protocol !== 'file:') { + throw new TypeError('Must be a file URL.') } - const rid = await invoke("plugin:fs|open", { + const rid = await invoke('plugin:fs|open', { path: path instanceof URL ? path.toString() : path, - options, - }); + options + }) - return new FileHandle(rid); + return new FileHandle(rid) } /** @@ -542,9 +583,9 @@ async function open( */ interface CopyFileOptions { /** Base directory for `fromPath`. */ - fromPathBaseDir?: BaseDirectory; + fromPathBaseDir?: BaseDirectory /** Base directory for `toPath`. */ - toPathBaseDir?: BaseDirectory; + toPathBaseDir?: BaseDirectory } /** @@ -552,7 +593,7 @@ interface CopyFileOptions { * @example * ```typescript * import { copyFile, BaseDirectory } from '@tauri-apps/plugin-fs'; - * await copyFile('app.conf', 'app.conf.bk', { fromPathBaseDir: BaseDirectory.App, toPathBaseDir: BaseDirectory.App }); + * await copyFile('app.conf', 'app.conf.bk', { fromPathBaseDir: BaseDirectory.AppConfig, toPathBaseDir: BaseDirectory.AppConfig }); * ``` * * @since 2.0.0 @@ -560,20 +601,20 @@ interface CopyFileOptions { async function copyFile( fromPath: string | URL, toPath: string | URL, - options?: CopyFileOptions, + options?: CopyFileOptions ): Promise { if ( - (fromPath instanceof URL && fromPath.protocol !== "file:") || - (toPath instanceof URL && toPath.protocol !== "file:") + (fromPath instanceof URL && fromPath.protocol !== 'file:') + || (toPath instanceof URL && toPath.protocol !== 'file:') ) { - throw new TypeError("Must be a file URL."); + throw new TypeError('Must be a file URL.') } - return invoke("plugin:fs|copy_file", { + await invoke('plugin:fs|copy_file', { fromPath: fromPath instanceof URL ? fromPath.toString() : fromPath, toPath: toPath instanceof URL ? toPath.toString() : toPath, - options, - }); + options + }) } /** @@ -581,13 +622,13 @@ async function copyFile( */ interface MkdirOptions { /** Permissions to use when creating the directory (defaults to `0o777`, before the process's umask). Ignored on Windows. */ - mode?: number; + mode?: number /** * Defaults to `false`. If set to `true`, means that any intermediate directories will also be created (as with the shell command `mkdir -p`). * */ - recursive?: boolean; + recursive?: boolean /** Base directory for `path` */ - baseDir?: BaseDirectory; + baseDir?: BaseDirectory } /** @@ -595,23 +636,23 @@ interface MkdirOptions { * @example * ```typescript * import { mkdir, BaseDirectory } from '@tauri-apps/plugin-fs'; - * await mkdir('users', { baseDir: BaseDirectory.App }); + * await mkdir('users', { baseDir: BaseDirectory.AppLocalData }); * ``` * * @since 2.0.0 */ async function mkdir( path: string | URL, - options?: MkdirOptions, + options?: MkdirOptions ): Promise { - if (path instanceof URL && path.protocol !== "file:") { - throw new TypeError("Must be a file URL."); + if (path instanceof URL && path.protocol !== 'file:') { + throw new TypeError('Must be a file URL.') } - return invoke("plugin:fs|mkdir", { + await invoke('plugin:fs|mkdir', { path: path instanceof URL ? path.toString() : path, - options, - }); + options + }) } /** @@ -619,7 +660,7 @@ async function mkdir( */ interface ReadDirOptions { /** Base directory for `path` */ - baseDir?: BaseDirectory; + baseDir?: BaseDirectory } /** @@ -631,13 +672,13 @@ interface ReadDirOptions { */ interface DirEntry { /** The name of the entry (file name with extension or directory name). */ - name: string; + name: string /** Specifies whether this entry is a directory or not. */ - isDirectory: boolean; + isDirectory: boolean /** Specifies whether this entry is a file or not. */ - isFile: boolean; + isFile: boolean /** Specifies whether this entry is a symlink or not. */ - isSymlink: boolean; + isSymlink: boolean } /** @@ -645,15 +686,16 @@ interface DirEntry { * @example * ```typescript * import { readDir, BaseDirectory } from '@tauri-apps/plugin-fs'; + * import { join } from '@tauri-apps/api/path'; * const dir = "users" - * const entries = await readDir('users', { baseDir: BaseDirectory.App }); - * processEntriesRecursive(dir, entries); - * async function processEntriesRecursive(parent, entries) { + * const entries = await readDir('users', { baseDir: BaseDirectory.AppLocalData }); + * processEntriesRecursively(dir, entries); + * async function processEntriesRecursively(parent, entries) { * for (const entry of entries) { * console.log(`Entry: ${entry.name}`); * if (entry.isDirectory) { - * const dir = parent + entry.name; - * processEntriesRecursive(dir, await readDir(dir, { baseDir: BaseDirectory.App })) + * const dir = await join(parent, entry.name); + * processEntriesRecursively(dir, await readDir(dir, { baseDir: BaseDirectory.AppLocalData })) * } * } * } @@ -663,16 +705,16 @@ interface DirEntry { */ async function readDir( path: string | URL, - options?: ReadDirOptions, + options?: ReadDirOptions ): Promise { - if (path instanceof URL && path.protocol !== "file:") { - throw new TypeError("Must be a file URL."); + if (path instanceof URL && path.protocol !== 'file:') { + throw new TypeError('Must be a file URL.') } - return invoke("plugin:fs|read_dir", { + return await invoke('plugin:fs|read_dir', { path: path instanceof URL ? path.toString() : path, - options, - }); + options + }) } /** @@ -680,7 +722,7 @@ async function readDir( */ interface ReadFileOptions { /** Base directory for `path` */ - baseDir?: BaseDirectory; + baseDir?: BaseDirectory } /** @@ -696,18 +738,18 @@ interface ReadFileOptions { */ async function readFile( path: string | URL, - options?: ReadFileOptions, + options?: ReadFileOptions ): Promise { - if (path instanceof URL && path.protocol !== "file:") { - throw new TypeError("Must be a file URL."); + if (path instanceof URL && path.protocol !== 'file:') { + throw new TypeError('Must be a file URL.') } - const arr = await invoke("plugin:fs|read_file", { + const arr = await invoke('plugin:fs|read_file', { path: path instanceof URL ? path.toString() : path, - options, - }); + options + }) - return Uint8Array.from(arr); + return arr instanceof ArrayBuffer ? new Uint8Array(arr) : Uint8Array.from(arr) } /** @@ -715,23 +757,27 @@ async function readFile( * @example * ```typescript * import { readTextFile, BaseDirectory } from '@tauri-apps/plugin-fs'; - * const contents = await readTextFile('app.conf', { baseDir: BaseDirectory.App }); + * const contents = await readTextFile('app.conf', { baseDir: BaseDirectory.AppConfig }); * ``` * * @since 2.0.0 */ async function readTextFile( path: string | URL, - options?: ReadFileOptions, + options?: ReadFileOptions ): Promise { - if (path instanceof URL && path.protocol !== "file:") { - throw new TypeError("Must be a file URL."); + if (path instanceof URL && path.protocol !== 'file:') { + throw new TypeError('Must be a file URL.') } - return invoke("plugin:fs|read_text_file", { + const arr = await invoke('plugin:fs|read_text_file', { path: path instanceof URL ? path.toString() : path, - options, - }); + options + }) + + const bytes = arr instanceof ArrayBuffer ? arr : Uint8Array.from(arr) + + return new TextDecoder().decode(bytes) } /** @@ -739,7 +785,7 @@ async function readTextFile( * @example * ```typescript * import { readTextFileLines, BaseDirectory } from '@tauri-apps/plugin-fs'; - * const lines = await readTextFileLines('app.conf', { baseDir: BaseDirectory.App }); + * const lines = await readTextFileLines('app.conf', { baseDir: BaseDirectory.AppConfig }); * for await (const line of lines) { * console.log(line); * } @@ -751,42 +797,59 @@ async function readTextFile( */ async function readTextFileLines( path: string | URL, - options?: ReadFileOptions, + options?: ReadFileOptions ): Promise> { - if (path instanceof URL && path.protocol !== "file:") { - throw new TypeError("Must be a file URL."); + if (path instanceof URL && path.protocol !== 'file:') { + throw new TypeError('Must be a file URL.') } - const pathStr = path instanceof URL ? path.toString() : path; + const pathStr = path instanceof URL ? path.toString() : path - return Promise.resolve({ + return await Promise.resolve({ path: pathStr, rid: null as number | null, + async next(): Promise> { - if (!this.rid) { - this.rid = await invoke("plugin:fs|read_text_file_lines", { + if (this.rid === null) { + this.rid = await invoke('plugin:fs|read_text_file_lines', { path: pathStr, - options, - }); + options + }) } - const [line, done] = await invoke<[string | null, boolean]>( - "plugin:fs|read_text_file_lines_next", - { rid: this.rid }, - ); + const arr = await invoke( + 'plugin:fs|read_text_file_lines_next', + { rid: this.rid } + ) + + const bytes = + arr instanceof ArrayBuffer ? new Uint8Array(arr) : Uint8Array.from(arr) + + // Rust side will never return an empty array for this command and + // ensure there is at least one elements there. + // + // This is an optimization to include whether we finished iteration or not (1 or 0) + // at the end of returned array to avoid serialization overhead of separate values. + const done = bytes[bytes.byteLength - 1] === 1 + + if (done) { + // a full iteration is over, reset rid for next iteration + this.rid = null + return { value: null, done } + } - // an iteration is over, reset rid for next iteration - if (done) this.rid = null; + const line = new TextDecoder().decode(bytes.slice(0, bytes.byteLength)) return { - value: done ? "" : (line as string), - done, - }; + value: line, + done + } }, + [Symbol.asyncIterator](): AsyncIterableIterator { - return this; - }, - }); + return this + } + }) } /** @@ -794,9 +857,9 @@ async function readTextFileLines( */ interface RemoveOptions { /** Defaults to `false`. If set to `true`, path will be removed even if it's a non-empty directory. */ - recursive?: boolean; + recursive?: boolean /** Base directory for `path` */ - baseDir?: BaseDirectory; + baseDir?: BaseDirectory } /** @@ -805,24 +868,24 @@ interface RemoveOptions { * @example * ```typescript * import { remove, BaseDirectory } from '@tauri-apps/plugin-fs'; - * await remove('users/file.txt', { baseDir: BaseDirectory.App }); - * await remove('users', { baseDir: BaseDirectory.App }); + * await remove('users/file.txt', { baseDir: BaseDirectory.AppLocalData }); + * await remove('users', { baseDir: BaseDirectory.AppLocalData }); * ``` * * @since 2.0.0 */ async function remove( path: string | URL, - options?: RemoveOptions, + options?: RemoveOptions ): Promise { - if (path instanceof URL && path.protocol !== "file:") { - throw new TypeError("Must be a file URL."); + if (path instanceof URL && path.protocol !== 'file:') { + throw new TypeError('Must be a file URL.') } - return invoke("plugin:fs|remove", { + await invoke('plugin:fs|remove', { path: path instanceof URL ? path.toString() : path, - options, - }); + options + }) } /** @@ -830,9 +893,9 @@ async function remove( */ interface RenameOptions { /** Base directory for `oldPath`. */ - oldPathBaseDir?: BaseDirectory; + oldPathBaseDir?: BaseDirectory /** Base directory for `newPath`. */ - newPathBaseDir?: BaseDirectory; + newPathBaseDir?: BaseDirectory } /** @@ -845,7 +908,7 @@ interface RenameOptions { * @example * ```typescript * import { rename, BaseDirectory } from '@tauri-apps/plugin-fs'; - * await rename('avatar.png', 'deleted.png', { oldPathBaseDir: BaseDirectory.App, newPathBaseDir: BaseDirectory.App }); + * await rename('avatar.png', 'deleted.png', { oldPathBaseDir: BaseDirectory.App, newPathBaseDir: BaseDirectory.AppLocalData }); * ``` * * @since 2.0.0 @@ -853,20 +916,20 @@ interface RenameOptions { async function rename( oldPath: string | URL, newPath: string | URL, - options?: RenameOptions, + options?: RenameOptions ): Promise { if ( - (oldPath instanceof URL && oldPath.protocol !== "file:") || - (newPath instanceof URL && newPath.protocol !== "file:") + (oldPath instanceof URL && oldPath.protocol !== 'file:') + || (newPath instanceof URL && newPath.protocol !== 'file:') ) { - throw new TypeError("Must be a file URL."); + throw new TypeError('Must be a file URL.') } - return invoke("plugin:fs|rename", { + await invoke('plugin:fs|rename', { oldPath: oldPath instanceof URL ? oldPath.toString() : oldPath, newPath: newPath instanceof URL ? newPath.toString() : newPath, - options, - }); + options + }) } /** @@ -874,7 +937,7 @@ async function rename( */ interface StatOptions { /** Base directory for `path`. */ - baseDir?: BaseDirectory; + baseDir?: BaseDirectory } /** @@ -884,7 +947,7 @@ interface StatOptions { * @example * ```typescript * import { stat, BaseDirectory } from '@tauri-apps/plugin-fs'; - * const fileInfo = await stat("hello.txt", { baseDir: BaseDirectory.App }); + * const fileInfo = await stat("hello.txt", { baseDir: BaseDirectory.AppLocalData }); * console.log(fileInfo.isFile); // true * ``` * @@ -892,14 +955,14 @@ interface StatOptions { */ async function stat( path: string | URL, - options?: StatOptions, + options?: StatOptions ): Promise { - const res = await invoke("plugin:fs|stat", { + const res = await invoke('plugin:fs|stat', { path: path instanceof URL ? path.toString() : path, - options, - }); + options + }) - return parseFileInfo(res); + return parseFileInfo(res) } /** @@ -910,7 +973,7 @@ async function stat( * @example * ```typescript * import { lstat, BaseDirectory } from '@tauri-apps/plugin-fs'; - * const fileInfo = await lstat("hello.txt", { baseDir: BaseDirectory.App }); + * const fileInfo = await lstat("hello.txt", { baseDir: BaseDirectory.AppLocalData }); * console.log(fileInfo.isFile); // true * ``` * @@ -918,14 +981,14 @@ async function stat( */ async function lstat( path: string | URL, - options?: StatOptions, + options?: StatOptions ): Promise { - const res = await invoke("plugin:fs|lstat", { + const res = await invoke('plugin:fs|lstat', { path: path instanceof URL ? path.toString() : path, - options, - }); + options + }) - return parseFileInfo(res); + return parseFileInfo(res) } /** @@ -933,7 +996,7 @@ async function lstat( */ interface TruncateOptions { /** Base directory for `path`. */ - baseDir?: BaseDirectory; + baseDir?: BaseDirectory } /** @@ -942,16 +1005,16 @@ interface TruncateOptions { * * @example * ```typescript - * import { truncate, readFile, writeFile, BaseDirectory } from '@tauri-apps/plugin-fs'; + * import { truncate, readTextFile, writeTextFile, BaseDirectory } from '@tauri-apps/plugin-fs'; * // truncate the entire file - * await truncate("my_file.txt", 0, { baseDir: BaseDirectory.App }); + * await truncate("my_file.txt", 0, { baseDir: BaseDirectory.AppLocalData }); * * // truncate part of the file - * let file = "file.txt"; - * await writeFile(file, new TextEncoder().encode("Hello World"), { baseDir: BaseDirectory.App }); - * await truncate(file, 7); - * const data = await readFile(file, { baseDir: BaseDirectory.App }); - * console.log(new TextDecoder().decode(data)); // "Hello W" + * const filePath = "file.txt"; + * await writeTextFile(filePath, "Hello World", { baseDir: BaseDirectory.AppLocalData }); + * await truncate(filePath, 7, { baseDir: BaseDirectory.AppLocalData }); + * const data = await readTextFile(filePath, { baseDir: BaseDirectory.AppLocalData }); + * console.log(data); // "Hello W" * ``` * * @since 2.0.0 @@ -959,17 +1022,17 @@ interface TruncateOptions { async function truncate( path: string | URL, len?: number, - options?: TruncateOptions, + options?: TruncateOptions ): Promise { - if (path instanceof URL && path.protocol !== "file:") { - throw new TypeError("Must be a file URL."); + if (path instanceof URL && path.protocol !== 'file:') { + throw new TypeError('Must be a file URL.') } - return invoke("plugin:fs|truncate", { + await invoke('plugin:fs|truncate', { path: path instanceof URL ? path.toString() : path, len, - options, - }); + options + }) } /** @@ -977,15 +1040,15 @@ async function truncate( */ interface WriteFileOptions { /** Defaults to `false`. If set to `true`, will append to a file instead of overwriting previous contents. */ - append?: boolean; + append?: boolean /** Sets the option to allow creating a new file, if one doesn't already exist at the specified path (defaults to `true`). */ - create?: boolean; + create?: boolean /** Sets the option to create a new file, failing if it already exists. */ - createNew?: boolean; + createNew?: boolean /** File permissions. Ignored on Windows. */ - mode?: number; + mode?: number /** Base directory for `path` */ - baseDir?: BaseDirectory; + baseDir?: BaseDirectory } /** @@ -996,25 +1059,42 @@ interface WriteFileOptions { * * let encoder = new TextEncoder(); * let data = encoder.encode("Hello World"); - * await writeFile('file.txt', data, { baseDir: BaseDirectory.App }); + * await writeFile('file.txt', data, { baseDir: BaseDirectory.AppLocalData }); * ``` * * @since 2.0.0 */ async function writeFile( path: string | URL, - data: Uint8Array, - options?: WriteFileOptions, + data: Uint8Array | ReadableStream, + options?: WriteFileOptions ): Promise { - if (path instanceof URL && path.protocol !== "file:") { - throw new TypeError("Must be a file URL."); + if (path instanceof URL && path.protocol !== 'file:') { + throw new TypeError('Must be a file URL.') } - return invoke("plugin:fs|write_file", { - path: path instanceof URL ? path.toString() : path, - data: Array.from(data), - options, - }); + if (data instanceof ReadableStream) { + const file = await open(path, options) + const reader = data.getReader() + + try { + while (true) { + const { done, value } = await reader.read() + if (done) break + await file.write(value) + } + } finally { + reader.releaseLock() + await file.close() + } + } else { + await invoke('plugin:fs|write_file', data, { + headers: { + path: encodeURIComponent(path instanceof URL ? path.toString() : path), + options: JSON.stringify(options) + } + }) + } } /** @@ -1023,7 +1103,7 @@ async function writeFile( * ```typescript * import { writeTextFile, BaseDirectory } from '@tauri-apps/plugin-fs'; * - * await writeTextFile('file.txt', "Hello world", { baseDir: BaseDirectory.App }); + * await writeTextFile('file.txt', "Hello world", { baseDir: BaseDirectory.AppLocalData }); * ``` * * @since 2.0.0 @@ -1031,17 +1111,20 @@ async function writeFile( async function writeTextFile( path: string | URL, data: string, - options?: WriteFileOptions, + options?: WriteFileOptions ): Promise { - if (path instanceof URL && path.protocol !== "file:") { - throw new TypeError("Must be a file URL."); + if (path instanceof URL && path.protocol !== 'file:') { + throw new TypeError('Must be a file URL.') } - return invoke("plugin:fs|write_text_file", { - path: path instanceof URL ? path.toString() : path, - data, - options, - }); + const encoder = new TextEncoder() + + await invoke('plugin:fs|write_text_file', encoder.encode(data), { + headers: { + path: encodeURIComponent(path instanceof URL ? path.toString() : path), + options: JSON.stringify(options) + } + }) } /** @@ -1049,7 +1132,7 @@ async function writeTextFile( */ interface ExistsOptions { /** Base directory for `path`. */ - baseDir?: BaseDirectory; + baseDir?: BaseDirectory } /** @@ -1065,16 +1148,16 @@ interface ExistsOptions { */ async function exists( path: string | URL, - options?: ExistsOptions, + options?: ExistsOptions ): Promise { - if (path instanceof URL && path.protocol !== "file:") { - throw new TypeError("Must be a file URL."); + if (path instanceof URL && path.protocol !== 'file:') { + throw new TypeError('Must be a file URL.') } - return invoke("plugin:fs|exists", { + return await invoke('plugin:fs|exists', { path: path instanceof URL ? path.toString() : path, - options, - }); + options + }) } /** @@ -1082,9 +1165,9 @@ async function exists( */ interface WatchOptions { /** Watch a directory recursively */ - recursive?: boolean; + recursive?: boolean /** Base directory for `path` */ - baseDir?: BaseDirectory; + baseDir?: BaseDirectory } /** @@ -1092,123 +1175,131 @@ interface WatchOptions { */ interface DebouncedWatchOptions extends WatchOptions { /** Debounce delay */ - delayMs?: number; + delayMs?: number } /** * @since 2.0.0 */ -type WatchEvent = { - type: WatchEventKind; - paths: string[]; - attrs: unknown; -}; +interface WatchEvent { + type: WatchEventKind + paths: string[] + attrs: unknown +} /** * @since 2.0.0 */ type WatchEventKind = - | "any" + | 'any' | { access: WatchEventKindAccess } | { create: WatchEventKindCreate } | { modify: WatchEventKindModify } | { remove: WatchEventKindRemove } - | "other"; + | 'other' /** * @since 2.0.0 */ type WatchEventKindAccess = - | { kind: "any" } - | { kind: "close"; mode: "any" | "execute" | "read" | "write" | "other" } - | { kind: "open"; mode: "any" | "execute" | "read" | "write" | "other" } - | { kind: "other" }; + | { kind: 'any' } + | { kind: 'close'; mode: 'any' | 'execute' | 'read' | 'write' | 'other' } + | { kind: 'open'; mode: 'any' | 'execute' | 'read' | 'write' | 'other' } + | { kind: 'other' } /** * @since 2.0.0 */ type WatchEventKindCreate = - | { kind: "any" } - | { kind: "file" } - | { kind: "folder" } - | { kind: "other" }; + | { kind: 'any' } + | { kind: 'file' } + | { kind: 'folder' } + | { kind: 'other' } /** * @since 2.0.0 */ type WatchEventKindModify = - | { kind: "any" } - | { kind: "data"; mode: "any" | "size" | "content" | "other" } + | { kind: 'any' } + | { kind: 'data'; mode: 'any' | 'size' | 'content' | 'other' } | { - kind: "metadata"; + kind: 'metadata' mode: - | "any" - | "access-time" - | "write-time" - | "permissions" - | "ownership" - | "extended" - | "other"; + | 'any' + | 'access-time' + | 'write-time' + | 'permissions' + | 'ownership' + | 'extended' + | 'other' } - | { kind: "rename"; mode: "any" | "to" | "from" | "both" | "other" } - | { kind: "other" }; + | { kind: 'rename'; mode: 'any' | 'to' | 'from' | 'both' | 'other' } + | { kind: 'other' } /** * @since 2.0.0 */ type WatchEventKindRemove = - | { kind: "any" } - | { kind: "file" } - | { kind: "folder" } - | { kind: "other" }; + | { kind: 'any' } + | { kind: 'file' } + | { kind: 'folder' } + | { kind: 'other' } +// TODO: Remove this in v3, return `Watcher` instead /** * @since 2.0.0 */ -type UnwatchFn = () => void; +type UnwatchFn = () => void -async function unwatch(rid: number): Promise { - await invoke("plugin:fs|unwatch", { rid }); -} +class Watcher extends Resource {} -/** - * Watch changes (after a delay) on files or directories. - * - * @since 2.0.0 - */ -async function watch( +async function watchInternal( paths: string | string[] | URL | URL[], cb: (event: WatchEvent) => void, - options?: DebouncedWatchOptions, + options: DebouncedWatchOptions ): Promise { - const opts = { - recursive: false, - delayMs: 2000, - ...options, - }; - - const watchPaths = Array.isArray(paths) ? paths : [paths]; + const watchPaths = Array.isArray(paths) ? paths : [paths] for (const path of watchPaths) { - if (path instanceof URL && path.protocol !== "file:") { - throw new TypeError("Must be a file URL."); + if (path instanceof URL && path.protocol !== 'file:') { + throw new TypeError('Must be a file URL.') } } - const onEvent = new Channel(); - onEvent.onmessage = cb; + const onEvent = new Channel() + onEvent.onmessage = cb - const rid: number = await invoke("plugin:fs|watch", { + const rid: number = await invoke('plugin:fs|watch', { paths: watchPaths.map((p) => (p instanceof URL ? p.toString() : p)), - options: opts, - onEvent, - }); + options, + onEvent + }) + + const watcher = new Watcher(rid) return () => { - void unwatch(rid); - }; + void watcher.close() + } } +// TODO: Return `Watcher` instead in v3 +/** + * Watch changes (after a delay) on files or directories. + * + * @since 2.0.0 + */ +async function watch( + paths: string | string[] | URL | URL[], + cb: (event: WatchEvent) => void, + options?: DebouncedWatchOptions +): Promise { + return await watchInternal(paths, cb, { + delayMs: 2000, + ...options + }) +} + +// TODO: Return `Watcher` instead in v3 /** * Watch changes on files or directories. * @@ -1217,34 +1308,37 @@ async function watch( async function watchImmediate( paths: string | string[] | URL | URL[], cb: (event: WatchEvent) => void, - options?: WatchOptions, + options?: WatchOptions ): Promise { - const opts = { - recursive: false, + return await watchInternal(paths, cb, { ...options, - delayMs: null, - }; - - const watchPaths = Array.isArray(paths) ? paths : [paths]; + delayMs: undefined + }) +} - for (const path of watchPaths) { - if (path instanceof URL && path.protocol !== "file:") { - throw new TypeError("Must be a file URL."); - } +/** + * Get the size of a file or directory. For files, the `stat` functions can be used as well. + * + * If `path` is a directory, this function will recursively iterate over every file and every directory inside of `path` and therefore will be very time consuming if used on larger directories. + * + * @example + * ```typescript + * import { size, BaseDirectory } from '@tauri-apps/plugin-fs'; + * // Get the size of the `$APPDATA/tauri` directory. + * const dirSize = await size('tauri', { baseDir: BaseDirectory.AppData }); + * console.log(dirSize); // 1024 + * ``` + * + * @since 2.1.0 + */ +async function size(path: string | URL): Promise { + if (path instanceof URL && path.protocol !== 'file:') { + throw new TypeError('Must be a file URL.') } - const onEvent = new Channel(); - onEvent.onmessage = cb; - - const rid: number = await invoke("plugin:fs|watch", { - paths: watchPaths.map((p) => (p instanceof URL ? p.toString() : p)), - options: opts, - onEvent, - }); - - return () => { - void unwatch(rid); - }; + return await invoke('plugin:fs|size', { + path: path instanceof URL ? path.toString() : path + }) } export type { @@ -1270,8 +1364,8 @@ export type { WatchEventKindCreate, WatchEventKindModify, WatchEventKindRemove, - UnwatchFn, -}; + UnwatchFn +} export { BaseDirectory, @@ -1295,4 +1389,5 @@ export { exists, watch, watchImmediate, -}; + size +} diff --git a/plugins/fs/package.json b/plugins/fs/package.json index 1dc2a0da..47d9fe34 100644 --- a/plugins/fs/package.json +++ b/plugins/fs/package.json @@ -1,11 +1,12 @@ { "name": "@tauri-apps/plugin-fs", - "version": "2.0.0-beta.1", + "version": "2.2.1", "description": "Access the file system.", - "license": "MIT or APACHE-2.0", + "license": "MIT OR Apache-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" ], + "repository": "https://github.com/tauri-apps/plugins-workspace", "type": "module", "types": "./dist-js/index.d.ts", "main": "./dist-js/index.cjs", @@ -24,6 +25,6 @@ "LICENSE" ], "dependencies": { - "@tauri-apps/api": "2.0.0-beta.2" + "@tauri-apps/api": "^2.0.0" } } diff --git a/plugins/fs/permissions/app.toml b/plugins/fs/permissions/app.toml new file mode 100644 index 00000000..aeb0521b --- /dev/null +++ b/plugins/fs/permissions/app.toml @@ -0,0 +1,114 @@ +"$schema" = "schemas/schema.json" + +# Scopes Section +# This section contains scopes, which define file level access + +[[permission]] +identifier = "scope-app-recursive" +description = "This scope permits recursive access to the complete application folders, including sub directories and files." + +[[permission.scope.allow]] +path = "$APPCONFIG" +[[permission.scope.allow]] +path = "$APPCONFIG/**" + +[[permission.scope.allow]] +path = "$APPDATA" +[[permission.scope.allow]] +path = "$APPDATA/**" + +[[permission.scope.allow]] +path = "$APPLOCALDATA" +[[permission.scope.allow]] +path = "$APPLOCALDATA/**" + +[[permission.scope.allow]] +path = "$APPCACHE" +[[permission.scope.allow]] +path = "$APPCACHE/**" + +[[permission.scope.allow]] +path = "$APPLOG" +[[permission.scope.allow]] +path = "$APPLOG/**" + +[[permission]] +identifier = "scope-app" +description = "This scope permits access to all files and list content of top level directories in the application folders." + +[[permission.scope.allow]] +path = "$APPCONFIG" +[[permission.scope.allow]] +path = "$APPCONFIG/*" + +[[permission.scope.allow]] +path = "$APPDATA" +[[permission.scope.allow]] +path = "$APPDATA/*" + +[[permission.scope.allow]] +path = "$APPLOCALDATA" +[[permission.scope.allow]] +path = "$APPLOCALDATA/*" + +[[permission.scope.allow]] +path = "$APPCACHE" +[[permission.scope.allow]] +path = "$APPCACHE/*" + +[[permission.scope.allow]] +path = "$APPLOG" +[[permission.scope.allow]] +path = "$APPLOG/*" + +[[permission]] +identifier = "scope-app-index" +description = "This scope permits to list all files and folders in the application directories." + +[[permission.scope.allow]] +path = "$APPCONFIG" + +[[permission.scope.allow]] +path = "$APPDATA" + +[[permission.scope.allow]] +path = "$APPLOCALDATA" + +[[permission.scope.allow]] +path = "$APPCACHE" + +[[permission.scope.allow]] +path = "$APPLOG" + +# Sets Section +# This section combines the scope elements with enablement of commands + +[[set]] +identifier = "allow-app-read-recursive" +description = "This allows full recursive read access to the complete application folders, files and subdirectories." +permissions = ["read-all", "scope-app-recursive"] + +[[set]] +identifier = "allow-app-write-recursive" +description = "This allows full recursive write access to the complete application folders, files and subdirectories." +permissions = ["write-all", "scope-app-recursive"] + +[[set]] +identifier = "allow-app-read" +description = "This allows non-recursive read access to the application folders." +permissions = ["read-all", "scope-app"] + +[[set]] +identifier = "allow-app-write" +description = "This allows non-recursive write access to the application folders." +permissions = ["write-all", "scope-app"] + +[[set]] +identifier = "allow-app-meta-recursive" +description = "This allows full recursive read access to metadata of the application folders, including file listing and statistics." +permissions = ["read-meta", "scope-app-recursive"] + +[[set]] +identifier = "allow-app-meta" +description = "This allows non-recursive read access to metadata of the application folders, including file listing and statistics." +permissions = ["read-meta", "scope-app-index"] diff --git a/plugins/fs/permissions/autogenerated/base-directories/app.toml b/plugins/fs/permissions/autogenerated/base-directories/app.toml deleted file mode 100644 index 37eaadcf..00000000 --- a/plugins/fs/permissions/autogenerated/base-directories/app.toml +++ /dev/null @@ -1,78 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -# Scopes Section -# This section contains scopes, which define file level access - -[[permission]] -identifier = "scope-app-recursive" -description = "This scope recursive access to the complete `$APP` folder, including sub directories and files." - -[[permission.scope.allow]] -path = "$APP/**" - -[[permission]] -identifier = "scope-app" -description = "This scope permits access to all files and list content of top level directories in the `$APP`folder." - -[[permission.scope.allow]] -path = "$APP/*" - -[[permission]] -identifier = "scope-app-index" -description = "This scope permits to list all files and folders in the `$APP`folder." - -[[permission.scope.allow]] -path = "$APP/" - -# Sets Section -# This section combines the scope elements with enablement of commands - -[[set]] -identifier = "allow-app-read-recursive" -description = "This allows full recursive read access to the complete `$APP` folder, files and subdirectories." -permissions = [ - "read-all", - "scope-app-recursive" -] - -[[set]] -identifier = "allow-app-write-recursive" -description = "This allows full recusrive write access to the complete `$APP` folder, files and subdirectories." -permissions = [ - "write-all", - "scope-app-recursive" -] - -[[set]] -identifier = "allow-app-read" -description = "This allows non-recursive read access to the `$APP` folder." -permissions = [ - "read-all", - "scope-app" -] - -[[set]] -identifier = "allow-app-write" -description = "This allows non-recursive write access to the `$APP` folder." -permissions = [ - "write-all", - "scope-app" -] - -[[set]] -identifier = "allow-app-meta-recursive" -description = "This allows read access to metadata of the `$APP` folder, including file listing and statistics." -permissions = [ - "read-meta", - "scope-app-recursive" -] - -[[set]] -identifier = "allow-app-meta" -description = "This allows read access to metadata of the `$APP` folder, including file listing and statistics." -permissions = [ - "read-meta", - "scope-app-index" -] \ No newline at end of file diff --git a/plugins/fs/permissions/autogenerated/base-directories/appcache.toml b/plugins/fs/permissions/autogenerated/base-directories/appcache.toml index 4deca0ff..50e19efc 100644 --- a/plugins/fs/permissions/autogenerated/base-directories/appcache.toml +++ b/plugins/fs/permissions/autogenerated/base-directories/appcache.toml @@ -7,15 +7,19 @@ [[permission]] identifier = "scope-appcache-recursive" -description = "This scope recursive access to the complete `$APPCACHE` folder, including sub directories and files." +description = "This scope permits recursive access to the complete `$APPCACHE` folder, including sub directories and files." +[[permission.scope.allow]] +path = "$APPCACHE" [[permission.scope.allow]] path = "$APPCACHE/**" [[permission]] identifier = "scope-appcache" -description = "This scope permits access to all files and list content of top level directories in the `$APPCACHE`folder." +description = "This scope permits access to all files and list content of top level directories in the `$APPCACHE` folder." +[[permission.scope.allow]] +path = "$APPCACHE" [[permission.scope.allow]] path = "$APPCACHE/*" @@ -24,7 +28,7 @@ identifier = "scope-appcache-index" description = "This scope permits to list all files and folders in the `$APPCACHE`folder." [[permission.scope.allow]] -path = "$APPCACHE/" +path = "$APPCACHE" # Sets Section # This section combines the scope elements with enablement of commands @@ -39,7 +43,7 @@ permissions = [ [[set]] identifier = "allow-appcache-write-recursive" -description = "This allows full recusrive write access to the complete `$APPCACHE` folder, files and subdirectories." +description = "This allows full recursive write access to the complete `$APPCACHE` folder, files and subdirectories." permissions = [ "write-all", "scope-appcache-recursive" @@ -63,7 +67,7 @@ permissions = [ [[set]] identifier = "allow-appcache-meta-recursive" -description = "This allows read access to metadata of the `$APPCACHE` folder, including file listing and statistics." +description = "This allows full recursive read access to metadata of the `$APPCACHE` folder, including file listing and statistics." permissions = [ "read-meta", "scope-appcache-recursive" @@ -71,7 +75,7 @@ permissions = [ [[set]] identifier = "allow-appcache-meta" -description = "This allows read access to metadata of the `$APPCACHE` folder, including file listing and statistics." +description = "This allows non-recursive read access to metadata of the `$APPCACHE` folder, including file listing and statistics." permissions = [ "read-meta", "scope-appcache-index" diff --git a/plugins/fs/permissions/autogenerated/base-directories/appconfig.toml b/plugins/fs/permissions/autogenerated/base-directories/appconfig.toml index e87229a7..ab136956 100644 --- a/plugins/fs/permissions/autogenerated/base-directories/appconfig.toml +++ b/plugins/fs/permissions/autogenerated/base-directories/appconfig.toml @@ -7,15 +7,19 @@ [[permission]] identifier = "scope-appconfig-recursive" -description = "This scope recursive access to the complete `$APPCONFIG` folder, including sub directories and files." +description = "This scope permits recursive access to the complete `$APPCONFIG` folder, including sub directories and files." +[[permission.scope.allow]] +path = "$APPCONFIG" [[permission.scope.allow]] path = "$APPCONFIG/**" [[permission]] identifier = "scope-appconfig" -description = "This scope permits access to all files and list content of top level directories in the `$APPCONFIG`folder." +description = "This scope permits access to all files and list content of top level directories in the `$APPCONFIG` folder." +[[permission.scope.allow]] +path = "$APPCONFIG" [[permission.scope.allow]] path = "$APPCONFIG/*" @@ -24,7 +28,7 @@ identifier = "scope-appconfig-index" description = "This scope permits to list all files and folders in the `$APPCONFIG`folder." [[permission.scope.allow]] -path = "$APPCONFIG/" +path = "$APPCONFIG" # Sets Section # This section combines the scope elements with enablement of commands @@ -39,7 +43,7 @@ permissions = [ [[set]] identifier = "allow-appconfig-write-recursive" -description = "This allows full recusrive write access to the complete `$APPCONFIG` folder, files and subdirectories." +description = "This allows full recursive write access to the complete `$APPCONFIG` folder, files and subdirectories." permissions = [ "write-all", "scope-appconfig-recursive" @@ -63,7 +67,7 @@ permissions = [ [[set]] identifier = "allow-appconfig-meta-recursive" -description = "This allows read access to metadata of the `$APPCONFIG` folder, including file listing and statistics." +description = "This allows full recursive read access to metadata of the `$APPCONFIG` folder, including file listing and statistics." permissions = [ "read-meta", "scope-appconfig-recursive" @@ -71,7 +75,7 @@ permissions = [ [[set]] identifier = "allow-appconfig-meta" -description = "This allows read access to metadata of the `$APPCONFIG` folder, including file listing and statistics." +description = "This allows non-recursive read access to metadata of the `$APPCONFIG` folder, including file listing and statistics." permissions = [ "read-meta", "scope-appconfig-index" diff --git a/plugins/fs/permissions/autogenerated/base-directories/appdata.toml b/plugins/fs/permissions/autogenerated/base-directories/appdata.toml index fc080b3a..1b0931e2 100644 --- a/plugins/fs/permissions/autogenerated/base-directories/appdata.toml +++ b/plugins/fs/permissions/autogenerated/base-directories/appdata.toml @@ -7,15 +7,19 @@ [[permission]] identifier = "scope-appdata-recursive" -description = "This scope recursive access to the complete `$APPDATA` folder, including sub directories and files." +description = "This scope permits recursive access to the complete `$APPDATA` folder, including sub directories and files." +[[permission.scope.allow]] +path = "$APPDATA" [[permission.scope.allow]] path = "$APPDATA/**" [[permission]] identifier = "scope-appdata" -description = "This scope permits access to all files and list content of top level directories in the `$APPDATA`folder." +description = "This scope permits access to all files and list content of top level directories in the `$APPDATA` folder." +[[permission.scope.allow]] +path = "$APPDATA" [[permission.scope.allow]] path = "$APPDATA/*" @@ -24,7 +28,7 @@ identifier = "scope-appdata-index" description = "This scope permits to list all files and folders in the `$APPDATA`folder." [[permission.scope.allow]] -path = "$APPDATA/" +path = "$APPDATA" # Sets Section # This section combines the scope elements with enablement of commands @@ -39,7 +43,7 @@ permissions = [ [[set]] identifier = "allow-appdata-write-recursive" -description = "This allows full recusrive write access to the complete `$APPDATA` folder, files and subdirectories." +description = "This allows full recursive write access to the complete `$APPDATA` folder, files and subdirectories." permissions = [ "write-all", "scope-appdata-recursive" @@ -63,7 +67,7 @@ permissions = [ [[set]] identifier = "allow-appdata-meta-recursive" -description = "This allows read access to metadata of the `$APPDATA` folder, including file listing and statistics." +description = "This allows full recursive read access to metadata of the `$APPDATA` folder, including file listing and statistics." permissions = [ "read-meta", "scope-appdata-recursive" @@ -71,7 +75,7 @@ permissions = [ [[set]] identifier = "allow-appdata-meta" -description = "This allows read access to metadata of the `$APPDATA` folder, including file listing and statistics." +description = "This allows non-recursive read access to metadata of the `$APPDATA` folder, including file listing and statistics." permissions = [ "read-meta", "scope-appdata-index" diff --git a/plugins/fs/permissions/autogenerated/base-directories/applocaldata.toml b/plugins/fs/permissions/autogenerated/base-directories/applocaldata.toml index f72202a2..a6e38a31 100644 --- a/plugins/fs/permissions/autogenerated/base-directories/applocaldata.toml +++ b/plugins/fs/permissions/autogenerated/base-directories/applocaldata.toml @@ -7,15 +7,19 @@ [[permission]] identifier = "scope-applocaldata-recursive" -description = "This scope recursive access to the complete `$APPLOCALDATA` folder, including sub directories and files." +description = "This scope permits recursive access to the complete `$APPLOCALDATA` folder, including sub directories and files." +[[permission.scope.allow]] +path = "$APPLOCALDATA" [[permission.scope.allow]] path = "$APPLOCALDATA/**" [[permission]] identifier = "scope-applocaldata" -description = "This scope permits access to all files and list content of top level directories in the `$APPLOCALDATA`folder." +description = "This scope permits access to all files and list content of top level directories in the `$APPLOCALDATA` folder." +[[permission.scope.allow]] +path = "$APPLOCALDATA" [[permission.scope.allow]] path = "$APPLOCALDATA/*" @@ -24,7 +28,7 @@ identifier = "scope-applocaldata-index" description = "This scope permits to list all files and folders in the `$APPLOCALDATA`folder." [[permission.scope.allow]] -path = "$APPLOCALDATA/" +path = "$APPLOCALDATA" # Sets Section # This section combines the scope elements with enablement of commands @@ -39,7 +43,7 @@ permissions = [ [[set]] identifier = "allow-applocaldata-write-recursive" -description = "This allows full recusrive write access to the complete `$APPLOCALDATA` folder, files and subdirectories." +description = "This allows full recursive write access to the complete `$APPLOCALDATA` folder, files and subdirectories." permissions = [ "write-all", "scope-applocaldata-recursive" @@ -63,7 +67,7 @@ permissions = [ [[set]] identifier = "allow-applocaldata-meta-recursive" -description = "This allows read access to metadata of the `$APPLOCALDATA` folder, including file listing and statistics." +description = "This allows full recursive read access to metadata of the `$APPLOCALDATA` folder, including file listing and statistics." permissions = [ "read-meta", "scope-applocaldata-recursive" @@ -71,7 +75,7 @@ permissions = [ [[set]] identifier = "allow-applocaldata-meta" -description = "This allows read access to metadata of the `$APPLOCALDATA` folder, including file listing and statistics." +description = "This allows non-recursive read access to metadata of the `$APPLOCALDATA` folder, including file listing and statistics." permissions = [ "read-meta", "scope-applocaldata-index" diff --git a/plugins/fs/permissions/autogenerated/base-directories/applog.toml b/plugins/fs/permissions/autogenerated/base-directories/applog.toml index e345bef8..a979ce76 100644 --- a/plugins/fs/permissions/autogenerated/base-directories/applog.toml +++ b/plugins/fs/permissions/autogenerated/base-directories/applog.toml @@ -7,15 +7,19 @@ [[permission]] identifier = "scope-applog-recursive" -description = "This scope recursive access to the complete `$APPLOG` folder, including sub directories and files." +description = "This scope permits recursive access to the complete `$APPLOG` folder, including sub directories and files." +[[permission.scope.allow]] +path = "$APPLOG" [[permission.scope.allow]] path = "$APPLOG/**" [[permission]] identifier = "scope-applog" -description = "This scope permits access to all files and list content of top level directories in the `$APPLOG`folder." +description = "This scope permits access to all files and list content of top level directories in the `$APPLOG` folder." +[[permission.scope.allow]] +path = "$APPLOG" [[permission.scope.allow]] path = "$APPLOG/*" @@ -24,7 +28,7 @@ identifier = "scope-applog-index" description = "This scope permits to list all files and folders in the `$APPLOG`folder." [[permission.scope.allow]] -path = "$APPLOG/" +path = "$APPLOG" # Sets Section # This section combines the scope elements with enablement of commands @@ -39,7 +43,7 @@ permissions = [ [[set]] identifier = "allow-applog-write-recursive" -description = "This allows full recusrive write access to the complete `$APPLOG` folder, files and subdirectories." +description = "This allows full recursive write access to the complete `$APPLOG` folder, files and subdirectories." permissions = [ "write-all", "scope-applog-recursive" @@ -63,7 +67,7 @@ permissions = [ [[set]] identifier = "allow-applog-meta-recursive" -description = "This allows read access to metadata of the `$APPLOG` folder, including file listing and statistics." +description = "This allows full recursive read access to metadata of the `$APPLOG` folder, including file listing and statistics." permissions = [ "read-meta", "scope-applog-recursive" @@ -71,7 +75,7 @@ permissions = [ [[set]] identifier = "allow-applog-meta" -description = "This allows read access to metadata of the `$APPLOG` folder, including file listing and statistics." +description = "This allows non-recursive read access to metadata of the `$APPLOG` folder, including file listing and statistics." permissions = [ "read-meta", "scope-applog-index" diff --git a/plugins/fs/permissions/autogenerated/base-directories/audio.toml b/plugins/fs/permissions/autogenerated/base-directories/audio.toml index adb15d93..d66d68a2 100644 --- a/plugins/fs/permissions/autogenerated/base-directories/audio.toml +++ b/plugins/fs/permissions/autogenerated/base-directories/audio.toml @@ -7,15 +7,19 @@ [[permission]] identifier = "scope-audio-recursive" -description = "This scope recursive access to the complete `$AUDIO` folder, including sub directories and files." +description = "This scope permits recursive access to the complete `$AUDIO` folder, including sub directories and files." +[[permission.scope.allow]] +path = "$AUDIO" [[permission.scope.allow]] path = "$AUDIO/**" [[permission]] identifier = "scope-audio" -description = "This scope permits access to all files and list content of top level directories in the `$AUDIO`folder." +description = "This scope permits access to all files and list content of top level directories in the `$AUDIO` folder." +[[permission.scope.allow]] +path = "$AUDIO" [[permission.scope.allow]] path = "$AUDIO/*" @@ -24,7 +28,7 @@ identifier = "scope-audio-index" description = "This scope permits to list all files and folders in the `$AUDIO`folder." [[permission.scope.allow]] -path = "$AUDIO/" +path = "$AUDIO" # Sets Section # This section combines the scope elements with enablement of commands @@ -39,7 +43,7 @@ permissions = [ [[set]] identifier = "allow-audio-write-recursive" -description = "This allows full recusrive write access to the complete `$AUDIO` folder, files and subdirectories." +description = "This allows full recursive write access to the complete `$AUDIO` folder, files and subdirectories." permissions = [ "write-all", "scope-audio-recursive" @@ -63,7 +67,7 @@ permissions = [ [[set]] identifier = "allow-audio-meta-recursive" -description = "This allows read access to metadata of the `$AUDIO` folder, including file listing and statistics." +description = "This allows full recursive read access to metadata of the `$AUDIO` folder, including file listing and statistics." permissions = [ "read-meta", "scope-audio-recursive" @@ -71,7 +75,7 @@ permissions = [ [[set]] identifier = "allow-audio-meta" -description = "This allows read access to metadata of the `$AUDIO` folder, including file listing and statistics." +description = "This allows non-recursive read access to metadata of the `$AUDIO` folder, including file listing and statistics." permissions = [ "read-meta", "scope-audio-index" diff --git a/plugins/fs/permissions/autogenerated/base-directories/cache.toml b/plugins/fs/permissions/autogenerated/base-directories/cache.toml index b9831a77..814319eb 100644 --- a/plugins/fs/permissions/autogenerated/base-directories/cache.toml +++ b/plugins/fs/permissions/autogenerated/base-directories/cache.toml @@ -7,15 +7,19 @@ [[permission]] identifier = "scope-cache-recursive" -description = "This scope recursive access to the complete `$CACHE` folder, including sub directories and files." +description = "This scope permits recursive access to the complete `$CACHE` folder, including sub directories and files." +[[permission.scope.allow]] +path = "$CACHE" [[permission.scope.allow]] path = "$CACHE/**" [[permission]] identifier = "scope-cache" -description = "This scope permits access to all files and list content of top level directories in the `$CACHE`folder." +description = "This scope permits access to all files and list content of top level directories in the `$CACHE` folder." +[[permission.scope.allow]] +path = "$CACHE" [[permission.scope.allow]] path = "$CACHE/*" @@ -24,7 +28,7 @@ identifier = "scope-cache-index" description = "This scope permits to list all files and folders in the `$CACHE`folder." [[permission.scope.allow]] -path = "$CACHE/" +path = "$CACHE" # Sets Section # This section combines the scope elements with enablement of commands @@ -39,7 +43,7 @@ permissions = [ [[set]] identifier = "allow-cache-write-recursive" -description = "This allows full recusrive write access to the complete `$CACHE` folder, files and subdirectories." +description = "This allows full recursive write access to the complete `$CACHE` folder, files and subdirectories." permissions = [ "write-all", "scope-cache-recursive" @@ -63,7 +67,7 @@ permissions = [ [[set]] identifier = "allow-cache-meta-recursive" -description = "This allows read access to metadata of the `$CACHE` folder, including file listing and statistics." +description = "This allows full recursive read access to metadata of the `$CACHE` folder, including file listing and statistics." permissions = [ "read-meta", "scope-cache-recursive" @@ -71,7 +75,7 @@ permissions = [ [[set]] identifier = "allow-cache-meta" -description = "This allows read access to metadata of the `$CACHE` folder, including file listing and statistics." +description = "This allows non-recursive read access to metadata of the `$CACHE` folder, including file listing and statistics." permissions = [ "read-meta", "scope-cache-index" diff --git a/plugins/fs/permissions/autogenerated/base-directories/config.toml b/plugins/fs/permissions/autogenerated/base-directories/config.toml index 6ad6d4b1..59221045 100644 --- a/plugins/fs/permissions/autogenerated/base-directories/config.toml +++ b/plugins/fs/permissions/autogenerated/base-directories/config.toml @@ -7,15 +7,19 @@ [[permission]] identifier = "scope-config-recursive" -description = "This scope recursive access to the complete `$CONFIG` folder, including sub directories and files." +description = "This scope permits recursive access to the complete `$CONFIG` folder, including sub directories and files." +[[permission.scope.allow]] +path = "$CONFIG" [[permission.scope.allow]] path = "$CONFIG/**" [[permission]] identifier = "scope-config" -description = "This scope permits access to all files and list content of top level directories in the `$CONFIG`folder." +description = "This scope permits access to all files and list content of top level directories in the `$CONFIG` folder." +[[permission.scope.allow]] +path = "$CONFIG" [[permission.scope.allow]] path = "$CONFIG/*" @@ -24,7 +28,7 @@ identifier = "scope-config-index" description = "This scope permits to list all files and folders in the `$CONFIG`folder." [[permission.scope.allow]] -path = "$CONFIG/" +path = "$CONFIG" # Sets Section # This section combines the scope elements with enablement of commands @@ -39,7 +43,7 @@ permissions = [ [[set]] identifier = "allow-config-write-recursive" -description = "This allows full recusrive write access to the complete `$CONFIG` folder, files and subdirectories." +description = "This allows full recursive write access to the complete `$CONFIG` folder, files and subdirectories." permissions = [ "write-all", "scope-config-recursive" @@ -63,7 +67,7 @@ permissions = [ [[set]] identifier = "allow-config-meta-recursive" -description = "This allows read access to metadata of the `$CONFIG` folder, including file listing and statistics." +description = "This allows full recursive read access to metadata of the `$CONFIG` folder, including file listing and statistics." permissions = [ "read-meta", "scope-config-recursive" @@ -71,7 +75,7 @@ permissions = [ [[set]] identifier = "allow-config-meta" -description = "This allows read access to metadata of the `$CONFIG` folder, including file listing and statistics." +description = "This allows non-recursive read access to metadata of the `$CONFIG` folder, including file listing and statistics." permissions = [ "read-meta", "scope-config-index" diff --git a/plugins/fs/permissions/autogenerated/base-directories/data.toml b/plugins/fs/permissions/autogenerated/base-directories/data.toml index d30423dd..a8428ca1 100644 --- a/plugins/fs/permissions/autogenerated/base-directories/data.toml +++ b/plugins/fs/permissions/autogenerated/base-directories/data.toml @@ -7,15 +7,19 @@ [[permission]] identifier = "scope-data-recursive" -description = "This scope recursive access to the complete `$DATA` folder, including sub directories and files." +description = "This scope permits recursive access to the complete `$DATA` folder, including sub directories and files." +[[permission.scope.allow]] +path = "$DATA" [[permission.scope.allow]] path = "$DATA/**" [[permission]] identifier = "scope-data" -description = "This scope permits access to all files and list content of top level directories in the `$DATA`folder." +description = "This scope permits access to all files and list content of top level directories in the `$DATA` folder." +[[permission.scope.allow]] +path = "$DATA" [[permission.scope.allow]] path = "$DATA/*" @@ -24,7 +28,7 @@ identifier = "scope-data-index" description = "This scope permits to list all files and folders in the `$DATA`folder." [[permission.scope.allow]] -path = "$DATA/" +path = "$DATA" # Sets Section # This section combines the scope elements with enablement of commands @@ -39,7 +43,7 @@ permissions = [ [[set]] identifier = "allow-data-write-recursive" -description = "This allows full recusrive write access to the complete `$DATA` folder, files and subdirectories." +description = "This allows full recursive write access to the complete `$DATA` folder, files and subdirectories." permissions = [ "write-all", "scope-data-recursive" @@ -63,7 +67,7 @@ permissions = [ [[set]] identifier = "allow-data-meta-recursive" -description = "This allows read access to metadata of the `$DATA` folder, including file listing and statistics." +description = "This allows full recursive read access to metadata of the `$DATA` folder, including file listing and statistics." permissions = [ "read-meta", "scope-data-recursive" @@ -71,7 +75,7 @@ permissions = [ [[set]] identifier = "allow-data-meta" -description = "This allows read access to metadata of the `$DATA` folder, including file listing and statistics." +description = "This allows non-recursive read access to metadata of the `$DATA` folder, including file listing and statistics." permissions = [ "read-meta", "scope-data-index" diff --git a/plugins/fs/permissions/autogenerated/base-directories/desktop.toml b/plugins/fs/permissions/autogenerated/base-directories/desktop.toml index 4268eb24..da369fa0 100644 --- a/plugins/fs/permissions/autogenerated/base-directories/desktop.toml +++ b/plugins/fs/permissions/autogenerated/base-directories/desktop.toml @@ -7,15 +7,19 @@ [[permission]] identifier = "scope-desktop-recursive" -description = "This scope recursive access to the complete `$DESKTOP` folder, including sub directories and files." +description = "This scope permits recursive access to the complete `$DESKTOP` folder, including sub directories and files." +[[permission.scope.allow]] +path = "$DESKTOP" [[permission.scope.allow]] path = "$DESKTOP/**" [[permission]] identifier = "scope-desktop" -description = "This scope permits access to all files and list content of top level directories in the `$DESKTOP`folder." +description = "This scope permits access to all files and list content of top level directories in the `$DESKTOP` folder." +[[permission.scope.allow]] +path = "$DESKTOP" [[permission.scope.allow]] path = "$DESKTOP/*" @@ -24,7 +28,7 @@ identifier = "scope-desktop-index" description = "This scope permits to list all files and folders in the `$DESKTOP`folder." [[permission.scope.allow]] -path = "$DESKTOP/" +path = "$DESKTOP" # Sets Section # This section combines the scope elements with enablement of commands @@ -39,7 +43,7 @@ permissions = [ [[set]] identifier = "allow-desktop-write-recursive" -description = "This allows full recusrive write access to the complete `$DESKTOP` folder, files and subdirectories." +description = "This allows full recursive write access to the complete `$DESKTOP` folder, files and subdirectories." permissions = [ "write-all", "scope-desktop-recursive" @@ -63,7 +67,7 @@ permissions = [ [[set]] identifier = "allow-desktop-meta-recursive" -description = "This allows read access to metadata of the `$DESKTOP` folder, including file listing and statistics." +description = "This allows full recursive read access to metadata of the `$DESKTOP` folder, including file listing and statistics." permissions = [ "read-meta", "scope-desktop-recursive" @@ -71,7 +75,7 @@ permissions = [ [[set]] identifier = "allow-desktop-meta" -description = "This allows read access to metadata of the `$DESKTOP` folder, including file listing and statistics." +description = "This allows non-recursive read access to metadata of the `$DESKTOP` folder, including file listing and statistics." permissions = [ "read-meta", "scope-desktop-index" diff --git a/plugins/fs/permissions/autogenerated/base-directories/document.toml b/plugins/fs/permissions/autogenerated/base-directories/document.toml index 668286db..9feb4d0d 100644 --- a/plugins/fs/permissions/autogenerated/base-directories/document.toml +++ b/plugins/fs/permissions/autogenerated/base-directories/document.toml @@ -7,15 +7,19 @@ [[permission]] identifier = "scope-document-recursive" -description = "This scope recursive access to the complete `$DOCUMENT` folder, including sub directories and files." +description = "This scope permits recursive access to the complete `$DOCUMENT` folder, including sub directories and files." +[[permission.scope.allow]] +path = "$DOCUMENT" [[permission.scope.allow]] path = "$DOCUMENT/**" [[permission]] identifier = "scope-document" -description = "This scope permits access to all files and list content of top level directories in the `$DOCUMENT`folder." +description = "This scope permits access to all files and list content of top level directories in the `$DOCUMENT` folder." +[[permission.scope.allow]] +path = "$DOCUMENT" [[permission.scope.allow]] path = "$DOCUMENT/*" @@ -24,7 +28,7 @@ identifier = "scope-document-index" description = "This scope permits to list all files and folders in the `$DOCUMENT`folder." [[permission.scope.allow]] -path = "$DOCUMENT/" +path = "$DOCUMENT" # Sets Section # This section combines the scope elements with enablement of commands @@ -39,7 +43,7 @@ permissions = [ [[set]] identifier = "allow-document-write-recursive" -description = "This allows full recusrive write access to the complete `$DOCUMENT` folder, files and subdirectories." +description = "This allows full recursive write access to the complete `$DOCUMENT` folder, files and subdirectories." permissions = [ "write-all", "scope-document-recursive" @@ -63,7 +67,7 @@ permissions = [ [[set]] identifier = "allow-document-meta-recursive" -description = "This allows read access to metadata of the `$DOCUMENT` folder, including file listing and statistics." +description = "This allows full recursive read access to metadata of the `$DOCUMENT` folder, including file listing and statistics." permissions = [ "read-meta", "scope-document-recursive" @@ -71,7 +75,7 @@ permissions = [ [[set]] identifier = "allow-document-meta" -description = "This allows read access to metadata of the `$DOCUMENT` folder, including file listing and statistics." +description = "This allows non-recursive read access to metadata of the `$DOCUMENT` folder, including file listing and statistics." permissions = [ "read-meta", "scope-document-index" diff --git a/plugins/fs/permissions/autogenerated/base-directories/download.toml b/plugins/fs/permissions/autogenerated/base-directories/download.toml index b9ea94d2..8659e3ac 100644 --- a/plugins/fs/permissions/autogenerated/base-directories/download.toml +++ b/plugins/fs/permissions/autogenerated/base-directories/download.toml @@ -7,15 +7,19 @@ [[permission]] identifier = "scope-download-recursive" -description = "This scope recursive access to the complete `$DOWNLOAD` folder, including sub directories and files." +description = "This scope permits recursive access to the complete `$DOWNLOAD` folder, including sub directories and files." +[[permission.scope.allow]] +path = "$DOWNLOAD" [[permission.scope.allow]] path = "$DOWNLOAD/**" [[permission]] identifier = "scope-download" -description = "This scope permits access to all files and list content of top level directories in the `$DOWNLOAD`folder." +description = "This scope permits access to all files and list content of top level directories in the `$DOWNLOAD` folder." +[[permission.scope.allow]] +path = "$DOWNLOAD" [[permission.scope.allow]] path = "$DOWNLOAD/*" @@ -24,7 +28,7 @@ identifier = "scope-download-index" description = "This scope permits to list all files and folders in the `$DOWNLOAD`folder." [[permission.scope.allow]] -path = "$DOWNLOAD/" +path = "$DOWNLOAD" # Sets Section # This section combines the scope elements with enablement of commands @@ -39,7 +43,7 @@ permissions = [ [[set]] identifier = "allow-download-write-recursive" -description = "This allows full recusrive write access to the complete `$DOWNLOAD` folder, files and subdirectories." +description = "This allows full recursive write access to the complete `$DOWNLOAD` folder, files and subdirectories." permissions = [ "write-all", "scope-download-recursive" @@ -63,7 +67,7 @@ permissions = [ [[set]] identifier = "allow-download-meta-recursive" -description = "This allows read access to metadata of the `$DOWNLOAD` folder, including file listing and statistics." +description = "This allows full recursive read access to metadata of the `$DOWNLOAD` folder, including file listing and statistics." permissions = [ "read-meta", "scope-download-recursive" @@ -71,7 +75,7 @@ permissions = [ [[set]] identifier = "allow-download-meta" -description = "This allows read access to metadata of the `$DOWNLOAD` folder, including file listing and statistics." +description = "This allows non-recursive read access to metadata of the `$DOWNLOAD` folder, including file listing and statistics." permissions = [ "read-meta", "scope-download-index" diff --git a/plugins/fs/permissions/autogenerated/base-directories/exe.toml b/plugins/fs/permissions/autogenerated/base-directories/exe.toml index 74da907a..94950e84 100644 --- a/plugins/fs/permissions/autogenerated/base-directories/exe.toml +++ b/plugins/fs/permissions/autogenerated/base-directories/exe.toml @@ -7,15 +7,19 @@ [[permission]] identifier = "scope-exe-recursive" -description = "This scope recursive access to the complete `$EXE` folder, including sub directories and files." +description = "This scope permits recursive access to the complete `$EXE` folder, including sub directories and files." +[[permission.scope.allow]] +path = "$EXE" [[permission.scope.allow]] path = "$EXE/**" [[permission]] identifier = "scope-exe" -description = "This scope permits access to all files and list content of top level directories in the `$EXE`folder." +description = "This scope permits access to all files and list content of top level directories in the `$EXE` folder." +[[permission.scope.allow]] +path = "$EXE" [[permission.scope.allow]] path = "$EXE/*" @@ -24,7 +28,7 @@ identifier = "scope-exe-index" description = "This scope permits to list all files and folders in the `$EXE`folder." [[permission.scope.allow]] -path = "$EXE/" +path = "$EXE" # Sets Section # This section combines the scope elements with enablement of commands @@ -39,7 +43,7 @@ permissions = [ [[set]] identifier = "allow-exe-write-recursive" -description = "This allows full recusrive write access to the complete `$EXE` folder, files and subdirectories." +description = "This allows full recursive write access to the complete `$EXE` folder, files and subdirectories." permissions = [ "write-all", "scope-exe-recursive" @@ -63,7 +67,7 @@ permissions = [ [[set]] identifier = "allow-exe-meta-recursive" -description = "This allows read access to metadata of the `$EXE` folder, including file listing and statistics." +description = "This allows full recursive read access to metadata of the `$EXE` folder, including file listing and statistics." permissions = [ "read-meta", "scope-exe-recursive" @@ -71,7 +75,7 @@ permissions = [ [[set]] identifier = "allow-exe-meta" -description = "This allows read access to metadata of the `$EXE` folder, including file listing and statistics." +description = "This allows non-recursive read access to metadata of the `$EXE` folder, including file listing and statistics." permissions = [ "read-meta", "scope-exe-index" diff --git a/plugins/fs/permissions/autogenerated/base-directories/font.toml b/plugins/fs/permissions/autogenerated/base-directories/font.toml index 13cfcc37..21840046 100644 --- a/plugins/fs/permissions/autogenerated/base-directories/font.toml +++ b/plugins/fs/permissions/autogenerated/base-directories/font.toml @@ -7,15 +7,19 @@ [[permission]] identifier = "scope-font-recursive" -description = "This scope recursive access to the complete `$FONT` folder, including sub directories and files." +description = "This scope permits recursive access to the complete `$FONT` folder, including sub directories and files." +[[permission.scope.allow]] +path = "$FONT" [[permission.scope.allow]] path = "$FONT/**" [[permission]] identifier = "scope-font" -description = "This scope permits access to all files and list content of top level directories in the `$FONT`folder." +description = "This scope permits access to all files and list content of top level directories in the `$FONT` folder." +[[permission.scope.allow]] +path = "$FONT" [[permission.scope.allow]] path = "$FONT/*" @@ -24,7 +28,7 @@ identifier = "scope-font-index" description = "This scope permits to list all files and folders in the `$FONT`folder." [[permission.scope.allow]] -path = "$FONT/" +path = "$FONT" # Sets Section # This section combines the scope elements with enablement of commands @@ -39,7 +43,7 @@ permissions = [ [[set]] identifier = "allow-font-write-recursive" -description = "This allows full recusrive write access to the complete `$FONT` folder, files and subdirectories." +description = "This allows full recursive write access to the complete `$FONT` folder, files and subdirectories." permissions = [ "write-all", "scope-font-recursive" @@ -63,7 +67,7 @@ permissions = [ [[set]] identifier = "allow-font-meta-recursive" -description = "This allows read access to metadata of the `$FONT` folder, including file listing and statistics." +description = "This allows full recursive read access to metadata of the `$FONT` folder, including file listing and statistics." permissions = [ "read-meta", "scope-font-recursive" @@ -71,7 +75,7 @@ permissions = [ [[set]] identifier = "allow-font-meta" -description = "This allows read access to metadata of the `$FONT` folder, including file listing and statistics." +description = "This allows non-recursive read access to metadata of the `$FONT` folder, including file listing and statistics." permissions = [ "read-meta", "scope-font-index" diff --git a/plugins/fs/permissions/autogenerated/base-directories/home.toml b/plugins/fs/permissions/autogenerated/base-directories/home.toml index a48d5d76..cbf48e2f 100644 --- a/plugins/fs/permissions/autogenerated/base-directories/home.toml +++ b/plugins/fs/permissions/autogenerated/base-directories/home.toml @@ -7,15 +7,19 @@ [[permission]] identifier = "scope-home-recursive" -description = "This scope recursive access to the complete `$HOME` folder, including sub directories and files." +description = "This scope permits recursive access to the complete `$HOME` folder, including sub directories and files." +[[permission.scope.allow]] +path = "$HOME" [[permission.scope.allow]] path = "$HOME/**" [[permission]] identifier = "scope-home" -description = "This scope permits access to all files and list content of top level directories in the `$HOME`folder." +description = "This scope permits access to all files and list content of top level directories in the `$HOME` folder." +[[permission.scope.allow]] +path = "$HOME" [[permission.scope.allow]] path = "$HOME/*" @@ -24,7 +28,7 @@ identifier = "scope-home-index" description = "This scope permits to list all files and folders in the `$HOME`folder." [[permission.scope.allow]] -path = "$HOME/" +path = "$HOME" # Sets Section # This section combines the scope elements with enablement of commands @@ -39,7 +43,7 @@ permissions = [ [[set]] identifier = "allow-home-write-recursive" -description = "This allows full recusrive write access to the complete `$HOME` folder, files and subdirectories." +description = "This allows full recursive write access to the complete `$HOME` folder, files and subdirectories." permissions = [ "write-all", "scope-home-recursive" @@ -63,7 +67,7 @@ permissions = [ [[set]] identifier = "allow-home-meta-recursive" -description = "This allows read access to metadata of the `$HOME` folder, including file listing and statistics." +description = "This allows full recursive read access to metadata of the `$HOME` folder, including file listing and statistics." permissions = [ "read-meta", "scope-home-recursive" @@ -71,7 +75,7 @@ permissions = [ [[set]] identifier = "allow-home-meta" -description = "This allows read access to metadata of the `$HOME` folder, including file listing and statistics." +description = "This allows non-recursive read access to metadata of the `$HOME` folder, including file listing and statistics." permissions = [ "read-meta", "scope-home-index" diff --git a/plugins/fs/permissions/autogenerated/base-directories/localdata.toml b/plugins/fs/permissions/autogenerated/base-directories/localdata.toml index 6d0633cf..90a8f48b 100644 --- a/plugins/fs/permissions/autogenerated/base-directories/localdata.toml +++ b/plugins/fs/permissions/autogenerated/base-directories/localdata.toml @@ -7,15 +7,19 @@ [[permission]] identifier = "scope-localdata-recursive" -description = "This scope recursive access to the complete `$LOCALDATA` folder, including sub directories and files." +description = "This scope permits recursive access to the complete `$LOCALDATA` folder, including sub directories and files." +[[permission.scope.allow]] +path = "$LOCALDATA" [[permission.scope.allow]] path = "$LOCALDATA/**" [[permission]] identifier = "scope-localdata" -description = "This scope permits access to all files and list content of top level directories in the `$LOCALDATA`folder." +description = "This scope permits access to all files and list content of top level directories in the `$LOCALDATA` folder." +[[permission.scope.allow]] +path = "$LOCALDATA" [[permission.scope.allow]] path = "$LOCALDATA/*" @@ -24,7 +28,7 @@ identifier = "scope-localdata-index" description = "This scope permits to list all files and folders in the `$LOCALDATA`folder." [[permission.scope.allow]] -path = "$LOCALDATA/" +path = "$LOCALDATA" # Sets Section # This section combines the scope elements with enablement of commands @@ -39,7 +43,7 @@ permissions = [ [[set]] identifier = "allow-localdata-write-recursive" -description = "This allows full recusrive write access to the complete `$LOCALDATA` folder, files and subdirectories." +description = "This allows full recursive write access to the complete `$LOCALDATA` folder, files and subdirectories." permissions = [ "write-all", "scope-localdata-recursive" @@ -63,7 +67,7 @@ permissions = [ [[set]] identifier = "allow-localdata-meta-recursive" -description = "This allows read access to metadata of the `$LOCALDATA` folder, including file listing and statistics." +description = "This allows full recursive read access to metadata of the `$LOCALDATA` folder, including file listing and statistics." permissions = [ "read-meta", "scope-localdata-recursive" @@ -71,7 +75,7 @@ permissions = [ [[set]] identifier = "allow-localdata-meta" -description = "This allows read access to metadata of the `$LOCALDATA` folder, including file listing and statistics." +description = "This allows non-recursive read access to metadata of the `$LOCALDATA` folder, including file listing and statistics." permissions = [ "read-meta", "scope-localdata-index" diff --git a/plugins/fs/permissions/autogenerated/base-directories/log.toml b/plugins/fs/permissions/autogenerated/base-directories/log.toml index 81d476e6..d505a3ce 100644 --- a/plugins/fs/permissions/autogenerated/base-directories/log.toml +++ b/plugins/fs/permissions/autogenerated/base-directories/log.toml @@ -7,15 +7,19 @@ [[permission]] identifier = "scope-log-recursive" -description = "This scope recursive access to the complete `$LOG` folder, including sub directories and files." +description = "This scope permits recursive access to the complete `$LOG` folder, including sub directories and files." +[[permission.scope.allow]] +path = "$LOG" [[permission.scope.allow]] path = "$LOG/**" [[permission]] identifier = "scope-log" -description = "This scope permits access to all files and list content of top level directories in the `$LOG`folder." +description = "This scope permits access to all files and list content of top level directories in the `$LOG` folder." +[[permission.scope.allow]] +path = "$LOG" [[permission.scope.allow]] path = "$LOG/*" @@ -24,7 +28,7 @@ identifier = "scope-log-index" description = "This scope permits to list all files and folders in the `$LOG`folder." [[permission.scope.allow]] -path = "$LOG/" +path = "$LOG" # Sets Section # This section combines the scope elements with enablement of commands @@ -39,7 +43,7 @@ permissions = [ [[set]] identifier = "allow-log-write-recursive" -description = "This allows full recusrive write access to the complete `$LOG` folder, files and subdirectories." +description = "This allows full recursive write access to the complete `$LOG` folder, files and subdirectories." permissions = [ "write-all", "scope-log-recursive" @@ -63,7 +67,7 @@ permissions = [ [[set]] identifier = "allow-log-meta-recursive" -description = "This allows read access to metadata of the `$LOG` folder, including file listing and statistics." +description = "This allows full recursive read access to metadata of the `$LOG` folder, including file listing and statistics." permissions = [ "read-meta", "scope-log-recursive" @@ -71,7 +75,7 @@ permissions = [ [[set]] identifier = "allow-log-meta" -description = "This allows read access to metadata of the `$LOG` folder, including file listing and statistics." +description = "This allows non-recursive read access to metadata of the `$LOG` folder, including file listing and statistics." permissions = [ "read-meta", "scope-log-index" diff --git a/plugins/fs/permissions/autogenerated/base-directories/picture.toml b/plugins/fs/permissions/autogenerated/base-directories/picture.toml index 5b6c361c..6a760909 100644 --- a/plugins/fs/permissions/autogenerated/base-directories/picture.toml +++ b/plugins/fs/permissions/autogenerated/base-directories/picture.toml @@ -7,15 +7,19 @@ [[permission]] identifier = "scope-picture-recursive" -description = "This scope recursive access to the complete `$PICTURE` folder, including sub directories and files." +description = "This scope permits recursive access to the complete `$PICTURE` folder, including sub directories and files." +[[permission.scope.allow]] +path = "$PICTURE" [[permission.scope.allow]] path = "$PICTURE/**" [[permission]] identifier = "scope-picture" -description = "This scope permits access to all files and list content of top level directories in the `$PICTURE`folder." +description = "This scope permits access to all files and list content of top level directories in the `$PICTURE` folder." +[[permission.scope.allow]] +path = "$PICTURE" [[permission.scope.allow]] path = "$PICTURE/*" @@ -24,7 +28,7 @@ identifier = "scope-picture-index" description = "This scope permits to list all files and folders in the `$PICTURE`folder." [[permission.scope.allow]] -path = "$PICTURE/" +path = "$PICTURE" # Sets Section # This section combines the scope elements with enablement of commands @@ -39,7 +43,7 @@ permissions = [ [[set]] identifier = "allow-picture-write-recursive" -description = "This allows full recusrive write access to the complete `$PICTURE` folder, files and subdirectories." +description = "This allows full recursive write access to the complete `$PICTURE` folder, files and subdirectories." permissions = [ "write-all", "scope-picture-recursive" @@ -63,7 +67,7 @@ permissions = [ [[set]] identifier = "allow-picture-meta-recursive" -description = "This allows read access to metadata of the `$PICTURE` folder, including file listing and statistics." +description = "This allows full recursive read access to metadata of the `$PICTURE` folder, including file listing and statistics." permissions = [ "read-meta", "scope-picture-recursive" @@ -71,7 +75,7 @@ permissions = [ [[set]] identifier = "allow-picture-meta" -description = "This allows read access to metadata of the `$PICTURE` folder, including file listing and statistics." +description = "This allows non-recursive read access to metadata of the `$PICTURE` folder, including file listing and statistics." permissions = [ "read-meta", "scope-picture-index" diff --git a/plugins/fs/permissions/autogenerated/base-directories/public.toml b/plugins/fs/permissions/autogenerated/base-directories/public.toml index 56e65f94..2e39abb4 100644 --- a/plugins/fs/permissions/autogenerated/base-directories/public.toml +++ b/plugins/fs/permissions/autogenerated/base-directories/public.toml @@ -7,15 +7,19 @@ [[permission]] identifier = "scope-public-recursive" -description = "This scope recursive access to the complete `$PUBLIC` folder, including sub directories and files." +description = "This scope permits recursive access to the complete `$PUBLIC` folder, including sub directories and files." +[[permission.scope.allow]] +path = "$PUBLIC" [[permission.scope.allow]] path = "$PUBLIC/**" [[permission]] identifier = "scope-public" -description = "This scope permits access to all files and list content of top level directories in the `$PUBLIC`folder." +description = "This scope permits access to all files and list content of top level directories in the `$PUBLIC` folder." +[[permission.scope.allow]] +path = "$PUBLIC" [[permission.scope.allow]] path = "$PUBLIC/*" @@ -24,7 +28,7 @@ identifier = "scope-public-index" description = "This scope permits to list all files and folders in the `$PUBLIC`folder." [[permission.scope.allow]] -path = "$PUBLIC/" +path = "$PUBLIC" # Sets Section # This section combines the scope elements with enablement of commands @@ -39,7 +43,7 @@ permissions = [ [[set]] identifier = "allow-public-write-recursive" -description = "This allows full recusrive write access to the complete `$PUBLIC` folder, files and subdirectories." +description = "This allows full recursive write access to the complete `$PUBLIC` folder, files and subdirectories." permissions = [ "write-all", "scope-public-recursive" @@ -63,7 +67,7 @@ permissions = [ [[set]] identifier = "allow-public-meta-recursive" -description = "This allows read access to metadata of the `$PUBLIC` folder, including file listing and statistics." +description = "This allows full recursive read access to metadata of the `$PUBLIC` folder, including file listing and statistics." permissions = [ "read-meta", "scope-public-recursive" @@ -71,7 +75,7 @@ permissions = [ [[set]] identifier = "allow-public-meta" -description = "This allows read access to metadata of the `$PUBLIC` folder, including file listing and statistics." +description = "This allows non-recursive read access to metadata of the `$PUBLIC` folder, including file listing and statistics." permissions = [ "read-meta", "scope-public-index" diff --git a/plugins/fs/permissions/autogenerated/base-directories/resource.toml b/plugins/fs/permissions/autogenerated/base-directories/resource.toml index 05dd1a5e..53dfeb07 100644 --- a/plugins/fs/permissions/autogenerated/base-directories/resource.toml +++ b/plugins/fs/permissions/autogenerated/base-directories/resource.toml @@ -7,15 +7,19 @@ [[permission]] identifier = "scope-resource-recursive" -description = "This scope recursive access to the complete `$RESOURCE` folder, including sub directories and files." +description = "This scope permits recursive access to the complete `$RESOURCE` folder, including sub directories and files." +[[permission.scope.allow]] +path = "$RESOURCE" [[permission.scope.allow]] path = "$RESOURCE/**" [[permission]] identifier = "scope-resource" -description = "This scope permits access to all files and list content of top level directories in the `$RESOURCE`folder." +description = "This scope permits access to all files and list content of top level directories in the `$RESOURCE` folder." +[[permission.scope.allow]] +path = "$RESOURCE" [[permission.scope.allow]] path = "$RESOURCE/*" @@ -24,7 +28,7 @@ identifier = "scope-resource-index" description = "This scope permits to list all files and folders in the `$RESOURCE`folder." [[permission.scope.allow]] -path = "$RESOURCE/" +path = "$RESOURCE" # Sets Section # This section combines the scope elements with enablement of commands @@ -39,7 +43,7 @@ permissions = [ [[set]] identifier = "allow-resource-write-recursive" -description = "This allows full recusrive write access to the complete `$RESOURCE` folder, files and subdirectories." +description = "This allows full recursive write access to the complete `$RESOURCE` folder, files and subdirectories." permissions = [ "write-all", "scope-resource-recursive" @@ -63,7 +67,7 @@ permissions = [ [[set]] identifier = "allow-resource-meta-recursive" -description = "This allows read access to metadata of the `$RESOURCE` folder, including file listing and statistics." +description = "This allows full recursive read access to metadata of the `$RESOURCE` folder, including file listing and statistics." permissions = [ "read-meta", "scope-resource-recursive" @@ -71,7 +75,7 @@ permissions = [ [[set]] identifier = "allow-resource-meta" -description = "This allows read access to metadata of the `$RESOURCE` folder, including file listing and statistics." +description = "This allows non-recursive read access to metadata of the `$RESOURCE` folder, including file listing and statistics." permissions = [ "read-meta", "scope-resource-index" diff --git a/plugins/fs/permissions/autogenerated/base-directories/runtime.toml b/plugins/fs/permissions/autogenerated/base-directories/runtime.toml index 50569412..8dcc2a03 100644 --- a/plugins/fs/permissions/autogenerated/base-directories/runtime.toml +++ b/plugins/fs/permissions/autogenerated/base-directories/runtime.toml @@ -7,15 +7,19 @@ [[permission]] identifier = "scope-runtime-recursive" -description = "This scope recursive access to the complete `$RUNTIME` folder, including sub directories and files." +description = "This scope permits recursive access to the complete `$RUNTIME` folder, including sub directories and files." +[[permission.scope.allow]] +path = "$RUNTIME" [[permission.scope.allow]] path = "$RUNTIME/**" [[permission]] identifier = "scope-runtime" -description = "This scope permits access to all files and list content of top level directories in the `$RUNTIME`folder." +description = "This scope permits access to all files and list content of top level directories in the `$RUNTIME` folder." +[[permission.scope.allow]] +path = "$RUNTIME" [[permission.scope.allow]] path = "$RUNTIME/*" @@ -24,7 +28,7 @@ identifier = "scope-runtime-index" description = "This scope permits to list all files and folders in the `$RUNTIME`folder." [[permission.scope.allow]] -path = "$RUNTIME/" +path = "$RUNTIME" # Sets Section # This section combines the scope elements with enablement of commands @@ -39,7 +43,7 @@ permissions = [ [[set]] identifier = "allow-runtime-write-recursive" -description = "This allows full recusrive write access to the complete `$RUNTIME` folder, files and subdirectories." +description = "This allows full recursive write access to the complete `$RUNTIME` folder, files and subdirectories." permissions = [ "write-all", "scope-runtime-recursive" @@ -63,7 +67,7 @@ permissions = [ [[set]] identifier = "allow-runtime-meta-recursive" -description = "This allows read access to metadata of the `$RUNTIME` folder, including file listing and statistics." +description = "This allows full recursive read access to metadata of the `$RUNTIME` folder, including file listing and statistics." permissions = [ "read-meta", "scope-runtime-recursive" @@ -71,7 +75,7 @@ permissions = [ [[set]] identifier = "allow-runtime-meta" -description = "This allows read access to metadata of the `$RUNTIME` folder, including file listing and statistics." +description = "This allows non-recursive read access to metadata of the `$RUNTIME` folder, including file listing and statistics." permissions = [ "read-meta", "scope-runtime-index" diff --git a/plugins/fs/permissions/autogenerated/base-directories/temp.toml b/plugins/fs/permissions/autogenerated/base-directories/temp.toml index 9e359e95..c08e1da2 100644 --- a/plugins/fs/permissions/autogenerated/base-directories/temp.toml +++ b/plugins/fs/permissions/autogenerated/base-directories/temp.toml @@ -7,15 +7,19 @@ [[permission]] identifier = "scope-temp-recursive" -description = "This scope recursive access to the complete `$TEMP` folder, including sub directories and files." +description = "This scope permits recursive access to the complete `$TEMP` folder, including sub directories and files." +[[permission.scope.allow]] +path = "$TEMP" [[permission.scope.allow]] path = "$TEMP/**" [[permission]] identifier = "scope-temp" -description = "This scope permits access to all files and list content of top level directories in the `$TEMP`folder." +description = "This scope permits access to all files and list content of top level directories in the `$TEMP` folder." +[[permission.scope.allow]] +path = "$TEMP" [[permission.scope.allow]] path = "$TEMP/*" @@ -24,7 +28,7 @@ identifier = "scope-temp-index" description = "This scope permits to list all files and folders in the `$TEMP`folder." [[permission.scope.allow]] -path = "$TEMP/" +path = "$TEMP" # Sets Section # This section combines the scope elements with enablement of commands @@ -39,7 +43,7 @@ permissions = [ [[set]] identifier = "allow-temp-write-recursive" -description = "This allows full recusrive write access to the complete `$TEMP` folder, files and subdirectories." +description = "This allows full recursive write access to the complete `$TEMP` folder, files and subdirectories." permissions = [ "write-all", "scope-temp-recursive" @@ -63,7 +67,7 @@ permissions = [ [[set]] identifier = "allow-temp-meta-recursive" -description = "This allows read access to metadata of the `$TEMP` folder, including file listing and statistics." +description = "This allows full recursive read access to metadata of the `$TEMP` folder, including file listing and statistics." permissions = [ "read-meta", "scope-temp-recursive" @@ -71,7 +75,7 @@ permissions = [ [[set]] identifier = "allow-temp-meta" -description = "This allows read access to metadata of the `$TEMP` folder, including file listing and statistics." +description = "This allows non-recursive read access to metadata of the `$TEMP` folder, including file listing and statistics." permissions = [ "read-meta", "scope-temp-index" diff --git a/plugins/fs/permissions/autogenerated/base-directories/template.toml b/plugins/fs/permissions/autogenerated/base-directories/template.toml index 73e6262f..ce39f773 100644 --- a/plugins/fs/permissions/autogenerated/base-directories/template.toml +++ b/plugins/fs/permissions/autogenerated/base-directories/template.toml @@ -7,15 +7,19 @@ [[permission]] identifier = "scope-template-recursive" -description = "This scope recursive access to the complete `$TEMPLATE` folder, including sub directories and files." +description = "This scope permits recursive access to the complete `$TEMPLATE` folder, including sub directories and files." +[[permission.scope.allow]] +path = "$TEMPLATE" [[permission.scope.allow]] path = "$TEMPLATE/**" [[permission]] identifier = "scope-template" -description = "This scope permits access to all files and list content of top level directories in the `$TEMPLATE`folder." +description = "This scope permits access to all files and list content of top level directories in the `$TEMPLATE` folder." +[[permission.scope.allow]] +path = "$TEMPLATE" [[permission.scope.allow]] path = "$TEMPLATE/*" @@ -24,7 +28,7 @@ identifier = "scope-template-index" description = "This scope permits to list all files and folders in the `$TEMPLATE`folder." [[permission.scope.allow]] -path = "$TEMPLATE/" +path = "$TEMPLATE" # Sets Section # This section combines the scope elements with enablement of commands @@ -39,7 +43,7 @@ permissions = [ [[set]] identifier = "allow-template-write-recursive" -description = "This allows full recusrive write access to the complete `$TEMPLATE` folder, files and subdirectories." +description = "This allows full recursive write access to the complete `$TEMPLATE` folder, files and subdirectories." permissions = [ "write-all", "scope-template-recursive" @@ -63,7 +67,7 @@ permissions = [ [[set]] identifier = "allow-template-meta-recursive" -description = "This allows read access to metadata of the `$TEMPLATE` folder, including file listing and statistics." +description = "This allows full recursive read access to metadata of the `$TEMPLATE` folder, including file listing and statistics." permissions = [ "read-meta", "scope-template-recursive" @@ -71,7 +75,7 @@ permissions = [ [[set]] identifier = "allow-template-meta" -description = "This allows read access to metadata of the `$TEMPLATE` folder, including file listing and statistics." +description = "This allows non-recursive read access to metadata of the `$TEMPLATE` folder, including file listing and statistics." permissions = [ "read-meta", "scope-template-index" diff --git a/plugins/fs/permissions/autogenerated/base-directories/video.toml b/plugins/fs/permissions/autogenerated/base-directories/video.toml index 2b73c825..df41abdc 100644 --- a/plugins/fs/permissions/autogenerated/base-directories/video.toml +++ b/plugins/fs/permissions/autogenerated/base-directories/video.toml @@ -7,15 +7,19 @@ [[permission]] identifier = "scope-video-recursive" -description = "This scope recursive access to the complete `$VIDEO` folder, including sub directories and files." +description = "This scope permits recursive access to the complete `$VIDEO` folder, including sub directories and files." +[[permission.scope.allow]] +path = "$VIDEO" [[permission.scope.allow]] path = "$VIDEO/**" [[permission]] identifier = "scope-video" -description = "This scope permits access to all files and list content of top level directories in the `$VIDEO`folder." +description = "This scope permits access to all files and list content of top level directories in the `$VIDEO` folder." +[[permission.scope.allow]] +path = "$VIDEO" [[permission.scope.allow]] path = "$VIDEO/*" @@ -24,7 +28,7 @@ identifier = "scope-video-index" description = "This scope permits to list all files and folders in the `$VIDEO`folder." [[permission.scope.allow]] -path = "$VIDEO/" +path = "$VIDEO" # Sets Section # This section combines the scope elements with enablement of commands @@ -39,7 +43,7 @@ permissions = [ [[set]] identifier = "allow-video-write-recursive" -description = "This allows full recusrive write access to the complete `$VIDEO` folder, files and subdirectories." +description = "This allows full recursive write access to the complete `$VIDEO` folder, files and subdirectories." permissions = [ "write-all", "scope-video-recursive" @@ -63,7 +67,7 @@ permissions = [ [[set]] identifier = "allow-video-meta-recursive" -description = "This allows read access to metadata of the `$VIDEO` folder, including file listing and statistics." +description = "This allows full recursive read access to metadata of the `$VIDEO` folder, including file listing and statistics." permissions = [ "read-meta", "scope-video-recursive" @@ -71,7 +75,7 @@ permissions = [ [[set]] identifier = "allow-video-meta" -description = "This allows read access to metadata of the `$VIDEO` folder, including file listing and statistics." +description = "This allows non-recursive read access to metadata of the `$VIDEO` folder, including file listing and statistics." permissions = [ "read-meta", "scope-video-index" diff --git a/plugins/fs/permissions/autogenerated/commands/read_text_file_lines.toml b/plugins/fs/permissions/autogenerated/commands/read_text_file_lines.toml index 1ba629cb..84b4ebb2 100644 --- a/plugins/fs/permissions/autogenerated/commands/read_text_file_lines.toml +++ b/plugins/fs/permissions/autogenerated/commands/read_text_file_lines.toml @@ -5,9 +5,18 @@ [[permission]] identifier = "allow-read-text-file-lines" description = "Enables the read_text_file_lines command without any pre-configured scope." -commands.allow = ["read_text_file_lines"] + +[permission.commands] +allow = [ + "read_text_file_lines", + "read_text_file_lines_next", +] +deny = [] [[permission]] identifier = "deny-read-text-file-lines" description = "Denies the read_text_file_lines command without any pre-configured scope." -commands.deny = ["read_text_file_lines"] + +[permission.commands] +allow = [] +deny = ["read_text_file_lines"] diff --git a/plugins/fs/permissions/autogenerated/commands/size.toml b/plugins/fs/permissions/autogenerated/commands/size.toml new file mode 100644 index 00000000..8a0ea55c --- /dev/null +++ b/plugins/fs/permissions/autogenerated/commands/size.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-size" +description = "Enables the size command without any pre-configured scope." +commands.allow = ["size"] + +[[permission]] +identifier = "deny-size" +description = "Denies the size command without any pre-configured scope." +commands.deny = ["size"] diff --git a/plugins/fs/permissions/autogenerated/commands/write_file.toml b/plugins/fs/permissions/autogenerated/commands/write_file.toml index cb0450fc..ea7d5136 100644 --- a/plugins/fs/permissions/autogenerated/commands/write_file.toml +++ b/plugins/fs/permissions/autogenerated/commands/write_file.toml @@ -5,9 +5,19 @@ [[permission]] identifier = "allow-write-file" description = "Enables the write_file command without any pre-configured scope." -commands.allow = ["write_file"] + +[permission.commands] +allow = [ + "write_file", + "open", + "write", +] +deny = [] [[permission]] identifier = "deny-write-file" description = "Denies the write_file command without any pre-configured scope." -commands.deny = ["write_file"] + +[permission.commands] +allow = [] +deny = ["write_file"] diff --git a/plugins/fs/permissions/autogenerated/reference.md b/plugins/fs/permissions/autogenerated/reference.md index 6e1d78d8..35ef551f 100644 --- a/plugins/fs/permissions/autogenerated/reference.md +++ b/plugins/fs/permissions/autogenerated/reference.md @@ -1,1164 +1,3780 @@ -# Permissions +## Default Permission -## allow-app-read-recursive +This set of permissions describes the what kind of +file system access the `fs` plugin has enabled or denied by default. -This allows full recursive read access to the complete `$APP` folder, files and subdirectories. +#### Granted Permissions -## allow-app-write-recursive +This default permission set enables read access to the +application specific directories (AppConfig, AppData, AppLocalData, AppCache, +AppLog) and all files and sub directories created in it. +The location of these directories depends on the operating system, +where the application is run. + +In general these directories need to be manually created +by the application at runtime, before accessing files or folders +in it is possible. + +Therefore, it is also allowed to create all of these folders via +the `mkdir` command. + +#### Denied Permissions + +This default permission set prevents access to critical components +of the Tauri application by default. +On Windows the webview data folder access is denied. + + +#### This default permission set includes the following: + +- `create-app-specific-dirs` +- `read-app-specific-dirs-recursive` +- `deny-default` + +## Permission Table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -This allows non-recursive read access to the `$APP` folder. + + + + -## allow-app-meta + + + + -This scope permits access to all files and list content of top level directories in the `$APP`folder. + + + + -## allow-appcache-write-recursive + + + + -This allows non-recursive write access to the `$APPCACHE` folder. + + + + -## scope-appcache-recursive + + + + -This scope permits to list all files and folders in the `$APPCACHE`folder. + + + + -## allow-appconfig-read + + + + -This allows read access to metadata of the `$APPCONFIG` folder, including file listing and statistics. + + + + -## scope-appconfig + + + + -This allows full recursive read access to the complete `$APPDATA` folder, files and subdirectories. + + + + -## allow-appdata-write + + + + -This allows read access to metadata of the `$APPDATA` folder, including file listing and statistics. + + + + -## scope-appdata-index + + + + -This allows full recusrive write access to the complete `$APPLOCALDATA` folder, files and subdirectories. + + + + -## allow-applocaldata-meta-recursive + + + + -This scope recursive access to the complete `$APPLOCALDATA` folder, including sub directories and files. + + + + -## allow-applog-read-recursive + + + + -This allows non-recursive read access to the `$APPLOG` folder. + + + + -## allow-applog-meta + + + + -This scope permits access to all files and list content of top level directories in the `$APPLOG`folder. + + + + -## allow-audio-write-recursive + + + + -This allows non-recursive write access to the `$AUDIO` folder. + + + + -## scope-audio-recursive + + + + -This scope permits to list all files and folders in the `$AUDIO`folder. + + + + -## allow-cache-read + + + + -This allows read access to metadata of the `$CACHE` folder, including file listing and statistics. + + + + -## scope-cache + + + + -This allows full recursive read access to the complete `$CONFIG` folder, files and subdirectories. + + + + -## allow-config-write + + + + -This allows read access to metadata of the `$CONFIG` folder, including file listing and statistics. + + + + -## scope-config-index + + + + -This allows full recusrive write access to the complete `$DATA` folder, files and subdirectories. + + + + -## allow-data-meta-recursive + + + + -This scope recursive access to the complete `$DATA` folder, including sub directories and files. + + + + -## allow-desktop-read-recursive + + + + -This allows non-recursive read access to the `$DESKTOP` folder. + + + + -## allow-desktop-meta + + + + -This scope permits access to all files and list content of top level directories in the `$DESKTOP`folder. + + + + -## allow-document-write-recursive + + + + -This allows non-recursive write access to the `$DOCUMENT` folder. + + + + -## scope-document-recursive + + + + -This scope permits to list all files and folders in the `$DOCUMENT`folder. + + + + -## allow-download-read + + + + -This allows read access to metadata of the `$DOWNLOAD` folder, including file listing and statistics. + + + + -## scope-download + + + + -This allows full recursive read access to the complete `$EXE` folder, files and subdirectories. + + + + -## allow-exe-write + + + + -This allows read access to metadata of the `$EXE` folder, including file listing and statistics. + + + + -## scope-exe-index + + + + -This allows full recusrive write access to the complete `$FONT` folder, files and subdirectories. + + + + -## allow-font-meta-recursive + + + + -This scope recursive access to the complete `$FONT` folder, including sub directories and files. + + + + -## allow-home-read-recursive + + + + -This allows non-recursive read access to the `$HOME` folder. + + + + -## allow-home-meta + + + + -This scope permits access to all files and list content of top level directories in the `$HOME`folder. + + + + -## allow-localdata-write-recursive + + + + -This allows non-recursive write access to the `$LOCALDATA` folder. + + + + -## scope-localdata-recursive + + + + -This scope permits to list all files and folders in the `$LOCALDATA`folder. + + + + -## allow-log-read + + + + -This allows read access to metadata of the `$LOG` folder, including file listing and statistics. + + + + -## scope-log + + + + -This allows full recursive read access to the complete `$PICTURE` folder, files and subdirectories. + + + + -## allow-picture-write + + + + -This allows read access to metadata of the `$PICTURE` folder, including file listing and statistics. + + + + -## scope-picture-index + + + + -This allows full recusrive write access to the complete `$PUBLIC` folder, files and subdirectories. + + + + -## allow-public-meta-recursive + + + + -This scope recursive access to the complete `$PUBLIC` folder, including sub directories and files. + + + + -## allow-resource-read-recursive + + + + -This allows non-recursive read access to the `$RESOURCE` folder. + + + + -## allow-resource-meta + + + + -This scope permits access to all files and list content of top level directories in the `$RESOURCE`folder. + + + + -## allow-runtime-write-recursive + + + + -This allows non-recursive write access to the `$RUNTIME` folder. + + + + -## scope-runtime-recursive + + + + -This scope permits to list all files and folders in the `$RUNTIME`folder. + + + + -## allow-temp-read + + + + -This allows read access to metadata of the `$TEMP` folder, including file listing and statistics. + + + + -## scope-temp + + + + -This allows full recursive read access to the complete `$TEMPLATE` folder, files and subdirectories. + + + + -## allow-template-write + + + + -This allows read access to metadata of the `$TEMPLATE` folder, including file listing and statistics. + + + + -## scope-template-index + + + + -This allows full recusrive write access to the complete `$VIDEO` folder, files and subdirectories. + + + + -## allow-video-meta-recursive + + + + -This scope recursive access to the complete `$VIDEO` folder, including sub directories and files. + + + + -## allow-copy-file + + + + -Enables the create command without any pre-configured scope. + + + + -## deny-exists + + + + -Denies the fstat command without any pre-configured scope. + + + + -## allow-lstat + + + + -Enables the mkdir command without any pre-configured scope. + + + + -## deny-open + + + + -Denies the read command without any pre-configured scope. + + + + -## allow-read-file + + + + -Enables the read_text_file command without any pre-configured scope. + + + + -## deny-read-text-file-lines + + + + -Denies the read_text_file_lines_next command without any pre-configured scope. + + + + -## allow-rename + + + + -Enables the seek command without any pre-configured scope. + + + + -## deny-stat + + + + -Denies the truncate command without any pre-configured scope. + + + + -## allow-watch + + + + -Enables the write command without any pre-configured scope. + + + + -## deny-write-file + + + + -Denies the write_text_file command without any pre-configured scope. + + + + -This default permission set enables all read-related commands and -allows access to the `$APP` folder and sub directories created in it. -The location of the `$APP` folder depends on the operating system, -where the application is run. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IdentifierDescription
+ +`fs:allow-app-read-recursive` + + + +This allows full recursive read access to the complete application folders, files and subdirectories. + +
+ +`fs:allow-app-write-recursive` + + + +This allows full recursive write access to the complete application folders, files and subdirectories. + +
+ +`fs:allow-app-read` + + + +This allows non-recursive read access to the application folders. + +
+ +`fs:allow-app-write` + + + +This allows non-recursive write access to the application folders. + +
+ +`fs:allow-app-meta-recursive` + + + +This allows full recursive read access to metadata of the application folders, including file listing and statistics. + +
+ +`fs:allow-app-meta` + + + +This allows non-recursive read access to metadata of the application folders, including file listing and statistics. + +
+ +`fs:scope-app-recursive` + + + +This scope permits recursive access to the complete application folders, including sub directories and files. + +
+ +`fs:scope-app` + + + +This scope permits access to all files and list content of top level directories in the application folders. + +
+ +`fs:scope-app-index` + + + +This scope permits to list all files and folders in the application directories. + +
+ +`fs:allow-appcache-read-recursive` + + + +This allows full recursive read access to the complete `$APPCACHE` folder, files and subdirectories. + +
+ +`fs:allow-appcache-write-recursive` + + + +This allows full recursive write access to the complete `$APPCACHE` folder, files and subdirectories. + +
+ +`fs:allow-appcache-read` + + + +This allows non-recursive read access to the `$APPCACHE` folder. + +
+ +`fs:allow-appcache-write` + + + +This allows non-recursive write access to the `$APPCACHE` folder. + +
+ +`fs:allow-appcache-meta-recursive` + + + +This allows full recursive read access to metadata of the `$APPCACHE` folder, including file listing and statistics. + +
+ +`fs:allow-appcache-meta` + + + +This allows non-recursive read access to metadata of the `$APPCACHE` folder, including file listing and statistics. + +
+ +`fs:scope-appcache-recursive` + + + +This scope permits recursive access to the complete `$APPCACHE` folder, including sub directories and files. + +
+ +`fs:scope-appcache` + + + +This scope permits access to all files and list content of top level directories in the `$APPCACHE` folder. + +
+ +`fs:scope-appcache-index` + + + +This scope permits to list all files and folders in the `$APPCACHE`folder. + +
+ +`fs:allow-appconfig-read-recursive` + + + +This allows full recursive read access to the complete `$APPCONFIG` folder, files and subdirectories. + +
+ +`fs:allow-appconfig-write-recursive` + + + +This allows full recursive write access to the complete `$APPCONFIG` folder, files and subdirectories. + +
+ +`fs:allow-appconfig-read` + + + +This allows non-recursive read access to the `$APPCONFIG` folder. + +
+ +`fs:allow-appconfig-write` + + + +This allows non-recursive write access to the `$APPCONFIG` folder. + +
+ +`fs:allow-appconfig-meta-recursive` + + + +This allows full recursive read access to metadata of the `$APPCONFIG` folder, including file listing and statistics. + +
+ +`fs:allow-appconfig-meta` + + + +This allows non-recursive read access to metadata of the `$APPCONFIG` folder, including file listing and statistics. + +
+ +`fs:scope-appconfig-recursive` + + + +This scope permits recursive access to the complete `$APPCONFIG` folder, including sub directories and files. + +
+ +`fs:scope-appconfig` + + + +This scope permits access to all files and list content of top level directories in the `$APPCONFIG` folder. + +
+ +`fs:scope-appconfig-index` + + + +This scope permits to list all files and folders in the `$APPCONFIG`folder. + +
+ +`fs:allow-appdata-read-recursive` + + + +This allows full recursive read access to the complete `$APPDATA` folder, files and subdirectories. + +
+ +`fs:allow-appdata-write-recursive` + + + +This allows full recursive write access to the complete `$APPDATA` folder, files and subdirectories. + +
+ +`fs:allow-appdata-read` + + + +This allows non-recursive read access to the `$APPDATA` folder. + +
+ +`fs:allow-appdata-write` + + + +This allows non-recursive write access to the `$APPDATA` folder. + +
+ +`fs:allow-appdata-meta-recursive` + + + +This allows full recursive read access to metadata of the `$APPDATA` folder, including file listing and statistics. + +
+ +`fs:allow-appdata-meta` + + + +This allows non-recursive read access to metadata of the `$APPDATA` folder, including file listing and statistics. + +
+ +`fs:scope-appdata-recursive` + + + +This scope permits recursive access to the complete `$APPDATA` folder, including sub directories and files. + +
+ +`fs:scope-appdata` + + + +This scope permits access to all files and list content of top level directories in the `$APPDATA` folder. + +
+ +`fs:scope-appdata-index` + + + +This scope permits to list all files and folders in the `$APPDATA`folder. + +
+ +`fs:allow-applocaldata-read-recursive` + + + +This allows full recursive read access to the complete `$APPLOCALDATA` folder, files and subdirectories. + +
+ +`fs:allow-applocaldata-write-recursive` + + + +This allows full recursive write access to the complete `$APPLOCALDATA` folder, files and subdirectories. + +
+ +`fs:allow-applocaldata-read` + + + +This allows non-recursive read access to the `$APPLOCALDATA` folder. + +
+ +`fs:allow-applocaldata-write` + + + +This allows non-recursive write access to the `$APPLOCALDATA` folder. + +
+ +`fs:allow-applocaldata-meta-recursive` + + + +This allows full recursive read access to metadata of the `$APPLOCALDATA` folder, including file listing and statistics. + +
+ +`fs:allow-applocaldata-meta` + + + +This allows non-recursive read access to metadata of the `$APPLOCALDATA` folder, including file listing and statistics. + +
+ +`fs:scope-applocaldata-recursive` + + + +This scope permits recursive access to the complete `$APPLOCALDATA` folder, including sub directories and files. + +
+ +`fs:scope-applocaldata` + + + +This scope permits access to all files and list content of top level directories in the `$APPLOCALDATA` folder. + +
+ +`fs:scope-applocaldata-index` + + + +This scope permits to list all files and folders in the `$APPLOCALDATA`folder. + +
+ +`fs:allow-applog-read-recursive` + + + +This allows full recursive read access to the complete `$APPLOG` folder, files and subdirectories. + +
+ +`fs:allow-applog-write-recursive` + + + +This allows full recursive write access to the complete `$APPLOG` folder, files and subdirectories. + +
+ +`fs:allow-applog-read` + + + +This allows non-recursive read access to the `$APPLOG` folder. + +
+ +`fs:allow-applog-write` + + + +This allows non-recursive write access to the `$APPLOG` folder. + +
+ +`fs:allow-applog-meta-recursive` + + + +This allows full recursive read access to metadata of the `$APPLOG` folder, including file listing and statistics. + +
+ +`fs:allow-applog-meta` + + + +This allows non-recursive read access to metadata of the `$APPLOG` folder, including file listing and statistics. + +
+ +`fs:scope-applog-recursive` + + + +This scope permits recursive access to the complete `$APPLOG` folder, including sub directories and files. + +
+ +`fs:scope-applog` + + + +This scope permits access to all files and list content of top level directories in the `$APPLOG` folder. + +
+ +`fs:scope-applog-index` + + + +This scope permits to list all files and folders in the `$APPLOG`folder. + +
+ +`fs:allow-audio-read-recursive` + + + +This allows full recursive read access to the complete `$AUDIO` folder, files and subdirectories. + +
+ +`fs:allow-audio-write-recursive` + + + +This allows full recursive write access to the complete `$AUDIO` folder, files and subdirectories. + +
+ +`fs:allow-audio-read` + + + +This allows non-recursive read access to the `$AUDIO` folder. + +
+ +`fs:allow-audio-write` + + + +This allows non-recursive write access to the `$AUDIO` folder. + +
+ +`fs:allow-audio-meta-recursive` + + + +This allows full recursive read access to metadata of the `$AUDIO` folder, including file listing and statistics. + +
+ +`fs:allow-audio-meta` + + + +This allows non-recursive read access to metadata of the `$AUDIO` folder, including file listing and statistics. + +
+ +`fs:scope-audio-recursive` + + + +This scope permits recursive access to the complete `$AUDIO` folder, including sub directories and files. + +
+ +`fs:scope-audio` + + + +This scope permits access to all files and list content of top level directories in the `$AUDIO` folder. + +
+ +`fs:scope-audio-index` + + + +This scope permits to list all files and folders in the `$AUDIO`folder. + +
+ +`fs:allow-cache-read-recursive` + + + +This allows full recursive read access to the complete `$CACHE` folder, files and subdirectories. + +
+ +`fs:allow-cache-write-recursive` + + + +This allows full recursive write access to the complete `$CACHE` folder, files and subdirectories. + +
+ +`fs:allow-cache-read` + + + +This allows non-recursive read access to the `$CACHE` folder. + +
+ +`fs:allow-cache-write` + + + +This allows non-recursive write access to the `$CACHE` folder. + +
+ +`fs:allow-cache-meta-recursive` + + + +This allows full recursive read access to metadata of the `$CACHE` folder, including file listing and statistics. + +
+ +`fs:allow-cache-meta` + + + +This allows non-recursive read access to metadata of the `$CACHE` folder, including file listing and statistics. + +
+ +`fs:scope-cache-recursive` + + + +This scope permits recursive access to the complete `$CACHE` folder, including sub directories and files. + +
+ +`fs:scope-cache` + + + +This scope permits access to all files and list content of top level directories in the `$CACHE` folder. + +
+ +`fs:scope-cache-index` + + + +This scope permits to list all files and folders in the `$CACHE`folder. + +
+ +`fs:allow-config-read-recursive` + + + +This allows full recursive read access to the complete `$CONFIG` folder, files and subdirectories. + +
+ +`fs:allow-config-write-recursive` + + + +This allows full recursive write access to the complete `$CONFIG` folder, files and subdirectories. + +
+ +`fs:allow-config-read` + + + +This allows non-recursive read access to the `$CONFIG` folder. + +
+ +`fs:allow-config-write` + + + +This allows non-recursive write access to the `$CONFIG` folder. + +
+ +`fs:allow-config-meta-recursive` + + + +This allows full recursive read access to metadata of the `$CONFIG` folder, including file listing and statistics. + +
+ +`fs:allow-config-meta` + + + +This allows non-recursive read access to metadata of the `$CONFIG` folder, including file listing and statistics. + +
+ +`fs:scope-config-recursive` + + + +This scope permits recursive access to the complete `$CONFIG` folder, including sub directories and files. + +
+ +`fs:scope-config` + + + +This scope permits access to all files and list content of top level directories in the `$CONFIG` folder. + +
+ +`fs:scope-config-index` + + + +This scope permits to list all files and folders in the `$CONFIG`folder. + +
+ +`fs:allow-data-read-recursive` + + + +This allows full recursive read access to the complete `$DATA` folder, files and subdirectories. + +
+ +`fs:allow-data-write-recursive` + + + +This allows full recursive write access to the complete `$DATA` folder, files and subdirectories. + +
+ +`fs:allow-data-read` + + + +This allows non-recursive read access to the `$DATA` folder. + +
+ +`fs:allow-data-write` + + + +This allows non-recursive write access to the `$DATA` folder. + +
+ +`fs:allow-data-meta-recursive` + + + +This allows full recursive read access to metadata of the `$DATA` folder, including file listing and statistics. + +
+ +`fs:allow-data-meta` + + + +This allows non-recursive read access to metadata of the `$DATA` folder, including file listing and statistics. + +
+ +`fs:scope-data-recursive` + + + +This scope permits recursive access to the complete `$DATA` folder, including sub directories and files. + +
+ +`fs:scope-data` + + + +This scope permits access to all files and list content of top level directories in the `$DATA` folder. + +
+ +`fs:scope-data-index` + + + +This scope permits to list all files and folders in the `$DATA`folder. + +
+ +`fs:allow-desktop-read-recursive` + + + +This allows full recursive read access to the complete `$DESKTOP` folder, files and subdirectories. + +
+ +`fs:allow-desktop-write-recursive` + + + +This allows full recursive write access to the complete `$DESKTOP` folder, files and subdirectories. + +
+ +`fs:allow-desktop-read` + + + +This allows non-recursive read access to the `$DESKTOP` folder. + +
+ +`fs:allow-desktop-write` + + + +This allows non-recursive write access to the `$DESKTOP` folder. + +
+ +`fs:allow-desktop-meta-recursive` + + + +This allows full recursive read access to metadata of the `$DESKTOP` folder, including file listing and statistics. + +
+ +`fs:allow-desktop-meta` + + + +This allows non-recursive read access to metadata of the `$DESKTOP` folder, including file listing and statistics. + +
+ +`fs:scope-desktop-recursive` + + + +This scope permits recursive access to the complete `$DESKTOP` folder, including sub directories and files. + +
+ +`fs:scope-desktop` + + + +This scope permits access to all files and list content of top level directories in the `$DESKTOP` folder. + +
+ +`fs:scope-desktop-index` + + + +This scope permits to list all files and folders in the `$DESKTOP`folder. + +
+ +`fs:allow-document-read-recursive` + + + +This allows full recursive read access to the complete `$DOCUMENT` folder, files and subdirectories. + +
+ +`fs:allow-document-write-recursive` + + + +This allows full recursive write access to the complete `$DOCUMENT` folder, files and subdirectories. + +
+ +`fs:allow-document-read` + + + +This allows non-recursive read access to the `$DOCUMENT` folder. + +
+ +`fs:allow-document-write` + + + +This allows non-recursive write access to the `$DOCUMENT` folder. + +
+ +`fs:allow-document-meta-recursive` + + + +This allows full recursive read access to metadata of the `$DOCUMENT` folder, including file listing and statistics. + +
+ +`fs:allow-document-meta` + + + +This allows non-recursive read access to metadata of the `$DOCUMENT` folder, including file listing and statistics. + +
+ +`fs:scope-document-recursive` + + + +This scope permits recursive access to the complete `$DOCUMENT` folder, including sub directories and files. + +
+ +`fs:scope-document` + + + +This scope permits access to all files and list content of top level directories in the `$DOCUMENT` folder. + +
+ +`fs:scope-document-index` + + + +This scope permits to list all files and folders in the `$DOCUMENT`folder. + +
+ +`fs:allow-download-read-recursive` + + + +This allows full recursive read access to the complete `$DOWNLOAD` folder, files and subdirectories. + +
+ +`fs:allow-download-write-recursive` + + + +This allows full recursive write access to the complete `$DOWNLOAD` folder, files and subdirectories. + +
+ +`fs:allow-download-read` + + + +This allows non-recursive read access to the `$DOWNLOAD` folder. + +
+ +`fs:allow-download-write` + + + +This allows non-recursive write access to the `$DOWNLOAD` folder. + +
+ +`fs:allow-download-meta-recursive` + + + +This allows full recursive read access to metadata of the `$DOWNLOAD` folder, including file listing and statistics. + +
+ +`fs:allow-download-meta` + + + +This allows non-recursive read access to metadata of the `$DOWNLOAD` folder, including file listing and statistics. + +
+ +`fs:scope-download-recursive` + + + +This scope permits recursive access to the complete `$DOWNLOAD` folder, including sub directories and files. + +
+ +`fs:scope-download` + + + +This scope permits access to all files and list content of top level directories in the `$DOWNLOAD` folder. + +
+ +`fs:scope-download-index` + + + +This scope permits to list all files and folders in the `$DOWNLOAD`folder. + +
+ +`fs:allow-exe-read-recursive` + + + +This allows full recursive read access to the complete `$EXE` folder, files and subdirectories. + +
+ +`fs:allow-exe-write-recursive` + + + +This allows full recursive write access to the complete `$EXE` folder, files and subdirectories. -This allows full recusrive write access to the complete `$APP` folder, files and subdirectories. +
+ +`fs:allow-exe-read` + + + +This allows non-recursive read access to the `$EXE` folder. + +
+ +`fs:allow-exe-write` + + + +This allows non-recursive write access to the `$EXE` folder. + +
+ +`fs:allow-exe-meta-recursive` + + + +This allows full recursive read access to metadata of the `$EXE` folder, including file listing and statistics. + +
+ +`fs:allow-exe-meta` + + + +This allows non-recursive read access to metadata of the `$EXE` folder, including file listing and statistics. + +
+ +`fs:scope-exe-recursive` + + + +This scope permits recursive access to the complete `$EXE` folder, including sub directories and files. + +
+ +`fs:scope-exe` + + + +This scope permits access to all files and list content of top level directories in the `$EXE` folder. + +
+ +`fs:scope-exe-index` + + + +This scope permits to list all files and folders in the `$EXE`folder. + +
+ +`fs:allow-font-read-recursive` + + + +This allows full recursive read access to the complete `$FONT` folder, files and subdirectories. + +
+ +`fs:allow-font-write-recursive` + + + +This allows full recursive write access to the complete `$FONT` folder, files and subdirectories. + +
+ +`fs:allow-font-read` + + + +This allows non-recursive read access to the `$FONT` folder. + +
+ +`fs:allow-font-write` + + + +This allows non-recursive write access to the `$FONT` folder. + +
+ +`fs:allow-font-meta-recursive` + + + +This allows full recursive read access to metadata of the `$FONT` folder, including file listing and statistics. + +
+ +`fs:allow-font-meta` + + + +This allows non-recursive read access to metadata of the `$FONT` folder, including file listing and statistics. + +
+ +`fs:scope-font-recursive` + + + +This scope permits recursive access to the complete `$FONT` folder, including sub directories and files. + +
+ +`fs:scope-font` + + + +This scope permits access to all files and list content of top level directories in the `$FONT` folder. + +
+ +`fs:scope-font-index` + + + +This scope permits to list all files and folders in the `$FONT`folder. + +
+ +`fs:allow-home-read-recursive` + + + +This allows full recursive read access to the complete `$HOME` folder, files and subdirectories. + +
+ +`fs:allow-home-write-recursive` + + + +This allows full recursive write access to the complete `$HOME` folder, files and subdirectories. + +
+ +`fs:allow-home-read` + + + +This allows non-recursive read access to the `$HOME` folder. + +
+ +`fs:allow-home-write` + + + +This allows non-recursive write access to the `$HOME` folder. + +
+ +`fs:allow-home-meta-recursive` + + + +This allows full recursive read access to metadata of the `$HOME` folder, including file listing and statistics. + +
+ +`fs:allow-home-meta` + + + +This allows non-recursive read access to metadata of the `$HOME` folder, including file listing and statistics. + +
+ +`fs:scope-home-recursive` + + + +This scope permits recursive access to the complete `$HOME` folder, including sub directories and files. + +
+ +`fs:scope-home` + + + +This scope permits access to all files and list content of top level directories in the `$HOME` folder. + +
+ +`fs:scope-home-index` + + + +This scope permits to list all files and folders in the `$HOME`folder. + +
+ +`fs:allow-localdata-read-recursive` + + + +This allows full recursive read access to the complete `$LOCALDATA` folder, files and subdirectories. + +
+ +`fs:allow-localdata-write-recursive` + + + +This allows full recursive write access to the complete `$LOCALDATA` folder, files and subdirectories. + +
+ +`fs:allow-localdata-read` + + + +This allows non-recursive read access to the `$LOCALDATA` folder. + +
+ +`fs:allow-localdata-write` + + + +This allows non-recursive write access to the `$LOCALDATA` folder. + +
+ +`fs:allow-localdata-meta-recursive` + + + +This allows full recursive read access to metadata of the `$LOCALDATA` folder, including file listing and statistics. + +
+ +`fs:allow-localdata-meta` + + + +This allows non-recursive read access to metadata of the `$LOCALDATA` folder, including file listing and statistics. + +
+ +`fs:scope-localdata-recursive` + + + +This scope permits recursive access to the complete `$LOCALDATA` folder, including sub directories and files. + +
+ +`fs:scope-localdata` + + + +This scope permits access to all files and list content of top level directories in the `$LOCALDATA` folder. + +
+ +`fs:scope-localdata-index` + + + +This scope permits to list all files and folders in the `$LOCALDATA`folder. + +
+ +`fs:allow-log-read-recursive` + + + +This allows full recursive read access to the complete `$LOG` folder, files and subdirectories. + +
+ +`fs:allow-log-write-recursive` + + + +This allows full recursive write access to the complete `$LOG` folder, files and subdirectories. + +
+ +`fs:allow-log-read` + + + +This allows non-recursive read access to the `$LOG` folder. + +
+ +`fs:allow-log-write` + + + +This allows non-recursive write access to the `$LOG` folder. + +
+ +`fs:allow-log-meta-recursive` + + + +This allows full recursive read access to metadata of the `$LOG` folder, including file listing and statistics. + +
+ +`fs:allow-log-meta` + + + +This allows non-recursive read access to metadata of the `$LOG` folder, including file listing and statistics. + +
+ +`fs:scope-log-recursive` + + + +This scope permits recursive access to the complete `$LOG` folder, including sub directories and files. + +
+ +`fs:scope-log` + + + +This scope permits access to all files and list content of top level directories in the `$LOG` folder. + +
+ +`fs:scope-log-index` + + + +This scope permits to list all files and folders in the `$LOG`folder. + +
+ +`fs:allow-picture-read-recursive` + + + +This allows full recursive read access to the complete `$PICTURE` folder, files and subdirectories. + +
+ +`fs:allow-picture-write-recursive` + + + +This allows full recursive write access to the complete `$PICTURE` folder, files and subdirectories. + +
+ +`fs:allow-picture-read` + + + +This allows non-recursive read access to the `$PICTURE` folder. + +
+ +`fs:allow-picture-write` + + + +This allows non-recursive write access to the `$PICTURE` folder. -## allow-app-read +
-## allow-app-write +`fs:allow-picture-meta-recursive` -This allows non-recursive write access to the `$APP` folder. + -## allow-app-meta-recursive +This allows full recursive read access to metadata of the `$PICTURE` folder, including file listing and statistics. -This allows read access to metadata of the `$APP` folder, including file listing and statistics. +
-This allows read access to metadata of the `$APP` folder, including file listing and statistics. +`fs:allow-picture-meta` -## scope-app-recursive + -This scope recursive access to the complete `$APP` folder, including sub directories and files. +This allows non-recursive read access to metadata of the `$PICTURE` folder, including file listing and statistics. -## scope-app +
-## scope-app-index +`fs:scope-picture-recursive` -This scope permits to list all files and folders in the `$APP`folder. + -## allow-appcache-read-recursive +This scope permits recursive access to the complete `$PICTURE` folder, including sub directories and files. -This allows full recursive read access to the complete `$APPCACHE` folder, files and subdirectories. +
-This allows full recusrive write access to the complete `$APPCACHE` folder, files and subdirectories. +`fs:scope-picture` -## allow-appcache-read + -This allows non-recursive read access to the `$APPCACHE` folder. +This scope permits access to all files and list content of top level directories in the `$PICTURE` folder. -## allow-appcache-write +
-## allow-appcache-meta-recursive +`fs:scope-picture-index` -This allows read access to metadata of the `$APPCACHE` folder, including file listing and statistics. + -## allow-appcache-meta +This scope permits to list all files and folders in the `$PICTURE`folder. -This allows read access to metadata of the `$APPCACHE` folder, including file listing and statistics. +
-This scope recursive access to the complete `$APPCACHE` folder, including sub directories and files. +`fs:allow-public-read-recursive` -## scope-appcache + -This scope permits access to all files and list content of top level directories in the `$APPCACHE`folder. +This allows full recursive read access to the complete `$PUBLIC` folder, files and subdirectories. -## scope-appcache-index +
-## allow-appconfig-read-recursive +`fs:allow-public-write-recursive` -This allows full recursive read access to the complete `$APPCONFIG` folder, files and subdirectories. + -## allow-appconfig-write-recursive +This allows full recursive write access to the complete `$PUBLIC` folder, files and subdirectories. -This allows full recusrive write access to the complete `$APPCONFIG` folder, files and subdirectories. +
-This allows non-recursive read access to the `$APPCONFIG` folder. +`fs:allow-public-read` -## allow-appconfig-write + -This allows non-recursive write access to the `$APPCONFIG` folder. +This allows non-recursive read access to the `$PUBLIC` folder. -## allow-appconfig-meta-recursive +
-## allow-appconfig-meta +`fs:allow-public-write` -This allows read access to metadata of the `$APPCONFIG` folder, including file listing and statistics. + -## scope-appconfig-recursive +This allows non-recursive write access to the `$PUBLIC` folder. -This scope recursive access to the complete `$APPCONFIG` folder, including sub directories and files. +
-This scope permits access to all files and list content of top level directories in the `$APPCONFIG`folder. +`fs:allow-public-meta-recursive` -## scope-appconfig-index + -This scope permits to list all files and folders in the `$APPCONFIG`folder. +This allows full recursive read access to metadata of the `$PUBLIC` folder, including file listing and statistics. -## allow-appdata-read-recursive +
-## allow-appdata-write-recursive +`fs:allow-public-meta` -This allows full recusrive write access to the complete `$APPDATA` folder, files and subdirectories. + -## allow-appdata-read +This allows non-recursive read access to metadata of the `$PUBLIC` folder, including file listing and statistics. -This allows non-recursive read access to the `$APPDATA` folder. +
-This allows non-recursive write access to the `$APPDATA` folder. +`fs:scope-public-recursive` -## allow-appdata-meta-recursive + -This allows read access to metadata of the `$APPDATA` folder, including file listing and statistics. +This scope permits recursive access to the complete `$PUBLIC` folder, including sub directories and files. -## allow-appdata-meta +
-## scope-appdata-recursive +`fs:scope-public` -This scope recursive access to the complete `$APPDATA` folder, including sub directories and files. + -## scope-appdata +This scope permits access to all files and list content of top level directories in the `$PUBLIC` folder. -This scope permits access to all files and list content of top level directories in the `$APPDATA`folder. +
-This scope permits to list all files and folders in the `$APPDATA`folder. +`fs:scope-public-index` -## allow-applocaldata-read-recursive + -This allows full recursive read access to the complete `$APPLOCALDATA` folder, files and subdirectories. +This scope permits to list all files and folders in the `$PUBLIC`folder. -## allow-applocaldata-write-recursive +
-## allow-applocaldata-read +`fs:allow-resource-read-recursive` -This allows non-recursive read access to the `$APPLOCALDATA` folder. + -## allow-applocaldata-write +This allows full recursive read access to the complete `$RESOURCE` folder, files and subdirectories. -This allows non-recursive write access to the `$APPLOCALDATA` folder. +
-This allows read access to metadata of the `$APPLOCALDATA` folder, including file listing and statistics. +`fs:allow-resource-write-recursive` -## allow-applocaldata-meta + -This allows read access to metadata of the `$APPLOCALDATA` folder, including file listing and statistics. +This allows full recursive write access to the complete `$RESOURCE` folder, files and subdirectories. -## scope-applocaldata-recursive +
-## scope-applocaldata +`fs:allow-resource-read` -This scope permits access to all files and list content of top level directories in the `$APPLOCALDATA`folder. + -## scope-applocaldata-index +This allows non-recursive read access to the `$RESOURCE` folder. -This scope permits to list all files and folders in the `$APPLOCALDATA`folder. +
-This allows full recursive read access to the complete `$APPLOG` folder, files and subdirectories. +`fs:allow-resource-write` -## allow-applog-write-recursive + -This allows full recusrive write access to the complete `$APPLOG` folder, files and subdirectories. +This allows non-recursive write access to the `$RESOURCE` folder. -## allow-applog-read +
-## allow-applog-write +`fs:allow-resource-meta-recursive` -This allows non-recursive write access to the `$APPLOG` folder. + -## allow-applog-meta-recursive +This allows full recursive read access to metadata of the `$RESOURCE` folder, including file listing and statistics. -This allows read access to metadata of the `$APPLOG` folder, including file listing and statistics. +
-This allows read access to metadata of the `$APPLOG` folder, including file listing and statistics. +`fs:allow-resource-meta` -## scope-applog-recursive + -This scope recursive access to the complete `$APPLOG` folder, including sub directories and files. +This allows non-recursive read access to metadata of the `$RESOURCE` folder, including file listing and statistics. -## scope-applog +
-## scope-applog-index +`fs:scope-resource-recursive` -This scope permits to list all files and folders in the `$APPLOG`folder. + -## allow-audio-read-recursive +This scope permits recursive access to the complete `$RESOURCE` folder, including sub directories and files. -This allows full recursive read access to the complete `$AUDIO` folder, files and subdirectories. +
-This allows full recusrive write access to the complete `$AUDIO` folder, files and subdirectories. +`fs:scope-resource` -## allow-audio-read + -This allows non-recursive read access to the `$AUDIO` folder. +This scope permits access to all files and list content of top level directories in the `$RESOURCE` folder. -## allow-audio-write +
-## allow-audio-meta-recursive +`fs:scope-resource-index` -This allows read access to metadata of the `$AUDIO` folder, including file listing and statistics. + -## allow-audio-meta +This scope permits to list all files and folders in the `$RESOURCE`folder. -This allows read access to metadata of the `$AUDIO` folder, including file listing and statistics. +
-This scope recursive access to the complete `$AUDIO` folder, including sub directories and files. +`fs:allow-runtime-read-recursive` -## scope-audio + -This scope permits access to all files and list content of top level directories in the `$AUDIO`folder. +This allows full recursive read access to the complete `$RUNTIME` folder, files and subdirectories. -## scope-audio-index +
-## allow-cache-read-recursive +`fs:allow-runtime-write-recursive` -This allows full recursive read access to the complete `$CACHE` folder, files and subdirectories. + -## allow-cache-write-recursive +This allows full recursive write access to the complete `$RUNTIME` folder, files and subdirectories. -This allows full recusrive write access to the complete `$CACHE` folder, files and subdirectories. +
-This allows non-recursive read access to the `$CACHE` folder. +`fs:allow-runtime-read` -## allow-cache-write + -This allows non-recursive write access to the `$CACHE` folder. +This allows non-recursive read access to the `$RUNTIME` folder. -## allow-cache-meta-recursive +
-## allow-cache-meta +`fs:allow-runtime-write` -This allows read access to metadata of the `$CACHE` folder, including file listing and statistics. + -## scope-cache-recursive +This allows non-recursive write access to the `$RUNTIME` folder. -This scope recursive access to the complete `$CACHE` folder, including sub directories and files. +
-This scope permits access to all files and list content of top level directories in the `$CACHE`folder. +`fs:allow-runtime-meta-recursive` -## scope-cache-index + -This scope permits to list all files and folders in the `$CACHE`folder. +This allows full recursive read access to metadata of the `$RUNTIME` folder, including file listing and statistics. -## allow-config-read-recursive +
-## allow-config-write-recursive +`fs:allow-runtime-meta` -This allows full recusrive write access to the complete `$CONFIG` folder, files and subdirectories. + -## allow-config-read +This allows non-recursive read access to metadata of the `$RUNTIME` folder, including file listing and statistics. -This allows non-recursive read access to the `$CONFIG` folder. +
-This allows non-recursive write access to the `$CONFIG` folder. +`fs:scope-runtime-recursive` -## allow-config-meta-recursive + -This allows read access to metadata of the `$CONFIG` folder, including file listing and statistics. +This scope permits recursive access to the complete `$RUNTIME` folder, including sub directories and files. -## allow-config-meta +
-## scope-config-recursive +`fs:scope-runtime` -This scope recursive access to the complete `$CONFIG` folder, including sub directories and files. + -## scope-config +This scope permits access to all files and list content of top level directories in the `$RUNTIME` folder. -This scope permits access to all files and list content of top level directories in the `$CONFIG`folder. +
-This scope permits to list all files and folders in the `$CONFIG`folder. +`fs:scope-runtime-index` -## allow-data-read-recursive + -This allows full recursive read access to the complete `$DATA` folder, files and subdirectories. +This scope permits to list all files and folders in the `$RUNTIME`folder. -## allow-data-write-recursive +
-## allow-data-read +`fs:allow-temp-read-recursive` -This allows non-recursive read access to the `$DATA` folder. + -## allow-data-write +This allows full recursive read access to the complete `$TEMP` folder, files and subdirectories. -This allows non-recursive write access to the `$DATA` folder. +
-This allows read access to metadata of the `$DATA` folder, including file listing and statistics. +`fs:allow-temp-write-recursive` -## allow-data-meta + -This allows read access to metadata of the `$DATA` folder, including file listing and statistics. +This allows full recursive write access to the complete `$TEMP` folder, files and subdirectories. -## scope-data-recursive +
-## scope-data +`fs:allow-temp-read` -This scope permits access to all files and list content of top level directories in the `$DATA`folder. + -## scope-data-index +This allows non-recursive read access to the `$TEMP` folder. -This scope permits to list all files and folders in the `$DATA`folder. +
-This allows full recursive read access to the complete `$DESKTOP` folder, files and subdirectories. +`fs:allow-temp-write` -## allow-desktop-write-recursive + -This allows full recusrive write access to the complete `$DESKTOP` folder, files and subdirectories. +This allows non-recursive write access to the `$TEMP` folder. -## allow-desktop-read +
-## allow-desktop-write +`fs:allow-temp-meta-recursive` -This allows non-recursive write access to the `$DESKTOP` folder. + -## allow-desktop-meta-recursive +This allows full recursive read access to metadata of the `$TEMP` folder, including file listing and statistics. -This allows read access to metadata of the `$DESKTOP` folder, including file listing and statistics. +
-This allows read access to metadata of the `$DESKTOP` folder, including file listing and statistics. +`fs:allow-temp-meta` -## scope-desktop-recursive + -This scope recursive access to the complete `$DESKTOP` folder, including sub directories and files. +This allows non-recursive read access to metadata of the `$TEMP` folder, including file listing and statistics. -## scope-desktop +
-## scope-desktop-index +`fs:scope-temp-recursive` -This scope permits to list all files and folders in the `$DESKTOP`folder. + -## allow-document-read-recursive +This scope permits recursive access to the complete `$TEMP` folder, including sub directories and files. -This allows full recursive read access to the complete `$DOCUMENT` folder, files and subdirectories. +
-This allows full recusrive write access to the complete `$DOCUMENT` folder, files and subdirectories. +`fs:scope-temp` -## allow-document-read + -This allows non-recursive read access to the `$DOCUMENT` folder. +This scope permits access to all files and list content of top level directories in the `$TEMP` folder. -## allow-document-write +
-## allow-document-meta-recursive +`fs:scope-temp-index` -This allows read access to metadata of the `$DOCUMENT` folder, including file listing and statistics. + -## allow-document-meta +This scope permits to list all files and folders in the `$TEMP`folder. -This allows read access to metadata of the `$DOCUMENT` folder, including file listing and statistics. +
-This scope recursive access to the complete `$DOCUMENT` folder, including sub directories and files. +`fs:allow-template-read-recursive` -## scope-document + -This scope permits access to all files and list content of top level directories in the `$DOCUMENT`folder. +This allows full recursive read access to the complete `$TEMPLATE` folder, files and subdirectories. -## scope-document-index +
-## allow-download-read-recursive +`fs:allow-template-write-recursive` -This allows full recursive read access to the complete `$DOWNLOAD` folder, files and subdirectories. + -## allow-download-write-recursive +This allows full recursive write access to the complete `$TEMPLATE` folder, files and subdirectories. -This allows full recusrive write access to the complete `$DOWNLOAD` folder, files and subdirectories. +
-This allows non-recursive read access to the `$DOWNLOAD` folder. +`fs:allow-template-read` -## allow-download-write + -This allows non-recursive write access to the `$DOWNLOAD` folder. +This allows non-recursive read access to the `$TEMPLATE` folder. -## allow-download-meta-recursive +
-## allow-download-meta +`fs:allow-template-write` -This allows read access to metadata of the `$DOWNLOAD` folder, including file listing and statistics. + -## scope-download-recursive +This allows non-recursive write access to the `$TEMPLATE` folder. -This scope recursive access to the complete `$DOWNLOAD` folder, including sub directories and files. +
-This scope permits access to all files and list content of top level directories in the `$DOWNLOAD`folder. +`fs:allow-template-meta-recursive` -## scope-download-index + -This scope permits to list all files and folders in the `$DOWNLOAD`folder. +This allows full recursive read access to metadata of the `$TEMPLATE` folder, including file listing and statistics. -## allow-exe-read-recursive +
-## allow-exe-write-recursive +`fs:allow-template-meta` -This allows full recusrive write access to the complete `$EXE` folder, files and subdirectories. + -## allow-exe-read +This allows non-recursive read access to metadata of the `$TEMPLATE` folder, including file listing and statistics. -This allows non-recursive read access to the `$EXE` folder. +
-This allows non-recursive write access to the `$EXE` folder. +`fs:scope-template-recursive` -## allow-exe-meta-recursive + -This allows read access to metadata of the `$EXE` folder, including file listing and statistics. +This scope permits recursive access to the complete `$TEMPLATE` folder, including sub directories and files. -## allow-exe-meta +
-## scope-exe-recursive +`fs:scope-template` -This scope recursive access to the complete `$EXE` folder, including sub directories and files. + -## scope-exe +This scope permits access to all files and list content of top level directories in the `$TEMPLATE` folder. -This scope permits access to all files and list content of top level directories in the `$EXE`folder. +
-This scope permits to list all files and folders in the `$EXE`folder. +`fs:scope-template-index` -## allow-font-read-recursive + -This allows full recursive read access to the complete `$FONT` folder, files and subdirectories. +This scope permits to list all files and folders in the `$TEMPLATE`folder. -## allow-font-write-recursive +
-## allow-font-read +`fs:allow-video-read-recursive` -This allows non-recursive read access to the `$FONT` folder. + -## allow-font-write +This allows full recursive read access to the complete `$VIDEO` folder, files and subdirectories. -This allows non-recursive write access to the `$FONT` folder. +
-This allows read access to metadata of the `$FONT` folder, including file listing and statistics. +`fs:allow-video-write-recursive` -## allow-font-meta + -This allows read access to metadata of the `$FONT` folder, including file listing and statistics. +This allows full recursive write access to the complete `$VIDEO` folder, files and subdirectories. -## scope-font-recursive +
-## scope-font +`fs:allow-video-read` -This scope permits access to all files and list content of top level directories in the `$FONT`folder. + -## scope-font-index +This allows non-recursive read access to the `$VIDEO` folder. -This scope permits to list all files and folders in the `$FONT`folder. +
-This allows full recursive read access to the complete `$HOME` folder, files and subdirectories. +`fs:allow-video-write` -## allow-home-write-recursive + -This allows full recusrive write access to the complete `$HOME` folder, files and subdirectories. +This allows non-recursive write access to the `$VIDEO` folder. -## allow-home-read +
-## allow-home-write +`fs:allow-video-meta-recursive` -This allows non-recursive write access to the `$HOME` folder. + -## allow-home-meta-recursive +This allows full recursive read access to metadata of the `$VIDEO` folder, including file listing and statistics. -This allows read access to metadata of the `$HOME` folder, including file listing and statistics. +
-This allows read access to metadata of the `$HOME` folder, including file listing and statistics. +`fs:allow-video-meta` -## scope-home-recursive + -This scope recursive access to the complete `$HOME` folder, including sub directories and files. +This allows non-recursive read access to metadata of the `$VIDEO` folder, including file listing and statistics. -## scope-home +
-## scope-home-index +`fs:scope-video-recursive` -This scope permits to list all files and folders in the `$HOME`folder. + -## allow-localdata-read-recursive +This scope permits recursive access to the complete `$VIDEO` folder, including sub directories and files. -This allows full recursive read access to the complete `$LOCALDATA` folder, files and subdirectories. +
-This allows full recusrive write access to the complete `$LOCALDATA` folder, files and subdirectories. +`fs:scope-video` -## allow-localdata-read + -This allows non-recursive read access to the `$LOCALDATA` folder. +This scope permits access to all files and list content of top level directories in the `$VIDEO` folder. -## allow-localdata-write +
-## allow-localdata-meta-recursive +`fs:scope-video-index` -This allows read access to metadata of the `$LOCALDATA` folder, including file listing and statistics. + -## allow-localdata-meta +This scope permits to list all files and folders in the `$VIDEO`folder. -This allows read access to metadata of the `$LOCALDATA` folder, including file listing and statistics. +
-This scope recursive access to the complete `$LOCALDATA` folder, including sub directories and files. +`fs:allow-copy-file` -## scope-localdata + -This scope permits access to all files and list content of top level directories in the `$LOCALDATA`folder. +Enables the copy_file command without any pre-configured scope. -## scope-localdata-index +
-## allow-log-read-recursive +`fs:deny-copy-file` -This allows full recursive read access to the complete `$LOG` folder, files and subdirectories. + -## allow-log-write-recursive +Denies the copy_file command without any pre-configured scope. -This allows full recusrive write access to the complete `$LOG` folder, files and subdirectories. +
-This allows non-recursive read access to the `$LOG` folder. +`fs:allow-create` -## allow-log-write + -This allows non-recursive write access to the `$LOG` folder. +Enables the create command without any pre-configured scope. -## allow-log-meta-recursive +
-## allow-log-meta +`fs:deny-create` -This allows read access to metadata of the `$LOG` folder, including file listing and statistics. + -## scope-log-recursive +Denies the create command without any pre-configured scope. -This scope recursive access to the complete `$LOG` folder, including sub directories and files. +
-This scope permits access to all files and list content of top level directories in the `$LOG`folder. +`fs:allow-exists` -## scope-log-index + -This scope permits to list all files and folders in the `$LOG`folder. +Enables the exists command without any pre-configured scope. -## allow-picture-read-recursive +
-## allow-picture-write-recursive +`fs:deny-exists` -This allows full recusrive write access to the complete `$PICTURE` folder, files and subdirectories. + -## allow-picture-read +Denies the exists command without any pre-configured scope. -This allows non-recursive read access to the `$PICTURE` folder. +
-This allows non-recursive write access to the `$PICTURE` folder. +`fs:allow-fstat` -## allow-picture-meta-recursive + -This allows read access to metadata of the `$PICTURE` folder, including file listing and statistics. +Enables the fstat command without any pre-configured scope. -## allow-picture-meta +
-## scope-picture-recursive +`fs:deny-fstat` -This scope recursive access to the complete `$PICTURE` folder, including sub directories and files. + -## scope-picture +Denies the fstat command without any pre-configured scope. -This scope permits access to all files and list content of top level directories in the `$PICTURE`folder. +
-This scope permits to list all files and folders in the `$PICTURE`folder. +`fs:allow-ftruncate` -## allow-public-read-recursive + -This allows full recursive read access to the complete `$PUBLIC` folder, files and subdirectories. +Enables the ftruncate command without any pre-configured scope. -## allow-public-write-recursive +
-## allow-public-read +`fs:deny-ftruncate` -This allows non-recursive read access to the `$PUBLIC` folder. + -## allow-public-write +Denies the ftruncate command without any pre-configured scope. -This allows non-recursive write access to the `$PUBLIC` folder. +
-This allows read access to metadata of the `$PUBLIC` folder, including file listing and statistics. +`fs:allow-lstat` -## allow-public-meta + -This allows read access to metadata of the `$PUBLIC` folder, including file listing and statistics. +Enables the lstat command without any pre-configured scope. -## scope-public-recursive +
-## scope-public +`fs:deny-lstat` -This scope permits access to all files and list content of top level directories in the `$PUBLIC`folder. + -## scope-public-index +Denies the lstat command without any pre-configured scope. -This scope permits to list all files and folders in the `$PUBLIC`folder. +
-This allows full recursive read access to the complete `$RESOURCE` folder, files and subdirectories. +`fs:allow-mkdir` -## allow-resource-write-recursive + -This allows full recusrive write access to the complete `$RESOURCE` folder, files and subdirectories. +Enables the mkdir command without any pre-configured scope. -## allow-resource-read +
-## allow-resource-write +`fs:deny-mkdir` -This allows non-recursive write access to the `$RESOURCE` folder. + -## allow-resource-meta-recursive +Denies the mkdir command without any pre-configured scope. -This allows read access to metadata of the `$RESOURCE` folder, including file listing and statistics. +
-This allows read access to metadata of the `$RESOURCE` folder, including file listing and statistics. +`fs:allow-open` -## scope-resource-recursive + -This scope recursive access to the complete `$RESOURCE` folder, including sub directories and files. +Enables the open command without any pre-configured scope. -## scope-resource +
-## scope-resource-index +`fs:deny-open` -This scope permits to list all files and folders in the `$RESOURCE`folder. + -## allow-runtime-read-recursive +Denies the open command without any pre-configured scope. -This allows full recursive read access to the complete `$RUNTIME` folder, files and subdirectories. +
-This allows full recusrive write access to the complete `$RUNTIME` folder, files and subdirectories. +`fs:allow-read` -## allow-runtime-read + -This allows non-recursive read access to the `$RUNTIME` folder. +Enables the read command without any pre-configured scope. -## allow-runtime-write +
-## allow-runtime-meta-recursive +`fs:deny-read` -This allows read access to metadata of the `$RUNTIME` folder, including file listing and statistics. + -## allow-runtime-meta +Denies the read command without any pre-configured scope. -This allows read access to metadata of the `$RUNTIME` folder, including file listing and statistics. +
-This scope recursive access to the complete `$RUNTIME` folder, including sub directories and files. +`fs:allow-read-dir` -## scope-runtime + -This scope permits access to all files and list content of top level directories in the `$RUNTIME`folder. +Enables the read_dir command without any pre-configured scope. -## scope-runtime-index +
-## allow-temp-read-recursive +`fs:deny-read-dir` -This allows full recursive read access to the complete `$TEMP` folder, files and subdirectories. + -## allow-temp-write-recursive +Denies the read_dir command without any pre-configured scope. -This allows full recusrive write access to the complete `$TEMP` folder, files and subdirectories. +
-This allows non-recursive read access to the `$TEMP` folder. +`fs:allow-read-file` -## allow-temp-write + -This allows non-recursive write access to the `$TEMP` folder. +Enables the read_file command without any pre-configured scope. -## allow-temp-meta-recursive +
-## allow-temp-meta +`fs:deny-read-file` -This allows read access to metadata of the `$TEMP` folder, including file listing and statistics. + -## scope-temp-recursive +Denies the read_file command without any pre-configured scope. -This scope recursive access to the complete `$TEMP` folder, including sub directories and files. +
-This scope permits access to all files and list content of top level directories in the `$TEMP`folder. +`fs:allow-read-text-file` -## scope-temp-index + -This scope permits to list all files and folders in the `$TEMP`folder. +Enables the read_text_file command without any pre-configured scope. -## allow-template-read-recursive +
-## allow-template-write-recursive +`fs:deny-read-text-file` -This allows full recusrive write access to the complete `$TEMPLATE` folder, files and subdirectories. + -## allow-template-read +Denies the read_text_file command without any pre-configured scope. -This allows non-recursive read access to the `$TEMPLATE` folder. +
-This allows non-recursive write access to the `$TEMPLATE` folder. +`fs:allow-read-text-file-lines` -## allow-template-meta-recursive + -This allows read access to metadata of the `$TEMPLATE` folder, including file listing and statistics. +Enables the read_text_file_lines command without any pre-configured scope. -## allow-template-meta +
-## scope-template-recursive +`fs:deny-read-text-file-lines` -This scope recursive access to the complete `$TEMPLATE` folder, including sub directories and files. + -## scope-template +Denies the read_text_file_lines command without any pre-configured scope. -This scope permits access to all files and list content of top level directories in the `$TEMPLATE`folder. +
-This scope permits to list all files and folders in the `$TEMPLATE`folder. +`fs:allow-read-text-file-lines-next` -## allow-video-read-recursive + -This allows full recursive read access to the complete `$VIDEO` folder, files and subdirectories. +Enables the read_text_file_lines_next command without any pre-configured scope. -## allow-video-write-recursive +
-## allow-video-read +`fs:deny-read-text-file-lines-next` -This allows non-recursive read access to the `$VIDEO` folder. + -## allow-video-write +Denies the read_text_file_lines_next command without any pre-configured scope. -This allows non-recursive write access to the `$VIDEO` folder. +
-This allows read access to metadata of the `$VIDEO` folder, including file listing and statistics. +`fs:allow-remove` -## allow-video-meta + -This allows read access to metadata of the `$VIDEO` folder, including file listing and statistics. +Enables the remove command without any pre-configured scope. -## scope-video-recursive +
-## scope-video +`fs:deny-remove` -This scope permits access to all files and list content of top level directories in the `$VIDEO`folder. + -## scope-video-index +Denies the remove command without any pre-configured scope. -This scope permits to list all files and folders in the `$VIDEO`folder. +
-Enables the copy_file command without any pre-configured scope. +`fs:allow-rename` -## deny-copy-file + -Denies the copy_file command without any pre-configured scope. +Enables the rename command without any pre-configured scope. -## allow-create +
-## deny-create +`fs:deny-rename` -Denies the create command without any pre-configured scope. + -## allow-exists +Denies the rename command without any pre-configured scope. -Enables the exists command without any pre-configured scope. +
-Denies the exists command without any pre-configured scope. +`fs:allow-seek` -## allow-fstat + -Enables the fstat command without any pre-configured scope. +Enables the seek command without any pre-configured scope. -## deny-fstat +
-## allow-ftruncate +`fs:deny-seek` -Enables the ftruncate command without any pre-configured scope. + -## deny-ftruncate +Denies the seek command without any pre-configured scope. -Denies the ftruncate command without any pre-configured scope. +
-Enables the lstat command without any pre-configured scope. +`fs:allow-size` -## deny-lstat + -Denies the lstat command without any pre-configured scope. +Enables the size command without any pre-configured scope. -## allow-mkdir +
-## deny-mkdir +`fs:deny-size` -Denies the mkdir command without any pre-configured scope. + -## allow-open +Denies the size command without any pre-configured scope. -Enables the open command without any pre-configured scope. +
-Denies the open command without any pre-configured scope. +`fs:allow-stat` -## allow-read + -Enables the read command without any pre-configured scope. +Enables the stat command without any pre-configured scope. -## deny-read +
-## allow-read-dir +`fs:deny-stat` -Enables the read_dir command without any pre-configured scope. + -## deny-read-dir +Denies the stat command without any pre-configured scope. -Denies the read_dir command without any pre-configured scope. +
-Enables the read_file command without any pre-configured scope. +`fs:allow-truncate` -## deny-read-file + -Denies the read_file command without any pre-configured scope. +Enables the truncate command without any pre-configured scope. -## allow-read-text-file +
-## deny-read-text-file +`fs:deny-truncate` -Denies the read_text_file command without any pre-configured scope. + -## allow-read-text-file-lines +Denies the truncate command without any pre-configured scope. -Enables the read_text_file_lines command without any pre-configured scope. +
-Denies the read_text_file_lines command without any pre-configured scope. +`fs:allow-unwatch` -## allow-read-text-file-lines-next + -Enables the read_text_file_lines_next command without any pre-configured scope. +Enables the unwatch command without any pre-configured scope. -## deny-read-text-file-lines-next +
-## allow-remove +`fs:deny-unwatch` -Enables the remove command without any pre-configured scope. + -## deny-remove +Denies the unwatch command without any pre-configured scope. -Denies the remove command without any pre-configured scope. +
-Enables the rename command without any pre-configured scope. +`fs:allow-watch` -## deny-rename + -Denies the rename command without any pre-configured scope. +Enables the watch command without any pre-configured scope. -## allow-seek +
-## deny-seek +`fs:deny-watch` -Denies the seek command without any pre-configured scope. + -## allow-stat +Denies the watch command without any pre-configured scope. -Enables the stat command without any pre-configured scope. +
-Denies the stat command without any pre-configured scope. +`fs:allow-write` -## allow-truncate + -Enables the truncate command without any pre-configured scope. +Enables the write command without any pre-configured scope. -## deny-truncate +
-## allow-unwatch +`fs:deny-write` -Enables the unwatch command without any pre-configured scope. + -## deny-unwatch +Denies the write command without any pre-configured scope. -Denies the unwatch command without any pre-configured scope. +
-Enables the watch command without any pre-configured scope. +`fs:allow-write-file` -## deny-watch + -Denies the watch command without any pre-configured scope. +Enables the write_file command without any pre-configured scope. -## allow-write +
-## deny-write +`fs:deny-write-file` -Denies the write command without any pre-configured scope. + -## allow-write-file +Denies the write_file command without any pre-configured scope. -Enables the write_file command without any pre-configured scope. +
-Denies the write_file command without any pre-configured scope. +`fs:allow-write-text-file` -## allow-write-text-file + Enables the write_text_file command without any pre-configured scope. -## deny-write-text-file +
-## default +`fs:deny-write-text-file` -# Tauri `fs` default permissions + -This configuration file defines the default permissions granted -to the filesystem. +Denies the write_text_file command without any pre-configured scope. -### Granted Permissions +
-In general the `$APP` folder needs to be manually created -by the application at runtime, before accessing files or folders -in it is possible. +`fs:create-app-specific-dirs` -### Denied Permissions + + +This permissions allows to create the application specific directories. -This default permission set prevents access to critical components -of the Tauri application by default. -On Windows the webview data folder access is denied. +
-## deny-default +`fs:deny-default` + + This denies access to dangerous Tauri relevant files and folders by default. -## deny-webview-data-linux +
+ +`fs:deny-webview-data-linux` + + This denies read access to the `$APPLOCALDATA` folder on linux as the webview data and configuration values are stored here. Allowing access can lead to sensitive information disclosure and should be well considered. -## deny-webview-data-windows +
+ +`fs:deny-webview-data-windows` + + This denies read access to the `$APPLOCALDATA/EBWebView` folder on windows as the webview data and configuration values are stored here. Allowing access can lead to sensitive information disclosure and should be well considered. -## read-all +
+ +`fs:read-all` + + This enables all read related commands without any pre-configured accessible paths. -## read-dirs +
+ +`fs:read-app-specific-dirs-recursive` + + + +This permission allows recursive read functionality on the application +specific base directories. + + +
+ +`fs:read-dirs` + + This enables directory read and file metadata related commands without any pre-configured accessible paths. -## read-files +
+ +`fs:read-files` + + This enables file read related commands without any pre-configured accessible paths. -## read-meta +
+ +`fs:read-meta` + + This enables all index or metadata related commands without any pre-configured accessible paths. -## scope +
+ +`fs:scope` + + An empty permission you can use to modify the global scope. -## write-all +
+ +`fs:write-all` + + This enables all write related commands without any pre-configured accessible paths. -## write-files +
+ +`fs:write-files` + + This enables all file write related commands without any pre-configured accessible paths. +
diff --git a/plugins/fs/permissions/create-app-specific-dirs.toml b/plugins/fs/permissions/create-app-specific-dirs.toml new file mode 100644 index 00000000..7785cb13 --- /dev/null +++ b/plugins/fs/permissions/create-app-specific-dirs.toml @@ -0,0 +1,8 @@ +"$schema" = "schemas/schema.json" + +[[permission]] +identifier = "create-app-specific-dirs" +description = """ +This permissions allows to create the application specific directories. +""" +commands.allow = ["mkdir", "scope-app-index"] diff --git a/plugins/fs/permissions/default.toml b/plugins/fs/permissions/default.toml index 213fece0..78836df7 100644 --- a/plugins/fs/permissions/default.toml +++ b/plugins/fs/permissions/default.toml @@ -2,27 +2,32 @@ [default] description = """ -# Tauri `fs` default permissions +This set of permissions describes the what kind of +file system access the `fs` plugin has enabled or denied by default. -This configuration file defines the default permissions granted -to the filesystem. +#### Granted Permissions -### Granted Permissions - -This default permission set enables all read-related commands and -allows access to the `$APP` folder and sub directories created in it. -The location of the `$APP` folder depends on the operating system, +This default permission set enables read access to the +application specific directories (AppConfig, AppData, AppLocalData, AppCache, +AppLog) and all files and sub directories created in it. +The location of these directories depends on the operating system, where the application is run. -In general the `$APP` folder needs to be manually created +In general these directories need to be manually created by the application at runtime, before accessing files or folders in it is possible. -### Denied Permissions +Therefore, it is also allowed to create all of these folders via +the `mkdir` command. + +#### Denied Permissions This default permission set prevents access to critical components of the Tauri application by default. On Windows the webview data folder access is denied. - """ -permissions = ["read-all", "scope-app-recursive", "deny-default"] +permissions = [ + "create-app-specific-dirs", + "read-app-specific-dirs-recursive", + "deny-default", +] diff --git a/plugins/fs/permissions/read-all.toml b/plugins/fs/permissions/read-all.toml index 99cbadf3..d43af5e0 100644 --- a/plugins/fs/permissions/read-all.toml +++ b/plugins/fs/permissions/read-all.toml @@ -4,18 +4,18 @@ identifier = "read-all" description = "This enables all read related commands without any pre-configured accessible paths." commands.allow = [ - "read_dir", - "read_file", - "read", - "open", - "read_text_file", - "read_text_file_lines", - "read_text_file_lines_next", - "seek", - "stat", - "lstat", - "fstat", - "exists", - "watch", - "unwatch", + "read_dir", + "read_file", + "read", + "open", + "read_text_file", + "read_text_file_lines", + "read_text_file_lines_next", + "seek", + "stat", + "lstat", + "fstat", + "exists", + "watch", + "unwatch", ] diff --git a/plugins/fs/permissions/read-app-specific-dirs-recursive.toml b/plugins/fs/permissions/read-app-specific-dirs-recursive.toml new file mode 100644 index 00000000..5342dbc0 --- /dev/null +++ b/plugins/fs/permissions/read-app-specific-dirs-recursive.toml @@ -0,0 +1,17 @@ +"$schema" = "schemas/schema.json" + +[[permission]] +identifier = "read-app-specific-dirs-recursive" +description = """ +This permission allows recursive read functionality on the application +specific base directories. +""" +commands.allow = [ + "read_dir", + "read_file", + "read_text_file", + "read_text_file_lines", + "read_text_file_lines_next", + "exists", + "scope-app-recursive", +] diff --git a/plugins/fs/permissions/read-files.toml b/plugins/fs/permissions/read-files.toml index a0691b44..f2685108 100644 --- a/plugins/fs/permissions/read-files.toml +++ b/plugins/fs/permissions/read-files.toml @@ -4,16 +4,16 @@ identifier = "read-files" description = "This enables file read related commands without any pre-configured accessible paths." commands.allow = [ - "read_file", - "read", - "open", - "read_text_file", - "read_text_file_lines", - "read_text_file_lines_next", - "seek", - "stat", - "lstat", - "fstat", - "exists", + "read_file", + "read", + "open", + "read_text_file", + "read_text_file_lines", + "read_text_file_lines_next", + "seek", + "stat", + "lstat", + "fstat", + "exists", ] diff --git a/plugins/fs/permissions/read-meta.toml b/plugins/fs/permissions/read-meta.toml index 09c731ad..83024b0c 100644 --- a/plugins/fs/permissions/read-meta.toml +++ b/plugins/fs/permissions/read-meta.toml @@ -3,4 +3,4 @@ [[permission]] identifier = "read-meta" description = "This enables all index or metadata related commands without any pre-configured accessible paths." -commands.allow = ["read_dir", "stat", "lstat", "fstat", "exists"] +commands.allow = ["read_dir", "stat", "lstat", "fstat", "exists", "size"] diff --git a/plugins/fs/permissions/schemas/schema.json b/plugins/fs/permissions/schemas/schema.json index 3f7361ab..54c6798b 100644 --- a/plugins/fs/permissions/schemas/schema.json +++ b/plugins/fs/permissions/schemas/schema.json @@ -17,7 +17,6 @@ }, "set": { "description": "A list of permissions sets defined", - "default": [], "type": "array", "items": { "$ref": "#/definitions/PermissionSet" @@ -50,7 +49,7 @@ "minimum": 1.0 }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -112,7 +111,7 @@ "type": "string" }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri internal convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -132,12 +131,21 @@ }, "scope": { "description": "Allowed or denied scoped when using this permission.", - "default": {}, "allOf": [ { "$ref": "#/definitions/Scopes" } ] + }, + "platforms": { + "description": "Target platforms this permission applies. By default all platforms are affected by this permission.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Target" + } } } }, @@ -164,7 +172,7 @@ } }, "Scopes": { - "description": "A restriction of the command/endpoint functionality.\n\nIt can be of any serde serializable type and is used for allowing or preventing certain actions inside a Tauri command.\n\nThe scope is passed to the command and handled/enforced by the command itself.", + "description": "An argument for fine grained behavior control of Tauri commands.\n\nIt can be of any serde serializable type and is used to allow or prevent certain actions inside a Tauri command. The configured scope is passed to the command and will be enforced by the command implementation.\n\n## Example\n\n```json { \"allow\": [{ \"path\": \"$HOME/**\" }], \"deny\": [{ \"path\": \"$HOME/secret.txt\" }] } ```", "type": "object", "properties": { "allow": { @@ -178,7 +186,7 @@ } }, "deny": { - "description": "Data that defines what is denied by the scope.", + "description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.", "type": [ "array", "null" @@ -243,1996 +251,1776 @@ } ] }, - "PermissionKind": { - "type": "string", + "Target": { + "description": "Platform target.", "oneOf": [ { - "description": "allow-app-read-recursive -> This allows full recursive read access to the complete `$APP` folder, files and subdirectories.", + "description": "MacOS.", "type": "string", "enum": [ - "allow-app-read-recursive" + "macOS" ] }, { - "description": "allow-app-write-recursive -> This allows full recusrive write access to the complete `$APP` folder, files and subdirectories.", + "description": "Windows.", "type": "string", "enum": [ - "allow-app-write-recursive" + "windows" ] }, { - "description": "allow-app-read -> This allows non-recursive read access to the `$APP` folder.", + "description": "Linux.", "type": "string", "enum": [ - "allow-app-read" + "linux" ] }, { - "description": "allow-app-write -> This allows non-recursive write access to the `$APP` folder.", + "description": "Android.", "type": "string", "enum": [ - "allow-app-write" + "android" ] }, { - "description": "allow-app-meta-recursive -> This allows read access to metadata of the `$APP` folder, including file listing and statistics.", + "description": "iOS.", "type": "string", "enum": [ - "allow-app-meta-recursive" + "iOS" ] + } + ] + }, + "PermissionKind": { + "type": "string", + "oneOf": [ + { + "description": "This allows full recursive read access to the complete application folders, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-app-recursive`", + "type": "string", + "const": "allow-app-read-recursive", + "markdownDescription": "This allows full recursive read access to the complete application folders, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-app-recursive`" }, { - "description": "allow-app-meta -> This allows read access to metadata of the `$APP` folder, including file listing and statistics.", + "description": "This allows full recursive write access to the complete application folders, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-app-recursive`", "type": "string", - "enum": [ - "allow-app-meta" - ] + "const": "allow-app-write-recursive", + "markdownDescription": "This allows full recursive write access to the complete application folders, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-app-recursive`" }, { - "description": "scope-app-recursive -> This scope recursive access to the complete `$APP` folder, including sub directories and files.", + "description": "This allows non-recursive read access to the application folders.\n#### This permission set includes:\n\n- `read-all`\n- `scope-app`", "type": "string", - "enum": [ - "scope-app-recursive" - ] + "const": "allow-app-read", + "markdownDescription": "This allows non-recursive read access to the application folders.\n#### This permission set includes:\n\n- `read-all`\n- `scope-app`" }, { - "description": "scope-app -> This scope permits access to all files and list content of top level directories in the `$APP`folder.", + "description": "This allows non-recursive write access to the application folders.\n#### This permission set includes:\n\n- `write-all`\n- `scope-app`", "type": "string", - "enum": [ - "scope-app" - ] + "const": "allow-app-write", + "markdownDescription": "This allows non-recursive write access to the application folders.\n#### This permission set includes:\n\n- `write-all`\n- `scope-app`" }, { - "description": "scope-app-index -> This scope permits to list all files and folders in the `$APP`folder.", + "description": "This allows full recursive read access to metadata of the application folders, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-app-recursive`", "type": "string", - "enum": [ - "scope-app-index" - ] + "const": "allow-app-meta-recursive", + "markdownDescription": "This allows full recursive read access to metadata of the application folders, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-app-recursive`" }, { - "description": "allow-appcache-read-recursive -> This allows full recursive read access to the complete `$APPCACHE` folder, files and subdirectories.", + "description": "This allows non-recursive read access to metadata of the application folders, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-app-index`", "type": "string", - "enum": [ - "allow-appcache-read-recursive" - ] + "const": "allow-app-meta", + "markdownDescription": "This allows non-recursive read access to metadata of the application folders, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-app-index`" }, { - "description": "allow-appcache-write-recursive -> This allows full recusrive write access to the complete `$APPCACHE` folder, files and subdirectories.", + "description": "This scope permits recursive access to the complete application folders, including sub directories and files.", "type": "string", - "enum": [ - "allow-appcache-write-recursive" - ] + "const": "scope-app-recursive", + "markdownDescription": "This scope permits recursive access to the complete application folders, including sub directories and files." }, { - "description": "allow-appcache-read -> This allows non-recursive read access to the `$APPCACHE` folder.", + "description": "This scope permits access to all files and list content of top level directories in the application folders.", "type": "string", - "enum": [ - "allow-appcache-read" - ] + "const": "scope-app", + "markdownDescription": "This scope permits access to all files and list content of top level directories in the application folders." }, { - "description": "allow-appcache-write -> This allows non-recursive write access to the `$APPCACHE` folder.", + "description": "This scope permits to list all files and folders in the application directories.", "type": "string", - "enum": [ - "allow-appcache-write" - ] + "const": "scope-app-index", + "markdownDescription": "This scope permits to list all files and folders in the application directories." }, { - "description": "allow-appcache-meta-recursive -> This allows read access to metadata of the `$APPCACHE` folder, including file listing and statistics.", + "description": "This allows full recursive read access to the complete `$APPCACHE` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-appcache-recursive`", "type": "string", - "enum": [ - "allow-appcache-meta-recursive" - ] + "const": "allow-appcache-read-recursive", + "markdownDescription": "This allows full recursive read access to the complete `$APPCACHE` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-appcache-recursive`" }, { - "description": "allow-appcache-meta -> This allows read access to metadata of the `$APPCACHE` folder, including file listing and statistics.", + "description": "This allows full recursive write access to the complete `$APPCACHE` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-appcache-recursive`", "type": "string", - "enum": [ - "allow-appcache-meta" - ] + "const": "allow-appcache-write-recursive", + "markdownDescription": "This allows full recursive write access to the complete `$APPCACHE` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-appcache-recursive`" }, { - "description": "scope-appcache-recursive -> This scope recursive access to the complete `$APPCACHE` folder, including sub directories and files.", + "description": "This allows non-recursive read access to the `$APPCACHE` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-appcache`", "type": "string", - "enum": [ - "scope-appcache-recursive" - ] + "const": "allow-appcache-read", + "markdownDescription": "This allows non-recursive read access to the `$APPCACHE` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-appcache`" }, { - "description": "scope-appcache -> This scope permits access to all files and list content of top level directories in the `$APPCACHE`folder.", + "description": "This allows non-recursive write access to the `$APPCACHE` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-appcache`", "type": "string", - "enum": [ - "scope-appcache" - ] + "const": "allow-appcache-write", + "markdownDescription": "This allows non-recursive write access to the `$APPCACHE` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-appcache`" }, { - "description": "scope-appcache-index -> This scope permits to list all files and folders in the `$APPCACHE`folder.", + "description": "This allows full recursive read access to metadata of the `$APPCACHE` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-appcache-recursive`", "type": "string", - "enum": [ - "scope-appcache-index" - ] + "const": "allow-appcache-meta-recursive", + "markdownDescription": "This allows full recursive read access to metadata of the `$APPCACHE` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-appcache-recursive`" }, { - "description": "allow-appconfig-read-recursive -> This allows full recursive read access to the complete `$APPCONFIG` folder, files and subdirectories.", + "description": "This allows non-recursive read access to metadata of the `$APPCACHE` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-appcache-index`", "type": "string", - "enum": [ - "allow-appconfig-read-recursive" - ] + "const": "allow-appcache-meta", + "markdownDescription": "This allows non-recursive read access to metadata of the `$APPCACHE` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-appcache-index`" }, { - "description": "allow-appconfig-write-recursive -> This allows full recusrive write access to the complete `$APPCONFIG` folder, files and subdirectories.", + "description": "This scope permits recursive access to the complete `$APPCACHE` folder, including sub directories and files.", "type": "string", - "enum": [ - "allow-appconfig-write-recursive" - ] + "const": "scope-appcache-recursive", + "markdownDescription": "This scope permits recursive access to the complete `$APPCACHE` folder, including sub directories and files." }, { - "description": "allow-appconfig-read -> This allows non-recursive read access to the `$APPCONFIG` folder.", + "description": "This scope permits access to all files and list content of top level directories in the `$APPCACHE` folder.", "type": "string", - "enum": [ - "allow-appconfig-read" - ] + "const": "scope-appcache", + "markdownDescription": "This scope permits access to all files and list content of top level directories in the `$APPCACHE` folder." }, { - "description": "allow-appconfig-write -> This allows non-recursive write access to the `$APPCONFIG` folder.", + "description": "This scope permits to list all files and folders in the `$APPCACHE`folder.", "type": "string", - "enum": [ - "allow-appconfig-write" - ] + "const": "scope-appcache-index", + "markdownDescription": "This scope permits to list all files and folders in the `$APPCACHE`folder." }, { - "description": "allow-appconfig-meta-recursive -> This allows read access to metadata of the `$APPCONFIG` folder, including file listing and statistics.", + "description": "This allows full recursive read access to the complete `$APPCONFIG` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-appconfig-recursive`", "type": "string", - "enum": [ - "allow-appconfig-meta-recursive" - ] + "const": "allow-appconfig-read-recursive", + "markdownDescription": "This allows full recursive read access to the complete `$APPCONFIG` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-appconfig-recursive`" }, { - "description": "allow-appconfig-meta -> This allows read access to metadata of the `$APPCONFIG` folder, including file listing and statistics.", + "description": "This allows full recursive write access to the complete `$APPCONFIG` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-appconfig-recursive`", "type": "string", - "enum": [ - "allow-appconfig-meta" - ] + "const": "allow-appconfig-write-recursive", + "markdownDescription": "This allows full recursive write access to the complete `$APPCONFIG` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-appconfig-recursive`" }, { - "description": "scope-appconfig-recursive -> This scope recursive access to the complete `$APPCONFIG` folder, including sub directories and files.", + "description": "This allows non-recursive read access to the `$APPCONFIG` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-appconfig`", "type": "string", - "enum": [ - "scope-appconfig-recursive" - ] + "const": "allow-appconfig-read", + "markdownDescription": "This allows non-recursive read access to the `$APPCONFIG` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-appconfig`" }, { - "description": "scope-appconfig -> This scope permits access to all files and list content of top level directories in the `$APPCONFIG`folder.", + "description": "This allows non-recursive write access to the `$APPCONFIG` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-appconfig`", "type": "string", - "enum": [ - "scope-appconfig" - ] + "const": "allow-appconfig-write", + "markdownDescription": "This allows non-recursive write access to the `$APPCONFIG` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-appconfig`" }, { - "description": "scope-appconfig-index -> This scope permits to list all files and folders in the `$APPCONFIG`folder.", + "description": "This allows full recursive read access to metadata of the `$APPCONFIG` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-appconfig-recursive`", "type": "string", - "enum": [ - "scope-appconfig-index" - ] + "const": "allow-appconfig-meta-recursive", + "markdownDescription": "This allows full recursive read access to metadata of the `$APPCONFIG` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-appconfig-recursive`" }, { - "description": "allow-appdata-read-recursive -> This allows full recursive read access to the complete `$APPDATA` folder, files and subdirectories.", + "description": "This allows non-recursive read access to metadata of the `$APPCONFIG` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-appconfig-index`", "type": "string", - "enum": [ - "allow-appdata-read-recursive" - ] + "const": "allow-appconfig-meta", + "markdownDescription": "This allows non-recursive read access to metadata of the `$APPCONFIG` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-appconfig-index`" }, { - "description": "allow-appdata-write-recursive -> This allows full recusrive write access to the complete `$APPDATA` folder, files and subdirectories.", + "description": "This scope permits recursive access to the complete `$APPCONFIG` folder, including sub directories and files.", "type": "string", - "enum": [ - "allow-appdata-write-recursive" - ] + "const": "scope-appconfig-recursive", + "markdownDescription": "This scope permits recursive access to the complete `$APPCONFIG` folder, including sub directories and files." }, { - "description": "allow-appdata-read -> This allows non-recursive read access to the `$APPDATA` folder.", + "description": "This scope permits access to all files and list content of top level directories in the `$APPCONFIG` folder.", "type": "string", - "enum": [ - "allow-appdata-read" - ] + "const": "scope-appconfig", + "markdownDescription": "This scope permits access to all files and list content of top level directories in the `$APPCONFIG` folder." }, { - "description": "allow-appdata-write -> This allows non-recursive write access to the `$APPDATA` folder.", + "description": "This scope permits to list all files and folders in the `$APPCONFIG`folder.", "type": "string", - "enum": [ - "allow-appdata-write" - ] + "const": "scope-appconfig-index", + "markdownDescription": "This scope permits to list all files and folders in the `$APPCONFIG`folder." }, { - "description": "allow-appdata-meta-recursive -> This allows read access to metadata of the `$APPDATA` folder, including file listing and statistics.", + "description": "This allows full recursive read access to the complete `$APPDATA` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-appdata-recursive`", "type": "string", - "enum": [ - "allow-appdata-meta-recursive" - ] + "const": "allow-appdata-read-recursive", + "markdownDescription": "This allows full recursive read access to the complete `$APPDATA` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-appdata-recursive`" }, { - "description": "allow-appdata-meta -> This allows read access to metadata of the `$APPDATA` folder, including file listing and statistics.", + "description": "This allows full recursive write access to the complete `$APPDATA` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-appdata-recursive`", "type": "string", - "enum": [ - "allow-appdata-meta" - ] + "const": "allow-appdata-write-recursive", + "markdownDescription": "This allows full recursive write access to the complete `$APPDATA` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-appdata-recursive`" }, { - "description": "scope-appdata-recursive -> This scope recursive access to the complete `$APPDATA` folder, including sub directories and files.", + "description": "This allows non-recursive read access to the `$APPDATA` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-appdata`", "type": "string", - "enum": [ - "scope-appdata-recursive" - ] + "const": "allow-appdata-read", + "markdownDescription": "This allows non-recursive read access to the `$APPDATA` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-appdata`" }, { - "description": "scope-appdata -> This scope permits access to all files and list content of top level directories in the `$APPDATA`folder.", + "description": "This allows non-recursive write access to the `$APPDATA` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-appdata`", "type": "string", - "enum": [ - "scope-appdata" - ] + "const": "allow-appdata-write", + "markdownDescription": "This allows non-recursive write access to the `$APPDATA` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-appdata`" }, { - "description": "scope-appdata-index -> This scope permits to list all files and folders in the `$APPDATA`folder.", + "description": "This allows full recursive read access to metadata of the `$APPDATA` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-appdata-recursive`", "type": "string", - "enum": [ - "scope-appdata-index" - ] + "const": "allow-appdata-meta-recursive", + "markdownDescription": "This allows full recursive read access to metadata of the `$APPDATA` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-appdata-recursive`" }, { - "description": "allow-applocaldata-read-recursive -> This allows full recursive read access to the complete `$APPLOCALDATA` folder, files and subdirectories.", + "description": "This allows non-recursive read access to metadata of the `$APPDATA` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-appdata-index`", "type": "string", - "enum": [ - "allow-applocaldata-read-recursive" - ] + "const": "allow-appdata-meta", + "markdownDescription": "This allows non-recursive read access to metadata of the `$APPDATA` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-appdata-index`" }, { - "description": "allow-applocaldata-write-recursive -> This allows full recusrive write access to the complete `$APPLOCALDATA` folder, files and subdirectories.", + "description": "This scope permits recursive access to the complete `$APPDATA` folder, including sub directories and files.", "type": "string", - "enum": [ - "allow-applocaldata-write-recursive" - ] + "const": "scope-appdata-recursive", + "markdownDescription": "This scope permits recursive access to the complete `$APPDATA` folder, including sub directories and files." }, { - "description": "allow-applocaldata-read -> This allows non-recursive read access to the `$APPLOCALDATA` folder.", + "description": "This scope permits access to all files and list content of top level directories in the `$APPDATA` folder.", "type": "string", - "enum": [ - "allow-applocaldata-read" - ] + "const": "scope-appdata", + "markdownDescription": "This scope permits access to all files and list content of top level directories in the `$APPDATA` folder." }, { - "description": "allow-applocaldata-write -> This allows non-recursive write access to the `$APPLOCALDATA` folder.", + "description": "This scope permits to list all files and folders in the `$APPDATA`folder.", "type": "string", - "enum": [ - "allow-applocaldata-write" - ] + "const": "scope-appdata-index", + "markdownDescription": "This scope permits to list all files and folders in the `$APPDATA`folder." }, { - "description": "allow-applocaldata-meta-recursive -> This allows read access to metadata of the `$APPLOCALDATA` folder, including file listing and statistics.", + "description": "This allows full recursive read access to the complete `$APPLOCALDATA` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-applocaldata-recursive`", "type": "string", - "enum": [ - "allow-applocaldata-meta-recursive" - ] + "const": "allow-applocaldata-read-recursive", + "markdownDescription": "This allows full recursive read access to the complete `$APPLOCALDATA` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-applocaldata-recursive`" }, { - "description": "allow-applocaldata-meta -> This allows read access to metadata of the `$APPLOCALDATA` folder, including file listing and statistics.", + "description": "This allows full recursive write access to the complete `$APPLOCALDATA` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-applocaldata-recursive`", "type": "string", - "enum": [ - "allow-applocaldata-meta" - ] + "const": "allow-applocaldata-write-recursive", + "markdownDescription": "This allows full recursive write access to the complete `$APPLOCALDATA` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-applocaldata-recursive`" }, { - "description": "scope-applocaldata-recursive -> This scope recursive access to the complete `$APPLOCALDATA` folder, including sub directories and files.", + "description": "This allows non-recursive read access to the `$APPLOCALDATA` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-applocaldata`", "type": "string", - "enum": [ - "scope-applocaldata-recursive" - ] + "const": "allow-applocaldata-read", + "markdownDescription": "This allows non-recursive read access to the `$APPLOCALDATA` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-applocaldata`" }, { - "description": "scope-applocaldata -> This scope permits access to all files and list content of top level directories in the `$APPLOCALDATA`folder.", + "description": "This allows non-recursive write access to the `$APPLOCALDATA` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-applocaldata`", "type": "string", - "enum": [ - "scope-applocaldata" - ] + "const": "allow-applocaldata-write", + "markdownDescription": "This allows non-recursive write access to the `$APPLOCALDATA` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-applocaldata`" }, { - "description": "scope-applocaldata-index -> This scope permits to list all files and folders in the `$APPLOCALDATA`folder.", + "description": "This allows full recursive read access to metadata of the `$APPLOCALDATA` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-applocaldata-recursive`", "type": "string", - "enum": [ - "scope-applocaldata-index" - ] + "const": "allow-applocaldata-meta-recursive", + "markdownDescription": "This allows full recursive read access to metadata of the `$APPLOCALDATA` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-applocaldata-recursive`" }, { - "description": "allow-applog-read-recursive -> This allows full recursive read access to the complete `$APPLOG` folder, files and subdirectories.", + "description": "This allows non-recursive read access to metadata of the `$APPLOCALDATA` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-applocaldata-index`", "type": "string", - "enum": [ - "allow-applog-read-recursive" - ] + "const": "allow-applocaldata-meta", + "markdownDescription": "This allows non-recursive read access to metadata of the `$APPLOCALDATA` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-applocaldata-index`" }, { - "description": "allow-applog-write-recursive -> This allows full recusrive write access to the complete `$APPLOG` folder, files and subdirectories.", + "description": "This scope permits recursive access to the complete `$APPLOCALDATA` folder, including sub directories and files.", "type": "string", - "enum": [ - "allow-applog-write-recursive" - ] + "const": "scope-applocaldata-recursive", + "markdownDescription": "This scope permits recursive access to the complete `$APPLOCALDATA` folder, including sub directories and files." }, { - "description": "allow-applog-read -> This allows non-recursive read access to the `$APPLOG` folder.", + "description": "This scope permits access to all files and list content of top level directories in the `$APPLOCALDATA` folder.", "type": "string", - "enum": [ - "allow-applog-read" - ] + "const": "scope-applocaldata", + "markdownDescription": "This scope permits access to all files and list content of top level directories in the `$APPLOCALDATA` folder." }, { - "description": "allow-applog-write -> This allows non-recursive write access to the `$APPLOG` folder.", + "description": "This scope permits to list all files and folders in the `$APPLOCALDATA`folder.", "type": "string", - "enum": [ - "allow-applog-write" - ] + "const": "scope-applocaldata-index", + "markdownDescription": "This scope permits to list all files and folders in the `$APPLOCALDATA`folder." }, { - "description": "allow-applog-meta-recursive -> This allows read access to metadata of the `$APPLOG` folder, including file listing and statistics.", + "description": "This allows full recursive read access to the complete `$APPLOG` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-applog-recursive`", "type": "string", - "enum": [ - "allow-applog-meta-recursive" - ] + "const": "allow-applog-read-recursive", + "markdownDescription": "This allows full recursive read access to the complete `$APPLOG` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-applog-recursive`" }, { - "description": "allow-applog-meta -> This allows read access to metadata of the `$APPLOG` folder, including file listing and statistics.", + "description": "This allows full recursive write access to the complete `$APPLOG` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-applog-recursive`", "type": "string", - "enum": [ - "allow-applog-meta" - ] + "const": "allow-applog-write-recursive", + "markdownDescription": "This allows full recursive write access to the complete `$APPLOG` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-applog-recursive`" }, { - "description": "scope-applog-recursive -> This scope recursive access to the complete `$APPLOG` folder, including sub directories and files.", + "description": "This allows non-recursive read access to the `$APPLOG` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-applog`", "type": "string", - "enum": [ - "scope-applog-recursive" - ] + "const": "allow-applog-read", + "markdownDescription": "This allows non-recursive read access to the `$APPLOG` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-applog`" }, { - "description": "scope-applog -> This scope permits access to all files and list content of top level directories in the `$APPLOG`folder.", + "description": "This allows non-recursive write access to the `$APPLOG` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-applog`", "type": "string", - "enum": [ - "scope-applog" - ] + "const": "allow-applog-write", + "markdownDescription": "This allows non-recursive write access to the `$APPLOG` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-applog`" }, { - "description": "scope-applog-index -> This scope permits to list all files and folders in the `$APPLOG`folder.", + "description": "This allows full recursive read access to metadata of the `$APPLOG` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-applog-recursive`", "type": "string", - "enum": [ - "scope-applog-index" - ] + "const": "allow-applog-meta-recursive", + "markdownDescription": "This allows full recursive read access to metadata of the `$APPLOG` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-applog-recursive`" }, { - "description": "allow-audio-read-recursive -> This allows full recursive read access to the complete `$AUDIO` folder, files and subdirectories.", + "description": "This allows non-recursive read access to metadata of the `$APPLOG` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-applog-index`", "type": "string", - "enum": [ - "allow-audio-read-recursive" - ] + "const": "allow-applog-meta", + "markdownDescription": "This allows non-recursive read access to metadata of the `$APPLOG` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-applog-index`" }, { - "description": "allow-audio-write-recursive -> This allows full recusrive write access to the complete `$AUDIO` folder, files and subdirectories.", + "description": "This scope permits recursive access to the complete `$APPLOG` folder, including sub directories and files.", "type": "string", - "enum": [ - "allow-audio-write-recursive" - ] + "const": "scope-applog-recursive", + "markdownDescription": "This scope permits recursive access to the complete `$APPLOG` folder, including sub directories and files." }, { - "description": "allow-audio-read -> This allows non-recursive read access to the `$AUDIO` folder.", + "description": "This scope permits access to all files and list content of top level directories in the `$APPLOG` folder.", "type": "string", - "enum": [ - "allow-audio-read" - ] + "const": "scope-applog", + "markdownDescription": "This scope permits access to all files and list content of top level directories in the `$APPLOG` folder." }, { - "description": "allow-audio-write -> This allows non-recursive write access to the `$AUDIO` folder.", + "description": "This scope permits to list all files and folders in the `$APPLOG`folder.", "type": "string", - "enum": [ - "allow-audio-write" - ] + "const": "scope-applog-index", + "markdownDescription": "This scope permits to list all files and folders in the `$APPLOG`folder." }, { - "description": "allow-audio-meta-recursive -> This allows read access to metadata of the `$AUDIO` folder, including file listing and statistics.", + "description": "This allows full recursive read access to the complete `$AUDIO` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-audio-recursive`", "type": "string", - "enum": [ - "allow-audio-meta-recursive" - ] + "const": "allow-audio-read-recursive", + "markdownDescription": "This allows full recursive read access to the complete `$AUDIO` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-audio-recursive`" }, { - "description": "allow-audio-meta -> This allows read access to metadata of the `$AUDIO` folder, including file listing and statistics.", + "description": "This allows full recursive write access to the complete `$AUDIO` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-audio-recursive`", "type": "string", - "enum": [ - "allow-audio-meta" - ] + "const": "allow-audio-write-recursive", + "markdownDescription": "This allows full recursive write access to the complete `$AUDIO` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-audio-recursive`" }, { - "description": "scope-audio-recursive -> This scope recursive access to the complete `$AUDIO` folder, including sub directories and files.", + "description": "This allows non-recursive read access to the `$AUDIO` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-audio`", "type": "string", - "enum": [ - "scope-audio-recursive" - ] + "const": "allow-audio-read", + "markdownDescription": "This allows non-recursive read access to the `$AUDIO` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-audio`" }, { - "description": "scope-audio -> This scope permits access to all files and list content of top level directories in the `$AUDIO`folder.", + "description": "This allows non-recursive write access to the `$AUDIO` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-audio`", "type": "string", - "enum": [ - "scope-audio" - ] + "const": "allow-audio-write", + "markdownDescription": "This allows non-recursive write access to the `$AUDIO` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-audio`" }, { - "description": "scope-audio-index -> This scope permits to list all files and folders in the `$AUDIO`folder.", + "description": "This allows full recursive read access to metadata of the `$AUDIO` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-audio-recursive`", "type": "string", - "enum": [ - "scope-audio-index" - ] + "const": "allow-audio-meta-recursive", + "markdownDescription": "This allows full recursive read access to metadata of the `$AUDIO` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-audio-recursive`" }, { - "description": "allow-cache-read-recursive -> This allows full recursive read access to the complete `$CACHE` folder, files and subdirectories.", + "description": "This allows non-recursive read access to metadata of the `$AUDIO` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-audio-index`", "type": "string", - "enum": [ - "allow-cache-read-recursive" - ] + "const": "allow-audio-meta", + "markdownDescription": "This allows non-recursive read access to metadata of the `$AUDIO` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-audio-index`" }, { - "description": "allow-cache-write-recursive -> This allows full recusrive write access to the complete `$CACHE` folder, files and subdirectories.", + "description": "This scope permits recursive access to the complete `$AUDIO` folder, including sub directories and files.", "type": "string", - "enum": [ - "allow-cache-write-recursive" - ] + "const": "scope-audio-recursive", + "markdownDescription": "This scope permits recursive access to the complete `$AUDIO` folder, including sub directories and files." }, { - "description": "allow-cache-read -> This allows non-recursive read access to the `$CACHE` folder.", + "description": "This scope permits access to all files and list content of top level directories in the `$AUDIO` folder.", "type": "string", - "enum": [ - "allow-cache-read" - ] + "const": "scope-audio", + "markdownDescription": "This scope permits access to all files and list content of top level directories in the `$AUDIO` folder." }, { - "description": "allow-cache-write -> This allows non-recursive write access to the `$CACHE` folder.", + "description": "This scope permits to list all files and folders in the `$AUDIO`folder.", "type": "string", - "enum": [ - "allow-cache-write" - ] + "const": "scope-audio-index", + "markdownDescription": "This scope permits to list all files and folders in the `$AUDIO`folder." }, { - "description": "allow-cache-meta-recursive -> This allows read access to metadata of the `$CACHE` folder, including file listing and statistics.", + "description": "This allows full recursive read access to the complete `$CACHE` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-cache-recursive`", "type": "string", - "enum": [ - "allow-cache-meta-recursive" - ] + "const": "allow-cache-read-recursive", + "markdownDescription": "This allows full recursive read access to the complete `$CACHE` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-cache-recursive`" }, { - "description": "allow-cache-meta -> This allows read access to metadata of the `$CACHE` folder, including file listing and statistics.", + "description": "This allows full recursive write access to the complete `$CACHE` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-cache-recursive`", "type": "string", - "enum": [ - "allow-cache-meta" - ] + "const": "allow-cache-write-recursive", + "markdownDescription": "This allows full recursive write access to the complete `$CACHE` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-cache-recursive`" }, { - "description": "scope-cache-recursive -> This scope recursive access to the complete `$CACHE` folder, including sub directories and files.", + "description": "This allows non-recursive read access to the `$CACHE` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-cache`", "type": "string", - "enum": [ - "scope-cache-recursive" - ] + "const": "allow-cache-read", + "markdownDescription": "This allows non-recursive read access to the `$CACHE` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-cache`" }, { - "description": "scope-cache -> This scope permits access to all files and list content of top level directories in the `$CACHE`folder.", + "description": "This allows non-recursive write access to the `$CACHE` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-cache`", "type": "string", - "enum": [ - "scope-cache" - ] + "const": "allow-cache-write", + "markdownDescription": "This allows non-recursive write access to the `$CACHE` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-cache`" }, { - "description": "scope-cache-index -> This scope permits to list all files and folders in the `$CACHE`folder.", + "description": "This allows full recursive read access to metadata of the `$CACHE` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-cache-recursive`", "type": "string", - "enum": [ - "scope-cache-index" - ] + "const": "allow-cache-meta-recursive", + "markdownDescription": "This allows full recursive read access to metadata of the `$CACHE` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-cache-recursive`" }, { - "description": "allow-config-read-recursive -> This allows full recursive read access to the complete `$CONFIG` folder, files and subdirectories.", + "description": "This allows non-recursive read access to metadata of the `$CACHE` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-cache-index`", "type": "string", - "enum": [ - "allow-config-read-recursive" - ] + "const": "allow-cache-meta", + "markdownDescription": "This allows non-recursive read access to metadata of the `$CACHE` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-cache-index`" }, { - "description": "allow-config-write-recursive -> This allows full recusrive write access to the complete `$CONFIG` folder, files and subdirectories.", + "description": "This scope permits recursive access to the complete `$CACHE` folder, including sub directories and files.", "type": "string", - "enum": [ - "allow-config-write-recursive" - ] + "const": "scope-cache-recursive", + "markdownDescription": "This scope permits recursive access to the complete `$CACHE` folder, including sub directories and files." }, { - "description": "allow-config-read -> This allows non-recursive read access to the `$CONFIG` folder.", + "description": "This scope permits access to all files and list content of top level directories in the `$CACHE` folder.", "type": "string", - "enum": [ - "allow-config-read" - ] + "const": "scope-cache", + "markdownDescription": "This scope permits access to all files and list content of top level directories in the `$CACHE` folder." }, { - "description": "allow-config-write -> This allows non-recursive write access to the `$CONFIG` folder.", + "description": "This scope permits to list all files and folders in the `$CACHE`folder.", "type": "string", - "enum": [ - "allow-config-write" - ] + "const": "scope-cache-index", + "markdownDescription": "This scope permits to list all files and folders in the `$CACHE`folder." }, { - "description": "allow-config-meta-recursive -> This allows read access to metadata of the `$CONFIG` folder, including file listing and statistics.", + "description": "This allows full recursive read access to the complete `$CONFIG` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-config-recursive`", "type": "string", - "enum": [ - "allow-config-meta-recursive" - ] + "const": "allow-config-read-recursive", + "markdownDescription": "This allows full recursive read access to the complete `$CONFIG` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-config-recursive`" }, { - "description": "allow-config-meta -> This allows read access to metadata of the `$CONFIG` folder, including file listing and statistics.", + "description": "This allows full recursive write access to the complete `$CONFIG` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-config-recursive`", "type": "string", - "enum": [ - "allow-config-meta" - ] + "const": "allow-config-write-recursive", + "markdownDescription": "This allows full recursive write access to the complete `$CONFIG` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-config-recursive`" }, { - "description": "scope-config-recursive -> This scope recursive access to the complete `$CONFIG` folder, including sub directories and files.", + "description": "This allows non-recursive read access to the `$CONFIG` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-config`", "type": "string", - "enum": [ - "scope-config-recursive" - ] + "const": "allow-config-read", + "markdownDescription": "This allows non-recursive read access to the `$CONFIG` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-config`" }, { - "description": "scope-config -> This scope permits access to all files and list content of top level directories in the `$CONFIG`folder.", + "description": "This allows non-recursive write access to the `$CONFIG` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-config`", "type": "string", - "enum": [ - "scope-config" - ] + "const": "allow-config-write", + "markdownDescription": "This allows non-recursive write access to the `$CONFIG` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-config`" }, { - "description": "scope-config-index -> This scope permits to list all files and folders in the `$CONFIG`folder.", + "description": "This allows full recursive read access to metadata of the `$CONFIG` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-config-recursive`", "type": "string", - "enum": [ - "scope-config-index" - ] + "const": "allow-config-meta-recursive", + "markdownDescription": "This allows full recursive read access to metadata of the `$CONFIG` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-config-recursive`" }, { - "description": "allow-data-read-recursive -> This allows full recursive read access to the complete `$DATA` folder, files and subdirectories.", + "description": "This allows non-recursive read access to metadata of the `$CONFIG` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-config-index`", "type": "string", - "enum": [ - "allow-data-read-recursive" - ] + "const": "allow-config-meta", + "markdownDescription": "This allows non-recursive read access to metadata of the `$CONFIG` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-config-index`" }, { - "description": "allow-data-write-recursive -> This allows full recusrive write access to the complete `$DATA` folder, files and subdirectories.", + "description": "This scope permits recursive access to the complete `$CONFIG` folder, including sub directories and files.", "type": "string", - "enum": [ - "allow-data-write-recursive" - ] + "const": "scope-config-recursive", + "markdownDescription": "This scope permits recursive access to the complete `$CONFIG` folder, including sub directories and files." }, { - "description": "allow-data-read -> This allows non-recursive read access to the `$DATA` folder.", + "description": "This scope permits access to all files and list content of top level directories in the `$CONFIG` folder.", "type": "string", - "enum": [ - "allow-data-read" - ] + "const": "scope-config", + "markdownDescription": "This scope permits access to all files and list content of top level directories in the `$CONFIG` folder." }, { - "description": "allow-data-write -> This allows non-recursive write access to the `$DATA` folder.", + "description": "This scope permits to list all files and folders in the `$CONFIG`folder.", "type": "string", - "enum": [ - "allow-data-write" - ] + "const": "scope-config-index", + "markdownDescription": "This scope permits to list all files and folders in the `$CONFIG`folder." }, { - "description": "allow-data-meta-recursive -> This allows read access to metadata of the `$DATA` folder, including file listing and statistics.", + "description": "This allows full recursive read access to the complete `$DATA` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-data-recursive`", "type": "string", - "enum": [ - "allow-data-meta-recursive" - ] + "const": "allow-data-read-recursive", + "markdownDescription": "This allows full recursive read access to the complete `$DATA` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-data-recursive`" }, { - "description": "allow-data-meta -> This allows read access to metadata of the `$DATA` folder, including file listing and statistics.", + "description": "This allows full recursive write access to the complete `$DATA` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-data-recursive`", "type": "string", - "enum": [ - "allow-data-meta" - ] + "const": "allow-data-write-recursive", + "markdownDescription": "This allows full recursive write access to the complete `$DATA` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-data-recursive`" }, { - "description": "scope-data-recursive -> This scope recursive access to the complete `$DATA` folder, including sub directories and files.", + "description": "This allows non-recursive read access to the `$DATA` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-data`", "type": "string", - "enum": [ - "scope-data-recursive" - ] + "const": "allow-data-read", + "markdownDescription": "This allows non-recursive read access to the `$DATA` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-data`" }, { - "description": "scope-data -> This scope permits access to all files and list content of top level directories in the `$DATA`folder.", + "description": "This allows non-recursive write access to the `$DATA` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-data`", "type": "string", - "enum": [ - "scope-data" - ] + "const": "allow-data-write", + "markdownDescription": "This allows non-recursive write access to the `$DATA` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-data`" }, { - "description": "scope-data-index -> This scope permits to list all files and folders in the `$DATA`folder.", + "description": "This allows full recursive read access to metadata of the `$DATA` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-data-recursive`", "type": "string", - "enum": [ - "scope-data-index" - ] + "const": "allow-data-meta-recursive", + "markdownDescription": "This allows full recursive read access to metadata of the `$DATA` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-data-recursive`" }, { - "description": "allow-desktop-read-recursive -> This allows full recursive read access to the complete `$DESKTOP` folder, files and subdirectories.", + "description": "This allows non-recursive read access to metadata of the `$DATA` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-data-index`", "type": "string", - "enum": [ - "allow-desktop-read-recursive" - ] + "const": "allow-data-meta", + "markdownDescription": "This allows non-recursive read access to metadata of the `$DATA` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-data-index`" }, { - "description": "allow-desktop-write-recursive -> This allows full recusrive write access to the complete `$DESKTOP` folder, files and subdirectories.", + "description": "This scope permits recursive access to the complete `$DATA` folder, including sub directories and files.", "type": "string", - "enum": [ - "allow-desktop-write-recursive" - ] + "const": "scope-data-recursive", + "markdownDescription": "This scope permits recursive access to the complete `$DATA` folder, including sub directories and files." }, { - "description": "allow-desktop-read -> This allows non-recursive read access to the `$DESKTOP` folder.", + "description": "This scope permits access to all files and list content of top level directories in the `$DATA` folder.", "type": "string", - "enum": [ - "allow-desktop-read" - ] + "const": "scope-data", + "markdownDescription": "This scope permits access to all files and list content of top level directories in the `$DATA` folder." }, { - "description": "allow-desktop-write -> This allows non-recursive write access to the `$DESKTOP` folder.", + "description": "This scope permits to list all files and folders in the `$DATA`folder.", "type": "string", - "enum": [ - "allow-desktop-write" - ] + "const": "scope-data-index", + "markdownDescription": "This scope permits to list all files and folders in the `$DATA`folder." }, { - "description": "allow-desktop-meta-recursive -> This allows read access to metadata of the `$DESKTOP` folder, including file listing and statistics.", + "description": "This allows full recursive read access to the complete `$DESKTOP` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-desktop-recursive`", "type": "string", - "enum": [ - "allow-desktop-meta-recursive" - ] + "const": "allow-desktop-read-recursive", + "markdownDescription": "This allows full recursive read access to the complete `$DESKTOP` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-desktop-recursive`" }, { - "description": "allow-desktop-meta -> This allows read access to metadata of the `$DESKTOP` folder, including file listing and statistics.", + "description": "This allows full recursive write access to the complete `$DESKTOP` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-desktop-recursive`", "type": "string", - "enum": [ - "allow-desktop-meta" - ] + "const": "allow-desktop-write-recursive", + "markdownDescription": "This allows full recursive write access to the complete `$DESKTOP` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-desktop-recursive`" }, { - "description": "scope-desktop-recursive -> This scope recursive access to the complete `$DESKTOP` folder, including sub directories and files.", + "description": "This allows non-recursive read access to the `$DESKTOP` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-desktop`", "type": "string", - "enum": [ - "scope-desktop-recursive" - ] + "const": "allow-desktop-read", + "markdownDescription": "This allows non-recursive read access to the `$DESKTOP` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-desktop`" }, { - "description": "scope-desktop -> This scope permits access to all files and list content of top level directories in the `$DESKTOP`folder.", + "description": "This allows non-recursive write access to the `$DESKTOP` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-desktop`", "type": "string", - "enum": [ - "scope-desktop" - ] + "const": "allow-desktop-write", + "markdownDescription": "This allows non-recursive write access to the `$DESKTOP` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-desktop`" }, { - "description": "scope-desktop-index -> This scope permits to list all files and folders in the `$DESKTOP`folder.", + "description": "This allows full recursive read access to metadata of the `$DESKTOP` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-desktop-recursive`", "type": "string", - "enum": [ - "scope-desktop-index" - ] + "const": "allow-desktop-meta-recursive", + "markdownDescription": "This allows full recursive read access to metadata of the `$DESKTOP` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-desktop-recursive`" }, { - "description": "allow-document-read-recursive -> This allows full recursive read access to the complete `$DOCUMENT` folder, files and subdirectories.", + "description": "This allows non-recursive read access to metadata of the `$DESKTOP` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-desktop-index`", "type": "string", - "enum": [ - "allow-document-read-recursive" - ] + "const": "allow-desktop-meta", + "markdownDescription": "This allows non-recursive read access to metadata of the `$DESKTOP` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-desktop-index`" }, { - "description": "allow-document-write-recursive -> This allows full recusrive write access to the complete `$DOCUMENT` folder, files and subdirectories.", + "description": "This scope permits recursive access to the complete `$DESKTOP` folder, including sub directories and files.", "type": "string", - "enum": [ - "allow-document-write-recursive" - ] + "const": "scope-desktop-recursive", + "markdownDescription": "This scope permits recursive access to the complete `$DESKTOP` folder, including sub directories and files." }, { - "description": "allow-document-read -> This allows non-recursive read access to the `$DOCUMENT` folder.", + "description": "This scope permits access to all files and list content of top level directories in the `$DESKTOP` folder.", "type": "string", - "enum": [ - "allow-document-read" - ] + "const": "scope-desktop", + "markdownDescription": "This scope permits access to all files and list content of top level directories in the `$DESKTOP` folder." }, { - "description": "allow-document-write -> This allows non-recursive write access to the `$DOCUMENT` folder.", + "description": "This scope permits to list all files and folders in the `$DESKTOP`folder.", "type": "string", - "enum": [ - "allow-document-write" - ] + "const": "scope-desktop-index", + "markdownDescription": "This scope permits to list all files and folders in the `$DESKTOP`folder." }, { - "description": "allow-document-meta-recursive -> This allows read access to metadata of the `$DOCUMENT` folder, including file listing and statistics.", + "description": "This allows full recursive read access to the complete `$DOCUMENT` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-document-recursive`", "type": "string", - "enum": [ - "allow-document-meta-recursive" - ] + "const": "allow-document-read-recursive", + "markdownDescription": "This allows full recursive read access to the complete `$DOCUMENT` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-document-recursive`" }, { - "description": "allow-document-meta -> This allows read access to metadata of the `$DOCUMENT` folder, including file listing and statistics.", + "description": "This allows full recursive write access to the complete `$DOCUMENT` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-document-recursive`", "type": "string", - "enum": [ - "allow-document-meta" - ] + "const": "allow-document-write-recursive", + "markdownDescription": "This allows full recursive write access to the complete `$DOCUMENT` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-document-recursive`" }, { - "description": "scope-document-recursive -> This scope recursive access to the complete `$DOCUMENT` folder, including sub directories and files.", + "description": "This allows non-recursive read access to the `$DOCUMENT` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-document`", "type": "string", - "enum": [ - "scope-document-recursive" - ] + "const": "allow-document-read", + "markdownDescription": "This allows non-recursive read access to the `$DOCUMENT` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-document`" }, { - "description": "scope-document -> This scope permits access to all files and list content of top level directories in the `$DOCUMENT`folder.", + "description": "This allows non-recursive write access to the `$DOCUMENT` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-document`", "type": "string", - "enum": [ - "scope-document" - ] + "const": "allow-document-write", + "markdownDescription": "This allows non-recursive write access to the `$DOCUMENT` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-document`" }, { - "description": "scope-document-index -> This scope permits to list all files and folders in the `$DOCUMENT`folder.", + "description": "This allows full recursive read access to metadata of the `$DOCUMENT` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-document-recursive`", "type": "string", - "enum": [ - "scope-document-index" - ] + "const": "allow-document-meta-recursive", + "markdownDescription": "This allows full recursive read access to metadata of the `$DOCUMENT` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-document-recursive`" }, { - "description": "allow-download-read-recursive -> This allows full recursive read access to the complete `$DOWNLOAD` folder, files and subdirectories.", + "description": "This allows non-recursive read access to metadata of the `$DOCUMENT` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-document-index`", "type": "string", - "enum": [ - "allow-download-read-recursive" - ] + "const": "allow-document-meta", + "markdownDescription": "This allows non-recursive read access to metadata of the `$DOCUMENT` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-document-index`" }, { - "description": "allow-download-write-recursive -> This allows full recusrive write access to the complete `$DOWNLOAD` folder, files and subdirectories.", + "description": "This scope permits recursive access to the complete `$DOCUMENT` folder, including sub directories and files.", "type": "string", - "enum": [ - "allow-download-write-recursive" - ] + "const": "scope-document-recursive", + "markdownDescription": "This scope permits recursive access to the complete `$DOCUMENT` folder, including sub directories and files." }, { - "description": "allow-download-read -> This allows non-recursive read access to the `$DOWNLOAD` folder.", + "description": "This scope permits access to all files and list content of top level directories in the `$DOCUMENT` folder.", "type": "string", - "enum": [ - "allow-download-read" - ] + "const": "scope-document", + "markdownDescription": "This scope permits access to all files and list content of top level directories in the `$DOCUMENT` folder." }, { - "description": "allow-download-write -> This allows non-recursive write access to the `$DOWNLOAD` folder.", + "description": "This scope permits to list all files and folders in the `$DOCUMENT`folder.", "type": "string", - "enum": [ - "allow-download-write" - ] + "const": "scope-document-index", + "markdownDescription": "This scope permits to list all files and folders in the `$DOCUMENT`folder." }, { - "description": "allow-download-meta-recursive -> This allows read access to metadata of the `$DOWNLOAD` folder, including file listing and statistics.", + "description": "This allows full recursive read access to the complete `$DOWNLOAD` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-download-recursive`", "type": "string", - "enum": [ - "allow-download-meta-recursive" - ] + "const": "allow-download-read-recursive", + "markdownDescription": "This allows full recursive read access to the complete `$DOWNLOAD` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-download-recursive`" }, { - "description": "allow-download-meta -> This allows read access to metadata of the `$DOWNLOAD` folder, including file listing and statistics.", + "description": "This allows full recursive write access to the complete `$DOWNLOAD` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-download-recursive`", "type": "string", - "enum": [ - "allow-download-meta" - ] + "const": "allow-download-write-recursive", + "markdownDescription": "This allows full recursive write access to the complete `$DOWNLOAD` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-download-recursive`" }, { - "description": "scope-download-recursive -> This scope recursive access to the complete `$DOWNLOAD` folder, including sub directories and files.", + "description": "This allows non-recursive read access to the `$DOWNLOAD` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-download`", "type": "string", - "enum": [ - "scope-download-recursive" - ] + "const": "allow-download-read", + "markdownDescription": "This allows non-recursive read access to the `$DOWNLOAD` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-download`" }, { - "description": "scope-download -> This scope permits access to all files and list content of top level directories in the `$DOWNLOAD`folder.", + "description": "This allows non-recursive write access to the `$DOWNLOAD` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-download`", "type": "string", - "enum": [ - "scope-download" - ] + "const": "allow-download-write", + "markdownDescription": "This allows non-recursive write access to the `$DOWNLOAD` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-download`" }, { - "description": "scope-download-index -> This scope permits to list all files and folders in the `$DOWNLOAD`folder.", + "description": "This allows full recursive read access to metadata of the `$DOWNLOAD` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-download-recursive`", "type": "string", - "enum": [ - "scope-download-index" - ] + "const": "allow-download-meta-recursive", + "markdownDescription": "This allows full recursive read access to metadata of the `$DOWNLOAD` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-download-recursive`" }, { - "description": "allow-exe-read-recursive -> This allows full recursive read access to the complete `$EXE` folder, files and subdirectories.", + "description": "This allows non-recursive read access to metadata of the `$DOWNLOAD` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-download-index`", "type": "string", - "enum": [ - "allow-exe-read-recursive" - ] + "const": "allow-download-meta", + "markdownDescription": "This allows non-recursive read access to metadata of the `$DOWNLOAD` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-download-index`" }, { - "description": "allow-exe-write-recursive -> This allows full recusrive write access to the complete `$EXE` folder, files and subdirectories.", + "description": "This scope permits recursive access to the complete `$DOWNLOAD` folder, including sub directories and files.", "type": "string", - "enum": [ - "allow-exe-write-recursive" - ] + "const": "scope-download-recursive", + "markdownDescription": "This scope permits recursive access to the complete `$DOWNLOAD` folder, including sub directories and files." }, { - "description": "allow-exe-read -> This allows non-recursive read access to the `$EXE` folder.", + "description": "This scope permits access to all files and list content of top level directories in the `$DOWNLOAD` folder.", "type": "string", - "enum": [ - "allow-exe-read" - ] + "const": "scope-download", + "markdownDescription": "This scope permits access to all files and list content of top level directories in the `$DOWNLOAD` folder." }, { - "description": "allow-exe-write -> This allows non-recursive write access to the `$EXE` folder.", + "description": "This scope permits to list all files and folders in the `$DOWNLOAD`folder.", "type": "string", - "enum": [ - "allow-exe-write" - ] + "const": "scope-download-index", + "markdownDescription": "This scope permits to list all files and folders in the `$DOWNLOAD`folder." }, { - "description": "allow-exe-meta-recursive -> This allows read access to metadata of the `$EXE` folder, including file listing and statistics.", + "description": "This allows full recursive read access to the complete `$EXE` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-exe-recursive`", "type": "string", - "enum": [ - "allow-exe-meta-recursive" - ] + "const": "allow-exe-read-recursive", + "markdownDescription": "This allows full recursive read access to the complete `$EXE` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-exe-recursive`" }, { - "description": "allow-exe-meta -> This allows read access to metadata of the `$EXE` folder, including file listing and statistics.", + "description": "This allows full recursive write access to the complete `$EXE` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-exe-recursive`", "type": "string", - "enum": [ - "allow-exe-meta" - ] + "const": "allow-exe-write-recursive", + "markdownDescription": "This allows full recursive write access to the complete `$EXE` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-exe-recursive`" }, { - "description": "scope-exe-recursive -> This scope recursive access to the complete `$EXE` folder, including sub directories and files.", + "description": "This allows non-recursive read access to the `$EXE` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-exe`", "type": "string", - "enum": [ - "scope-exe-recursive" - ] + "const": "allow-exe-read", + "markdownDescription": "This allows non-recursive read access to the `$EXE` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-exe`" }, { - "description": "scope-exe -> This scope permits access to all files and list content of top level directories in the `$EXE`folder.", + "description": "This allows non-recursive write access to the `$EXE` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-exe`", "type": "string", - "enum": [ - "scope-exe" - ] + "const": "allow-exe-write", + "markdownDescription": "This allows non-recursive write access to the `$EXE` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-exe`" }, { - "description": "scope-exe-index -> This scope permits to list all files and folders in the `$EXE`folder.", + "description": "This allows full recursive read access to metadata of the `$EXE` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-exe-recursive`", "type": "string", - "enum": [ - "scope-exe-index" - ] + "const": "allow-exe-meta-recursive", + "markdownDescription": "This allows full recursive read access to metadata of the `$EXE` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-exe-recursive`" }, { - "description": "allow-font-read-recursive -> This allows full recursive read access to the complete `$FONT` folder, files and subdirectories.", + "description": "This allows non-recursive read access to metadata of the `$EXE` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-exe-index`", "type": "string", - "enum": [ - "allow-font-read-recursive" - ] + "const": "allow-exe-meta", + "markdownDescription": "This allows non-recursive read access to metadata of the `$EXE` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-exe-index`" }, { - "description": "allow-font-write-recursive -> This allows full recusrive write access to the complete `$FONT` folder, files and subdirectories.", + "description": "This scope permits recursive access to the complete `$EXE` folder, including sub directories and files.", "type": "string", - "enum": [ - "allow-font-write-recursive" - ] + "const": "scope-exe-recursive", + "markdownDescription": "This scope permits recursive access to the complete `$EXE` folder, including sub directories and files." }, { - "description": "allow-font-read -> This allows non-recursive read access to the `$FONT` folder.", + "description": "This scope permits access to all files and list content of top level directories in the `$EXE` folder.", "type": "string", - "enum": [ - "allow-font-read" - ] + "const": "scope-exe", + "markdownDescription": "This scope permits access to all files and list content of top level directories in the `$EXE` folder." }, { - "description": "allow-font-write -> This allows non-recursive write access to the `$FONT` folder.", + "description": "This scope permits to list all files and folders in the `$EXE`folder.", "type": "string", - "enum": [ - "allow-font-write" - ] + "const": "scope-exe-index", + "markdownDescription": "This scope permits to list all files and folders in the `$EXE`folder." }, { - "description": "allow-font-meta-recursive -> This allows read access to metadata of the `$FONT` folder, including file listing and statistics.", + "description": "This allows full recursive read access to the complete `$FONT` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-font-recursive`", "type": "string", - "enum": [ - "allow-font-meta-recursive" - ] + "const": "allow-font-read-recursive", + "markdownDescription": "This allows full recursive read access to the complete `$FONT` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-font-recursive`" }, { - "description": "allow-font-meta -> This allows read access to metadata of the `$FONT` folder, including file listing and statistics.", + "description": "This allows full recursive write access to the complete `$FONT` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-font-recursive`", "type": "string", - "enum": [ - "allow-font-meta" - ] + "const": "allow-font-write-recursive", + "markdownDescription": "This allows full recursive write access to the complete `$FONT` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-font-recursive`" }, { - "description": "scope-font-recursive -> This scope recursive access to the complete `$FONT` folder, including sub directories and files.", + "description": "This allows non-recursive read access to the `$FONT` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-font`", "type": "string", - "enum": [ - "scope-font-recursive" - ] + "const": "allow-font-read", + "markdownDescription": "This allows non-recursive read access to the `$FONT` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-font`" }, { - "description": "scope-font -> This scope permits access to all files and list content of top level directories in the `$FONT`folder.", + "description": "This allows non-recursive write access to the `$FONT` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-font`", "type": "string", - "enum": [ - "scope-font" - ] + "const": "allow-font-write", + "markdownDescription": "This allows non-recursive write access to the `$FONT` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-font`" }, { - "description": "scope-font-index -> This scope permits to list all files and folders in the `$FONT`folder.", + "description": "This allows full recursive read access to metadata of the `$FONT` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-font-recursive`", "type": "string", - "enum": [ - "scope-font-index" - ] + "const": "allow-font-meta-recursive", + "markdownDescription": "This allows full recursive read access to metadata of the `$FONT` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-font-recursive`" }, { - "description": "allow-home-read-recursive -> This allows full recursive read access to the complete `$HOME` folder, files and subdirectories.", + "description": "This allows non-recursive read access to metadata of the `$FONT` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-font-index`", "type": "string", - "enum": [ - "allow-home-read-recursive" - ] + "const": "allow-font-meta", + "markdownDescription": "This allows non-recursive read access to metadata of the `$FONT` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-font-index`" }, { - "description": "allow-home-write-recursive -> This allows full recusrive write access to the complete `$HOME` folder, files and subdirectories.", + "description": "This scope permits recursive access to the complete `$FONT` folder, including sub directories and files.", "type": "string", - "enum": [ - "allow-home-write-recursive" - ] + "const": "scope-font-recursive", + "markdownDescription": "This scope permits recursive access to the complete `$FONT` folder, including sub directories and files." }, { - "description": "allow-home-read -> This allows non-recursive read access to the `$HOME` folder.", + "description": "This scope permits access to all files and list content of top level directories in the `$FONT` folder.", "type": "string", - "enum": [ - "allow-home-read" - ] + "const": "scope-font", + "markdownDescription": "This scope permits access to all files and list content of top level directories in the `$FONT` folder." }, { - "description": "allow-home-write -> This allows non-recursive write access to the `$HOME` folder.", + "description": "This scope permits to list all files and folders in the `$FONT`folder.", "type": "string", - "enum": [ - "allow-home-write" - ] + "const": "scope-font-index", + "markdownDescription": "This scope permits to list all files and folders in the `$FONT`folder." }, { - "description": "allow-home-meta-recursive -> This allows read access to metadata of the `$HOME` folder, including file listing and statistics.", + "description": "This allows full recursive read access to the complete `$HOME` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-home-recursive`", "type": "string", - "enum": [ - "allow-home-meta-recursive" - ] + "const": "allow-home-read-recursive", + "markdownDescription": "This allows full recursive read access to the complete `$HOME` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-home-recursive`" }, { - "description": "allow-home-meta -> This allows read access to metadata of the `$HOME` folder, including file listing and statistics.", + "description": "This allows full recursive write access to the complete `$HOME` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-home-recursive`", "type": "string", - "enum": [ - "allow-home-meta" - ] + "const": "allow-home-write-recursive", + "markdownDescription": "This allows full recursive write access to the complete `$HOME` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-home-recursive`" }, { - "description": "scope-home-recursive -> This scope recursive access to the complete `$HOME` folder, including sub directories and files.", + "description": "This allows non-recursive read access to the `$HOME` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-home`", "type": "string", - "enum": [ - "scope-home-recursive" - ] + "const": "allow-home-read", + "markdownDescription": "This allows non-recursive read access to the `$HOME` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-home`" }, { - "description": "scope-home -> This scope permits access to all files and list content of top level directories in the `$HOME`folder.", + "description": "This allows non-recursive write access to the `$HOME` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-home`", "type": "string", - "enum": [ - "scope-home" - ] + "const": "allow-home-write", + "markdownDescription": "This allows non-recursive write access to the `$HOME` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-home`" }, { - "description": "scope-home-index -> This scope permits to list all files and folders in the `$HOME`folder.", + "description": "This allows full recursive read access to metadata of the `$HOME` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-home-recursive`", "type": "string", - "enum": [ - "scope-home-index" - ] + "const": "allow-home-meta-recursive", + "markdownDescription": "This allows full recursive read access to metadata of the `$HOME` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-home-recursive`" }, { - "description": "allow-localdata-read-recursive -> This allows full recursive read access to the complete `$LOCALDATA` folder, files and subdirectories.", + "description": "This allows non-recursive read access to metadata of the `$HOME` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-home-index`", "type": "string", - "enum": [ - "allow-localdata-read-recursive" - ] + "const": "allow-home-meta", + "markdownDescription": "This allows non-recursive read access to metadata of the `$HOME` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-home-index`" }, { - "description": "allow-localdata-write-recursive -> This allows full recusrive write access to the complete `$LOCALDATA` folder, files and subdirectories.", + "description": "This scope permits recursive access to the complete `$HOME` folder, including sub directories and files.", "type": "string", - "enum": [ - "allow-localdata-write-recursive" - ] + "const": "scope-home-recursive", + "markdownDescription": "This scope permits recursive access to the complete `$HOME` folder, including sub directories and files." }, { - "description": "allow-localdata-read -> This allows non-recursive read access to the `$LOCALDATA` folder.", + "description": "This scope permits access to all files and list content of top level directories in the `$HOME` folder.", "type": "string", - "enum": [ - "allow-localdata-read" - ] + "const": "scope-home", + "markdownDescription": "This scope permits access to all files and list content of top level directories in the `$HOME` folder." }, { - "description": "allow-localdata-write -> This allows non-recursive write access to the `$LOCALDATA` folder.", + "description": "This scope permits to list all files and folders in the `$HOME`folder.", "type": "string", - "enum": [ - "allow-localdata-write" - ] + "const": "scope-home-index", + "markdownDescription": "This scope permits to list all files and folders in the `$HOME`folder." }, { - "description": "allow-localdata-meta-recursive -> This allows read access to metadata of the `$LOCALDATA` folder, including file listing and statistics.", + "description": "This allows full recursive read access to the complete `$LOCALDATA` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-localdata-recursive`", "type": "string", - "enum": [ - "allow-localdata-meta-recursive" - ] + "const": "allow-localdata-read-recursive", + "markdownDescription": "This allows full recursive read access to the complete `$LOCALDATA` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-localdata-recursive`" }, { - "description": "allow-localdata-meta -> This allows read access to metadata of the `$LOCALDATA` folder, including file listing and statistics.", + "description": "This allows full recursive write access to the complete `$LOCALDATA` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-localdata-recursive`", "type": "string", - "enum": [ - "allow-localdata-meta" - ] + "const": "allow-localdata-write-recursive", + "markdownDescription": "This allows full recursive write access to the complete `$LOCALDATA` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-localdata-recursive`" }, { - "description": "scope-localdata-recursive -> This scope recursive access to the complete `$LOCALDATA` folder, including sub directories and files.", + "description": "This allows non-recursive read access to the `$LOCALDATA` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-localdata`", "type": "string", - "enum": [ - "scope-localdata-recursive" - ] + "const": "allow-localdata-read", + "markdownDescription": "This allows non-recursive read access to the `$LOCALDATA` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-localdata`" }, { - "description": "scope-localdata -> This scope permits access to all files and list content of top level directories in the `$LOCALDATA`folder.", + "description": "This allows non-recursive write access to the `$LOCALDATA` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-localdata`", "type": "string", - "enum": [ - "scope-localdata" - ] + "const": "allow-localdata-write", + "markdownDescription": "This allows non-recursive write access to the `$LOCALDATA` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-localdata`" }, { - "description": "scope-localdata-index -> This scope permits to list all files and folders in the `$LOCALDATA`folder.", + "description": "This allows full recursive read access to metadata of the `$LOCALDATA` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-localdata-recursive`", "type": "string", - "enum": [ - "scope-localdata-index" - ] + "const": "allow-localdata-meta-recursive", + "markdownDescription": "This allows full recursive read access to metadata of the `$LOCALDATA` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-localdata-recursive`" }, { - "description": "allow-log-read-recursive -> This allows full recursive read access to the complete `$LOG` folder, files and subdirectories.", + "description": "This allows non-recursive read access to metadata of the `$LOCALDATA` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-localdata-index`", "type": "string", - "enum": [ - "allow-log-read-recursive" - ] + "const": "allow-localdata-meta", + "markdownDescription": "This allows non-recursive read access to metadata of the `$LOCALDATA` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-localdata-index`" }, { - "description": "allow-log-write-recursive -> This allows full recusrive write access to the complete `$LOG` folder, files and subdirectories.", + "description": "This scope permits recursive access to the complete `$LOCALDATA` folder, including sub directories and files.", "type": "string", - "enum": [ - "allow-log-write-recursive" - ] + "const": "scope-localdata-recursive", + "markdownDescription": "This scope permits recursive access to the complete `$LOCALDATA` folder, including sub directories and files." }, { - "description": "allow-log-read -> This allows non-recursive read access to the `$LOG` folder.", + "description": "This scope permits access to all files and list content of top level directories in the `$LOCALDATA` folder.", "type": "string", - "enum": [ - "allow-log-read" - ] + "const": "scope-localdata", + "markdownDescription": "This scope permits access to all files and list content of top level directories in the `$LOCALDATA` folder." }, { - "description": "allow-log-write -> This allows non-recursive write access to the `$LOG` folder.", + "description": "This scope permits to list all files and folders in the `$LOCALDATA`folder.", "type": "string", - "enum": [ - "allow-log-write" - ] + "const": "scope-localdata-index", + "markdownDescription": "This scope permits to list all files and folders in the `$LOCALDATA`folder." }, { - "description": "allow-log-meta-recursive -> This allows read access to metadata of the `$LOG` folder, including file listing and statistics.", + "description": "This allows full recursive read access to the complete `$LOG` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-log-recursive`", "type": "string", - "enum": [ - "allow-log-meta-recursive" - ] + "const": "allow-log-read-recursive", + "markdownDescription": "This allows full recursive read access to the complete `$LOG` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-log-recursive`" }, { - "description": "allow-log-meta -> This allows read access to metadata of the `$LOG` folder, including file listing and statistics.", + "description": "This allows full recursive write access to the complete `$LOG` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-log-recursive`", "type": "string", - "enum": [ - "allow-log-meta" - ] + "const": "allow-log-write-recursive", + "markdownDescription": "This allows full recursive write access to the complete `$LOG` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-log-recursive`" }, { - "description": "scope-log-recursive -> This scope recursive access to the complete `$LOG` folder, including sub directories and files.", + "description": "This allows non-recursive read access to the `$LOG` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-log`", "type": "string", - "enum": [ - "scope-log-recursive" - ] + "const": "allow-log-read", + "markdownDescription": "This allows non-recursive read access to the `$LOG` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-log`" }, { - "description": "scope-log -> This scope permits access to all files and list content of top level directories in the `$LOG`folder.", + "description": "This allows non-recursive write access to the `$LOG` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-log`", "type": "string", - "enum": [ - "scope-log" - ] + "const": "allow-log-write", + "markdownDescription": "This allows non-recursive write access to the `$LOG` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-log`" }, { - "description": "scope-log-index -> This scope permits to list all files and folders in the `$LOG`folder.", + "description": "This allows full recursive read access to metadata of the `$LOG` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-log-recursive`", "type": "string", - "enum": [ - "scope-log-index" - ] + "const": "allow-log-meta-recursive", + "markdownDescription": "This allows full recursive read access to metadata of the `$LOG` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-log-recursive`" }, { - "description": "allow-picture-read-recursive -> This allows full recursive read access to the complete `$PICTURE` folder, files and subdirectories.", + "description": "This allows non-recursive read access to metadata of the `$LOG` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-log-index`", "type": "string", - "enum": [ - "allow-picture-read-recursive" - ] + "const": "allow-log-meta", + "markdownDescription": "This allows non-recursive read access to metadata of the `$LOG` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-log-index`" }, { - "description": "allow-picture-write-recursive -> This allows full recusrive write access to the complete `$PICTURE` folder, files and subdirectories.", + "description": "This scope permits recursive access to the complete `$LOG` folder, including sub directories and files.", "type": "string", - "enum": [ - "allow-picture-write-recursive" - ] + "const": "scope-log-recursive", + "markdownDescription": "This scope permits recursive access to the complete `$LOG` folder, including sub directories and files." }, { - "description": "allow-picture-read -> This allows non-recursive read access to the `$PICTURE` folder.", + "description": "This scope permits access to all files and list content of top level directories in the `$LOG` folder.", "type": "string", - "enum": [ - "allow-picture-read" - ] + "const": "scope-log", + "markdownDescription": "This scope permits access to all files and list content of top level directories in the `$LOG` folder." }, { - "description": "allow-picture-write -> This allows non-recursive write access to the `$PICTURE` folder.", + "description": "This scope permits to list all files and folders in the `$LOG`folder.", "type": "string", - "enum": [ - "allow-picture-write" - ] + "const": "scope-log-index", + "markdownDescription": "This scope permits to list all files and folders in the `$LOG`folder." }, { - "description": "allow-picture-meta-recursive -> This allows read access to metadata of the `$PICTURE` folder, including file listing and statistics.", + "description": "This allows full recursive read access to the complete `$PICTURE` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-picture-recursive`", "type": "string", - "enum": [ - "allow-picture-meta-recursive" - ] + "const": "allow-picture-read-recursive", + "markdownDescription": "This allows full recursive read access to the complete `$PICTURE` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-picture-recursive`" }, { - "description": "allow-picture-meta -> This allows read access to metadata of the `$PICTURE` folder, including file listing and statistics.", + "description": "This allows full recursive write access to the complete `$PICTURE` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-picture-recursive`", "type": "string", - "enum": [ - "allow-picture-meta" - ] + "const": "allow-picture-write-recursive", + "markdownDescription": "This allows full recursive write access to the complete `$PICTURE` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-picture-recursive`" }, { - "description": "scope-picture-recursive -> This scope recursive access to the complete `$PICTURE` folder, including sub directories and files.", + "description": "This allows non-recursive read access to the `$PICTURE` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-picture`", "type": "string", - "enum": [ - "scope-picture-recursive" - ] + "const": "allow-picture-read", + "markdownDescription": "This allows non-recursive read access to the `$PICTURE` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-picture`" }, { - "description": "scope-picture -> This scope permits access to all files and list content of top level directories in the `$PICTURE`folder.", + "description": "This allows non-recursive write access to the `$PICTURE` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-picture`", "type": "string", - "enum": [ - "scope-picture" - ] + "const": "allow-picture-write", + "markdownDescription": "This allows non-recursive write access to the `$PICTURE` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-picture`" }, { - "description": "scope-picture-index -> This scope permits to list all files and folders in the `$PICTURE`folder.", + "description": "This allows full recursive read access to metadata of the `$PICTURE` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-picture-recursive`", "type": "string", - "enum": [ - "scope-picture-index" - ] + "const": "allow-picture-meta-recursive", + "markdownDescription": "This allows full recursive read access to metadata of the `$PICTURE` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-picture-recursive`" }, { - "description": "allow-public-read-recursive -> This allows full recursive read access to the complete `$PUBLIC` folder, files and subdirectories.", + "description": "This allows non-recursive read access to metadata of the `$PICTURE` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-picture-index`", "type": "string", - "enum": [ - "allow-public-read-recursive" - ] + "const": "allow-picture-meta", + "markdownDescription": "This allows non-recursive read access to metadata of the `$PICTURE` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-picture-index`" }, { - "description": "allow-public-write-recursive -> This allows full recusrive write access to the complete `$PUBLIC` folder, files and subdirectories.", + "description": "This scope permits recursive access to the complete `$PICTURE` folder, including sub directories and files.", "type": "string", - "enum": [ - "allow-public-write-recursive" - ] + "const": "scope-picture-recursive", + "markdownDescription": "This scope permits recursive access to the complete `$PICTURE` folder, including sub directories and files." }, { - "description": "allow-public-read -> This allows non-recursive read access to the `$PUBLIC` folder.", + "description": "This scope permits access to all files and list content of top level directories in the `$PICTURE` folder.", "type": "string", - "enum": [ - "allow-public-read" - ] + "const": "scope-picture", + "markdownDescription": "This scope permits access to all files and list content of top level directories in the `$PICTURE` folder." }, { - "description": "allow-public-write -> This allows non-recursive write access to the `$PUBLIC` folder.", + "description": "This scope permits to list all files and folders in the `$PICTURE`folder.", "type": "string", - "enum": [ - "allow-public-write" - ] + "const": "scope-picture-index", + "markdownDescription": "This scope permits to list all files and folders in the `$PICTURE`folder." }, { - "description": "allow-public-meta-recursive -> This allows read access to metadata of the `$PUBLIC` folder, including file listing and statistics.", + "description": "This allows full recursive read access to the complete `$PUBLIC` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-public-recursive`", "type": "string", - "enum": [ - "allow-public-meta-recursive" - ] + "const": "allow-public-read-recursive", + "markdownDescription": "This allows full recursive read access to the complete `$PUBLIC` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-public-recursive`" }, { - "description": "allow-public-meta -> This allows read access to metadata of the `$PUBLIC` folder, including file listing and statistics.", + "description": "This allows full recursive write access to the complete `$PUBLIC` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-public-recursive`", "type": "string", - "enum": [ - "allow-public-meta" - ] + "const": "allow-public-write-recursive", + "markdownDescription": "This allows full recursive write access to the complete `$PUBLIC` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-public-recursive`" }, { - "description": "scope-public-recursive -> This scope recursive access to the complete `$PUBLIC` folder, including sub directories and files.", + "description": "This allows non-recursive read access to the `$PUBLIC` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-public`", "type": "string", - "enum": [ - "scope-public-recursive" - ] + "const": "allow-public-read", + "markdownDescription": "This allows non-recursive read access to the `$PUBLIC` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-public`" }, { - "description": "scope-public -> This scope permits access to all files and list content of top level directories in the `$PUBLIC`folder.", + "description": "This allows non-recursive write access to the `$PUBLIC` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-public`", "type": "string", - "enum": [ - "scope-public" - ] + "const": "allow-public-write", + "markdownDescription": "This allows non-recursive write access to the `$PUBLIC` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-public`" }, { - "description": "scope-public-index -> This scope permits to list all files and folders in the `$PUBLIC`folder.", + "description": "This allows full recursive read access to metadata of the `$PUBLIC` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-public-recursive`", "type": "string", - "enum": [ - "scope-public-index" - ] + "const": "allow-public-meta-recursive", + "markdownDescription": "This allows full recursive read access to metadata of the `$PUBLIC` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-public-recursive`" }, { - "description": "allow-resource-read-recursive -> This allows full recursive read access to the complete `$RESOURCE` folder, files and subdirectories.", + "description": "This allows non-recursive read access to metadata of the `$PUBLIC` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-public-index`", "type": "string", - "enum": [ - "allow-resource-read-recursive" - ] + "const": "allow-public-meta", + "markdownDescription": "This allows non-recursive read access to metadata of the `$PUBLIC` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-public-index`" }, { - "description": "allow-resource-write-recursive -> This allows full recusrive write access to the complete `$RESOURCE` folder, files and subdirectories.", + "description": "This scope permits recursive access to the complete `$PUBLIC` folder, including sub directories and files.", "type": "string", - "enum": [ - "allow-resource-write-recursive" - ] + "const": "scope-public-recursive", + "markdownDescription": "This scope permits recursive access to the complete `$PUBLIC` folder, including sub directories and files." }, { - "description": "allow-resource-read -> This allows non-recursive read access to the `$RESOURCE` folder.", + "description": "This scope permits access to all files and list content of top level directories in the `$PUBLIC` folder.", "type": "string", - "enum": [ - "allow-resource-read" - ] + "const": "scope-public", + "markdownDescription": "This scope permits access to all files and list content of top level directories in the `$PUBLIC` folder." }, { - "description": "allow-resource-write -> This allows non-recursive write access to the `$RESOURCE` folder.", + "description": "This scope permits to list all files and folders in the `$PUBLIC`folder.", "type": "string", - "enum": [ - "allow-resource-write" - ] + "const": "scope-public-index", + "markdownDescription": "This scope permits to list all files and folders in the `$PUBLIC`folder." }, { - "description": "allow-resource-meta-recursive -> This allows read access to metadata of the `$RESOURCE` folder, including file listing and statistics.", + "description": "This allows full recursive read access to the complete `$RESOURCE` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-resource-recursive`", "type": "string", - "enum": [ - "allow-resource-meta-recursive" - ] + "const": "allow-resource-read-recursive", + "markdownDescription": "This allows full recursive read access to the complete `$RESOURCE` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-resource-recursive`" }, { - "description": "allow-resource-meta -> This allows read access to metadata of the `$RESOURCE` folder, including file listing and statistics.", + "description": "This allows full recursive write access to the complete `$RESOURCE` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-resource-recursive`", "type": "string", - "enum": [ - "allow-resource-meta" - ] + "const": "allow-resource-write-recursive", + "markdownDescription": "This allows full recursive write access to the complete `$RESOURCE` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-resource-recursive`" }, { - "description": "scope-resource-recursive -> This scope recursive access to the complete `$RESOURCE` folder, including sub directories and files.", + "description": "This allows non-recursive read access to the `$RESOURCE` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-resource`", "type": "string", - "enum": [ - "scope-resource-recursive" - ] + "const": "allow-resource-read", + "markdownDescription": "This allows non-recursive read access to the `$RESOURCE` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-resource`" }, { - "description": "scope-resource -> This scope permits access to all files and list content of top level directories in the `$RESOURCE`folder.", + "description": "This allows non-recursive write access to the `$RESOURCE` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-resource`", "type": "string", - "enum": [ - "scope-resource" - ] + "const": "allow-resource-write", + "markdownDescription": "This allows non-recursive write access to the `$RESOURCE` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-resource`" }, { - "description": "scope-resource-index -> This scope permits to list all files and folders in the `$RESOURCE`folder.", + "description": "This allows full recursive read access to metadata of the `$RESOURCE` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-resource-recursive`", "type": "string", - "enum": [ - "scope-resource-index" - ] + "const": "allow-resource-meta-recursive", + "markdownDescription": "This allows full recursive read access to metadata of the `$RESOURCE` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-resource-recursive`" }, { - "description": "allow-runtime-read-recursive -> This allows full recursive read access to the complete `$RUNTIME` folder, files and subdirectories.", + "description": "This allows non-recursive read access to metadata of the `$RESOURCE` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-resource-index`", "type": "string", - "enum": [ - "allow-runtime-read-recursive" - ] + "const": "allow-resource-meta", + "markdownDescription": "This allows non-recursive read access to metadata of the `$RESOURCE` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-resource-index`" }, { - "description": "allow-runtime-write-recursive -> This allows full recusrive write access to the complete `$RUNTIME` folder, files and subdirectories.", + "description": "This scope permits recursive access to the complete `$RESOURCE` folder, including sub directories and files.", "type": "string", - "enum": [ - "allow-runtime-write-recursive" - ] + "const": "scope-resource-recursive", + "markdownDescription": "This scope permits recursive access to the complete `$RESOURCE` folder, including sub directories and files." }, { - "description": "allow-runtime-read -> This allows non-recursive read access to the `$RUNTIME` folder.", + "description": "This scope permits access to all files and list content of top level directories in the `$RESOURCE` folder.", "type": "string", - "enum": [ - "allow-runtime-read" - ] + "const": "scope-resource", + "markdownDescription": "This scope permits access to all files and list content of top level directories in the `$RESOURCE` folder." }, { - "description": "allow-runtime-write -> This allows non-recursive write access to the `$RUNTIME` folder.", + "description": "This scope permits to list all files and folders in the `$RESOURCE`folder.", "type": "string", - "enum": [ - "allow-runtime-write" - ] + "const": "scope-resource-index", + "markdownDescription": "This scope permits to list all files and folders in the `$RESOURCE`folder." }, { - "description": "allow-runtime-meta-recursive -> This allows read access to metadata of the `$RUNTIME` folder, including file listing and statistics.", + "description": "This allows full recursive read access to the complete `$RUNTIME` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-runtime-recursive`", "type": "string", - "enum": [ - "allow-runtime-meta-recursive" - ] + "const": "allow-runtime-read-recursive", + "markdownDescription": "This allows full recursive read access to the complete `$RUNTIME` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-runtime-recursive`" }, { - "description": "allow-runtime-meta -> This allows read access to metadata of the `$RUNTIME` folder, including file listing and statistics.", + "description": "This allows full recursive write access to the complete `$RUNTIME` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-runtime-recursive`", "type": "string", - "enum": [ - "allow-runtime-meta" - ] + "const": "allow-runtime-write-recursive", + "markdownDescription": "This allows full recursive write access to the complete `$RUNTIME` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-runtime-recursive`" }, { - "description": "scope-runtime-recursive -> This scope recursive access to the complete `$RUNTIME` folder, including sub directories and files.", + "description": "This allows non-recursive read access to the `$RUNTIME` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-runtime`", "type": "string", - "enum": [ - "scope-runtime-recursive" - ] + "const": "allow-runtime-read", + "markdownDescription": "This allows non-recursive read access to the `$RUNTIME` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-runtime`" }, { - "description": "scope-runtime -> This scope permits access to all files and list content of top level directories in the `$RUNTIME`folder.", + "description": "This allows non-recursive write access to the `$RUNTIME` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-runtime`", "type": "string", - "enum": [ - "scope-runtime" - ] + "const": "allow-runtime-write", + "markdownDescription": "This allows non-recursive write access to the `$RUNTIME` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-runtime`" }, { - "description": "scope-runtime-index -> This scope permits to list all files and folders in the `$RUNTIME`folder.", + "description": "This allows full recursive read access to metadata of the `$RUNTIME` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-runtime-recursive`", "type": "string", - "enum": [ - "scope-runtime-index" - ] + "const": "allow-runtime-meta-recursive", + "markdownDescription": "This allows full recursive read access to metadata of the `$RUNTIME` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-runtime-recursive`" }, { - "description": "allow-temp-read-recursive -> This allows full recursive read access to the complete `$TEMP` folder, files and subdirectories.", + "description": "This allows non-recursive read access to metadata of the `$RUNTIME` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-runtime-index`", "type": "string", - "enum": [ - "allow-temp-read-recursive" - ] + "const": "allow-runtime-meta", + "markdownDescription": "This allows non-recursive read access to metadata of the `$RUNTIME` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-runtime-index`" }, { - "description": "allow-temp-write-recursive -> This allows full recusrive write access to the complete `$TEMP` folder, files and subdirectories.", + "description": "This scope permits recursive access to the complete `$RUNTIME` folder, including sub directories and files.", "type": "string", - "enum": [ - "allow-temp-write-recursive" - ] + "const": "scope-runtime-recursive", + "markdownDescription": "This scope permits recursive access to the complete `$RUNTIME` folder, including sub directories and files." }, { - "description": "allow-temp-read -> This allows non-recursive read access to the `$TEMP` folder.", + "description": "This scope permits access to all files and list content of top level directories in the `$RUNTIME` folder.", "type": "string", - "enum": [ - "allow-temp-read" - ] + "const": "scope-runtime", + "markdownDescription": "This scope permits access to all files and list content of top level directories in the `$RUNTIME` folder." }, { - "description": "allow-temp-write -> This allows non-recursive write access to the `$TEMP` folder.", + "description": "This scope permits to list all files and folders in the `$RUNTIME`folder.", "type": "string", - "enum": [ - "allow-temp-write" - ] + "const": "scope-runtime-index", + "markdownDescription": "This scope permits to list all files and folders in the `$RUNTIME`folder." }, { - "description": "allow-temp-meta-recursive -> This allows read access to metadata of the `$TEMP` folder, including file listing and statistics.", + "description": "This allows full recursive read access to the complete `$TEMP` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-temp-recursive`", "type": "string", - "enum": [ - "allow-temp-meta-recursive" - ] + "const": "allow-temp-read-recursive", + "markdownDescription": "This allows full recursive read access to the complete `$TEMP` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-temp-recursive`" }, { - "description": "allow-temp-meta -> This allows read access to metadata of the `$TEMP` folder, including file listing and statistics.", + "description": "This allows full recursive write access to the complete `$TEMP` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-temp-recursive`", "type": "string", - "enum": [ - "allow-temp-meta" - ] + "const": "allow-temp-write-recursive", + "markdownDescription": "This allows full recursive write access to the complete `$TEMP` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-temp-recursive`" }, { - "description": "scope-temp-recursive -> This scope recursive access to the complete `$TEMP` folder, including sub directories and files.", + "description": "This allows non-recursive read access to the `$TEMP` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-temp`", "type": "string", - "enum": [ - "scope-temp-recursive" - ] + "const": "allow-temp-read", + "markdownDescription": "This allows non-recursive read access to the `$TEMP` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-temp`" }, { - "description": "scope-temp -> This scope permits access to all files and list content of top level directories in the `$TEMP`folder.", + "description": "This allows non-recursive write access to the `$TEMP` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-temp`", "type": "string", - "enum": [ - "scope-temp" - ] + "const": "allow-temp-write", + "markdownDescription": "This allows non-recursive write access to the `$TEMP` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-temp`" }, { - "description": "scope-temp-index -> This scope permits to list all files and folders in the `$TEMP`folder.", + "description": "This allows full recursive read access to metadata of the `$TEMP` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-temp-recursive`", "type": "string", - "enum": [ - "scope-temp-index" - ] + "const": "allow-temp-meta-recursive", + "markdownDescription": "This allows full recursive read access to metadata of the `$TEMP` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-temp-recursive`" }, { - "description": "allow-template-read-recursive -> This allows full recursive read access to the complete `$TEMPLATE` folder, files and subdirectories.", + "description": "This allows non-recursive read access to metadata of the `$TEMP` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-temp-index`", "type": "string", - "enum": [ - "allow-template-read-recursive" - ] + "const": "allow-temp-meta", + "markdownDescription": "This allows non-recursive read access to metadata of the `$TEMP` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-temp-index`" }, { - "description": "allow-template-write-recursive -> This allows full recusrive write access to the complete `$TEMPLATE` folder, files and subdirectories.", + "description": "This scope permits recursive access to the complete `$TEMP` folder, including sub directories and files.", "type": "string", - "enum": [ - "allow-template-write-recursive" - ] + "const": "scope-temp-recursive", + "markdownDescription": "This scope permits recursive access to the complete `$TEMP` folder, including sub directories and files." }, { - "description": "allow-template-read -> This allows non-recursive read access to the `$TEMPLATE` folder.", + "description": "This scope permits access to all files and list content of top level directories in the `$TEMP` folder.", "type": "string", - "enum": [ - "allow-template-read" - ] + "const": "scope-temp", + "markdownDescription": "This scope permits access to all files and list content of top level directories in the `$TEMP` folder." }, { - "description": "allow-template-write -> This allows non-recursive write access to the `$TEMPLATE` folder.", + "description": "This scope permits to list all files and folders in the `$TEMP`folder.", "type": "string", - "enum": [ - "allow-template-write" - ] + "const": "scope-temp-index", + "markdownDescription": "This scope permits to list all files and folders in the `$TEMP`folder." }, { - "description": "allow-template-meta-recursive -> This allows read access to metadata of the `$TEMPLATE` folder, including file listing and statistics.", + "description": "This allows full recursive read access to the complete `$TEMPLATE` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-template-recursive`", "type": "string", - "enum": [ - "allow-template-meta-recursive" - ] + "const": "allow-template-read-recursive", + "markdownDescription": "This allows full recursive read access to the complete `$TEMPLATE` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-template-recursive`" }, { - "description": "allow-template-meta -> This allows read access to metadata of the `$TEMPLATE` folder, including file listing and statistics.", + "description": "This allows full recursive write access to the complete `$TEMPLATE` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-template-recursive`", "type": "string", - "enum": [ - "allow-template-meta" - ] + "const": "allow-template-write-recursive", + "markdownDescription": "This allows full recursive write access to the complete `$TEMPLATE` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-template-recursive`" }, { - "description": "scope-template-recursive -> This scope recursive access to the complete `$TEMPLATE` folder, including sub directories and files.", + "description": "This allows non-recursive read access to the `$TEMPLATE` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-template`", "type": "string", - "enum": [ - "scope-template-recursive" - ] + "const": "allow-template-read", + "markdownDescription": "This allows non-recursive read access to the `$TEMPLATE` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-template`" }, { - "description": "scope-template -> This scope permits access to all files and list content of top level directories in the `$TEMPLATE`folder.", + "description": "This allows non-recursive write access to the `$TEMPLATE` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-template`", "type": "string", - "enum": [ - "scope-template" - ] + "const": "allow-template-write", + "markdownDescription": "This allows non-recursive write access to the `$TEMPLATE` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-template`" }, { - "description": "scope-template-index -> This scope permits to list all files and folders in the `$TEMPLATE`folder.", + "description": "This allows full recursive read access to metadata of the `$TEMPLATE` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-template-recursive`", "type": "string", - "enum": [ - "scope-template-index" - ] + "const": "allow-template-meta-recursive", + "markdownDescription": "This allows full recursive read access to metadata of the `$TEMPLATE` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-template-recursive`" }, { - "description": "allow-video-read-recursive -> This allows full recursive read access to the complete `$VIDEO` folder, files and subdirectories.", + "description": "This allows non-recursive read access to metadata of the `$TEMPLATE` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-template-index`", "type": "string", - "enum": [ - "allow-video-read-recursive" - ] + "const": "allow-template-meta", + "markdownDescription": "This allows non-recursive read access to metadata of the `$TEMPLATE` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-template-index`" }, { - "description": "allow-video-write-recursive -> This allows full recusrive write access to the complete `$VIDEO` folder, files and subdirectories.", + "description": "This scope permits recursive access to the complete `$TEMPLATE` folder, including sub directories and files.", "type": "string", - "enum": [ - "allow-video-write-recursive" - ] + "const": "scope-template-recursive", + "markdownDescription": "This scope permits recursive access to the complete `$TEMPLATE` folder, including sub directories and files." }, { - "description": "allow-video-read -> This allows non-recursive read access to the `$VIDEO` folder.", + "description": "This scope permits access to all files and list content of top level directories in the `$TEMPLATE` folder.", "type": "string", - "enum": [ - "allow-video-read" - ] + "const": "scope-template", + "markdownDescription": "This scope permits access to all files and list content of top level directories in the `$TEMPLATE` folder." }, { - "description": "allow-video-write -> This allows non-recursive write access to the `$VIDEO` folder.", + "description": "This scope permits to list all files and folders in the `$TEMPLATE`folder.", "type": "string", - "enum": [ - "allow-video-write" - ] + "const": "scope-template-index", + "markdownDescription": "This scope permits to list all files and folders in the `$TEMPLATE`folder." }, { - "description": "allow-video-meta-recursive -> This allows read access to metadata of the `$VIDEO` folder, including file listing and statistics.", + "description": "This allows full recursive read access to the complete `$VIDEO` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-video-recursive`", "type": "string", - "enum": [ - "allow-video-meta-recursive" - ] + "const": "allow-video-read-recursive", + "markdownDescription": "This allows full recursive read access to the complete `$VIDEO` folder, files and subdirectories.\n#### This permission set includes:\n\n- `read-all`\n- `scope-video-recursive`" }, { - "description": "allow-video-meta -> This allows read access to metadata of the `$VIDEO` folder, including file listing and statistics.", + "description": "This allows full recursive write access to the complete `$VIDEO` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-video-recursive`", "type": "string", - "enum": [ - "allow-video-meta" - ] + "const": "allow-video-write-recursive", + "markdownDescription": "This allows full recursive write access to the complete `$VIDEO` folder, files and subdirectories.\n#### This permission set includes:\n\n- `write-all`\n- `scope-video-recursive`" }, { - "description": "scope-video-recursive -> This scope recursive access to the complete `$VIDEO` folder, including sub directories and files.", + "description": "This allows non-recursive read access to the `$VIDEO` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-video`", "type": "string", - "enum": [ - "scope-video-recursive" - ] + "const": "allow-video-read", + "markdownDescription": "This allows non-recursive read access to the `$VIDEO` folder.\n#### This permission set includes:\n\n- `read-all`\n- `scope-video`" }, { - "description": "scope-video -> This scope permits access to all files and list content of top level directories in the `$VIDEO`folder.", + "description": "This allows non-recursive write access to the `$VIDEO` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-video`", "type": "string", - "enum": [ - "scope-video" - ] + "const": "allow-video-write", + "markdownDescription": "This allows non-recursive write access to the `$VIDEO` folder.\n#### This permission set includes:\n\n- `write-all`\n- `scope-video`" }, { - "description": "scope-video-index -> This scope permits to list all files and folders in the `$VIDEO`folder.", + "description": "This allows full recursive read access to metadata of the `$VIDEO` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-video-recursive`", "type": "string", - "enum": [ - "scope-video-index" - ] + "const": "allow-video-meta-recursive", + "markdownDescription": "This allows full recursive read access to metadata of the `$VIDEO` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-video-recursive`" }, { - "description": "allow-copy-file -> Enables the copy_file command without any pre-configured scope.", + "description": "This allows non-recursive read access to metadata of the `$VIDEO` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-video-index`", "type": "string", - "enum": [ - "allow-copy-file" - ] + "const": "allow-video-meta", + "markdownDescription": "This allows non-recursive read access to metadata of the `$VIDEO` folder, including file listing and statistics.\n#### This permission set includes:\n\n- `read-meta`\n- `scope-video-index`" }, { - "description": "deny-copy-file -> Denies the copy_file command without any pre-configured scope.", + "description": "This scope permits recursive access to the complete `$VIDEO` folder, including sub directories and files.", "type": "string", - "enum": [ - "deny-copy-file" - ] + "const": "scope-video-recursive", + "markdownDescription": "This scope permits recursive access to the complete `$VIDEO` folder, including sub directories and files." }, { - "description": "allow-create -> Enables the create command without any pre-configured scope.", + "description": "This scope permits access to all files and list content of top level directories in the `$VIDEO` folder.", "type": "string", - "enum": [ - "allow-create" - ] + "const": "scope-video", + "markdownDescription": "This scope permits access to all files and list content of top level directories in the `$VIDEO` folder." }, { - "description": "deny-create -> Denies the create command without any pre-configured scope.", + "description": "This scope permits to list all files and folders in the `$VIDEO`folder.", "type": "string", - "enum": [ - "deny-create" - ] + "const": "scope-video-index", + "markdownDescription": "This scope permits to list all files and folders in the `$VIDEO`folder." }, { - "description": "allow-exists -> Enables the exists command without any pre-configured scope.", + "description": "Enables the copy_file command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-exists" - ] + "const": "allow-copy-file", + "markdownDescription": "Enables the copy_file command without any pre-configured scope." }, { - "description": "deny-exists -> Denies the exists command without any pre-configured scope.", + "description": "Denies the copy_file command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-exists" - ] + "const": "deny-copy-file", + "markdownDescription": "Denies the copy_file command without any pre-configured scope." }, { - "description": "allow-fstat -> Enables the fstat command without any pre-configured scope.", + "description": "Enables the create command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-fstat" - ] + "const": "allow-create", + "markdownDescription": "Enables the create command without any pre-configured scope." }, { - "description": "deny-fstat -> Denies the fstat command without any pre-configured scope.", + "description": "Denies the create command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-fstat" - ] + "const": "deny-create", + "markdownDescription": "Denies the create command without any pre-configured scope." }, { - "description": "allow-ftruncate -> Enables the ftruncate command without any pre-configured scope.", + "description": "Enables the exists command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-ftruncate" - ] + "const": "allow-exists", + "markdownDescription": "Enables the exists command without any pre-configured scope." }, { - "description": "deny-ftruncate -> Denies the ftruncate command without any pre-configured scope.", + "description": "Denies the exists command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-ftruncate" - ] + "const": "deny-exists", + "markdownDescription": "Denies the exists command without any pre-configured scope." }, { - "description": "allow-lstat -> Enables the lstat command without any pre-configured scope.", + "description": "Enables the fstat command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-lstat" - ] + "const": "allow-fstat", + "markdownDescription": "Enables the fstat command without any pre-configured scope." }, { - "description": "deny-lstat -> Denies the lstat command without any pre-configured scope.", + "description": "Denies the fstat command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-lstat" - ] + "const": "deny-fstat", + "markdownDescription": "Denies the fstat command without any pre-configured scope." }, { - "description": "allow-mkdir -> Enables the mkdir command without any pre-configured scope.", + "description": "Enables the ftruncate command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-mkdir" - ] + "const": "allow-ftruncate", + "markdownDescription": "Enables the ftruncate command without any pre-configured scope." }, { - "description": "deny-mkdir -> Denies the mkdir command without any pre-configured scope.", + "description": "Denies the ftruncate command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-mkdir" - ] + "const": "deny-ftruncate", + "markdownDescription": "Denies the ftruncate command without any pre-configured scope." }, { - "description": "allow-open -> Enables the open command without any pre-configured scope.", + "description": "Enables the lstat command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-open" - ] + "const": "allow-lstat", + "markdownDescription": "Enables the lstat command without any pre-configured scope." }, { - "description": "deny-open -> Denies the open command without any pre-configured scope.", + "description": "Denies the lstat command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-open" - ] + "const": "deny-lstat", + "markdownDescription": "Denies the lstat command without any pre-configured scope." }, { - "description": "allow-read -> Enables the read command without any pre-configured scope.", + "description": "Enables the mkdir command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-read" - ] + "const": "allow-mkdir", + "markdownDescription": "Enables the mkdir command without any pre-configured scope." }, { - "description": "deny-read -> Denies the read command without any pre-configured scope.", + "description": "Denies the mkdir command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-read" - ] + "const": "deny-mkdir", + "markdownDescription": "Denies the mkdir command without any pre-configured scope." }, { - "description": "allow-read-dir -> Enables the read_dir command without any pre-configured scope.", + "description": "Enables the open command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-read-dir" - ] + "const": "allow-open", + "markdownDescription": "Enables the open command without any pre-configured scope." }, { - "description": "deny-read-dir -> Denies the read_dir command without any pre-configured scope.", + "description": "Denies the open command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-read-dir" - ] + "const": "deny-open", + "markdownDescription": "Denies the open command without any pre-configured scope." }, { - "description": "allow-read-file -> Enables the read_file command without any pre-configured scope.", + "description": "Enables the read command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-read-file" - ] + "const": "allow-read", + "markdownDescription": "Enables the read command without any pre-configured scope." }, { - "description": "deny-read-file -> Denies the read_file command without any pre-configured scope.", + "description": "Denies the read command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-read-file" - ] + "const": "deny-read", + "markdownDescription": "Denies the read command without any pre-configured scope." }, { - "description": "allow-read-text-file -> Enables the read_text_file command without any pre-configured scope.", + "description": "Enables the read_dir command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-read-text-file" - ] + "const": "allow-read-dir", + "markdownDescription": "Enables the read_dir command without any pre-configured scope." }, { - "description": "deny-read-text-file -> Denies the read_text_file command without any pre-configured scope.", + "description": "Denies the read_dir command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-read-text-file" - ] + "const": "deny-read-dir", + "markdownDescription": "Denies the read_dir command without any pre-configured scope." }, { - "description": "allow-read-text-file-lines -> Enables the read_text_file_lines command without any pre-configured scope.", + "description": "Enables the read_file command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-read-text-file-lines" - ] + "const": "allow-read-file", + "markdownDescription": "Enables the read_file command without any pre-configured scope." }, { - "description": "deny-read-text-file-lines -> Denies the read_text_file_lines command without any pre-configured scope.", + "description": "Denies the read_file command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-read-text-file-lines" - ] + "const": "deny-read-file", + "markdownDescription": "Denies the read_file command without any pre-configured scope." }, { - "description": "allow-read-text-file-lines-next -> Enables the read_text_file_lines_next command without any pre-configured scope.", + "description": "Enables the read_text_file command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-read-text-file-lines-next" - ] + "const": "allow-read-text-file", + "markdownDescription": "Enables the read_text_file command without any pre-configured scope." }, { - "description": "deny-read-text-file-lines-next -> Denies the read_text_file_lines_next command without any pre-configured scope.", + "description": "Denies the read_text_file command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-read-text-file-lines-next" - ] + "const": "deny-read-text-file", + "markdownDescription": "Denies the read_text_file command without any pre-configured scope." }, { - "description": "allow-remove -> Enables the remove command without any pre-configured scope.", + "description": "Enables the read_text_file_lines command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-remove" - ] + "const": "allow-read-text-file-lines", + "markdownDescription": "Enables the read_text_file_lines command without any pre-configured scope." }, { - "description": "deny-remove -> Denies the remove command without any pre-configured scope.", + "description": "Denies the read_text_file_lines command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-remove" - ] + "const": "deny-read-text-file-lines", + "markdownDescription": "Denies the read_text_file_lines command without any pre-configured scope." }, { - "description": "allow-rename -> Enables the rename command without any pre-configured scope.", + "description": "Enables the read_text_file_lines_next command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-rename" - ] + "const": "allow-read-text-file-lines-next", + "markdownDescription": "Enables the read_text_file_lines_next command without any pre-configured scope." }, { - "description": "deny-rename -> Denies the rename command without any pre-configured scope.", + "description": "Denies the read_text_file_lines_next command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-rename" - ] + "const": "deny-read-text-file-lines-next", + "markdownDescription": "Denies the read_text_file_lines_next command without any pre-configured scope." }, { - "description": "allow-seek -> Enables the seek command without any pre-configured scope.", + "description": "Enables the remove command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-seek" - ] + "const": "allow-remove", + "markdownDescription": "Enables the remove command without any pre-configured scope." }, { - "description": "deny-seek -> Denies the seek command without any pre-configured scope.", + "description": "Denies the remove command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-seek" - ] + "const": "deny-remove", + "markdownDescription": "Denies the remove command without any pre-configured scope." }, { - "description": "allow-stat -> Enables the stat command without any pre-configured scope.", + "description": "Enables the rename command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-stat" - ] + "const": "allow-rename", + "markdownDescription": "Enables the rename command without any pre-configured scope." }, { - "description": "deny-stat -> Denies the stat command without any pre-configured scope.", + "description": "Denies the rename command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-stat" - ] + "const": "deny-rename", + "markdownDescription": "Denies the rename command without any pre-configured scope." }, { - "description": "allow-truncate -> Enables the truncate command without any pre-configured scope.", + "description": "Enables the seek command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-truncate" - ] + "const": "allow-seek", + "markdownDescription": "Enables the seek command without any pre-configured scope." }, { - "description": "deny-truncate -> Denies the truncate command without any pre-configured scope.", + "description": "Denies the seek command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-truncate" - ] + "const": "deny-seek", + "markdownDescription": "Denies the seek command without any pre-configured scope." }, { - "description": "allow-unwatch -> Enables the unwatch command without any pre-configured scope.", + "description": "Enables the size command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-unwatch" - ] + "const": "allow-size", + "markdownDescription": "Enables the size command without any pre-configured scope." }, { - "description": "deny-unwatch -> Denies the unwatch command without any pre-configured scope.", + "description": "Denies the size command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-unwatch" - ] + "const": "deny-size", + "markdownDescription": "Denies the size command without any pre-configured scope." }, { - "description": "allow-watch -> Enables the watch command without any pre-configured scope.", + "description": "Enables the stat command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-watch" - ] + "const": "allow-stat", + "markdownDescription": "Enables the stat command without any pre-configured scope." }, { - "description": "deny-watch -> Denies the watch command without any pre-configured scope.", + "description": "Denies the stat command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-watch" - ] + "const": "deny-stat", + "markdownDescription": "Denies the stat command without any pre-configured scope." }, { - "description": "allow-write -> Enables the write command without any pre-configured scope.", + "description": "Enables the truncate command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-write" - ] + "const": "allow-truncate", + "markdownDescription": "Enables the truncate command without any pre-configured scope." }, { - "description": "deny-write -> Denies the write command without any pre-configured scope.", + "description": "Denies the truncate command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-write" - ] + "const": "deny-truncate", + "markdownDescription": "Denies the truncate command without any pre-configured scope." }, { - "description": "allow-write-file -> Enables the write_file command without any pre-configured scope.", + "description": "Enables the unwatch command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-write-file" - ] + "const": "allow-unwatch", + "markdownDescription": "Enables the unwatch command without any pre-configured scope." }, { - "description": "deny-write-file -> Denies the write_file command without any pre-configured scope.", + "description": "Denies the unwatch command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-write-file" - ] + "const": "deny-unwatch", + "markdownDescription": "Denies the unwatch command without any pre-configured scope." }, { - "description": "allow-write-text-file -> Enables the write_text_file command without any pre-configured scope.", + "description": "Enables the watch command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-write-text-file" - ] + "const": "allow-watch", + "markdownDescription": "Enables the watch command without any pre-configured scope." }, { - "description": "deny-write-text-file -> Denies the write_text_file command without any pre-configured scope.", + "description": "Denies the watch command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-write-text-file" - ] + "const": "deny-watch", + "markdownDescription": "Denies the watch command without any pre-configured scope." }, { - "description": "default -> # Tauri `fs` default permissions\n\nThis configuration file defines the default permissions granted\nto the filesystem.\n\n### Granted Permissions\n\nThis default permission set enables all read-related commands and\nallows access to the `$APP` folder and sub directories created in it.\nThe location of the `$APP` folder depends on the operating system,\nwhere the application is run.\n\nIn general the `$APP` folder needs to be manually created\nby the application at runtime, before accessing files or folders\nin it is possible.\n\n### Denied Permissions\n\nThis default permission set prevents access to critical components\nof the Tauri application by default.\nOn Windows the webview data folder access is denied.\n\n", + "description": "Enables the write command without any pre-configured scope.", "type": "string", - "enum": [ - "default" - ] + "const": "allow-write", + "markdownDescription": "Enables the write command without any pre-configured scope." }, { - "description": "deny-default -> This denies access to dangerous Tauri relevant files and folders by default.", + "description": "Denies the write command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-default" - ] + "const": "deny-write", + "markdownDescription": "Denies the write command without any pre-configured scope." }, { - "description": "deny-webview-data-linux -> This denies read access to the\n`$APPLOCALDATA` folder on linux as the webview data and configuration values are stored here.\nAllowing access can lead to sensitive information disclosure and should be well considered.", + "description": "Enables the write_file command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-webview-data-linux" - ] + "const": "allow-write-file", + "markdownDescription": "Enables the write_file command without any pre-configured scope." }, { - "description": "deny-webview-data-windows -> This denies read access to the\n`$APPLOCALDATA/EBWebView` folder on windows as the webview data and configuration values are stored here.\nAllowing access can lead to sensitive information disclosure and should be well considered.", + "description": "Denies the write_file command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-webview-data-windows" - ] + "const": "deny-write-file", + "markdownDescription": "Denies the write_file command without any pre-configured scope." }, { - "description": "read-all -> This enables all read related commands without any pre-configured accessible paths.", + "description": "Enables the write_text_file command without any pre-configured scope.", "type": "string", - "enum": [ - "read-all" - ] + "const": "allow-write-text-file", + "markdownDescription": "Enables the write_text_file command without any pre-configured scope." }, { - "description": "read-dirs -> This enables directory read and file metadata related commands without any pre-configured accessible paths.", + "description": "Denies the write_text_file command without any pre-configured scope.", "type": "string", - "enum": [ - "read-dirs" - ] + "const": "deny-write-text-file", + "markdownDescription": "Denies the write_text_file command without any pre-configured scope." }, { - "description": "read-files -> This enables file read related commands without any pre-configured accessible paths.", + "description": "This permissions allows to create the application specific directories.\n", "type": "string", - "enum": [ - "read-files" - ] + "const": "create-app-specific-dirs", + "markdownDescription": "This permissions allows to create the application specific directories.\n" }, { - "description": "read-meta -> This enables all index or metadata related commands without any pre-configured accessible paths.", + "description": "This set of permissions describes the what kind of\nfile system access the `fs` plugin has enabled or denied by default.\n\n#### Granted Permissions\n\nThis default permission set enables read access to the\napplication specific directories (AppConfig, AppData, AppLocalData, AppCache,\nAppLog) and all files and sub directories created in it.\nThe location of these directories depends on the operating system,\nwhere the application is run.\n\nIn general these directories need to be manually created\nby the application at runtime, before accessing files or folders\nin it is possible.\n\nTherefore, it is also allowed to create all of these folders via\nthe `mkdir` command.\n\n#### Denied Permissions\n\nThis default permission set prevents access to critical components\nof the Tauri application by default.\nOn Windows the webview data folder access is denied.\n\n#### This default permission set includes:\n\n- `create-app-specific-dirs`\n- `read-app-specific-dirs-recursive`\n- `deny-default`", "type": "string", - "enum": [ - "read-meta" - ] + "const": "default", + "markdownDescription": "This set of permissions describes the what kind of\nfile system access the `fs` plugin has enabled or denied by default.\n\n#### Granted Permissions\n\nThis default permission set enables read access to the\napplication specific directories (AppConfig, AppData, AppLocalData, AppCache,\nAppLog) and all files and sub directories created in it.\nThe location of these directories depends on the operating system,\nwhere the application is run.\n\nIn general these directories need to be manually created\nby the application at runtime, before accessing files or folders\nin it is possible.\n\nTherefore, it is also allowed to create all of these folders via\nthe `mkdir` command.\n\n#### Denied Permissions\n\nThis default permission set prevents access to critical components\nof the Tauri application by default.\nOn Windows the webview data folder access is denied.\n\n#### This default permission set includes:\n\n- `create-app-specific-dirs`\n- `read-app-specific-dirs-recursive`\n- `deny-default`" }, { - "description": "scope -> An empty permission you can use to modify the global scope.", + "description": "This denies access to dangerous Tauri relevant files and folders by default.\n#### This permission set includes:\n\n- `deny-webview-data-linux`\n- `deny-webview-data-windows`", "type": "string", - "enum": [ - "scope" - ] + "const": "deny-default", + "markdownDescription": "This denies access to dangerous Tauri relevant files and folders by default.\n#### This permission set includes:\n\n- `deny-webview-data-linux`\n- `deny-webview-data-windows`" }, { - "description": "write-all -> This enables all write related commands without any pre-configured accessible paths.", + "description": "This denies read access to the\n`$APPLOCALDATA` folder on linux as the webview data and configuration values are stored here.\nAllowing access can lead to sensitive information disclosure and should be well considered.", "type": "string", - "enum": [ - "write-all" - ] + "const": "deny-webview-data-linux", + "markdownDescription": "This denies read access to the\n`$APPLOCALDATA` folder on linux as the webview data and configuration values are stored here.\nAllowing access can lead to sensitive information disclosure and should be well considered." }, { - "description": "write-files -> This enables all file write related commands without any pre-configured accessible paths.", + "description": "This denies read access to the\n`$APPLOCALDATA/EBWebView` folder on windows as the webview data and configuration values are stored here.\nAllowing access can lead to sensitive information disclosure and should be well considered.", "type": "string", - "enum": [ - "write-files" - ] + "const": "deny-webview-data-windows", + "markdownDescription": "This denies read access to the\n`$APPLOCALDATA/EBWebView` folder on windows as the webview data and configuration values are stored here.\nAllowing access can lead to sensitive information disclosure and should be well considered." + }, + { + "description": "This enables all read related commands without any pre-configured accessible paths.", + "type": "string", + "const": "read-all", + "markdownDescription": "This enables all read related commands without any pre-configured accessible paths." + }, + { + "description": "This permission allows recursive read functionality on the application\nspecific base directories. \n", + "type": "string", + "const": "read-app-specific-dirs-recursive", + "markdownDescription": "This permission allows recursive read functionality on the application\nspecific base directories. \n" + }, + { + "description": "This enables directory read and file metadata related commands without any pre-configured accessible paths.", + "type": "string", + "const": "read-dirs", + "markdownDescription": "This enables directory read and file metadata related commands without any pre-configured accessible paths." + }, + { + "description": "This enables file read related commands without any pre-configured accessible paths.", + "type": "string", + "const": "read-files", + "markdownDescription": "This enables file read related commands without any pre-configured accessible paths." + }, + { + "description": "This enables all index or metadata related commands without any pre-configured accessible paths.", + "type": "string", + "const": "read-meta", + "markdownDescription": "This enables all index or metadata related commands without any pre-configured accessible paths." + }, + { + "description": "An empty permission you can use to modify the global scope.", + "type": "string", + "const": "scope", + "markdownDescription": "An empty permission you can use to modify the global scope." + }, + { + "description": "This enables all write related commands without any pre-configured accessible paths.", + "type": "string", + "const": "write-all", + "markdownDescription": "This enables all write related commands without any pre-configured accessible paths." + }, + { + "description": "This enables all file write related commands without any pre-configured accessible paths.", + "type": "string", + "const": "write-files", + "markdownDescription": "This enables all file write related commands without any pre-configured accessible paths." } ] } diff --git a/plugins/fs/permissions/write-all.toml b/plugins/fs/permissions/write-all.toml index 55a512de..c1802782 100644 --- a/plugins/fs/permissions/write-all.toml +++ b/plugins/fs/permissions/write-all.toml @@ -4,14 +4,14 @@ identifier = "write-all" description = "This enables all write related commands without any pre-configured accessible paths." commands.allow = [ - "mkdir", - "create", - "copy_file", - "remove", - "rename", - "truncate", - "ftruncate", - "write", - "write_file", - "write_text_file", + "mkdir", + "create", + "copy_file", + "remove", + "rename", + "truncate", + "ftruncate", + "write", + "write_file", + "write_text_file", ] diff --git a/plugins/fs/permissions/write-files.toml b/plugins/fs/permissions/write-files.toml index 239bc60d..2d6aeffb 100644 --- a/plugins/fs/permissions/write-files.toml +++ b/plugins/fs/permissions/write-files.toml @@ -4,13 +4,13 @@ identifier = "write-files" description = "This enables all file write related commands without any pre-configured accessible paths." commands.allow = [ - "create", - "copy_file", - "remove", - "rename", - "truncate", - "ftruncate", - "write", - "write_file", - "write_text_file", + "create", + "copy_file", + "remove", + "rename", + "truncate", + "ftruncate", + "write", + "write_file", + "write_text_file", ] diff --git a/plugins/fs/rollup.config.js b/plugins/fs/rollup.config.js index 977dfac8..1f349ec8 100644 --- a/plugins/fs/rollup.config.js +++ b/plugins/fs/rollup.config.js @@ -2,6 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { createConfig } from "../../shared/rollup.config.js"; +import { createConfig } from '../../shared/rollup.config.js' -export default createConfig(); +export default createConfig() diff --git a/plugins/fs/src/api-iife.js b/plugins/fs/src/api-iife.js deleted file mode 100644 index f380ba77..00000000 --- a/plugins/fs/src/api-iife.js +++ /dev/null @@ -1 +0,0 @@ -if("__TAURI__"in window){var __TAURI_PLUGIN_FS__=function(t){"use strict";function e(t,e,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(t):i?i.value:e.get(t)}function n(t,e,n,i,o){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?o.call(t,n):o?o.value=n:e.set(t,n),n}var i,o,r,a;"function"==typeof SuppressedError&&SuppressedError;class s{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,i.set(this,(()=>{})),this.id=function(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}((t=>{e(this,i,"f").call(this,t)}))}set onmessage(t){n(this,i,t,"f")}get onmessage(){return e(this,i,"f")}toJSON(){return`__CHANNEL__:${this.id}`}}async function c(t,e={},n){return window.__TAURI_INTERNALS__.invoke(t,e,n)}i=new WeakMap;class f{get rid(){return e(this,o,"f")}constructor(t){o.set(this,void 0),n(this,o,t,"f")}async close(){return c("plugin:resources|close",{rid:this.rid})}}function l(t){return{isFile:t.isFile,isDirectory:t.isDirectory,isSymlink:t.isSymlink,size:t.size,mtime:null!=t.mtime?new Date(t.mtime):null,atime:null!=t.atime?new Date(t.atime):null,birthtime:null!=t.birthtime?new Date(t.birthtime):null,readonly:t.readonly,fileAttributes:t.fileAttributes,dev:t.dev,ino:t.ino,mode:t.mode,nlink:t.nlink,uid:t.uid,gid:t.gid,rdev:t.rdev,blksize:t.blksize,blocks:t.blocks}}o=new WeakMap,t.BaseDirectory=void 0,(r=t.BaseDirectory||(t.BaseDirectory={}))[r.Audio=1]="Audio",r[r.Cache=2]="Cache",r[r.Config=3]="Config",r[r.Data=4]="Data",r[r.LocalData=5]="LocalData",r[r.Document=6]="Document",r[r.Download=7]="Download",r[r.Picture=8]="Picture",r[r.Public=9]="Public",r[r.Video=10]="Video",r[r.Resource=11]="Resource",r[r.Temp=12]="Temp",r[r.AppConfig=13]="AppConfig",r[r.AppData=14]="AppData",r[r.AppLocalData=15]="AppLocalData",r[r.AppCache=16]="AppCache",r[r.AppLog=17]="AppLog",r[r.Desktop=18]="Desktop",r[r.Executable=19]="Executable",r[r.Font=20]="Font",r[r.Home=21]="Home",r[r.Runtime=22]="Runtime",r[r.Template=23]="Template",t.SeekMode=void 0,(a=t.SeekMode||(t.SeekMode={}))[a.Start=0]="Start",a[a.Current=1]="Current",a[a.End=2]="End";class u extends f{constructor(t){super(t)}async read(t){if(0===t.byteLength)return 0;const[e,n]=await c("plugin:fs|read",{rid:this.rid,len:t.byteLength});return t.set(e),0===n?null:n}async seek(t,e){return c("plugin:fs|seek",{rid:this.rid,offset:t,whence:e})}async stat(){return l(await c("plugin:fs|fstat",{rid:this.rid}))}async truncate(t){return c("plugin:fs|ftruncate",{rid:this.rid,len:t})}async write(t){return c("plugin:fs|write",{rid:this.rid,data:Array.from(t)})}}async function p(t){await c("plugin:fs|unwatch",{rid:t})}return t.FileHandle=u,t.copyFile=async function(t,e,n){if(t instanceof URL&&"file:"!==t.protocol||e instanceof URL&&"file:"!==e.protocol)throw new TypeError("Must be a file URL.");return c("plugin:fs|copy_file",{fromPath:t instanceof URL?t.toString():t,toPath:e instanceof URL?e.toString():e,options:n})},t.create=async function(t,e){if(t instanceof URL&&"file:"!==t.protocol)throw new TypeError("Must be a file URL.");const n=await c("plugin:fs|create",{path:t instanceof URL?t.toString():t,options:e});return new u(n)},t.exists=async function(t,e){if(t instanceof URL&&"file:"!==t.protocol)throw new TypeError("Must be a file URL.");return c("plugin:fs|exists",{path:t instanceof URL?t.toString():t,options:e})},t.lstat=async function(t,e){return l(await c("plugin:fs|lstat",{path:t instanceof URL?t.toString():t,options:e}))},t.mkdir=async function(t,e){if(t instanceof URL&&"file:"!==t.protocol)throw new TypeError("Must be a file URL.");return c("plugin:fs|mkdir",{path:t instanceof URL?t.toString():t,options:e})},t.open=async function(t,e){if(t instanceof URL&&"file:"!==t.protocol)throw new TypeError("Must be a file URL.");const n=await c("plugin:fs|open",{path:t instanceof URL?t.toString():t,options:e});return new u(n)},t.readDir=async function(t,e){if(t instanceof URL&&"file:"!==t.protocol)throw new TypeError("Must be a file URL.");return c("plugin:fs|read_dir",{path:t instanceof URL?t.toString():t,options:e})},t.readFile=async function(t,e){if(t instanceof URL&&"file:"!==t.protocol)throw new TypeError("Must be a file URL.");const n=await c("plugin:fs|read_file",{path:t instanceof URL?t.toString():t,options:e});return Uint8Array.from(n)},t.readTextFile=async function(t,e){if(t instanceof URL&&"file:"!==t.protocol)throw new TypeError("Must be a file URL.");return c("plugin:fs|read_text_file",{path:t instanceof URL?t.toString():t,options:e})},t.readTextFileLines=async function(t,e){if(t instanceof URL&&"file:"!==t.protocol)throw new TypeError("Must be a file URL.");const n=t instanceof URL?t.toString():t;return Promise.resolve({path:n,rid:null,async next(){this.rid||(this.rid=await c("plugin:fs|read_text_file_lines",{path:n,options:e}));const[t,i]=await c("plugin:fs|read_text_file_lines_next",{rid:this.rid});return i&&(this.rid=null),{value:i?"":t,done:i}},[Symbol.asyncIterator](){return this}})},t.remove=async function(t,e){if(t instanceof URL&&"file:"!==t.protocol)throw new TypeError("Must be a file URL.");return c("plugin:fs|remove",{path:t instanceof URL?t.toString():t,options:e})},t.rename=async function(t,e,n){if(t instanceof URL&&"file:"!==t.protocol||e instanceof URL&&"file:"!==e.protocol)throw new TypeError("Must be a file URL.");return c("plugin:fs|rename",{oldPath:t instanceof URL?t.toString():t,newPath:e instanceof URL?e.toString():e,options:n})},t.stat=async function(t,e){return l(await c("plugin:fs|stat",{path:t instanceof URL?t.toString():t,options:e}))},t.truncate=async function(t,e,n){if(t instanceof URL&&"file:"!==t.protocol)throw new TypeError("Must be a file URL.");return c("plugin:fs|truncate",{path:t instanceof URL?t.toString():t,len:e,options:n})},t.watch=async function(t,e,n){const i={recursive:!1,delayMs:2e3,...n},o=Array.isArray(t)?t:[t];for(const t of o)if(t instanceof URL&&"file:"!==t.protocol)throw new TypeError("Must be a file URL.");const r=new s;r.onmessage=e;const a=await c("plugin:fs|watch",{paths:o.map((t=>t instanceof URL?t.toString():t)),options:i,onEvent:r});return()=>{p(a)}},t.watchImmediate=async function(t,e,n){const i={recursive:!1,...n,delayMs:null},o=Array.isArray(t)?t:[t];for(const t of o)if(t instanceof URL&&"file:"!==t.protocol)throw new TypeError("Must be a file URL.");const r=new s;r.onmessage=e;const a=await c("plugin:fs|watch",{paths:o.map((t=>t instanceof URL?t.toString():t)),options:i,onEvent:r});return()=>{p(a)}},t.writeFile=async function(t,e,n){if(t instanceof URL&&"file:"!==t.protocol)throw new TypeError("Must be a file URL.");return c("plugin:fs|write_file",{path:t instanceof URL?t.toString():t,data:Array.from(e),options:n})},t.writeTextFile=async function(t,e,n){if(t instanceof URL&&"file:"!==t.protocol)throw new TypeError("Must be a file URL.");return c("plugin:fs|write_text_file",{path:t instanceof URL?t.toString():t,data:e,options:n})},t}({});Object.defineProperty(window.__TAURI__,"fs",{value:__TAURI_PLUGIN_FS__})} diff --git a/plugins/fs/src/commands.rs b/plugins/fs/src/commands.rs index fe49d15c..bd1400ea 100644 --- a/plugins/fs/src/commands.rs +++ b/plugins/fs/src/commands.rs @@ -7,20 +7,22 @@ use serde::{Deserialize, Serialize, Serializer}; use serde_repr::{Deserialize_repr, Serialize_repr}; use tauri::{ ipc::{CommandScope, GlobalScope}, - path::{BaseDirectory, SafePathBuf}, + path::BaseDirectory, utils::config::FsScope, - AppHandle, Manager, Resource, ResourceId, Runtime, + Manager, Resource, ResourceId, Runtime, Webview, }; use std::{ + borrow::Cow, fs::File, - io::{BufReader, Lines, Read, Write}, + io::{BufRead, BufReader, Read, Write}, path::{Path, PathBuf}, + str::FromStr, sync::Mutex, time::{SystemTime, UNIX_EPOCH}, }; -use crate::{scope::Entry, Error, FsExt}; +use crate::{scope::Entry, Error, SafeFilePath}; #[derive(Debug, thiserror::Error)] pub enum CommandError { @@ -31,6 +33,10 @@ pub enum CommandError { #[error(transparent)] Tauri(#[from] tauri::Error), #[error(transparent)] + Json(#[from] serde_json::Error), + #[error(transparent)] + Io(#[from] std::io::Error), + #[error(transparent)] UrlParseError(#[from] url::ParseError), #[cfg(feature = "watch")] #[error(transparent)] @@ -64,7 +70,7 @@ impl Serialize for CommandError { pub type CommandResult = std::result::Result; -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Default, Clone, Deserialize)] #[serde(rename_all = "camelCase")] pub struct BaseOptions { base_dir: Option, @@ -72,14 +78,14 @@ pub struct BaseOptions { #[tauri::command] pub fn create( - app: AppHandle, + webview: Webview, global_scope: GlobalScope, command_scope: CommandScope, - path: SafePathBuf, + path: SafeFilePath, options: Option, ) -> CommandResult { let resolved_path = resolve_path( - &app, + &webview, &global_scope, &command_scope, path, @@ -91,89 +97,59 @@ pub fn create( resolved_path.display() ) })?; - let rid = app.resources_table().add(StdFileResource::new(file)); + let rid = webview.resources_table().add(StdFileResource::new(file)); Ok(rid) } -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Default, Clone, Deserialize)] #[serde(rename_all = "camelCase")] pub struct OpenOptions { #[serde(flatten)] base: BaseOptions, - #[serde(default = "default_true")] - read: bool, - #[serde(default)] - write: bool, - #[serde(default)] - append: bool, - #[serde(default)] - truncate: bool, - #[serde(default)] - create: bool, - #[serde(default)] - create_new: bool, - #[allow(unused)] - mode: Option, -} - -fn default_true() -> bool { - true + #[serde(flatten)] + options: crate::OpenOptions, } #[tauri::command] pub fn open( - app: AppHandle, + webview: Webview, global_scope: GlobalScope, command_scope: CommandScope, - path: SafePathBuf, + path: SafeFilePath, options: Option, ) -> CommandResult { - let resolved_path = resolve_path( - &app, + let (file, _path) = resolve_file( + &webview, &global_scope, &command_scope, path, - options.as_ref().and_then(|o| o.base.base_dir), - )?; - - let mut opts = std::fs::OpenOptions::new(); - // default to read-only - opts.read(true); - - if let Some(options) = options { - #[cfg(unix)] - { - use std::os::unix::fs::OpenOptionsExt; - if let Some(mode) = options.mode { - opts.mode(mode); + if let Some(opts) = options { + OpenOptions { + base: opts.base, + options: opts.options, } - } - - opts.read(options.read) - .create(options.create) - .write(options.write) - .truncate(options.truncate) - .append(options.append) - .create_new(options.create_new); - } - - let file = opts.open(&resolved_path).map_err(|e| { - format!( - "failed to open file at path: {} with error: {e}", - resolved_path.display() - ) - })?; + } else { + OpenOptions { + base: BaseOptions { base_dir: None }, + options: crate::OpenOptions { + read: true, + write: false, + truncate: false, + create: false, + create_new: false, + append: false, + mode: None, + custom_flags: None, + }, + } + }, + )?; - let rid = app.resources_table().add(StdFileResource::new(file)); + let rid = webview.resources_table().add(StdFileResource::new(file)); Ok(rid) } -#[tauri::command] -pub fn close(app: AppHandle, rid: ResourceId) -> CommandResult<()> { - app.resources_table().close(rid).map_err(Into::into) -} - #[derive(Debug, Clone, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CopyFileOptions { @@ -182,23 +158,23 @@ pub struct CopyFileOptions { } #[tauri::command] -pub fn copy_file( - app: AppHandle, +pub async fn copy_file( + webview: Webview, global_scope: GlobalScope, command_scope: CommandScope, - from_path: SafePathBuf, - to_path: SafePathBuf, + from_path: SafeFilePath, + to_path: SafeFilePath, options: Option, ) -> CommandResult<()> { let resolved_from_path = resolve_path( - &app, + &webview, &global_scope, &command_scope, from_path, options.as_ref().and_then(|o| o.from_path_base_dir), )?; let resolved_to_path = resolve_path( - &app, + &webview, &global_scope, &command_scope, to_path, @@ -225,14 +201,14 @@ pub struct MkdirOptions { #[tauri::command] pub fn mkdir( - app: AppHandle, + webview: Webview, global_scope: GlobalScope, command_scope: CommandScope, - path: SafePathBuf, + path: SafeFilePath, options: Option, ) -> CommandResult<()> { let resolved_path = resolve_path( - &app, + &webview, &global_scope, &command_scope, path, @@ -264,133 +240,155 @@ pub fn mkdir( #[serde(rename_all = "camelCase")] #[non_exhaustive] pub struct DirEntry { - pub name: Option, + pub name: String, pub is_directory: bool, pub is_file: bool, pub is_symlink: bool, } -fn read_dir_inner>(path: P) -> crate::Result> { - let mut files_and_dirs: Vec = vec![]; - for entry in std::fs::read_dir(path)? { - let path = entry?.path(); - let file_type = path.metadata()?.file_type(); - files_and_dirs.push(DirEntry { - is_directory: file_type.is_dir(), - is_file: file_type.is_file(), - is_symlink: std::fs::symlink_metadata(&path) - .map(|md| md.file_type().is_symlink()) - .unwrap_or(false), - name: path - .file_name() - .map(|name| name.to_string_lossy()) - .map(|name| name.to_string()), - }); - } - Result::Ok(files_and_dirs) -} - #[tauri::command] -pub fn read_dir( - app: AppHandle, +pub async fn read_dir( + webview: Webview, global_scope: GlobalScope, command_scope: CommandScope, - path: SafePathBuf, + path: SafeFilePath, options: Option, ) -> CommandResult> { let resolved_path = resolve_path( - &app, + &webview, &global_scope, &command_scope, path, options.as_ref().and_then(|o| o.base_dir), )?; - read_dir_inner(&resolved_path) - .map_err(|e| { - format!( - "failed to read directory at path: {} with error: {e}", - resolved_path.display() - ) + let entries = std::fs::read_dir(&resolved_path).map_err(|e| { + format!( + "failed to read directory at path: {} with error: {e}", + resolved_path.display() + ) + })?; + + let entries = entries + .filter_map(|entry| { + let entry = entry.ok()?; + let name = entry.file_name().into_string().ok()?; + let metadata = entry.file_type(); + macro_rules! method_or_false { + ($method:ident) => { + if let Ok(metadata) = &metadata { + metadata.$method() + } else { + false + } + }; + } + Some(DirEntry { + name, + is_file: method_or_false!(is_file), + is_directory: method_or_false!(is_dir), + is_symlink: method_or_false!(is_symlink), + }) }) - .map_err(Into::into) + .collect(); + + Ok(entries) } #[tauri::command] -pub fn read( - app: AppHandle, +pub async fn read( + webview: Webview, rid: ResourceId, - len: u32, -) -> CommandResult<(Vec, usize)> { - let mut data = vec![0; len as usize]; - let file = app.resources_table().get::(rid)?; + len: usize, +) -> CommandResult { + let mut data = vec![0; len]; + let file = webview.resources_table().get::(rid)?; let nread = StdFileResource::with_lock(&file, |mut file| file.read(&mut data)) .map_err(|e| format!("faied to read bytes from file with error: {e}"))?; - Ok((data, nread)) + + // This is an optimization to include the number of read bytes (as bigendian bytes) + // at the end of returned vector so we can use `tauri::ipc::Response` + // and avoid serialization overhead of separate values. + #[cfg(target_pointer_width = "16")] + let nread = { + let nread = nread.to_be_bytes(); + let mut out = [0; 8]; + out[6..].copy_from_slice(&nread); + out + }; + #[cfg(target_pointer_width = "32")] + let nread = { + let nread = nread.to_be_bytes(); + let mut out = [0; 8]; + out[4..].copy_from_slice(&nread); + out + }; + #[cfg(target_pointer_width = "64")] + let nread = nread.to_be_bytes(); + + data.extend(nread); + + Ok(tauri::ipc::Response::new(data)) } #[tauri::command] -pub fn read_file( - app: AppHandle, +pub async fn read_file( + webview: Webview, global_scope: GlobalScope, command_scope: CommandScope, - path: SafePathBuf, + path: SafeFilePath, options: Option, -) -> CommandResult> { - let resolved_path = resolve_path( - &app, +) -> CommandResult { + let (mut file, path) = resolve_file( + &webview, &global_scope, &command_scope, path, - options.as_ref().and_then(|o| o.base_dir), + OpenOptions { + base: BaseOptions { + base_dir: options.as_ref().and_then(|o| o.base_dir), + }, + options: crate::OpenOptions { + read: true, + ..Default::default() + }, + }, )?; - std::fs::read(&resolved_path) - .map_err(|e| { - format!( - "failed to read file at path: {} with error: {e}", - resolved_path.display() - ) - }) - .map_err(Into::into) + + let mut contents = Vec::new(); + + file.read_to_end(&mut contents).map_err(|e| { + format!( + "failed to read file as text at path: {} with error: {e}", + path.display() + ) + })?; + + Ok(tauri::ipc::Response::new(contents)) } +// TODO, remove in v3, rely on `read_file` command instead #[tauri::command] -pub fn read_text_file( - app: AppHandle, +pub async fn read_text_file( + webview: Webview, global_scope: GlobalScope, command_scope: CommandScope, - path: SafePathBuf, + path: SafeFilePath, options: Option, -) -> CommandResult { - let resolved_path = resolve_path( - &app, - &global_scope, - &command_scope, - path, - options.as_ref().and_then(|o| o.base_dir), - )?; - std::fs::read_to_string(&resolved_path) - .map_err(|e| { - format!( - "failed to read file as text at path: {} with error: {e}", - resolved_path.display() - ) - }) - .map_err(Into::into) +) -> CommandResult { + read_file(webview, global_scope, command_scope, path, options).await } #[tauri::command] pub fn read_text_file_lines( - app: AppHandle, + webview: Webview, global_scope: GlobalScope, command_scope: CommandScope, - path: SafePathBuf, + path: SafeFilePath, options: Option, ) -> CommandResult { - use std::io::BufRead; - let resolved_path = resolve_path( - &app, + &webview, &global_scope, &command_scope, path, @@ -404,28 +402,38 @@ pub fn read_text_file_lines( ) })?; - let lines = BufReader::new(file).lines(); - let rid = app.resources_table().add(StdLinesResource::new(lines)); + let lines = BufReader::new(file); + let rid = webview.resources_table().add(StdLinesResource::new(lines)); Ok(rid) } #[tauri::command] -pub fn read_text_file_lines_next( - app: AppHandle, +pub async fn read_text_file_lines_next( + webview: Webview, rid: ResourceId, -) -> CommandResult<(Option, bool)> { - let mut resource_table = app.resources_table(); +) -> CommandResult { + let mut resource_table = webview.resources_table(); let lines = resource_table.get::(rid)?; - let ret = StdLinesResource::with_lock(&lines, |lines| { - lines.next().map(|a| (a.ok(), false)).unwrap_or_else(|| { - let _ = resource_table.close(rid); - (None, true) - }) + let ret = StdLinesResource::with_lock(&lines, |lines| -> CommandResult> { + // This is an optimization to include wether we finished iteration or not (1 or 0) + // at the end of returned vector so we can use `tauri::ipc::Response` + // and avoid serialization overhead of separate values. + match lines.next() { + Some(Ok(mut bytes)) => { + bytes.push(false as u8); + Ok(bytes) + } + Some(Err(_)) => Ok(vec![false as u8]), + None => { + resource_table.close(rid)?; + Ok(vec![true as u8]) + } + } }); - Ok(ret) + ret.map(tauri::ipc::Response::new) } #[derive(Debug, Clone, Deserialize)] @@ -437,14 +445,14 @@ pub struct RemoveOptions { #[tauri::command] pub fn remove( - app: AppHandle, + webview: Webview, global_scope: GlobalScope, command_scope: CommandScope, - path: SafePathBuf, + path: SafeFilePath, options: Option, ) -> CommandResult<()> { let resolved_path = resolve_path( - &app, + &webview, &global_scope, &command_scope, path, @@ -505,22 +513,22 @@ pub struct RenameOptions { #[tauri::command] pub fn rename( - app: AppHandle, + webview: Webview, global_scope: GlobalScope, command_scope: CommandScope, - old_path: SafePathBuf, - new_path: SafePathBuf, + old_path: SafeFilePath, + new_path: SafeFilePath, options: Option, ) -> CommandResult<()> { let resolved_old_path = resolve_path( - &app, + &webview, &global_scope, &command_scope, old_path, options.as_ref().and_then(|o| o.old_path_base_dir), )?; let resolved_new_path = resolve_path( - &app, + &webview, &global_scope, &command_scope, new_path, @@ -546,14 +554,14 @@ pub enum SeekMode { } #[tauri::command] -pub fn seek( - app: AppHandle, +pub async fn seek( + webview: Webview, rid: ResourceId, offset: i64, whence: SeekMode, ) -> CommandResult { use std::io::{Seek, SeekFrom}; - let file = app.resources_table().get::(rid)?; + let file = webview.resources_table().get::(rid)?; StdFileResource::with_lock(&file, |mut file| { file.seek(match whence { SeekMode::Start => SeekFrom::Start(offset as u64), @@ -565,73 +573,150 @@ pub fn seek( .map_err(Into::into) } -#[tauri::command] -pub fn stat( - app: AppHandle, - global_scope: GlobalScope, - command_scope: CommandScope, - path: SafePathBuf, +#[cfg(target_os = "android")] +fn get_metadata std::io::Result>( + metadata_fn: F, + webview: &Webview, + global_scope: &GlobalScope, + command_scope: &CommandScope, + path: SafeFilePath, options: Option, -) -> CommandResult { +) -> CommandResult { + match path { + SafeFilePath::Url(url) => { + let (file, path) = resolve_file( + webview, + global_scope, + command_scope, + SafeFilePath::Url(url), + OpenOptions { + base: BaseOptions { base_dir: None }, + options: crate::OpenOptions { + read: true, + ..Default::default() + }, + }, + )?; + file.metadata().map_err(|e| { + format!( + "failed to get metadata of path: {} with error: {e}", + path.display() + ) + .into() + }) + } + SafeFilePath::Path(p) => get_fs_metadata( + metadata_fn, + webview, + global_scope, + command_scope, + SafeFilePath::Path(p), + options, + ), + } +} + +#[cfg(not(target_os = "android"))] +fn get_metadata std::io::Result>( + metadata_fn: F, + webview: &Webview, + global_scope: &GlobalScope, + command_scope: &CommandScope, + path: SafeFilePath, + options: Option, +) -> CommandResult { + get_fs_metadata( + metadata_fn, + webview, + global_scope, + command_scope, + path, + options, + ) +} + +fn get_fs_metadata std::io::Result>( + metadata_fn: F, + webview: &Webview, + global_scope: &GlobalScope, + command_scope: &CommandScope, + path: SafeFilePath, + options: Option, +) -> CommandResult { let resolved_path = resolve_path( - &app, - &global_scope, - &command_scope, + webview, + global_scope, + command_scope, path, options.as_ref().and_then(|o| o.base_dir), )?; - let metadata = std::fs::metadata(&resolved_path).map_err(|e| { + let metadata = metadata_fn(&resolved_path).map_err(|e| { format!( "failed to get metadata of path: {} with error: {e}", resolved_path.display() ) })?; + Ok(metadata) +} + +#[tauri::command] +pub fn stat( + webview: Webview, + global_scope: GlobalScope, + command_scope: CommandScope, + path: SafeFilePath, + options: Option, +) -> CommandResult { + let metadata = get_metadata( + |p| std::fs::metadata(p), + &webview, + &global_scope, + &command_scope, + path, + options, + )?; + Ok(get_stat(metadata)) } #[tauri::command] pub fn lstat( - app: AppHandle, + webview: Webview, global_scope: GlobalScope, command_scope: CommandScope, - path: SafePathBuf, + path: SafeFilePath, options: Option, ) -> CommandResult { - let resolved_path = resolve_path( - &app, + let metadata = get_metadata( + |p| std::fs::symlink_metadata(p), + &webview, &global_scope, &command_scope, path, - options.as_ref().and_then(|o| o.base_dir), + options, )?; - let metadata = std::fs::symlink_metadata(&resolved_path).map_err(|e| { - format!( - "failed to get metadata of path: {} with error: {e}", - resolved_path.display() - ) - })?; Ok(get_stat(metadata)) } #[tauri::command] -pub fn fstat(app: AppHandle, rid: ResourceId) -> CommandResult { - let file = app.resources_table().get::(rid)?; +pub fn fstat(webview: Webview, rid: ResourceId) -> CommandResult { + let file = webview.resources_table().get::(rid)?; let metadata = StdFileResource::with_lock(&file, |file| file.metadata()) .map_err(|e| format!("failed to get metadata of file with error: {e}"))?; Ok(get_stat(metadata)) } #[tauri::command] -pub fn truncate( - app: AppHandle, +pub async fn truncate( + webview: Webview, global_scope: GlobalScope, command_scope: CommandScope, - path: SafePathBuf, + path: SafeFilePath, len: Option, options: Option, ) -> CommandResult<()> { let resolved_path = resolve_path( - &app, + &webview, &global_scope, &command_scope, path, @@ -657,24 +742,24 @@ pub fn truncate( } #[tauri::command] -pub fn ftruncate( - app: AppHandle, +pub async fn ftruncate( + webview: Webview, rid: ResourceId, len: Option, ) -> CommandResult<()> { - let file = app.resources_table().get::(rid)?; + let file = webview.resources_table().get::(rid)?; StdFileResource::with_lock(&file, |file| file.set_len(len.unwrap_or(0))) .map_err(|e| format!("failed to truncate file with error: {e}")) .map_err(Into::into) } #[tauri::command] -pub fn write( - app: AppHandle, +pub async fn write( + webview: Webview, rid: ResourceId, data: Vec, ) -> CommandResult { - let file = app.resources_table().get::(rid)?; + let file = webview.resources_table().get::(rid)?; StdFileResource::with_lock(&file, |mut file| file.write(&data)) .map_err(|e| format!("failed to write bytes to file with error: {e}")) .map_err(Into::into) @@ -699,166 +784,314 @@ fn default_create_value() -> bool { true } -fn write_file_inner( - app: AppHandle, - global_scope: &GlobalScope, - command_scope: &CommandScope, - path: SafePathBuf, - data: &[u8], - options: Option, +#[tauri::command] +pub async fn write_file( + webview: Webview, + global_scope: GlobalScope, + command_scope: CommandScope, + request: tauri::ipc::Request<'_>, ) -> CommandResult<()> { - let resolved_path = resolve_path( - &app, - global_scope, - command_scope, - path, - options.as_ref().and_then(|o| o.base.base_dir), - )?; - - let mut opts = std::fs::OpenOptions::new(); - // defaults - opts.read(false).write(true).truncate(true).create(true); + let data = match request.body() { + tauri::ipc::InvokeBody::Raw(data) => Cow::Borrowed(data), + tauri::ipc::InvokeBody::Json(serde_json::Value::Array(data)) => Cow::Owned( + data.iter() + .flat_map(|v| v.as_number().and_then(|v| v.as_u64().map(|v| v as u8))) + .collect(), + ), + _ => return Err(anyhow::anyhow!("unexpected invoke body").into()), + }; - if let Some(options) = options { - #[cfg(unix)] - { - use std::os::unix::fs::OpenOptionsExt; - if let Some(mode) = options.mode { - opts.mode(mode); + let path = request + .headers() + .get("path") + .ok_or_else(|| anyhow::anyhow!("missing file path").into()) + .and_then(|p| { + percent_encoding::percent_decode(p.as_ref()) + .decode_utf8() + .map_err(|_| anyhow::anyhow!("path is not a valid UTF-8").into()) + }) + .and_then(|p| SafeFilePath::from_str(&p).map_err(CommandError::from))?; + let options: Option = request + .headers() + .get("options") + .and_then(|p| p.to_str().ok()) + .and_then(|opts| serde_json::from_str(opts).ok()); + + let (mut file, path) = resolve_file( + &webview, + &global_scope, + &command_scope, + path, + if let Some(opts) = options { + OpenOptions { + base: opts.base, + options: crate::OpenOptions { + read: false, + write: true, + create: opts.create, + truncate: !opts.append, + append: opts.append, + create_new: opts.create_new, + mode: opts.mode, + custom_flags: None, + }, } - } - - opts.create(options.create) - .append(options.append) - .truncate(!options.append) - .create_new(options.create_new); - } - - let mut file = opts.open(&resolved_path).map_err(|e| { - format!( - "failed to open file at path: {} with error: {e}", - resolved_path.display() - ) - })?; + } else { + OpenOptions { + base: BaseOptions { base_dir: None }, + options: crate::OpenOptions { + read: false, + write: true, + truncate: true, + create: true, + create_new: false, + append: false, + mode: None, + custom_flags: None, + }, + } + }, + )?; - file.write_all(data) + file.write_all(&data) .map_err(|e| { format!( "failed to write bytes to file at path: {} with error: {e}", - resolved_path.display() + path.display() ) }) .map_err(Into::into) } +// TODO, remove in v3, rely on `write_file` command instead #[tauri::command] -pub fn write_file( - app: AppHandle, +pub async fn write_text_file( + webview: Webview, global_scope: GlobalScope, command_scope: CommandScope, - path: SafePathBuf, - data: Vec, - options: Option, + request: tauri::ipc::Request<'_>, ) -> CommandResult<()> { - write_file_inner(app, &global_scope, &command_scope, path, &data, options) + write_file(webview, global_scope, command_scope, request).await } #[tauri::command] -pub fn write_text_file( - app: AppHandle, +pub fn exists( + webview: Webview, global_scope: GlobalScope, command_scope: CommandScope, - path: SafePathBuf, - data: String, - options: Option, -) -> CommandResult<()> { - write_file_inner( - app, + path: SafeFilePath, + options: Option, +) -> CommandResult { + let resolved_path = resolve_path( + &webview, &global_scope, &command_scope, path, - data.as_bytes(), - options, - ) + options.as_ref().and_then(|o| o.base_dir), + )?; + Ok(resolved_path.exists()) } #[tauri::command] -pub fn exists( - app: AppHandle, +pub async fn size( + webview: Webview, global_scope: GlobalScope, command_scope: CommandScope, - path: SafePathBuf, + path: SafeFilePath, options: Option, -) -> CommandResult { +) -> CommandResult { let resolved_path = resolve_path( - &app, + &webview, &global_scope, &command_scope, path, options.as_ref().and_then(|o| o.base_dir), )?; - Ok(resolved_path.exists()) + + let metadata = resolved_path.metadata()?; + + if metadata.is_file() { + Ok(metadata.len()) + } else { + let size = get_dir_size(&resolved_path).map_err(|e| { + format!( + "failed to get size at path: {} with error: {e}", + resolved_path.display() + ) + })?; + + Ok(size) + } +} + +fn get_dir_size(path: &PathBuf) -> CommandResult { + let mut size = 0; + + for entry in std::fs::read_dir(path)? { + let entry = entry?; + let metadata = entry.metadata()?; + + if metadata.is_file() { + size += metadata.len(); + } else if metadata.is_dir() { + size += get_dir_size(&entry.path())?; + } + } + + Ok(size) +} + +#[cfg(not(target_os = "android"))] +pub fn resolve_file( + webview: &Webview, + global_scope: &GlobalScope, + command_scope: &CommandScope, + path: SafeFilePath, + open_options: OpenOptions, +) -> CommandResult<(File, PathBuf)> { + resolve_file_in_fs(webview, global_scope, command_scope, path, open_options) +} + +fn resolve_file_in_fs( + webview: &Webview, + global_scope: &GlobalScope, + command_scope: &CommandScope, + path: SafeFilePath, + open_options: OpenOptions, +) -> CommandResult<(File, PathBuf)> { + let path = resolve_path( + webview, + global_scope, + command_scope, + path, + open_options.base.base_dir, + )?; + + let file = std::fs::OpenOptions::from(open_options.options) + .open(&path) + .map_err(|e| { + format!( + "failed to open file at path: {} with error: {e}", + path.display() + ) + })?; + Ok((file, path)) +} + +#[cfg(target_os = "android")] +pub fn resolve_file( + webview: &Webview, + global_scope: &GlobalScope, + command_scope: &CommandScope, + path: SafeFilePath, + open_options: OpenOptions, +) -> CommandResult<(File, PathBuf)> { + use crate::FsExt; + + match path { + SafeFilePath::Url(url) => { + let path = url.as_str().into(); + let file = webview + .fs() + .open(SafeFilePath::Url(url), open_options.options)?; + Ok((file, path)) + } + SafeFilePath::Path(path) => resolve_file_in_fs( + webview, + global_scope, + command_scope, + SafeFilePath::Path(path), + open_options, + ), + } } pub fn resolve_path( - app: &AppHandle, + webview: &Webview, global_scope: &GlobalScope, command_scope: &CommandScope, - path: SafePathBuf, + path: SafeFilePath, base_dir: Option, ) -> CommandResult { - let path = file_url_to_safe_pathbuf(path)?; + let path = path.into_path()?; let path = if let Some(base_dir) = base_dir { - app.path() - .resolve(&path, base_dir) - .map_err(Error::CannotResolvePath)? + webview.path().resolve(&path, base_dir)? } else { - path.as_ref().to_path_buf() + path }; + let fs_scope = webview.state::(); + let scope = tauri::scope::fs::Scope::new( - app, + webview, &FsScope::Scope { - allow: app - .fs_scope() - .allowed - .lock() - .unwrap() - .clone() - .into_iter() - .chain(global_scope.allows().iter().map(|e| e.path.clone())) - .chain(command_scope.allows().iter().map(|e| e.path.clone())) + allow: global_scope + .allows() + .iter() + .filter_map(|e| e.path.clone()) + .chain(command_scope.allows().iter().filter_map(|e| e.path.clone())) .collect(), - deny: app - .fs_scope() - .denied - .lock() - .unwrap() - .clone() - .into_iter() - .chain(global_scope.denies().iter().map(|e| e.path.clone())) - .chain(command_scope.denies().iter().map(|e| e.path.clone())) + deny: global_scope + .denies() + .iter() + .filter_map(|e| e.path.clone()) + .chain(command_scope.denies().iter().filter_map(|e| e.path.clone())) .collect(), - require_literal_leading_dot: None, + require_literal_leading_dot: fs_scope.require_literal_leading_dot, }, )?; - if scope.is_allowed(&path) { + let require_literal_leading_dot = fs_scope.require_literal_leading_dot.unwrap_or(cfg!(unix)); + + if is_forbidden(&fs_scope.scope, &path, require_literal_leading_dot) + || is_forbidden(&scope, &path, require_literal_leading_dot) + { + return Err(CommandError::Plugin(Error::PathForbidden(path))); + } + + if fs_scope.scope.is_allowed(&path) || scope.is_allowed(&path) { Ok(path) } else { Err(CommandError::Plugin(Error::PathForbidden(path))) } } -#[inline] -fn file_url_to_safe_pathbuf(path: SafePathBuf) -> CommandResult { - if path.as_ref().starts_with("file:") { - let url = url::Url::parse(&path.display().to_string())? - .to_file_path() - .map_err(|_| "failed to get path from `file:` url")?; - SafePathBuf::new(url).map_err(Into::into) +fn is_forbidden>( + scope: &tauri::fs::Scope, + path: P, + require_literal_leading_dot: bool, +) -> bool { + let path = path.as_ref(); + let path = if path.is_symlink() { + match std::fs::read_link(path) { + Ok(p) => p, + Err(_) => return false, + } } else { - Ok(path) + path.to_path_buf() + }; + let path = if !path.exists() { + crate::Result::Ok(path) + } else { + std::fs::canonicalize(path).map_err(Into::into) + }; + + if let Ok(path) = path { + let path: PathBuf = path.components().collect(); + scope.forbidden_patterns().iter().any(|p| { + p.matches_path_with( + &path, + glob::MatchOptions { + // this is needed so `/dir/*` doesn't match files within subdirectories such as `/dir/subdir/file.txt` + // see: + require_literal_separator: true, + require_literal_leading_dot, + ..Default::default() + }, + ) + }) + } else { + false } } @@ -877,14 +1110,38 @@ impl StdFileResource { impl Resource for StdFileResource {} -struct StdLinesResource(Mutex>>); +/// Same as [std::io::Lines] but with bytes +struct LinesBytes(T); + +impl Iterator for LinesBytes { + type Item = std::io::Result>; + + fn next(&mut self) -> Option>> { + let mut buf = Vec::new(); + match self.0.read_until(b'\n', &mut buf) { + Ok(0) => None, + Ok(_n) => { + if buf.last() == Some(&b'\n') { + buf.pop(); + if buf.last() == Some(&b'\r') { + buf.pop(); + } + } + Some(Ok(buf)) + } + Err(e) => Some(Err(e)), + } + } +} + +struct StdLinesResource(Mutex>>); impl StdLinesResource { - fn new(lines: Lines>) -> Self { - Self(Mutex::new(lines)) + fn new(lines: BufReader) -> Self { + Self(Mutex::new(LinesBytes(lines))) } - fn with_lock>) -> R>(&self, mut f: F) -> R { + fn with_lock>) -> R>(&self, mut f: F) -> R { let mut lines = self.0.lock().unwrap(); f(&mut lines) } @@ -982,3 +1239,44 @@ fn get_stat(metadata: std::fs::Metadata) -> FileInfo { blocks: usm!(blocks), } } + +#[cfg(test)] +mod test { + use std::io::{BufRead, BufReader}; + + use super::LinesBytes; + + #[test] + fn safe_file_path_parse() { + use super::SafeFilePath; + + assert!(matches!( + serde_json::from_str::("\"C:/Users\""), + Ok(SafeFilePath::Path(_)) + )); + assert!(matches!( + serde_json::from_str::("\"file:///C:/Users\""), + Ok(SafeFilePath::Url(_)) + )); + } + + #[test] + fn test_lines_bytes() { + let base = String::from("line 1\nline2\nline 3\nline 4"); + let bytes = base.as_bytes(); + + let string1 = base.lines().collect::(); + let string2 = BufReader::new(bytes) + .lines() + .map_while(Result::ok) + .collect::(); + let string3 = LinesBytes(BufReader::new(bytes)) + .flatten() + .flat_map(String::from_utf8) + .collect::(); + + assert_eq!(string1, string2); + assert_eq!(string1, string3); + assert_eq!(string2, string3); + } +} diff --git a/plugins/fs/src/config.rs b/plugins/fs/src/config.rs index d8a19714..db3bae45 100644 --- a/plugins/fs/src/config.rs +++ b/plugins/fs/src/config.rs @@ -5,6 +5,7 @@ use serde::Deserialize; #[derive(Deserialize)] +#[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct Config { /// Whether or not paths that contain components that start with a `.` /// will require that `.` appears literally in the pattern; `*`, `?`, `**`, diff --git a/plugins/fs/src/desktop.rs b/plugins/fs/src/desktop.rs new file mode 100644 index 00000000..477c0537 --- /dev/null +++ b/plugins/fs/src/desktop.rs @@ -0,0 +1,35 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use std::path::PathBuf; + +use tauri::{AppHandle, Runtime}; + +use crate::{FilePath, OpenOptions}; + +pub struct Fs(pub(crate) AppHandle); + +fn path_or_err>(p: P) -> std::io::Result { + match p.into() { + FilePath::Path(p) => Ok(p), + FilePath::Url(u) if u.scheme() == "file" => u + .to_file_path() + .map_err(|_| std::io::Error::new(std::io::ErrorKind::InvalidInput, "invalid file URL")), + FilePath::Url(_) => Err(std::io::Error::new( + std::io::ErrorKind::InvalidInput, + "cannot use a URL to load files on desktop and iOS", + )), + } +} + +impl Fs { + pub fn open>( + &self, + path: P, + opts: OpenOptions, + ) -> std::io::Result { + let path = path_or_err(path)?; + std::fs::OpenOptions::from(opts).open(path) + } +} diff --git a/plugins/fs/src/error.rs b/plugins/fs/src/error.rs index 212714ef..0c98e83f 100644 --- a/plugins/fs/src/error.rs +++ b/plugins/fs/src/error.rs @@ -7,6 +7,7 @@ use std::path::PathBuf; use serde::{Serialize, Serializer}; #[derive(Debug, thiserror::Error)] +#[non_exhaustive] pub enum Error { #[error(transparent)] Json(#[from] serde_json::Error), @@ -16,8 +17,6 @@ pub enum Error { Io(#[from] std::io::Error), #[error("forbidden path: {0}")] PathForbidden(PathBuf), - #[error("failed to resolve path: {0}")] - CannotResolvePath(tauri::path::Error), /// Invalid glob pattern. #[error("invalid glob pattern: {0}")] GlobPattern(#[from] glob::PatternError), @@ -25,6 +24,13 @@ pub enum Error { #[cfg(feature = "watch")] #[error(transparent)] Watch(#[from] notify::Error), + #[cfg(target_os = "android")] + #[error(transparent)] + PluginInvoke(#[from] tauri::plugin::mobile::PluginInvokeError), + #[error("URL is not a valid path")] + InvalidPathUrl, + #[error("Unsafe PathBuf: {0}")] + UnsafePathBuf(&'static str), } impl Serialize for Error { diff --git a/plugins/fs/src/file_path.rs b/plugins/fs/src/file_path.rs new file mode 100644 index 00000000..6316a248 --- /dev/null +++ b/plugins/fs/src/file_path.rs @@ -0,0 +1,308 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use std::{ + convert::Infallible, + path::{Path, PathBuf}, + str::FromStr, +}; + +use serde::Serialize; +use tauri::path::SafePathBuf; + +use crate::{Error, Result}; + +/// Represents either a filesystem path or a URI pointing to a file +/// such as `file://` URIs or Android `content://` URIs. +#[derive(Debug, Serialize, Clone)] +#[serde(untagged)] +pub enum FilePath { + /// `file://` URIs or Android `content://` URIs. + Url(url::Url), + /// Regular [`PathBuf`] + Path(PathBuf), +} + +/// Represents either a safe filesystem path or a URI pointing to a file +/// such as `file://` URIs or Android `content://` URIs. +#[derive(Debug, Clone, Serialize)] +pub enum SafeFilePath { + /// `file://` URIs or Android `content://` URIs. + Url(url::Url), + /// Safe [`PathBuf`], see [`SafePathBuf``]. + Path(SafePathBuf), +} + +impl FilePath { + /// Get a reference to the contained [`Path`] if the variant is [`FilePath::Path`]. + /// + /// Use [`FilePath::into_path`] to try to convert the [`FilePath::Url`] variant as well. + #[inline] + pub fn as_path(&self) -> Option<&Path> { + match self { + Self::Url(_) => None, + Self::Path(p) => Some(p), + } + } + + /// Try to convert into [`PathBuf`] if possible. + /// + /// This calls [`Url::to_file_path`](url::Url::to_file_path) if the variant is [`FilePath::Url`], + /// otherwise returns the contained [PathBuf] as is. + #[inline] + pub fn into_path(self) -> Result { + match self { + Self::Url(url) => url.to_file_path().map_err(|_| Error::InvalidPathUrl), + Self::Path(p) => Ok(p), + } + } + + /// Takes the contained [`PathBuf`] if the variant is [`FilePath::Path`], + /// and when possible, converts Windows UNC paths to regular paths. + #[inline] + pub fn simplified(self) -> Self { + match self { + Self::Url(url) => Self::Url(url), + Self::Path(p) => Self::Path(dunce::simplified(&p).to_path_buf()), + } + } +} + +impl SafeFilePath { + /// Get a reference to the contained [`Path`] if the variant is [`SafeFilePath::Path`]. + /// + /// Use [`SafeFilePath::into_path`] to try to convert the [`SafeFilePath::Url`] variant as well. + #[inline] + pub fn as_path(&self) -> Option<&Path> { + match self { + Self::Url(_) => None, + Self::Path(p) => Some(p.as_ref()), + } + } + + /// Try to convert into [`PathBuf`] if possible. + /// + /// This calls [`Url::to_file_path`](url::Url::to_file_path) if the variant is [`SafeFilePath::Url`], + /// otherwise returns the contained [PathBuf] as is. + #[inline] + pub fn into_path(self) -> Result { + match self { + Self::Url(url) => url.to_file_path().map_err(|_| Error::InvalidPathUrl), + Self::Path(p) => Ok(p.as_ref().to_owned()), + } + } + + /// Takes the contained [`PathBuf`] if the variant is [`SafeFilePath::Path`], + /// and when possible, converts Windows UNC paths to regular paths. + #[inline] + pub fn simplified(self) -> Self { + match self { + Self::Url(url) => Self::Url(url), + Self::Path(p) => { + // Safe to unwrap since it was a safe file path already + Self::Path(SafePathBuf::new(dunce::simplified(p.as_ref()).to_path_buf()).unwrap()) + } + } + } +} + +impl std::fmt::Display for FilePath { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Url(u) => u.fmt(f), + Self::Path(p) => p.display().fmt(f), + } + } +} + +impl std::fmt::Display for SafeFilePath { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Url(u) => u.fmt(f), + Self::Path(p) => p.display().fmt(f), + } + } +} + +impl<'de> serde::Deserialize<'de> for FilePath { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct FilePathVisitor; + + impl serde::de::Visitor<'_> for FilePathVisitor { + type Value = FilePath; + + fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { + formatter.write_str("a string representing an file URL or a path") + } + + fn visit_str(self, s: &str) -> std::result::Result + where + E: serde::de::Error, + { + FilePath::from_str(s).map_err(|e| { + serde::de::Error::invalid_value( + serde::de::Unexpected::Str(s), + &e.to_string().as_str(), + ) + }) + } + } + + deserializer.deserialize_str(FilePathVisitor) + } +} + +impl<'de> serde::Deserialize<'de> for SafeFilePath { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct SafeFilePathVisitor; + + impl serde::de::Visitor<'_> for SafeFilePathVisitor { + type Value = SafeFilePath; + + fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { + formatter.write_str("a string representing an file URL or a path") + } + + fn visit_str(self, s: &str) -> std::result::Result + where + E: serde::de::Error, + { + SafeFilePath::from_str(s).map_err(|e| { + serde::de::Error::invalid_value( + serde::de::Unexpected::Str(s), + &e.to_string().as_str(), + ) + }) + } + } + + deserializer.deserialize_str(SafeFilePathVisitor) + } +} + +impl FromStr for FilePath { + type Err = Infallible; + fn from_str(s: &str) -> std::result::Result { + if let Ok(url) = url::Url::from_str(s) { + if url.scheme().len() != 1 { + return Ok(Self::Url(url)); + } + } + Ok(Self::Path(PathBuf::from(s))) + } +} + +impl FromStr for SafeFilePath { + type Err = Error; + fn from_str(s: &str) -> Result { + if let Ok(url) = url::Url::from_str(s) { + if url.scheme().len() != 1 { + return Ok(Self::Url(url)); + } + } + + SafePathBuf::new(s.into()) + .map(SafeFilePath::Path) + .map_err(Error::UnsafePathBuf) + } +} + +impl From for FilePath { + fn from(value: PathBuf) -> Self { + Self::Path(value) + } +} + +impl TryFrom for SafeFilePath { + type Error = Error; + fn try_from(value: PathBuf) -> Result { + SafePathBuf::new(value) + .map(SafeFilePath::Path) + .map_err(Error::UnsafePathBuf) + } +} + +impl From<&Path> for FilePath { + fn from(value: &Path) -> Self { + Self::Path(value.to_owned()) + } +} + +impl TryFrom<&Path> for SafeFilePath { + type Error = Error; + fn try_from(value: &Path) -> Result { + SafePathBuf::new(value.to_path_buf()) + .map(SafeFilePath::Path) + .map_err(Error::UnsafePathBuf) + } +} + +impl From<&PathBuf> for FilePath { + fn from(value: &PathBuf) -> Self { + Self::Path(value.to_owned()) + } +} + +impl TryFrom<&PathBuf> for SafeFilePath { + type Error = Error; + fn try_from(value: &PathBuf) -> Result { + SafePathBuf::new(value.to_owned()) + .map(SafeFilePath::Path) + .map_err(Error::UnsafePathBuf) + } +} + +impl From for FilePath { + fn from(value: url::Url) -> Self { + Self::Url(value) + } +} + +impl From for SafeFilePath { + fn from(value: url::Url) -> Self { + Self::Url(value) + } +} + +impl TryFrom for PathBuf { + type Error = Error; + fn try_from(value: FilePath) -> Result { + value.into_path() + } +} + +impl TryFrom for PathBuf { + type Error = Error; + fn try_from(value: SafeFilePath) -> Result { + value.into_path() + } +} + +impl From for FilePath { + fn from(value: SafeFilePath) -> Self { + match value { + SafeFilePath::Url(url) => FilePath::Url(url), + SafeFilePath::Path(p) => FilePath::Path(p.as_ref().to_owned()), + } + } +} + +impl TryFrom for SafeFilePath { + type Error = Error; + + fn try_from(value: FilePath) -> Result { + match value { + FilePath::Url(url) => Ok(SafeFilePath::Url(url)), + FilePath::Path(p) => SafePathBuf::new(p) + .map(SafeFilePath::Path) + .map_err(Error::UnsafePathBuf), + } + } +} diff --git a/plugins/fs/src/lib.rs b/plugins/fs/src/lib.rs index 2c8843ff..bdc6b170 100644 --- a/plugins/fs/src/lib.rs +++ b/plugins/fs/src/lib.rs @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -//! [![](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/fs/banner.png)](https://github.com/tauri-apps/plugins-workspace/tree/v2/plugins/fs) -//! //! Access the file system. #![doc( @@ -11,70 +9,394 @@ html_favicon_url = "https://github.com/tauri-apps/tauri/raw/dev/app-icon.png" )] -use std::path::PathBuf; +use std::io::Read; use serde::Deserialize; use tauri::{ ipc::ScopeObject, plugin::{Builder as PluginBuilder, TauriPlugin}, - utils::acl::Value, - AppHandle, FileDropEvent, Manager, RunEvent, Runtime, WindowEvent, + utils::{acl::Value, config::FsScope}, + AppHandle, DragDropEvent, Manager, RunEvent, Runtime, WindowEvent, }; mod commands; mod config; +#[cfg(not(target_os = "android"))] +mod desktop; mod error; +mod file_path; +#[cfg(target_os = "android")] +mod mobile; +#[cfg(target_os = "android")] +mod models; mod scope; #[cfg(feature = "watch")] mod watcher; +#[cfg(not(target_os = "android"))] +pub use desktop::Fs; +#[cfg(target_os = "android")] +pub use mobile::Fs; + pub use error::Error; -pub use scope::{Event as ScopeEvent, Scope}; + +pub use file_path::FilePath; +pub use file_path::SafeFilePath; type Result = std::result::Result; -pub trait FsExt { - fn fs_scope(&self) -> &Scope; - fn try_fs_scope(&self) -> Option<&Scope>; +#[derive(Debug, Default, Clone, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct OpenOptions { + #[serde(default = "default_true")] + read: bool, + #[serde(default)] + write: bool, + #[serde(default)] + append: bool, + #[serde(default)] + truncate: bool, + #[serde(default)] + create: bool, + #[serde(default)] + create_new: bool, + #[serde(default)] + #[allow(unused)] + mode: Option, + #[serde(default)] + #[allow(unused)] + custom_flags: Option, } -impl> FsExt for T { - fn fs_scope(&self) -> &Scope { - self.state::().inner() +fn default_true() -> bool { + true +} + +impl From for std::fs::OpenOptions { + fn from(open_options: OpenOptions) -> Self { + let mut opts = std::fs::OpenOptions::new(); + + #[cfg(unix)] + { + use std::os::unix::fs::OpenOptionsExt; + if let Some(mode) = open_options.mode { + opts.mode(mode); + } + if let Some(flags) = open_options.custom_flags { + opts.custom_flags(flags); + } + } + + opts.read(open_options.read) + .write(open_options.write) + .create(open_options.create) + .append(open_options.append) + .truncate(open_options.truncate) + .create_new(open_options.create_new); + + opts + } +} + +impl OpenOptions { + /// Creates a blank new set of options ready for configuration. + /// + /// All options are initially set to `false`. + /// + /// # Examples + /// + /// ```no_run + /// use tauri_plugin_fs::OpenOptions; + /// + /// let mut options = OpenOptions::new(); + /// let file = options.read(true).open("foo.txt"); + /// ``` + #[must_use] + pub fn new() -> Self { + Self::default() + } + + /// Sets the option for read access. + /// + /// This option, when true, will indicate that the file should be + /// `read`-able if opened. + /// + /// # Examples + /// + /// ```no_run + /// use tauri_plugin_fs::OpenOptions; + /// + /// let file = OpenOptions::new().read(true).open("foo.txt"); + /// ``` + pub fn read(&mut self, read: bool) -> &mut Self { + self.read = read; + self + } + + /// Sets the option for write access. + /// + /// This option, when true, will indicate that the file should be + /// `write`-able if opened. + /// + /// If the file already exists, any write calls on it will overwrite its + /// contents, without truncating it. + /// + /// # Examples + /// + /// ```no_run + /// use tauri_plugin_fs::OpenOptions; + /// + /// let file = OpenOptions::new().write(true).open("foo.txt"); + /// ``` + pub fn write(&mut self, write: bool) -> &mut Self { + self.write = write; + self + } + + /// Sets the option for the append mode. + /// + /// This option, when true, means that writes will append to a file instead + /// of overwriting previous contents. + /// Note that setting `.write(true).append(true)` has the same effect as + /// setting only `.append(true)`. + /// + /// Append mode guarantees that writes will be positioned at the current end of file, + /// even when there are other processes or threads appending to the same file. This is + /// unlike [seek]\([SeekFrom]::[End]\(0)) followed by `write()`, which + /// has a race between seeking and writing during which another writer can write, with + /// our `write()` overwriting their data. + /// + /// Keep in mind that this does not necessarily guarantee that data appended by + /// different processes or threads does not interleave. The amount of data accepted a + /// single `write()` call depends on the operating system and file system. A + /// successful `write()` is allowed to write only part of the given data, so even if + /// you're careful to provide the whole message in a single call to `write()`, there + /// is no guarantee that it will be written out in full. If you rely on the filesystem + /// accepting the message in a single write, make sure that all data that belongs + /// together is written in one operation. This can be done by concatenating strings + /// before passing them to [`write()`]. + /// + /// If a file is opened with both read and append access, beware that after + /// opening, and after every write, the position for reading may be set at the + /// end of the file. So, before writing, save the current position (using + /// [Seek]::[stream_position]), and restore it before the next read. + /// + /// ## Note + /// + /// This function doesn't create the file if it doesn't exist. Use the + /// [`OpenOptions::create`] method to do so. + /// + /// [`write()`]: Write::write "io::Write::write" + /// [`flush()`]: Write::flush "io::Write::flush" + /// [stream_position]: Seek::stream_position "io::Seek::stream_position" + /// [seek]: Seek::seek "io::Seek::seek" + /// [Current]: SeekFrom::Current "io::SeekFrom::Current" + /// [End]: SeekFrom::End "io::SeekFrom::End" + /// + /// # Examples + /// + /// ```no_run + /// use tauri_plugin_fs::OpenOptions; + /// + /// let file = OpenOptions::new().append(true).open("foo.txt"); + /// ``` + pub fn append(&mut self, append: bool) -> &mut Self { + self.append = append; + self + } + + /// Sets the option for truncating a previous file. + /// + /// If a file is successfully opened with this option set it will truncate + /// the file to 0 length if it already exists. + /// + /// The file must be opened with write access for truncate to work. + /// + /// # Examples + /// + /// ```no_run + /// use tauri_plugin_fs::OpenOptions; + /// + /// let file = OpenOptions::new().write(true).truncate(true).open("foo.txt"); + /// ``` + pub fn truncate(&mut self, truncate: bool) -> &mut Self { + self.truncate = truncate; + self + } + + /// Sets the option to create a new file, or open it if it already exists. + /// + /// In order for the file to be created, [`OpenOptions::write`] or + /// [`OpenOptions::append`] access must be used. + /// + /// + /// # Examples + /// + /// ```no_run + /// use tauri_plugin_fs::OpenOptions; + /// + /// let file = OpenOptions::new().write(true).create(true).open("foo.txt"); + /// ``` + pub fn create(&mut self, create: bool) -> &mut Self { + self.create = create; + self + } + + /// Sets the option to create a new file, failing if it already exists. + /// + /// No file is allowed to exist at the target location, also no (dangling) symlink. In this + /// way, if the call succeeds, the file returned is guaranteed to be new. + /// If a file exists at the target location, creating a new file will fail with [`AlreadyExists`] + /// or another error based on the situation. See [`OpenOptions::open`] for a + /// non-exhaustive list of likely errors. + /// + /// This option is useful because it is atomic. Otherwise between checking + /// whether a file exists and creating a new one, the file may have been + /// created by another process (a TOCTOU race condition / attack). + /// + /// If `.create_new(true)` is set, [`.create()`] and [`.truncate()`] are + /// ignored. + /// + /// The file must be opened with write or append access in order to create + /// a new file. + /// + /// [`.create()`]: OpenOptions::create + /// [`.truncate()`]: OpenOptions::truncate + /// [`AlreadyExists`]: io::ErrorKind::AlreadyExists + /// + /// # Examples + /// + /// ```no_run + /// use tauri_plugin_fs::OpenOptions; + /// + /// let file = OpenOptions::new().write(true) + /// .create_new(true) + /// .open("foo.txt"); + /// ``` + pub fn create_new(&mut self, create_new: bool) -> &mut Self { + self.create_new = create_new; + self + } +} + +#[cfg(unix)] +impl std::os::unix::fs::OpenOptionsExt for OpenOptions { + fn custom_flags(&mut self, flags: i32) -> &mut Self { + self.custom_flags.replace(flags); + self } - fn try_fs_scope(&self) -> Option<&Scope> { - self.try_state::().map(|s| s.inner()) + fn mode(&mut self, mode: u32) -> &mut Self { + self.mode.replace(mode); + self } } +impl OpenOptions { + #[cfg(target_os = "android")] + fn android_mode(&self) -> String { + let mut mode = String::new(); + + if self.read { + mode.push('r'); + } + if self.write { + mode.push('w'); + } + if self.truncate { + mode.push('t'); + } + if self.append { + mode.push('a'); + } + + mode + } +} + +impl Fs { + pub fn read_to_string>(&self, path: P) -> std::io::Result { + let mut s = String::new(); + self.open( + path, + OpenOptions { + read: true, + ..Default::default() + }, + )? + .read_to_string(&mut s)?; + Ok(s) + } + + pub fn read>(&self, path: P) -> std::io::Result> { + let mut buf = Vec::new(); + self.open( + path, + OpenOptions { + read: true, + ..Default::default() + }, + )? + .read_to_end(&mut buf)?; + Ok(buf) + } +} + +// implement ScopeObject here instead of in the scope module because it is also used on the build script +// and we don't want to add tauri as a build dependency impl ScopeObject for scope::Entry { type Error = Error; fn deserialize( app: &AppHandle, raw: Value, ) -> std::result::Result { - #[derive(Deserialize)] - struct EntryRaw { - path: PathBuf, + let path = serde_json::from_value(raw.into()).map(|raw| match raw { + scope::EntryRaw::Value(path) => path, + scope::EntryRaw::Object { path } => path, + })?; + + match app.path().parse(path) { + Ok(path) => Ok(Self { path: Some(path) }), + #[cfg(not(target_os = "android"))] + Err(tauri::Error::UnknownPath) => Ok(Self { path: None }), + Err(err) => Err(err.into()), } + } +} - let entry = serde_json::from_value::(raw.into())?; +pub(crate) struct Scope { + pub(crate) scope: tauri::fs::Scope, + pub(crate) require_literal_leading_dot: Option, +} - Ok(Self { - path: app.path().parse(entry.path)?, - }) +pub trait FsExt { + fn fs_scope(&self) -> tauri::fs::Scope; + fn try_fs_scope(&self) -> Option; + + /// Cross platform file system APIs that also support manipulating Android files. + fn fs(&self) -> &Fs; +} + +impl> FsExt for T { + fn fs_scope(&self) -> tauri::fs::Scope { + self.state::().scope.clone() + } + + fn try_fs_scope(&self) -> Option { + self.try_state::().map(|s| s.scope.clone()) + } + + fn fs(&self) -> &Fs { + self.state::>().inner() } } pub fn init() -> TauriPlugin> { PluginBuilder::>::new("fs") - .js_init_script(include_str!("api-iife.js").to_string()) .invoke_handler(tauri::generate_handler![ commands::create, commands::open, commands::copy_file, - commands::close, commands::mkdir, commands::read_dir, commands::read, @@ -94,33 +416,43 @@ pub fn init() -> TauriPlugin> { commands::write_file, commands::write_text_file, commands::exists, + commands::size, #[cfg(feature = "watch")] watcher::watch, - #[cfg(feature = "watch")] - watcher::unwatch ]) .setup(|app, api| { - let mut scope = Scope::default(); - scope.require_literal_leading_dot = api - .config() - .as_ref() - .and_then(|c| c.require_literal_leading_dot); + let scope = Scope { + require_literal_leading_dot: api + .config() + .as_ref() + .and_then(|c| c.require_literal_leading_dot), + scope: tauri::fs::Scope::new(app, &FsScope::default())?, + }; + + #[cfg(target_os = "android")] + { + let fs = mobile::init(app, api)?; + app.manage(fs); + } + #[cfg(not(target_os = "android"))] + app.manage(Fs(app.clone())); + app.manage(scope); Ok(()) }) .on_event(|app, event| { if let RunEvent::WindowEvent { label: _, - event: WindowEvent::FileDrop(FileDropEvent::Dropped { paths, position: _ }), + event: WindowEvent::DragDrop(DragDropEvent::Drop { paths, position: _ }), .. } = event { let scope = app.fs_scope(); for path in paths { if path.is_file() { - scope.allow_file(path); + let _ = scope.allow_file(path); } else { - scope.allow_directory(path, true); + let _ = scope.allow_directory(path, true); } } } diff --git a/plugins/fs/src/mobile.rs b/plugins/fs/src/mobile.rs new file mode 100644 index 00000000..06422be6 --- /dev/null +++ b/plugins/fs/src/mobile.rs @@ -0,0 +1,96 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use serde::de::DeserializeOwned; +use tauri::{ + plugin::{PluginApi, PluginHandle}, + AppHandle, Runtime, +}; + +use crate::{models::*, FilePath, OpenOptions}; + +#[cfg(target_os = "android")] +const PLUGIN_IDENTIFIER: &str = "com.plugin.fs"; + +#[cfg(target_os = "ios")] +tauri::ios_plugin_binding!(init_plugin_fs); + +// initializes the Kotlin or Swift plugin classes +pub fn init( + _app: &AppHandle, + api: PluginApi, +) -> crate::Result> { + #[cfg(target_os = "android")] + let handle = api + .register_android_plugin(PLUGIN_IDENTIFIER, "FsPlugin") + .unwrap(); + #[cfg(target_os = "ios")] + let handle = api.register_ios_plugin(init_plugin_android - intent - send)?; + Ok(Fs(handle)) +} + +/// Access to the android-intent-send APIs. +pub struct Fs(PluginHandle); + +impl Fs { + pub fn open>( + &self, + path: P, + opts: OpenOptions, + ) -> std::io::Result { + match path.into() { + FilePath::Url(u) => self + .resolve_content_uri(u.to_string(), opts.android_mode()) + .map_err(|e| { + std::io::Error::new( + std::io::ErrorKind::Other, + format!("failed to open file: {e}"), + ) + }), + FilePath::Path(p) => { + // tauri::utils::platform::resources_dir() returns a PathBuf with the Android asset URI prefix + // we must resolve that file with the Android API + if p.strip_prefix(tauri::utils::platform::ANDROID_ASSET_PROTOCOL_URI_PREFIX) + .is_ok() + { + self.resolve_content_uri(p.to_string_lossy(), opts.android_mode()) + .map_err(|e| { + std::io::Error::new( + std::io::ErrorKind::Other, + format!("failed to open file: {e}"), + ) + }) + } else { + std::fs::OpenOptions::from(opts).open(p) + } + } + } + } + + #[cfg(target_os = "android")] + fn resolve_content_uri( + &self, + uri: impl Into, + mode: impl Into, + ) -> crate::Result { + #[cfg(target_os = "android")] + { + let result = self.0.run_mobile_plugin::( + "getFileDescriptor", + GetFileDescriptorPayload { + uri: uri.into(), + mode: mode.into(), + }, + )?; + if let Some(fd) = result.fd { + Ok(unsafe { + use std::os::fd::FromRawFd; + std::fs::File::from_raw_fd(fd) + }) + } else { + todo!() + } + } + } +} diff --git a/plugins/fs/src/models.rs b/plugins/fs/src/models.rs new file mode 100644 index 00000000..b9edc2cb --- /dev/null +++ b/plugins/fs/src/models.rs @@ -0,0 +1,18 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Default, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct GetFileDescriptorPayload { + pub uri: String, + pub mode: String, +} + +#[derive(Debug, Clone, Default, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct GetFileDescriptorResponse { + pub fd: Option, +} diff --git a/plugins/fs/src/scope.rs b/plugins/fs/src/scope.rs index d7040a58..7914706a 100644 --- a/plugins/fs/src/scope.rs +++ b/plugins/fs/src/scope.rs @@ -2,117 +2,18 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -use std::{ - collections::HashMap, - path::{Path, PathBuf}, - sync::{ - atomic::{AtomicU32, Ordering}, - Mutex, - }, -}; +use std::path::PathBuf; -#[derive(Debug, schemars::JsonSchema)] -pub struct Entry { - pub path: PathBuf, -} - -pub type EventId = u32; -type EventListener = Box; +use serde::Deserialize; -/// Scope change event. -#[derive(Debug, Clone)] -pub enum Event { - /// A path has been allowed. - PathAllowed(PathBuf), - /// A path has been forbidden. - PathForbidden(PathBuf), -} - -#[derive(Default)] -pub struct Scope { - pub(crate) allowed: Mutex>, - pub(crate) denied: Mutex>, - event_listeners: Mutex>, - next_event_id: AtomicU32, - pub(crate) require_literal_leading_dot: Option, +#[derive(Debug)] +pub struct Entry { + pub path: Option, } -impl Scope { - /// Extend the allowed patterns with the given directory. - /// - /// After this function has been called, the frontend will be able to use the Tauri API to read - /// the directory and all of its files. If `recursive` is `true`, subdirectories will be accessible too. - pub fn allow_directory>(&self, path: P, recursive: bool) { - let path = path.as_ref(); - - let mut allowed = self.allowed.lock().unwrap(); - allowed.push(path.to_path_buf()); - allowed.push(path.join(if recursive { "**" } else { "*" })); - - self.emit(Event::PathAllowed(path.to_path_buf())); - } - - /// Extend the allowed patterns with the given file path. - /// - /// After this function has been called, the frontend will be able to use the Tauri API to read the contents of this file. - pub fn allow_file>(&self, path: P) { - let path = path.as_ref(); - - self.allowed.lock().unwrap().push(path.to_path_buf()); - - self.emit(Event::PathAllowed(path.to_path_buf())); - } - - /// Set the given directory path to be forbidden by this scope. - /// - /// **Note:** this takes precedence over allowed paths, so its access gets denied **always**. - pub fn forbid_directory>(&self, path: P, recursive: bool) { - let path = path.as_ref(); - - let mut denied = self.denied.lock().unwrap(); - denied.push(path.to_path_buf()); - denied.push(path.join(if recursive { "**" } else { "*" })); - - self.emit(Event::PathForbidden(path.to_path_buf())); - } - - /// Set the given file path to be forbidden by this scope. - /// - /// **Note:** this takes precedence over allowed paths, so its access gets denied **always**. - pub fn forbid_file>(&self, path: P) { - let path = path.as_ref(); - - self.denied.lock().unwrap().push(path.to_path_buf()); - - self.emit(Event::PathForbidden(path.to_path_buf())); - } - - /// List of allowed paths. - pub fn allowed(&self) -> Vec { - self.allowed.lock().unwrap().clone() - } - - /// List of forbidden paths. - pub fn forbidden(&self) -> Vec { - self.denied.lock().unwrap().clone() - } - - fn next_event_id(&self) -> u32 { - self.next_event_id.fetch_add(1, Ordering::Relaxed) - } - - fn emit(&self, event: Event) { - let listeners = self.event_listeners.lock().unwrap(); - let handlers = listeners.values(); - for listener in handlers { - listener(&event); - } - } - - /// Listen to an event on this scope. - pub fn listen(&self, f: F) -> EventId { - let id = self.next_event_id(); - self.event_listeners.lock().unwrap().insert(id, Box::new(f)); - id - } +#[derive(Deserialize)] +#[serde(untagged)] +pub(crate) enum EntryRaw { + Value(PathBuf), + Object { path: PathBuf }, } diff --git a/plugins/fs/src/watcher.rs b/plugins/fs/src/watcher.rs index d83262a2..89446b88 100644 --- a/plugins/fs/src/watcher.rs +++ b/plugins/fs/src/watcher.rs @@ -2,156 +2,102 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -use notify::{Config, Event, RecommendedWatcher, RecursiveMode, Watcher}; -use notify_debouncer_full::{new_debouncer, DebounceEventResult, Debouncer, FileIdMap}; +use notify::{Config, RecommendedWatcher, RecursiveMode, Watcher}; +use notify_debouncer_full::{new_debouncer, DebouncedEvent, Debouncer, RecommendedCache}; use serde::Deserialize; use tauri::{ ipc::{Channel, CommandScope, GlobalScope}, - path::{BaseDirectory, SafePathBuf}, - AppHandle, Manager, Resource, ResourceId, Runtime, + path::BaseDirectory, + Manager, Resource, ResourceId, Runtime, Webview, }; -use std::{ - path::PathBuf, - sync::{ - mpsc::{channel, Receiver}, - Mutex, - }, - thread::spawn, - time::Duration, -}; +use std::time::Duration; use crate::{ commands::{resolve_path, CommandResult}, scope::Entry, + SafeFilePath, }; -struct InnerWatcher { - pub kind: WatcherKind, - paths: Vec, -} - -pub struct WatcherResource(Mutex); -impl WatcherResource { - fn new(kind: WatcherKind, paths: Vec) -> Self { - Self(Mutex::new(InnerWatcher { kind, paths })) - } - - fn with_lock R>(&self, mut f: F) -> R { - let mut watcher = self.0.lock().unwrap(); - f(&mut watcher) - } -} - -impl Resource for WatcherResource {} - +#[allow(unused)] enum WatcherKind { - Debouncer(Debouncer), + Debouncer(Debouncer), Watcher(RecommendedWatcher), } -fn watch_raw(on_event: Channel, rx: Receiver>) { - spawn(move || { - while let Ok(event) = rx.recv() { - if let Ok(event) = event { - // TODO: Should errors be emitted too? - let _ = on_event.send(&event); - } - } - }); -} - -fn watch_debounced(on_event: Channel, rx: Receiver) { - spawn(move || { - while let Ok(Ok(events)) = rx.recv() { - for event in events { - // TODO: Should errors be emitted too? - let _ = on_event.send(&event.event); - } - } - }); -} +impl Resource for WatcherKind {} -#[derive(Deserialize)] +#[derive(Clone, Deserialize)] #[serde(rename_all = "camelCase")] pub struct WatchOptions { - dir: Option, + base_dir: Option, + #[serde(default)] recursive: bool, delay_ms: Option, } #[tauri::command] -pub async fn watch( - app: AppHandle, - paths: Vec, +pub fn watch( + webview: Webview, + paths: Vec, options: WatchOptions, - on_event: Channel, + on_event: Channel, global_scope: GlobalScope, command_scope: CommandScope, ) -> CommandResult { - let mut resolved_paths = Vec::with_capacity(paths.capacity()); - for path in paths { - resolved_paths.push(resolve_path( - &app, - &global_scope, - &command_scope, - path, - options.dir, - )?); - } - - let mode = if options.recursive { + let resolved_paths = paths + .into_iter() + .map(|path| { + resolve_path( + &webview, + &global_scope, + &command_scope, + path, + options.base_dir, + ) + }) + .collect::>>()?; + + let recursive_mode = if options.recursive { RecursiveMode::Recursive } else { RecursiveMode::NonRecursive }; - let kind = if let Some(delay) = options.delay_ms { - let (tx, rx) = channel(); - let mut debouncer = new_debouncer(Duration::from_millis(delay), None, tx)?; + let watcher_kind = if let Some(delay) = options.delay_ms { + let mut debouncer = new_debouncer( + Duration::from_millis(delay), + None, + move |events: Result, Vec>| { + if let Ok(events) = events { + for event in events { + // TODO: Should errors be emitted too? + let _ = on_event.send(event.event); + } + } + }, + )?; for path in &resolved_paths { - debouncer.watcher().watch(path.as_ref(), mode)?; + debouncer.watch(path, recursive_mode)?; } - watch_debounced(on_event, rx); WatcherKind::Debouncer(debouncer) } else { - let (tx, rx) = channel(); - let mut watcher = RecommendedWatcher::new(tx, Config::default())?; + let mut watcher = RecommendedWatcher::new( + move |event| { + if let Ok(event) = event { + // TODO: Should errors be emitted too? + let _ = on_event.send(event); + } + }, + Config::default(), + )?; for path in &resolved_paths { - watcher.watch(path.as_ref(), mode)?; + watcher.watch(path, recursive_mode)?; } - watch_raw(on_event, rx); WatcherKind::Watcher(watcher) }; - let rid = app - .resources_table() - .add(WatcherResource::new(kind, resolved_paths)); + let rid = webview.resources_table().add(watcher_kind); Ok(rid) } - -#[tauri::command] -pub async fn unwatch(app: AppHandle, rid: ResourceId) -> CommandResult<()> { - let watcher = app.resources_table().take::(rid)?; - WatcherResource::with_lock(&watcher, |watcher| { - match &mut watcher.kind { - WatcherKind::Debouncer(ref mut debouncer) => { - for path in &watcher.paths { - debouncer.watcher().unwatch(path.as_ref()).map_err(|e| { - format!("failed to unwatch path: {} with error: {e}", path.display()) - })?; - } - } - WatcherKind::Watcher(ref mut w) => { - for path in &watcher.paths { - w.unwatch(path.as_ref()).map_err(|e| { - format!("failed to unwatch path: {} with error: {e}", path.display()) - })?; - } - } - } - - Ok(()) - }) -} diff --git a/plugins/geolocation/CHANGELOG.md b/plugins/geolocation/CHANGELOG.md new file mode 100644 index 00000000..dbee2e7d --- /dev/null +++ b/plugins/geolocation/CHANGELOG.md @@ -0,0 +1,57 @@ +# Changelog + +## \[2.2.4] + +- [`a1b3fa27`](https://github.com/tauri-apps/plugins-workspace/commit/a1b3fa27f11022c9b6622b4fab12d93239eb05de) ([#2515](https://github.com/tauri-apps/plugins-workspace/pull/2515) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Re-exported the `Geolocation`, `Haptics`, `Notification`, and `Os` structs so that they show up on docs.rs. + +## \[2.2.3] + +- [`406e6f48`](https://github.com/tauri-apps/plugins-workspace/commit/406e6f484cdc13d35c50fb949f7489ca9eeccc44) ([#2323](https://github.com/tauri-apps/plugins-workspace/pull/2323) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Fixed an issue that caused build failures when the `haptics` or `geolocation` plugin was used without their `specta` feature flag enabled. + +## \[2.2.2] + +- [`c9c13a0f`](https://github.com/tauri-apps/plugins-workspace/commit/c9c13a0fe7cdaac223843f5ba33176252f8e22f5) ([#2316](https://github.com/tauri-apps/plugins-workspace/pull/2316) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) **Breaking change:** `specta` integration is now behind a `specta` feature flag like in Tauri. +- [`c9c13a0f`](https://github.com/tauri-apps/plugins-workspace/commit/c9c13a0fe7cdaac223843f5ba33176252f8e22f5) ([#2316](https://github.com/tauri-apps/plugins-workspace/pull/2316) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Unlock and widen `specta` version range to match Tauri. No API changes. + +## \[2.2.1] + +- [`fb67ab2b`](https://github.com/tauri-apps/plugins-workspace/commit/fb67ab2b926502bfc20d6b43fbdd156691ea8526) ([#2281](https://github.com/tauri-apps/plugins-workspace/pull/2281) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Added `specta-util` to fix a "dependency not found" compilation error. + +## \[2.2.0] + +- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other. + +## \[2.0.1] + +- [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7. + +## \[2.0.0] + +- [`e2c4dfb6`](https://github.com/tauri-apps/plugins-workspace/commit/e2c4dfb6af43e5dd8d9ceba232c315f5febd55c1) Update to tauri v2 stable release. + +## \[2.0.0-rc.2] + +- [`60765694`](https://github.com/tauri-apps/plugins-workspace/commit/60765694f54875e22b8eb70b1d2e32dbf0c585c7) ([#1773](https://github.com/tauri-apps/plugins-workspace/pull/1773) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update API to match other plugins. + +## \[2.0.0-rc.1] + +- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Use `PermissionState` from the `tauri` crate, which now also includes a "prompt with rationale" variant for Android (returned when your app must explain to the user why it needs the permission). +- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri 2.0.0-rc.8 + +## \[2.0.0-rc.2] + +- [`b9147758`](https://github.com/tauri-apps/plugins-workspace/commit/b914775898c2bee7ceb20bd17ee595005cd17a64) ([#1679](https://github.com/tauri-apps/plugins-workspace/pull/1679) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Explicitly set a minimum macOS version for the Swift package. + +## \[2.0.0-rc.1] + +- [`5d170a54`](https://github.com/tauri-apps/plugins-workspace/commit/5d170a5444982dcc14135f6f1fc3e5da359f0eb0) ([#1671](https://github.com/tauri-apps/plugins-workspace/pull/1671) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri 2.0.0-rc.3. + +### changes + +- [`6b079cfd`](https://github.com/tauri-apps/plugins-workspace/commit/6b079cfdd107c94abc2c7300f6af00bac3ff4040) ([#1649](https://github.com/tauri-apps/plugins-workspace/pull/1649) by [@ahqsoftwares](https://github.com/tauri-apps/plugins-workspace/../../ahqsoftwares)) Remove targetSdk from build.kts files as it is deprecated and will be removed from DSL v9.0 + +## \[2.0.0-rc.0] + +- [`9606089b`](https://github.com/tauri-apps/plugins-workspace/commit/9606089b2add4a17f80ed5a09d59ce94824bd672) ([#1599](https://github.com/tauri-apps/plugins-workspace/pull/1599)) Initial release. +- [`9887d1`](https://github.com/tauri-apps/plugins-workspace/commit/9887d14bd0e971c4c0f5c1188fc4005d3fc2e29e) Update to tauri RC. + tauri-apps/plugins-workspace/commit/9887d14bd0e971c4c0f5c1188fc4005d3fc2e29e) Update to tauri RC. diff --git a/plugins/geolocation/Cargo.toml b/plugins/geolocation/Cargo.toml new file mode 100644 index 00000000..7d01b526 --- /dev/null +++ b/plugins/geolocation/Cargo.toml @@ -0,0 +1,38 @@ +[package] +name = "tauri-plugin-geolocation" +description = "Get and track the device's current position" +version = "2.2.4" +edition = { workspace = true } +authors = { workspace = true } +license = { workspace = true } +repository = { workspace = true } +links = "tauri-plugin-geolocation" + +[package.metadata.docs.rs] +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs"] +targets = ["x86_64-linux-android"] + +[package.metadata.platforms.support] +windows = { level = "none", notes = "" } +linux = { level = "none", notes = "" } +macos = { level = "none", notes = "" } +android = { level = "full", notes = "" } +ios = { level = "full", notes = "" } + +[build-dependencies] +tauri-plugin = { workspace = true, features = ["build"] } + +[dependencies] +serde = { workspace = true } +serde_json = { workspace = true } +tauri = { workspace = true } +log = { workspace = true } +thiserror = { workspace = true } +specta = { workspace = true, optional = true } + +[target.'cfg(target_os = "ios")'.dependencies] +tauri = { workspace = true, features = ["wry"] } + +[features] +specta = ["dep:specta", "tauri/specta"] diff --git a/plugins/authenticator/LICENSE.spdx b/plugins/geolocation/LICENSE.spdx similarity index 100% rename from plugins/authenticator/LICENSE.spdx rename to plugins/geolocation/LICENSE.spdx diff --git a/plugins/authenticator/LICENSE_APACHE-2.0 b/plugins/geolocation/LICENSE_APACHE-2.0 similarity index 100% rename from plugins/authenticator/LICENSE_APACHE-2.0 rename to plugins/geolocation/LICENSE_APACHE-2.0 diff --git a/plugins/authenticator/LICENSE_MIT b/plugins/geolocation/LICENSE_MIT similarity index 100% rename from plugins/authenticator/LICENSE_MIT rename to plugins/geolocation/LICENSE_MIT diff --git a/plugins/geolocation/README.md b/plugins/geolocation/README.md new file mode 100644 index 00000000..5d306cee --- /dev/null +++ b/plugins/geolocation/README.md @@ -0,0 +1,182 @@ +![geolocation](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/geolocation/banner.png) + +This plugin provides APIs for getting and tracking the device's current position, including information about altitude, heading, and speed (if available). + +| Platform | Supported | +| -------- | --------- | +| Linux | x | +| Windows | x | +| macOS | x | +| Android | ✓ | +| iOS | ✓ | + +## Install + +_This plugin requires a Rust version of at least **1.77.2**_ + +There are three general methods of installation that we can recommend. + +1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked) +2. Pull sources directly from Github using git tags / revision hashes (most secure) +3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use) + +Install the Core plugin by adding the following to your `Cargo.toml` file: + +`src-tauri/Cargo.toml` + +```toml +[dependencies] +tauri-plugin-geolocation = "2.0.0" +# alternatively with Git: +tauri-plugin-geolocation = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } +``` + +You can install the JavaScript Guest bindings using your preferred JavaScript package manager: + +> Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use. + + + +```sh +pnpm add @tauri-apps/plugin-geolocation +# or +npm add @tauri-apps/plugin-geolocation +# or +yarn add @tauri-apps/plugin-geolocation + +# alternatively with Git: +pnpm add https://github.com/tauri-apps/tauri-plugin-geolocation#v2 +# or +npm add https://github.com/tauri-apps/tauri-plugin-geolocation#v2 +# or +yarn add https://github.com/tauri-apps/tauri-plugin-geolocation#v2 +``` + +## Setting up + +### iOS + +Apple requires privacy descriptions to be specified in `Info.plist` for location information: + +- `NSLocationWhenInUseDescription` + +### Android + +This plugin automatically adds the following permissions to your `AndroidManifest.xml` file: + +```xml + + +``` + +If your app requires GPS functionality to function, **you** should add the following to your `AndroidManifest.xml` file: + +```xml + +``` + +The Google Play Store uses this property to decide whether it should show the app to devices without GPS capabilities. + +## Usage + +First you need to register the core plugin with Tauri: + +`src-tauri/src/lib.rs` + +```rust +fn main() { + tauri::Builder::default() + .plugin(tauri_plugin_geolocation::init()) + .run(tauri::generate_context!()) + .expect("error while running tauri application"); +} +``` + +Then, for instance, grant the plugin the permission to check or request permissions from the user and to read the device position + +`src-tauri/capabilities/default.json` + +```json + "permissions": [ + "core:default", + "geolocation:allow-check-permissions", + "geolocation:allow-request-permissions", + "geolocation:allow-get-current-position", + "geolocation:allow-watch-position", + ] +``` + +Afterwards all the plugin's APIs are available through the JavaScript guest bindings: + +```javascript +import { + checkPermissions, + requestPermissions, + getCurrentPosition, + watchPosition +} from '@tauri-apps/plugin-geolocation' + +let permissions = await checkPermissions() +if ( + permissions.location === 'prompt' + || permissions.location === 'prompt-with-rationale' +) { + permissions = await requestPermissions(['location']) +} + +if (permissions.location === 'granted') { + const pos = await getCurrentPosition() + + await watchPosition( + { enableHighAccuracy: true, timeout: 10000, maximumAge: 0 }, + (pos) => { + console.log(pos) + } + ) +} +``` + +## Contributing + +PRs accepted. Please make sure to read the Contributing Guide before making a pull request. + +## Contributed By + + + + + + + + +
+ + CrabNebula + + + + Rescue.co + +
+ +## Partners + + + + + + + +
+ + CrabNebula + +
+ +For the complete list of sponsors please visit our [website](https://tauri.app#sponsors) and [Open Collective](https://opencollective.com/tauri). + +## License + +Code: (c) 2015 - Present - The Tauri Programme within The Commons Conservancy. + +MIT or MIT/Apache 2.0 where applicable. diff --git a/plugins/geolocation/SECURITY.md b/plugins/geolocation/SECURITY.md new file mode 100644 index 00000000..4f09bbac --- /dev/null +++ b/plugins/geolocation/SECURITY.md @@ -0,0 +1,23 @@ +# Security Policy + +**Do not report security vulnerabilities through public GitHub issues.** + +**Please use the [Private Vulnerability Disclosure](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability) feature of GitHub.** + +Include as much of the following information: + +- Type of issue (e.g. improper input parsing, privilege escalation, etc.) +- The location of the affected source code (tag/branch/commit or direct URL) +- Any special configuration required to reproduce the issue +- The distribution affected or used to help us with reproduction of the issue +- Step-by-step instructions to reproduce the issue +- Ideally a reproduction repository +- Impact of the issue, including how an attacker might exploit the issue + +We prefer to receive reports in English. + +## Contact + +Please disclose a vulnerability or security relevant issue here: [https://github.com/tauri-apps/plugins-workspace/security/advisories/new](https://github.com/tauri-apps/plugins-workspace/security/advisories/new). + +Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app). diff --git a/plugins/biometric/.gitignore b/plugins/geolocation/android/.gitignore similarity index 53% rename from plugins/biometric/.gitignore rename to plugins/geolocation/android/.gitignore index 1b0b469d..c0f21ec2 100644 --- a/plugins/biometric/.gitignore +++ b/plugins/geolocation/android/.gitignore @@ -1 +1,2 @@ +/build /.tauri diff --git a/plugins/geolocation/android/build.gradle.kts b/plugins/geolocation/android/build.gradle.kts new file mode 100644 index 00000000..18fba0f3 --- /dev/null +++ b/plugins/geolocation/android/build.gradle.kts @@ -0,0 +1,45 @@ +plugins { + id("com.android.library") + id("org.jetbrains.kotlin.android") +} + +android { + namespace = "app.tauri.geolocation" + compileSdk = 34 + + defaultConfig { + minSdk = 24 + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles("consumer-rules.pro") + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = "1.8" + } +} + +dependencies { + + implementation("androidx.core:core-ktx:1.9.0") + implementation("androidx.appcompat:appcompat:1.6.0") + implementation("com.google.android.material:material:1.7.0") + implementation("com.google.android.gms:play-services-location:21.3.0") + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test.ext:junit:1.1.5") + androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1") + implementation(project(":tauri-android")) +} diff --git a/plugins/geolocation/android/proguard-rules.pro b/plugins/geolocation/android/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/plugins/geolocation/android/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/plugins/geolocation/android/settings.gradle b/plugins/geolocation/android/settings.gradle new file mode 100644 index 00000000..14a752e4 --- /dev/null +++ b/plugins/geolocation/android/settings.gradle @@ -0,0 +1,2 @@ +include ':tauri-android' +project(':tauri-android').projectDir = new File('./.tauri/tauri-api') diff --git a/plugins/geolocation/android/src/androidTest/java/ExampleInstrumentedTest.kt b/plugins/geolocation/android/src/androidTest/java/ExampleInstrumentedTest.kt new file mode 100644 index 00000000..a301dc2d --- /dev/null +++ b/plugins/geolocation/android/src/androidTest/java/ExampleInstrumentedTest.kt @@ -0,0 +1,28 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +package app.tauri.geolocation + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("app.tauri.geolocation", appContext.packageName) + } +} diff --git a/plugins/geolocation/android/src/main/AndroidManifest.xml b/plugins/geolocation/android/src/main/AndroidManifest.xml new file mode 100644 index 00000000..a47edd1c --- /dev/null +++ b/plugins/geolocation/android/src/main/AndroidManifest.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/plugins/geolocation/android/src/main/java/Geolocation.kt b/plugins/geolocation/android/src/main/java/Geolocation.kt new file mode 100644 index 00000000..b16a4482 --- /dev/null +++ b/plugins/geolocation/android/src/main/java/Geolocation.kt @@ -0,0 +1,148 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +package app.tauri.geolocation + +import android.annotation.SuppressLint +import android.content.Context +import android.location.Location +import android.location.LocationManager +import android.os.SystemClock +import androidx.core.location.LocationManagerCompat +import app.tauri.Logger +import com.google.android.gms.common.ConnectionResult +import com.google.android.gms.common.GoogleApiAvailability +import com.google.android.gms.location.FusedLocationProviderClient +import com.google.android.gms.location.LocationCallback +import com.google.android.gms.location.LocationRequest +import com.google.android.gms.location.LocationResult +import com.google.android.gms.location.LocationServices +import com.google.android.gms.location.Priority + + +public class Geolocation(private val context: Context) { + private var fusedLocationClient: FusedLocationProviderClient? = null + private var locationCallback: LocationCallback? = null + + + fun isLocationServicesEnabled(): Boolean { + val lm = context.getSystemService(Context.LOCATION_SERVICE) as LocationManager + return LocationManagerCompat.isLocationEnabled(lm) + } + + @SuppressWarnings("MissingPermission") + fun sendLocation(enableHighAccuracy: Boolean, successCallback: (location: Location) -> Unit, errorCallback: (error: String) -> Unit) { + val resultCode = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context); + if (resultCode == ConnectionResult.SUCCESS) { + val lm = context.getSystemService(Context.LOCATION_SERVICE) as LocationManager + + if (this.isLocationServicesEnabled()) { + var networkEnabled = false + + try { + networkEnabled = lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER) + } catch (_: Exception) { + Logger.error("isProviderEnabled failed") + } + + val lowPrio = if (networkEnabled) Priority.PRIORITY_BALANCED_POWER_ACCURACY else Priority.PRIORITY_LOW_POWER + val prio = if (enableHighAccuracy) Priority.PRIORITY_HIGH_ACCURACY else lowPrio + + Logger.error(prio.toString()) + + LocationServices + .getFusedLocationProviderClient(context) + .getCurrentLocation(prio, null) + .addOnFailureListener { e -> e.message?.let { errorCallback(it) } } + .addOnSuccessListener { location -> + if (location == null) { + errorCallback("Location unavailable.") + } else { + successCallback(location) + } + } + } else { + errorCallback("Location disabled.") + } + } else { + errorCallback("Google Play Services unavailable.") + } + } + + @SuppressLint("MissingPermission") + fun requestLocationUpdates(enableHighAccuracy: Boolean, timeout: Long, successCallback: (location: Location) -> Unit, errorCallback: (error: String) -> Unit) { + val resultCode = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context); + if (resultCode == ConnectionResult.SUCCESS) { + clearLocationUpdates() + fusedLocationClient = LocationServices.getFusedLocationProviderClient(context) + + val lm = context.getSystemService(Context.LOCATION_SERVICE) as LocationManager + + if (this.isLocationServicesEnabled()) { + var networkEnabled = false + + try { + networkEnabled = lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER) + } catch (_: Exception) { + Logger.error("isProviderEnabled failed") + } + + val lowPrio = if (networkEnabled) Priority.PRIORITY_BALANCED_POWER_ACCURACY else Priority.PRIORITY_LOW_POWER + val prio = if (enableHighAccuracy) Priority.PRIORITY_HIGH_ACCURACY else lowPrio + + Logger.error(prio.toString()) + + val locationRequest = LocationRequest.Builder(10000) + .setMaxUpdateDelayMillis(timeout) + .setMinUpdateIntervalMillis(5000) + .setPriority(prio) + .build() + + locationCallback = + object : LocationCallback() { + override fun onLocationResult(locationResult: LocationResult) { + val lastLocation = locationResult.lastLocation + if (lastLocation == null) { + errorCallback("Location unavailable.") + } else { + successCallback(lastLocation) + } + } + } + + fusedLocationClient?.requestLocationUpdates(locationRequest, locationCallback!!, null) + } else { + errorCallback("Location disabled.") + } + } else { + errorCallback("Google Play Services not available.") + } + } + + fun clearLocationUpdates() { + if (locationCallback != null) { + fusedLocationClient?.removeLocationUpdates(locationCallback!!) + locationCallback = null + } + } + + @SuppressLint("MissingPermission") + fun getLastLocation(maximumAge: Long): Location? { + var lastLoc: Location? = null + val lm = context.getSystemService(Context.LOCATION_SERVICE) as LocationManager + + for (provider in lm.allProviders) { + val tmpLoc = lm.getLastKnownLocation(provider) + if (tmpLoc != null) { + val locationAge = SystemClock.elapsedRealtimeNanos() - tmpLoc.elapsedRealtimeNanos + val maxAgeNano = maximumAge * 1000000L + if (locationAge <= maxAgeNano && (lastLoc == null || lastLoc.elapsedRealtimeNanos > tmpLoc.elapsedRealtimeNanos)) { + lastLoc = tmpLoc + } + } + } + + return lastLoc + } +} \ No newline at end of file diff --git a/plugins/geolocation/android/src/main/java/GeolocationPlugin.kt b/plugins/geolocation/android/src/main/java/GeolocationPlugin.kt new file mode 100644 index 00000000..cf81f5e3 --- /dev/null +++ b/plugins/geolocation/android/src/main/java/GeolocationPlugin.kt @@ -0,0 +1,172 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +package app.tauri.geolocation + +import android.Manifest +import android.app.Activity +import android.location.Location +import android.os.Build +import android.webkit.WebView +import app.tauri.Logger +import app.tauri.PermissionState +import app.tauri.annotation.Command +import app.tauri.annotation.InvokeArg +import app.tauri.annotation.Permission +import app.tauri.annotation.PermissionCallback +import app.tauri.annotation.TauriPlugin +import app.tauri.plugin.Channel +import app.tauri.plugin.Invoke +import app.tauri.plugin.JSObject +import app.tauri.plugin.Plugin + +@InvokeArg +class PositionOptions { + var enableHighAccuracy: Boolean = false + var maximumAge: Long = 0 + var timeout: Long = 10000 +} + +@InvokeArg +class WatchArgs { + var options: PositionOptions = PositionOptions() + lateinit var channel: Channel +} + +@InvokeArg +class ClearWatchArgs { + var channelId: Long = 0 +} + +// TODO: Plugin does not ask user to enable google location services (like gmaps does) + +private const val ALIAS_LOCATION: String = "location" +private const val ALIAS_COARSE_LOCATION: String = "coarseLocation" + +@TauriPlugin( + permissions = [ + Permission(strings = [ + Manifest.permission.ACCESS_FINE_LOCATION, + Manifest.permission.ACCESS_COARSE_LOCATION + ], + alias = ALIAS_LOCATION + ), + Permission(strings = [ + Manifest.permission.ACCESS_COARSE_LOCATION + ], + alias = ALIAS_COARSE_LOCATION + ) + ] +) +class GeolocationPlugin(private val activity: Activity): Plugin(activity) { + private lateinit var implementation: Geolocation + private var watchers = hashMapOf>() + + override fun load(webView: WebView) { + super.load(webView) + implementation = Geolocation(activity.applicationContext) + } + + override fun onPause() { + super.onPause() + // Clear all location updates on pause to avoid possible background location calls + implementation.clearLocationUpdates() + } + + override fun onResume() { + super.onResume() + // resume watchers + for ((watcher, args) in watchers.values) { + startWatch(watcher, args) + } + } + + @Command + override fun checkPermissions(invoke: Invoke) { + if (implementation.isLocationServicesEnabled()) { + super.checkPermissions(invoke) + } else { + invoke.reject("Location services are disabled.") + } + } + + @Command + override fun requestPermissions(invoke: Invoke) { + if (implementation.isLocationServicesEnabled()) { + super.requestPermissions(invoke) + } else { + invoke.reject("Location services are disabled.") + } + } + + @Command + fun getCurrentPosition(invoke: Invoke) { + val args = invoke.parseArgs(PositionOptions::class.java) + + val location = implementation.getLastLocation(args.maximumAge) + if (location != null) { + invoke.resolve(convertLocation(location)) + } else { + implementation.sendLocation(args.enableHighAccuracy, + { loc -> invoke.resolve(convertLocation(loc)) }, + { error -> invoke.reject(error) }) + } + } + + @PermissionCallback + private fun positionPermissionCallback(invoke: Invoke) { + val permissionsResultJSON = JSObject() + permissionsResultJSON.put("location", getPermissionState(ALIAS_LOCATION)) + permissionsResultJSON.put("coarseLocation", getPermissionState(ALIAS_COARSE_LOCATION)) + invoke.resolve(permissionsResultJSON) + } + + @Command + fun watchPosition(invoke: Invoke) { + val args = invoke.parseArgs(WatchArgs::class.java) + startWatch(invoke, args) + } + + private fun startWatch(invoke: Invoke, args: WatchArgs) { + implementation.requestLocationUpdates( + args.options.enableHighAccuracy, + args.options.timeout, + { location -> args.channel.send(convertLocation(location)) }, + { error -> args.channel.sendObject(error) }) + + watchers[args.channel.id] = Pair(invoke, args) + } + + @Command + fun clearWatch(invoke: Invoke) { + val args = invoke.parseArgs(ClearWatchArgs::class.java) + + watchers.remove(args.channelId) + + if (watchers.isEmpty()) { + implementation.clearLocationUpdates() + } + + invoke.resolve() + } + + private fun convertLocation(location: Location): JSObject { + val ret = JSObject() + val coords = JSObject() + + coords.put("latitude", location.latitude) + coords.put("longitude", location.longitude) + coords.put("accuracy", location.accuracy) + coords.put("altitude", location.altitude) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + coords.put("altitudeAccuracy", location.verticalAccuracyMeters) + } + coords.put("speed", location.speed) + coords.put("heading", location.bearing) + ret.put("timestamp", location.time) + ret.put("coords", coords) + + return ret + } +} diff --git a/plugins/geolocation/android/src/test/java/ExampleUnitTest.kt b/plugins/geolocation/android/src/test/java/ExampleUnitTest.kt new file mode 100644 index 00000000..03c99f7d --- /dev/null +++ b/plugins/geolocation/android/src/test/java/ExampleUnitTest.kt @@ -0,0 +1,21 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +package app.tauri.geolocation + +import org.junit.Test + +import org.junit.Assert.* + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class ExampleUnitTest { + @Test + fun addition_isCorrect() { + assertEquals(4, 2 + 2) + } +} diff --git a/plugins/geolocation/api-iife.js b/plugins/geolocation/api-iife.js new file mode 100644 index 00000000..1db79359 --- /dev/null +++ b/plugins/geolocation/api-iife.js @@ -0,0 +1 @@ +if("__TAURI__"in window){var __TAURI_PLUGIN_GEOLOCATION__=function(t){"use strict";function n(t,n,e,i){if("function"==typeof n||!n.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===e?i:"a"===e?i.call(t):i?i.value:n.get(t)}function e(t,n,e,i,s){if("function"==typeof n||!n.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n.set(t,e),e}var i,s,o,r;"function"==typeof SuppressedError&&SuppressedError;const a="__TAURI_TO_IPC_KEY__";class c{constructor(t){i.set(this,void 0),s.set(this,0),o.set(this,[]),r.set(this,void 0),e(this,i,t||(()=>{})),this.id=function(t,n=!1){return window.__TAURI_INTERNALS__.transformCallback(t,n)}((t=>{const a=t.index;if("end"in t)return void(a==n(this,s,"f")?this.cleanupCallback():e(this,r,a));const c=t.message;if(a==n(this,s,"f")){for(n(this,i,"f").call(this,c),e(this,s,n(this,s,"f")+1);n(this,s,"f")in n(this,o,"f");){const t=n(this,o,"f")[n(this,s,"f")];n(this,i,"f").call(this,t),delete n(this,o,"f")[n(this,s,"f")],e(this,s,n(this,s,"f")+1)}n(this,s,"f")===n(this,r,"f")&&this.cleanupCallback()}else n(this,o,"f")[a]=c}))}cleanupCallback(){Reflect.deleteProperty(window,`_${this.id}`)}set onmessage(t){e(this,i,t)}get onmessage(){return n(this,i,"f")}[(i=new WeakMap,s=new WeakMap,o=new WeakMap,r=new WeakMap,a)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[a]()}}async function _(t,n={},e){return window.__TAURI_INTERNALS__.invoke(t,n,e)}return t.checkPermissions=async function(){return await async function(t){return _(`plugin:${t}|check_permissions`)}("geolocation")},t.clearWatch=async function(t){await _("plugin:geolocation|clear_watch",{channelId:t})},t.getCurrentPosition=async function(t){return await _("plugin:geolocation|get_current_position",{options:t})},t.requestPermissions=async function(t){return await _("plugin:geolocation|request_permissions",{permissions:t})},t.watchPosition=async function(t,n){const e=new c;return e.onmessage=t=>{"string"==typeof t?n(null,t):n(t)},await _("plugin:geolocation|watch_position",{options:t,channel:e}),e.id},t}({});Object.defineProperty(window.__TAURI__,"geolocation",{value:__TAURI_PLUGIN_GEOLOCATION__})} diff --git a/plugins/geolocation/build.rs b/plugins/geolocation/build.rs new file mode 100644 index 00000000..b5249761 --- /dev/null +++ b/plugins/geolocation/build.rs @@ -0,0 +1,24 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +const COMMANDS: &[&str] = &[ + "get_current_position", + "watch_position", + "clear_watch", + "check_permissions", + "request_permissions", +]; + +fn main() { + let result = tauri_plugin::Builder::new(COMMANDS) + .global_api_script_path("./api-iife.js") + .android_path("android") + .ios_path("ios") + .try_build(); + + // when building documentation for Android the plugin build result is always Err() and is irrelevant to the crate documentation build + if !(cfg!(docsrs) && std::env::var("TARGET").unwrap().contains("android")) { + result.unwrap(); + } +} diff --git a/plugins/geolocation/contributors/crabnebula.svg b/plugins/geolocation/contributors/crabnebula.svg new file mode 100644 index 00000000..40e24131 --- /dev/null +++ b/plugins/geolocation/contributors/crabnebula.svg @@ -0,0 +1,31 @@ + \ No newline at end of file diff --git a/plugins/geolocation/contributors/rescue.png b/plugins/geolocation/contributors/rescue.png new file mode 100644 index 00000000..2b5916f4 Binary files /dev/null and b/plugins/geolocation/contributors/rescue.png differ diff --git a/plugins/geolocation/guest-js/index.ts b/plugins/geolocation/guest-js/index.ts new file mode 100644 index 00000000..8ef5c533 --- /dev/null +++ b/plugins/geolocation/guest-js/index.ts @@ -0,0 +1,138 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +import { + Channel, + invoke, + PermissionState, + checkPermissions as checkPluginPermissions +} from '@tauri-apps/api/core' + +export type Coordinates = { + /** + * Latitude in decimal degrees. + */ + latitude: number + /** + * Longitude in decimal degrees. + */ + longitude: number + /** + * Accuracy level of the latitude and longitude coordinates in meters. + */ + accuracy: number + /** + * Accuracy level of the altitude coordinate in meters, if available. + * Available on all iOS versions and on Android 8 and above. + */ + altitudeAccuracy: number | null + /** + * The altitude the user is at, if available. + */ + altitude: number | null + speed: number | null + /** + * The heading the user is facing, if available. + */ + heading: number | null +} + +export type PermissionStatus = { + /** + * Permission state for the location alias. + * + * On Android it requests/checks both ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION permissions. + * + * On iOS it requests/checks location permissions. + */ + location: PermissionState + /** + * Permissions state for the coarseLoaction alias. + * + * On Android it requests/checks ACCESS_COARSE_LOCATION. + * + * On Android 12+, users can choose between Approximate location (ACCESS_COARSE_LOCATION) and Precise location (ACCESS_FINE_LOCATION). + * + * On iOS it will have the same value as the `location` alias. + */ + coarseLocation: PermissionState +} + +export type PermissionType = 'location' | 'coarseLocation' + +export type Position = { + /** + * Creation time for these coordinates. + */ + timestamp: number + /** + * The GPD coordinates along with the accuracy of the data. + */ + coords: Coordinates +} + +export type PositionOptions = { + /** + * High accuracy mode (such as GPS, if available) + * Will be ignored on Android 12+ if users didn't grant the ACCESS_FINE_LOCATION permission (`coarseLocation` permission). + */ + enableHighAccuracy: boolean + /** + * The maximum wait time in milliseconds for location updates. + * On Android the timeout gets ignored for getCurrentPosition. + * Ignored on iOS + */ + timeout: number + /** + * The maximum age in milliseconds of a possible cached position that is acceptable to return. + * Default: 0 + * Ignored on iOS + */ + maximumAge: number +} + +export async function watchPosition( + options: PositionOptions, + cb: (location: Position | null, error?: string) => void +): Promise { + const channel = new Channel() + channel.onmessage = (message) => { + if (typeof message === 'string') { + cb(null, message) + } else { + cb(message) + } + } + await invoke('plugin:geolocation|watch_position', { + options, + channel + }) + return channel.id +} + +export async function getCurrentPosition( + options?: PositionOptions +): Promise { + return await invoke('plugin:geolocation|get_current_position', { + options + }) +} + +export async function clearWatch(channelId: number): Promise { + await invoke('plugin:geolocation|clear_watch', { + channelId + }) +} + +export async function checkPermissions(): Promise { + return await checkPluginPermissions('geolocation') +} + +export async function requestPermissions( + permissions: PermissionType[] | null +): Promise { + return await invoke('plugin:geolocation|request_permissions', { + permissions + }) +} diff --git a/plugins/geolocation/ios/.gitignore b/plugins/geolocation/ios/.gitignore new file mode 100644 index 00000000..5922fdaa --- /dev/null +++ b/plugins/geolocation/ios/.gitignore @@ -0,0 +1,10 @@ +.DS_Store +/.build +/Packages +/*.xcodeproj +xcuserdata/ +DerivedData/ +.swiftpm/config/registries.json +.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata +.netrc +Package.resolved diff --git a/plugins/geolocation/ios/Package.swift b/plugins/geolocation/ios/Package.swift new file mode 100644 index 00000000..f8cfb73f --- /dev/null +++ b/plugins/geolocation/ios/Package.swift @@ -0,0 +1,34 @@ +// swift-tools-version:5.3 +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +import PackageDescription + +let package = Package( + name: "tauri-plugin-geolocation", + platforms: [ + .macOS(.v10_13), + .iOS(.v13), + ], + products: [ + // Products define the executables and libraries a package produces, and make them visible to other packages. + .library( + name: "tauri-plugin-geolocation", + type: .static, + targets: ["tauri-plugin-geolocation"]) + ], + dependencies: [ + .package(name: "Tauri", path: "../.tauri/tauri-api") + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages this package depends on. + .target( + name: "tauri-plugin-geolocation", + dependencies: [ + .byName(name: "Tauri") + ], + path: "Sources") + ] +) diff --git a/plugins/geolocation/ios/README.md b/plugins/geolocation/ios/README.md new file mode 100644 index 00000000..5612ac82 --- /dev/null +++ b/plugins/geolocation/ios/README.md @@ -0,0 +1,3 @@ +# Tauri Plugin Geolocation + +A description of this package. diff --git a/plugins/geolocation/ios/Sources/GeolocationPlugin.swift b/plugins/geolocation/ios/Sources/GeolocationPlugin.swift new file mode 100644 index 00000000..7a2b57a9 --- /dev/null +++ b/plugins/geolocation/ios/Sources/GeolocationPlugin.swift @@ -0,0 +1,250 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +import CoreLocation +import SwiftRs +import Tauri +import UIKit +import WebKit + +class GetPositionArgs: Decodable { + var enableHighAccuracy: Bool? +} + +class WatchPositionArgs: Decodable { + let options: GetPositionArgs + let channel: Channel +} + +class ClearWatchArgs: Decodable { + let channelId: UInt32 +} + +class GeolocationPlugin: Plugin, CLLocationManagerDelegate { + private let locationManager = CLLocationManager() + private var isUpdatingLocation: Bool = false + private var permissionRequests: [Invoke] = [] + private var positionRequests: [Invoke] = [] + private var watcherChannels: [Channel] = [] + + override init() { + super.init() + locationManager.delegate = self + } + + // + // Tauri commands + // + + @objc public func getCurrentPosition(_ invoke: Invoke) throws { + let args = try invoke.parseArgs(GetPositionArgs.self) + + self.positionRequests.append(invoke) + + DispatchQueue.main.async { + if args.enableHighAccuracy == true { + self.locationManager.desiredAccuracy = kCLLocationAccuracyBest + } else { + self.locationManager.desiredAccuracy = kCLLocationAccuracyKilometer + } + + // TODO: Use the authorizationStatus instance property with locationManagerDidChangeAuthorization(_:) instead. + if CLLocationManager.authorizationStatus() == .notDetermined { + self.locationManager.requestWhenInUseAuthorization() + } else { + self.locationManager.requestLocation() + } + } + } + + @objc public func watchPosition(_ invoke: Invoke) throws { + let args = try invoke.parseArgs(WatchPositionArgs.self) + + self.watcherChannels.append(args.channel) + + DispatchQueue.main.async { + if args.options.enableHighAccuracy == true { + self.locationManager.desiredAccuracy = kCLLocationAccuracyBest + } else { + self.locationManager.desiredAccuracy = kCLLocationAccuracyKilometer + } + + // TODO: Use the authorizationStatus instance property with locationManagerDidChangeAuthorization(_:) instead. + if CLLocationManager.authorizationStatus() == .notDetermined { + self.locationManager.requestWhenInUseAuthorization() + } else { + self.locationManager.startUpdatingLocation() + self.isUpdatingLocation = true + } + } + + invoke.resolve() + } + + @objc public func clearWatch(_ invoke: Invoke) throws { + let args = try invoke.parseArgs(ClearWatchArgs.self) + + self.watcherChannels = self.watcherChannels.filter { $0.id != args.channelId } + + // TODO: capacitor plugin calls stopUpdating unconditionally + if self.watcherChannels.isEmpty { + self.stopUpdating() + } + + invoke.resolve() + } + + @objc override public func checkPermissions(_ invoke: Invoke) { + var status: String = "" + + if CLLocationManager.locationServicesEnabled() { + // TODO: Use the authorizationStatus instance property with locationManagerDidChangeAuthorization(_:) instead. + switch CLLocationManager.authorizationStatus() { + case .notDetermined: + status = "prompt" + case .restricted, .denied: + status = "denied" + case .authorizedAlways, .authorizedWhenInUse: + status = "granted" + @unknown default: + status = "prompt" + } + } else { + invoke.reject("Location services are not enabled.") + return + } + + let result = ["location": status, "coarseLocation": status] + + invoke.resolve(result) + } + + @objc override public func requestPermissions(_ invoke: Invoke) { + if CLLocationManager.locationServicesEnabled() { + // TODO: Use the authorizationStatus instance property with locationManagerDidChangeAuthorization(_:) instead. + if CLLocationManager.authorizationStatus() == .notDetermined { + self.permissionRequests.append(invoke) + + DispatchQueue.main.async { + self.locationManager.requestWhenInUseAuthorization() + } + } else { + checkPermissions(invoke) + } + } else { + invoke.reject("Location services are not enabled.") + } + } + + // + // Delegate methods + // + + public func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) { + Logger.error(error) + + let requests = self.positionRequests + self.permissionRequests + self.positionRequests.removeAll() + self.permissionRequests.removeAll() + + for request in requests { + request.reject(error.localizedDescription) + } + + for channel in self.watcherChannels { + do { + try channel.send(error.localizedDescription) + } catch { + Logger.error(error) + } + } + } + + public func locationManager( + _ manager: CLLocationManager, didUpdateLocations locations: [CLLocation] + ) { + // Respond to all getCurrentPosition() calls. + for request in self.positionRequests { + // The capacitor plugin uses locations.first but .last should be the most current one + // and i don't see a reason to use old locations + if let location = locations.last { + let result = convertLocation(location) + request.resolve(result) + } else { + request.reject("Location service returned an empty Location array.") + } + } + + for channel in self.watcherChannels { + // The capacitor plugin uses locations.first but .last should be the most recent one + // and i don't see a reason to use old locations + if let location = locations.last { + let result = convertLocation(location) + do { + try channel.send(result) + } catch { + Logger.error(error) + } + } else { + do { + try channel.send("Location service returned an empty Location array.") + } catch { + Logger.error(error) + } + } + } + } + + public func locationManager( + _ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus + ) { + let requests = self.permissionRequests + self.permissionRequests.removeAll() + + for request in requests { + checkPermissions(request) + } + + if !self.positionRequests.isEmpty { + self.locationManager.requestLocation() + } + + if !self.watcherChannels.isEmpty && !self.isUpdatingLocation { + self.locationManager.startUpdatingLocation() + self.isUpdatingLocation = true + } + } + + // + // Internal/Helper methods + // + + // TODO: Why is this pub in capacitor + private func stopUpdating() { + self.locationManager.stopUpdatingLocation() + self.isUpdatingLocation = false + } + + private func convertLocation(_ location: CLLocation) -> JsonObject { + var ret: JsonObject = [:] + var coords: JsonObject = [:] + + coords["latitude"] = location.coordinate.latitude + coords["longitude"] = location.coordinate.longitude + coords["accuracy"] = location.horizontalAccuracy + coords["altitude"] = location.altitude + coords["altitudeAccuracy"] = location.verticalAccuracy + coords["speed"] = location.speed + coords["heading"] = location.course + ret["timestamp"] = Int((location.timestamp.timeIntervalSince1970 * 1000)) + ret["coords"] = coords + + return ret + } +} + +@_cdecl("init_plugin_geolocation") +func initPlugin() -> Plugin { + return GeolocationPlugin() +} diff --git a/plugins/geolocation/ios/Tests/PluginTests/PluginTests.swift b/plugins/geolocation/ios/Tests/PluginTests/PluginTests.swift new file mode 100644 index 00000000..99992ce4 --- /dev/null +++ b/plugins/geolocation/ios/Tests/PluginTests/PluginTests.swift @@ -0,0 +1,12 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +import XCTest +@testable import ExamplePlugin + +final class ExamplePluginTests: XCTestCase { + func testExample() throws { + let plugin = ExamplePlugin() + } +} diff --git a/plugins/authenticator/package.json b/plugins/geolocation/package.json similarity index 68% rename from plugins/authenticator/package.json rename to plugins/geolocation/package.json index 7e57c456..0e3b09cb 100644 --- a/plugins/authenticator/package.json +++ b/plugins/geolocation/package.json @@ -1,11 +1,11 @@ { - "name": "@tauri-apps/plugin-authenticator", - "version": "2.0.0-beta.1", - "description": "Use hardware security-keys in your Tauri App.", - "license": "MIT or APACHE-2.0", + "name": "@tauri-apps/plugin-geolocation", + "version": "2.2.4", + "license": "MIT OR Apache-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" ], + "repository": "https://github.com/tauri-apps/plugins-workspace", "type": "module", "types": "./dist-js/index.d.ts", "main": "./dist-js/index.cjs", @@ -24,6 +24,6 @@ "LICENSE" ], "dependencies": { - "@tauri-apps/api": "2.0.0-beta.2" + "@tauri-apps/api": "^2.0.0" } } diff --git a/plugins/geolocation/permissions/autogenerated/commands/check_permissions.toml b/plugins/geolocation/permissions/autogenerated/commands/check_permissions.toml new file mode 100644 index 00000000..f5af08b1 --- /dev/null +++ b/plugins/geolocation/permissions/autogenerated/commands/check_permissions.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-check-permissions" +description = "Enables the check_permissions command without any pre-configured scope." +commands.allow = ["check_permissions"] + +[[permission]] +identifier = "deny-check-permissions" +description = "Denies the check_permissions command without any pre-configured scope." +commands.deny = ["check_permissions"] diff --git a/plugins/geolocation/permissions/autogenerated/commands/clear_permissions.toml b/plugins/geolocation/permissions/autogenerated/commands/clear_permissions.toml new file mode 100644 index 00000000..a3e6ab5c --- /dev/null +++ b/plugins/geolocation/permissions/autogenerated/commands/clear_permissions.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-clear-permissions" +description = "Enables the clear_permissions command without any pre-configured scope." +commands.allow = ["clear_permissions"] + +[[permission]] +identifier = "deny-clear-permissions" +description = "Denies the clear_permissions command without any pre-configured scope." +commands.deny = ["clear_permissions"] diff --git a/plugins/geolocation/permissions/autogenerated/commands/clear_watch.toml b/plugins/geolocation/permissions/autogenerated/commands/clear_watch.toml new file mode 100644 index 00000000..19fb5776 --- /dev/null +++ b/plugins/geolocation/permissions/autogenerated/commands/clear_watch.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-clear-watch" +description = "Enables the clear_watch command without any pre-configured scope." +commands.allow = ["clear_watch"] + +[[permission]] +identifier = "deny-clear-watch" +description = "Denies the clear_watch command without any pre-configured scope." +commands.deny = ["clear_watch"] diff --git a/plugins/geolocation/permissions/autogenerated/commands/get_current_position.toml b/plugins/geolocation/permissions/autogenerated/commands/get_current_position.toml new file mode 100644 index 00000000..fefb951b --- /dev/null +++ b/plugins/geolocation/permissions/autogenerated/commands/get_current_position.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-get-current-position" +description = "Enables the get_current_position command without any pre-configured scope." +commands.allow = ["get_current_position"] + +[[permission]] +identifier = "deny-get-current-position" +description = "Denies the get_current_position command without any pre-configured scope." +commands.deny = ["get_current_position"] diff --git a/plugins/geolocation/permissions/autogenerated/commands/request_permissions.toml b/plugins/geolocation/permissions/autogenerated/commands/request_permissions.toml new file mode 100644 index 00000000..02dcd627 --- /dev/null +++ b/plugins/geolocation/permissions/autogenerated/commands/request_permissions.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-request-permissions" +description = "Enables the request_permissions command without any pre-configured scope." +commands.allow = ["request_permissions"] + +[[permission]] +identifier = "deny-request-permissions" +description = "Denies the request_permissions command without any pre-configured scope." +commands.deny = ["request_permissions"] diff --git a/plugins/geolocation/permissions/autogenerated/commands/watch_position.toml b/plugins/geolocation/permissions/autogenerated/commands/watch_position.toml new file mode 100644 index 00000000..5878ba1a --- /dev/null +++ b/plugins/geolocation/permissions/autogenerated/commands/watch_position.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-watch-position" +description = "Enables the watch_position command without any pre-configured scope." +commands.allow = ["watch_position"] + +[[permission]] +identifier = "deny-watch-position" +description = "Denies the watch_position command without any pre-configured scope." +commands.deny = ["watch_position"] diff --git a/plugins/geolocation/permissions/autogenerated/reference.md b/plugins/geolocation/permissions/autogenerated/reference.md new file mode 100644 index 00000000..71d81a72 --- /dev/null +++ b/plugins/geolocation/permissions/autogenerated/reference.md @@ -0,0 +1,166 @@ + +## Permission Table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IdentifierDescription
+ +`geolocation:allow-check-permissions` + + + +Enables the check_permissions command without any pre-configured scope. + +
+ +`geolocation:deny-check-permissions` + + + +Denies the check_permissions command without any pre-configured scope. + +
+ +`geolocation:allow-clear-permissions` + + + +Enables the clear_permissions command without any pre-configured scope. + +
+ +`geolocation:deny-clear-permissions` + + + +Denies the clear_permissions command without any pre-configured scope. + +
+ +`geolocation:allow-clear-watch` + + + +Enables the clear_watch command without any pre-configured scope. + +
+ +`geolocation:deny-clear-watch` + + + +Denies the clear_watch command without any pre-configured scope. + +
+ +`geolocation:allow-get-current-position` + + + +Enables the get_current_position command without any pre-configured scope. + +
+ +`geolocation:deny-get-current-position` + + + +Denies the get_current_position command without any pre-configured scope. + +
+ +`geolocation:allow-request-permissions` + + + +Enables the request_permissions command without any pre-configured scope. + +
+ +`geolocation:deny-request-permissions` + + + +Denies the request_permissions command without any pre-configured scope. + +
+ +`geolocation:allow-watch-position` + + + +Enables the watch_position command without any pre-configured scope. + +
+ +`geolocation:deny-watch-position` + + + +Denies the watch_position command without any pre-configured scope. + +
diff --git a/plugins/geolocation/permissions/schemas/schema.json b/plugins/geolocation/permissions/schemas/schema.json new file mode 100644 index 00000000..237b445d --- /dev/null +++ b/plugins/geolocation/permissions/schemas/schema.json @@ -0,0 +1,372 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PermissionFile", + "description": "Permission file that can define a default permission, a set of permissions or a list of inlined permissions.", + "type": "object", + "properties": { + "default": { + "description": "The default permission set for the plugin", + "anyOf": [ + { + "$ref": "#/definitions/DefaultPermission" + }, + { + "type": "null" + } + ] + }, + "set": { + "description": "A list of permissions sets defined", + "type": "array", + "items": { + "$ref": "#/definitions/PermissionSet" + } + }, + "permission": { + "description": "A list of inlined permissions", + "default": [], + "type": "array", + "items": { + "$ref": "#/definitions/Permission" + } + } + }, + "definitions": { + "DefaultPermission": { + "description": "The default permission set of the plugin.\n\nWorks similarly to a permission with the \"default\" identifier.", + "type": "object", + "required": [ + "permissions" + ], + "properties": { + "version": { + "description": "The version of the permission.", + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 1.0 + }, + "description": { + "description": "Human-readable description of what the permission does. Tauri convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", + "type": [ + "string", + "null" + ] + }, + "permissions": { + "description": "All permissions this set contains.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "PermissionSet": { + "description": "A set of direct permissions grouped together under a new name.", + "type": "object", + "required": [ + "description", + "identifier", + "permissions" + ], + "properties": { + "identifier": { + "description": "A unique identifier for the permission.", + "type": "string" + }, + "description": { + "description": "Human-readable description of what the permission does.", + "type": "string" + }, + "permissions": { + "description": "All permissions this set contains.", + "type": "array", + "items": { + "$ref": "#/definitions/PermissionKind" + } + } + } + }, + "Permission": { + "description": "Descriptions of explicit privileges of commands.\n\nIt can enable commands to be accessible in the frontend of the application.\n\nIf the scope is defined it can be used to fine grain control the access of individual or multiple commands.", + "type": "object", + "required": [ + "identifier" + ], + "properties": { + "version": { + "description": "The version of the permission.", + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 1.0 + }, + "identifier": { + "description": "A unique identifier for the permission.", + "type": "string" + }, + "description": { + "description": "Human-readable description of what the permission does. Tauri internal convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", + "type": [ + "string", + "null" + ] + }, + "commands": { + "description": "Allowed or denied commands when using this permission.", + "default": { + "allow": [], + "deny": [] + }, + "allOf": [ + { + "$ref": "#/definitions/Commands" + } + ] + }, + "scope": { + "description": "Allowed or denied scoped when using this permission.", + "allOf": [ + { + "$ref": "#/definitions/Scopes" + } + ] + }, + "platforms": { + "description": "Target platforms this permission applies. By default all platforms are affected by this permission.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Target" + } + } + } + }, + "Commands": { + "description": "Allowed and denied commands inside a permission.\n\nIf two commands clash inside of `allow` and `deny`, it should be denied by default.", + "type": "object", + "properties": { + "allow": { + "description": "Allowed command.", + "default": [], + "type": "array", + "items": { + "type": "string" + } + }, + "deny": { + "description": "Denied command, which takes priority.", + "default": [], + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "Scopes": { + "description": "An argument for fine grained behavior control of Tauri commands.\n\nIt can be of any serde serializable type and is used to allow or prevent certain actions inside a Tauri command. The configured scope is passed to the command and will be enforced by the command implementation.\n\n## Example\n\n```json { \"allow\": [{ \"path\": \"$HOME/**\" }], \"deny\": [{ \"path\": \"$HOME/secret.txt\" }] } ```", + "type": "object", + "properties": { + "allow": { + "description": "Data that defines what is allowed by the scope.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + }, + "deny": { + "description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + "Value": { + "description": "All supported ACL values.", + "anyOf": [ + { + "description": "Represents a null JSON value.", + "type": "null" + }, + { + "description": "Represents a [`bool`].", + "type": "boolean" + }, + { + "description": "Represents a valid ACL [`Number`].", + "allOf": [ + { + "$ref": "#/definitions/Number" + } + ] + }, + { + "description": "Represents a [`String`].", + "type": "string" + }, + { + "description": "Represents a list of other [`Value`]s.", + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + }, + { + "description": "Represents a map of [`String`] keys to [`Value`]s.", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/Value" + } + } + ] + }, + "Number": { + "description": "A valid ACL number.", + "anyOf": [ + { + "description": "Represents an [`i64`].", + "type": "integer", + "format": "int64" + }, + { + "description": "Represents a [`f64`].", + "type": "number", + "format": "double" + } + ] + }, + "Target": { + "description": "Platform target.", + "oneOf": [ + { + "description": "MacOS.", + "type": "string", + "enum": [ + "macOS" + ] + }, + { + "description": "Windows.", + "type": "string", + "enum": [ + "windows" + ] + }, + { + "description": "Linux.", + "type": "string", + "enum": [ + "linux" + ] + }, + { + "description": "Android.", + "type": "string", + "enum": [ + "android" + ] + }, + { + "description": "iOS.", + "type": "string", + "enum": [ + "iOS" + ] + } + ] + }, + "PermissionKind": { + "type": "string", + "oneOf": [ + { + "description": "Enables the check_permissions command without any pre-configured scope.", + "type": "string", + "const": "allow-check-permissions", + "markdownDescription": "Enables the check_permissions command without any pre-configured scope." + }, + { + "description": "Denies the check_permissions command without any pre-configured scope.", + "type": "string", + "const": "deny-check-permissions", + "markdownDescription": "Denies the check_permissions command without any pre-configured scope." + }, + { + "description": "Enables the clear_permissions command without any pre-configured scope.", + "type": "string", + "const": "allow-clear-permissions", + "markdownDescription": "Enables the clear_permissions command without any pre-configured scope." + }, + { + "description": "Denies the clear_permissions command without any pre-configured scope.", + "type": "string", + "const": "deny-clear-permissions", + "markdownDescription": "Denies the clear_permissions command without any pre-configured scope." + }, + { + "description": "Enables the clear_watch command without any pre-configured scope.", + "type": "string", + "const": "allow-clear-watch", + "markdownDescription": "Enables the clear_watch command without any pre-configured scope." + }, + { + "description": "Denies the clear_watch command without any pre-configured scope.", + "type": "string", + "const": "deny-clear-watch", + "markdownDescription": "Denies the clear_watch command without any pre-configured scope." + }, + { + "description": "Enables the get_current_position command without any pre-configured scope.", + "type": "string", + "const": "allow-get-current-position", + "markdownDescription": "Enables the get_current_position command without any pre-configured scope." + }, + { + "description": "Denies the get_current_position command without any pre-configured scope.", + "type": "string", + "const": "deny-get-current-position", + "markdownDescription": "Denies the get_current_position command without any pre-configured scope." + }, + { + "description": "Enables the request_permissions command without any pre-configured scope.", + "type": "string", + "const": "allow-request-permissions", + "markdownDescription": "Enables the request_permissions command without any pre-configured scope." + }, + { + "description": "Denies the request_permissions command without any pre-configured scope.", + "type": "string", + "const": "deny-request-permissions", + "markdownDescription": "Denies the request_permissions command without any pre-configured scope." + }, + { + "description": "Enables the watch_position command without any pre-configured scope.", + "type": "string", + "const": "allow-watch-position", + "markdownDescription": "Enables the watch_position command without any pre-configured scope." + }, + { + "description": "Denies the watch_position command without any pre-configured scope.", + "type": "string", + "const": "deny-watch-position", + "markdownDescription": "Denies the watch_position command without any pre-configured scope." + } + ] + } + } +} \ No newline at end of file diff --git a/plugins/authenticator/rollup.config.js b/plugins/geolocation/rollup.config.js similarity index 60% rename from plugins/authenticator/rollup.config.js rename to plugins/geolocation/rollup.config.js index 977dfac8..1f349ec8 100644 --- a/plugins/authenticator/rollup.config.js +++ b/plugins/geolocation/rollup.config.js @@ -2,6 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { createConfig } from "../../shared/rollup.config.js"; +import { createConfig } from '../../shared/rollup.config.js' -export default createConfig(); +export default createConfig() diff --git a/plugins/geolocation/src/commands.rs b/plugins/geolocation/src/commands.rs new file mode 100644 index 00000000..d2cae848 --- /dev/null +++ b/plugins/geolocation/src/commands.rs @@ -0,0 +1,42 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use tauri::{command, ipc::Channel, AppHandle, Runtime}; + +use crate::{GeolocationExt, PermissionStatus, PermissionType, Position, PositionOptions, Result}; + +#[command] +pub(crate) async fn get_current_position( + app: AppHandle, + options: Option, +) -> Result { + app.geolocation().get_current_position(options) +} + +#[command] +pub(crate) async fn watch_position( + app: AppHandle, + options: PositionOptions, + channel: Channel, +) -> Result<()> { + app.geolocation().watch_position_inner(options, channel) +} + +#[command] +pub(crate) async fn clear_watch(app: AppHandle, channel_id: u32) -> Result<()> { + app.geolocation().clear_watch(channel_id) +} + +#[command] +pub(crate) async fn check_permissions(app: AppHandle) -> Result { + app.geolocation().check_permissions() +} + +#[command] +pub(crate) async fn request_permissions( + app: AppHandle, + permissions: Option>, +) -> Result { + app.geolocation().request_permissions(permissions) +} diff --git a/plugins/geolocation/src/desktop.rs b/plugins/geolocation/src/desktop.rs new file mode 100644 index 00000000..00da1fad --- /dev/null +++ b/plugins/geolocation/src/desktop.rs @@ -0,0 +1,95 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use serde::{de::DeserializeOwned, Serialize}; +use tauri::{ + ipc::{Channel, InvokeResponseBody}, + plugin::PluginApi, + AppHandle, Runtime, +}; + +use crate::models::*; + +pub fn init( + app: &AppHandle, + _api: PluginApi, +) -> crate::Result> { + Ok(Geolocation(app.clone())) +} + +/// Access to the geolocation APIs. +pub struct Geolocation(AppHandle); + +impl Geolocation { + pub fn get_current_position( + &self, + _options: Option, + ) -> crate::Result { + Ok(Position::default()) + } + + pub fn watch_position( + &self, + options: PositionOptions, + callback: F, + ) -> crate::Result { + let channel = Channel::new(move |event| { + let payload = match event { + InvokeResponseBody::Json(payload) => serde_json::from_str::(&payload) + .unwrap_or_else(|error| { + WatchEvent::Error(format!( + "Couldn't deserialize watch event payload: `{error}`" + )) + }), + _ => WatchEvent::Error("Unexpected watch event payload.".to_string()), + }; + + callback(payload); + + Ok(()) + }); + let id = channel.id(); + + self.watch_position_inner(options, channel)?; + + Ok(id) + } + + pub(crate) fn watch_position_inner( + &self, + _options: PositionOptions, + _callback_channel: Channel, + ) -> crate::Result<()> { + Ok(()) + } + + pub fn clear_watch(&self, _channel_id: u32) -> crate::Result<()> { + Ok(()) + } + + pub fn check_permissions(&self) -> crate::Result { + Ok(PermissionStatus::default()) + } + + pub fn request_permissions( + &self, + _permissions: Option>, + ) -> crate::Result { + Ok(PermissionStatus::default()) + } +} + +#[derive(Serialize)] +#[allow(unused)] // TODO: +struct WatchPayload { + options: PositionOptions, + channel: Channel, +} + +#[derive(Serialize)] +#[serde(rename_all = "camelCase")] +#[allow(unused)] // TODO: +struct ClearWatchPayload { + channel_id: u32, +} diff --git a/plugins/geolocation/src/error.rs b/plugins/geolocation/src/error.rs new file mode 100644 index 00000000..0fba5445 --- /dev/null +++ b/plugins/geolocation/src/error.rs @@ -0,0 +1,30 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use serde::{ser::Serializer, Serialize}; + +pub type Result = std::result::Result; + +// TODO: Improve Error handling (different typed errors instead of one (stringified) PluginInvokeError for all mobile errors) + +#[derive(Debug, thiserror::Error)] +#[cfg_attr(feature = "specta", derive(specta::Type))] +pub enum Error { + #[cfg(mobile)] + #[error(transparent)] + PluginInvoke( + #[cfg_attr(feature = "specta", serde(skip))] + #[from] + tauri::plugin::mobile::PluginInvokeError, + ), +} + +impl Serialize for Error { + fn serialize(&self, serializer: S) -> std::result::Result + where + S: Serializer, + { + serializer.serialize_str(self.to_string().as_ref()) + } +} diff --git a/plugins/geolocation/src/lib.rs b/plugins/geolocation/src/lib.rs new file mode 100644 index 00000000..588f96e3 --- /dev/null +++ b/plugins/geolocation/src/lib.rs @@ -0,0 +1,58 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use tauri::{ + plugin::{Builder, TauriPlugin}, + Manager, Runtime, +}; + +pub use models::*; + +#[cfg(desktop)] +mod desktop; +#[cfg(mobile)] +mod mobile; + +mod commands; +mod error; +mod models; + +pub use error::{Error, Result}; + +#[cfg(desktop)] +pub use desktop::Geolocation; +#[cfg(mobile)] +pub use mobile::Geolocation; + +/// Extensions to [`tauri::App`], [`tauri::AppHandle`], [`tauri::WebviewWindow`], [`tauri::Webview`] and [`tauri::Window`] to access the geolocation APIs. +pub trait GeolocationExt { + fn geolocation(&self) -> &Geolocation; +} + +impl> crate::GeolocationExt for T { + fn geolocation(&self) -> &Geolocation { + self.state::>().inner() + } +} + +/// Initializes the plugin. +pub fn init() -> TauriPlugin { + Builder::new("geolocation") + .invoke_handler(tauri::generate_handler![ + commands::get_current_position, + commands::watch_position, + commands::clear_watch, + commands::check_permissions, + commands::request_permissions + ]) + .setup(|app, api| { + #[cfg(mobile)] + let geolocation = mobile::init(app, api)?; + #[cfg(desktop)] + let geolocation = desktop::init(app, api)?; + app.manage(geolocation); + Ok(()) + }) + .build() +} diff --git a/plugins/geolocation/src/mobile.rs b/plugins/geolocation/src/mobile.rs new file mode 100644 index 00000000..48a3f5de --- /dev/null +++ b/plugins/geolocation/src/mobile.rs @@ -0,0 +1,119 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use serde::{de::DeserializeOwned, Serialize}; +use tauri::{ + ipc::{Channel, InvokeResponseBody}, + plugin::{PluginApi, PluginHandle}, + AppHandle, Runtime, +}; + +use crate::models::*; + +#[cfg(target_os = "android")] +const PLUGIN_IDENTIFIER: &str = "app.tauri.geolocation"; + +#[cfg(target_os = "ios")] +tauri::ios_plugin_binding!(init_plugin_geolocation); + +// initializes the Kotlin or Swift plugin classes +pub fn init( + _app: &AppHandle, + api: PluginApi, +) -> crate::Result> { + #[cfg(target_os = "android")] + let handle = api.register_android_plugin(PLUGIN_IDENTIFIER, "GeolocationPlugin")?; + #[cfg(target_os = "ios")] + let handle = api.register_ios_plugin(init_plugin_geolocation)?; + Ok(Geolocation(handle)) +} + +/// Access to the geolocation APIs. +pub struct Geolocation(PluginHandle); + +impl Geolocation { + pub fn get_current_position( + &self, + options: Option, + ) -> crate::Result { + // TODO: We may have to send over None if that's better on Android + self.0 + .run_mobile_plugin("getCurrentPosition", options.unwrap_or_default()) + .map_err(Into::into) + } + + /// Register a position watcher. This method returns an id to use in `clear_watch`. + pub fn watch_position( + &self, + options: PositionOptions, + callback: F, + ) -> crate::Result { + let channel = Channel::new(move |event| { + let payload = match event { + InvokeResponseBody::Json(payload) => serde_json::from_str::(&payload) + .unwrap_or_else(|error| { + WatchEvent::Error(format!( + "Couldn't deserialize watch event payload: `{error}`" + )) + }), + _ => WatchEvent::Error("Unexpected watch event payload.".to_string()), + }; + + callback(payload); + + Ok(()) + }); + let id = channel.id(); + + self.watch_position_inner(options, channel)?; + + Ok(id) + } + + pub(crate) fn watch_position_inner( + &self, + options: PositionOptions, + channel: Channel, + ) -> crate::Result<()> { + self.0 + .run_mobile_plugin("watchPosition", WatchPayload { options, channel }) + .map_err(Into::into) + } + + pub fn clear_watch(&self, channel_id: u32) -> crate::Result<()> { + self.0 + .run_mobile_plugin("clearWatch", ClearWatchPayload { channel_id }) + .map_err(Into::into) + } + + pub fn check_permissions(&self) -> crate::Result { + self.0 + .run_mobile_plugin("checkPermissions", ()) + .map_err(Into::into) + } + + pub fn request_permissions( + &self, + permissions: Option>, + ) -> crate::Result { + self.0 + .run_mobile_plugin( + "requestPermissions", + serde_json::json!({ "permissions": permissions }), + ) + .map_err(Into::into) + } +} + +#[derive(Serialize)] +struct WatchPayload { + options: PositionOptions, + channel: Channel, +} + +#[derive(Serialize)] +#[serde(rename_all = "camelCase")] +struct ClearWatchPayload { + channel_id: u32, +} diff --git a/plugins/geolocation/src/models.rs b/plugins/geolocation/src/models.rs new file mode 100644 index 00000000..c08bb27a --- /dev/null +++ b/plugins/geolocation/src/models.rs @@ -0,0 +1,96 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use serde::{Deserialize, Serialize}; +use tauri::plugin::PermissionState; + +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[cfg_attr(feature = "specta", derive(specta::Type))] +#[serde(rename_all = "camelCase")] +pub struct PermissionStatus { + /// Permission state for the location alias. + /// + /// On Android it requests/checks both ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION permissions. + /// + /// On iOS it requests/checks location permissions. + pub location: PermissionState, + /// Permissions state for the coarseLoaction alias. + /// + /// On Android it requests/checks ACCESS_COARSE_LOCATION. + /// + /// On Android 12+, users can choose between Approximate location (ACCESS_COARSE_LOCATION) and Precise location (ACCESS_FINE_LOCATION). + /// + /// On iOS it will have the same value as the `location` alias. + pub coarse_location: PermissionState, +} + +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[cfg_attr(feature = "specta", derive(specta::Type))] +#[serde(rename_all = "camelCase")] +pub struct PositionOptions { + /// High accuracy mode (such as GPS, if available) + /// Will be ignored on Android 12+ if users didn't grant the ACCESS_FINE_LOCATION permission. + pub enable_high_accuracy: bool, + /// The maximum wait time in milliseconds for location updates. + /// Default: 10000 + /// On Android the timeout gets ignored for getCurrentPosition. + /// Ignored on iOS. + // TODO: Handle Infinity and default to it. + // TODO: Should be u64+ but specta doesn't like that? + pub timeout: u32, + /// The maximum age in milliseconds of a possible cached position that is acceptable to return. + /// Default: 0 + /// Ignored on iOS. + // TODO: Handle Infinity. + // TODO: Should be u64+ but specta doesn't like that? + pub maximum_age: u32, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "specta", derive(specta::Type))] +#[serde(rename_all = "camelCase")] +pub enum PermissionType { + Location, + CoarseLocation, +} + +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[cfg_attr(feature = "specta", derive(specta::Type))] +#[serde(rename_all = "camelCase")] +pub struct Coordinates { + /// Latitude in decimal degrees. + pub latitude: f64, + /// Longitude in decimal degrees. + pub longitude: f64, + /// Accuracy level of the latitude and longitude coordinates in meters. + pub accuracy: f64, + /// Accuracy level of the altitude coordinate in meters, if available. + /// Available on all iOS versions and on Android 8 and above. + pub altitude_accuracy: Option, + /// The altitude the user is at, if available. + pub altitude: Option, + // The speed the user is traveling, if available. + pub speed: Option, + /// The heading the user is facing, if available. + pub heading: Option, +} + +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[cfg_attr(feature = "specta", derive(specta::Type))] +#[serde(rename_all = "camelCase")] +pub struct Position { + /// Creation time for these coordinates. + // TODO: Check if we're actually losing precision. + pub timestamp: u64, + /// The GPS coordinates along with the accuracy of the data. + pub coords: Coordinates, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "specta", derive(specta::Type))] +#[serde(untagged)] +pub enum WatchEvent { + Position(Position), + Error(String), +} diff --git a/plugins/authenticator/tsconfig.json b/plugins/geolocation/tsconfig.json similarity index 100% rename from plugins/authenticator/tsconfig.json rename to plugins/geolocation/tsconfig.json diff --git a/plugins/global-shortcut/CHANGELOG.md b/plugins/global-shortcut/CHANGELOG.md index fd670851..32f8748d 100644 --- a/plugins/global-shortcut/CHANGELOG.md +++ b/plugins/global-shortcut/CHANGELOG.md @@ -1,5 +1,77 @@ # Changelog +## \[2.2.0] + +- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other. + +## \[2.0.1] + +- [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7. + +## \[2.0.0] + +- [`e2c4dfb6`](https://github.com/tauri-apps/plugins-workspace/commit/e2c4dfb6af43e5dd8d9ceba232c315f5febd55c1) Update to tauri v2 stable release. + +## \[2.0.0-rc.1] + +- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri 2.0.0-rc.8 + +## \[2.0.0-rc.1] + +- [`2c00c029`](https://github.com/tauri-apps/plugins-workspace/commit/2c00c0292c9127b81567de46691e8c0f73557261) ([#1630](https://github.com/tauri-apps/plugins-workspace/pull/1630) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Fixed an issue that caused multi-word IIFE names to not be formatted correctly. For example the `barcode-scanner` was defined as `window.__TAURI_PLUGIN_CLIPBOARDMANAGER__` instead of `window.__TAURI_PLUGIN_CLIPBOARD_MANAGER__`. + +## \[2.0.0-rc.0] + +- [`9887d1`](https://github.com/tauri-apps/plugins-workspace/commit/9887d14bd0e971c4c0f5c1188fc4005d3fc2e29e) Update to tauri RC. + +## \[2.0.0-beta.8] + +- [`99d6ac0f`](https://github.com/tauri-apps/plugins-workspace/commit/99d6ac0f9506a6a4a1aa59c728157190a7441af6) ([#1606](https://github.com/tauri-apps/plugins-workspace/pull/1606) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) The JS packages now specify the *minimum* `@tauri-apps/api` version instead of a single exact version. +- [`6de87966`](https://github.com/tauri-apps/plugins-workspace/commit/6de87966ecc00ad9d91c25be452f1f46bd2b7e1f) ([#1597](https://github.com/tauri-apps/plugins-workspace/pull/1597) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Update to tauri beta.25. + +## \[2.0.0-beta.7] + +- [`381a466d`](https://github.com/tauri-apps/plugins-workspace/commit/381a466db344e59a76b2a4d5785b2a0b64d4d373) ([#1117](https://github.com/tauri-apps/plugins-workspace/pull/1117) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Refactored the JS APIs: + + - Enhanced `register` and `unregister` to take either a single shortcut or an array. + - Removed `registerAll` instead use `register` with an array. +- [`22a17980`](https://github.com/tauri-apps/plugins-workspace/commit/22a17980ff4f6f8c40adb1b8f4ffc6dae2fe7e30) ([#1537](https://github.com/tauri-apps/plugins-workspace/pull/1537) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri beta.24. + +## \[2.0.0-beta.6] + +- [`76daee7a`](https://github.com/tauri-apps/plugins-workspace/commit/76daee7aafece34de3092c86e531cf9eb1138989) ([#1512](https://github.com/tauri-apps/plugins-workspace/pull/1512) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Update to tauri beta.23. + +## \[2.0.0-beta.5] + +- [`9013854f`](https://github.com/tauri-apps/plugins-workspace/commit/9013854f42a49a230b9dbb9d02774765528a923f)([#1382](https://github.com/tauri-apps/plugins-workspace/pull/1382)) Update to tauri beta.22. + +## \[2.0.0-beta.4] + +- [`430bd6f4`](https://github.com/tauri-apps/plugins-workspace/commit/430bd6f4f379bee5d232ae6b098ae131db7f178a)([#1363](https://github.com/tauri-apps/plugins-workspace/pull/1363)) Update to tauri beta.20. + +## \[2.0.0-beta.3] + +- [`9c7eb359`](https://github.com/tauri-apps/plugins-workspace/commit/9c7eb35967ad10659eb4976bd6f77d9d270bfeed)([#1244](https://github.com/tauri-apps/plugins-workspace/pull/1244)) Refactored APIs to introduce new pressed and released events: + + - Added `ShortcutEvent` and `ShortcutState` types in Rust. + - Changed the handler function passed to `GlobalShortcut::on_shortcut`, `GlobalShortcut::on_all_shortcuts` and `Builder::with_handler` to take a 3rd argument of type `ShortcutEvent`. + - Added `ShortcutEvent` interface in JS. + - Changed `ShortcutHandler` type alias (which affects the JS `register` and `registerAll` APIs) to take `ShortcutEvent` instead of a string. +- [`bd1ed590`](https://github.com/tauri-apps/plugins-workspace/commit/bd1ed5903ffcce5500310dac1e59e8c67674ef1e)([#1237](https://github.com/tauri-apps/plugins-workspace/pull/1237)) Update to tauri beta.17. + +## \[2.0.0-beta.3] + +- [`a04ea2f`](https://github.com/tauri-apps/plugins-workspace/commit/a04ea2f38294d5a3987578283badc8eec87a7752)([#1071](https://github.com/tauri-apps/plugins-workspace/pull/1071)) The global API script is now only added to the binary when the `withGlobalTauri` config is true. +- [`62dafda`](https://github.com/tauri-apps/plugins-workspace/commit/62dafda6526899b407a7c5a1bb269c5c0dfb2630)([#969](https://github.com/tauri-apps/plugins-workspace/pull/969)) **Breaking change** Refactored the plugin Rust APIs for better DX and flexibility: + + - Changed `Builder::with_handler` to be a method instead of a static method, it will also be triggered for any and all shortcuts even if the shortcut is registered through JS. + - Added `Builder::with_shortcut` and `Builder::with_shortcuts` to register shortcuts on the plugin builder. + - Added `on_shortcut` and `on_all_shortcuts` to register shortcuts with a handler. + +## \[2.0.0-beta.2] + +- [`99bea25`](https://github.com/tauri-apps/plugins-workspace/commit/99bea2559c2c0648c2519c50a18cd124dacef57b)([#1005](https://github.com/tauri-apps/plugins-workspace/pull/1005)) Update to tauri beta.8. + ## \[2.0.0-beta.1] - [`569defb`](https://github.com/tauri-apps/plugins-workspace/commit/569defbe9492e38938554bb7bdc1be9151456d21) Update to tauri beta.4. @@ -36,15 +108,3 @@ ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - te to alpha.11. - -## \[2.0.0-alpha.0] - -- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - \-apps/plugins-workspace/pull/371)) First v2 alpha release! - te to alpha.11. - -## \[2.0.0-alpha.0] - -- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! -717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/global-shortcut/Cargo.toml b/plugins/global-shortcut/Cargo.toml index 90cbaa58..a9ff1fe0 100644 --- a/plugins/global-shortcut/Cargo.toml +++ b/plugins/global-shortcut/Cargo.toml @@ -1,19 +1,27 @@ [package] name = "tauri-plugin-global-shortcut" -version = "2.0.0-beta.1" +version = "2.2.0" description = "Register global hotkeys listeners on your Tauri application." edition = { workspace = true } authors = { workspace = true } license = { workspace = true } rust-version = { workspace = true } +repository = { workspace = true } links = "tauri-plugin-global-shortcut" [package.metadata.docs.rs] -rustc-args = [ "--cfg", "docsrs" ] -rustdoc-args = [ "--cfg", "docsrs" ] +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs"] + +[package.metadata.platforms.support] +windows = { level = "full", notes = "" } +linux = { level = "full", notes = "" } +macos = { level = "full", notes = "" } +android = { level = "none", notes = "" } +ios = { level = "none", notes = "" } [build-dependencies] -tauri-plugin = { workspace = true, features = [ "build" ] } +tauri-plugin = { workspace = true, features = ["build"] } [dependencies] serde = { workspace = true } @@ -23,4 +31,4 @@ log = { workspace = true } thiserror = { workspace = true } [target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies] -global-hotkey = "0.2.1" +global-hotkey = { version = "0.6", features = ["serde"] } diff --git a/plugins/global-shortcut/README.md b/plugins/global-shortcut/README.md index 4bdb24f4..53e7b19f 100644 --- a/plugins/global-shortcut/README.md +++ b/plugins/global-shortcut/README.md @@ -2,11 +2,17 @@ Register global shortcuts. -- Supported platforms: Windows, Linux and macOS. +| Platform | Supported | +| -------- | --------- | +| Linux | ✓ | +| Windows | ✓ | +| macOS | ✓ | +| Android | x | +| iOS | x | ## Install -_This plugin requires a Rust version of at least **1.75**_ +_This plugin requires a Rust version of at least **1.77.2**_ There are three general methods of installation that we can recommend. @@ -21,7 +27,7 @@ Install the Core plugin by adding the following to your `Cargo.toml` file: ```toml # you can add the dependencies on the `[dependencies]` section if you do not target mobile [target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies] -tauri-plugin-global-shortcut = "2.0.0-beta" +tauri-plugin-global-shortcut = "2.0.0" # alternatively with Git: tauri-plugin-global-shortcut = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` @@ -49,7 +55,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-global-shortcut#v2 First you need to register the core plugin with Tauri: -`src-tauri/src/main.rs` +`src-tauri/src/lib.rs` ```rust fn main() { @@ -57,20 +63,24 @@ fn main() { .setup(|app| { #[cfg(desktop)] { - use tauri_plugin_global_shortcut::{Code, GlobalShortcutExt, Modifiers, Shortcut}; + use tauri::Manager; + use tauri_plugin_global_shortcut::{Code, Modifiers, ShortcutState}; - let ctrl_n_shortcut = Shortcut::new(Some(Modifiers::CONTROL), Code::KeyN); app.handle().plugin( - tauri_plugin_global_shortcut::Builder::with_handler(move |_app, shortcut| { - println!("{:?}", shortcut); - if shortcut == &ctrl_n_shortcut { - println!("Ctrl-N Detected!"); - } - }) - .build(), + tauri_plugin_global_shortcut::Builder::new() + .with_shortcuts(["ctrl+d", "alt+space"])? + .with_handler(|app, shortcut, event| { + if event.state == ShortcutState::Pressed { + if shortcut.matches(Modifiers::CONTROL, Code::KeyD) { + let _ = app.emit("shortcut-event", "Ctrl+D triggered"); + } + if shortcut.matches(Modifiers::ALT, Code::Space) { + let _ = app.emit("shortcut-event", "Alt+Space triggered"); + } + } + }) + .build(), )?; - - app.global_shortcut().register(ctrl_n_shortcut)?; } Ok(()) @@ -83,10 +93,12 @@ fn main() { Afterwards all the plugin's APIs are available through the JavaScript bindings: ```javascript -import { register } from "@tauri-apps/plugin-global-shortcut"; -await register("CommandOrControl+Shift+C", () => { - console.log("Shortcut triggered"); -}); +import { register } from '@tauri-apps/plugin-global-shortcut' +await register('CommandOrControl+Shift+C', (event) => { + if (event.state === 'Pressed') { + console.log('Shortcut triggered') + } +}) ``` ## Contributing diff --git a/plugins/global-shortcut/SECURITY.md b/plugins/global-shortcut/SECURITY.md new file mode 100644 index 00000000..4f09bbac --- /dev/null +++ b/plugins/global-shortcut/SECURITY.md @@ -0,0 +1,23 @@ +# Security Policy + +**Do not report security vulnerabilities through public GitHub issues.** + +**Please use the [Private Vulnerability Disclosure](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability) feature of GitHub.** + +Include as much of the following information: + +- Type of issue (e.g. improper input parsing, privilege escalation, etc.) +- The location of the affected source code (tag/branch/commit or direct URL) +- Any special configuration required to reproduce the issue +- The distribution affected or used to help us with reproduction of the issue +- Step-by-step instructions to reproduce the issue +- Ideally a reproduction repository +- Impact of the issue, including how an attacker might exploit the issue + +We prefer to receive reports in English. + +## Contact + +Please disclose a vulnerability or security relevant issue here: [https://github.com/tauri-apps/plugins-workspace/security/advisories/new](https://github.com/tauri-apps/plugins-workspace/security/advisories/new). + +Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app). diff --git a/plugins/global-shortcut/api-iife.js b/plugins/global-shortcut/api-iife.js new file mode 100644 index 00000000..8d4ae006 --- /dev/null +++ b/plugins/global-shortcut/api-iife.js @@ -0,0 +1 @@ +if("__TAURI__"in window){var __TAURI_PLUGIN_GLOBAL_SHORTCUT__=function(t){"use strict";function e(t,e,s,i){if("function"==typeof e||!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?i:"a"===s?i.call(t):i?i.value:e.get(t)}function s(t,e,s,i,r){if("function"==typeof e||!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,s),s}var i,r,n,a;"function"==typeof SuppressedError&&SuppressedError;const o="__TAURI_TO_IPC_KEY__";class c{constructor(t){i.set(this,void 0),r.set(this,0),n.set(this,[]),a.set(this,void 0),s(this,i,t||(()=>{})),this.id=function(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}((t=>{const o=t.index;if("end"in t)return void(o==e(this,r,"f")?this.cleanupCallback():s(this,a,o));const c=t.message;if(o==e(this,r,"f")){for(e(this,i,"f").call(this,c),s(this,r,e(this,r,"f")+1);e(this,r,"f")in e(this,n,"f");){const t=e(this,n,"f")[e(this,r,"f")];e(this,i,"f").call(this,t),delete e(this,n,"f")[e(this,r,"f")],s(this,r,e(this,r,"f")+1)}e(this,r,"f")===e(this,a,"f")&&this.cleanupCallback()}else e(this,n,"f")[o]=c}))}cleanupCallback(){Reflect.deleteProperty(window,`_${this.id}`)}set onmessage(t){s(this,i,t)}get onmessage(){return e(this,i,"f")}[(i=new WeakMap,r=new WeakMap,n=new WeakMap,a=new WeakMap,o)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[o]()}}async function u(t,e={},s){return window.__TAURI_INTERNALS__.invoke(t,e,s)}return t.isRegistered=async function(t){return await u("plugin:global-shortcut|is_registered",{shortcut:t})},t.register=async function(t,e){const s=new c;return s.onmessage=e,await u("plugin:global-shortcut|register",{shortcuts:Array.isArray(t)?t:[t],handler:s})},t.unregister=async function(t){return await u("plugin:global-shortcut|unregister",{shortcuts:Array.isArray(t)?t:[t]})},t.unregisterAll=async function(){return await u("plugin:global-shortcut|unregister_all",{})},t}({});Object.defineProperty(window.__TAURI__,"globalShortcut",{value:__TAURI_PLUGIN_GLOBAL_SHORTCUT__})} diff --git a/plugins/global-shortcut/build.rs b/plugins/global-shortcut/build.rs index 8c5c71df..20b7b7f8 100644 --- a/plugins/global-shortcut/build.rs +++ b/plugins/global-shortcut/build.rs @@ -2,14 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -const COMMANDS: &[&str] = &[ - "register", - "register_all", - "unregister", - "unregister_all", - "is_registered", -]; +const COMMANDS: &[&str] = &["register", "unregister", "unregister_all", "is_registered"]; fn main() { - tauri_plugin::Builder::new(COMMANDS).build(); + tauri_plugin::Builder::new(COMMANDS) + .global_api_script_path("./api-iife.js") + .build(); } diff --git a/plugins/global-shortcut/guest-js/index.ts b/plugins/global-shortcut/guest-js/index.ts index e9cd935f..13e8e50e 100644 --- a/plugins/global-shortcut/guest-js/index.ts +++ b/plugins/global-shortcut/guest-js/index.ts @@ -8,17 +8,38 @@ * @module */ -import { invoke, Channel } from "@tauri-apps/api/core"; +import { invoke, Channel } from '@tauri-apps/api/core' -export type ShortcutHandler = (shortcut: string) => void; +export interface ShortcutEvent { + shortcut: string + id: number + state: 'Released' | 'Pressed' +} + +export type ShortcutHandler = (event: ShortcutEvent) => void /** - * Register a global shortcut. + * Register a global shortcut or a list of shortcuts. + * + * The handler is called when any of the registered shortcuts are pressed by the user. + * + * If the shortcut is already taken by another application, the handler will not be triggered. + * Make sure the shortcut is as unique as possible while still taking user experience into consideration. + * * @example * ```typescript * import { register } from '@tauri-apps/plugin-global-shortcut'; - * await register('CommandOrControl+Shift+C', () => { - * console.log('Shortcut triggered'); + * + * // register a single hotkey + * await register('CommandOrControl+Shift+C', (event) => { + * if (event.state === "Pressed") { + * console.log('Shortcut triggered'); + * } + * }); + * + * // or register multiple hotkeys at once + * await register(['CommandOrControl+Shift+C', 'Alt+A'], (event) => { + * console.log(`Shortcut ${event.shortcut} triggered`); * }); * ``` * @@ -28,97 +49,75 @@ export type ShortcutHandler = (shortcut: string) => void; * @since 2.0.0 */ async function register( - shortcut: string, - handler: ShortcutHandler, + shortcuts: string | string[], + handler: ShortcutHandler ): Promise { - const h = new Channel(); - h.onmessage = handler; + const h = new Channel() + h.onmessage = handler - return await invoke("plugin:global-shortcut|register", { - shortcut, - handler: h, - }); + return await invoke('plugin:global-shortcut|register', { + shortcuts: Array.isArray(shortcuts) ? shortcuts : [shortcuts], + handler: h + }) } /** - * Register a collection of global shortcuts. + * Unregister a global shortcut or a list of shortcuts. + * * @example * ```typescript - * import { registerAll } from '@tauri-apps/plugin-global-shortcut'; - * await registerAll(['CommandOrControl+Shift+C', 'Ctrl+Alt+F12'], (shortcut) => { - * console.log(`Shortcut ${shortcut} triggered`); - * }); + * import { unregister } from '@tauri-apps/plugin-global-shortcut'; + * + * // unregister a single hotkey + * await unregister('CmdOrControl+Space'); + * + * // or unregister multiple hotkeys at the same time + * await unregister(['CmdOrControl+Space', 'Alt+A']); * ``` * - * @param shortcuts Array of shortcut definitions, modifiers and key separated by "+" e.g. CmdOrControl+Q - * @param handler Shortcut handler callback - takes the triggered shortcut as argument + * @param shortcut shortcut definition (modifiers and key separated by "+" e.g. CmdOrControl+Q), also accepts a list of shortcuts * * @since 2.0.0 */ -async function registerAll( - shortcuts: string[], - handler: ShortcutHandler, -): Promise { - const h = new Channel(); - h.onmessage = handler; - - return await invoke("plugin:global-shortcut|register_all", { - shortcuts, - handler: h, - }); +async function unregister(shortcuts: string | string[]): Promise { + return await invoke('plugin:global-shortcut|unregister', { + shortcuts: Array.isArray(shortcuts) ? shortcuts : [shortcuts] + }) } /** - * Determines whether the given shortcut is registered by this application or not. - * - * If the shortcut is registered by another application, it will still return `false`. + * Unregister all global shortcuts. * * @example * ```typescript - * import { isRegistered } from '@tauri-apps/plugin-global-shortcut'; - * const isRegistered = await isRegistered('CommandOrControl+P'); + * import { unregisterAll } from '@tauri-apps/plugin-global-shortcut'; + * await unregisterAll(); * ``` - * - * @param shortcut shortcut definition, modifiers and key separated by "+" e.g. CmdOrControl+Q - * * @since 2.0.0 */ -async function isRegistered(shortcut: string): Promise { - return await invoke("plugin:global-shortcut|is_registered", { - shortcut, - }); +async function unregisterAll(): Promise { + return await invoke('plugin:global-shortcut|unregister_all', {}) } /** - * Unregister a global shortcut. - * @example - * ```typescript - * import { unregister } from '@tauri-apps/plugin-global-shortcut'; - * await unregister('CmdOrControl+Space'); - * ``` + * Determines whether the given shortcut is registered by this application or not. * - * @param shortcut shortcut definition, modifiers and key separated by "+" e.g. CmdOrControl+Q + * If the shortcut is registered by another application, it will still return `false`. * - * @since 2.0.0 - */ -async function unregister(shortcut: string): Promise { - return await invoke("plugin:global-shortcut|unregister", { - shortcut, - }); -} - -/** - * Unregisters all shortcuts registered by the application. * @example * ```typescript - * import { unregisterAll } from '@tauri-apps/plugin-global-shortcut'; - * await unregisterAll(); + * import { isRegistered } from '@tauri-apps/plugin-global-shortcut'; + * const isRegistered = await isRegistered('CommandOrControl+P'); * ``` * + * @param shortcut shortcut definition, modifiers and key separated by "+" e.g. CmdOrControl+Q + * * @since 2.0.0 */ -async function unregisterAll(): Promise { - return await invoke("plugin:global-shortcut|unregister_all"); +async function isRegistered(shortcut: string): Promise { + return await invoke('plugin:global-shortcut|is_registered', { + shortcut + }) } -export { register, registerAll, isRegistered, unregister, unregisterAll }; +export { register, unregister, unregisterAll, isRegistered } diff --git a/plugins/global-shortcut/package.json b/plugins/global-shortcut/package.json index 3bfdf0b2..13f014b7 100644 --- a/plugins/global-shortcut/package.json +++ b/plugins/global-shortcut/package.json @@ -1,10 +1,11 @@ { "name": "@tauri-apps/plugin-global-shortcut", - "version": "2.0.0-beta.1", - "license": "MIT or APACHE-2.0", + "version": "2.2.0", + "license": "MIT OR Apache-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" ], + "repository": "https://github.com/tauri-apps/plugins-workspace", "type": "module", "types": "./dist-js/index.d.ts", "main": "./dist-js/index.cjs", @@ -23,6 +24,6 @@ "LICENSE" ], "dependencies": { - "@tauri-apps/api": "2.0.0-beta.2" + "@tauri-apps/api": "^2.0.0" } } diff --git a/plugins/global-shortcut/permissions/autogenerated/reference.md b/plugins/global-shortcut/permissions/autogenerated/reference.md index daff8aba..dedb1aef 100644 --- a/plugins/global-shortcut/permissions/autogenerated/reference.md +++ b/plugins/global-shortcut/permissions/autogenerated/reference.md @@ -1,42 +1,150 @@ -# Permissions +## Default Permission -## allow-is-registered +No features are enabled by default, as we believe +the shortcuts can be inherently dangerous and it is +application specific if specific shortcuts should be +registered or unregistered. + + +#### This default permission set includes the following: + + +## Permission Table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IdentifierDescription
+ +`global-shortcut:allow-is-registered` + + Enables the is_registered command without any pre-configured scope. -## deny-is-registered +
+ +`global-shortcut:deny-is-registered` + + Denies the is_registered command without any pre-configured scope. -## allow-register +
+ +`global-shortcut:allow-register` + + Enables the register command without any pre-configured scope. -## deny-register +
+ +`global-shortcut:deny-register` + + Denies the register command without any pre-configured scope. -## allow-register-all +
+ +`global-shortcut:allow-register-all` + + Enables the register_all command without any pre-configured scope. -## deny-register-all +
+ +`global-shortcut:deny-register-all` + + Denies the register_all command without any pre-configured scope. -## allow-unregister +
+ +`global-shortcut:allow-unregister` + + Enables the unregister command without any pre-configured scope. -## deny-unregister +
+ +`global-shortcut:deny-unregister` + + Denies the unregister command without any pre-configured scope. -## allow-unregister-all +
+ +`global-shortcut:allow-unregister-all` + + Enables the unregister_all command without any pre-configured scope. -## deny-unregister-all +
+ +`global-shortcut:deny-unregister-all` + + Denies the unregister_all command without any pre-configured scope. +
diff --git a/plugins/global-shortcut/permissions/default.toml b/plugins/global-shortcut/permissions/default.toml new file mode 100644 index 00000000..fd32c51e --- /dev/null +++ b/plugins/global-shortcut/permissions/default.toml @@ -0,0 +1,10 @@ +"$schema" = "schemas/schema.json" +[default] +description = """ +No features are enabled by default, as we believe +the shortcuts can be inherently dangerous and it is +application specific if specific shortcuts should be +registered or unregistered. +""" + +permissions = [] diff --git a/plugins/global-shortcut/permissions/schemas/schema.json b/plugins/global-shortcut/permissions/schemas/schema.json index 7b601b8a..1224869c 100644 --- a/plugins/global-shortcut/permissions/schemas/schema.json +++ b/plugins/global-shortcut/permissions/schemas/schema.json @@ -17,7 +17,6 @@ }, "set": { "description": "A list of permissions sets defined", - "default": [], "type": "array", "items": { "$ref": "#/definitions/PermissionSet" @@ -50,7 +49,7 @@ "minimum": 1.0 }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -112,7 +111,7 @@ "type": "string" }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri internal convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -132,12 +131,21 @@ }, "scope": { "description": "Allowed or denied scoped when using this permission.", - "default": {}, "allOf": [ { "$ref": "#/definitions/Scopes" } ] + }, + "platforms": { + "description": "Target platforms this permission applies. By default all platforms are affected by this permission.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Target" + } } } }, @@ -164,7 +172,7 @@ } }, "Scopes": { - "description": "A restriction of the command/endpoint functionality.\n\nIt can be of any serde serializable type and is used for allowing or preventing certain actions inside a Tauri command.\n\nThe scope is passed to the command and handled/enforced by the command itself.", + "description": "An argument for fine grained behavior control of Tauri commands.\n\nIt can be of any serde serializable type and is used to allow or prevent certain actions inside a Tauri command. The configured scope is passed to the command and will be enforced by the command implementation.\n\n## Example\n\n```json { \"allow\": [{ \"path\": \"$HOME/**\" }], \"deny\": [{ \"path\": \"$HOME/secret.txt\" }] } ```", "type": "object", "properties": { "allow": { @@ -178,7 +186,7 @@ } }, "deny": { - "description": "Data that defines what is denied by the scope.", + "description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.", "type": [ "array", "null" @@ -243,78 +251,114 @@ } ] }, - "PermissionKind": { - "type": "string", + "Target": { + "description": "Platform target.", "oneOf": [ { - "description": "allow-is-registered -> Enables the is_registered command without any pre-configured scope.", + "description": "MacOS.", "type": "string", "enum": [ - "allow-is-registered" + "macOS" ] }, { - "description": "deny-is-registered -> Denies the is_registered command without any pre-configured scope.", + "description": "Windows.", "type": "string", "enum": [ - "deny-is-registered" + "windows" ] }, { - "description": "allow-register -> Enables the register command without any pre-configured scope.", + "description": "Linux.", "type": "string", "enum": [ - "allow-register" + "linux" ] }, { - "description": "deny-register -> Denies the register command without any pre-configured scope.", + "description": "Android.", "type": "string", "enum": [ - "deny-register" + "android" ] }, { - "description": "allow-register-all -> Enables the register_all command without any pre-configured scope.", + "description": "iOS.", "type": "string", "enum": [ - "allow-register-all" + "iOS" ] + } + ] + }, + "PermissionKind": { + "type": "string", + "oneOf": [ + { + "description": "Enables the is_registered command without any pre-configured scope.", + "type": "string", + "const": "allow-is-registered", + "markdownDescription": "Enables the is_registered command without any pre-configured scope." }, { - "description": "deny-register-all -> Denies the register_all command without any pre-configured scope.", + "description": "Denies the is_registered command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-register-all" - ] + "const": "deny-is-registered", + "markdownDescription": "Denies the is_registered command without any pre-configured scope." }, { - "description": "allow-unregister -> Enables the unregister command without any pre-configured scope.", + "description": "Enables the register command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-unregister" - ] + "const": "allow-register", + "markdownDescription": "Enables the register command without any pre-configured scope." }, { - "description": "deny-unregister -> Denies the unregister command without any pre-configured scope.", + "description": "Denies the register command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-unregister" - ] + "const": "deny-register", + "markdownDescription": "Denies the register command without any pre-configured scope." }, { - "description": "allow-unregister-all -> Enables the unregister_all command without any pre-configured scope.", + "description": "Enables the register_all command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-unregister-all" - ] + "const": "allow-register-all", + "markdownDescription": "Enables the register_all command without any pre-configured scope." }, { - "description": "deny-unregister-all -> Denies the unregister_all command without any pre-configured scope.", + "description": "Denies the register_all command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-unregister-all" - ] + "const": "deny-register-all", + "markdownDescription": "Denies the register_all command without any pre-configured scope." + }, + { + "description": "Enables the unregister command without any pre-configured scope.", + "type": "string", + "const": "allow-unregister", + "markdownDescription": "Enables the unregister command without any pre-configured scope." + }, + { + "description": "Denies the unregister command without any pre-configured scope.", + "type": "string", + "const": "deny-unregister", + "markdownDescription": "Denies the unregister command without any pre-configured scope." + }, + { + "description": "Enables the unregister_all command without any pre-configured scope.", + "type": "string", + "const": "allow-unregister-all", + "markdownDescription": "Enables the unregister_all command without any pre-configured scope." + }, + { + "description": "Denies the unregister_all command without any pre-configured scope.", + "type": "string", + "const": "deny-unregister-all", + "markdownDescription": "Denies the unregister_all command without any pre-configured scope." + }, + { + "description": "No features are enabled by default, as we believe\nthe shortcuts can be inherently dangerous and it is\napplication specific if specific shortcuts should be\nregistered or unregistered.\n", + "type": "string", + "const": "default", + "markdownDescription": "No features are enabled by default, as we believe\nthe shortcuts can be inherently dangerous and it is\napplication specific if specific shortcuts should be\nregistered or unregistered.\n" } ] } diff --git a/plugins/global-shortcut/rollup.config.js b/plugins/global-shortcut/rollup.config.js index 977dfac8..1f349ec8 100644 --- a/plugins/global-shortcut/rollup.config.js +++ b/plugins/global-shortcut/rollup.config.js @@ -2,6 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { createConfig } from "../../shared/rollup.config.js"; +import { createConfig } from '../../shared/rollup.config.js' -export default createConfig(); +export default createConfig() diff --git a/plugins/global-shortcut/src/api-iife.js b/plugins/global-shortcut/src/api-iife.js deleted file mode 100644 index 54da2b59..00000000 --- a/plugins/global-shortcut/src/api-iife.js +++ /dev/null @@ -1 +0,0 @@ -if("__TAURI__"in window){var __TAURI_PLUGIN_GLOBALSHORTCUT__=function(t){"use strict";function e(t,e,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(t):n?n.value:e.get(t)}var r;"function"==typeof SuppressedError&&SuppressedError;class n{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,r.set(this,(()=>{})),this.id=function(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}((t=>{e(this,r,"f").call(this,t)}))}set onmessage(t){!function(t,e,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?o.call(t,r):o?o.value=r:e.set(t,r)}(this,r,t,"f")}get onmessage(){return e(this,r,"f")}toJSON(){return`__CHANNEL__:${this.id}`}}async function o(t,e={},r){return window.__TAURI_INTERNALS__.invoke(t,e,r)}return r=new WeakMap,t.isRegistered=async function(t){return await o("plugin:global-shortcut|is_registered",{shortcut:t})},t.register=async function(t,e){const r=new n;return r.onmessage=e,await o("plugin:global-shortcut|register",{shortcut:t,handler:r})},t.registerAll=async function(t,e){const r=new n;return r.onmessage=e,await o("plugin:global-shortcut|register_all",{shortcuts:t,handler:r})},t.unregister=async function(t){return await o("plugin:global-shortcut|unregister",{shortcut:t})},t.unregisterAll=async function(){return await o("plugin:global-shortcut|unregister_all")},t}({});Object.defineProperty(window.__TAURI__,"globalShortcut",{value:__TAURI_PLUGIN_GLOBALSHORTCUT__})} diff --git a/plugins/global-shortcut/src/error.rs b/plugins/global-shortcut/src/error.rs index 8157000c..37392b32 100644 --- a/plugins/global-shortcut/src/error.rs +++ b/plugins/global-shortcut/src/error.rs @@ -5,9 +5,14 @@ use serde::{Serialize, Serializer}; #[derive(Debug, thiserror::Error)] +#[non_exhaustive] pub enum Error { #[error("{0}")] GlobalHotkey(String), + #[error(transparent)] + RecvError(#[from] std::sync::mpsc::RecvError), + #[error(transparent)] + Tauri(#[from] tauri::Error), } impl Serialize for Error { @@ -24,3 +29,9 @@ impl From for Error { Self::GlobalHotkey(value.to_string()) } } + +impl From for Error { + fn from(value: global_hotkey::hotkey::HotKeyParseError) -> Self { + Self::GlobalHotkey(value.to_string()) + } +} diff --git a/plugins/global-shortcut/src/lib.rs b/plugins/global-shortcut/src/lib.rs index eed72a99..450bb598 100644 --- a/plugins/global-shortcut/src/lib.rs +++ b/plugins/global-shortcut/src/lib.rs @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -//! [![](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/global-shortcut/banner.png)](https://github.com/tauri-apps/plugins-workspace/tree/v2/plugins/global-shortcut) -//! //! Register global shortcuts. //! //! - Supported platforms: Windows, Linux and macOS. @@ -20,34 +18,25 @@ use std::{ sync::{Arc, Mutex}, }; -pub use global_hotkey::hotkey::{Code, HotKey as Shortcut, Modifiers}; -use global_hotkey::{GlobalHotKeyEvent, GlobalHotKeyManager}; +use global_hotkey::GlobalHotKeyEvent; +pub use global_hotkey::{ + hotkey::{Code, HotKey as Shortcut, Modifiers}, + GlobalHotKeyEvent as ShortcutEvent, HotKeyState as ShortcutState, +}; +use serde::Serialize; use tauri::{ ipc::Channel, plugin::{Builder as PluginBuilder, TauriPlugin}, - AppHandle, Manager, Runtime, State, Window, + AppHandle, Manager, Runtime, State, }; mod error; pub use error::Error; type Result = std::result::Result; -type HotKeyId = u32; -type HandlerFn = Box, &Shortcut) + Send + Sync + 'static>; -enum ShortcutSource { - Ipc(Channel), - Rust, -} - -impl Clone for ShortcutSource { - fn clone(&self) -> Self { - match self { - Self::Ipc(channel) => Self::Ipc(channel.clone()), - Self::Rust => Self::Rust, - } - } -} +type HotKeyId = u32; +type HandlerFn = Box, &Shortcut, ShortcutEvent) + Send + Sync + 'static>; pub struct ShortcutWrapper(Shortcut); @@ -58,109 +47,183 @@ impl From for ShortcutWrapper { } impl TryFrom<&str> for ShortcutWrapper { - type Error = global_hotkey::Error; + type Error = global_hotkey::hotkey::HotKeyParseError; fn try_from(value: &str) -> std::result::Result { Shortcut::from_str(value).map(ShortcutWrapper) } } -struct RegisteredShortcut { - source: ShortcutSource, - shortcut: (Shortcut, Option), +struct RegisteredShortcut { + shortcut: Shortcut, + handler: Option>>, } +struct GlobalHotKeyManager(global_hotkey::GlobalHotKeyManager); + +/// SAFETY: we ensure it is run on main thread only +unsafe impl Send for GlobalHotKeyManager {} +/// SAFETY: we ensure it is run on main thread only +unsafe impl Sync for GlobalHotKeyManager {} + pub struct GlobalShortcut { #[allow(dead_code)] app: AppHandle, - manager: std::result::Result, - shortcuts: Arc>>, + manager: Arc, + shortcuts: Arc>>>, +} + +macro_rules! run_main_thread { + ($handle:expr, $manager:expr, |$m:ident| $ex:expr) => {{ + let (tx, rx) = std::sync::mpsc::channel(); + let manager = $manager.clone(); + let task = move || { + let f = |$m: &GlobalHotKeyManager| $ex; + let _ = tx.send(f(&*manager)); + }; + $handle.run_on_main_thread(task)?; + rx.recv()? + }}; } impl GlobalShortcut { - fn register_internal( + fn register_internal, &Shortcut, ShortcutEvent) + Send + Sync + 'static>( &self, - shortcut: (Shortcut, Option), - source: ShortcutSource, + shortcut: Shortcut, + handler: Option, ) -> Result<()> { - let id = shortcut.0.id(); - acquire_manager(&self.manager)?.register(shortcut.0)?; + let id = shortcut.id(); + let handler = handler.map(|h| Arc::new(Box::new(h) as HandlerFn)); + run_main_thread!(self.app, self.manager, |m| m.0.register(shortcut))?; self.shortcuts .lock() .unwrap() - .insert(id, RegisteredShortcut { source, shortcut }); + .insert(id, RegisteredShortcut { shortcut, handler }); Ok(()) } - fn register_all_internal)>>( - &self, - shortcuts: S, - source: ShortcutSource, - ) -> Result<()> { - let hotkeys = shortcuts - .into_iter() - .collect::)>>(); + fn register_multiple_internal(&self, shortcuts: S, handler: Option) -> Result<()> + where + S: IntoIterator, + F: Fn(&AppHandle, &Shortcut, ShortcutEvent) + Send + Sync + 'static, + { + let handler = handler.map(|h| Arc::new(Box::new(h) as HandlerFn)); - let manager = acquire_manager(&self.manager)?; - let mut shortcuts = self.shortcuts.lock().unwrap(); - for hotkey in hotkeys { - manager.register(hotkey.0)?; + let hotkeys = shortcuts.into_iter().collect::>(); + let mut shortcuts = self.shortcuts.lock().unwrap(); + for shortcut in hotkeys { + run_main_thread!(self.app, self.manager, |m| m.0.register(shortcut))?; shortcuts.insert( - hotkey.0.id(), + shortcut.id(), RegisteredShortcut { - source: source.clone(), - shortcut: hotkey, + shortcut, + handler: handler.clone(), }, ); } Ok(()) } +} - pub fn register>(&self, shortcut: S) -> Result<()> +impl GlobalShortcut { + /// Register a shortcut. + pub fn register(&self, shortcut: S) -> Result<()> where + S: TryInto, S::Error: std::error::Error, { - self.register_internal((try_into_shortcut(shortcut)?, None), ShortcutSource::Rust) + self.register_internal( + try_into_shortcut(shortcut)?, + None::, &Shortcut, ShortcutEvent)>, + ) } - pub fn register_all, S: IntoIterator>( - &self, - shortcuts: S, - ) -> Result<()> + /// Register a shortcut with a handler. + pub fn on_shortcut(&self, shortcut: S, handler: F) -> Result<()> + where + S: TryInto, + S::Error: std::error::Error, + F: Fn(&AppHandle, &Shortcut, ShortcutEvent) + Send + Sync + 'static, + { + self.register_internal(try_into_shortcut(shortcut)?, Some(handler)) + } + + /// Register multiple shortcuts. + pub fn register_multiple(&self, shortcuts: S) -> Result<()> where + S: IntoIterator, + T: TryInto, T::Error: std::error::Error, { let mut s = Vec::new(); for shortcut in shortcuts { - s.push((try_into_shortcut(shortcut)?, None)); + s.push(try_into_shortcut(shortcut)?); } - self.register_all_internal(s, ShortcutSource::Rust) + self.register_multiple_internal(s, None::, &Shortcut, ShortcutEvent)>) } + /// Register multiple shortcuts with a handler. + pub fn on_shortcuts(&self, shortcuts: S, handler: F) -> Result<()> + where + S: IntoIterator, + T: TryInto, + T::Error: std::error::Error, + F: Fn(&AppHandle, &Shortcut, ShortcutEvent) + Send + Sync + 'static, + { + let mut s = Vec::new(); + for shortcut in shortcuts { + s.push(try_into_shortcut(shortcut)?); + } + self.register_multiple_internal(s, Some(handler)) + } + + /// Unregister a shortcut pub fn unregister>(&self, shortcut: S) -> Result<()> where S::Error: std::error::Error, { - acquire_manager(&self.manager)? - .unregister(try_into_shortcut(shortcut)?) - .map_err(Into::into) + let shortcut = try_into_shortcut(shortcut)?; + run_main_thread!(self.app, self.manager, |m| m.0.unregister(shortcut))?; + self.shortcuts.lock().unwrap().remove(&shortcut.id()); + Ok(()) } - pub fn unregister_all, S: IntoIterator>( + /// Unregister multiple shortcuts. + pub fn unregister_multiple, S: IntoIterator>( &self, shortcuts: S, ) -> Result<()> where T::Error: std::error::Error, { - let mut s = Vec::new(); + let mut mapped_shortcuts = Vec::new(); for shortcut in shortcuts { - s.push(try_into_shortcut(shortcut)?); + mapped_shortcuts.push(try_into_shortcut(shortcut)?); + } + + { + let mapped_shortcuts = mapped_shortcuts.clone(); + #[rustfmt::skip] + run_main_thread!(self.app, self.manager, |m| m.0.unregister_all(&mapped_shortcuts))?; } - acquire_manager(&self.manager)? - .unregister_all(&s) - .map_err(Into::into) + + let mut shortcuts = self.shortcuts.lock().unwrap(); + for s in mapped_shortcuts { + shortcuts.remove(&s.id()); + } + + Ok(()) + } + + /// Unregister all registered shortcuts. + pub fn unregister_all(&self) -> Result<()> { + let mut shortcuts = self.shortcuts.lock().unwrap(); + let hotkeys = std::mem::take(&mut *shortcuts); + let hotkeys = hotkeys.values().map(|s| s.shortcut).collect::>(); + #[rustfmt::skip] + let res = run_main_thread!(self.app, self.manager, |m| m.0.unregister_all(hotkeys.as_slice())); + res.map_err(Into::into) } /// Determines whether the given shortcut is registered by this application or not. @@ -188,14 +251,6 @@ impl> GlobalShortcutExt for T { } } -fn acquire_manager( - manager: &std::result::Result, -) -> Result<&GlobalHotKeyManager> { - manager - .as_ref() - .map_err(|e| Error::GlobalHotkey(e.to_string())) -} - fn parse_shortcut>(shortcut: S) -> Result { shortcut.as_ref().parse().map_err(Into::into) } @@ -210,53 +265,63 @@ where .map_err(|e| Error::GlobalHotkey(e.to_string())) } -#[tauri::command] -fn register( - _window: Window, - global_shortcut: State<'_, GlobalShortcut>, +#[derive(Clone, Serialize)] +struct ShortcutJsEvent { shortcut: String, - handler: Channel, -) -> Result<()> { - global_shortcut.register_internal( - (parse_shortcut(&shortcut)?, Some(shortcut)), - ShortcutSource::Ipc(handler), - ) + id: u32, + state: ShortcutState, } #[tauri::command] -fn register_all( - _window: Window, +fn register( + _app: AppHandle, global_shortcut: State<'_, GlobalShortcut>, shortcuts: Vec, - handler: Channel, + handler: Channel, ) -> Result<()> { let mut hotkeys = Vec::new(); + + let mut shortcut_map = HashMap::new(); for shortcut in shortcuts { - hotkeys.push((parse_shortcut(&shortcut)?, Some(shortcut))); + let hotkey = parse_shortcut(&shortcut)?; + shortcut_map.insert(hotkey.id(), shortcut); + hotkeys.push(hotkey); } - global_shortcut.register_all_internal(hotkeys, ShortcutSource::Ipc(handler)) + + global_shortcut.register_multiple_internal( + hotkeys, + Some( + move |_app: &AppHandle, shortcut: &Shortcut, e: ShortcutEvent| { + let js_event = ShortcutJsEvent { + id: e.id, + state: e.state, + shortcut: shortcut.into_string(), + }; + let _ = handler.send(js_event); + }, + ), + ) } #[tauri::command] fn unregister( _app: AppHandle, global_shortcut: State<'_, GlobalShortcut>, - shortcut: String, + shortcuts: Vec, ) -> Result<()> { - global_shortcut.unregister(parse_shortcut(shortcut)?) + let mut hotkeys = Vec::new(); + for shortcut in shortcuts { + hotkeys.push(parse_shortcut(&shortcut)?); + } + global_shortcut.unregister_multiple(hotkeys) } #[tauri::command] fn unregister_all( _app: AppHandle, global_shortcut: State<'_, GlobalShortcut>, - shortcuts: Vec, ) -> Result<()> { - let mut hotkeys = Vec::new(); - for shortcut in shortcuts { - hotkeys.push(parse_shortcut(&shortcut)?); - } - global_shortcut.unregister_all(hotkeys) + global_shortcut.unregister_all() } #[tauri::command] @@ -269,12 +334,14 @@ fn is_registered( } pub struct Builder { + shortcuts: Vec, handler: Option>, } impl Default for Builder { fn default() -> Self { Self { + shortcuts: Vec::new(), handler: Default::default(), } } @@ -285,49 +352,81 @@ impl Builder { Self::default() } - pub fn with_handler, &Shortcut) + Send + Sync + 'static>( + /// Add a shortcut to be registerd. + pub fn with_shortcut(mut self, shortcut: T) -> Result + where + T: TryInto, + T::Error: std::error::Error, + { + self.shortcuts.push(try_into_shortcut(shortcut)?); + Ok(self) + } + + /// Add multiple shortcuts to be registerd. + pub fn with_shortcuts(mut self, shortcuts: S) -> Result + where + S: IntoIterator, + T: TryInto, + T::Error: std::error::Error, + { + for shortcut in shortcuts { + self.shortcuts.push(try_into_shortcut(shortcut)?); + } + + Ok(self) + } + + /// Specify a global shortcut handler that will be triggered for any and all shortcuts. + pub fn with_handler, &Shortcut, ShortcutEvent) + Send + Sync + 'static>( + mut self, handler: F, ) -> Self { - Self { - handler: Some(Box::new(handler)), - } + self.handler.replace(Box::new(handler)); + self } pub fn build(self) -> TauriPlugin { let handler = self.handler; + let shortcuts = self.shortcuts; PluginBuilder::new("global-shortcut") - .js_init_script(include_str!("api-iife.js").to_string()) .invoke_handler(tauri::generate_handler![ register, - register_all, unregister, unregister_all, - is_registered + is_registered, ]) .setup(move |app, _api| { - let shortcuts = - Arc::new(Mutex::new(HashMap::::new())); + let manager = global_hotkey::GlobalHotKeyManager::new()?; + let mut store = HashMap::>::new(); + for shortcut in shortcuts { + manager.register(shortcut)?; + store.insert( + shortcut.id(), + RegisteredShortcut { + shortcut, + handler: None, + }, + ); + } + + let shortcuts = Arc::new(Mutex::new(store)); let shortcuts_ = shortcuts.clone(); let app_handle = app.clone(); GlobalHotKeyEvent::set_event_handler(Some(move |e: GlobalHotKeyEvent| { if let Some(shortcut) = shortcuts_.lock().unwrap().get(&e.id) { - match &shortcut.source { - ShortcutSource::Ipc(channel) => { - let _ = channel.send(&shortcut.shortcut.1); - } - ShortcutSource::Rust => { - if let Some(handler) = &handler { - handler(&app_handle, &shortcut.shortcut.0); - } - } + if let Some(handler) = &shortcut.handler { + handler(&app_handle, &shortcut.shortcut, e); + } + if let Some(handler) = &handler { + handler(&app_handle, &shortcut.shortcut, e); } } })); app.manage(GlobalShortcut { app: app.clone(), - manager: GlobalHotKeyManager::new(), + manager: Arc::new(GlobalHotKeyManager(manager)), shortcuts, }); Ok(()) diff --git a/plugins/haptics/CHANGELOG.md b/plugins/haptics/CHANGELOG.md new file mode 100644 index 00000000..aa3fbbd8 --- /dev/null +++ b/plugins/haptics/CHANGELOG.md @@ -0,0 +1,49 @@ +# Changelog + +## \[2.2.4] + +- [`a1b3fa27`](https://github.com/tauri-apps/plugins-workspace/commit/a1b3fa27f11022c9b6622b4fab12d93239eb05de) ([#2515](https://github.com/tauri-apps/plugins-workspace/pull/2515) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Re-exported the `Geolocation`, `Haptics`, `Notification`, and `Os` structs so that they show up on docs.rs. + +## \[2.2.3] + +- [`406e6f48`](https://github.com/tauri-apps/plugins-workspace/commit/406e6f484cdc13d35c50fb949f7489ca9eeccc44) ([#2323](https://github.com/tauri-apps/plugins-workspace/pull/2323) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Fixed an issue that caused build failures when the `haptics` or `geolocation` plugin was used without their `specta` feature flag enabled. + +## \[2.2.2] + +- [`c9c13a0f`](https://github.com/tauri-apps/plugins-workspace/commit/c9c13a0fe7cdaac223843f5ba33176252f8e22f5) ([#2316](https://github.com/tauri-apps/plugins-workspace/pull/2316) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) **Breaking change:** `specta` integration is now behind a `specta` feature flag like in Tauri. +- [`c9c13a0f`](https://github.com/tauri-apps/plugins-workspace/commit/c9c13a0fe7cdaac223843f5ba33176252f8e22f5) ([#2316](https://github.com/tauri-apps/plugins-workspace/pull/2316) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Unlock and widen `specta` version range to match Tauri. No API changes. + +## \[2.2.1] + +- [`fb67ab2b`](https://github.com/tauri-apps/plugins-workspace/commit/fb67ab2b926502bfc20d6b43fbdd156691ea8526) ([#2281](https://github.com/tauri-apps/plugins-workspace/pull/2281) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Added `specta-util` to fix a "dependency not found" compilation error. + +## \[2.2.0] + +- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other. + +## \[2.0.1] + +- [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7. + +## \[2.0.0] + +- [`e2c4dfb6`](https://github.com/tauri-apps/plugins-workspace/commit/e2c4dfb6af43e5dd8d9ceba232c315f5febd55c1) Update to tauri v2 stable release. + +## \[2.0.0-rc.1] + +- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri 2.0.0-rc.8 + +## \[2.0.0-rc.2] + +- [`b9147758`](https://github.com/tauri-apps/plugins-workspace/commit/b914775898c2bee7ceb20bd17ee595005cd17a64) ([#1679](https://github.com/tauri-apps/plugins-workspace/pull/1679) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Explicitly set a minimum macOS version for the Swift package. + +## \[2.0.0-rc.1] + +### changes + +- [`6b079cfd`](https://github.com/tauri-apps/plugins-workspace/commit/6b079cfdd107c94abc2c7300f6af00bac3ff4040) ([#1649](https://github.com/tauri-apps/plugins-workspace/pull/1649) by [@ahqsoftwares](https://github.com/tauri-apps/plugins-workspace/../../ahqsoftwares)) Remove targetSdk from build.kts files as it is deprecated and will be removed from DSL v9.0 + +## \[2.0.0-rc.0] + +- [`9606089b`](https://github.com/tauri-apps/plugins-workspace/commit/9606089b2add4a17f80ed5a09d59ce94824bd672) ([#1599](https://github.com/tauri-apps/plugins-workspace/pull/1599)) Initial release. +- [`9887d1`](https://github.com/tauri-apps/plugins-workspace/commit/9887d14bd0e971c4c0f5c1188fc4005d3fc2e29e) Update to tauri RC. diff --git a/plugins/haptics/Cargo.toml b/plugins/haptics/Cargo.toml new file mode 100644 index 00000000..34c80bab --- /dev/null +++ b/plugins/haptics/Cargo.toml @@ -0,0 +1,38 @@ +[package] +name = "tauri-plugin-haptics" +description = "Haptic feedback and vibrations on Android and iOS" +version = "2.2.4" +edition = { workspace = true } +authors = { workspace = true } +license = { workspace = true } +repository = { workspace = true } +links = "tauri-plugin-haptics" + +[package.metadata.docs.rs] +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs"] +targets = ["x86_64-linux-android"] + +[package.metadata.platforms.support] +windows = { level = "none", notes = "" } +linux = { level = "none", notes = "" } +macos = { level = "none", notes = "" } +android = { level = "full", notes = "" } +ios = { level = "full", notes = "" } + +[build-dependencies] +tauri-plugin = { workspace = true, features = ["build"] } + +[dependencies] +serde = { workspace = true } +serde_json = { workspace = true } +tauri = { workspace = true } +log = { workspace = true } +thiserror = { workspace = true } +specta = { workspace = true, optional = true } + +[target.'cfg(target_os = "ios")'.dependencies] +tauri = { workspace = true, features = ["wry"] } + +[features] +specta = ["dep:specta", "tauri/specta"] diff --git a/plugins/haptics/LICENSE.spdx b/plugins/haptics/LICENSE.spdx new file mode 100644 index 00000000..cdd0df5a --- /dev/null +++ b/plugins/haptics/LICENSE.spdx @@ -0,0 +1,20 @@ +SPDXVersion: SPDX-2.1 +DataLicense: CC0-1.0 +PackageName: tauri +DataFormat: SPDXRef-1 +PackageSupplier: Organization: The Tauri Programme in the Commons Conservancy +PackageHomePage: https://tauri.app +PackageLicenseDeclared: Apache-2.0 +PackageLicenseDeclared: MIT +PackageCopyrightText: 2019-2022, The Tauri Programme in the Commons Conservancy +PackageSummary: Tauri is a rust project that enables developers to make secure +and small desktop applications using a web frontend. + +PackageComment: The package includes the following libraries; see +Relationship information. + +Created: 2019-05-20T09:00:00Z +PackageDownloadLocation: git://github.com/tauri-apps/tauri +PackageDownloadLocation: git+https://github.com/tauri-apps/tauri.git +PackageDownloadLocation: git+ssh://github.com/tauri-apps/tauri.git +Creator: Person: Daniel Thompson-Yvetot \ No newline at end of file diff --git a/plugins/haptics/LICENSE_APACHE-2.0 b/plugins/haptics/LICENSE_APACHE-2.0 new file mode 100644 index 00000000..4947287f --- /dev/null +++ b/plugins/haptics/LICENSE_APACHE-2.0 @@ -0,0 +1,177 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/plugins/haptics/LICENSE_MIT b/plugins/haptics/LICENSE_MIT new file mode 100644 index 00000000..4d754725 --- /dev/null +++ b/plugins/haptics/LICENSE_MIT @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 - Present Tauri Apps Contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/plugins/haptics/README.md b/plugins/haptics/README.md new file mode 100644 index 00000000..44118812 --- /dev/null +++ b/plugins/haptics/README.md @@ -0,0 +1,144 @@ +![haptics](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/haptics/banner.png) + +Haptic feedback and vibrations on Android and iOS. + +There are no standards/requirements for vibration support on Android, so the `feedback` APIs may not work correctly on more affordable phones, including recently released ones. + +| Platform | Supported | +| -------- | --------- | +| Linux | x | +| Windows | x | +| macOS | x | +| Android | ✓ | +| iOS | ✓ | + +## Install + +_This plugin requires a Rust version of at least **1.77.2**_ + +There are three general methods of installation that we can recommend. + +1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked) +2. Pull sources directly from Github using git tags / revision hashes (most secure) +3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use) + +Install the Core plugin by adding the following to your `Cargo.toml` file: + +`src-tauri/Cargo.toml` + +```toml +[dependencies] +tauri-plugin-haptics = "2.0.0" +# alternatively with Git: +tauri-plugin-haptics = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } +``` + +You can install the JavaScript Guest bindings using your preferred JavaScript package manager: + +> Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use. + + + +```sh +pnpm add @tauri-apps/plugin-haptics +# or +npm add @tauri-apps/plugin-haptics +# or +yarn add @tauri-apps/plugin-haptics + +# alternatively with Git: +pnpm add https://github.com/tauri-apps/tauri-plugin-haptics#v2 +# or +npm add https://github.com/tauri-apps/tauri-plugin-haptics#v2 +# or +yarn add https://github.com/tauri-apps/tauri-plugin-haptics#v2 +``` + +## Usage + +First you need to register the core plugin with Tauri: + +`src-tauri/src/lib.rs` + +```rust +fn main() { + tauri::Builder::default() + .plugin(tauri_plugin_haptics::init()) + .run(tauri::generate_context!()) + .expect("error while running tauri application"); +} +``` + +Second, add the required permissions in the project: + +`src-tauri/capabilities/default.json` + +```json + "permissions": [ + "haptics:allow-impact-feedback", + "haptics:allow-notification-feedback", + "haptics:allow-selection-feedback", + "haptics:allow-vibrate" + ] +``` + +Afterwards all the plugin's APIs are available through the JavaScript guest bindings: + +```javascript +import { + vibrate, + impactFeedback, + notificationFeedback, + selectionFeedback +} from '@tauri-apps/plugin-haptics' + +await vibrate(1) +await impactFeedback('medium') +await notificationFeedback('warning') +await selectionFeedback() +``` + +## Contributing + +PRs accepted. Please make sure to read the Contributing Guide before making a pull request. + +## Contributed By + + + + + + + + +
+ + CrabNebula + + + + Rescue.co + +
+ +## Partners + + + + + + + +
+ + CrabNebula + +
+ +For the complete list of sponsors please visit our [website](https://tauri.app#sponsors) and [Open Collective](https://opencollective.com/tauri). + +## License + +Code: (c) 2015 - Present - The Tauri Programme within The Commons Conservancy. + +MIT or MIT/Apache 2.0 where applicable. diff --git a/plugins/haptics/SECURITY.md b/plugins/haptics/SECURITY.md new file mode 100644 index 00000000..4f09bbac --- /dev/null +++ b/plugins/haptics/SECURITY.md @@ -0,0 +1,23 @@ +# Security Policy + +**Do not report security vulnerabilities through public GitHub issues.** + +**Please use the [Private Vulnerability Disclosure](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability) feature of GitHub.** + +Include as much of the following information: + +- Type of issue (e.g. improper input parsing, privilege escalation, etc.) +- The location of the affected source code (tag/branch/commit or direct URL) +- Any special configuration required to reproduce the issue +- The distribution affected or used to help us with reproduction of the issue +- Step-by-step instructions to reproduce the issue +- Ideally a reproduction repository +- Impact of the issue, including how an attacker might exploit the issue + +We prefer to receive reports in English. + +## Contact + +Please disclose a vulnerability or security relevant issue here: [https://github.com/tauri-apps/plugins-workspace/security/advisories/new](https://github.com/tauri-apps/plugins-workspace/security/advisories/new). + +Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app). diff --git a/plugins/clipboard-manager/.gitignore b/plugins/haptics/android/.gitignore similarity index 53% rename from plugins/clipboard-manager/.gitignore rename to plugins/haptics/android/.gitignore index 1b0b469d..c0f21ec2 100644 --- a/plugins/clipboard-manager/.gitignore +++ b/plugins/haptics/android/.gitignore @@ -1 +1,2 @@ +/build /.tauri diff --git a/plugins/haptics/android/build.gradle.kts b/plugins/haptics/android/build.gradle.kts new file mode 100644 index 00000000..7de1d372 --- /dev/null +++ b/plugins/haptics/android/build.gradle.kts @@ -0,0 +1,45 @@ +plugins { + id("com.android.library") + id("org.jetbrains.kotlin.android") +} + +android { + namespace = "app.tauri.haptics" + compileSdk = 34 + + defaultConfig { + minSdk = 24 + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles("consumer-rules.pro") + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = "1.8" + } +} + +dependencies { + + implementation("androidx.core:core-ktx:1.9.0") + implementation("androidx.appcompat:appcompat:1.6.0") + implementation("com.google.android.material:material:1.7.0") + implementation("com.fasterxml.jackson.core:jackson-databind:2.15.3") + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test.ext:junit:1.1.5") + androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1") + implementation(project(":tauri-android")) +} diff --git a/plugins/haptics/android/proguard-rules.pro b/plugins/haptics/android/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/plugins/haptics/android/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/plugins/haptics/android/settings.gradle b/plugins/haptics/android/settings.gradle new file mode 100644 index 00000000..14a752e4 --- /dev/null +++ b/plugins/haptics/android/settings.gradle @@ -0,0 +1,2 @@ +include ':tauri-android' +project(':tauri-android').projectDir = new File('./.tauri/tauri-api') diff --git a/plugins/haptics/android/src/androidTest/java/ExampleInstrumentedTest.kt b/plugins/haptics/android/src/androidTest/java/ExampleInstrumentedTest.kt new file mode 100644 index 00000000..1b408ac8 --- /dev/null +++ b/plugins/haptics/android/src/androidTest/java/ExampleInstrumentedTest.kt @@ -0,0 +1,28 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +package app.tauri.haptics + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("app.tauri.haptics", appContext.packageName) + } +} diff --git a/plugins/haptics/android/src/main/AndroidManifest.xml b/plugins/haptics/android/src/main/AndroidManifest.xml new file mode 100644 index 00000000..042e61a7 --- /dev/null +++ b/plugins/haptics/android/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + diff --git a/plugins/haptics/android/src/main/java/HapticsPlugin.kt b/plugins/haptics/android/src/main/java/HapticsPlugin.kt new file mode 100644 index 00000000..5a6bf1b8 --- /dev/null +++ b/plugins/haptics/android/src/main/java/HapticsPlugin.kt @@ -0,0 +1,143 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +package app.tauri.haptics + +import android.app.Activity +import android.content.Context +import android.os.Build +import android.os.VibrationEffect +import android.os.Vibrator +import android.os.VibratorManager +import app.tauri.Logger +import app.tauri.annotation.Command +import app.tauri.annotation.InvokeArg +import app.tauri.annotation.TauriPlugin +import app.tauri.haptics.patterns.ImpactPatternHeavy +import app.tauri.haptics.patterns.ImpactPatternLight +import app.tauri.haptics.patterns.ImpactPatternMedium +import app.tauri.haptics.patterns.ImpactPatternRigid +import app.tauri.haptics.patterns.ImpactPatternSoft +import app.tauri.haptics.patterns.NotificationPatternError +import app.tauri.haptics.patterns.NotificationPatternSuccess +import app.tauri.haptics.patterns.NotificationPatternWarning +import app.tauri.haptics.patterns.Pattern +import app.tauri.haptics.patterns.SelectionPattern +import app.tauri.plugin.Invoke +import app.tauri.plugin.Plugin +import com.fasterxml.jackson.annotation.JsonProperty + +@InvokeArg +class HapticsOptions { + var duration: Long = 300 +} + +@InvokeArg +class NotificationFeedbackArgs { + val type: NotificationFeedbackType = NotificationFeedbackType.Success +} + +@InvokeArg +enum class NotificationFeedbackType { + @JsonProperty("success") + Success, + @JsonProperty("warning") + Warning, + @JsonProperty("error") + Error; + + fun into(): Pattern { + return when(this) { + Success -> NotificationPatternSuccess + Warning -> NotificationPatternWarning + Error -> NotificationPatternError + } + } +} + +@InvokeArg +class ImpactFeedbackArgs { + val style: ImpactFeedbackStyle = ImpactFeedbackStyle.Medium +} + +@InvokeArg +enum class ImpactFeedbackStyle { + @JsonProperty("light") + Light, + @JsonProperty("medium") + Medium, + @JsonProperty("heavy") + Heavy, + @JsonProperty("soft") + Soft, + @JsonProperty("rigid") + Rigid; + + fun into(): Pattern { + return when(this) { + Light -> ImpactPatternLight + Medium -> ImpactPatternMedium + Heavy -> ImpactPatternHeavy + Soft -> ImpactPatternSoft + Rigid -> ImpactPatternRigid + } + } +} + +@TauriPlugin +class HapticsPlugin(private val activity: Activity): Plugin(activity) { + private val vibrator: Vibrator = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { + val vibManager = activity.applicationContext.getSystemService(Context.VIBRATOR_MANAGER_SERVICE) as VibratorManager + vibManager.defaultVibrator + } else { + @Suppress("DEPRECATION") + activity.applicationContext.getSystemService(Context.VIBRATOR_SERVICE) as Vibrator + } + + // + // TAURI COMMANDS + // + + @Command + fun vibrate(invoke: Invoke) { + val args = invoke.parseArgs(HapticsOptions::class.java) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + vibrator.vibrate(VibrationEffect.createOneShot(args.duration, VibrationEffect.DEFAULT_AMPLITUDE)) + } else { + vibrator.vibrate(args.duration) + } + invoke.resolve() + } + + @Command + fun impactFeedback(invoke: Invoke) { + val args = invoke.parseArgs(ImpactFeedbackArgs::class.java) + vibratePattern(args.style.into()) + invoke.resolve() + } + + @Command + fun notificationFeedback(invoke: Invoke) { + val args = invoke.parseArgs(NotificationFeedbackArgs::class.java) + vibratePattern(args.type.into()) + invoke.resolve() + } + + // TODO: Consider breaking this up into Start,Change,End like capacitor + @Command + fun selectionFeedback(invoke: Invoke) { + vibratePattern(SelectionPattern) + invoke.resolve() + } + + // INTERNAL FUNCTIONS + + private fun vibratePattern(pattern: Pattern) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + vibrator.vibrate(VibrationEffect.createWaveform(pattern.timings, pattern.amplitudes, -1)) + } else { + vibrator.vibrate(pattern.oldSDKPattern, -1) + } + } +} diff --git a/plugins/haptics/android/src/main/java/patterns/Impact.kt b/plugins/haptics/android/src/main/java/patterns/Impact.kt new file mode 100644 index 00000000..d40e750d --- /dev/null +++ b/plugins/haptics/android/src/main/java/patterns/Impact.kt @@ -0,0 +1,35 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +package app.tauri.haptics.patterns + +val ImpactPatternLight = Pattern( + longArrayOf(0, 50), + intArrayOf(0, 30), + longArrayOf(0, 20) +) + +val ImpactPatternMedium = Pattern( + longArrayOf(0, 43), + intArrayOf(0, 50), + longArrayOf(0, 43) +) + +val ImpactPatternHeavy = Pattern( + longArrayOf(0, 60), + intArrayOf(0, 70), + longArrayOf(0, 61) +) + +val ImpactPatternSoft = Pattern( + longArrayOf(0, 50), + intArrayOf(0, 30), + longArrayOf(0, 20) +) + +val ImpactPatternRigid = Pattern( + longArrayOf(0, 43), + intArrayOf(0, 50), + longArrayOf(0, 43) +) \ No newline at end of file diff --git a/plugins/haptics/android/src/main/java/patterns/Notification.kt b/plugins/haptics/android/src/main/java/patterns/Notification.kt new file mode 100644 index 00000000..2f70c23e --- /dev/null +++ b/plugins/haptics/android/src/main/java/patterns/Notification.kt @@ -0,0 +1,23 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +package app.tauri.haptics.patterns + +val NotificationPatternSuccess = Pattern( + longArrayOf(0, 40, 100, 40), + intArrayOf(0, 50, 0, 60), + longArrayOf(0, 40, 100, 40) +) + +val NotificationPatternWarning = Pattern( + longArrayOf(0, 40, 120, 60), + intArrayOf(0, 40, 0, 60), + longArrayOf(0, 40, 120, 60) +) + +val NotificationPatternError = Pattern( + longArrayOf(0, 60, 100, 40, 80, 50), + intArrayOf(0, 50, 0, 40, 0, 50), + longArrayOf(0, 60, 100, 40, 80, 50) +) diff --git a/plugins/haptics/android/src/main/java/patterns/Pattern.kt b/plugins/haptics/android/src/main/java/patterns/Pattern.kt new file mode 100644 index 00000000..5f99b02c --- /dev/null +++ b/plugins/haptics/android/src/main/java/patterns/Pattern.kt @@ -0,0 +1,11 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +package app.tauri.haptics.patterns + +class Pattern ( + val timings: LongArray, + val amplitudes: IntArray, + val oldSDKPattern: LongArray +) {} \ No newline at end of file diff --git a/plugins/haptics/android/src/main/java/patterns/Selection.kt b/plugins/haptics/android/src/main/java/patterns/Selection.kt new file mode 100644 index 00000000..02dce4c2 --- /dev/null +++ b/plugins/haptics/android/src/main/java/patterns/Selection.kt @@ -0,0 +1,11 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +package app.tauri.haptics.patterns + +val SelectionPattern = Pattern ( + timings = longArrayOf(0, 50), + amplitudes = intArrayOf(0, 30), + oldSDKPattern = longArrayOf(0, 70) +) \ No newline at end of file diff --git a/plugins/haptics/android/src/test/java/ExampleUnitTest.kt b/plugins/haptics/android/src/test/java/ExampleUnitTest.kt new file mode 100644 index 00000000..562188f0 --- /dev/null +++ b/plugins/haptics/android/src/test/java/ExampleUnitTest.kt @@ -0,0 +1,21 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +package app.tauri.haptics + +import org.junit.Test + +import org.junit.Assert.* + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class ExampleUnitTest { + @Test + fun addition_isCorrect() { + assertEquals(4, 2 + 2) + } +} diff --git a/plugins/haptics/api-iife.js b/plugins/haptics/api-iife.js new file mode 100644 index 00000000..5cccb15f --- /dev/null +++ b/plugins/haptics/api-iife.js @@ -0,0 +1 @@ +if("__TAURI__"in window){var __TAURI_PLUGIN_HAPTICS__=function(r){"use strict";async function t(r,t={},e){return window.__TAURI_INTERNALS__.invoke(r,t,e)}var e;"function"==typeof SuppressedError&&SuppressedError,function(r){r.WINDOW_RESIZED="tauri://resize",r.WINDOW_MOVED="tauri://move",r.WINDOW_CLOSE_REQUESTED="tauri://close-requested",r.WINDOW_DESTROYED="tauri://destroyed",r.WINDOW_FOCUS="tauri://focus",r.WINDOW_BLUR="tauri://blur",r.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",r.WINDOW_THEME_CHANGED="tauri://theme-changed",r.WINDOW_CREATED="tauri://window-created",r.WEBVIEW_CREATED="tauri://webview-created",r.DRAG_ENTER="tauri://drag-enter",r.DRAG_OVER="tauri://drag-over",r.DRAG_DROP="tauri://drag-drop",r.DRAG_LEAVE="tauri://drag-leave"}(e||(e={}));const a={async vibrate(r){try{return{status:"ok",data:await t("plugin:haptics|vibrate",{duration:r})}}catch(r){if(r instanceof Error)throw r;return{status:"error",error:r}}},async impactFeedback(r){try{return{status:"ok",data:await t("plugin:haptics|impact_feedback",{style:r})}}catch(r){if(r instanceof Error)throw r;return{status:"error",error:r}}},async notificationFeedback(r){try{return{status:"ok",data:await t("plugin:haptics|notification_feedback",{type:r})}}catch(r){if(r instanceof Error)throw r;return{status:"error",error:r}}},async selectionFeedback(){try{return{status:"ok",data:await t("plugin:haptics|selection_feedback")}}catch(r){if(r instanceof Error)throw r;return{status:"error",error:r}}}},{vibrate:i,impactFeedback:c,notificationFeedback:n,selectionFeedback:o}=a;return r.impactFeedback=c,r.notificationFeedback=n,r.selectionFeedback=o,r.vibrate=i,r}({});Object.defineProperty(window.__TAURI__,"haptics",{value:__TAURI_PLUGIN_HAPTICS__})} diff --git a/plugins/haptics/build.rs b/plugins/haptics/build.rs new file mode 100644 index 00000000..2556cb67 --- /dev/null +++ b/plugins/haptics/build.rs @@ -0,0 +1,23 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +const COMMANDS: &[&str] = &[ + "vibrate", + "impact_feedback", + "notification_feedback", + "selection_feedback", +]; + +fn main() { + let result = tauri_plugin::Builder::new(COMMANDS) + .global_api_script_path("./api-iife.js") + .android_path("android") + .ios_path("ios") + .try_build(); + + // when building documentation for Android the plugin build result is always Err() and is irrelevant to the crate documentation build + if !(cfg!(docsrs) && std::env::var("TARGET").unwrap().contains("android")) { + result.unwrap(); + } +} diff --git a/plugins/haptics/contributors/crabnebula.svg b/plugins/haptics/contributors/crabnebula.svg new file mode 100644 index 00000000..40e24131 --- /dev/null +++ b/plugins/haptics/contributors/crabnebula.svg @@ -0,0 +1,31 @@ + \ No newline at end of file diff --git a/plugins/haptics/contributors/rescue.png b/plugins/haptics/contributors/rescue.png new file mode 100644 index 00000000..2b5916f4 Binary files /dev/null and b/plugins/haptics/contributors/rescue.png differ diff --git a/plugins/haptics/guest-js/bindings.ts b/plugins/haptics/guest-js/bindings.ts new file mode 100644 index 00000000..d12920d8 --- /dev/null +++ b/plugins/haptics/guest-js/bindings.ts @@ -0,0 +1,140 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +// @ts-nocheck +// This file was generated by [tauri-specta](https://github.com/oscartbeaumont/tauri-specta). Do not edit this file manually. + +/** user-defined commands **/ + +export const commands = { + async vibrate(duration: number): Promise> { + try { + return { + status: 'ok', + data: await TAURI_INVOKE('plugin:haptics|vibrate', { duration }) + } + } catch (e) { + if (e instanceof Error) throw e + else return { status: 'error', error: e as any } + } + }, + async impactFeedback( + style: ImpactFeedbackStyle + ): Promise> { + try { + return { + status: 'ok', + data: await TAURI_INVOKE('plugin:haptics|impact_feedback', { style }) + } + } catch (e) { + if (e instanceof Error) throw e + else return { status: 'error', error: e as any } + } + }, + async notificationFeedback( + type: NotificationFeedbackType + ): Promise> { + try { + return { + status: 'ok', + data: await TAURI_INVOKE('plugin:haptics|notification_feedback', { + type + }) + } + } catch (e) { + if (e instanceof Error) throw e + else return { status: 'error', error: e as any } + } + }, + async selectionFeedback(): Promise> { + try { + return { + status: 'ok', + data: await TAURI_INVOKE('plugin:haptics|selection_feedback') + } + } catch (e) { + if (e instanceof Error) throw e + else return { status: 'error', error: e as any } + } + } +} + +/** user-defined events **/ + +/* export const events = __makeEvents__<{ + randomNumber: RandomNumber; +}>({ + randomNumber: "plugin:haptics:random-number", +}); */ + +/** user-defined statics **/ + +/** user-defined types **/ + +export type Error = never +export type ImpactFeedbackStyle = + | 'light' + | 'medium' + | 'heavy' + | 'soft' + | 'rigid' +export type NotificationFeedbackType = 'success' | 'warning' | 'error' +//export type RandomNumber = number; + +/** tauri-specta globals **/ + +import { invoke as TAURI_INVOKE } from '@tauri-apps/api/core' +import * as TAURI_API_EVENT from '@tauri-apps/api/event' +import { type WebviewWindow as __WebviewWindow__ } from '@tauri-apps/api/webviewWindow' + +type __EventObj__ = { + listen: ( + cb: TAURI_API_EVENT.EventCallback + ) => ReturnType> + once: ( + cb: TAURI_API_EVENT.EventCallback + ) => ReturnType> + emit: T extends null + ? (payload?: T) => ReturnType + : (payload: T) => ReturnType +} + +export type Result = + | { status: 'ok'; data: T } + | { status: 'error'; error: E } + +function __makeEvents__>( + mappings: Record +) { + return new Proxy( + {} as unknown as { + [K in keyof T]: __EventObj__ & { + (handle: __WebviewWindow__): __EventObj__ + } + }, + { + get: (_, event) => { + const name = mappings[event as keyof T] + + return new Proxy((() => {}) as any, { + apply: (_, __, [window]: [__WebviewWindow__]) => ({ + listen: (arg: any) => window.listen(name, arg), + once: (arg: any) => window.once(name, arg), + emit: (arg: any) => window.emit(name, arg) + }), + get: (_, command: keyof __EventObj__) => { + switch (command) { + case 'listen': + return (arg: any) => TAURI_API_EVENT.listen(name, arg) + case 'once': + return (arg: any) => TAURI_API_EVENT.once(name, arg) + case 'emit': + return (arg: any) => TAURI_API_EVENT.emit(name, arg) + } + } + }) + } + } + ) +} diff --git a/plugins/haptics/guest-js/index.ts b/plugins/haptics/guest-js/index.ts new file mode 100644 index 00000000..23485bdf --- /dev/null +++ b/plugins/haptics/guest-js/index.ts @@ -0,0 +1,18 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +/* eslint-disable @typescript-eslint/unbound-method */ + +import { commands } from './bindings' + +export const { + vibrate, + impactFeedback, + notificationFeedback, + selectionFeedback +} = commands + +export { ImpactFeedbackStyle, NotificationFeedbackType } from './bindings' + +// export { events }; diff --git a/plugins/haptics/ios/.gitignore b/plugins/haptics/ios/.gitignore new file mode 100644 index 00000000..5922fdaa --- /dev/null +++ b/plugins/haptics/ios/.gitignore @@ -0,0 +1,10 @@ +.DS_Store +/.build +/Packages +/*.xcodeproj +xcuserdata/ +DerivedData/ +.swiftpm/config/registries.json +.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata +.netrc +Package.resolved diff --git a/plugins/haptics/ios/Package.swift b/plugins/haptics/ios/Package.swift new file mode 100644 index 00000000..a64b9890 --- /dev/null +++ b/plugins/haptics/ios/Package.swift @@ -0,0 +1,34 @@ +// swift-tools-version:5.3 +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +import PackageDescription + +let package = Package( + name: "tauri-plugin-haptics", + platforms: [ + .macOS(.v10_13), + .iOS(.v13), + ], + products: [ + // Products define the executables and libraries a package produces, and make them visible to other packages. + .library( + name: "tauri-plugin-haptics", + type: .static, + targets: ["tauri-plugin-haptics"]) + ], + dependencies: [ + .package(name: "Tauri", path: "../.tauri/tauri-api") + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages this package depends on. + .target( + name: "tauri-plugin-haptics", + dependencies: [ + .byName(name: "Tauri") + ], + path: "Sources") + ] +) diff --git a/plugins/haptics/ios/README.md b/plugins/haptics/ios/README.md new file mode 100644 index 00000000..3f7138b5 --- /dev/null +++ b/plugins/haptics/ios/README.md @@ -0,0 +1,3 @@ +# Tauri Plugin Haptics + +A description of this package. diff --git a/plugins/haptics/ios/Sources/HapticsPlugin.swift b/plugins/haptics/ios/Sources/HapticsPlugin.swift new file mode 100644 index 00000000..96e3f275 --- /dev/null +++ b/plugins/haptics/ios/Sources/HapticsPlugin.swift @@ -0,0 +1,133 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +import SwiftRs +import Tauri +import UIKit +import WebKit +import CoreHaptics +import AudioToolbox + +class ImpactFeedbackOptions: Decodable { + let style: ImpactFeedbackStyle +} + +enum ImpactFeedbackStyle: String, Decodable { + case light, medium, heavy, soft, rigid + + func into() -> UIImpactFeedbackGenerator.FeedbackStyle { + switch self { + case .light: + return .light + case .medium: + return .medium + case .heavy: + return .heavy + case .soft: + return .soft + case .rigid: + return .rigid + } + } +} + +class NotificationFeedbackOptions: Decodable { + let type: NotificationFeedbackType +} + +enum NotificationFeedbackType: String, Decodable { + case success, warning, error + + func into() -> UINotificationFeedbackGenerator.FeedbackType { + switch self { + case .success: + return .success + case .warning: + return .warning + case .error: + return .error + } + } +} + +class VibrateOptions: Decodable { + // TODO: Array + let duration: Double +} + +class HapticsPlugin: Plugin { + // + // Tauri commands + // + + @objc public func vibrate(_ invoke: Invoke) throws { + let args = try invoke.parseArgs(VibrateOptions.self) + if CHHapticEngine.capabilitiesForHardware().supportsHaptics { + do { + let engine = try CHHapticEngine() + try engine.start() + engine.resetHandler = { [] in + do { + try engine.start() + } catch { + AudioServicesPlayAlertSound(kSystemSoundID_Vibrate) + } + } + // TODO: Make some of this (or all) configurable? + let intensity: CHHapticEventParameter = CHHapticEventParameter(parameterID: .hapticIntensity, value: 1.0) + let sharpness: CHHapticEventParameter = CHHapticEventParameter(parameterID: .hapticSharpness, value: 1.0) + let continuousEvent = CHHapticEvent( + eventType: .hapticContinuous, + parameters: [intensity, sharpness], + relativeTime: 0.0, + duration: args.duration/1000 + ) + let pattern = try CHHapticPattern(events: [continuousEvent], parameters: []) + let player = try engine.makePlayer(with: pattern) + + try player.start(atTime: 0) + } catch { + AudioServicesPlayAlertSound(kSystemSoundID_Vibrate) + } + } else { + AudioServicesPlayAlertSound(kSystemSoundID_Vibrate) + } + + Logger.error("VIBRATE END") + + invoke.resolve() + } + + @objc public func impactFeedback(_ invoke: Invoke) throws { + let args = try invoke.parseArgs(ImpactFeedbackOptions.self) + let generator = UIImpactFeedbackGenerator(style: args.style.into()) + generator.prepare() + generator.impactOccurred() + + invoke.resolve() + } + + @objc public func notificationFeedback(_ invoke: Invoke) throws { + let args = try invoke.parseArgs(NotificationFeedbackOptions.self) + let generator = UINotificationFeedbackGenerator() + generator.prepare() + generator.notificationOccurred(args.type.into()) + + invoke.resolve() + } + + // TODO: Consider breaking this up into Start,Change,End like capacitor + @objc public func selectionFeedback(_ invoke: Invoke) throws { + let generator = UISelectionFeedbackGenerator() + generator.prepare() + generator.selectionChanged() + + invoke.resolve() + } +} + +@_cdecl("init_plugin_haptics") +func initPlugin() -> Plugin { + return HapticsPlugin() +} diff --git a/plugins/haptics/ios/Tests/PluginTests/PluginTests.swift b/plugins/haptics/ios/Tests/PluginTests/PluginTests.swift new file mode 100644 index 00000000..99992ce4 --- /dev/null +++ b/plugins/haptics/ios/Tests/PluginTests/PluginTests.swift @@ -0,0 +1,12 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +import XCTest +@testable import ExamplePlugin + +final class ExamplePluginTests: XCTestCase { + func testExample() throws { + let plugin = ExamplePlugin() + } +} diff --git a/plugins/haptics/package.json b/plugins/haptics/package.json new file mode 100644 index 00000000..12c5b74b --- /dev/null +++ b/plugins/haptics/package.json @@ -0,0 +1,29 @@ +{ + "name": "@tauri-apps/plugin-haptics", + "version": "2.2.4", + "license": "MIT OR Apache-2.0", + "authors": [ + "Tauri Programme within The Commons Conservancy" + ], + "repository": "https://github.com/tauri-apps/plugins-workspace", + "type": "module", + "types": "./dist-js/index.d.ts", + "main": "./dist-js/index.cjs", + "module": "./dist-js/index.js", + "exports": { + "types": "./dist-js/index.d.ts", + "import": "./dist-js/index.js", + "require": "./dist-js/index.cjs" + }, + "scripts": { + "build": "rollup -c" + }, + "files": [ + "dist-js", + "README.md", + "LICENSE" + ], + "dependencies": { + "@tauri-apps/api": "^2.0.0" + } +} diff --git a/plugins/haptics/permissions/autogenerated/commands/impact_feedback.toml b/plugins/haptics/permissions/autogenerated/commands/impact_feedback.toml new file mode 100644 index 00000000..13fce392 --- /dev/null +++ b/plugins/haptics/permissions/autogenerated/commands/impact_feedback.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-impact-feedback" +description = "Enables the impact_feedback command without any pre-configured scope." +commands.allow = ["impact_feedback"] + +[[permission]] +identifier = "deny-impact-feedback" +description = "Denies the impact_feedback command without any pre-configured scope." +commands.deny = ["impact_feedback"] diff --git a/plugins/haptics/permissions/autogenerated/commands/notification_feedback.toml b/plugins/haptics/permissions/autogenerated/commands/notification_feedback.toml new file mode 100644 index 00000000..0c2782c5 --- /dev/null +++ b/plugins/haptics/permissions/autogenerated/commands/notification_feedback.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-notification-feedback" +description = "Enables the notification_feedback command without any pre-configured scope." +commands.allow = ["notification_feedback"] + +[[permission]] +identifier = "deny-notification-feedback" +description = "Denies the notification_feedback command without any pre-configured scope." +commands.deny = ["notification_feedback"] diff --git a/plugins/haptics/permissions/autogenerated/commands/selection_feedback.toml b/plugins/haptics/permissions/autogenerated/commands/selection_feedback.toml new file mode 100644 index 00000000..63e645d8 --- /dev/null +++ b/plugins/haptics/permissions/autogenerated/commands/selection_feedback.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-selection-feedback" +description = "Enables the selection_feedback command without any pre-configured scope." +commands.allow = ["selection_feedback"] + +[[permission]] +identifier = "deny-selection-feedback" +description = "Denies the selection_feedback command without any pre-configured scope." +commands.deny = ["selection_feedback"] diff --git a/plugins/haptics/permissions/autogenerated/commands/vibrate.toml b/plugins/haptics/permissions/autogenerated/commands/vibrate.toml new file mode 100644 index 00000000..4c2fe94e --- /dev/null +++ b/plugins/haptics/permissions/autogenerated/commands/vibrate.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-vibrate" +description = "Enables the vibrate command without any pre-configured scope." +commands.allow = ["vibrate"] + +[[permission]] +identifier = "deny-vibrate" +description = "Denies the vibrate command without any pre-configured scope." +commands.deny = ["vibrate"] diff --git a/plugins/haptics/permissions/autogenerated/reference.md b/plugins/haptics/permissions/autogenerated/reference.md new file mode 100644 index 00000000..c2d0dd5d --- /dev/null +++ b/plugins/haptics/permissions/autogenerated/reference.md @@ -0,0 +1,114 @@ + +## Permission Table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IdentifierDescription
+ +`haptics:allow-impact-feedback` + + + +Enables the impact_feedback command without any pre-configured scope. + +
+ +`haptics:deny-impact-feedback` + + + +Denies the impact_feedback command without any pre-configured scope. + +
+ +`haptics:allow-notification-feedback` + + + +Enables the notification_feedback command without any pre-configured scope. + +
+ +`haptics:deny-notification-feedback` + + + +Denies the notification_feedback command without any pre-configured scope. + +
+ +`haptics:allow-selection-feedback` + + + +Enables the selection_feedback command without any pre-configured scope. + +
+ +`haptics:deny-selection-feedback` + + + +Denies the selection_feedback command without any pre-configured scope. + +
+ +`haptics:allow-vibrate` + + + +Enables the vibrate command without any pre-configured scope. + +
+ +`haptics:deny-vibrate` + + + +Denies the vibrate command without any pre-configured scope. + +
diff --git a/plugins/authenticator/permissions/schemas/schema.json b/plugins/haptics/permissions/schemas/schema.json similarity index 67% rename from plugins/authenticator/permissions/schemas/schema.json rename to plugins/haptics/permissions/schemas/schema.json index d5482860..ed217dc4 100644 --- a/plugins/authenticator/permissions/schemas/schema.json +++ b/plugins/haptics/permissions/schemas/schema.json @@ -17,7 +17,6 @@ }, "set": { "description": "A list of permissions sets defined", - "default": [], "type": "array", "items": { "$ref": "#/definitions/PermissionSet" @@ -50,7 +49,7 @@ "minimum": 1.0 }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -112,7 +111,7 @@ "type": "string" }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri internal convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -132,12 +131,21 @@ }, "scope": { "description": "Allowed or denied scoped when using this permission.", - "default": {}, "allOf": [ { "$ref": "#/definitions/Scopes" } ] + }, + "platforms": { + "description": "Target platforms this permission applies. By default all platforms are affected by this permission.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Target" + } } } }, @@ -164,7 +172,7 @@ } }, "Scopes": { - "description": "A restriction of the command/endpoint functionality.\n\nIt can be of any serde serializable type and is used for allowing or preventing certain actions inside a Tauri command.\n\nThe scope is passed to the command and handled/enforced by the command itself.", + "description": "An argument for fine grained behavior control of Tauri commands.\n\nIt can be of any serde serializable type and is used to allow or prevent certain actions inside a Tauri command. The configured scope is passed to the command and will be enforced by the command implementation.\n\n## Example\n\n```json { \"allow\": [{ \"path\": \"$HOME/**\" }], \"deny\": [{ \"path\": \"$HOME/secret.txt\" }] } ```", "type": "object", "properties": { "allow": { @@ -178,7 +186,7 @@ } }, "deny": { - "description": "Data that defines what is denied by the scope.", + "description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.", "type": [ "array", "null" @@ -243,78 +251,96 @@ } ] }, - "PermissionKind": { - "type": "string", + "Target": { + "description": "Platform target.", "oneOf": [ { - "description": "allow-init-auth -> Enables the init_auth command without any pre-configured scope.", + "description": "MacOS.", "type": "string", "enum": [ - "allow-init-auth" + "macOS" ] }, { - "description": "deny-init-auth -> Denies the init_auth command without any pre-configured scope.", + "description": "Windows.", "type": "string", "enum": [ - "deny-init-auth" + "windows" ] }, { - "description": "allow-register -> Enables the register command without any pre-configured scope.", + "description": "Linux.", "type": "string", "enum": [ - "allow-register" + "linux" ] }, { - "description": "deny-register -> Denies the register command without any pre-configured scope.", + "description": "Android.", "type": "string", "enum": [ - "deny-register" + "android" ] }, { - "description": "allow-sign -> Enables the sign command without any pre-configured scope.", + "description": "iOS.", "type": "string", "enum": [ - "allow-sign" + "iOS" ] + } + ] + }, + "PermissionKind": { + "type": "string", + "oneOf": [ + { + "description": "Enables the impact_feedback command without any pre-configured scope.", + "type": "string", + "const": "allow-impact-feedback", + "markdownDescription": "Enables the impact_feedback command without any pre-configured scope." }, { - "description": "deny-sign -> Denies the sign command without any pre-configured scope.", + "description": "Denies the impact_feedback command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-sign" - ] + "const": "deny-impact-feedback", + "markdownDescription": "Denies the impact_feedback command without any pre-configured scope." }, { - "description": "allow-verify-registration -> Enables the verify_registration command without any pre-configured scope.", + "description": "Enables the notification_feedback command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-verify-registration" - ] + "const": "allow-notification-feedback", + "markdownDescription": "Enables the notification_feedback command without any pre-configured scope." }, { - "description": "deny-verify-registration -> Denies the verify_registration command without any pre-configured scope.", + "description": "Denies the notification_feedback command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-verify-registration" - ] + "const": "deny-notification-feedback", + "markdownDescription": "Denies the notification_feedback command without any pre-configured scope." }, { - "description": "allow-verify-signature -> Enables the verify_signature command without any pre-configured scope.", + "description": "Enables the selection_feedback command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-verify-signature" - ] + "const": "allow-selection-feedback", + "markdownDescription": "Enables the selection_feedback command without any pre-configured scope." }, { - "description": "deny-verify-signature -> Denies the verify_signature command without any pre-configured scope.", + "description": "Denies the selection_feedback command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-verify-signature" - ] + "const": "deny-selection-feedback", + "markdownDescription": "Denies the selection_feedback command without any pre-configured scope." + }, + { + "description": "Enables the vibrate command without any pre-configured scope.", + "type": "string", + "const": "allow-vibrate", + "markdownDescription": "Enables the vibrate command without any pre-configured scope." + }, + { + "description": "Denies the vibrate command without any pre-configured scope.", + "type": "string", + "const": "deny-vibrate", + "markdownDescription": "Denies the vibrate command without any pre-configured scope." } ] } diff --git a/plugins/haptics/rollup.config.js b/plugins/haptics/rollup.config.js new file mode 100644 index 00000000..1f349ec8 --- /dev/null +++ b/plugins/haptics/rollup.config.js @@ -0,0 +1,7 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +import { createConfig } from '../../shared/rollup.config.js' + +export default createConfig() diff --git a/plugins/haptics/src/commands.rs b/plugins/haptics/src/commands.rs new file mode 100644 index 00000000..76f097c0 --- /dev/null +++ b/plugins/haptics/src/commands.rs @@ -0,0 +1,33 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use tauri::{command, AppHandle, Runtime}; + +use crate::{HapticsExt, ImpactFeedbackStyle, NotificationFeedbackType, Result}; + +#[command] +pub(crate) async fn vibrate(app: AppHandle, duration: u32) -> Result<()> { + app.haptics().vibrate(duration) +} + +#[command] +pub(crate) async fn impact_feedback( + app: AppHandle, + style: ImpactFeedbackStyle, +) -> Result<()> { + app.haptics().impact_feedback(style) +} + +#[command] +pub(crate) async fn notification_feedback( + app: AppHandle, + r#type: NotificationFeedbackType, +) -> Result<()> { + app.haptics().notification_feedback(r#type) +} + +#[command] +pub(crate) async fn selection_feedback(app: AppHandle) -> Result<()> { + app.haptics().selection_feedback() +} diff --git a/plugins/haptics/src/desktop.rs b/plugins/haptics/src/desktop.rs new file mode 100644 index 00000000..b04b7567 --- /dev/null +++ b/plugins/haptics/src/desktop.rs @@ -0,0 +1,36 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use serde::de::DeserializeOwned; +use tauri::{plugin::PluginApi, AppHandle, Runtime}; + +use crate::models::*; + +pub fn init( + app: &AppHandle, + _api: PluginApi, +) -> crate::Result> { + Ok(Haptics(app.clone())) +} + +/// Access to the haptics APIs. +pub struct Haptics(AppHandle); + +impl Haptics { + pub fn vibrate(&self, _duration: u32) -> crate::Result<()> { + Ok(()) + } + + pub fn impact_feedback(&self, _style: ImpactFeedbackStyle) -> crate::Result<()> { + Ok(()) + } + + pub fn notification_feedback(&self, _type: NotificationFeedbackType) -> crate::Result<()> { + Ok(()) + } + + pub fn selection_feedback(&self) -> crate::Result<()> { + Ok(()) + } +} diff --git a/plugins/haptics/src/error.rs b/plugins/haptics/src/error.rs new file mode 100644 index 00000000..0fba5445 --- /dev/null +++ b/plugins/haptics/src/error.rs @@ -0,0 +1,30 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use serde::{ser::Serializer, Serialize}; + +pub type Result = std::result::Result; + +// TODO: Improve Error handling (different typed errors instead of one (stringified) PluginInvokeError for all mobile errors) + +#[derive(Debug, thiserror::Error)] +#[cfg_attr(feature = "specta", derive(specta::Type))] +pub enum Error { + #[cfg(mobile)] + #[error(transparent)] + PluginInvoke( + #[cfg_attr(feature = "specta", serde(skip))] + #[from] + tauri::plugin::mobile::PluginInvokeError, + ), +} + +impl Serialize for Error { + fn serialize(&self, serializer: S) -> std::result::Result + where + S: Serializer, + { + serializer.serialize_str(self.to_string().as_ref()) + } +} diff --git a/plugins/haptics/src/lib.rs b/plugins/haptics/src/lib.rs new file mode 100644 index 00000000..31798743 --- /dev/null +++ b/plugins/haptics/src/lib.rs @@ -0,0 +1,57 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use tauri::{ + plugin::{Builder, TauriPlugin}, + Manager, Runtime, +}; + +pub use models::*; + +#[cfg(desktop)] +mod desktop; +#[cfg(mobile)] +mod mobile; + +mod commands; +mod error; +mod models; + +pub use error::{Error, Result}; + +#[cfg(desktop)] +pub use desktop::Haptics; +#[cfg(mobile)] +pub use mobile::Haptics; + +/// Extensions to [`tauri::App`], [`tauri::AppHandle`], [`tauri::WebviewWindow`], [`tauri::Webview`] and [`tauri::Window`] to access the haptics APIs. +pub trait HapticsExt { + fn haptics(&self) -> &Haptics; +} + +impl> crate::HapticsExt for T { + fn haptics(&self) -> &Haptics { + self.state::>().inner() + } +} + +/// Initializes the plugin. +pub fn init() -> TauriPlugin { + Builder::new("haptics") + .invoke_handler(tauri::generate_handler![ + commands::vibrate, + commands::impact_feedback, + commands::notification_feedback, + commands::selection_feedback + ]) + .setup(|app, api| { + #[cfg(mobile)] + let haptics = mobile::init(app, api)?; + #[cfg(desktop)] + let haptics = desktop::init(app, api)?; + app.manage(haptics); + Ok(()) + }) + .build() +} diff --git a/plugins/haptics/src/mobile.rs b/plugins/haptics/src/mobile.rs new file mode 100644 index 00000000..2b1e2036 --- /dev/null +++ b/plugins/haptics/src/mobile.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 serde::{de::DeserializeOwned, Serialize}; +use tauri::{ + plugin::{PluginApi, PluginHandle}, + AppHandle, Runtime, +}; + +use crate::models::*; + +#[cfg(target_os = "android")] +const PLUGIN_IDENTIFIER: &str = "app.tauri.haptics"; + +#[cfg(target_os = "ios")] +tauri::ios_plugin_binding!(init_plugin_haptics); + +// initializes the Kotlin or Swift plugin classes +pub fn init( + _app: &AppHandle, + api: PluginApi, +) -> crate::Result> { + #[cfg(target_os = "android")] + let handle = api.register_android_plugin(PLUGIN_IDENTIFIER, "HapticsPlugin")?; + #[cfg(target_os = "ios")] + let handle = api.register_ios_plugin(init_plugin_haptics)?; + Ok(Haptics(handle)) +} + +/// Access to the haptics APIs. +pub struct Haptics(PluginHandle); + +impl Haptics { + pub fn vibrate(&self, duration: u32) -> crate::Result<()> { + self.0 + .run_mobile_plugin("vibrate", VibratePayload { duration }) + .map_err(Into::into) + } + + pub fn impact_feedback(&self, style: ImpactFeedbackStyle) -> crate::Result<()> { + self.0 + .run_mobile_plugin("impactFeedback", ImpactFeedbackPayload { style }) + .map_err(Into::into) + } + + pub fn notification_feedback(&self, r#type: NotificationFeedbackType) -> crate::Result<()> { + self.0 + .run_mobile_plugin( + "notificationFeedback", + NotificationFeedbackPayload { r#type }, + ) + .map_err(Into::into) + } + + pub fn selection_feedback(&self) -> crate::Result<()> { + self.0 + .run_mobile_plugin("selectionFeedback", ()) + .map_err(Into::into) + } +} + +#[derive(Serialize)] +struct VibratePayload { + duration: u32, +} + +#[derive(Serialize)] +struct ImpactFeedbackPayload { + style: ImpactFeedbackStyle, +} + +#[derive(Serialize)] +struct NotificationFeedbackPayload { + r#type: NotificationFeedbackType, +} diff --git a/plugins/haptics/src/models.rs b/plugins/haptics/src/models.rs new file mode 100644 index 00000000..50a1fb16 --- /dev/null +++ b/plugins/haptics/src/models.rs @@ -0,0 +1,36 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use serde::{Deserialize, Serialize}; +/* +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[cfg_attr(feature = "specta", derive(specta::Type))] +#[serde(rename_all = "camelCase")] +pub struct HapticsOptions { + // TODO: support array to match web api + pub duration: u32, +} + */ + +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +#[cfg_attr(feature = "specta", derive(specta::Type))] +#[serde(rename_all = "camelCase")] +pub enum ImpactFeedbackStyle { + Light, + #[default] + Medium, + Heavy, + Soft, + Rigid, +} + +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +#[cfg_attr(feature = "specta", derive(specta::Type))] +#[serde(rename_all = "camelCase")] +pub enum NotificationFeedbackType { + #[default] + Success, + Warning, + Error, +} diff --git a/plugins/haptics/tsconfig.json b/plugins/haptics/tsconfig.json new file mode 100644 index 00000000..5098169a --- /dev/null +++ b/plugins/haptics/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../tsconfig.base.json", + "include": ["guest-js/*.ts"] +} diff --git a/plugins/http/CHANGELOG.md b/plugins/http/CHANGELOG.md index 31e0250f..4e1fb76b 100644 --- a/plugins/http/CHANGELOG.md +++ b/plugins/http/CHANGELOG.md @@ -1,5 +1,195 @@ # Changelog +## \[2.4.3] + +- [`37c0477a`](https://github.com/tauri-apps/plugins-workspace/commit/37c0477afe926d326573f1827045875ce8bf8187) ([#2561](https://github.com/tauri-apps/plugins-workspace/pull/2561)) Add `zstd` cargo feature flag to enable `reqwest/zstd` flag. +- [`9ebbfb2e`](https://github.com/tauri-apps/plugins-workspace/commit/9ebbfb2e3ccef8e0f277a0c02fe6b399b41feeb6) ([#1978](https://github.com/tauri-apps/plugins-workspace/pull/1978)) Persist cookies to disk and load it on next app start. + +### Dependencies + +- Upgraded to `fs-js@2.2.1` + +## \[2.4.2] + +- [`a15eedf3`](https://github.com/tauri-apps/plugins-workspace/commit/a15eedf37854344f7ffbcb0d373d848563817011) ([#2535](https://github.com/tauri-apps/plugins-workspace/pull/2535) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Fix `fetch` occasionally throwing an error due to trying to close the underline stream twice. + +## \[2.4.1] + +- [`d3183aa9`](https://github.com/tauri-apps/plugins-workspace/commit/d3183aa99da7ca67e627394132ddeb3b85ccef06) ([#2522](https://github.com/tauri-apps/plugins-workspace/pull/2522) by [@adrieljss](https://github.com/tauri-apps/plugins-workspace/../../adrieljss)) Fix `fetch` blocking until the whole response is read even if it was a streaming response. + +## \[2.4.0] + +- [`cb38f54f`](https://github.com/tauri-apps/plugins-workspace/commit/cb38f54f4a4ef30995283cd82166c62da17bac44) ([#2479](https://github.com/tauri-apps/plugins-workspace/pull/2479) by [@adrieljss](https://github.com/tauri-apps/plugins-workspace/../../adrieljss)) Add stream support for HTTP stream responses. + +## \[2.3.0] + +- [`10513649`](https://github.com/tauri-apps/plugins-workspace/commit/105136494c5a5bf4b1f1cc06cc71815412d17ec8) ([#2204](https://github.com/tauri-apps/plugins-workspace/pull/2204) by [@RickeyWard](https://github.com/tauri-apps/plugins-workspace/../../RickeyWard)) Add `dangerous-settings` feature flag and new JS `danger` option to disable tls hostname/certificate validation. + +## \[2.2.0] + +- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other. + +### Dependencies + +- Upgraded to `fs@2.2.0` + +## \[2.0.2] + +### Dependencies + +- Upgraded to `fs-js@2.0.4` + +## \[2.0.4] + +- [`a3b553dd`](https://github.com/tauri-apps/plugins-workspace/commit/a3b553ddb403771aa699362c4e69a064b7731da5) ([#2079](https://github.com/tauri-apps/plugins-workspace/pull/2079) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Add tracing logs for requestes and responses behind `tracing` feature flag. + +### Dependencies + +- Upgraded to `fs@2.1.0` + +## \[2.0.3] + +### Dependencies + +- Upgraded to `fs@2.0.3` + +## \[2.0.1] + +- [`cfd48b3b`](https://github.com/tauri-apps/plugins-workspace/commit/cfd48b3b2ec0fccfc162197518694ed59ceda22c) ([#1941](https://github.com/tauri-apps/plugins-workspace/pull/1941) by [@Nipsuli](https://github.com/tauri-apps/plugins-workspace/../../Nipsuli)) Allow skipping sending `Origin` header in HTTP requests by setting `Origin` header to an empty string when calling `fetch`. +- [`9b2840db`](https://github.com/tauri-apps/plugins-workspace/commit/9b2840db9464cf08db75806270e4441f0af81e5d) ([#1884](https://github.com/tauri-apps/plugins-workspace/pull/1884) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Retain headers order. + +## \[2.0.1] + +- [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7. + +### Dependencies + +- Upgraded to `fs@2.0.1` + +## \[2.0.0] + +- [`e2c4dfb6`](https://github.com/tauri-apps/plugins-workspace/commit/e2c4dfb6af43e5dd8d9ceba232c315f5febd55c1) Update to tauri v2 stable release. + +### Dependencies + +- Upgraded to `fs@2.0.0` + +## \[2.0.0-rc.6] + +### Dependencies + +- Upgraded to `fs@2.0.0-rc.6` + +## \[2.0.0-rc.5] + +### Dependencies + +- Upgraded to `fs@2.0.0-rc.5` + +## \[2.0.0-rc.4] + +### Dependencies + +- Upgraded to `fs@2.0.0-rc.4` + +## \[2.0.0-rc.3] + +### Dependencies + +- Upgraded to `fs@2.0.0-rc.3` + +## \[2.0.0-rc.2] + +### Dependencies + +- Upgraded to `fs@2.0.0-rc.2` + +## \[2.0.0-rc.2] + +- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri 2.0.0-rc.8 + +## \[2.0.0-rc.1] + +- [`84f8bd5e`](https://github.com/tauri-apps/plugins-workspace/commit/84f8bd5e1ef22e664267380b5bbf756ebc5389c3) ([#1662](https://github.com/tauri-apps/plugins-workspace/pull/1662) by [@twlite](https://github.com/tauri-apps/plugins-workspace/../../twlite)) Fixed an issue with abort signal not aborting the fetch request. + +## \[2.0.0-rc.0] + +- [`9887d1`](https://github.com/tauri-apps/plugins-workspace/commit/9887d14bd0e971c4c0f5c1188fc4005d3fc2e29e) Update to tauri RC. + +### Dependencies + +- Upgraded to `fs@2.0.0-rc.0` + +## \[2.0.0-beta.9] + +- [`99d6ac0f`](https://github.com/tauri-apps/plugins-workspace/commit/99d6ac0f9506a6a4a1aa59c728157190a7441af6) ([#1606](https://github.com/tauri-apps/plugins-workspace/pull/1606) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) The JS packages now specify the *minimum* `@tauri-apps/api` version instead of a single exact version. +- [`6de87966`](https://github.com/tauri-apps/plugins-workspace/commit/6de87966ecc00ad9d91c25be452f1f46bd2b7e1f) ([#1597](https://github.com/tauri-apps/plugins-workspace/pull/1597) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Update to tauri beta.25. + +## \[2.0.0-beta.8] + +- [`ac9a25cc`](https://github.com/tauri-apps/plugins-workspace/commit/ac9a25cc12ee2b325f00212ba74316da3369bde5) ([#1395](https://github.com/tauri-apps/plugins-workspace/pull/1395) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Fix cancelling requests using `AbortSignal`. +- [`a6654932`](https://github.com/tauri-apps/plugins-workspace/commit/a66549329c60dea35e3a06a38c357e368c9053a1) ([#1526](https://github.com/tauri-apps/plugins-workspace/pull/1526) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Fix missing `Set-Cookie` headers in the response which meant `request.headers.getSetCookie()` always returned empty array. +- [`22a17980`](https://github.com/tauri-apps/plugins-workspace/commit/22a17980ff4f6f8c40adb1b8f4ffc6dae2fe7e30) ([#1537](https://github.com/tauri-apps/plugins-workspace/pull/1537) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri beta.24. + +## \[2.0.0-beta.7] + +- [`76daee7a`](https://github.com/tauri-apps/plugins-workspace/commit/76daee7aafece34de3092c86e531cf9eb1138989) ([#1512](https://github.com/tauri-apps/plugins-workspace/pull/1512) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Update to tauri beta.23. + +## \[2.0.0-beta.6] + +- [`0f739dbc`](https://github.com/tauri-apps/plugins-workspace/commit/0f739dbc483a1f091977cbe575c3862fd39f8cf1) ([#1392](https://github.com/tauri-apps/plugins-workspace/pull/1392) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Allow setting `Origin` header when `unsafe-headers` feature flag is active. + +## \[2.0.0-beta.5] + +- [`9013854f`](https://github.com/tauri-apps/plugins-workspace/commit/9013854f42a49a230b9dbb9d02774765528a923f)([#1382](https://github.com/tauri-apps/plugins-workspace/pull/1382)) Update to tauri beta.22. + +## \[2.0.0-beta.4] + +- [`9d7ae45b`](https://github.com/tauri-apps/plugins-workspace/commit/9d7ae45b0edf9b22c73e7d7c413a784bb35c3d77)([#1354](https://github.com/tauri-apps/plugins-workspace/pull/1354)) Include headers created by browser if not declared by user, which fixes missing headers like `Content-Type` when using `FormData`. +- [`430bd6f4`](https://github.com/tauri-apps/plugins-workspace/commit/430bd6f4f379bee5d232ae6b098ae131db7f178a)([#1363](https://github.com/tauri-apps/plugins-workspace/pull/1363)) Update to tauri beta.20. + +## \[2.0.0-beta.3] + +- [`bd1ed590`](https://github.com/tauri-apps/plugins-workspace/commit/bd1ed5903ffcce5500310dac1e59e8c67674ef1e)([#1237](https://github.com/tauri-apps/plugins-workspace/pull/1237)) Update to tauri beta.17. + +## \[2.0.0-beta.6] + +### Dependencies + +- Upgraded to `fs@2.0.0-beta.6` + +## \[2.0.0-beta.5] + +- [`500ff10`](https://github.com/tauri-apps/plugins-workspace/commit/500ff10fbd89fdfc73caf9d153029dad567b4ff1)([#1166](https://github.com/tauri-apps/plugins-workspace/pull/1166)) **Breaking change:** Removed the `default-tls` feature flag. The `rustls-tls`, `http2`, `macos-system-configuration`, and `charset` feature flags are now enabled by default. +- [`e3d41f4`](https://github.com/tauri-apps/plugins-workspace/commit/e3d41f4011bd3ea3ce281bb38bbe31d3709f8e0f)([#1191](https://github.com/tauri-apps/plugins-workspace/pull/1191)) Internally use the webview scoped resources table instead of the app one, so other webviews can't access other webviews resources. +- [`7e2fcc5`](https://github.com/tauri-apps/plugins-workspace/commit/7e2fcc5e74df7c3c718e40f75bfb0eafc7d69d8d)([#1146](https://github.com/tauri-apps/plugins-workspace/pull/1146)) Update dependencies to align with tauri 2.0.0-beta.14. +- [`e3d41f4`](https://github.com/tauri-apps/plugins-workspace/commit/e3d41f4011bd3ea3ce281bb38bbe31d3709f8e0f)([#1191](https://github.com/tauri-apps/plugins-workspace/pull/1191)) Update for tauri 2.0.0-beta.15. + +### Dependencies + +- Upgraded to `fs@2.0.0-beta.5` + +## \[2.0.0-beta.4] + +### Dependencies + +- Upgraded to `fs@2.0.0-beta.4` + +## \[2.0.0-beta.3] + +- [`c873e4d`](https://github.com/tauri-apps/plugins-workspace/commit/c873e4d6c74e759742f7c9a88e35cff10a75122a)([#1059](https://github.com/tauri-apps/plugins-workspace/pull/1059)) Fixes scope not allowing subpaths, query parameters and hash when those values are empty. +- [`a04ea2f`](https://github.com/tauri-apps/plugins-workspace/commit/a04ea2f38294d5a3987578283badc8eec87a7752)([#1071](https://github.com/tauri-apps/plugins-workspace/pull/1071)) The global API script is now only added to the binary when the `withGlobalTauri` config is true. +- [`753c7be`](https://github.com/tauri-apps/plugins-workspace/commit/753c7be0a6a78121d2e88ea0efc3040580c885b4)([#1050](https://github.com/tauri-apps/plugins-workspace/pull/1050)) Add `unsafe-headers` cargo feature flag to allow using [forbidden headers](https://fetch.spec.whatwg.org/#terminology-headers). + +### Dependencies + +- Upgraded to `fs@2.0.0-beta.3` + +## \[2.0.0-beta.2] + +- [`ae56b13`](https://github.com/tauri-apps/plugins-workspace/commit/ae56b13a4d49dbf922b8a0fbb0d557bb63c1d72b)([#983](https://github.com/tauri-apps/plugins-workspace/pull/983)) Allow `User-Agent` header to be set. +- [`99bea25`](https://github.com/tauri-apps/plugins-workspace/commit/99bea2559c2c0648c2519c50a18cd124dacef57b)([#1005](https://github.com/tauri-apps/plugins-workspace/pull/1005)) Update to tauri beta.8. + ## \[2.0.0-beta.1] - [`569defb`](https://github.com/tauri-apps/plugins-workspace/commit/569defbe9492e38938554bb7bdc1be9151456d21) Update to tauri beta.4. @@ -57,26 +247,3 @@ ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - 371\)) First v2 alpha release! - ! - 371\)) First v2 alpha release! - ! - 371\)) First v2 alpha release! - ! - 371\)) First v2 alpha release! - /717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - 371\)) First v2 alpha release! - ! - 371\)) First v2 alpha release! - ! - 371\)) First v2 alpha release! - ! - 371\)) First v2 alpha release! -ace/pull/371)) First v2 alpha release! - 371\)) First v2 alpha release! - ! - 371\)) First v2 alpha release! - ! - 371\)) First v2 alpha release! - ! - 371\)) First v2 alpha release! diff --git a/plugins/http/Cargo.toml b/plugins/http/Cargo.toml index 3b06c2a2..353f72a3 100644 --- a/plugins/http/Cargo.toml +++ b/plugins/http/Cargo.toml @@ -1,53 +1,79 @@ [package] name = "tauri-plugin-http" -version = "2.0.0-beta.1" +version = "2.4.3" description = "Access an HTTP client written in Rust." edition = { workspace = true } authors = { workspace = true } license = { workspace = true } rust-version = { workspace = true } +repository = { workspace = true } links = "tauri-plugin-http" [package.metadata.docs.rs] -rustc-args = [ "--cfg", "docsrs" ] -rustdoc-args = [ "--cfg", "docsrs" ] +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs"] + +[package.metadata.platforms.support] +windows = { level = "full", notes = "" } +linux = { level = "full", notes = "" } +macos = { level = "full", notes = "" } +android = { level = "full", notes = "" } +ios = { level = "full", notes = "" } [build-dependencies] -tauri-plugin = { workspace = true, features = [ "build" ] } +tauri-plugin = { workspace = true, features = ["build"] } schemars = { workspace = true } serde = { workspace = true } url = { workspace = true } -glob = "0.3" +urlpattern = "0.3" +regex = "1" [dependencies] serde = { workspace = true } serde_json = { workspace = true } tauri = { workspace = true } thiserror = { workspace = true } -tauri-plugin-fs = { path = "../fs", version = "2.0.0-beta.1" } -glob = "0.3" -http = "0.2" -reqwest = { version = "0.11", default-features = false } +tokio = { version = "1", features = ["sync", "macros"] } +tauri-plugin-fs = { path = "../fs", version = "2.2.1" } +urlpattern = "0.3" +regex = "1" +http = "1" +reqwest = { version = "0.12", default-features = false } url = { workspace = true } data-url = "0.3" +cookie_store = { version = "0.21.1", optional = true, features = ["serde"] } +bytes = { version = "1.9", optional = true } +tracing = { workspace = true, optional = true } [features] -multipart = [ "reqwest/multipart" ] -json = [ "reqwest/json" ] -stream = [ "reqwest/stream" ] -native-tls = [ "reqwest/native-tls" ] -native-tls-vendored = [ "reqwest/native-tls-vendored" ] -rustls-tls = [ "reqwest/rustls-tls" ] -default-tls = [ "reqwest/default-tls" ] -native-tls-alpn = [ "reqwest/native-tls-alpn" ] -rustls-tls-manual-roots = [ "reqwest/rustls-tls-manual-roots" ] -rustls-tls-webpki-roots = [ "reqwest/rustls-tls-webpki-roots" ] -rustls-tls-native-roots = [ "reqwest/rustls-tls-native-roots" ] -blocking = [ "reqwest/blocking" ] -cookies = [ "reqwest/cookies" ] -gzip = [ "reqwest/gzip" ] -brotli = [ "reqwest/brotli" ] -deflate = [ "reqwest/deflate" ] -trust-dns = [ "reqwest/trust-dns" ] -socks = [ "reqwest/socks" ] -http3 = [ "reqwest/http3" ] +default = [ + "rustls-tls", + "http2", + "charset", + "macos-system-configuration", + "cookies", +] +multipart = ["reqwest/multipart"] +json = ["reqwest/json"] +stream = ["reqwest/stream"] +native-tls = ["reqwest/native-tls"] +native-tls-vendored = ["reqwest/native-tls-vendored"] +native-tls-alpn = ["reqwest/native-tls-alpn"] +rustls-tls = ["reqwest/rustls-tls"] +rustls-tls-manual-roots = ["reqwest/rustls-tls-manual-roots"] +rustls-tls-webpki-roots = ["reqwest/rustls-tls-webpki-roots"] +rustls-tls-native-roots = ["reqwest/rustls-tls-native-roots"] +blocking = ["reqwest/blocking"] +cookies = ["reqwest/cookies", "dep:cookie_store", "dep:bytes"] +gzip = ["reqwest/gzip"] +brotli = ["reqwest/brotli"] +deflate = ["reqwest/deflate"] +zstd = ["reqwest/zstd"] +trust-dns = ["reqwest/trust-dns"] +socks = ["reqwest/socks"] +http2 = ["reqwest/http2"] +charset = ["reqwest/charset"] +macos-system-configuration = ["reqwest/macos-system-configuration"] +unsafe-headers = [] +tracing = ["dep:tracing"] +dangerous-settings = [] diff --git a/plugins/http/README.md b/plugins/http/README.md index d1f9bfa1..5c3cd9c2 100644 --- a/plugins/http/README.md +++ b/plugins/http/README.md @@ -2,9 +2,17 @@ Access the HTTP client written in Rust. +| Platform | Supported | +| -------- | --------- | +| Linux | ✓ | +| Windows | ✓ | +| macOS | ✓ | +| Android | ✓ | +| iOS | ✓ | + ## Install -_This plugin requires a Rust version of at least **1.75**_ +_This plugin requires a Rust version of at least **1.77.2**_ There are three general methods of installation that we can recommend. @@ -18,7 +26,7 @@ Install the Core plugin by adding the following to your `Cargo.toml` file: ```toml [dependencies] -tauri-plugin-http = "2.0.0-beta" +tauri-plugin-http = "2.0.0" # alternatively with Git: tauri-plugin-http = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` @@ -46,7 +54,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-http#v2 First you need to register the core plugin with Tauri: -`src-tauri/src/main.rs` +`src-tauri/src/lib.rs` ```rust fn main() { @@ -60,11 +68,11 @@ fn main() { Afterwards all the plugin's APIs are available through the JavaScript guest bindings: ```javascript -import { fetch } from "@tauri-apps/plugin-http"; -const response = await fetch("http://localhost:3003/users/2", { - method: "GET", - timeout: 30, -}); +import { fetch } from '@tauri-apps/plugin-http' +const response = await fetch('http://localhost:3003/users/2', { + method: 'GET', + timeout: 30 +}) ``` ## Contributing diff --git a/plugins/http/SECURITY.md b/plugins/http/SECURITY.md new file mode 100644 index 00000000..4f09bbac --- /dev/null +++ b/plugins/http/SECURITY.md @@ -0,0 +1,23 @@ +# Security Policy + +**Do not report security vulnerabilities through public GitHub issues.** + +**Please use the [Private Vulnerability Disclosure](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability) feature of GitHub.** + +Include as much of the following information: + +- Type of issue (e.g. improper input parsing, privilege escalation, etc.) +- The location of the affected source code (tag/branch/commit or direct URL) +- Any special configuration required to reproduce the issue +- The distribution affected or used to help us with reproduction of the issue +- Step-by-step instructions to reproduce the issue +- Ideally a reproduction repository +- Impact of the issue, including how an attacker might exploit the issue + +We prefer to receive reports in English. + +## Contact + +Please disclose a vulnerability or security relevant issue here: [https://github.com/tauri-apps/plugins-workspace/security/advisories/new](https://github.com/tauri-apps/plugins-workspace/security/advisories/new). + +Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app). diff --git a/plugins/http/api-iife.js b/plugins/http/api-iife.js new file mode 100644 index 00000000..d962f4fc --- /dev/null +++ b/plugins/http/api-iife.js @@ -0,0 +1 @@ +if("__TAURI__"in window){var __TAURI_PLUGIN_HTTP__=function(e){"use strict";function t(e,t,r,n){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function r(e,t,r,n,s){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,r),r}var n,s,i,a;"function"==typeof SuppressedError&&SuppressedError;const o="__TAURI_TO_IPC_KEY__";class c{constructor(e){n.set(this,void 0),s.set(this,0),i.set(this,[]),a.set(this,void 0),r(this,n,e||(()=>{})),this.id=function(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}((e=>{const o=e.index;if("end"in e)return void(o==t(this,s,"f")?this.cleanupCallback():r(this,a,o));const c=e.message;if(o==t(this,s,"f")){for(t(this,n,"f").call(this,c),r(this,s,t(this,s,"f")+1);t(this,s,"f")in t(this,i,"f");){const e=t(this,i,"f")[t(this,s,"f")];t(this,n,"f").call(this,e),delete t(this,i,"f")[t(this,s,"f")],r(this,s,t(this,s,"f")+1)}t(this,s,"f")===t(this,a,"f")&&this.cleanupCallback()}else t(this,i,"f")[o]=c}))}cleanupCallback(){Reflect.deleteProperty(window,`_${this.id}`)}set onmessage(e){r(this,n,e)}get onmessage(){return t(this,n,"f")}[(n=new WeakMap,s=new WeakMap,i=new WeakMap,a=new WeakMap,o)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[o]()}}async function d(e,t={},r){return window.__TAURI_INTERNALS__.invoke(e,t,r)}const h="Request cancelled";return e.fetch=async function(e,t){const r=t?.signal;if(r?.aborted)throw new Error(h);const n=t?.maxRedirections,s=t?.connectTimeout,i=t?.proxy,a=t?.danger;t&&(delete t.maxRedirections,delete t.connectTimeout,delete t.proxy,delete t.danger);const o=t?.headers?t.headers instanceof Headers?t.headers:new Headers(t.headers):new Headers,f=new Request(e,t),l=await f.arrayBuffer(),u=0!==l.byteLength?Array.from(new Uint8Array(l)):null;for(const[e,t]of f.headers)o.get(e)||o.set(e,t);const _=(o instanceof Headers?Array.from(o.entries()):Array.isArray(o)?o:Object.entries(o)).map((([e,t])=>[e,"string"==typeof t?t:t.toString()]));if(r?.aborted)throw new Error(h);const w=await d("plugin:http|fetch",{clientConfig:{method:f.method,url:f.url,headers:_,data:u,maxRedirections:n,connectTimeout:s,proxy:i,danger:a}}),p=()=>d("plugin:http|fetch_cancel",{rid:w});if(r?.aborted)throw p(),new Error(h);r?.addEventListener("abort",(()=>{p()}));const{status:y,statusText:m,url:b,headers:g,rid:T}=await d("plugin:http|fetch_send",{rid:w}),R=[204,205,304].includes(y)?null:new ReadableStream({start:e=>{const t=new c;t.onmessage=t=>{if(r?.aborted)return void e.error(h);const n=new Uint8Array(t),s=n[n.byteLength-1],i=n.slice(0,n.byteLength-1);1!=s?e.enqueue(i):e.close()},d("plugin:http|fetch_read_body",{rid:T,streamChannel:t}).catch((t=>{e.error(t)}))}}),A=new Response(R,{status:y,statusText:m});return Object.defineProperty(A,"url",{value:b}),Object.defineProperty(A,"headers",{value:new Headers(g)}),A},e}({});Object.defineProperty(window.__TAURI__,"http",{value:__TAURI_PLUGIN_HTTP__})} diff --git a/plugins/http/build.rs b/plugins/http/build.rs index 2eaf72ba..a4b802ad 100644 --- a/plugins/http/build.rs +++ b/plugins/http/build.rs @@ -8,33 +8,60 @@ mod scope; const COMMANDS: &[&str] = &["fetch", "fetch_cancel", "fetch_send", "fetch_read_body"]; -/// HTTP scope entry object definition. +/// HTTP scope entry. #[derive(schemars::JsonSchema)] -struct ScopeEntry { +#[serde(untagged)] +#[allow(unused)] +enum HttpScopeEntry { /// A URL that can be accessed by the webview when using the HTTP APIs. - /// The scoped URL is matched against the request URL using a glob pattern. + /// Wildcards can be used following the URL pattern standard. + /// + /// See [the URL Pattern spec](https://urlpattern.spec.whatwg.org/) for more information. /// /// Examples: /// - /// - "https://*" or "https://**" : allows all HTTPS urls + /// - "https://*" : allows all HTTPS origin on port 443 + /// + /// - "https://*:*" : allows all HTTPS origin on any port /// /// - "https://*.github.com/tauri-apps/tauri": allows any subdomain of "github.com" with the "tauri-apps/api" path /// /// - "https://myapi.service.com/users/*": allows access to any URLs that begins with "https://myapi.service.com/users/" - url: String, + Value(String), + Object { + /// A URL that can be accessed by the webview when using the HTTP APIs. + /// Wildcards can be used following the URL pattern standard. + /// + /// See [the URL Pattern spec](https://urlpattern.spec.whatwg.org/) for more information. + /// + /// Examples: + /// + /// - "https://*" : allows all HTTPS origin on port 443 + /// + /// - "https://*:*" : allows all HTTPS origin on any port + /// + /// - "https://*.github.com/tauri-apps/tauri": allows any subdomain of "github.com" with the "tauri-apps/api" path + /// + /// - "https://myapi.service.com/users/*": allows access to any URLs that begins with "https://myapi.service.com/users/" + url: String, + }, } -// ensure scope entry is up to date -impl From for scope::Entry { - fn from(value: ScopeEntry) -> Self { - scope::Entry { - url: value.url.parse().unwrap(), - } - } +// Ensure `HttpScopeEntry` and `scope::EntryRaw` is kept in sync +fn _f() { + match scope::EntryRaw::Value(String::new()) { + scope::EntryRaw::Value(url) => HttpScopeEntry::Value(url), + scope::EntryRaw::Object { url } => HttpScopeEntry::Object { url }, + }; + match HttpScopeEntry::Value(String::new()) { + HttpScopeEntry::Value(url) => scope::EntryRaw::Value(url), + HttpScopeEntry::Object { url } => scope::EntryRaw::Object { url }, + }; } fn main() { tauri_plugin::Builder::new(COMMANDS) - .global_scope_schema(schemars::schema_for!(ScopeEntry)) + .global_api_script_path("./api-iife.js") + .global_scope_schema(schemars::schema_for!(HttpScopeEntry)) .build(); } diff --git a/plugins/http/guest-js/index.ts b/plugins/http/guest-js/index.ts index a1a6d77a..712bbd39 100644 --- a/plugins/http/guest-js/index.ts +++ b/plugins/http/guest-js/index.ts @@ -7,16 +7,18 @@ * * ## Security * - * This API has a scope configuration that forces you to restrict the URLs and paths that can be accessed using glob patterns. + * This API has a scope configuration that forces you to restrict the URLs that can be accessed using glob patterns. * - * For instance, this scope configuration only allows making HTTP requests to the GitHub API for the `tauri-apps` organization: + * For instance, this scope configuration only allows making HTTP requests to all subdomains for `tauri.app` except for `https://private.tauri.app`: * ```json * { - * "plugins": { - * "http": { - * "scope": ["https://api.github.com/repos/tauri-apps/*"] + * "permissions": [ + * { + * "identifier": "http:default", + * "allow": [{ "url": "https://*.tauri.app" }], + * "deny": [{ "url": "https://private.tauri.app" }] * } - * } + * ] * } * ``` * Trying to execute any API with a URL not configured on the scope results in a promise rejection due to denied access. @@ -24,45 +26,45 @@ * @module */ -import { invoke } from "@tauri-apps/api/core"; +import { Channel, invoke } from '@tauri-apps/api/core' /** * Configuration of a proxy that a Client should pass requests to. * * @since 2.0.0 */ -export type Proxy = { +export interface Proxy { /** * Proxy all traffic to the passed URL. */ - all?: string | ProxyConfig; + all?: string | ProxyConfig /** * Proxy all HTTP traffic to the passed URL. */ - http?: string | ProxyConfig; + http?: string | ProxyConfig /** * Proxy all HTTPS traffic to the passed URL. */ - https?: string | ProxyConfig; -}; + https?: string | ProxyConfig +} export interface ProxyConfig { /** * The URL of the proxy server. */ - url: string; + url: string /** * Set the `Proxy-Authorization` header using Basic auth. */ basicAuth?: { - username: string; - password: string; - }; + username: string + password: string + } /** - * A configuration for filtering out requests that shouldn’t be proxied. + * A configuration for filtering out requests that shouldn't be proxied. * Entries are expected to be comma-separated (whitespace between entries is ignored) */ - noProxy?: string; + noProxy?: string } /** @@ -75,15 +77,37 @@ export interface ClientOptions { * Defines the maximum number of redirects the client should follow. * If set to 0, no redirects will be followed. */ - maxRedirections?: number; + maxRedirections?: number /** Timeout in milliseconds */ - connectTimeout?: number; + connectTimeout?: number /** * Configuration of a proxy that a Client should pass requests to. */ - proxy?: Proxy; + proxy?: Proxy + /** + * Configuration for dangerous settings on the client such as disabling SSL verification. + */ + danger?: DangerousSettings +} + +/** + * Configuration for dangerous settings on the client such as disabling SSL verification. + * + * @since 2.3.0 + */ +export interface DangerousSettings { + /** + * Disables SSL verification. + */ + acceptInvalidCerts?: boolean + /** + * Disables hostname verification. + */ + acceptInvalidHostnames?: boolean } +const ERROR_REQUEST_CANCELLED = 'Request cancelled' + /** * Fetch a resource from the network. It returns a `Promise` that resolves to the * `Response` to that `Request`, whether it is successful or not. @@ -100,64 +124,99 @@ export interface ClientOptions { */ export async function fetch( input: URL | Request | string, - init?: RequestInit & ClientOptions, + init?: RequestInit & ClientOptions ): Promise { - const maxRedirections = init?.maxRedirections; - const connectTimeout = init?.connectTimeout; - const proxy = init?.proxy; + // abort early here if needed + const signal = init?.signal + if (signal?.aborted) { + throw new Error(ERROR_REQUEST_CANCELLED) + } + + const maxRedirections = init?.maxRedirections + const connectTimeout = init?.connectTimeout + const proxy = init?.proxy + const danger = init?.danger // Remove these fields before creating the request if (init) { - delete init.maxRedirections; - delete init.connectTimeout; - delete init.proxy; + delete init.maxRedirections + delete init.connectTimeout + delete init.proxy + delete init.danger } - const signal = init?.signal; + const headers = init?.headers + ? init.headers instanceof Headers + ? init.headers + : new Headers(init.headers) + : new Headers() - const headers = !init?.headers - ? [] - : init.headers instanceof Headers - ? Array.from(init.headers.entries()) - : Array.isArray(init.headers) - ? init.headers - : Object.entries(init.headers); + const req = new Request(input, init) + const buffer = await req.arrayBuffer() + const data = + buffer.byteLength !== 0 ? Array.from(new Uint8Array(buffer)) : null - const mappedHeaders: [string, string][] = headers.map(([name, val]) => [ - name, - // we need to ensure we have all values as strings - // eslint-disable-next-line - typeof val === "string" ? val : (val as any).toString(), - ]); + // append new headers created by the browser `Request` implementation, + // if not already declared by the caller of this function + for (const [key, value] of req.headers) { + if (!headers.get(key)) { + headers.set(key, value) + } + } + + const headersArray = + headers instanceof Headers + ? Array.from(headers.entries()) + : Array.isArray(headers) + ? headers + : Object.entries(headers) - const req = new Request(input, init); - const buffer = await req.arrayBuffer(); - const reqData = buffer.byteLength ? Array.from(new Uint8Array(buffer)) : null; + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + const mappedHeaders: Array<[string, string]> = headersArray.map( + ([name, val]) => [ + name, + // we need to ensure we have all header values as strings + // eslint-disable-next-line + typeof val === 'string' ? val : (val as any).toString() + ] + ) + + // abort early here if needed + if (signal?.aborted) { + throw new Error(ERROR_REQUEST_CANCELLED) + } - const rid = await invoke("plugin:http|fetch", { + const rid = await invoke('plugin:http|fetch', { clientConfig: { method: req.method, url: req.url, headers: mappedHeaders, - data: reqData, + data, maxRedirections, connectTimeout, proxy, - }, - }); + danger + } + }) - signal?.addEventListener("abort", () => { - invoke("plugin:http|fetch_cancel", { - rid, - }); - }); + const abort = () => invoke('plugin:http|fetch_cancel', { rid }) + + // abort early here if needed + if (signal?.aborted) { + // we don't care about the result of this proimse + // eslint-disable-next-line @typescript-eslint/no-floating-promises + abort() + throw new Error(ERROR_REQUEST_CANCELLED) + } + + signal?.addEventListener('abort', () => void abort()) interface FetchSendResponse { - status: number; - statusText: string; - headers: [[string, string]]; - url: string; - rid: number; + status: number + statusText: string + headers: [[string, string]] + url: string + rid: number } const { @@ -165,33 +224,62 @@ export async function fetch( statusText, url, headers: responseHeaders, - rid: responseRid, - } = await invoke("plugin:http|fetch_send", { - rid, - }); - - const body = await invoke( - "plugin:http|fetch_read_body", - { - rid: responseRid, - }, - ); - - const res = new Response( - body instanceof ArrayBuffer && body.byteLength - ? body - : body instanceof Array && body.length - ? new Uint8Array(body) - : null, - { - headers: responseHeaders, - status, - statusText, - }, - ); - - // url is read only but seems like we can do this - Object.defineProperty(res, "url", { value: url }); - - return res; + rid: responseRid + } = await invoke('plugin:http|fetch_send', { + rid + }) + + // no body for 204, 205 and 304 + // see https://searchfox.org/mozilla-central/source/dom/fetch/Response.cpp#258 + const body = [204, 205, 304].includes(status) + ? null + : new ReadableStream({ + start: (controller) => { + const streamChannel = new Channel() + streamChannel.onmessage = (res: ArrayBuffer | number[]) => { + // close early if aborted + if (signal?.aborted) { + controller.error(ERROR_REQUEST_CANCELLED) + return + } + + const resUint8 = new Uint8Array(res) + const lastByte = resUint8[resUint8.byteLength - 1] + const actualRes = resUint8.slice(0, resUint8.byteLength - 1) + + // close when the signal to close (last byte is 1) is sent from the IPC. + if (lastByte == 1) { + controller.close() + return + } + + controller.enqueue(actualRes) + } + + // run a non-blocking body stream fetch + invoke('plugin:http|fetch_read_body', { + rid: responseRid, + streamChannel + }).catch((e) => { + controller.error(e) + }) + } + }) + + const res = new Response(body, { + status, + statusText + }) + + // Set `Response` properties that are ignored by the + // constructor, like url and some headers + // + // Since url and headers are read only properties + // this is the only way to set them. + Object.defineProperty(res, 'url', { value: url }) + Object.defineProperty(res, 'headers', { + value: new Headers(responseHeaders) + }) + + return res } diff --git a/plugins/http/package.json b/plugins/http/package.json index ef615036..7439c461 100644 --- a/plugins/http/package.json +++ b/plugins/http/package.json @@ -1,10 +1,11 @@ { "name": "@tauri-apps/plugin-http", - "version": "2.0.0-beta.1", - "license": "MIT or APACHE-2.0", + "version": "2.4.3", + "license": "MIT OR Apache-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" ], + "repository": "https://github.com/tauri-apps/plugins-workspace", "type": "module", "types": "./dist-js/index.d.ts", "main": "./dist-js/index.cjs", @@ -23,6 +24,6 @@ "LICENSE" ], "dependencies": { - "@tauri-apps/api": "2.0.0-beta.2" + "@tauri-apps/api": "^2.0.0" } } diff --git a/plugins/http/permissions/autogenerated/reference.md b/plugins/http/permissions/autogenerated/reference.md index 16508acb..a155fd62 100644 --- a/plugins/http/permissions/autogenerated/reference.md +++ b/plugins/http/permissions/autogenerated/reference.md @@ -1,38 +1,135 @@ -# Permissions +## Default Permission -## allow-fetch +This permission set configures what kind of +fetch operations are available from the http plugin. + +This enables all fetch operations but does not +allow explicitly any origins to be fetched. This needs to +be manually configured before usage. + +#### Granted Permissions + +All fetch operations are enabled. + + + +#### This default permission set includes the following: + +- `allow-fetch` +- `allow-fetch-cancel` +- `allow-fetch-read-body` +- `allow-fetch-send` + +## Permission Table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -Denies the fetch_send command without any pre-configured scope. + + + + +
IdentifierDescription
+ +`http:allow-fetch` + + Enables the fetch command without any pre-configured scope. -## deny-fetch +
+ +`http:deny-fetch` + + Denies the fetch command without any pre-configured scope. -## allow-fetch-cancel +
+ +`http:allow-fetch-cancel` + + Enables the fetch_cancel command without any pre-configured scope. -## deny-fetch-cancel +
+ +`http:deny-fetch-cancel` + + Denies the fetch_cancel command without any pre-configured scope. -## allow-fetch-read-body +
+ +`http:allow-fetch-read-body` + + Enables the fetch_read_body command without any pre-configured scope. -## deny-fetch-read-body +
+ +`http:deny-fetch-read-body` + + Denies the fetch_read_body command without any pre-configured scope. -## allow-fetch-send +
+ +`http:allow-fetch-send` + + Enables the fetch_send command without any pre-configured scope. -## deny-fetch-send +
-## default +`http:deny-fetch-send` -Allows all fetch operations + + +Denies the fetch_send command without any pre-configured scope. +
diff --git a/plugins/http/permissions/default.toml b/plugins/http/permissions/default.toml index fd7802b4..b469536d 100644 --- a/plugins/http/permissions/default.toml +++ b/plugins/http/permissions/default.toml @@ -1,6 +1,19 @@ "$schema" = "schemas/schema.json" + [default] -description = "Allows all fetch operations" +description = """ +This permission set configures what kind of +fetch operations are available from the http plugin. + +This enables all fetch operations but does not +allow explicitly any origins to be fetched. This needs to +be manually configured before usage. + +#### Granted Permissions + +All fetch operations are enabled. + +""" permissions = [ "allow-fetch", "allow-fetch-cancel", diff --git a/plugins/http/permissions/schemas/schema.json b/plugins/http/permissions/schemas/schema.json index 559f707b..ea774399 100644 --- a/plugins/http/permissions/schemas/schema.json +++ b/plugins/http/permissions/schemas/schema.json @@ -17,7 +17,6 @@ }, "set": { "description": "A list of permissions sets defined", - "default": [], "type": "array", "items": { "$ref": "#/definitions/PermissionSet" @@ -50,7 +49,7 @@ "minimum": 1.0 }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -112,7 +111,7 @@ "type": "string" }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri internal convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -132,12 +131,21 @@ }, "scope": { "description": "Allowed or denied scoped when using this permission.", - "default": {}, "allOf": [ { "$ref": "#/definitions/Scopes" } ] + }, + "platforms": { + "description": "Target platforms this permission applies. By default all platforms are affected by this permission.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Target" + } } } }, @@ -164,7 +172,7 @@ } }, "Scopes": { - "description": "A restriction of the command/endpoint functionality.\n\nIt can be of any serde serializable type and is used for allowing or preventing certain actions inside a Tauri command.\n\nThe scope is passed to the command and handled/enforced by the command itself.", + "description": "An argument for fine grained behavior control of Tauri commands.\n\nIt can be of any serde serializable type and is used to allow or prevent certain actions inside a Tauri command. The configured scope is passed to the command and will be enforced by the command implementation.\n\n## Example\n\n```json { \"allow\": [{ \"path\": \"$HOME/**\" }], \"deny\": [{ \"path\": \"$HOME/secret.txt\" }] } ```", "type": "object", "properties": { "allow": { @@ -178,7 +186,7 @@ } }, "deny": { - "description": "Data that defines what is denied by the scope.", + "description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.", "type": [ "array", "null" @@ -243,71 +251,102 @@ } ] }, - "PermissionKind": { - "type": "string", + "Target": { + "description": "Platform target.", "oneOf": [ { - "description": "allow-fetch -> Enables the fetch command without any pre-configured scope.", + "description": "MacOS.", "type": "string", "enum": [ - "allow-fetch" + "macOS" ] }, { - "description": "deny-fetch -> Denies the fetch command without any pre-configured scope.", + "description": "Windows.", "type": "string", "enum": [ - "deny-fetch" + "windows" ] }, { - "description": "allow-fetch-cancel -> Enables the fetch_cancel command without any pre-configured scope.", + "description": "Linux.", "type": "string", "enum": [ - "allow-fetch-cancel" + "linux" ] }, { - "description": "deny-fetch-cancel -> Denies the fetch_cancel command without any pre-configured scope.", + "description": "Android.", "type": "string", "enum": [ - "deny-fetch-cancel" + "android" ] }, { - "description": "allow-fetch-read-body -> Enables the fetch_read_body command without any pre-configured scope.", + "description": "iOS.", "type": "string", "enum": [ - "allow-fetch-read-body" + "iOS" ] + } + ] + }, + "PermissionKind": { + "type": "string", + "oneOf": [ + { + "description": "Enables the fetch command without any pre-configured scope.", + "type": "string", + "const": "allow-fetch", + "markdownDescription": "Enables the fetch command without any pre-configured scope." }, { - "description": "deny-fetch-read-body -> Denies the fetch_read_body command without any pre-configured scope.", + "description": "Denies the fetch command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-fetch-read-body" - ] + "const": "deny-fetch", + "markdownDescription": "Denies the fetch command without any pre-configured scope." }, { - "description": "allow-fetch-send -> Enables the fetch_send command without any pre-configured scope.", + "description": "Enables the fetch_cancel command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-fetch-send" - ] + "const": "allow-fetch-cancel", + "markdownDescription": "Enables the fetch_cancel command without any pre-configured scope." }, { - "description": "deny-fetch-send -> Denies the fetch_send command without any pre-configured scope.", + "description": "Denies the fetch_cancel command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-fetch-send" - ] + "const": "deny-fetch-cancel", + "markdownDescription": "Denies the fetch_cancel command without any pre-configured scope." }, { - "description": "default -> Allows all fetch operations", + "description": "Enables the fetch_read_body command without any pre-configured scope.", "type": "string", - "enum": [ - "default" - ] + "const": "allow-fetch-read-body", + "markdownDescription": "Enables the fetch_read_body command without any pre-configured scope." + }, + { + "description": "Denies the fetch_read_body command without any pre-configured scope.", + "type": "string", + "const": "deny-fetch-read-body", + "markdownDescription": "Denies the fetch_read_body command without any pre-configured scope." + }, + { + "description": "Enables the fetch_send command without any pre-configured scope.", + "type": "string", + "const": "allow-fetch-send", + "markdownDescription": "Enables the fetch_send command without any pre-configured scope." + }, + { + "description": "Denies the fetch_send command without any pre-configured scope.", + "type": "string", + "const": "deny-fetch-send", + "markdownDescription": "Denies the fetch_send command without any pre-configured scope." + }, + { + "description": "This permission set configures what kind of\nfetch operations are available from the http plugin.\n\nThis enables all fetch operations but does not\nallow explicitly any origins to be fetched. This needs to\nbe manually configured before usage.\n\n#### Granted Permissions\n\nAll fetch operations are enabled.\n\n\n#### This default permission set includes:\n\n- `allow-fetch`\n- `allow-fetch-cancel`\n- `allow-fetch-read-body`\n- `allow-fetch-send`", + "type": "string", + "const": "default", + "markdownDescription": "This permission set configures what kind of\nfetch operations are available from the http plugin.\n\nThis enables all fetch operations but does not\nallow explicitly any origins to be fetched. This needs to\nbe manually configured before usage.\n\n#### Granted Permissions\n\nAll fetch operations are enabled.\n\n\n#### This default permission set includes:\n\n- `allow-fetch`\n- `allow-fetch-cancel`\n- `allow-fetch-read-body`\n- `allow-fetch-send`" } ] } diff --git a/plugins/http/rollup.config.js b/plugins/http/rollup.config.js index 977dfac8..1f349ec8 100644 --- a/plugins/http/rollup.config.js +++ b/plugins/http/rollup.config.js @@ -2,6 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { createConfig } from "../../shared/rollup.config.js"; +import { createConfig } from '../../shared/rollup.config.js' -export default createConfig(); +export default createConfig() diff --git a/plugins/http/src/api-iife.js b/plugins/http/src/api-iife.js deleted file mode 100644 index 40a09cb9..00000000 --- a/plugins/http/src/api-iife.js +++ /dev/null @@ -1 +0,0 @@ -if("__TAURI__"in window){var __TAURI_PLUGIN_HTTP__=function(e){"use strict";async function t(e,t={},r){return window.__TAURI_INTERNALS__.invoke(e,t,r)}return"function"==typeof SuppressedError&&SuppressedError,e.fetch=async function(e,r){const n=r?.maxRedirections,a=r?.connectTimeout,i=r?.proxy;r&&(delete r.maxRedirections,delete r.connectTimeout,delete r.proxy);const s=r?.signal,o=(r?.headers?r.headers instanceof Headers?Array.from(r.headers.entries()):Array.isArray(r.headers)?r.headers:Object.entries(r.headers):[]).map((([e,t])=>[e,"string"==typeof t?t:t.toString()])),d=new Request(e,r),c=await d.arrayBuffer(),u=c.byteLength?Array.from(new Uint8Array(c)):null,_=await t("plugin:http|fetch",{clientConfig:{method:d.method,url:d.url,headers:o,data:u,maxRedirections:n,connectTimeout:a,proxy:i}});s?.addEventListener("abort",(()=>{t("plugin:http|fetch_cancel",{rid:_})}));const{status:f,statusText:h,url:p,headers:l,rid:y}=await t("plugin:http|fetch_send",{rid:_}),T=await t("plugin:http|fetch_read_body",{rid:y}),w=new Response(T instanceof ArrayBuffer&&T.byteLength?T:T instanceof Array&&T.length?new Uint8Array(T):null,{headers:l,status:f,statusText:h});return Object.defineProperty(w,"url",{value:p}),w},e}({});Object.defineProperty(window.__TAURI__,"http",{value:__TAURI_PLUGIN_HTTP__})} diff --git a/plugins/http/src/commands.rs b/plugins/http/src/commands.rs index d4b2469b..bb47444e 100644 --- a/plugins/http/src/commands.rs +++ b/plugins/http/src/commands.rs @@ -2,38 +2,68 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -use std::{collections::HashMap, future::Future, pin::Pin, sync::Arc, time::Duration}; +use std::{future::Future, pin::Pin, str::FromStr, sync::Arc, time::Duration}; -use http::{header, HeaderName, HeaderValue, Method, StatusCode}; +use http::{header, HeaderMap, HeaderName, HeaderValue, Method, StatusCode}; use reqwest::{redirect::Policy, NoProxy}; use serde::{Deserialize, Serialize}; use tauri::{ async_runtime::Mutex, command, - ipc::{CommandScope, GlobalScope}, - AppHandle, Manager, ResourceId, Runtime, + ipc::{Channel, CommandScope, GlobalScope}, + Manager, ResourceId, ResourceTable, Runtime, State, Webview, }; +use tokio::sync::oneshot::{channel, Receiver, Sender}; use crate::{ scope::{Entry, Scope}, - Error, Result, + Error, Http, Result, }; +const HTTP_USER_AGENT: &str = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"),); + struct ReqwestResponse(reqwest::Response); +impl tauri::Resource for ReqwestResponse {} -type CancelableResponseResult = Result>; +type CancelableResponseResult = Result; type CancelableResponseFuture = Pin + Send + Sync>>; -struct FetchRequest(Mutex); -impl FetchRequest { - fn new(f: CancelableResponseFuture) -> Self { - Self(Mutex::new(f)) +struct FetchRequest { + fut: Mutex, + abort_tx_rid: ResourceId, + abort_rx_rid: ResourceId, +} +impl tauri::Resource for FetchRequest {} + +struct AbortSender(Sender<()>); +impl tauri::Resource for AbortRecveiver {} + +impl AbortSender { + fn abort(self) { + let _ = self.0.send(()); } } -impl tauri::Resource for FetchRequest {} -impl tauri::Resource for ReqwestResponse {} +struct AbortRecveiver(Receiver<()>); +impl tauri::Resource for AbortSender {} + +trait AddRequest { + fn add_request(&mut self, fut: CancelableResponseFuture) -> ResourceId; +} + +impl AddRequest for ResourceTable { + fn add_request(&mut self, fut: CancelableResponseFuture) -> ResourceId { + let (tx, rx) = channel::<()>(); + let (tx, rx) = (AbortSender(tx), AbortRecveiver(rx)); + let req = FetchRequest { + fut: Mutex::new(fut), + abort_tx_rid: self.add(tx), + abort_rx_rid: self.add(rx), + }; + self.add(req) + } +} #[derive(Serialize)] #[serde(rename_all = "camelCase")] @@ -45,7 +75,15 @@ pub struct FetchResponse { rid: ResourceId, } -#[derive(Deserialize)] +#[derive(Debug, Deserialize)] +#[serde(rename_all = "camelCase")] +#[allow(dead_code)] //feature flags shoudln't affect api +pub struct DangerousSettings { + accept_invalid_certs: bool, + accept_invalid_hostnames: bool, +} + +#[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] pub struct ClientConfig { method: String, @@ -55,9 +93,10 @@ pub struct ClientConfig { connect_timeout: Option, max_redirections: Option, proxy: Option, + danger: Option, } -#[derive(Deserialize)] +#[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] pub struct Proxy { all: Option, @@ -65,7 +104,7 @@ pub struct Proxy { https: Option, } -#[derive(Deserialize)] +#[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] #[serde(untagged)] pub enum UrlOrConfig { @@ -73,7 +112,7 @@ pub enum UrlOrConfig { Config(ProxyConfig), } -#[derive(Deserialize)] +#[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] pub struct ProxyConfig { url: String, @@ -81,7 +120,7 @@ pub struct ProxyConfig { no_proxy: Option, } -#[derive(Deserialize)] +#[derive(Debug, Deserialize)] pub struct BasicAuth { username: String, password: String, @@ -137,7 +176,8 @@ fn attach_proxy( #[command] pub async fn fetch( - app: AppHandle, + webview: Webview, + state: State<'_, Http>, client_config: ClientConfig, command_scope: CommandScope, global_scope: GlobalScope, @@ -145,16 +185,32 @@ pub async fn fetch( let ClientConfig { method, url, - headers, + headers: headers_raw, data, connect_timeout, max_redirections, proxy, + danger, } = client_config; let scheme = url.scheme(); let method = Method::from_bytes(method.as_bytes())?; - let headers: HashMap = HashMap::from_iter(headers); + + let mut headers = HeaderMap::new(); + for (h, v) in headers_raw { + let name = HeaderName::from_str(&h)?; + #[cfg(not(feature = "unsafe-headers"))] + if is_unsafe_header(&name) { + #[cfg(debug_assertions)] + { + eprintln!("[\x1b[33mWARNING\x1b[0m] Skipping {name} header as it is a forbidden header per fetch spec https://fetch.spec.whatwg.org/#terminology-headers"); + eprintln!("[\x1b[33mWARNING\x1b[0m] if keeping the header is a desired behavior, you can enable `unsafe-headers` feature flag in your Cargo.toml"); + } + continue; + } + + headers.append(name, HeaderValue::from_str(&v)?); + } match scheme { "http" | "https" => { @@ -174,6 +230,24 @@ pub async fn fetch( { let mut builder = reqwest::ClientBuilder::new(); + if let Some(danger_config) = danger { + #[cfg(not(feature = "dangerous-settings"))] + { + #[cfg(debug_assertions)] + { + eprintln!("[\x1b[33mWARNING\x1b[0m] using dangerous settings requires `dangerous-settings` feature flag in your Cargo.toml"); + } + let _ = danger_config; + return Err(Error::DangerousSettings); + } + #[cfg(feature = "dangerous-settings")] + { + builder = builder + .danger_accept_invalid_certs(danger_config.accept_invalid_certs) + .danger_accept_invalid_hostnames(danger_config.accept_invalid_hostnames) + } + } + if let Some(timeout) = connect_timeout { builder = builder.connect_timeout(Duration::from_millis(timeout)); } @@ -190,64 +264,60 @@ pub async fn fetch( builder = attach_proxy(proxy_config, builder)?; } - let mut request = builder.build()?.request(method.clone(), url); - - for (name, value) in &headers { - let name = HeaderName::from_bytes(name.as_bytes())?; - let value = HeaderValue::from_bytes(value.as_bytes())?; - if !matches!( - name, - // forbidden headers per fetch spec https://fetch.spec.whatwg.org/#terminology-headers - header::ACCEPT_CHARSET - | header::ACCEPT_ENCODING - | header::ACCESS_CONTROL_REQUEST_HEADERS - | header::ACCESS_CONTROL_REQUEST_METHOD - | header::CONNECTION - | header::CONTENT_LENGTH - | header::COOKIE - | header::DATE - | header::DNT - | header::EXPECT - | header::HOST - | header::ORIGIN - | header::REFERER - | header::SET_COOKIE - | header::TE - | header::TRAILER - | header::TRANSFER_ENCODING - | header::UPGRADE - | header::VIA - ) { - request = request.header(name, value); - } + #[cfg(feature = "cookies")] + { + builder = builder.cookie_provider(state.cookies_jar.clone()); } + let mut request = builder.build()?.request(method.clone(), url); + // POST and PUT requests should always have a 0 length content-length, // if there is no body. https://fetch.spec.whatwg.org/#http-network-or-cache-fetch if data.is_none() && matches!(method, Method::POST | Method::PUT) { - request = request.header(header::CONTENT_LENGTH, HeaderValue::from(0)); + headers.append(header::CONTENT_LENGTH, HeaderValue::from_str("0")?); } - if headers.contains_key(header::RANGE.as_str()) { + if headers.contains_key(header::RANGE) { // https://fetch.spec.whatwg.org/#http-network-or-cache-fetch step 18 // If httpRequest’s header list contains `Range`, then append (`Accept-Encoding`, `identity`) - request = request.header( - header::ACCEPT_ENCODING, - HeaderValue::from_static("identity"), - ); + headers.append(header::ACCEPT_ENCODING, HeaderValue::from_str("identity")?); + } + + if !headers.contains_key(header::USER_AGENT) { + headers.append(header::USER_AGENT, HeaderValue::from_str(HTTP_USER_AGENT)?); } - if !headers.contains_key(header::USER_AGENT.as_str()) { - request = request.header(header::USER_AGENT, HeaderValue::from_static("tauri")); + // ensure we have an Origin header set + if cfg!(not(feature = "unsafe-headers")) || !headers.contains_key(header::ORIGIN) { + if let Ok(url) = webview.url() { + headers.append( + header::ORIGIN, + HeaderValue::from_str(&url.origin().ascii_serialization())?, + ); + } } + // In case empty origin is passed, remove it. Some services do not like Origin header + // so this way we can remove it in explicit way. The default behaviour is still to set it + if cfg!(feature = "unsafe-headers") + && headers.get(header::ORIGIN) == Some(&HeaderValue::from_static("")) + { + headers.remove(header::ORIGIN); + }; + if let Some(data) = data { request = request.body(data); } - let fut = async move { Ok(request.send().await.map_err(Into::into)) }; - let mut resources_table = app.resources_table(); - let rid = resources_table.add(FetchRequest::new(Box::pin(fut))); + request = request.headers(headers); + + #[cfg(feature = "tracing")] + tracing::trace!("{:?}", request); + + let fut = async move { request.send().await.map_err(Into::into) }; + + let mut resources_table = webview.resources_table(); + let rid = resources_table.add_request(Box::pin(fut)); Ok(rid) } else { @@ -266,9 +336,12 @@ pub async fn fetch( .header(header::CONTENT_TYPE, data_url.mime_type().to_string()) .body(reqwest::Body::from(body))?; - let fut = async move { Ok(Ok(reqwest::Response::from(response))) }; - let mut resources_table = app.resources_table(); - let rid = resources_table.add(FetchRequest::new(Box::pin(fut))); + #[cfg(feature = "tracing")] + tracing::trace!("{:?}", response); + + let fut = async move { Ok(reqwest::Response::from(response)) }; + let mut resources_table = webview.resources_table(); + let rid = resources_table.add_request(Box::pin(fut)); Ok(rid) } _ => Err(Error::SchemeNotSupport(scheme.to_string())), @@ -276,32 +349,46 @@ pub async fn fetch( } #[command] -pub async fn fetch_cancel(app: AppHandle, rid: ResourceId) -> crate::Result<()> { - let req = { - let resources_table = app.resources_table(); - resources_table.get::(rid)? - }; - let mut req = req.0.lock().await; - *req = Box::pin(async { Err(Error::RequestCanceled) }); - +pub fn fetch_cancel(webview: Webview, rid: ResourceId) -> crate::Result<()> { + let mut resources_table = webview.resources_table(); + let req = resources_table.get::(rid)?; + let abort_tx = resources_table.take::(req.abort_tx_rid)?; + if let Some(abort_tx) = Arc::into_inner(abort_tx) { + abort_tx.abort(); + } Ok(()) } -#[tauri::command] +#[command] pub async fn fetch_send( - app: AppHandle, + webview: Webview, rid: ResourceId, ) -> crate::Result { - let req = { - let mut resources_table = app.resources_table(); - resources_table.take::(rid)? + let (req, abort_rx) = { + let mut resources_table = webview.resources_table(); + let req = resources_table.get::(rid)?; + let abort_rx = resources_table.take::(req.abort_rx_rid)?; + (req, abort_rx) }; - let res = match req.0.lock().await.as_mut().await { - Ok(Ok(res)) => res, - Ok(Err(e)) | Err(e) => return Err(e), + let Some(abort_rx) = Arc::into_inner(abort_rx) else { + return Err(Error::RequestCanceled); }; + let mut fut = req.fut.lock().await; + + let res = tokio::select! { + res = fut.as_mut() => res?, + _ = abort_rx.0 => { + let mut resources_table = webview.resources_table(); + resources_table.close(rid)?; + return Err(Error::RequestCanceled); + } + }; + + #[cfg(feature = "tracing")] + tracing::trace!("{:?}", res); + let status = res.status(); let url = res.url().to_string(); let mut headers = Vec::new(); @@ -312,7 +399,7 @@ pub async fn fetch_send( )); } - let mut resources_table = app.resources_table(); + let mut resources_table = webview.resources_table(); let rid = resources_table.add(ReqwestResponse(res)); Ok(FetchResponse { @@ -324,15 +411,59 @@ pub async fn fetch_send( }) } -#[tauri::command] -pub(crate) async fn fetch_read_body( - app: AppHandle, +#[command] +pub async fn fetch_read_body( + webview: Webview, rid: ResourceId, -) -> crate::Result { + stream_channel: Channel, +) -> crate::Result<()> { let res = { - let mut resources_table = app.resources_table(); + let mut resources_table = webview.resources_table(); resources_table.take::(rid)? }; - let res = Arc::into_inner(res).unwrap().0; - Ok(tauri::ipc::Response::new(res.bytes().await?.to_vec())) + + let mut res = Arc::into_inner(res).unwrap().0; + + // send response through IPC channel + while let Some(chunk) = res.chunk().await? { + let mut chunk = chunk.to_vec(); + // append 0 to indicate we are not done yet + chunk.push(0); + stream_channel.send(tauri::ipc::InvokeResponseBody::Raw(chunk))?; + } + + // send 1 to indicate we are done + stream_channel.send(tauri::ipc::InvokeResponseBody::Raw(vec![1]))?; + + Ok(()) +} + +// forbidden headers per fetch spec https://fetch.spec.whatwg.org/#terminology-headers +#[cfg(not(feature = "unsafe-headers"))] +fn is_unsafe_header(header: &HeaderName) -> bool { + matches!( + *header, + header::ACCEPT_CHARSET + | header::ACCEPT_ENCODING + | header::ACCESS_CONTROL_REQUEST_HEADERS + | header::ACCESS_CONTROL_REQUEST_METHOD + | header::CONNECTION + | header::CONTENT_LENGTH + | header::COOKIE + | header::DATE + | header::DNT + | header::EXPECT + | header::HOST + | header::ORIGIN + | header::REFERER + | header::SET_COOKIE + | header::TE + | header::TRAILER + | header::TRANSFER_ENCODING + | header::UPGRADE + | header::VIA + ) || { + let lower = header.as_str().to_lowercase(); + lower.starts_with("proxy-") || lower.starts_with("sec-") + } } diff --git a/plugins/http/src/error.rs b/plugins/http/src/error.rs index 78ff08a2..ef8de0c5 100644 --- a/plugins/http/src/error.rs +++ b/plugins/http/src/error.rs @@ -41,6 +41,8 @@ pub enum Error { Tauri(#[from] tauri::Error), #[error(transparent)] Utf8(#[from] std::string::FromUtf8Error), + #[error("dangerous settings used but are not enabled")] + DangerousSettings, } impl Serialize for Error { diff --git a/plugins/http/src/lib.rs b/plugins/http/src/lib.rs index e4aa7ba1..5acc2b47 100644 --- a/plugins/http/src/lib.rs +++ b/plugins/http/src/lib.rs @@ -2,49 +2,89 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -//! [![](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/http/banner.png)](https://github.com/tauri-apps/plugins-workspace/tree/v2/plugins/http) -//! //! Access the HTTP client written in Rust. pub use reqwest; use tauri::{ plugin::{Builder, TauriPlugin}, - AppHandle, Manager, Runtime, + Manager, Runtime, }; pub use error::{Error, Result}; mod commands; mod error; +#[cfg(feature = "cookies")] +mod reqwest_cookie_store; mod scope; -struct Http { - #[allow(dead_code)] - app: AppHandle, -} - -trait HttpExt { - fn http(&self) -> &Http; -} +#[cfg(feature = "cookies")] +const COOKIES_FILENAME: &str = ".cookies"; -impl> HttpExt for T { - fn http(&self) -> &Http { - self.state::>().inner() - } +pub(crate) struct Http { + #[cfg(feature = "cookies")] + cookies_jar: std::sync::Arc, } pub fn init() -> TauriPlugin { Builder::::new("http") - .js_init_script(include_str!("api-iife.js").to_string()) + .setup(|app, _| { + #[cfg(feature = "cookies")] + let cookies_jar = { + use crate::reqwest_cookie_store::*; + use std::fs::File; + use std::io::BufReader; + + let cache_dir = app.path().app_cache_dir()?; + std::fs::create_dir_all(&cache_dir)?; + + let path = cache_dir.join(COOKIES_FILENAME); + let file = File::options() + .create(true) + .append(true) + .read(true) + .open(&path)?; + + let reader = BufReader::new(file); + CookieStoreMutex::load(path.clone(), reader).unwrap_or_else(|_e| { + #[cfg(feature = "tracing")] + tracing::warn!( + "failed to load cookie store: {_e}, falling back to empty store" + ); + CookieStoreMutex::new(path, Default::default()) + }) + }; + + let state = Http { + #[cfg(feature = "cookies")] + cookies_jar: std::sync::Arc::new(cookies_jar), + }; + + app.manage(state); + + Ok(()) + }) + .on_event(|app, event| { + #[cfg(feature = "cookies")] + if let tauri::RunEvent::Exit = event { + let state = app.state::(); + + match state.cookies_jar.request_save() { + Ok(rx) => { + let _ = rx.recv(); + } + Err(_e) => { + #[cfg(feature = "tracing")] + tracing::error!("failed to save cookie jar: {_e}"); + } + } + } + }) .invoke_handler(tauri::generate_handler![ commands::fetch, commands::fetch_cancel, commands::fetch_send, - commands::fetch_read_body, + commands::fetch_read_body ]) - .setup(|app, _api| { - app.manage(Http { app: app.clone() }); - Ok(()) - }) .build() } diff --git a/plugins/http/src/reqwest_cookie_store.rs b/plugins/http/src/reqwest_cookie_store.rs new file mode 100644 index 00000000..6a7c0186 --- /dev/null +++ b/plugins/http/src/reqwest_cookie_store.rs @@ -0,0 +1,133 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +// taken from https://github.com/pfernie/reqwest_cookie_store/blob/2ec4afabcd55e24d3afe3f0626ee6dc97bed938d/src/lib.rs + +use std::{ + path::PathBuf, + sync::{mpsc::Receiver, Mutex}, +}; + +use cookie_store::{CookieStore, RawCookie, RawCookieParseError}; +use reqwest::header::HeaderValue; + +fn set_cookies( + cookie_store: &mut CookieStore, + cookie_headers: &mut dyn Iterator, + url: &url::Url, +) { + let cookies = cookie_headers.filter_map(|val| { + std::str::from_utf8(val.as_bytes()) + .map_err(RawCookieParseError::from) + .and_then(RawCookie::parse) + .map(|c| c.into_owned()) + .ok() + }); + cookie_store.store_response_cookies(cookies, url); +} + +fn cookies(cookie_store: &CookieStore, url: &url::Url) -> Option { + let s = cookie_store + .get_request_values(url) + .map(|(name, value)| format!("{}={}", name, value)) + .collect::>() + .join("; "); + + if s.is_empty() { + return None; + } + + HeaderValue::from_maybe_shared(bytes::Bytes::from(s)).ok() +} + +/// A [`cookie_store::CookieStore`] wrapped internally by a [`std::sync::Mutex`], suitable for use in +/// async/concurrent contexts. +#[derive(Debug)] +pub struct CookieStoreMutex { + pub path: PathBuf, + store: Mutex, + save_task: Mutex>, +} + +impl CookieStoreMutex { + /// Create a new [`CookieStoreMutex`] from an existing [`cookie_store::CookieStore`]. + pub fn new(path: PathBuf, cookie_store: CookieStore) -> CookieStoreMutex { + CookieStoreMutex { + path, + store: Mutex::new(cookie_store), + save_task: Default::default(), + } + } + + pub fn load( + path: PathBuf, + reader: R, + ) -> cookie_store::Result { + cookie_store::serde::load(reader, |c| serde_json::from_str(c)) + .map(|store| CookieStoreMutex::new(path, store)) + } + + fn cookies_to_str(&self) -> Result { + let mut cookies = Vec::new(); + for cookie in self + .store + .lock() + .expect("poisoned cookie jar mutex") + .iter_unexpired() + { + if cookie.is_persistent() { + cookies.push(cookie.clone()); + } + } + serde_json::to_string(&cookies) + } + + pub fn request_save(&self) -> cookie_store::Result> { + let cookie_str = self.cookies_to_str()?; + let path = self.path.clone(); + let (tx, rx) = std::sync::mpsc::channel(); + let task = tauri::async_runtime::spawn(async move { + match tokio::fs::write(&path, &cookie_str).await { + Ok(()) => { + let _ = tx.send(()); + } + Err(_e) => { + #[cfg(feature = "tracing")] + tracing::error!("failed to save cookie jar: {_e}"); + } + } + }); + self.save_task + .lock() + .unwrap() + .replace(CancellableTask(task)); + Ok(rx) + } +} + +impl reqwest::cookie::CookieStore for CookieStoreMutex { + fn set_cookies(&self, cookie_headers: &mut dyn Iterator, url: &url::Url) { + set_cookies(&mut self.store.lock().unwrap(), cookie_headers, url); + + // try to persist cookies immediately asynchronously + if let Err(_e) = self.request_save() { + #[cfg(feature = "tracing")] + tracing::error!("failed to save cookie jar: {_e}"); + } + } + + fn cookies(&self, url: &url::Url) -> Option { + let store = self.store.lock().unwrap(); + cookies(&store, url) + } +} + +#[derive(Debug)] +struct CancellableTask(tauri::async_runtime::JoinHandle<()>); + +impl Drop for CancellableTask { + fn drop(&mut self) { + self.0.abort(); + } +} diff --git a/plugins/http/src/scope.rs b/plugins/http/src/scope.rs index d80a55fb..2123f215 100644 --- a/plugins/http/src/scope.rs +++ b/plugins/http/src/scope.rs @@ -2,13 +2,42 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT +use std::sync::Arc; + use serde::{Deserialize, Deserializer}; use url::Url; +use urlpattern::{UrlPattern, UrlPatternMatchInput}; #[allow(rustdoc::bare_urls)] #[derive(Debug)] pub struct Entry { - pub url: glob::Pattern, + pub url: UrlPattern, +} + +fn parse_url_pattern(s: &str) -> Result { + let mut init = urlpattern::UrlPatternInit::parse_constructor_string::(s, None)?; + if init.search.as_ref().map(|p| p.is_empty()).unwrap_or(true) { + init.search.replace("*".to_string()); + } + if init.hash.as_ref().map(|p| p.is_empty()).unwrap_or(true) { + init.hash.replace("*".to_string()); + } + if init + .pathname + .as_ref() + .map(|p| p.is_empty() || p == "/") + .unwrap_or(true) + { + init.pathname.replace("*".to_string()); + } + UrlPattern::parse(init, Default::default()) +} + +#[derive(Deserialize)] +#[serde(untagged)] +pub(crate) enum EntryRaw { + Value(String), + Object { url: String }, } impl<'de> Deserialize<'de> for Entry { @@ -16,18 +45,14 @@ impl<'de> Deserialize<'de> for Entry { where D: Deserializer<'de>, { - #[derive(Deserialize)] - struct EntryRaw { - url: String, - } - EntryRaw::deserialize(deserializer).and_then(|raw| { + let url = match raw { + EntryRaw::Value(url) => url, + EntryRaw::Object { url } => url, + }; Ok(Entry { - url: glob::Pattern::new(&raw.url).map_err(|e| { - serde::de::Error::custom(format!( - "URL `{}` is not a valid glob pattern: {e}", - raw.url - )) + url: parse_url_pattern(&url).map_err(|e| { + serde::de::Error::custom(format!("`{}` is not a valid URL pattern: {e}", url)) })?, }) }) @@ -37,32 +62,32 @@ impl<'de> Deserialize<'de> for Entry { /// Scope for filesystem access. #[derive(Debug)] pub struct Scope<'a> { - allowed: Vec<&'a Entry>, - denied: Vec<&'a Entry>, + allowed: Vec<&'a Arc>, + denied: Vec<&'a Arc>, } impl<'a> Scope<'a> { /// Creates a new scope from the scope configuration. - pub(crate) fn new(allowed: Vec<&'a Entry>, denied: Vec<&'a Entry>) -> Self { + pub(crate) fn new(allowed: Vec<&'a Arc>, denied: Vec<&'a Arc>) -> Self { Self { allowed, denied } } /// Determines if the given URL is allowed on this scope. pub fn is_allowed(&self, url: &Url) -> bool { let denied = self.denied.iter().any(|entry| { - entry.url.matches(url.as_str()) - || entry - .url - .matches(url.as_str().strip_suffix('/').unwrap_or_default()) + entry + .url + .test(UrlPatternMatchInput::Url(url.clone())) + .unwrap_or_default() }); if denied { false } else { self.allowed.iter().any(|entry| { - entry.url.matches(url.as_str()) - || entry - .url - .matches(url.as_str().strip_suffix('/').unwrap_or_default()) + entry + .url + .test(UrlPatternMatchInput::Url(url.clone())) + .unwrap_or_default() }) } } @@ -70,69 +95,137 @@ impl<'a> Scope<'a> { #[cfg(test)] mod tests { - use std::str::FromStr; + use std::{str::FromStr, sync::Arc}; use super::Entry; impl FromStr for Entry { - type Err = glob::PatternError; + type Err = urlpattern::quirks::Error; fn from_str(s: &str) -> Result { - let pattern = s.parse()?; + let pattern = super::parse_url_pattern(s)?; Ok(Self { url: pattern }) } } #[test] - fn is_allowed() { + fn denied_takes_precedence() { + let allow = Arc::new("http://localhost:8080/file.png".parse().unwrap()); + let deny = Arc::new("http://localhost:8080/*".parse().unwrap()); + let scope = super::Scope::new(vec![&allow], vec![&deny]); + assert!(!scope.is_allowed(&"http://localhost:8080/file.png".parse().unwrap())); + assert!(!scope.is_allowed(&"http://localhost:8080?framework=tauri".parse().unwrap())); + } + + #[test] + fn fixed_url() { // plain URL - let entry = "http://localhost:8080".parse().unwrap(); + let entry = Arc::new("http://localhost:8080".parse().unwrap()); let scope = super::Scope::new(vec![&entry], Vec::new()); assert!(scope.is_allowed(&"http://localhost:8080".parse().unwrap())); assert!(scope.is_allowed(&"http://localhost:8080/".parse().unwrap())); + assert!(scope.is_allowed(&"http://localhost:8080/file".parse().unwrap())); + assert!(scope.is_allowed(&"http://localhost:8080/path/to/asset.png".parse().unwrap())); + assert!(scope.is_allowed(&"http://localhost:8080/path/list?limit=50".parse().unwrap())); - assert!(!scope.is_allowed(&"http://localhost:8080/file".parse().unwrap())); - assert!(!scope.is_allowed(&"http://localhost:8080/path/to/asset.png".parse().unwrap())); assert!(!scope.is_allowed(&"https://localhost:8080".parse().unwrap())); assert!(!scope.is_allowed(&"http://localhost:8081".parse().unwrap())); assert!(!scope.is_allowed(&"http://local:8080".parse().unwrap())); + } - // deny takes precedence - let allow = "http://localhost:8080/file.png".parse().unwrap(); - let deny = "http://localhost:8080/*".parse().unwrap(); - let scope = super::Scope::new(vec![&allow], vec![&deny]); - assert!(!scope.is_allowed(&"http://localhost:8080/file.png".parse().unwrap())); - + #[test] + fn fixed_path() { // URL with fixed path - let entry = "http://localhost:8080/file.png".parse().unwrap(); + let entry = Arc::new("http://localhost:8080/file.png".parse().unwrap()); let scope = super::Scope::new(vec![&entry], Vec::new()); assert!(scope.is_allowed(&"http://localhost:8080/file.png".parse().unwrap())); + assert!(scope.is_allowed(&"http://localhost:8080/file.png?q=1".parse().unwrap())); assert!(!scope.is_allowed(&"http://localhost:8080".parse().unwrap())); assert!(!scope.is_allowed(&"http://localhost:8080/file".parse().unwrap())); assert!(!scope.is_allowed(&"http://localhost:8080/file.png/other.jpg".parse().unwrap())); + } - // URL with glob pattern - let entry = "http://localhost:8080/*.png".parse().unwrap(); + #[test] + fn pattern_wildcard() { + let entry = Arc::new("http://localhost:8080/*.png".parse().unwrap()); let scope = super::Scope::new(vec![&entry], Vec::new()); assert!(scope.is_allowed(&"http://localhost:8080/file.png".parse().unwrap())); + assert!(scope.is_allowed(&"http://localhost:8080/file.png#head".parse().unwrap())); assert!(scope.is_allowed(&"http://localhost:8080/assets/file.png".parse().unwrap())); + assert!(scope.is_allowed( + &"http://localhost:8080/assets/file.png?width=100&height=200" + .parse() + .unwrap() + )); assert!(!scope.is_allowed(&"http://localhost:8080/file.jpeg".parse().unwrap())); + } - let entry = "http://*".parse().unwrap(); + #[test] + fn domain_wildcard() { + let entry = Arc::new("http://*".parse().unwrap()); let scope = super::Scope::new(vec![&entry], Vec::new()); assert!(scope.is_allowed(&"http://something.else".parse().unwrap())); + assert!(scope.is_allowed(&"http://something.else#tauri".parse().unwrap())); assert!(scope.is_allowed(&"http://something.else/path/to/file".parse().unwrap())); + assert!(scope.is_allowed(&"http://something.else?rel=tauri".parse().unwrap())); + assert!(scope.is_allowed( + &"http://something.else/path/to/file.mp4?start=500" + .parse() + .unwrap() + )); + assert!(!scope.is_allowed(&"https://something.else".parse().unwrap())); - let entry = "http://**".parse().unwrap(); + let entry = Arc::new("http://*/*".parse().unwrap()); + let scope = super::Scope::new(vec![&entry], Vec::new()); + + assert!(scope.is_allowed(&"http://something.else".parse().unwrap())); + assert!(scope.is_allowed(&"http://something.else/path/to/file".parse().unwrap())); + } + + #[test] + fn scheme_wildcard() { + let entry = Arc::new("*://*".parse().unwrap()); + let scope = super::Scope::new(vec![&entry], Vec::new()); + + assert!(scope.is_allowed(&"http://something.else".parse().unwrap())); + assert!(scope.is_allowed(&"http://something.else/path/to/file".parse().unwrap())); + assert!(scope.is_allowed(&"file://path".parse().unwrap())); + assert!(scope.is_allowed(&"file://path/to/file".parse().unwrap())); + assert!(scope.is_allowed(&"https://something.else".parse().unwrap())); + assert!(scope.is_allowed(&"https://something.else?x=1#frag".parse().unwrap())); + + let entry = Arc::new("*://*/*".parse().unwrap()); let scope = super::Scope::new(vec![&entry], Vec::new()); assert!(scope.is_allowed(&"http://something.else".parse().unwrap())); assert!(scope.is_allowed(&"http://something.else/path/to/file".parse().unwrap())); + assert!(scope.is_allowed(&"file://path/to/file".parse().unwrap())); + assert!(scope.is_allowed(&"https://something.else".parse().unwrap())); + } + + #[test] + fn validate_query() { + let entry = Arc::new("https://tauri.app/path?x=*".parse().unwrap()); + let scope = super::Scope::new(vec![&entry], Vec::new()); + + assert!(scope.is_allowed(&"https://tauri.app/path?x=5".parse().unwrap())); + + assert!(!scope.is_allowed(&"https://tauri.app/path?y=5".parse().unwrap())); + } + + #[test] + fn validate_hash() { + let entry = Arc::new("https://tauri.app/path#frame*".parse().unwrap()); + let scope = super::Scope::new(vec![&entry], Vec::new()); + + assert!(scope.is_allowed(&"https://tauri.app/path#frame".parse().unwrap())); + + assert!(!scope.is_allowed(&"https://tauri.app/path#work".parse().unwrap())); } } diff --git a/plugins/localhost/CHANGELOG.md b/plugins/localhost/CHANGELOG.md index d69e3727..f2b15a89 100644 --- a/plugins/localhost/CHANGELOG.md +++ b/plugins/localhost/CHANGELOG.md @@ -1,5 +1,62 @@ # Changelog +## \[2.2.0] + +- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other. + +## \[2.1.0] + +- [`3449dd5a`](https://github.com/tauri-apps/plugins-workspace/commit/3449dd5a8f6d12fee8d6389c034fe47e19d72bcd) ([#1982](https://github.com/tauri-apps/plugins-workspace/pull/1982) by [@arihav](https://github.com/tauri-apps/plugins-workspace/../../arihav)) Add custom host binding to allow external access + +## \[2.0.1] + +- [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7. + +## \[2.0.0] + +- [`e2c4dfb6`](https://github.com/tauri-apps/plugins-workspace/commit/e2c4dfb6af43e5dd8d9ceba232c315f5febd55c1) Update to tauri v2 stable release. + +## \[2.0.0-rc.1] + +- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri 2.0.0-rc.8 + +## \[2.0.0-rc.0] + +- [`9887d1`](https://github.com/tauri-apps/plugins-workspace/commit/9887d14bd0e971c4c0f5c1188fc4005d3fc2e29e) Update to tauri RC. + +## \[2.0.0-beta.9] + +- [`e847cedc`](https://github.com/tauri-apps/plugins-workspace/commit/e847cedc1f46f3e7a2ad81ea579b620bc5b992d7) ([#1402](https://github.com/tauri-apps/plugins-workspace/pull/1402) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Use no default features on tauri for all plugins so that consumers can use `default-features = false` on tauri, note that this will still enable wry feature on iOS +- [`6de87966`](https://github.com/tauri-apps/plugins-workspace/commit/6de87966ecc00ad9d91c25be452f1f46bd2b7e1f) ([#1597](https://github.com/tauri-apps/plugins-workspace/pull/1597) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Update to tauri beta.25. + +## \[2.0.0-beta.8] + +- [`22a17980`](https://github.com/tauri-apps/plugins-workspace/commit/22a17980ff4f6f8c40adb1b8f4ffc6dae2fe7e30) ([#1537](https://github.com/tauri-apps/plugins-workspace/pull/1537) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri beta.24. + +## \[2.0.0-beta.7] + +- [`76daee7a`](https://github.com/tauri-apps/plugins-workspace/commit/76daee7aafece34de3092c86e531cf9eb1138989) ([#1512](https://github.com/tauri-apps/plugins-workspace/pull/1512) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Update to tauri beta.23. + +## \[2.0.0-beta.6] + +- [`9013854f`](https://github.com/tauri-apps/plugins-workspace/commit/9013854f42a49a230b9dbb9d02774765528a923f)([#1382](https://github.com/tauri-apps/plugins-workspace/pull/1382)) Update to tauri beta.22. + +## \[2.0.0-beta.5] + +- [`430bd6f4`](https://github.com/tauri-apps/plugins-workspace/commit/430bd6f4f379bee5d232ae6b098ae131db7f178a)([#1363](https://github.com/tauri-apps/plugins-workspace/pull/1363)) Update to tauri beta.20. + +## \[2.0.0-beta.4] + +- [`bd1ed590`](https://github.com/tauri-apps/plugins-workspace/commit/bd1ed5903ffcce5500310dac1e59e8c67674ef1e)([#1237](https://github.com/tauri-apps/plugins-workspace/pull/1237)) Update to tauri beta.17. + +## \[2.0.0-beta.3] + +- [`a04ea2f`](https://github.com/tauri-apps/plugins-workspace/commit/a04ea2f38294d5a3987578283badc8eec87a7752)([#1071](https://github.com/tauri-apps/plugins-workspace/pull/1071)) The global API script is now only added to the binary when the `withGlobalTauri` config is true. + +## \[2.0.0-beta.2] + +- [`99bea25`](https://github.com/tauri-apps/plugins-workspace/commit/99bea2559c2c0648c2519c50a18cd124dacef57b)([#1005](https://github.com/tauri-apps/plugins-workspace/pull/1005)) Update to tauri beta.8. + ## \[2.0.0-beta.1] - [`14f381a`](https://github.com/tauri-apps/plugins-workspace/commit/14f381acf8fe690acecc676922c6f05939b95734) Update MSRV to 1.75. diff --git a/plugins/localhost/Cargo.toml b/plugins/localhost/Cargo.toml index e23343dc..34ee7ee6 100644 --- a/plugins/localhost/Cargo.toml +++ b/plugins/localhost/Cargo.toml @@ -1,15 +1,23 @@ [package] name = "tauri-plugin-localhost" -version = "2.0.0-beta.1" +version = "2.2.0" description = "Expose your apps assets through a localhost server instead of the default custom protocol." authors = { workspace = true } license = { workspace = true } edition = { workspace = true } rust-version = { workspace = true } +repository = { workspace = true } [package.metadata.docs.rs] -rustc-args = [ "--cfg", "docsrs" ] -rustdoc-args = [ "--cfg", "docsrs" ] +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs"] + +[package.metadata.platforms.support] +windows = { level = "full", notes = "" } +linux = { level = "full", notes = "" } +macos = { level = "full", notes = "" } +android = { level = "none", notes = "" } +ios = { level = "none", notes = "" } [dependencies] serde = { workspace = true } diff --git a/plugins/localhost/README.md b/plugins/localhost/README.md index 0b21087e..dc0d98d2 100644 --- a/plugins/localhost/README.md +++ b/plugins/localhost/README.md @@ -2,11 +2,19 @@ Expose your apps assets through a localhost server instead of the default custom protocol. +| Platform | Supported | +| -------- | --------- | +| Linux | ✓ | +| Windows | ✓ | +| macOS | ✓ | +| Android | ✓ | +| iOS | ✓ | + > Note: This plugins brings considerable security risks and you should only use it if you know what your are doing. If in doubt, use the default custom protocol implementation. ## Install -_This plugin requires a Rust version of at least **1.75**_ +_This plugin requires a Rust version of at least **1.77.2**_ There are three general methods of installation that we can recommend. @@ -21,7 +29,7 @@ Install the Core plugin by adding the following to your `Cargo.toml` file: ```toml [dependencies] portpicker = "0.1" # used in the example to pick a random free port -tauri-plugin-localhost = "2.0.0-beta" +tauri-plugin-localhost = "2.0.0" # alternatively with Git: tauri-plugin-localhost = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` @@ -30,7 +38,7 @@ tauri-plugin-localhost = { git = "https://github.com/tauri-apps/plugins-workspac First you need to register the core plugin with Tauri: -`src-tauri/src/main.rs` +`src-tauri/src/lib.rs` ```rust use tauri::{Manager, window::WindowBuilder, WindowUrl}; diff --git a/plugins/localhost/SECURITY.md b/plugins/localhost/SECURITY.md new file mode 100644 index 00000000..4f09bbac --- /dev/null +++ b/plugins/localhost/SECURITY.md @@ -0,0 +1,23 @@ +# Security Policy + +**Do not report security vulnerabilities through public GitHub issues.** + +**Please use the [Private Vulnerability Disclosure](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability) feature of GitHub.** + +Include as much of the following information: + +- Type of issue (e.g. improper input parsing, privilege escalation, etc.) +- The location of the affected source code (tag/branch/commit or direct URL) +- Any special configuration required to reproduce the issue +- The distribution affected or used to help us with reproduction of the issue +- Step-by-step instructions to reproduce the issue +- Ideally a reproduction repository +- Impact of the issue, including how an attacker might exploit the issue + +We prefer to receive reports in English. + +## Contact + +Please disclose a vulnerability or security relevant issue here: [https://github.com/tauri-apps/plugins-workspace/security/advisories/new](https://github.com/tauri-apps/plugins-workspace/security/advisories/new). + +Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app). diff --git a/plugins/localhost/src/lib.rs b/plugins/localhost/src/lib.rs index c0b42a29..5b00087f 100644 --- a/plugins/localhost/src/lib.rs +++ b/plugins/localhost/src/lib.rs @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -//! [![](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/localhost/banner.png)](https://github.com/tauri-apps/plugins-workspace/tree/v2/plugins/localhost) -//! //! Expose your apps assets through a localhost server instead of the default custom protocol. //! //! **Note: This plugins brings considerable security risks and you should only use it if you know what your are doing. If in doubt, use the default custom protocol implementation.** @@ -46,6 +44,7 @@ type OnRequest = Option>; pub struct Builder { port: u16, + host: Option, on_request: OnRequest, } @@ -53,10 +52,17 @@ impl Builder { pub fn new(port: u16) -> Self { Self { port, + host: None, on_request: None, } } + // Change the host the plugin binds to. Defaults to `localhost`. + pub fn host>(mut self, host: H) -> Self { + self.host = Some(host.into()); + self + } + pub fn on_request( mut self, f: F, @@ -67,6 +73,7 @@ impl Builder { pub fn build(mut self) -> TauriPlugin { let port = self.port; + let host = self.host.unwrap_or("localhost".to_string()); let on_request = self.on_request.take(); PluginBuilder::new("localhost") @@ -74,7 +81,7 @@ impl Builder { let asset_resolver = app.asset_resolver(); std::thread::spawn(move || { let server = - Server::http(&format!("localhost:{port}")).expect("Unable to spawn server"); + Server::http(format!("{host}:{port}")).expect("Unable to spawn server"); for req in server.incoming_requests() { let path = req .url() @@ -102,16 +109,6 @@ impl Builder { on_request(&request, &mut response); } - #[cfg(target_os = "linux")] - if let Some(response_csp) = - response.headers.get("Content-Security-Policy") - { - let html = String::from_utf8_lossy(&asset.bytes); - let body = - html.replacen(tauri::utils::html::CSP_TOKEN, response_csp, 1); - asset.bytes = body.as_bytes().to_vec(); - } - let mut resp = HttpResponse::from_data(asset.bytes); for (header, value) in response.headers { if let Ok(h) = Header::from_bytes(header.as_bytes(), value) { diff --git a/plugins/log/.gitignore b/plugins/log/.gitignore deleted file mode 100644 index 28fd5eff..00000000 --- a/plugins/log/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules -/.tauri diff --git a/plugins/log/CHANGELOG.md b/plugins/log/CHANGELOG.md index 2978fe21..210df69b 100644 --- a/plugins/log/CHANGELOG.md +++ b/plugins/log/CHANGELOG.md @@ -1,5 +1,114 @@ # Changelog +## \[2.4.0] + +- [`c9b21f6f`](https://github.com/tauri-apps/plugins-workspace/commit/c9b21f6f4345806eff5f495885f20dea0082b7d7) ([#2625](https://github.com/tauri-apps/plugins-workspace/pull/2625) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Export the `LogLevel` type. +- [`9629c2f4`](https://github.com/tauri-apps/plugins-workspace/commit/9629c2f4f90a56b5c2d265d1d13d3af40fc0c525) ([#2600](https://github.com/tauri-apps/plugins-workspace/pull/2600) by [@exoego](https://github.com/tauri-apps/plugins-workspace/../../exoego)) Adds a new varient `TargetKind::Dispatch` that allows you to construct arbitrary log targets +- [`686a839c`](https://github.com/tauri-apps/plugins-workspace/commit/686a839c96fae1b0334f2df9dc76ca5cdbe00dbe) ([#2626](https://github.com/tauri-apps/plugins-workspace/pull/2626) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Fix iOS app stuck when using the iOS Simulator and the log plugin due to a deadlock when calling os_log too early. + +### feat + +- [`60fc35d3`](https://github.com/tauri-apps/plugins-workspace/commit/60fc35d35cccaf1654eceb4446ecf0f89dc15502) ([#2576](https://github.com/tauri-apps/plugins-workspace/pull/2576) by [@3lpsy](https://github.com/tauri-apps/plugins-workspace/../../3lpsy)) Add a `tracing` feature to the `log` plugin that emits log messages to the `tracing` system. + +## \[2.3.1] + +- [`1bb1ced5`](https://github.com/tauri-apps/plugins-workspace/commit/1bb1ced53820127204aa7adf57510c1cbce55e12) ([#2524](https://github.com/tauri-apps/plugins-workspace/pull/2524) by [@elwerene](https://github.com/tauri-apps/plugins-workspace/../../elwerene)) enable TargetKind::LogDir on mobile + +## \[2.3.0] + +### feat + +- [`02481501`](https://github.com/tauri-apps/plugins-workspace/commit/024815018fbc63a37afc716796a454925aa7d25e) ([#2377](https://github.com/tauri-apps/plugins-workspace/pull/2377) by [@3lpsy](https://github.com/tauri-apps/plugins-workspace/../../3lpsy)) Add a `is_skip_logger` flag to the Log Plugin `Builder` struct, a `skip_logger()` method to the Builder, and logic to avoid acquiring (creating) a logger and attaching it to the global logger. Since acquire_logger is pub, a `LoggerNotInitialized` is added and returned if it's called when the `is_skip_looger` flag is set. Overall, this feature permits a user to avoid calling `attach_logger` which can only be called once in a program's lifetime and allows the user to control the logger returned from `logger()`. Additionally, it also will allow users to generate multiple Tauri Mock apps in test suites that run and parallel and have the `log` plugin attached (assuming they use `skip_logger()`). + +## \[2.2.3] + +- [`1a984659`](https://github.com/tauri-apps/plugins-workspace/commit/1a9846599b6a71faf330845847a30f6bf9735898) ([#2469](https://github.com/tauri-apps/plugins-workspace/pull/2469) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Update `objc2` crate to 0.6. No user facing changes. + +## \[2.2.2] + +- [`6b4c3917`](https://github.com/tauri-apps/plugins-workspace/commit/6b4c3917389f4bc489d03b48a837557ac0584175) ([#2401](https://github.com/tauri-apps/plugins-workspace/pull/2401) by [@Seishiin](https://github.com/tauri-apps/plugins-workspace/../../Seishiin)) Fix timezone_strategy overwriting previously set LogLevels. + +## \[2.2.1] + +- [`784a54a3`](https://github.com/tauri-apps/plugins-workspace/commit/784a54a39094dfbaaa8dd123eb083c04dc6c3bb2) ([#2344](https://github.com/tauri-apps/plugins-workspace/pull/2344) by [@madsmtm](https://github.com/tauri-apps/plugins-workspace/../../madsmtm)) Use `objc2` instead of `objc`. + +## \[2.2.0] + +- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other. + +## \[2.0.2] + +- [`69d508ee`](https://github.com/tauri-apps/plugins-workspace/commit/69d508ee6910ae4064f2398fbacb803b3944d6a8) ([#2157](https://github.com/tauri-apps/plugins-workspace/pull/2157) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Make log functions omit caller location when failed to parse it instead of throwing + +## \[2.0.1] + +- [`371a2f73`](https://github.com/tauri-apps/plugins-workspace/commit/371a2f7361e0b91cf66f1287ffb18b34414a6cb8) ([#2021](https://github.com/tauri-apps/plugins-workspace/pull/2021) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Make webview log target more consistent that it always starts with `webview` + +## \[2.0.2] + +- [`606fa08d`](https://github.com/tauri-apps/plugins-workspace/commit/606fa08dae1acd074b961fb360623f4c86f13ee8) ([#1997](https://github.com/tauri-apps/plugins-workspace/pull/1997) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) **Potentially breaking:** Updated `fern` from 0.6 to 0.7. This is technically a breaking change because `fern` is re-exported in `tauri-plugin-log`. + +## \[2.0.1] + +- [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7. + +## \[2.0.0] + +- [`e2c4dfb6`](https://github.com/tauri-apps/plugins-workspace/commit/e2c4dfb6af43e5dd8d9ceba232c315f5febd55c1) Update to tauri v2 stable release. + +## \[2.0.0-rc.1] + +- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri 2.0.0-rc.8 + +## \[2.0.0-rc.1] + +- [`b9147758`](https://github.com/tauri-apps/plugins-workspace/commit/b914775898c2bee7ceb20bd17ee595005cd17a64) ([#1679](https://github.com/tauri-apps/plugins-workspace/pull/1679) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Explicitly set a minimum macOS version for the Swift package. + +## \[2.0.0-rc.0] + +- [`9887d1`](https://github.com/tauri-apps/plugins-workspace/commit/9887d14bd0e971c4c0f5c1188fc4005d3fc2e29e) Update to tauri RC. + +## \[2.0.0-beta.9] + +- [`99d6ac0f`](https://github.com/tauri-apps/plugins-workspace/commit/99d6ac0f9506a6a4a1aa59c728157190a7441af6) ([#1606](https://github.com/tauri-apps/plugins-workspace/pull/1606) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) The JS packages now specify the *minimum* `@tauri-apps/api` version instead of a single exact version. +- [`6de87966`](https://github.com/tauri-apps/plugins-workspace/commit/6de87966ecc00ad9d91c25be452f1f46bd2b7e1f) ([#1597](https://github.com/tauri-apps/plugins-workspace/pull/1597) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Update to tauri beta.25. + +## \[2.0.0-beta.9] + +- [`20a1d24e`](https://github.com/tauri-apps/plugins-workspace/commit/20a1d24ee004e77c2d12a0e20d258ce120216ed1) ([#1579](https://github.com/tauri-apps/plugins-workspace/pull/1579) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Added `Builder::split` which returns the raw logger implementation so you can pipe to other loggers such as `multi_log` or `tauri-plugin-devtools`. + +## \[2.0.0-beta.8] + +- [`22a17980`](https://github.com/tauri-apps/plugins-workspace/commit/22a17980ff4f6f8c40adb1b8f4ffc6dae2fe7e30) ([#1537](https://github.com/tauri-apps/plugins-workspace/pull/1537) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri beta.24. + +## \[2.0.0-beta.7] + +- [`76daee7a`](https://github.com/tauri-apps/plugins-workspace/commit/76daee7aafece34de3092c86e531cf9eb1138989) ([#1512](https://github.com/tauri-apps/plugins-workspace/pull/1512) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Update to tauri beta.23. + +## \[2.0.0-beta.6] + +- [`9013854f`](https://github.com/tauri-apps/plugins-workspace/commit/9013854f42a49a230b9dbb9d02774765528a923f)([#1382](https://github.com/tauri-apps/plugins-workspace/pull/1382)) Update to tauri beta.22. + +## \[2.0.0-beta.5] + +- [`430bd6f4`](https://github.com/tauri-apps/plugins-workspace/commit/430bd6f4f379bee5d232ae6b098ae131db7f178a)([#1363](https://github.com/tauri-apps/plugins-workspace/pull/1363)) Update to tauri beta.20. + +## \[2.0.0-beta.4] + +- [`bd1ed590`](https://github.com/tauri-apps/plugins-workspace/commit/bd1ed5903ffcce5500310dac1e59e8c67674ef1e)([#1237](https://github.com/tauri-apps/plugins-workspace/pull/1237)) Update to tauri beta.17. + +## \[2.0.0-beta.3] + +- [`ed46dca`](https://github.com/tauri-apps/plugins-workspace/commit/ed46dca74ff3947dbbcb26a7b571c129bf925698) Added `attachLogger` helper function to register a function that should be called for each log entry. + +## \[2.0.0-beta.3] + +- [`a04ea2f`](https://github.com/tauri-apps/plugins-workspace/commit/a04ea2f38294d5a3987578283badc8eec87a7752)([#1071](https://github.com/tauri-apps/plugins-workspace/pull/1071)) The global API script is now only added to the binary when the `withGlobalTauri` config is true. + +## \[2.0.0-beta.2] + +- [`99bea25`](https://github.com/tauri-apps/plugins-workspace/commit/99bea2559c2c0648c2519c50a18cd124dacef57b)([#1005](https://github.com/tauri-apps/plugins-workspace/pull/1005)) Update to tauri beta.8. + ## \[2.0.0-beta.1] - [`569defb`](https://github.com/tauri-apps/plugins-workspace/commit/569defbe9492e38938554bb7bdc1be9151456d21) Update to tauri beta.4. @@ -35,14 +144,3 @@ ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - te to alpha.11. - -## \[2.0.0-alpha.0] - -- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - v2 alpha release! - https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - ase! - https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! -717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/log/Cargo.toml b/plugins/log/Cargo.toml index 309431c7..660cae32 100644 --- a/plugins/log/Cargo.toml +++ b/plugins/log/Cargo.toml @@ -1,37 +1,52 @@ [package] name = "tauri-plugin-log" -version = "2.0.0-beta.1" +version = "2.4.0" description = "Configurable logging for your Tauri app." authors = { workspace = true } license = { workspace = true } edition = { workspace = true } rust-version = { workspace = true } +repository = { workspace = true } links = "tauri-plugin-log" [package.metadata.docs.rs] -rustc-args = [ "--cfg", "docsrs" ] -rustdoc-args = [ "--cfg", "docsrs" ] +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs"] + +[package.metadata.platforms.support] +windows = { level = "full", notes = "" } +linux = { level = "full", notes = "" } +macos = { level = "full", notes = "" } +android = { level = "full", notes = "" } +ios = { level = "full", notes = "" } [build-dependencies] -tauri-plugin = { workspace = true, features = [ "build" ] } +tauri-plugin = { workspace = true, features = ["build"] } [dependencies] serde = { workspace = true } serde_json = { workspace = true } tauri = { workspace = true } +thiserror = { workspace = true } serde_repr = "0.1" byte-unit = "5" -log = { workspace = true, features = [ "kv_unstable" ] } -time = { version = "0.3", features = [ "formatting", "local-offset" ] } -fern = "0.6" +log = { workspace = true, features = ["kv_unstable"] } +time = { version = "0.3", features = ["formatting", "local-offset", "macros"] } +fern = "0.7" +tracing = { workspace = true, optional = true } + [target."cfg(target_os = \"android\")".dependencies] -android_logger = "0.11" +android_logger = "0.15" [target."cfg(target_os = \"ios\")".dependencies] -swift-rs = "1.0.1" -objc = "0.2" -cocoa = "0.24" +swift-rs = "1" +objc2 = "0.6" +objc2-foundation = { version = "0.3", default-features = false, features = [ + "std", + "NSString", +] } [features] -colored = [ "fern/colored" ] +colored = ["fern/colored"] +tracing = ["dep:tracing"] diff --git a/plugins/log/README.md b/plugins/log/README.md index 56c4beeb..462bdab9 100644 --- a/plugins/log/README.md +++ b/plugins/log/README.md @@ -2,9 +2,17 @@ Configurable logging for your Tauri app. +| Platform | Supported | +| -------- | --------- | +| Linux | ✓ | +| Windows | ✓ | +| macOS | ✓ | +| Android | ✓ | +| iOS | ✓ | + ## Install -_This plugin requires a Rust version of at least **1.75**_ +_This plugin requires a Rust version of at least **1.77.2**_ There are three general methods of installation that we can recommend. @@ -18,12 +26,14 @@ Install the Core plugin by adding the following to your `Cargo.toml` file: ```toml [dependencies] -tauri-plugin-log = "2.0.0-beta" +tauri-plugin-log = "2.0.0" # alternatively with Git: tauri-plugin-log = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` -You can install the JavaScript Guest bindings using your preferred JavaScript package manager: +If you want the single instance mechanism to only trigger for semver compatible instances of your apps, for example if you expect users to have multiple installations of your app installed, you can add `features = ["semver"]` to the dependency declaration in `Cargo.toml`. + +Then you can install the JavaScript Guest bindings using your preferred JavaScript package manager: > Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use. @@ -44,9 +54,25 @@ yarn add https://github.com/tauri-apps/tauri-plugin-log#v2 ## Usage -First you need to register the core plugin with Tauri: +First, you should enable the `log:default` capability: + +```json +{ + "$schema": "../gen/schemas/desktop-schema.json", + "identifier": "default", + "description": "Capability for the main window", + "windows": ["main"], + "permissions": [ + "core:default", + "opener:default", + "log:default" # add this! + ] +} +``` + +Then, you need to register the core plugin with Tauri: -`src-tauri/src/main.rs` +`src-tauri/src/lib.rs` ```rust use tauri_plugin_log::{Target, TargetKind}; @@ -66,17 +92,17 @@ fn main() { Afterwards all the plugin's APIs are available through the JavaScript guest bindings: ```javascript -import { trace, info, error, attachConsole } from "@tauri-apps/plugin-log"; +import { trace, info, error, attachConsole } from '@tauri-apps/plugin-log' // with TargetKind::Webview enabled this function will print logs to the browser console -const detach = await attachConsole(); +const detach = await attachConsole() -trace("Trace"); -info("Info"); -error("Error"); +trace('Trace') +info('Info') +error('Error') // detach the browser console from the log stream -detach(); +detach() ``` To log from rust code, add the log crate to your `Cargo.toml`: diff --git a/plugins/log/SECURITY.md b/plugins/log/SECURITY.md index 072f2f09..d013f6a6 100644 --- a/plugins/log/SECURITY.md +++ b/plugins/log/SECURITY.md @@ -39,6 +39,7 @@ One possible threat you need to consider when using this plugin is that secrets in logs can theoretically be leaked when the application's frontend gets compromised. For this threat to be possible all of the following requirements need to be fulfilled: + - `TargetKind::Webview` enabled OR secrets stem from frontend logs - Frontend application is compromised via something like XSS (cross-site-scripting) OR logs are directly exposed - Logs contain secrets or sensitive information diff --git a/plugins/log/api-iife.js b/plugins/log/api-iife.js new file mode 100644 index 00000000..c94f2aab --- /dev/null +++ b/plugins/log/api-iife.js @@ -0,0 +1 @@ +if("__TAURI__"in window){var __TAURI_PLUGIN_LOG__=function(e){"use strict";function n(e,n=!1){return window.__TAURI_INTERNALS__.transformCallback(e,n)}async function r(e,n={},r){return window.__TAURI_INTERNALS__.invoke(e,n,r)}var a,o;async function t(e,a,o){const t={kind:"Any"};return r("plugin:event|listen",{event:e,target:t,handler:n(a)}).then((n=>async()=>async function(e,n){await r("plugin:event|unlisten",{event:e,eventId:n})}(e,n)))}async function i(e,n,a){const o=function(e){if(e){if(!e.startsWith("Error")){const n=e.split("\n").map((e=>e.split("@"))).filter((([e,n])=>e.length>0&&"[native code]"!==n));return n[2]?.filter((e=>e.length>0)).join("@")}{const n=e.split("\n"),r=n[3]?.trim();if(!r)return;const a=/at\s+(?.*?)\s+\((?.*?):(?\d+):(?\d+)\)/,o=r.match(a);if(o){const{functionName:e,fileName:n,lineNumber:r,columnNumber:a}=o.groups;return`${e}@${n}:${r}:${a}`}{const e=/at\s+(?.*?):(?\d+):(?\d+)/,n=r.match(e);if(n){const{fileName:e,lineNumber:r,columnNumber:a}=n.groups;return`@${e}:${r}:${a}`}}}}}((new Error).stack),{file:t,line:i,keyValues:l}=a??{};await r("plugin:log|log",{level:e,message:n,location:o,file:t,line:i,keyValues:l})}async function l(e){return await t("log://log",(n=>{const{level:r}=n.payload;let{message:a}=n.payload;a=a.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,""),e({message:a,level:r})}))}return"function"==typeof SuppressedError&&SuppressedError,function(e){e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_CREATED="tauri://window-created",e.WEBVIEW_CREATED="tauri://webview-created",e.DRAG_ENTER="tauri://drag-enter",e.DRAG_OVER="tauri://drag-over",e.DRAG_DROP="tauri://drag-drop",e.DRAG_LEAVE="tauri://drag-leave"}(a||(a={})),e.LogLevel=void 0,(o=e.LogLevel||(e.LogLevel={}))[o.Trace=1]="Trace",o[o.Debug=2]="Debug",o[o.Info=3]="Info",o[o.Warn=4]="Warn",o[o.Error=5]="Error",e.attachConsole=async function(){return await l((({level:n,message:r})=>{switch(n){case e.LogLevel.Trace:console.log(r);break;case e.LogLevel.Debug:console.debug(r);break;case e.LogLevel.Info:console.info(r);break;case e.LogLevel.Warn:console.warn(r);break;case e.LogLevel.Error:console.error(r);break;default:throw new Error(`unknown log level ${n}`)}}))},e.attachLogger=l,e.debug=async function(n,r){await i(e.LogLevel.Debug,n,r)},e.error=async function(n,r){await i(e.LogLevel.Error,n,r)},e.info=async function(n,r){await i(e.LogLevel.Info,n,r)},e.trace=async function(n,r){await i(e.LogLevel.Trace,n,r)},e.warn=async function(n,r){await i(e.LogLevel.Warn,n,r)},e}({});Object.defineProperty(window.__TAURI__,"log",{value:__TAURI_PLUGIN_LOG__})} diff --git a/plugins/log/build.rs b/plugins/log/build.rs index f413529a..5969c1e9 100644 --- a/plugins/log/build.rs +++ b/plugins/log/build.rs @@ -5,5 +5,8 @@ const COMMANDS: &[&str] = &["log"]; fn main() { - tauri_plugin::Builder::new(COMMANDS).ios_path("ios").build(); + tauri_plugin::Builder::new(COMMANDS) + .global_api_script_path("./api-iife.js") + .ios_path("ios") + .build(); } diff --git a/plugins/log/guest-js/index.ts b/plugins/log/guest-js/index.ts index 5aad73d5..93022a97 100644 --- a/plugins/log/guest-js/index.ts +++ b/plugins/log/guest-js/index.ts @@ -2,17 +2,16 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { listen, UnlistenFn } from "@tauri-apps/api/event"; +import { invoke } from '@tauri-apps/api/core' +import { listen, type UnlistenFn, type Event } from '@tauri-apps/api/event' -import { invoke } from "@tauri-apps/api/core"; - -export type LogOptions = { - file?: string; - line?: number; - keyValues?: Record; -}; +export interface LogOptions { + file?: string + line?: number + keyValues?: Record +} -enum LogLevel { +export enum LogLevel { /** * The "trace" level. * @@ -42,35 +41,92 @@ enum LogLevel { * * Designates very serious errors. */ - Error, + Error +} + +function getCallerLocation(stack?: string) { + if (!stack) { + return + } + + if (stack.startsWith('Error')) { + // Assume it's Chromium V8 + // + // Error + // at baz (filename.js:10:15) + // at bar (filename.js:6:3) + // at foo (filename.js:2:3) + // at filename.js:13:1 + + const lines = stack.split('\n') + // Find the third line (caller's caller of the current location) + const callerLine = lines[3]?.trim() + if (!callerLine) { + return + } + + const regex = + /at\s+(?.*?)\s+\((?.*?):(?\d+):(?\d+)\)/ + const match = callerLine.match(regex) + + if (match) { + const { functionName, fileName, lineNumber, columnNumber } = + match.groups as { + functionName: string + fileName: string + lineNumber: string + columnNumber: string + } + return `${functionName}@${fileName}:${lineNumber}:${columnNumber}` + } else { + // Handle cases where the regex does not match (e.g., last line without function name) + const regexNoFunction = + /at\s+(?.*?):(?\d+):(?\d+)/ + const matchNoFunction = callerLine.match(regexNoFunction) + if (matchNoFunction) { + const { fileName, lineNumber, columnNumber } = + matchNoFunction.groups as { + fileName: string + lineNumber: string + columnNumber: string + } + return `@${fileName}:${lineNumber}:${columnNumber}` + } + } + } else { + // Assume it's Webkit JavaScriptCore, example: + // + // baz@filename.js:10:24 + // bar@filename.js:6:6 + // foo@filename.js:2:6 + // global code@filename.js:13:4 + + const traces = stack.split('\n').map((line) => line.split('@')) + const filtered = traces.filter(([name, location]) => { + return name.length > 0 && location !== '[native code]' + }) + // Find the third line (caller's caller of the current location) + return filtered[2]?.filter((v) => v.length > 0).join('@') + } } async function log( level: LogLevel, message: string, - options?: LogOptions, + options?: LogOptions ): Promise { - const traces = new Error().stack?.split("\n").map((line) => line.split("@")); + const location = getCallerLocation(new Error().stack) - const filtered = traces?.filter(([name, location]) => { - return name.length > 0 && location !== "[native code]"; - }); + const { file, line, keyValues } = options ?? {} - const { file, line, keyValues } = options ?? {}; - - let location = filtered?.[0]?.filter((v) => v.length > 0).join("@"); - if (location === "Error") { - location = "webview::unknown"; - } - - await invoke("plugin:log|log", { + await invoke('plugin:log|log', { level, message, location, file, line, - keyValues, - }); + keyValues + }) } /** @@ -91,9 +147,9 @@ async function log( */ export async function error( message: string, - options?: LogOptions, + options?: LogOptions ): Promise { - await log(LogLevel.Error, message, options); + await log(LogLevel.Error, message, options) } /** @@ -113,9 +169,9 @@ export async function error( */ export async function warn( message: string, - options?: LogOptions, + options?: LogOptions ): Promise { - await log(LogLevel.Warn, message, options); + await log(LogLevel.Warn, message, options) } /** @@ -135,9 +191,9 @@ export async function warn( */ export async function info( message: string, - options?: LogOptions, + options?: LogOptions ): Promise { - await log(LogLevel.Info, message, options); + await log(LogLevel.Info, message, options) } /** @@ -157,9 +213,9 @@ export async function info( */ export async function debug( message: string, - options?: LogOptions, + options?: LogOptions ): Promise { - await log(LogLevel.Debug, message, options); + await log(LogLevel.Debug, message, options) } /** @@ -179,47 +235,66 @@ export async function debug( */ export async function trace( message: string, - options?: LogOptions, + options?: LogOptions ): Promise { - await log(LogLevel.Trace, message, options); + await log(LogLevel.Trace, message, options) } interface RecordPayload { - level: LogLevel; - message: string; + level: LogLevel + message: string } -export async function attachConsole(): Promise { - return await listen("log://log", (event) => { - const payload = event.payload as RecordPayload; +type LoggerFn = (fn: RecordPayload) => void + +/** + * Attaches a listener for the log, and calls the passed function for each log entry. + * @param fn + * + * @returns a function to cancel the listener. + */ +export async function attachLogger(fn: LoggerFn): Promise { + return await listen('log://log', (event: Event) => { + const { level } = event.payload + let { message } = event.payload // Strip ANSI escape codes - const message = payload.message.replace( + message = message.replace( // TODO: Investigate security/detect-unsafe-regex // eslint-disable-next-line no-control-regex, security/detect-unsafe-regex /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, - "", - ); + '' + ) + fn({ message, level }) + }) +} - switch (payload.level) { +/** + * Attaches a listener that writes log entries to the console as they come in. + * + * @returns a function to cancel the listener. + */ +export async function attachConsole(): Promise { + return await attachLogger(({ level, message }: RecordPayload) => { + switch (level) { case LogLevel.Trace: - console.log(message); - break; + console.log(message) + break case LogLevel.Debug: - console.debug(message); - break; + console.debug(message) + break case LogLevel.Info: - console.info(message); - break; + console.info(message) + break case LogLevel.Warn: - console.warn(message); - break; + console.warn(message) + break case LogLevel.Error: - console.error(message); - break; + console.error(message) + break default: // eslint-disable-next-line @typescript-eslint/restrict-template-expressions - throw new Error(`unknown log level ${payload.level}`); + throw new Error(`unknown log level ${level}`) } - }); + }) } diff --git a/plugins/log/ios/Package.swift b/plugins/log/ios/Package.swift index 4afbbbdb..1571f22e 100644 --- a/plugins/log/ios/Package.swift +++ b/plugins/log/ios/Package.swift @@ -6,28 +6,29 @@ import PackageDescription let package = Package( - name: "tauri-plugin-log", - platforms: [ - .iOS(.v11), - ], - products: [ - // Products define the executables and libraries a package produces, and make them visible to other packages. - .library( - name: "tauri-plugin-log", - type: .static, - targets: ["tauri-plugin-log"]), - ], - dependencies: [ - .package(name: "Tauri", path: "../.tauri/tauri-api") - ], - targets: [ - // Targets are the basic building blocks of a package. A target can define a module or a test suite. - // Targets can depend on other targets in this package, and on products in packages this package depends on. - .target( - name: "tauri-plugin-log", - dependencies: [ - .byName(name: "Tauri") - ], - path: "Sources") - ] + name: "tauri-plugin-log", + platforms: [ + .macOS(.v10_13), + .iOS(.v11), + ], + products: [ + // Products define the executables and libraries a package produces, and make them visible to other packages. + .library( + name: "tauri-plugin-log", + type: .static, + targets: ["tauri-plugin-log"]) + ], + dependencies: [ + .package(name: "Tauri", path: "../.tauri/tauri-api") + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages this package depends on. + .target( + name: "tauri-plugin-log", + dependencies: [ + .byName(name: "Tauri") + ], + path: "Sources") + ] ) diff --git a/plugins/log/ios/Sources/LogPlugin.swift b/plugins/log/ios/Sources/LogPlugin.swift index cefdc858..e21b4bab 100644 --- a/plugins/log/ios/Sources/LogPlugin.swift +++ b/plugins/log/ios/Sources/LogPlugin.swift @@ -2,16 +2,41 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import UIKit -import Tauri import SwiftRs +import Tauri +import UIKit + +#if targetEnvironment(simulator) + var logReady = false +#else + var logReady = true +#endif @_cdecl("tauri_log") func log(level: Int, message: NSString) { - switch level { - case 1: Logger.debug(message as String) - case 2: Logger.info(message as String) - case 3: Logger.error(message as String) - default: break - } + if logReady { + os_log(level, message) + } else { + dispatch_log(level, message) + } +} + +func dispatch_log(_ level: Int, _ message: NSString) { + // delay logging when the logger isn't immediately available + // in some cases when using the simulator the app would hang when calling os_log too soon + // better be safe here and wait a few seconds than actually freeze the app in dev mode + // in production this isn't a problem + DispatchQueue.main.asyncAfter(deadline: .now() + 2) { + os_log(level, message) + logReady = true + } +} + +func os_log(_ level: Int, _ message: NSString) { + switch level { + case 1: Logger.debug(message as String) + case 2: Logger.info(message as String) + case 3: Logger.error(message as String) + default: break + } } diff --git a/plugins/log/package.json b/plugins/log/package.json index 7f071e03..9130ca88 100644 --- a/plugins/log/package.json +++ b/plugins/log/package.json @@ -1,11 +1,12 @@ { "name": "@tauri-apps/plugin-log", - "version": "2.0.0-beta.1", + "version": "2.4.0", "description": "Configurable logging for your Tauri app.", - "license": "MIT or APACHE-2.0", + "license": "MIT OR Apache-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" ], + "repository": "https://github.com/tauri-apps/plugins-workspace", "type": "module", "types": "./dist-js/index.d.ts", "main": "./dist-js/index.cjs", @@ -24,6 +25,6 @@ "LICENSE" ], "dependencies": { - "@tauri-apps/api": "2.0.0-beta.2" + "@tauri-apps/api": "^2.0.0" } } diff --git a/plugins/log/permissions/autogenerated/reference.md b/plugins/log/permissions/autogenerated/reference.md index 7dd146d0..57d6c9f3 100644 --- a/plugins/log/permissions/autogenerated/reference.md +++ b/plugins/log/permissions/autogenerated/reference.md @@ -1,14 +1,43 @@ -# Permissions +## Default Permission -## allow-log +Allows the log command + +#### This default permission set includes the following: + +- `allow-log` + +## Permission Table + + + + + + + + + + + + -Denies the log command without any pre-configured scope. + + + + +
IdentifierDescription
+ +`log:allow-log` + + Enables the log command without any pre-configured scope. -## deny-log +
-## default +`log:deny-log` -Allows the log command + + +Denies the log command without any pre-configured scope. +
diff --git a/plugins/log/permissions/schemas/schema.json b/plugins/log/permissions/schemas/schema.json index 3bb82dc4..cfee7e75 100644 --- a/plugins/log/permissions/schemas/schema.json +++ b/plugins/log/permissions/schemas/schema.json @@ -17,7 +17,6 @@ }, "set": { "description": "A list of permissions sets defined", - "default": [], "type": "array", "items": { "$ref": "#/definitions/PermissionSet" @@ -50,7 +49,7 @@ "minimum": 1.0 }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -112,7 +111,7 @@ "type": "string" }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri internal convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -132,12 +131,21 @@ }, "scope": { "description": "Allowed or denied scoped when using this permission.", - "default": {}, "allOf": [ { "$ref": "#/definitions/Scopes" } ] + }, + "platforms": { + "description": "Target platforms this permission applies. By default all platforms are affected by this permission.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Target" + } } } }, @@ -164,7 +172,7 @@ } }, "Scopes": { - "description": "A restriction of the command/endpoint functionality.\n\nIt can be of any serde serializable type and is used for allowing or preventing certain actions inside a Tauri command.\n\nThe scope is passed to the command and handled/enforced by the command itself.", + "description": "An argument for fine grained behavior control of Tauri commands.\n\nIt can be of any serde serializable type and is used to allow or prevent certain actions inside a Tauri command. The configured scope is passed to the command and will be enforced by the command implementation.\n\n## Example\n\n```json { \"allow\": [{ \"path\": \"$HOME/**\" }], \"deny\": [{ \"path\": \"$HOME/secret.txt\" }] } ```", "type": "object", "properties": { "allow": { @@ -178,7 +186,7 @@ } }, "deny": { - "description": "Data that defines what is denied by the scope.", + "description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.", "type": [ "array", "null" @@ -243,31 +251,68 @@ } ] }, - "PermissionKind": { - "type": "string", + "Target": { + "description": "Platform target.", "oneOf": [ { - "description": "allow-log -> Enables the log command without any pre-configured scope.", + "description": "MacOS.", + "type": "string", + "enum": [ + "macOS" + ] + }, + { + "description": "Windows.", + "type": "string", + "enum": [ + "windows" + ] + }, + { + "description": "Linux.", "type": "string", "enum": [ - "allow-log" + "linux" ] }, { - "description": "deny-log -> Denies the log command without any pre-configured scope.", + "description": "Android.", "type": "string", "enum": [ - "deny-log" + "android" ] }, { - "description": "default -> Allows the log command", + "description": "iOS.", "type": "string", "enum": [ - "default" + "iOS" ] } ] + }, + "PermissionKind": { + "type": "string", + "oneOf": [ + { + "description": "Enables the log command without any pre-configured scope.", + "type": "string", + "const": "allow-log", + "markdownDescription": "Enables the log command without any pre-configured scope." + }, + { + "description": "Denies the log command without any pre-configured scope.", + "type": "string", + "const": "deny-log", + "markdownDescription": "Denies the log command without any pre-configured scope." + }, + { + "description": "Allows the log command\n#### This default permission set includes:\n\n- `allow-log`", + "type": "string", + "const": "default", + "markdownDescription": "Allows the log command\n#### This default permission set includes:\n\n- `allow-log`" + } + ] } } } \ No newline at end of file diff --git a/plugins/log/rollup.config.js b/plugins/log/rollup.config.js index 977dfac8..1f349ec8 100644 --- a/plugins/log/rollup.config.js +++ b/plugins/log/rollup.config.js @@ -2,6 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { createConfig } from "../../shared/rollup.config.js"; +import { createConfig } from '../../shared/rollup.config.js' -export default createConfig(); +export default createConfig() diff --git a/plugins/log/src/api-iife.js b/plugins/log/src/api-iife.js deleted file mode 100644 index ff5eb504..00000000 --- a/plugins/log/src/api-iife.js +++ /dev/null @@ -1 +0,0 @@ -if("__TAURI__"in window){var __TAURI_PLUGIN_LOG__=function(e){"use strict";function n(e,n=!1){return window.__TAURI_INTERNALS__.transformCallback(e,n)}async function r(e,n={},r){return window.__TAURI_INTERNALS__.invoke(e,n,r)}var a,t;async function o(e,a,t){const o="string"==typeof t?.target?{kind:"AnyLabel",label:t.target}:t?.target??{kind:"Any"};return r("plugin:event|listen",{event:e,target:o,handler:n(a)}).then((n=>async()=>async function(e,n){await r("plugin:event|unlisten",{event:e,eventId:n})}(e,n)))}async function i(e,n,a){const t=(new Error).stack?.split("\n").map((e=>e.split("@"))),o=t?.filter((([e,n])=>e.length>0&&"[native code]"!==n)),{file:i,line:c,keyValues:l}=a??{};let u=o?.[0]?.filter((e=>e.length>0)).join("@");"Error"===u&&(u="webview::unknown"),await r("plugin:log|log",{level:e,message:n,location:u,file:i,line:c,keyValues:l})}return"function"==typeof SuppressedError&&SuppressedError,function(e){e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WEBVIEW_CREATED="tauri://webview-created",e.FILE_DROP="tauri://file-drop",e.FILE_DROP_HOVER="tauri://file-drop-hover",e.FILE_DROP_CANCELLED="tauri://file-drop-cancelled"}(a||(a={})),function(e){e[e.Trace=1]="Trace",e[e.Debug=2]="Debug",e[e.Info=3]="Info",e[e.Warn=4]="Warn",e[e.Error=5]="Error"}(t||(t={})),e.attachConsole=async function(){return await o("log://log",(e=>{const n=e.payload,r=n.message.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,"");switch(n.level){case t.Trace:console.log(r);break;case t.Debug:console.debug(r);break;case t.Info:console.info(r);break;case t.Warn:console.warn(r);break;case t.Error:console.error(r);break;default:throw new Error(`unknown log level ${n.level}`)}}))},e.debug=async function(e,n){await i(t.Debug,e,n)},e.error=async function(e,n){await i(t.Error,e,n)},e.info=async function(e,n){await i(t.Info,e,n)},e.trace=async function(e,n){await i(t.Trace,e,n)},e.warn=async function(e,n){await i(t.Warn,e,n)},e}({});Object.defineProperty(window.__TAURI__,"log",{value:__TAURI_PLUGIN_LOG__})} diff --git a/plugins/log/src/lib.rs b/plugins/log/src/lib.rs index 5f564b2d..e16ddc57 100644 --- a/plugins/log/src/lib.rs +++ b/plugins/log/src/lib.rs @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -//! [![](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/log/banner.png)](https://github.com/tauri-apps/plugins-workspace/tree/v2/plugins/log) -//! //! Logging for Tauri applications. #![doc( @@ -28,39 +26,15 @@ use tauri::{ plugin::{self, TauriPlugin}, Manager, Runtime, }; +use tauri::{AppHandle, Emitter}; +use time::{macros::format_description, OffsetDateTime}; pub use fern; -use time::OffsetDateTime; -pub const WEBVIEW_TARGET: &str = "Webview"; +pub const WEBVIEW_TARGET: &str = "webview"; #[cfg(target_os = "ios")] mod ios { - use cocoa::base::id; - use objc::*; - - const UTF8_ENCODING: usize = 4; - pub struct NSString(pub id); - - impl NSString { - pub fn new(s: &str) -> Self { - // Safety: objc runtime calls are unsafe - NSString(unsafe { - let ns_string: id = msg_send![class!(NSString), alloc]; - let ns_string: id = msg_send![ns_string, - initWithBytes:s.as_ptr() - length:s.len() - encoding:UTF8_ENCODING]; - - // The thing is allocated in rust, the thing must be set to autorelease in rust to relinquish control - // or it can not be released correctly in OC runtime - let _: () = msg_send![ns_string, autorelease]; - - ns_string - }) - } - } - swift_rs::swift!(pub fn tauri_log( level: u8, message: *const std::ffi::c_void )); @@ -74,6 +48,20 @@ const DEFAULT_LOG_TARGETS: [Target; 2] = [ Target::new(TargetKind::LogDir { file_name: None }), ]; +#[derive(Debug, thiserror::Error)] +pub enum Error { + #[error(transparent)] + Tauri(#[from] tauri::Error), + #[error(transparent)] + Io(#[from] std::io::Error), + #[error(transparent)] + TimeFormat(#[from] time::error::Format), + #[error(transparent)] + InvalidFormatDescription(#[from] time::error::InvalidFormatDescription), + #[error("Internal logger disabled and cannot be acquired or attached")] + LoggerNotInitialized, +} + /// An enum representing the available verbosity levels of the logger. /// /// It is very similar to the [`log::Level`], but serializes to unsigned ints instead of strings. @@ -167,20 +155,25 @@ pub enum TargetKind { path: PathBuf, file_name: Option, }, - /// Write logs to the OS specififc logs directory. + /// Write logs to the OS specific logs directory. /// /// ### Platform-specific /// - /// |Platform | Value | Example | - /// | ------- | --------------------------------------------- | ---------------------------------------------- | - /// | Linux | `{configDir}/{bundleIdentifier}` | `/home/alice/.config/com.tauri.dev` | - /// | macOS | `{homeDir}/Library/Logs/{bundleIdentifier}` | `/Users/Alice/Library/Logs/com.tauri.dev` | - /// | Windows | `{configDir}/{bundleIdentifier}` | `C:\Users\Alice\AppData\Roaming\com.tauri.dev` | + /// |Platform | Value | Example | + /// | --------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------- | + /// | Linux | `$XDG_DATA_HOME/{bundleIdentifier}/logs` or `$HOME/.local/share/{bundleIdentifier}/logs` | `/home/alice/.local/share/com.tauri.dev/logs` | + /// | macOS/iOS | `{homeDir}/Library/Logs/{bundleIdentifier}` | `/Users/Alice/Library/Logs/com.tauri.dev` | + /// | Windows | `{FOLDERID_LocalAppData}/{bundleIdentifier}/logs` | `C:\Users\Alice\AppData\Local\com.tauri.dev\logs` | + /// | Android | `{ConfigDir}/logs` | `/data/data/com.tauri.dev/files/logs` | LogDir { file_name: Option }, /// Forward logs to the webview (via the `log://log` event). /// /// This requires the webview to subscribe to log events, via this plugins `attachConsole` function. Webview, + /// Send logs to a [`fern::Dispatch`] + /// + /// You can use this to construct arbitrary log targets. + Dispatch(fern::Dispatch), } /// A log target. @@ -208,6 +201,38 @@ impl Target { } } +// Target becomes default and location is added as a parameter +#[cfg(feature = "tracing")] +fn emit_trace( + level: log::Level, + message: &String, + location: Option<&str>, + file: Option<&str>, + line: Option, + kv: &HashMap<&str, &str>, +) { + macro_rules! emit_event { + ($level:expr) => { + tracing::event!( + target: WEBVIEW_TARGET, + $level, + message = %message, + location = location, + file, + line, + ?kv + ) + }; + } + match level { + log::Level::Error => emit_event!(tracing::Level::ERROR), + log::Level::Warn => emit_event!(tracing::Level::WARN), + log::Level::Info => emit_event!(tracing::Level::INFO), + log::Level::Debug => emit_event!(tracing::Level::DEBUG), + log::Level::Trace => emit_event!(tracing::Level::TRACE), + } +} + #[tauri::command] fn log( level: LogLevel, @@ -217,22 +242,16 @@ fn log( line: Option, key_values: Option>, ) { - let location = location.unwrap_or("webview"); - let level = log::Level::from(level); - let metadata = log::MetadataBuilder::new() - .level(level) - .target(WEBVIEW_TARGET) - .build(); + let target = if let Some(location) = location { + format!("{WEBVIEW_TARGET}:{location}") + } else { + WEBVIEW_TARGET.to_string() + }; let mut builder = RecordBuilder::new(); - builder - .level(level) - .metadata(metadata) - .target(location) - .file(file) - .line(line); + builder.level(level).target(&target).file(file).line(line); let key_values = key_values.unwrap_or_default(); let mut kv = HashMap::new(); @@ -240,6 +259,8 @@ fn log( kv.insert(k.as_str(), v.as_str()); } builder.key_values(&kv); + #[cfg(feature = "tracing")] + emit_trace(level, &message, location, file, line, &kv); logger().log(&builder.args(format_args!("{message}")).build()); } @@ -250,14 +271,13 @@ pub struct Builder { timezone_strategy: TimezoneStrategy, max_file_size: u128, targets: Vec, + is_skip_logger: bool, } impl Default for Builder { fn default() -> Self { #[cfg(desktop)] - let format = - time::format_description::parse("[[[year]-[month]-[day]][[[hour]:[minute]:[second]]") - .unwrap(); + let format = format_description!("[[[year]-[month]-[day]][[[hour]:[minute]:[second]]"); let dispatch = fern::Dispatch::new().format(move |out, message, record| { out.finish( #[cfg(mobile)] @@ -278,6 +298,7 @@ impl Default for Builder { timezone_strategy: DEFAULT_TIMEZONE_STRATEGY, max_file_size: DEFAULT_MAX_FILE_SIZE, targets: DEFAULT_LOG_TARGETS.into(), + is_skip_logger: false, } } } @@ -295,10 +316,8 @@ impl Builder { pub fn timezone_strategy(mut self, timezone_strategy: TimezoneStrategy) -> Self { self.timezone_strategy = timezone_strategy.clone(); - let format = - time::format_description::parse("[[[year]-[month]-[day]][[[hour]:[minute]:[second]]") - .unwrap(); - self.dispatch = fern::Dispatch::new().format(move |out, message, record| { + let format = format_description!("[[[year]-[month]-[day]][[[hour]:[minute]:[second]]"); + self.dispatch = self.dispatch.format(move |out, message, record| { out.finish(format_args!( "{}[{}][{}] {}", timezone_strategy.get_now().format(&format).unwrap(), @@ -359,16 +378,31 @@ impl Builder { self } - /// Adds a collection of targets to the logger. + /// Skip the creation and global registration of a logger + /// + /// If you wish to use your own global logger, you must call `skip_logger` so that the plugin does not attempt to set a second global logger. In this configuration, no logger will be created and the plugin's `log` command will rely on the result of `log::logger()`. You will be responsible for configuring the logger yourself and any included targets will be ignored. If ever initializing the plugin multiple times, such as if registering the plugin while testing, call this method to avoid panicking when registering multiple loggers. For interacting with `tracing`, you can leverage the `tracing-log` logger to forward logs to `tracing` or enable the `tracing` feature for this plugin to emit events directly to the tracing system. Both scenarios require calling this method. + /// ```rust + /// static LOGGER: SimpleLogger = SimpleLogger; + /// + /// log::set_logger(&SimpleLogger)?; + /// log::set_max_level(LevelFilter::Info); + /// tauri_plugin_log::Builder::new() + /// .skip_logger(); + /// ``` + pub fn skip_logger(mut self) -> Self { + self.is_skip_logger = true; + self + } + + /// Replaces the targets of the logger. /// /// ```rust /// use tauri_plugin_log::{Target, TargetKind, WEBVIEW_TARGET}; /// tauri_plugin_log::Builder::new() - /// .clear_targets() /// .targets([ /// Target::new(TargetKind::Webview), - /// Target::new(TargetKind::LogDir { file_name: Some("webview".into()) }).filter(|metadata| metadata.target() == WEBVIEW_TARGET), - /// Target::new(TargetKind::LogDir { file_name: Some("rust".into()) }).filter(|metadata| metadata.target() != WEBVIEW_TARGET), + /// Target::new(TargetKind::LogDir { file_name: Some("webview".into()) }).filter(|metadata| metadata.target().starts_with(WEBVIEW_TARGET)), + /// Target::new(TargetKind::LogDir { file_name: Some("rust".into()) }).filter(|metadata| !metadata.target().starts_with(WEBVIEW_TARGET)), /// ]); /// ``` pub fn targets(mut self, targets: impl IntoIterator) -> Self { @@ -378,9 +412,7 @@ impl Builder { #[cfg(feature = "colored")] pub fn with_colors(self, colors: fern::colors::ColoredLevelConfig) -> Self { - let format = - time::format_description::parse("[[[year]-[month]-[day]][[[hour]:[minute]:[second]]") - .unwrap(); + let format = format_description!("[[[year]-[month]-[day]][[[hour]:[minute]:[second]]"); let timezone_strategy = self.timezone_strategy.clone(); self.format(move |out, message, record| { @@ -394,112 +426,164 @@ impl Builder { }) } - pub fn build(mut self) -> TauriPlugin { - plugin::Builder::new("log") - .js_init_script(include_str!("api-iife.js").to_string()) - .invoke_handler(tauri::generate_handler![log]) - .setup(move |app_handle, _api| { - let app_name = &app_handle.package_info().name; + fn acquire_logger( + app_handle: &AppHandle, + mut dispatch: fern::Dispatch, + rotation_strategy: RotationStrategy, + timezone_strategy: TimezoneStrategy, + max_file_size: u128, + targets: Vec, + ) -> Result<(log::LevelFilter, Box), Error> { + let app_name = &app_handle.package_info().name; + + // setup targets + for target in targets { + let mut target_dispatch = fern::Dispatch::new(); + for filter in target.filters { + target_dispatch = target_dispatch.filter(filter); + } + + let logger = match target.kind { + #[cfg(target_os = "android")] + TargetKind::Stdout | TargetKind::Stderr => fern::Output::call(android_logger::log), + #[cfg(target_os = "ios")] + TargetKind::Stdout | TargetKind::Stderr => fern::Output::call(move |record| { + let message = format!("{}", record.args()); + unsafe { + ios::tauri_log( + match record.level() { + log::Level::Trace | log::Level::Debug => 1, + log::Level::Info => 2, + log::Level::Warn | log::Level::Error => 3, + }, + // The string is allocated in rust, so we must + // autorelease it rust to give it to the Swift + // runtime. + objc2::rc::Retained::autorelease_ptr( + objc2_foundation::NSString::from_str(message.as_str()), + ) as _, + ); + } + }), + #[cfg(desktop)] + TargetKind::Stdout => std::io::stdout().into(), + #[cfg(desktop)] + TargetKind::Stderr => std::io::stderr().into(), + TargetKind::Folder { path, file_name } => { + if !path.exists() { + fs::create_dir_all(&path)?; + } - // setup targets - for target in self.targets { - let mut target_dispatch = fern::Dispatch::new(); - for filter in target.filters { - target_dispatch = target_dispatch.filter(filter); + fern::log_file(get_log_file_path( + &path, + file_name.as_deref().unwrap_or(app_name), + &rotation_strategy, + &timezone_strategy, + max_file_size, + )?)? + .into() + } + TargetKind::LogDir { file_name } => { + let path = app_handle.path().app_log_dir()?; + if !path.exists() { + fs::create_dir_all(&path)?; } - let logger = match target.kind { - #[cfg(target_os = "android")] - TargetKind::Stdout | TargetKind::Stderr => { - fern::Output::call(android_logger::log) - } - #[cfg(target_os = "ios")] - TargetKind::Stdout | TargetKind::Stderr => { - fern::Output::call(move |record| { - let message = format!("{}", record.args()); - unsafe { - ios::tauri_log( - match record.level() { - log::Level::Trace | log::Level::Debug => 1, - log::Level::Info => 2, - log::Level::Warn | log::Level::Error => 3, - }, - ios::NSString::new(message.as_str()).0 as _, - ); - } - }) - } - #[cfg(desktop)] - TargetKind::Stdout => std::io::stdout().into(), - #[cfg(desktop)] - TargetKind::Stderr => std::io::stderr().into(), - TargetKind::Folder { path, file_name } => { - if !path.exists() { - fs::create_dir_all(&path).unwrap(); - } - - fern::log_file(get_log_file_path( - &path, - file_name.as_deref().unwrap_or(app_name), - &self.rotation_strategy, - &self.timezone_strategy, - self.max_file_size, - )?)? - .into() - } - #[cfg(mobile)] - TargetKind::LogDir { .. } => continue, - #[cfg(desktop)] - TargetKind::LogDir { file_name } => { - let path = app_handle.path().app_log_dir().unwrap(); - if !path.exists() { - fs::create_dir_all(&path).unwrap(); - } - - fern::log_file(get_log_file_path( - &path, - file_name.as_deref().unwrap_or(app_name), - &self.rotation_strategy, - &self.timezone_strategy, - self.max_file_size, - )?)? - .into() - } - TargetKind::Webview => { - let app_handle = app_handle.clone(); - - fern::Output::call(move |record| { - let payload = RecordPayload { - message: record.args().to_string(), - level: record.level().into(), - }; - let app_handle = app_handle.clone(); - tauri::async_runtime::spawn(async move { - app_handle.emit("log://log", payload).unwrap(); - }); - }) - } - }; - target_dispatch = target_dispatch.chain(logger); - - self.dispatch = self.dispatch.chain(target_dispatch); + fern::log_file(get_log_file_path( + &path, + file_name.as_deref().unwrap_or(app_name), + &rotation_strategy, + &timezone_strategy, + max_file_size, + )?)? + .into() + } + TargetKind::Webview => { + let app_handle = app_handle.clone(); + + fern::Output::call(move |record| { + let payload = RecordPayload { + message: record.args().to_string(), + level: record.level().into(), + }; + let app_handle = app_handle.clone(); + tauri::async_runtime::spawn(async move { + let _ = app_handle.emit("log://log", payload); + }); + }) } + TargetKind::Dispatch(dispatch) => dispatch.into(), + }; + target_dispatch = target_dispatch.chain(logger); - self.dispatch.apply()?; + dispatch = dispatch.chain(target_dispatch); + } + Ok(dispatch.into_log()) + } + + fn plugin_builder() -> plugin::Builder { + plugin::Builder::new("log").invoke_handler(tauri::generate_handler![log]) + } + + #[allow(clippy::type_complexity)] + pub fn split( + self, + app_handle: &AppHandle, + ) -> Result<(TauriPlugin, log::LevelFilter, Box), Error> { + if self.is_skip_logger { + return Err(Error::LoggerNotInitialized); + } + let plugin = Self::plugin_builder(); + let (max_level, log) = Self::acquire_logger( + app_handle, + self.dispatch, + self.rotation_strategy, + self.timezone_strategy, + self.max_file_size, + self.targets, + )?; + + Ok((plugin.build(), max_level, log)) + } + + pub fn build(self) -> TauriPlugin { + Self::plugin_builder() + .setup(move |app_handle, _api| { + if !self.is_skip_logger { + let (max_level, log) = Self::acquire_logger( + app_handle, + self.dispatch, + self.rotation_strategy, + self.timezone_strategy, + self.max_file_size, + self.targets, + )?; + attach_logger(max_level, log)?; + } Ok(()) }) .build() } } +/// Attaches the given logger +pub fn attach_logger( + max_level: log::LevelFilter, + log: Box, +) -> Result<(), log::SetLoggerError> { + log::set_boxed_logger(log)?; + log::set_max_level(max_level); + Ok(()) +} + fn get_log_file_path( dir: &impl AsRef, file_name: &str, rotation_strategy: &RotationStrategy, timezone_strategy: &TimezoneStrategy, max_file_size: u128, -) -> Result> { +) -> Result { let path = dir.as_ref().join(format!("{file_name}.log")); if path.exists() { @@ -510,15 +594,9 @@ fn get_log_file_path( let to = dir.as_ref().join(format!( "{}_{}.log", file_name, - timezone_strategy - .get_now() - .format( - &time::format_description::parse( - "[year]-[month]-[day]_[hour]-[minute]-[second]" - ) - .unwrap() - ) - .unwrap(), + timezone_strategy.get_now().format(&format_description!( + "[year]-[month]-[day]_[hour]-[minute]-[second]" + ))?, )); if to.is_file() { // designated rotated log file name already exists @@ -526,7 +604,10 @@ fn get_log_file_path( let mut to_bak = to.clone(); to_bak.set_file_name(format!( "{}.bak", - to_bak.file_name().unwrap().to_string_lossy() + to_bak + .file_name() + .map(|f| f.to_string_lossy()) + .unwrap_or_default() )); fs::rename(&to, to_bak)?; } diff --git a/plugins/mirrors.txt b/plugins/mirrors.txt index 73f0816e..d346da18 100644 --- a/plugins/mirrors.txt +++ b/plugins/mirrors.txt @@ -1,4 +1,3 @@ -authenticator autostart cli clipboard-manager diff --git a/plugins/nfc/.gitignore b/plugins/nfc/.gitignore deleted file mode 100644 index 1b0b469d..00000000 --- a/plugins/nfc/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/.tauri diff --git a/plugins/nfc/CHANGELOG.md b/plugins/nfc/CHANGELOG.md index 0350c5d7..132ae5cc 100644 --- a/plugins/nfc/CHANGELOG.md +++ b/plugins/nfc/CHANGELOG.md @@ -1,5 +1,68 @@ # Changelog +## \[2.2.0] + +- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other. + +## \[2.0.1] + +- [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7. + +## \[2.0.0] + +- [`e2c4dfb6`](https://github.com/tauri-apps/plugins-workspace/commit/e2c4dfb6af43e5dd8d9ceba232c315f5febd55c1) Update to tauri v2 stable release. + +## \[2.0.0-rc.1] + +- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri 2.0.0-rc.8 + +## \[2.0.0-rc.2] + +- [`b9147758`](https://github.com/tauri-apps/plugins-workspace/commit/b914775898c2bee7ceb20bd17ee595005cd17a64) ([#1679](https://github.com/tauri-apps/plugins-workspace/pull/1679) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Explicitly set a minimum macOS version for the Swift package. + +## \[2.0.0-rc.1] + +### changes + +- [`6b079cfd`](https://github.com/tauri-apps/plugins-workspace/commit/6b079cfdd107c94abc2c7300f6af00bac3ff4040) ([#1649](https://github.com/tauri-apps/plugins-workspace/pull/1649) by [@ahqsoftwares](https://github.com/tauri-apps/plugins-workspace/../../ahqsoftwares)) Remove targetSdk from build.kts files as it is deprecated and will be removed from DSL v9.0 + +## \[2.0.0-rc.0] + +- [`9887d1`](https://github.com/tauri-apps/plugins-workspace/commit/9887d14bd0e971c4c0f5c1188fc4005d3fc2e29e) Update to tauri RC. + +## \[2.0.0-beta.8] + +- [`99d6ac0f`](https://github.com/tauri-apps/plugins-workspace/commit/99d6ac0f9506a6a4a1aa59c728157190a7441af6) ([#1606](https://github.com/tauri-apps/plugins-workspace/pull/1606) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) The JS packages now specify the *minimum* `@tauri-apps/api` version instead of a single exact version. +- [`6de87966`](https://github.com/tauri-apps/plugins-workspace/commit/6de87966ecc00ad9d91c25be452f1f46bd2b7e1f) ([#1597](https://github.com/tauri-apps/plugins-workspace/pull/1597) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Update to tauri beta.25. + +## \[2.0.0-beta.7] + +- [`22a17980`](https://github.com/tauri-apps/plugins-workspace/commit/22a17980ff4f6f8c40adb1b8f4ffc6dae2fe7e30) ([#1537](https://github.com/tauri-apps/plugins-workspace/pull/1537) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri beta.24. + +## \[2.0.0-beta.6] + +- [`76daee7a`](https://github.com/tauri-apps/plugins-workspace/commit/76daee7aafece34de3092c86e531cf9eb1138989) ([#1512](https://github.com/tauri-apps/plugins-workspace/pull/1512) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Update to tauri beta.23. + +## \[2.0.0-beta.5] + +- [`9013854f`](https://github.com/tauri-apps/plugins-workspace/commit/9013854f42a49a230b9dbb9d02774765528a923f)([#1382](https://github.com/tauri-apps/plugins-workspace/pull/1382)) Update to tauri beta.22. + +## \[2.0.0-beta.4] + +- [`430bd6f4`](https://github.com/tauri-apps/plugins-workspace/commit/430bd6f4f379bee5d232ae6b098ae131db7f178a)([#1363](https://github.com/tauri-apps/plugins-workspace/pull/1363)) Update to tauri beta.20. + +## \[2.0.0-beta.3] + +- [`bd1ed590`](https://github.com/tauri-apps/plugins-workspace/commit/bd1ed5903ffcce5500310dac1e59e8c67674ef1e)([#1237](https://github.com/tauri-apps/plugins-workspace/pull/1237)) Update to tauri beta.17. + +## \[2.0.0-beta.3] + +- [`a04ea2f`](https://github.com/tauri-apps/plugins-workspace/commit/a04ea2f38294d5a3987578283badc8eec87a7752)([#1071](https://github.com/tauri-apps/plugins-workspace/pull/1071)) The global API script is now only added to the binary when the `withGlobalTauri` config is true. + +## \[2.0.0-beta.2] + +- [`99bea25`](https://github.com/tauri-apps/plugins-workspace/commit/99bea2559c2c0648c2519c50a18cd124dacef57b)([#1005](https://github.com/tauri-apps/plugins-workspace/pull/1005)) Update to tauri beta.8. + ## \[2.0.0-beta.1] - [`569defb`](https://github.com/tauri-apps/plugins-workspace/commit/569defbe9492e38938554bb7bdc1be9151456d21) Update to tauri beta.4. @@ -12,4 +75,9 @@ ## \[2.0.0-alpha.0] - [`fe79adb`](https://github.com/tauri-apps/plugins-workspace/commit/fe79adb5c7febd0e912efb5581264d671709fbb0)([#830](https://github.com/tauri-apps/plugins-workspace/pull/830)) Initial release. -commit/fe79adb5c7febd0e912efb5581264d671709fbb0)([#830](https://github.com/tauri-apps/plugins-workspace/pull/830)) Initial release. + commit/fe79adb5c7febd0e912efb5581264d671709fbb0)([#830](https://github.com/tauri-apps/plugins-workspace/pull/830)) Initial release. + 30]\(https://github.com/tauri-apps/plugins-workspace/pull/830)) Initial release. + commit/fe79adb5c7febd0e912efb5581264d671709fbb0)([#830](https://github.com/tauri-apps/plugins-workspace/pull/830)) Initial release. + . + commit/fe79adb5c7febd0e912efb5581264d671709fbb0)([#830](https://github.com/tauri-apps/plugins-workspace/pull/830)) Initial release. + ithub.com/tauri-apps/plugins-workspace/pull/830)) Initial release. diff --git a/plugins/nfc/Cargo.toml b/plugins/nfc/Cargo.toml index 507fc519..56cc218b 100644 --- a/plugins/nfc/Cargo.toml +++ b/plugins/nfc/Cargo.toml @@ -1,18 +1,27 @@ [package] name = "tauri-plugin-nfc" -version = "2.0.0-beta.1" +version = "2.2.0" description = "Read and write NFC tags on Android and iOS." edition = { workspace = true } authors = { workspace = true } license = { workspace = true } +repository = { workspace = true } links = "tauri-plugin-nfc" [package.metadata.docs.rs] -rustc-args = [ "--cfg", "docsrs" ] -rustdoc-args = [ "--cfg", "docsrs" ] +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs"] +targets = ["x86_64-linux-android"] + +[package.metadata.platforms.support] +windows = { level = "none", notes = "" } +linux = { level = "none", notes = "" } +macos = { level = "none", notes = "" } +android = { level = "full", notes = "" } +ios = { level = "full", notes = "" } [build-dependencies] -tauri-plugin = { workspace = true, features = [ "build" ] } +tauri-plugin = { workspace = true, features = ["build"] } [dependencies] serde = { workspace = true } diff --git a/plugins/nfc/README.md b/plugins/nfc/README.md index cf846783..1f8ceb6b 100644 --- a/plugins/nfc/README.md +++ b/plugins/nfc/README.md @@ -2,6 +2,14 @@ Read and write NFC tags on Android and iOS. +| Platform | Supported | +| -------- | --------- | +| Linux | x | +| Windows | x | +| macOS | x | +| Android | ✓ | +| iOS | ✓ | + ## Install _This plugin requires a Rust version of at least **1.65**_ @@ -18,7 +26,7 @@ Install the Core plugin by adding the following to your `Cargo.toml` file: ```toml [dependencies] -tauri-plugin-nfc = "2.0.0-beta" +tauri-plugin-nfc = "2.0.0" # alternatively with Git: tauri-plugin-nfc = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` @@ -48,7 +56,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-nfc#v2 First you need to register the core plugin with Tauri: -`src-tauri/src/main.rs` +`src-tauri/src/lib.rs` ```rust fn main() { @@ -62,9 +70,9 @@ fn main() { Afterwards all the plugin's APIs are available through the JavaScript guest bindings: ```javascript -import { scan, textRecord, write } from "@tauri-apps/plugin-nfc"; -await scan({ type: "tag", keepSessionAlive: true }); -await write([textRecord("Tauri is awesome!")]); +import { scan, textRecord, write } from '@tauri-apps/plugin-nfc' +await scan({ type: 'tag', keepSessionAlive: true }) +await write([textRecord('Tauri is awesome!')]) ``` ## Contributing diff --git a/plugins/nfc/SECURITY.md b/plugins/nfc/SECURITY.md new file mode 100644 index 00000000..4f09bbac --- /dev/null +++ b/plugins/nfc/SECURITY.md @@ -0,0 +1,23 @@ +# Security Policy + +**Do not report security vulnerabilities through public GitHub issues.** + +**Please use the [Private Vulnerability Disclosure](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability) feature of GitHub.** + +Include as much of the following information: + +- Type of issue (e.g. improper input parsing, privilege escalation, etc.) +- The location of the affected source code (tag/branch/commit or direct URL) +- Any special configuration required to reproduce the issue +- The distribution affected or used to help us with reproduction of the issue +- Step-by-step instructions to reproduce the issue +- Ideally a reproduction repository +- Impact of the issue, including how an attacker might exploit the issue + +We prefer to receive reports in English. + +## Contact + +Please disclose a vulnerability or security relevant issue here: [https://github.com/tauri-apps/plugins-workspace/security/advisories/new](https://github.com/tauri-apps/plugins-workspace/security/advisories/new). + +Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app). diff --git a/plugins/nfc/android/build.gradle.kts b/plugins/nfc/android/build.gradle.kts index 66eb414f..595f9173 100644 --- a/plugins/nfc/android/build.gradle.kts +++ b/plugins/nfc/android/build.gradle.kts @@ -5,11 +5,10 @@ plugins { android { namespace = "app.tauri.nfc" - compileSdk = 33 + compileSdk = 34 defaultConfig { - minSdk = 24 - targetSdk = 33 + minSdk = 24 testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles("consumer-rules.pro") diff --git a/plugins/nfc/android/src/main/AndroidManifest.xml b/plugins/nfc/android/src/main/AndroidManifest.xml index a2c208e2..7603a356 100644 --- a/plugins/nfc/android/src/main/AndroidManifest.xml +++ b/plugins/nfc/android/src/main/AndroidManifest.xml @@ -1,9 +1,4 @@ - - - - - diff --git a/plugins/nfc/android/src/main/java/NfcPlugin.kt b/plugins/nfc/android/src/main/java/NfcPlugin.kt index 5aa33732..4deaab44 100644 --- a/plugins/nfc/android/src/main/java/NfcPlugin.kt +++ b/plugins/nfc/android/src/main/java/NfcPlugin.kt @@ -141,7 +141,6 @@ sealed class ScanKind { addDataFilters(intentFilter, uri, mimeType) arrayOf(intentFilter) } - else -> null } } @@ -163,7 +162,6 @@ sealed class ScanKind { null } } - else -> null } } } diff --git a/plugins/nfc/src/api-iife.js b/plugins/nfc/api-iife.js similarity index 75% rename from plugins/nfc/src/api-iife.js rename to plugins/nfc/api-iife.js index 1828f2b6..5939782f 100644 --- a/plugins/nfc/src/api-iife.js +++ b/plugins/nfc/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_PLUGIN_NFC__=function(n){"use strict";async function e(n,e={},t){return window.__TAURI_INTERNALS__.invoke(n,e,t)}"function"==typeof SuppressedError&&SuppressedError;const t=[84],r=[85];var o,c;function a(n,e,t,r){return{format:n,kind:"string"==typeof e?Array.from((new TextEncoder).encode(e)):e,id:"string"==typeof t?Array.from((new TextEncoder).encode(t)):t,payload:"string"==typeof r?Array.from((new TextEncoder).encode(r)):r}}n.TechKind=void 0,(o=n.TechKind||(n.TechKind={}))[o.IsoDep=0]="IsoDep",o[o.MifareClassic=1]="MifareClassic",o[o.MifareUltralight=2]="MifareUltralight",o[o.Ndef=3]="Ndef",o[o.NdefFormatable=4]="NdefFormatable",o[o.NfcA=5]="NfcA",o[o.NfcB=6]="NfcB",o[o.NfcBarcode=7]="NfcBarcode",o[o.NfcF=8]="NfcF",o[o.NfcV=9]="NfcV",n.NFCTypeNameFormat=void 0,(c=n.NFCTypeNameFormat||(n.NFCTypeNameFormat={}))[c.Empty=0]="Empty",c[c.NfcWellKnown=1]="NfcWellKnown",c[c.Media=2]="Media",c[c.AbsoluteURI=3]="AbsoluteURI",c[c.NfcExternal=4]="NfcExternal",c[c.Unknown=5]="Unknown",c[c.Unchanged=6]="Unchanged";const i=["","http://www.","https://www.","http://","https://","tel:","mailto:","ftp://anonymous:anonymous@","ftp://ftp.","ftps://","sftp://","smb://","nfs://","ftp://","dav://","news:","telnet://","imap:","rtsp://","urn:","pop:","sip:","sips:","tftp:","btspp://","btl2cap://","btgoep://","tcpobex://","irdaobex://","file://","urn:epc:id:","urn:epc:tag:","urn:epc:pat:","urn:epc:raw:","urn:epc:","urn:nfc:"];function f(n){const{type:e,...t}=n;return{[e]:t}}return n.RTD_TEXT=t,n.RTD_URI=r,n.isAvailable=async function(){return await e("plugin:nfc|is_available")},n.record=a,n.scan=async function(n,t){return await e("plugin:nfc|scan",{kind:f(n),...t})},n.textRecord=function(e,r,o="en"){const c=Array.from((new TextEncoder).encode(o+e));return c.unshift(o.length),a(n.NFCTypeNameFormat.NfcWellKnown,t,r||[],c)},n.uriRecord=function(e,t){return a(n.NFCTypeNameFormat.NfcWellKnown,r,t||[],function(n){let e="";i.slice(1).forEach((function(t){e&&"urn:"!==e||0!==n.indexOf(t)||(e=t)})),e||(e="");const t=Array.from((new TextEncoder).encode(n.slice(e.length))),r=i.indexOf(e);return t.unshift(r),t}(e))},n.write=async function(n,t){const{kind:r,...o}=t||{};return r&&(o.kind=f(r)),await e("plugin:nfc|write",{records:n,...o})},n}({});Object.defineProperty(window.__TAURI__,"nfc",{value:__TAURI_PLUGIN_NFC__})} +if("__TAURI__"in window){var __TAURI_PLUGIN_NFC__=function(n){"use strict";async function e(n,e={},t){return window.__TAURI_INTERNALS__.invoke(n,e,t)}"function"==typeof SuppressedError&&SuppressedError;const t=[84],r=[85];var o,c;function a(n,e,t,r){return{format:n,kind:"string"==typeof e?Array.from((new TextEncoder).encode(e)):e,id:"string"==typeof t?Array.from((new TextEncoder).encode(t)):t,payload:"string"==typeof r?Array.from((new TextEncoder).encode(r)):r}}n.TechKind=void 0,(o=n.TechKind||(n.TechKind={}))[o.IsoDep=0]="IsoDep",o[o.MifareClassic=1]="MifareClassic",o[o.MifareUltralight=2]="MifareUltralight",o[o.Ndef=3]="Ndef",o[o.NdefFormatable=4]="NdefFormatable",o[o.NfcA=5]="NfcA",o[o.NfcB=6]="NfcB",o[o.NfcBarcode=7]="NfcBarcode",o[o.NfcF=8]="NfcF",o[o.NfcV=9]="NfcV",n.NFCTypeNameFormat=void 0,(c=n.NFCTypeNameFormat||(n.NFCTypeNameFormat={}))[c.Empty=0]="Empty",c[c.NfcWellKnown=1]="NfcWellKnown",c[c.Media=2]="Media",c[c.AbsoluteURI=3]="AbsoluteURI",c[c.NfcExternal=4]="NfcExternal",c[c.Unknown=5]="Unknown",c[c.Unchanged=6]="Unchanged";const i=["","http://www.","https://www.","http://","https://","tel:","mailto:","ftp://anonymous:anonymous@","ftp://ftp.","ftps://","sftp://","smb://","nfs://","ftp://","dav://","news:","telnet://","imap:","rtsp://","urn:","pop:","sip:","sips:","tftp:","btspp://","btl2cap://","btgoep://","tcpobex://","irdaobex://","file://","urn:epc:id:","urn:epc:tag:","urn:epc:pat:","urn:epc:raw:","urn:epc:","urn:nfc:"];function f(n){const{type:e,...t}=n;return{[e]:t}}return n.RTD_TEXT=t,n.RTD_URI=r,n.isAvailable=async function(){return await e("plugin:nfc|is_available")},n.record=a,n.scan=async function(n,t){return await e("plugin:nfc|scan",{kind:f(n),...t})},n.textRecord=function(e,r,o="en"){const c=Array.from((new TextEncoder).encode(o+e));return c.unshift(o.length),a(n.NFCTypeNameFormat.NfcWellKnown,t,r??[],c)},n.uriRecord=function(e,t){return a(n.NFCTypeNameFormat.NfcWellKnown,r,t??[],function(n){let e="";i.slice(1).forEach((function(t){0!==e.length&&"urn:"!==e||0!==n.indexOf(t)||(e=t)})),0===e.length&&(e="");const t=Array.from((new TextEncoder).encode(n.slice(e.length))),r=i.indexOf(e);return t.unshift(r),t}(e))},n.write=async function(n,t){const{kind:r,...o}=t??{};r&&(o.kind=f(r)),await e("plugin:nfc|write",{records:n,...o})},n}({});Object.defineProperty(window.__TAURI__,"nfc",{value:__TAURI_PLUGIN_NFC__})} diff --git a/plugins/nfc/build.rs b/plugins/nfc/build.rs index 1d234371..bdcd84bf 100644 --- a/plugins/nfc/build.rs +++ b/plugins/nfc/build.rs @@ -5,10 +5,16 @@ const COMMANDS: &[&str] = &["is_available", "write", "scan"]; fn main() { - tauri_plugin::Builder::new(COMMANDS) + let result = tauri_plugin::Builder::new(COMMANDS) + .global_api_script_path("./api-iife.js") .android_path("android") .ios_path("ios") - .build(); + .try_build(); + + // when building documentation for Android the plugin build result is always Err() and is irrelevant to the crate documentation build + if !(cfg!(docsrs) && std::env::var("TARGET").unwrap().contains("android")) { + result.unwrap(); + } // TODO: triple check if this can reference the plugin's xml as it expects rn // TODO: This has to be configurable if we want to support handling nfc tags when the app is not open. diff --git a/plugins/nfc/guest-js/index.ts b/plugins/nfc/guest-js/index.ts index b16c8a5c..051a1841 100644 --- a/plugins/nfc/guest-js/index.ts +++ b/plugins/nfc/guest-js/index.ts @@ -2,15 +2,15 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { invoke } from "@tauri-apps/api/core"; +import { invoke } from '@tauri-apps/api/core' -export const RTD_TEXT = [0x54]; // "T" -export const RTD_URI = [0x55]; // "U" +export const RTD_TEXT = [0x54] // "T" +export const RTD_URI = [0x55] // "U" export interface UriFilter { - scheme?: string; - host?: string; - pathPrefix?: string; + scheme?: string + host?: string + pathPrefix?: string } export enum TechKind { @@ -23,19 +23,19 @@ export enum TechKind { NfcB, NfcBarcode, NfcF, - NfcV, + NfcV } export type ScanKind = | { - type: "tag"; - uri?: UriFilter; - mimeType?: string; + type: 'tag' + uri?: UriFilter + mimeType?: string } | { - type: "ndef"; - uri?: UriFilter; - mimeType?: string; + type: 'ndef' + uri?: UriFilter + mimeType?: string /** * Each of the tech-lists is considered independently and the activity is considered a match if * any single tech-list matches the tag that was discovered. @@ -56,25 +56,25 @@ export type ScanKind = * ] * ``` */ - techLists?: TechKind[][]; - }; + techLists?: TechKind[][] + } export interface ScanOptions { - keepSessionAlive?: boolean; + keepSessionAlive?: boolean /** Message displayed in the UI. iOS only. */ - message?: string; + message?: string /** Message displayed in the UI when the message has been read. iOS only. */ - successMessage?: string; + successMessage?: string } export interface WriteOptions { - kind?: ScanKind; + kind?: ScanKind /** Message displayed in the UI when reading the tag. iOS only. */ - message?: string; + message?: string /** Message displayed in the UI when the tag has been read. iOS only. */ - successfulReadMessage?: string; + successfulReadMessage?: string /** Message displayed in the UI when the message has been written. iOS only. */ - successMessage?: string; + successMessage?: string } export enum NFCTypeNameFormat { @@ -84,133 +84,134 @@ export enum NFCTypeNameFormat { AbsoluteURI = 3, NfcExternal = 4, Unknown = 5, - Unchanged = 6, + Unchanged = 6 } export interface TagRecord { - tnf: NFCTypeNameFormat; - kind: number[]; - id: number[]; - payload: number[]; + tnf: NFCTypeNameFormat + kind: number[] + id: number[] + payload: number[] } export interface Tag { - id: number[]; - kind: string[]; - records: TagRecord[]; + id: number[] + kind: string[] + records: TagRecord[] } export interface NFCRecord { - format: NFCTypeNameFormat; - kind: number[]; - id: number[]; - payload: number[]; + format: NFCTypeNameFormat + kind: number[] + id: number[] + payload: number[] } export function record( format: NFCTypeNameFormat, kind: string | number[], id: string | number[], - payload: string | number[], + payload: string | number[] ): NFCRecord { return { format, kind: - typeof kind === "string" + typeof kind === 'string' ? Array.from(new TextEncoder().encode(kind)) : kind, - id: typeof id === "string" ? Array.from(new TextEncoder().encode(id)) : id, + id: typeof id === 'string' ? Array.from(new TextEncoder().encode(id)) : id, payload: - typeof payload === "string" + typeof payload === 'string' ? Array.from(new TextEncoder().encode(payload)) - : payload, - }; + : payload + } } export function textRecord( text: string, id?: string | number[], - language: string = "en", + language: string = 'en' ): NFCRecord { - const payload = Array.from(new TextEncoder().encode(language + text)); - payload.unshift(language.length); - return record(NFCTypeNameFormat.NfcWellKnown, RTD_TEXT, id || [], payload); + const payload = Array.from(new TextEncoder().encode(language + text)) + payload.unshift(language.length) + return record(NFCTypeNameFormat.NfcWellKnown, RTD_TEXT, id ?? [], payload) } const protocols = [ - "", - "http://www.", - "https://www.", - "http://", - "https://", - "tel:", - "mailto:", - "ftp://anonymous:anonymous@", - "ftp://ftp.", - "ftps://", - "sftp://", - "smb://", - "nfs://", - "ftp://", - "dav://", - "news:", - "telnet://", - "imap:", - "rtsp://", - "urn:", - "pop:", - "sip:", - "sips:", - "tftp:", - "btspp://", - "btl2cap://", - "btgoep://", - "tcpobex://", - "irdaobex://", - "file://", - "urn:epc:id:", - "urn:epc:tag:", - "urn:epc:pat:", - "urn:epc:raw:", - "urn:epc:", - "urn:nfc:", -]; + '', + 'http://www.', + 'https://www.', + 'http://', + 'https://', + 'tel:', + 'mailto:', + 'ftp://anonymous:anonymous@', + 'ftp://ftp.', + 'ftps://', + 'sftp://', + 'smb://', + 'nfs://', + 'ftp://', + 'dav://', + 'news:', + 'telnet://', + 'imap:', + 'rtsp://', + 'urn:', + 'pop:', + 'sip:', + 'sips:', + 'tftp:', + 'btspp://', + 'btl2cap://', + 'btgoep://', + 'tcpobex://', + 'irdaobex://', + 'file://', + 'urn:epc:id:', + 'urn:epc:tag:', + 'urn:epc:pat:', + 'urn:epc:raw:', + 'urn:epc:', + 'urn:nfc:' +] function encodeURI(uri: string): number[] { - let prefix = ""; + let prefix = '' protocols.slice(1).forEach(function (protocol) { - if ((!prefix || prefix === "urn:") && uri.indexOf(protocol) === 0) { - prefix = protocol; + if ( + (prefix.length === 0 || prefix === 'urn:') + && uri.indexOf(protocol) === 0 + ) { + prefix = protocol } - }); + }) - if (!prefix) { - prefix = ""; + if (prefix.length === 0) { + prefix = '' } - const encoded = Array.from( - new TextEncoder().encode(uri.slice(prefix.length)), - ); - const protocolCode = protocols.indexOf(prefix); + const encoded = Array.from(new TextEncoder().encode(uri.slice(prefix.length))) + const protocolCode = protocols.indexOf(prefix) // prepend protocol code - encoded.unshift(protocolCode); + encoded.unshift(protocolCode) - return encoded; + return encoded } export function uriRecord(uri: string, id?: string | number[]): NFCRecord { return record( NFCTypeNameFormat.NfcWellKnown, RTD_URI, - id || [], - encodeURI(uri), - ); + id ?? [], + encodeURI(uri) + ) } function mapScanKind(kind: ScanKind): Record { - const { type: scanKind, ...kindOptions } = kind; - return { [scanKind]: kindOptions }; + const { type: scanKind, ...kindOptions } = kind + return { [scanKind]: kindOptions } } /** @@ -229,12 +230,12 @@ function mapScanKind(kind: ScanKind): Record { */ export async function scan( kind: ScanKind, - options?: ScanOptions, + options?: ScanOptions ): Promise { - return await invoke("plugin:nfc|scan", { + return await invoke('plugin:nfc|scan', { kind: mapScanKind(kind), - ...options, - }); + ...options + }) } /** @@ -254,19 +255,19 @@ export async function scan( */ export async function write( records: NFCRecord[], - options?: WriteOptions, + options?: WriteOptions ): Promise { - const { kind, ...opts } = options || {}; + const { kind, ...opts } = options ?? {} if (kind) { // @ts-expect-error map the property - opts.kind = mapScanKind(kind); + opts.kind = mapScanKind(kind) } - return await invoke("plugin:nfc|write", { + await invoke('plugin:nfc|write', { records, - ...opts, - }); + ...opts + }) } export async function isAvailable(): Promise { - return await invoke("plugin:nfc|is_available"); + return await invoke('plugin:nfc|is_available') } diff --git a/plugins/nfc/ios/Package.swift b/plugins/nfc/ios/Package.swift index e8f1f19a..a028db7d 100644 --- a/plugins/nfc/ios/Package.swift +++ b/plugins/nfc/ios/Package.swift @@ -8,7 +8,8 @@ import PackageDescription let package = Package( name: "tauri-plugin-nfc", platforms: [ - .iOS(.v13) + .macOS(.v10_13), + .iOS(.v13), ], products: [ // Products define the executables and libraries a package produces, and make them visible to other packages. diff --git a/plugins/nfc/ios/Sources/NfcPlugin.swift b/plugins/nfc/ios/Sources/NfcPlugin.swift index 21bb2606..58d69a84 100644 --- a/plugins/nfc/ios/Sources/NfcPlugin.swift +++ b/plugins/nfc/ios/Sources/NfcPlugin.swift @@ -16,24 +16,24 @@ enum ScanKind: Decodable { struct ScanOptions: Decodable { let kind: ScanKind - let keepSessionAlive: Bool? - let message: String? - let successMessage: String? + var keepSessionAlive: Bool? + var message: String? + var successMessage: String? } struct NDEFRecord: Decodable { - let format: UInt8? - let kind: [UInt8]? - let identifier: [UInt8]? - let payload: [UInt8]? + var format: UInt8? + var kind: [UInt8]? + var identifier: [UInt8]? + var payload: [UInt8]? } struct WriteOptions: Decodable { - let kind: ScanKind? + var kind: ScanKind? let records: [NDEFRecord] - let message: String? - let successMessage: String? - let successfulReadMessage: String? + var message: String? + var successMessage: String? + var successfulReadMessage: String? } enum TagProcessMode { diff --git a/plugins/nfc/package.json b/plugins/nfc/package.json index aeb4ac2d..c4852e51 100644 --- a/plugins/nfc/package.json +++ b/plugins/nfc/package.json @@ -1,10 +1,11 @@ { "name": "@tauri-apps/plugin-nfc", - "version": "2.0.0-beta.1", - "license": "MIT or APACHE-2.0", + "version": "2.2.0", + "license": "MIT OR Apache-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" ], + "repository": "https://github.com/tauri-apps/plugins-workspace", "type": "module", "types": "./dist-js/index.d.ts", "main": "./dist-js/index.cjs", @@ -23,10 +24,7 @@ "README.md", "LICENSE" ], - "devDependencies": { - "tslib": "2.6.0" - }, "dependencies": { - "@tauri-apps/api": "2.0.0-beta.2" + "@tauri-apps/api": "^2.0.0" } } diff --git a/plugins/nfc/permissions/autogenerated/reference.md b/plugins/nfc/permissions/autogenerated/reference.md index 9b972b2b..6148cf2c 100644 --- a/plugins/nfc/permissions/autogenerated/reference.md +++ b/plugins/nfc/permissions/autogenerated/reference.md @@ -1,26 +1,105 @@ -# Permissions +## Default Permission -## allow-is-available +This permission set configures what kind of +operations are available from the nfc plugin. + +#### Granted Permissions + +Checking if the NFC functionality is available +and scanning nearby tags is allowed. +Writing to tags needs to be manually enabled. + + + +#### This default permission set includes the following: + +- `allow-is-available` +- `allow-scan` + +## Permission Table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IdentifierDescription
+ +`nfc:allow-is-available` + + Enables the is_available command without any pre-configured scope. -## deny-is-available +
+ +`nfc:deny-is-available` + + Denies the is_available command without any pre-configured scope. -## allow-scan +
+ +`nfc:allow-scan` + + Enables the scan command without any pre-configured scope. -## deny-scan +
+ +`nfc:deny-scan` + + Denies the scan command without any pre-configured scope. -## allow-write +
+ +`nfc:allow-write` + + Enables the write command without any pre-configured scope. -## deny-write +
+ +`nfc:deny-write` + + Denies the write command without any pre-configured scope. +
diff --git a/plugins/nfc/permissions/default.toml b/plugins/nfc/permissions/default.toml new file mode 100644 index 00000000..d69c7f1b --- /dev/null +++ b/plugins/nfc/permissions/default.toml @@ -0,0 +1,15 @@ +"$schema" = "schemas/schema.json" + +[default] +description = """ +This permission set configures what kind of +operations are available from the nfc plugin. + +#### Granted Permissions + +Checking if the NFC functionality is available +and scanning nearby tags is allowed. +Writing to tags needs to be manually enabled. + +""" +permissions = ["allow-is-available", "allow-scan"] diff --git a/plugins/nfc/permissions/schemas/schema.json b/plugins/nfc/permissions/schemas/schema.json index 2fbc4329..8a018e26 100644 --- a/plugins/nfc/permissions/schemas/schema.json +++ b/plugins/nfc/permissions/schemas/schema.json @@ -17,7 +17,6 @@ }, "set": { "description": "A list of permissions sets defined", - "default": [], "type": "array", "items": { "$ref": "#/definitions/PermissionSet" @@ -50,7 +49,7 @@ "minimum": 1.0 }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -112,7 +111,7 @@ "type": "string" }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri internal convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -132,12 +131,21 @@ }, "scope": { "description": "Allowed or denied scoped when using this permission.", - "default": {}, "allOf": [ { "$ref": "#/definitions/Scopes" } ] + }, + "platforms": { + "description": "Target platforms this permission applies. By default all platforms are affected by this permission.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Target" + } } } }, @@ -164,7 +172,7 @@ } }, "Scopes": { - "description": "A restriction of the command/endpoint functionality.\n\nIt can be of any serde serializable type and is used for allowing or preventing certain actions inside a Tauri command.\n\nThe scope is passed to the command and handled/enforced by the command itself.", + "description": "An argument for fine grained behavior control of Tauri commands.\n\nIt can be of any serde serializable type and is used to allow or prevent certain actions inside a Tauri command. The configured scope is passed to the command and will be enforced by the command implementation.\n\n## Example\n\n```json { \"allow\": [{ \"path\": \"$HOME/**\" }], \"deny\": [{ \"path\": \"$HOME/secret.txt\" }] } ```", "type": "object", "properties": { "allow": { @@ -178,7 +186,7 @@ } }, "deny": { - "description": "Data that defines what is denied by the scope.", + "description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.", "type": [ "array", "null" @@ -243,50 +251,90 @@ } ] }, - "PermissionKind": { - "type": "string", + "Target": { + "description": "Platform target.", "oneOf": [ { - "description": "allow-is-available -> Enables the is_available command without any pre-configured scope.", + "description": "MacOS.", "type": "string", "enum": [ - "allow-is-available" + "macOS" ] }, { - "description": "deny-is-available -> Denies the is_available command without any pre-configured scope.", + "description": "Windows.", "type": "string", "enum": [ - "deny-is-available" + "windows" ] }, { - "description": "allow-scan -> Enables the scan command without any pre-configured scope.", + "description": "Linux.", "type": "string", "enum": [ - "allow-scan" + "linux" ] }, { - "description": "deny-scan -> Denies the scan command without any pre-configured scope.", + "description": "Android.", "type": "string", "enum": [ - "deny-scan" + "android" ] }, { - "description": "allow-write -> Enables the write command without any pre-configured scope.", + "description": "iOS.", "type": "string", "enum": [ - "allow-write" + "iOS" ] + } + ] + }, + "PermissionKind": { + "type": "string", + "oneOf": [ + { + "description": "Enables the is_available command without any pre-configured scope.", + "type": "string", + "const": "allow-is-available", + "markdownDescription": "Enables the is_available command without any pre-configured scope." }, { - "description": "deny-write -> Denies the write command without any pre-configured scope.", + "description": "Denies the is_available command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-write" - ] + "const": "deny-is-available", + "markdownDescription": "Denies the is_available command without any pre-configured scope." + }, + { + "description": "Enables the scan command without any pre-configured scope.", + "type": "string", + "const": "allow-scan", + "markdownDescription": "Enables the scan command without any pre-configured scope." + }, + { + "description": "Denies the scan command without any pre-configured scope.", + "type": "string", + "const": "deny-scan", + "markdownDescription": "Denies the scan command without any pre-configured scope." + }, + { + "description": "Enables the write command without any pre-configured scope.", + "type": "string", + "const": "allow-write", + "markdownDescription": "Enables the write command without any pre-configured scope." + }, + { + "description": "Denies the write command without any pre-configured scope.", + "type": "string", + "const": "deny-write", + "markdownDescription": "Denies the write command without any pre-configured scope." + }, + { + "description": "This permission set configures what kind of\noperations are available from the nfc plugin.\n\n#### Granted Permissions\n\nChecking if the NFC functionality is available\nand scanning nearby tags is allowed.\nWriting to tags needs to be manually enabled.\n\n\n#### This default permission set includes:\n\n- `allow-is-available`\n- `allow-scan`", + "type": "string", + "const": "default", + "markdownDescription": "This permission set configures what kind of\noperations are available from the nfc plugin.\n\n#### Granted Permissions\n\nChecking if the NFC functionality is available\nand scanning nearby tags is allowed.\nWriting to tags needs to be manually enabled.\n\n\n#### This default permission set includes:\n\n- `allow-is-available`\n- `allow-scan`" } ] } diff --git a/plugins/nfc/rollup.config.js b/plugins/nfc/rollup.config.js index 977dfac8..1f349ec8 100644 --- a/plugins/nfc/rollup.config.js +++ b/plugins/nfc/rollup.config.js @@ -2,6 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { createConfig } from "../../shared/rollup.config.js"; +import { createConfig } from '../../shared/rollup.config.js' -export default createConfig(); +export default createConfig() diff --git a/plugins/nfc/src/lib.rs b/plugins/nfc/src/lib.rs index 28d5160d..d8708c1d 100644 --- a/plugins/nfc/src/lib.rs +++ b/plugins/nfc/src/lib.rs @@ -57,7 +57,7 @@ impl Nfc { } } -/// Extensions to [`tauri::App`], [`tauri::AppHandle`] and [`tauri::Window`] to access the nfc APIs. +/// Extensions to [`tauri::App`], [`tauri::AppHandle`], [`tauri::WebviewWindow`], [`tauri::Webview`] and [`tauri::Window`] to access the NFC APIs. pub trait NfcExt { fn nfc(&self) -> &Nfc; } @@ -71,7 +71,6 @@ impl> crate::NfcExt for T { /// Initializes the plugin. pub fn init() -> TauriPlugin { Builder::new("nfc") - .js_init_script(include_str!("api-iife.js").to_string()) .setup(|app, api| { #[cfg(target_os = "android")] let handle = api.register_android_plugin(PLUGIN_IDENTIFIER, "NfcPlugin")?; diff --git a/plugins/notification/.gitignore b/plugins/notification/.gitignore deleted file mode 100644 index 1b0b469d..00000000 --- a/plugins/notification/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/.tauri diff --git a/plugins/notification/CHANGELOG.md b/plugins/notification/CHANGELOG.md index 0e8731dc..42efb6ab 100644 --- a/plugins/notification/CHANGELOG.md +++ b/plugins/notification/CHANGELOG.md @@ -1,5 +1,99 @@ # Changelog +## \[2.2.2] + +- [`a1b3fa27`](https://github.com/tauri-apps/plugins-workspace/commit/a1b3fa27f11022c9b6622b4fab12d93239eb05de) ([#2515](https://github.com/tauri-apps/plugins-workspace/pull/2515) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Re-exported the `Geolocation`, `Haptics`, `Notification`, and `Os` structs so that they show up on docs.rs. + +## \[2.2.1] + +- [`da5c59e2`](https://github.com/tauri-apps/plugins-workspace/commit/da5c59e2fe879d177e3cfd52fcacce85440423cb) ([#2271](https://github.com/tauri-apps/plugins-workspace/pull/2271) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Updated `zbus` dependency to version 5. No API changes. + +## \[2.2.0] + +- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other. + +## \[2.0.1] + +- [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7. + +## \[2.0.0] + +- [`e2c4dfb6`](https://github.com/tauri-apps/plugins-workspace/commit/e2c4dfb6af43e5dd8d9ceba232c315f5febd55c1) Update to tauri v2 stable release. + +## \[2.0.0-rc.5] + +- [`fb85e5dd`](https://github.com/tauri-apps/plugins-workspace/commit/fb85e5dd76688f3ae836890160f9bde843b70167) ([#1785](https://github.com/tauri-apps/plugins-workspace/pull/1785)) Update to tauri 2.0.0-rc.12. + +## \[2.0.0-rc.4] + +- [`3d301c65`](https://github.com/tauri-apps/plugins-workspace/commit/3d301c654e6f5e7f343e0e0cbb57648002e98f04) ([#1737](https://github.com/tauri-apps/plugins-workspace/pull/1737) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) The notification body is now optional on iOS to match the other platforms. + +## \[2.0.0-rc.1] + +- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Use `PermissionState` from the `tauri` crate, which now also includes a "prompt with rationale" variant for Android (returned when your app must explain to the user why it needs the permission). +- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) **Breaking change**: The permission type when using the API is now `'granted' | 'denied' | 'prompt' | 'prompt-with-rationale'` instead of `'granted' | 'denied' | 'default'` for consistency with Rust types. When using the `window.Notification` API the type is unchanged to match the Web API type. +- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri 2.0.0-rc.8 + +## \[2.0.0-rc.2] + +- [`b9147758`](https://github.com/tauri-apps/plugins-workspace/commit/b914775898c2bee7ceb20bd17ee595005cd17a64) ([#1679](https://github.com/tauri-apps/plugins-workspace/pull/1679) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Explicitly set a minimum macOS version for the Swift package. + +## \[2.0.0-rc.1] + +### changes + +- [`6b079cfd`](https://github.com/tauri-apps/plugins-workspace/commit/6b079cfdd107c94abc2c7300f6af00bac3ff4040) ([#1649](https://github.com/tauri-apps/plugins-workspace/pull/1649) by [@ahqsoftwares](https://github.com/tauri-apps/plugins-workspace/../../ahqsoftwares)) Remove targetSdk from build.kts files as it is deprecated and will be removed from DSL v9.0 + +## \[2.0.0-rc.0] + +- [`9887d1`](https://github.com/tauri-apps/plugins-workspace/commit/9887d14bd0e971c4c0f5c1188fc4005d3fc2e29e) Update to tauri RC. + +## \[2.0.0-beta.8] + +- [`99d6ac0f`](https://github.com/tauri-apps/plugins-workspace/commit/99d6ac0f9506a6a4a1aa59c728157190a7441af6) ([#1606](https://github.com/tauri-apps/plugins-workspace/pull/1606) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) The JS packages now specify the *minimum* `@tauri-apps/api` version instead of a single exact version. +- [`6de87966`](https://github.com/tauri-apps/plugins-workspace/commit/6de87966ecc00ad9d91c25be452f1f46bd2b7e1f) ([#1597](https://github.com/tauri-apps/plugins-workspace/pull/1597) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Update to tauri beta.25. + +## \[2.0.0-beta.11] + +- [`725ff429`](https://github.com/tauri-apps/plugins-workspace/commit/725ff4295e56df9c30c099813bd64b96fe61b945) ([#1556](https://github.com/tauri-apps/plugins-workspace/pull/1556) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Fixed an issue that caused the `notification` plugin's initialization script to cause the WebView on Windows to throw a `STATUS_ACCESS_VIOLATION` error on remote websites. + +## \[2.0.0-beta.7] + +- [`22a17980`](https://github.com/tauri-apps/plugins-workspace/commit/22a17980ff4f6f8c40adb1b8f4ffc6dae2fe7e30) ([#1537](https://github.com/tauri-apps/plugins-workspace/pull/1537) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri beta.24. + +## \[2.0.0-beta.6] + +- [`76daee7a`](https://github.com/tauri-apps/plugins-workspace/commit/76daee7aafece34de3092c86e531cf9eb1138989) ([#1512](https://github.com/tauri-apps/plugins-workspace/pull/1512) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Update to tauri beta.23. + +## \[2.0.0-beta.8] + +- [`3779fb50`](https://github.com/tauri-apps/plugins-workspace/commit/3779fb50634fba4d7e7eb0bfecc2216349b9d64d) ([#1432](https://github.com/tauri-apps/plugins-workspace/pull/1432) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Use notify_rust from crates.io instead of local fork. + +## \[2.0.0-beta.5] + +- [`9013854f`](https://github.com/tauri-apps/plugins-workspace/commit/9013854f42a49a230b9dbb9d02774765528a923f)([#1382](https://github.com/tauri-apps/plugins-workspace/pull/1382)) Update to tauri beta.22. + +## \[2.0.0-beta.4] + +- [`430bd6f4`](https://github.com/tauri-apps/plugins-workspace/commit/430bd6f4f379bee5d232ae6b098ae131db7f178a)([#1363](https://github.com/tauri-apps/plugins-workspace/pull/1363)) Update to tauri beta.20. + +## \[2.0.0-beta.3] + +- [`bd1ed590`](https://github.com/tauri-apps/plugins-workspace/commit/bd1ed5903ffcce5500310dac1e59e8c67674ef1e)([#1237](https://github.com/tauri-apps/plugins-workspace/pull/1237)) Update to tauri beta.17. + +## \[2.0.0-beta.4] + +- [`326df688`](https://github.com/tauri-apps/plugins-workspace/commit/326df6883998d416fc0837583ed972854628bb52)([#1236](https://github.com/tauri-apps/plugins-workspace/pull/1236)) Fixes command argument parsing on iOS. + +## \[2.0.0-beta.3] + +- [`a04ea2f`](https://github.com/tauri-apps/plugins-workspace/commit/a04ea2f38294d5a3987578283badc8eec87a7752)([#1071](https://github.com/tauri-apps/plugins-workspace/pull/1071)) The global API script is now only added to the binary when the `withGlobalTauri` config is true. +- [`62ce5df`](https://github.com/tauri-apps/plugins-workspace/commit/62ce5df52ca3c86786e711ef193a206e7b0dc0cf)([#1096](https://github.com/tauri-apps/plugins-workspace/pull/1096)) Fix development mode check to set the app ID on macOS. + +## \[2.0.0-beta.2] + +- [`99bea25`](https://github.com/tauri-apps/plugins-workspace/commit/99bea2559c2c0648c2519c50a18cd124dacef57b)([#1005](https://github.com/tauri-apps/plugins-workspace/pull/1005)) Update to tauri beta.8. + ## \[2.0.0-beta.1] - [`569defb`](https://github.com/tauri-apps/plugins-workspace/commit/569defbe9492e38938554bb7bdc1be9151456d21) Update to tauri beta.4. @@ -42,15 +136,3 @@ ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - ub.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11. - -## \[2.0.0-alpha.1] - -- [`d8b4aca`](https://github.com/tauri-apps/plugins-workspace/commit/d8b4aca69f628b170804ecb982e2c319d026ef47)([#414](https://github.com/tauri-apps/plugins-workspace/pull/414)) Use `window.__TAURI_INVOKE__` instead of `window.__TAURI__` in init.js, fixes usage in apps without `withGlobalTauri` enabled. -- [`7d71ad4`](https://github.com/tauri-apps/plugins-workspace/commit/7d71ad4e587bcf47ea34645f5b226945e487b765) Play a default sound when showing a notification on Windows. - -## \[2.0.0-alpha.0] - -- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - ithub.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! -717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/notification/Cargo.toml b/plugins/notification/Cargo.toml index eb5e6a86..bca17c09 100644 --- a/plugins/notification/Cargo.toml +++ b/plugins/notification/Cargo.toml @@ -1,20 +1,28 @@ [package] name = "tauri-plugin-notification" -version = "2.0.0-beta.1" +version = "2.2.2" description = "Send desktop and mobile notifications on your Tauri application." edition = { workspace = true } authors = { workspace = true } license = { workspace = true } rust-version = { workspace = true } +repository = { workspace = true } links = "tauri-plugin-notification" [package.metadata.docs.rs] -rustc-args = [ "--cfg", "docsrs" ] -rustdoc-args = [ "--cfg", "docsrs" ] -targets = [ "x86_64-unknown-linux-gnu", "x86_64-linux-android" ] +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs"] +targets = ["x86_64-unknown-linux-gnu", "x86_64-linux-android"] + +[package.metadata.platforms.support] +windows = { level = "full", notes = "Only works for installed apps. Shows powershell name & icon in development." } +linux = { level = "full", notes = "" } +macos = { level = "full", notes = "" } +android = { level = "full", notes = "" } +ios = { level = "full", notes = "" } [build-dependencies] -tauri-plugin = { workspace = true, features = [ "build" ] } +tauri-plugin = { workspace = true, features = ["build"] } [dependencies] serde = { workspace = true } @@ -23,34 +31,24 @@ tauri = { workspace = true } log = { workspace = true } thiserror = { workspace = true } rand = "0.8" -time = { version = "0.3", features = [ "serde", "parsing", "formatting" ] } -url = { version = "2", features = [ "serde" ] } +time = { version = "0.3", features = ["serde", "parsing", "formatting"] } +url = { version = "2", features = ["serde"] } serde_repr = "0.1" +[target.'cfg(target_os = "ios")'.dependencies] +tauri = { workspace = true, features = ["wry"] } + [target."cfg(windows)".dependencies] -win7-notifications = { version = "0.3.1", optional = true } +win7-notifications = { version = "0.4.5", optional = true } windows-version = { version = "0.1", optional = true } -[target."cfg(all(unix, not(target_os = \"macos\")))".dependencies] -lazy_static = { version = "1", optional = true } -image = { version = "0.24", optional = true } -zbus = { version = "4", optional = true } -log = "0.4" -env_logger = { version = "0.10", optional = true } - -[target."cfg(target_os=\"macos\")".dependencies] -mac-notification-sys = "0.6" -chrono = { version = "0.4", optional = true } - -[target."cfg(target_os=\"windows\")".dependencies] -winrt-notification = { package = "tauri-winrt-notification", version = "0.1" } +[target."cfg(any(target_os = \"macos\", windows, target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies] +notify-rust = "4.11" [dev-dependencies] -color-backtrace = "0.5" +color-backtrace = "0.7" ctor = "0.2" -maplit = "1.0" +maplit = "1" [features] -default = [ "zbus", "async" ] -async = [ ] -windows7-compat = [ "win7-notifications", "windows-version" ] +windows7-compat = ["win7-notifications", "windows-version"] diff --git a/plugins/notification/README.md b/plugins/notification/README.md index 8d1f9637..04632493 100644 --- a/plugins/notification/README.md +++ b/plugins/notification/README.md @@ -2,9 +2,17 @@ Send message notifications (brief auto-expiring OS window element) to your user. Can also be used with the Notification Web API. +| Platform | Supported | +| -------- | --------- | +| Linux | ✓ | +| Windows | ✓ | +| macOS | ✓ | +| Android | ✓ | +| iOS | ✓ | + ## Install -_This plugin requires a Rust version of at least **1.75**_ +_This plugin requires a Rust version of at least **1.77.2**_ There are three general methods of installation that we can recommend. @@ -18,7 +26,7 @@ Install the Core plugin by adding the following to your `Cargo.toml` file: ```toml [dependencies] -tauri-plugin-notification = "2.0.0-beta" +tauri-plugin-notification = "2.0.0" # alternatively with Git: tauri-plugin-notification = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` @@ -46,7 +54,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-notification#v2 First you need to register the core plugin with Tauri: -`src-tauri/src/main.rs` +`src-tauri/src/lib.rs` ```rust fn main() { @@ -57,10 +65,43 @@ fn main() { } ``` +Then you need to add the permissions to your capabilities file: + +`src-tauri/capabilities/main.json` + +```json +{ + ... + "permissions": [ + ... + "notification:default" + ], + ... +} +``` + Afterwards all the plugin's APIs are available through the JavaScript guest bindings: ```javascript +import { + isPermissionGranted, + requestPermission, + sendNotification +} from '@tauri-apps/plugin-notification' + +async function checkPermission() { + if (!(await isPermissionGranted())) { + return (await requestPermission()) === 'granted' + } + return true +} +export async function enqueueNotification(title, body) { + if (!(await checkPermission())) { + return + } + sendNotification({ title, body }) +} ``` ## Contributing diff --git a/plugins/notification/SECURITY.md b/plugins/notification/SECURITY.md new file mode 100644 index 00000000..4f09bbac --- /dev/null +++ b/plugins/notification/SECURITY.md @@ -0,0 +1,23 @@ +# Security Policy + +**Do not report security vulnerabilities through public GitHub issues.** + +**Please use the [Private Vulnerability Disclosure](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability) feature of GitHub.** + +Include as much of the following information: + +- Type of issue (e.g. improper input parsing, privilege escalation, etc.) +- The location of the affected source code (tag/branch/commit or direct URL) +- Any special configuration required to reproduce the issue +- The distribution affected or used to help us with reproduction of the issue +- Step-by-step instructions to reproduce the issue +- Ideally a reproduction repository +- Impact of the issue, including how an attacker might exploit the issue + +We prefer to receive reports in English. + +## Contact + +Please disclose a vulnerability or security relevant issue here: [https://github.com/tauri-apps/plugins-workspace/security/advisories/new](https://github.com/tauri-apps/plugins-workspace/security/advisories/new). + +Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app). diff --git a/plugins/notification/android/build.gradle.kts b/plugins/notification/android/build.gradle.kts index 6fe1c46a..0ac990e4 100644 --- a/plugins/notification/android/build.gradle.kts +++ b/plugins/notification/android/build.gradle.kts @@ -5,11 +5,10 @@ plugins { android { namespace = "app.tauri.notification" - compileSdk = 33 + compileSdk = 34 defaultConfig { - minSdk = 24 - targetSdk = 33 + minSdk = 24 testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles("consumer-rules.pro") diff --git a/plugins/notification/android/src/main/java/NotificationSchedule.kt b/plugins/notification/android/src/main/java/NotificationSchedule.kt index 459461b8..316ff909 100644 --- a/plugins/notification/android/src/main/java/NotificationSchedule.kt +++ b/plugins/notification/android/src/main/java/NotificationSchedule.kt @@ -135,7 +135,6 @@ internal class NotificationScheduleSerializer @JvmOverloads constructor(t: Class jgen.writeEndObject() } - else -> {} } jgen.writeEndObject() diff --git a/plugins/notification/api-iife.js b/plugins/notification/api-iife.js new file mode 100644 index 00000000..5ece60e8 --- /dev/null +++ b/plugins/notification/api-iife.js @@ -0,0 +1 @@ +if("__TAURI__"in window){var __TAURI_PLUGIN_NOTIFICATION__=function(i){"use strict";function t(i,t,n,e){if("function"==typeof t||!t.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?e:"a"===n?e.call(i):e?e.value:t.get(i)}function n(i,t,n,e,a){if("function"==typeof t||!t.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(i,n),n}var e,a,o,r;"function"==typeof SuppressedError&&SuppressedError;const c="__TAURI_TO_IPC_KEY__";class s{constructor(i){e.set(this,void 0),a.set(this,0),o.set(this,[]),r.set(this,void 0),n(this,e,i||(()=>{})),this.id=function(i,t=!1){return window.__TAURI_INTERNALS__.transformCallback(i,t)}((i=>{const c=i.index;if("end"in i)return void(c==t(this,a,"f")?this.cleanupCallback():n(this,r,c));const s=i.message;if(c==t(this,a,"f")){for(t(this,e,"f").call(this,s),n(this,a,t(this,a,"f")+1);t(this,a,"f")in t(this,o,"f");){const i=t(this,o,"f")[t(this,a,"f")];t(this,e,"f").call(this,i),delete t(this,o,"f")[t(this,a,"f")],n(this,a,t(this,a,"f")+1)}t(this,a,"f")===t(this,r,"f")&&this.cleanupCallback()}else t(this,o,"f")[c]=s}))}cleanupCallback(){Reflect.deleteProperty(window,`_${this.id}`)}set onmessage(i){n(this,e,i)}get onmessage(){return t(this,e,"f")}[(e=new WeakMap,a=new WeakMap,o=new WeakMap,r=new WeakMap,c)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[c]()}}class l{constructor(i,t,n){this.plugin=i,this.event=t,this.channelId=n}async unregister(){return f(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}}async function u(i,t,n){const e=new s(n);return f(`plugin:${i}|registerListener`,{event:t,handler:e}).then((()=>new l(i,t,e.id)))}async function f(i,t={},n){return window.__TAURI_INTERNALS__.invoke(i,t,n)}var h,d,w;i.ScheduleEvery=void 0,(h=i.ScheduleEvery||(i.ScheduleEvery={})).Year="year",h.Month="month",h.TwoWeeks="twoWeeks",h.Week="week",h.Day="day",h.Hour="hour",h.Minute="minute",h.Second="second";return i.Importance=void 0,(d=i.Importance||(i.Importance={}))[d.None=0]="None",d[d.Min=1]="Min",d[d.Low=2]="Low",d[d.Default=3]="Default",d[d.High=4]="High",i.Visibility=void 0,(w=i.Visibility||(i.Visibility={}))[w.Secret=-1]="Secret",w[w.Private=0]="Private",w[w.Public=1]="Public",i.Schedule=class{static at(i,t=!1,n=!1){return{at:{date:i,repeating:t,allowWhileIdle:n},interval:void 0,every:void 0}}static interval(i,t=!1){return{at:void 0,interval:{interval:i,allowWhileIdle:t},every:void 0}}static every(i,t,n=!1){return{at:void 0,interval:void 0,every:{interval:i,count:t,allowWhileIdle:n}}}},i.active=async function(){return await f("plugin:notification|get_active")},i.cancel=async function(i){await f("plugin:notification|cancel",{notifications:i})},i.cancelAll=async function(){await f("plugin:notification|cancel")},i.channels=async function(){return await f("plugin:notification|listChannels")},i.createChannel=async function(i){await f("plugin:notification|create_channel",{...i})},i.isPermissionGranted=async function(){return"default"!==window.Notification.permission?await Promise.resolve("granted"===window.Notification.permission):await f("plugin:notification|is_permission_granted")},i.onAction=async function(i){return await u("notification","actionPerformed",i)},i.onNotificationReceived=async function(i){return await u("notification","notification",i)},i.pending=async function(){return await f("plugin:notification|get_pending")},i.registerActionTypes=async function(i){await f("plugin:notification|register_action_types",{types:i})},i.removeActive=async function(i){await f("plugin:notification|remove_active",{notifications:i})},i.removeAllActive=async function(){await f("plugin:notification|remove_active")},i.removeChannel=async function(i){await f("plugin:notification|delete_channel",{id:i})},i.requestPermission=async function(){return await window.Notification.requestPermission()},i.sendNotification=function(i){"string"==typeof i?new window.Notification(i):new window.Notification(i.title,i)},i}({});Object.defineProperty(window.__TAURI__,"notification",{value:__TAURI_PLUGIN_NOTIFICATION__})} diff --git a/plugins/notification/build.rs b/plugins/notification/build.rs index 26d1f96e..4b24c755 100644 --- a/plugins/notification/build.rs +++ b/plugins/notification/build.rs @@ -2,18 +2,34 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -const COMMANDS: &[&str] = &["notify", "request_permission", "is_permission_granted"]; +const COMMANDS: &[&str] = &[ + "notify", + "request_permission", + "is_permission_granted", + "register_action_types", + "register_listener", + "cancel", + "get_pending", + "remove_active", + "get_active", + "check_permissions", + "show", + "batch", + "list_channels", + "delete_channel", + "create_channel", + "permission_state", +]; fn main() { - if let Err(error) = tauri_plugin::Builder::new(COMMANDS) + let result = tauri_plugin::Builder::new(COMMANDS) + .global_api_script_path("./api-iife.js") .android_path("android") .ios_path("ios") - .try_build() - { - println!("{error:#}"); - // when building documentation for Android the plugin build result is irrelevant to the crate itself - if !(cfg!(docsrs) && std::env::var("TARGET").unwrap().contains("android")) { - std::process::exit(1); - } + .try_build(); + + // when building documentation for Android the plugin build result is always Err() and is irrelevant to the crate documentation build + if !(cfg!(docsrs) && std::env::var("TARGET").unwrap().contains("android")) { + result.unwrap(); } } diff --git a/plugins/notification/guest-js/index.ts b/plugins/notification/guest-js/index.ts index b7bac7d7..9f81a1e1 100644 --- a/plugins/notification/guest-js/index.ts +++ b/plugins/notification/guest-js/index.ts @@ -11,9 +11,11 @@ import { invoke, - PluginListener, - addPluginListener, -} from "@tauri-apps/api/core"; + type PluginListener, + addPluginListener +} from '@tauri-apps/api/core' + +export type { PermissionState } from '@tauri-apps/api/core' /** * Options to send a notification. @@ -24,54 +26,54 @@ interface Options { /** * The notification identifier to reference this object later. Must be a 32-bit integer. */ - id?: number; + id?: number /** * Identifier of the {@link Channel} that deliveres this notification. * * If the channel does not exist, the notification won't fire. * Make sure the channel exists with {@link listChannels} and {@link createChannel}. */ - channelId?: string; + channelId?: string /** * Notification title. */ - title: string; + title: string /** * Optional notification body. * */ - body?: string; + body?: string /** * Schedule this notification to fire on a later time or a fixed interval. */ - schedule?: Schedule; + schedule?: Schedule /** * Multiline text. * Changes the notification style to big text. * Cannot be used with `inboxLines`. */ - largeBody?: string; + largeBody?: string /** * Detail text for the notification with `largeBody`, `inboxLines` or `groupSummary`. */ - summary?: string; + summary?: string /** * Defines an action type for this notification. */ - actionTypeId?: string; + actionTypeId?: string /** * Identifier used to group multiple notifications. * * https://developer.apple.com/documentation/usernotifications/unmutablenotificationcontent/1649872-threadidentifier */ - group?: string; + group?: string /** * Instructs the system that this notification is the summary of a group on Android. */ - groupSummary?: boolean; + groupSummary?: boolean /** * The sound resource name. Only available on mobile. */ - sound?: string; + sound?: string /** * List of lines to add to the notification. * Changes the notification style to inbox. @@ -79,31 +81,31 @@ interface Options { * * Only supports up to 5 lines. */ - inboxLines?: string[]; + inboxLines?: string[] /** * Notification icon. * * On Android the icon must be placed in the app's `res/drawable` folder. */ - icon?: string; + icon?: string /** * Notification large icon (Android). * * The icon must be placed in the app's `res/drawable` folder. */ - largeIcon?: string; + largeIcon?: string /** * Icon color on Android. */ - iconColor?: string; + iconColor?: string /** * Notification attachments. */ - attachments?: Attachment[]; + attachments?: Attachment[] /** * Extra payload to store in the notification. */ - extra?: { [key: string]: unknown }; + extra?: Record /** * If true, the notification cannot be dismissed by the user on Android. * @@ -111,29 +113,29 @@ interface Options { * It is typically used to indicate a background task that is pending (e.g. a file download) * or the user is engaged with (e.g. playing music). */ - ongoing?: boolean; + ongoing?: boolean /** * Automatically cancel the notification when the user clicks on it. */ - autoCancel?: boolean; + autoCancel?: boolean /** * Changes the notification presentation to be silent on iOS (no badge, no sound, not listed). */ - silent?: boolean; + silent?: boolean /** * Notification visibility. */ - visibility?: Visibility; + visibility?: Visibility /** * Sets the number of items this notification represents on Android. */ - number?: number; + number?: number } -type ScheduleInterval = { - year?: number; - month?: number; - day?: number; +interface ScheduleInterval { + year?: number + month?: number + day?: number /** * 1 - Sunday * 2 - Monday @@ -143,77 +145,79 @@ type ScheduleInterval = { * 6 - Friday * 7 - Saturday */ - weekday?: number; - hour?: number; - minute?: number; - second?: number; -}; + weekday?: number + hour?: number + minute?: number + second?: number +} enum ScheduleEvery { - Year = "year", - Month = "month", - TwoWeeks = "twoWeeks", - Week = "week", - Day = "day", - Hour = "hour", - Minute = "minute", + Year = 'year', + Month = 'month', + TwoWeeks = 'twoWeeks', + Week = 'week', + Day = 'day', + Hour = 'hour', + Minute = 'minute', /** * Not supported on iOS. */ - Second = "second", + Second = 'second' } class Schedule { at: | { - date: Date; - repeating: boolean; - allowWhileIdle: boolean; + date: Date + repeating: boolean + allowWhileIdle: boolean } - | undefined; + | undefined + interval: | { - interval: ScheduleInterval; - allowWhileIdle: boolean; + interval: ScheduleInterval + allowWhileIdle: boolean } - | undefined; + | undefined + every: | { - interval: ScheduleEvery; - count: number; - allowWhileIdle: boolean; + interval: ScheduleEvery + count: number + allowWhileIdle: boolean } - | undefined; + | undefined static at(date: Date, repeating = false, allowWhileIdle = false): Schedule { return { at: { date, repeating, allowWhileIdle }, interval: undefined, - every: undefined, - }; + every: undefined + } } static interval( interval: ScheduleInterval, - allowWhileIdle = false, + allowWhileIdle = false ): Schedule { return { at: undefined, interval: { interval, allowWhileIdle }, - every: undefined, - }; + every: undefined + } } static every( kind: ScheduleEvery, count: number, - allowWhileIdle = false, + allowWhileIdle = false ): Schedule { return { at: undefined, interval: undefined, - every: { interval: kind, count, allowWhileIdle }, - }; + every: { interval: kind, count, allowWhileIdle } + } } } @@ -222,58 +226,58 @@ class Schedule { */ interface Attachment { /** Attachment identifier. */ - id: string; + id: string /** Attachment URL. Accepts the `asset` and `file` protocols. */ - url: string; + url: string } interface Action { - id: string; - title: string; - requiresAuthentication?: boolean; - foreground?: boolean; - destructive?: boolean; - input?: boolean; - inputButtonTitle?: string; - inputPlaceholder?: string; + id: string + title: string + requiresAuthentication?: boolean + foreground?: boolean + destructive?: boolean + input?: boolean + inputButtonTitle?: string + inputPlaceholder?: string } interface ActionType { /** * The identifier of this action type */ - id: string; + id: string /** * The list of associated actions */ - actions: Action[]; - hiddenPreviewsBodyPlaceholder?: string; - customDismissAction?: boolean; - allowInCarPlay?: boolean; - hiddenPreviewsShowTitle?: boolean; - hiddenPreviewsShowSubtitle?: boolean; + actions: Action[] + hiddenPreviewsBodyPlaceholder?: string + customDismissAction?: boolean + allowInCarPlay?: boolean + hiddenPreviewsShowTitle?: boolean + hiddenPreviewsShowSubtitle?: boolean } interface PendingNotification { - id: number; - title?: string; - body?: string; - schedule: Schedule; + id: number + title?: string + body?: string + schedule: Schedule } interface ActiveNotification { - id: number; - tag?: string; - title?: string; - body?: string; - group?: string; - groupSummary: boolean; - data: Record; - extra: Record; - attachments: Attachment[]; - actionTypeId?: string; - schedule?: Schedule; - sound?: string; + id: number + tag?: string + title?: string + body?: string + group?: string + groupSummary: boolean + data: Record + extra: Record + attachments: Attachment[] + actionTypeId?: string + schedule?: Schedule + sound?: string } enum Importance { @@ -281,30 +285,27 @@ enum Importance { Min, Low, Default, - High, + High } enum Visibility { Secret = -1, Private, - Public, + Public } interface Channel { - id: string; - name: string; - description?: string; - sound?: string; - lights?: boolean; - lightColor?: string; - vibration?: boolean; - importance?: Importance; - visibility?: Visibility; + id: string + name: string + description?: string + sound?: string + lights?: boolean + lightColor?: string + vibration?: boolean + importance?: Importance + visibility?: Visibility } -/** Possible permission values. */ -type Permission = "granted" | "denied" | "default"; - /** * Checks if the permission to send notifications is granted. * @example @@ -316,10 +317,10 @@ type Permission = "granted" | "denied" | "default"; * @since 2.0.0 */ async function isPermissionGranted(): Promise { - if (window.Notification.permission !== "default") { - return Promise.resolve(window.Notification.permission === "granted"); + if (window.Notification.permission !== 'default') { + return await Promise.resolve(window.Notification.permission === 'granted') } - return invoke("plugin:notification|is_permission_granted"); + return await invoke('plugin:notification|is_permission_granted') } /** @@ -338,8 +339,8 @@ async function isPermissionGranted(): Promise { * * @since 2.0.0 */ -async function requestPermission(): Promise { - return window.Notification.requestPermission(); +async function requestPermission(): Promise { + return await window.Notification.requestPermission() } /** @@ -361,12 +362,10 @@ async function requestPermission(): Promise { * @since 2.0.0 */ function sendNotification(options: Options | string): void { - if (typeof options === "string") { - // eslint-disable-next-line no-new - new window.Notification(options); + if (typeof options === 'string') { + new window.Notification(options) } else { - // eslint-disable-next-line no-new - new window.Notification(options.title, options); + new window.Notification(options.title, options) } } @@ -390,7 +389,7 @@ function sendNotification(options: Options | string): void { * @since 2.0.0 */ async function registerActionTypes(types: ActionType[]): Promise { - return invoke("plugin:notification|register_action_types", { types }); + await invoke('plugin:notification|register_action_types', { types }) } /** @@ -407,7 +406,7 @@ async function registerActionTypes(types: ActionType[]): Promise { * @since 2.0.0 */ async function pending(): Promise { - return invoke("plugin:notification|get_pending"); + return await invoke('plugin:notification|get_pending') } /** @@ -424,7 +423,7 @@ async function pending(): Promise { * @since 2.0.0 */ async function cancel(notifications: number[]): Promise { - return invoke("plugin:notification|cancel", { notifications }); + await invoke('plugin:notification|cancel', { notifications }) } /** @@ -441,7 +440,7 @@ async function cancel(notifications: number[]): Promise { * @since 2.0.0 */ async function cancelAll(): Promise { - return invoke("plugin:notification|cancel"); + await invoke('plugin:notification|cancel') } /** @@ -458,7 +457,7 @@ async function cancelAll(): Promise { * @since 2.0.0 */ async function active(): Promise { - return invoke("plugin:notification|get_active"); + return await invoke('plugin:notification|get_active') } /** @@ -475,9 +474,9 @@ async function active(): Promise { * @since 2.0.0 */ async function removeActive( - notifications: { id: number; tag?: string }[], + notifications: Array<{ id: number; tag?: string }> ): Promise { - return invoke("plugin:notification|remove_active", { notifications }); + await invoke('plugin:notification|remove_active', { notifications }) } /** @@ -494,7 +493,7 @@ async function removeActive( * @since 2.0.0 */ async function removeAllActive(): Promise { - return invoke("plugin:notification|remove_active"); + await invoke('plugin:notification|remove_active') } /** @@ -518,7 +517,7 @@ async function removeAllActive(): Promise { * @since 2.0.0 */ async function createChannel(channel: Channel): Promise { - return invoke("plugin:notification|create_channel", { ...channel }); + await invoke('plugin:notification|create_channel', { ...channel }) } /** @@ -535,7 +534,7 @@ async function createChannel(channel: Channel): Promise { * @since 2.0.0 */ async function removeChannel(id: string): Promise { - return invoke("plugin:notification|delete_channel", { id }); + await invoke('plugin:notification|delete_channel', { id }) } /** @@ -552,32 +551,31 @@ async function removeChannel(id: string): Promise { * @since 2.0.0 */ async function channels(): Promise { - return invoke("plugin:notification|listChannels"); + return await invoke('plugin:notification|listChannels') } async function onNotificationReceived( - cb: (notification: Options) => void, + cb: (notification: Options) => void ): Promise { - return addPluginListener("notification", "notification", cb); + return await addPluginListener('notification', 'notification', cb) } async function onAction( - cb: (notification: Options) => void, + cb: (notification: Options) => void ): Promise { - return addPluginListener("notification", "actionPerformed", cb); + return await addPluginListener('notification', 'actionPerformed', cb) } export type { Attachment, Options, - Permission, Action, ActionType, PendingNotification, ActiveNotification, Channel, - ScheduleInterval, -}; + ScheduleInterval +} export { Importance, @@ -598,5 +596,5 @@ export { onNotificationReceived, onAction, Schedule, - ScheduleEvery, -}; + ScheduleEvery +} diff --git a/plugins/notification/guest-js/init.ts b/plugins/notification/guest-js/init.ts index 85c593fc..42d65fd9 100644 --- a/plugins/notification/guest-js/init.ts +++ b/plugins/notification/guest-js/init.ts @@ -2,82 +2,89 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { invoke } from "@tauri-apps/api/core"; -import type { Options } from "./index"; +import { invoke } from '@tauri-apps/api/core' +import type { PermissionState } from '@tauri-apps/api/core' +import type { Options } from './index' +;(function () { + let permissionSettable = false + let permissionValue = 'default' -(function () { - let permissionSettable = false; - let permissionValue = "default"; - - function isPermissionGranted() { - if (window.Notification.permission !== "default") { - return Promise.resolve(window.Notification.permission === "granted"); + async function isPermissionGranted(): Promise { + // @ts-expect-error __TEMPLATE_windows__ will be replaced in rust before it's injected. + if (window.Notification.permission !== 'default' || __TEMPLATE_windows__) { + return await Promise.resolve(window.Notification.permission === 'granted') } - return invoke("plugin:notification|is_permission_granted"); + return await invoke('plugin:notification|is_permission_granted') } - function setNotificationPermission(value: "granted" | "denied" | "default") { - permissionSettable = true; + function setNotificationPermission(value: NotificationPermission): void { + permissionSettable = true // @ts-expect-error we can actually set this value on the webview - window.Notification.permission = value; - permissionSettable = false; + window.Notification.permission = value + permissionSettable = false } - function requestPermission() { - return invoke<"prompt" | "default" | "granted" | "denied">( - "plugin:notification|request_permission", + async function requestPermission(): Promise { + return await invoke( + 'plugin:notification|request_permission' ).then((permission) => { setNotificationPermission( - permission === "prompt" ? "default" : permission, - ); - return permission; - }); + permission === 'prompt' || permission === 'prompt-with-rationale' + ? 'default' + : permission + ) + return permission + }) } - function sendNotification(options: string | Options) { - if (typeof options === "object") { - Object.freeze(options); + async function sendNotification(options: string | Options): Promise { + if (typeof options === 'object') { + Object.freeze(options) } - return invoke("plugin:notification|notify", { + await invoke('plugin:notification|notify', { options: - typeof options === "string" + typeof options === 'string' ? { - title: options, + title: options } - : options, - }); + : options + }) } // @ts-expect-error unfortunately we can't implement the whole type, so we overwrite it with our own version window.Notification = function (title, options) { - const opts = options || {}; - sendNotification( + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + const opts = options || {} + void sendNotification( + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument Object.assign(opts, { - title, - }), - ); - }; + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + title + }) + ) + } // @ts-expect-error tauri does not have sync IPC :( - window.Notification.requestPermission = requestPermission; + window.Notification.requestPermission = requestPermission - Object.defineProperty(window.Notification, "permission", { + Object.defineProperty(window.Notification, 'permission', { enumerable: true, get: () => permissionValue, set: (v) => { if (!permissionSettable) { - throw new Error("Readonly property"); + throw new Error('Readonly property') } - permissionValue = v; - }, - }); + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + permissionValue = v + } + }) - isPermissionGranted().then(function (response) { + void isPermissionGranted().then(function (response) { if (response === null) { - setNotificationPermission("default"); + setNotificationPermission('default') } else { - setNotificationPermission(response ? "granted" : "denied"); + setNotificationPermission(response ? 'granted' : 'denied') } - }); -})(); + }) +})() diff --git a/plugins/notification/ios/Package.swift b/plugins/notification/ios/Package.swift index 9b681869..bbd6df9e 100644 --- a/plugins/notification/ios/Package.swift +++ b/plugins/notification/ios/Package.swift @@ -3,33 +3,32 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT - - import PackageDescription let package = Package( - name: "tauri-plugin-notification", - platforms: [ - .iOS(.v13), - ], - products: [ - // Products define the executables and libraries a package produces, and make them visible to other packages. - .library( - name: "tauri-plugin-notification", - type: .static, - targets: ["tauri-plugin-notification"]), - ], - dependencies: [ - .package(name: "Tauri", path: "../.tauri/tauri-api") - ], - targets: [ - // Targets are the basic building blocks of a package. A target can define a module or a test suite. - // Targets can depend on other targets in this package, and on products in packages this package depends on. - .target( - name: "tauri-plugin-notification", - dependencies: [ - .byName(name: "Tauri") - ], - path: "Sources") - ] + name: "tauri-plugin-notification", + platforms: [ + .macOS(.v10_13), + .iOS(.v13), + ], + products: [ + // Products define the executables and libraries a package produces, and make them visible to other packages. + .library( + name: "tauri-plugin-notification", + type: .static, + targets: ["tauri-plugin-notification"]) + ], + dependencies: [ + .package(name: "Tauri", path: "../.tauri/tauri-api") + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages this package depends on. + .target( + name: "tauri-plugin-notification", + dependencies: [ + .byName(name: "Tauri") + ], + path: "Sources") + ] ) diff --git a/plugins/notification/ios/Sources/Notification.swift b/plugins/notification/ios/Sources/Notification.swift index 0f572aa9..adba05ec 100644 --- a/plugins/notification/ios/Sources/Notification.swift +++ b/plugins/notification/ios/Sources/Notification.swift @@ -32,9 +32,11 @@ func makeNotificationContent(_ notification: Notification) throws -> UNNotificat let content = UNMutableNotificationContent() content.title = NSString.localizedUserNotificationString( forKey: notification.title, arguments: nil) - content.body = NSString.localizedUserNotificationString( - forKey: notification.body, - arguments: nil) + if let body = notification.body { + content.body = NSString.localizedUserNotificationString( + forKey: body, + arguments: nil) + } content.userInfo = [ "__EXTRA__": notification.extra as Any, diff --git a/plugins/notification/ios/Sources/NotificationCategory.swift b/plugins/notification/ios/Sources/NotificationCategory.swift index a5d4eea6..f796e03a 100644 --- a/plugins/notification/ios/Sources/NotificationCategory.swift +++ b/plugins/notification/ios/Sources/NotificationCategory.swift @@ -40,7 +40,7 @@ func makeActions(_ actions: [Action]) -> [UNNotificationAction] { for action in actions { var newAction: UNNotificationAction - if action.input { + if action.input ?? false { if action.inputButtonTitle != nil { newAction = UNTextInputNotificationAction( identifier: action.id, @@ -66,30 +66,30 @@ func makeActions(_ actions: [Action]) -> [UNNotificationAction] { } func makeActionOptions(_ action: Action) -> UNNotificationActionOptions { - if action.foreground { + if action.foreground ?? false { return .foreground } - if action.destructive { + if action.destructive ?? false { return .destructive } - if action.requiresAuthentication { + if action.requiresAuthentication ?? false { return .authenticationRequired } return UNNotificationActionOptions(rawValue: 0) } func makeCategoryOptions(_ type: ActionType) -> UNNotificationCategoryOptions { - if type.customDismissAction { + if type.customDismissAction ?? false { return .customDismissAction } - if type.allowInCarPlay { + if type.allowInCarPlay ?? false { return .allowInCarPlay } - if type.hiddenPreviewsShowTitle { + if type.hiddenPreviewsShowTitle ?? false { return .hiddenPreviewsShowTitle } - if type.hiddenPreviewsShowSubtitle { + if type.hiddenPreviewsShowSubtitle ?? false { return .hiddenPreviewsShowSubtitle } diff --git a/plugins/notification/ios/Sources/NotificationHandler.swift b/plugins/notification/ios/Sources/NotificationHandler.swift index 83ac0ae4..1bf134b6 100644 --- a/plugins/notification/ios/Sources/NotificationHandler.swift +++ b/plugins/notification/ios/Sources/NotificationHandler.swift @@ -34,7 +34,7 @@ public class NotificationHandler: NSObject, NotificationHandlerProtocol { try? self.plugin?.trigger("notification", data: notificationData) if let options = notificationsMap[notification.request.identifier] { - if options.silent { + if options.silent ?? false { return UNNotificationPresentationOptions.init(rawValue: 0) } } diff --git a/plugins/notification/ios/Sources/NotificationPlugin.swift b/plugins/notification/ios/Sources/NotificationPlugin.swift index 53c9788e..6d8391bc 100644 --- a/plugins/notification/ios/Sources/NotificationPlugin.swift +++ b/plugins/notification/ios/Sources/NotificationPlugin.swift @@ -34,13 +34,13 @@ enum ScheduleEveryKind: String, Decodable { } struct ScheduleInterval: Decodable { - let year: Int? - let month: Int? - let day: Int? - let weekday: Int? - let hour: Int? - let minute: Int? - let second: Int? + var year: Int? + var month: Int? + var day: Int? + var weekday: Int? + var hour: Int? + var minute: Int? + var second: Int? } enum NotificationSchedule: Decodable { @@ -64,16 +64,16 @@ struct NotificationAttachment: Codable { struct Notification: Decodable { let id: Int - var title: String = "" - var body: String = "" - var extra: [String: String] = [:] - let schedule: NotificationSchedule? - let attachments: [NotificationAttachment]? - let sound: String? - let group: String? - let actionTypeId: String? - let summary: String? - var silent = false + var title: String + var body: String? + var extra: [String: String]? + var schedule: NotificationSchedule? + var attachments: [NotificationAttachment]? + var sound: String? + var group: String? + var actionTypeId: String? + var summary: String? + var silent: Bool? } struct RemoveActiveNotification: Decodable { @@ -126,23 +126,23 @@ struct CancelArgs: Decodable { struct Action: Decodable { let id: String let title: String - var requiresAuthentication: Bool = false - var foreground: Bool = false - var destructive: Bool = false - var input: Bool = false - let inputButtonTitle: String? - let inputPlaceholder: String? + var requiresAuthentication: Bool? + var foreground: Bool? + var destructive: Bool? + var input: Bool? + var inputButtonTitle: String? + var inputPlaceholder: String? } struct ActionType: Decodable { let id: String let actions: [Action] - let hiddenPreviewsBodyPlaceholder: String? - var customDismissAction = false - var allowInCarPlay = false - var hiddenPreviewsShowTitle = false - var hiddenPreviewsShowSubtitle = false - let hiddenBodyPlaceholder: String? + var hiddenPreviewsBodyPlaceholder: String? + var customDismissAction: Bool? + var allowInCarPlay: Bool? + var hiddenPreviewsShowTitle: Bool? + var hiddenPreviewsShowSubtitle: Bool? + var hiddenBodyPlaceholder: String? } struct RegisterActionTypesArgs: Decodable { diff --git a/plugins/notification/package.json b/plugins/notification/package.json index cc16ce62..07c04d5c 100644 --- a/plugins/notification/package.json +++ b/plugins/notification/package.json @@ -1,10 +1,11 @@ { "name": "@tauri-apps/plugin-notification", - "version": "2.0.0-beta.1", - "license": "MIT or APACHE-2.0", + "version": "2.2.2", + "license": "MIT OR Apache-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" ], + "repository": "https://github.com/tauri-apps/plugins-workspace", "type": "module", "types": "./dist-js/index.d.ts", "main": "./dist-js/index.cjs", @@ -23,6 +24,6 @@ "LICENSE" ], "dependencies": { - "@tauri-apps/api": "2.0.0-beta.2" + "@tauri-apps/api": "^2.0.0" } } diff --git a/plugins/notification/permissions/autogenerated/commands/batch.toml b/plugins/notification/permissions/autogenerated/commands/batch.toml new file mode 100644 index 00000000..c52cc16d --- /dev/null +++ b/plugins/notification/permissions/autogenerated/commands/batch.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-batch" +description = "Enables the batch command without any pre-configured scope." +commands.allow = ["batch"] + +[[permission]] +identifier = "deny-batch" +description = "Denies the batch command without any pre-configured scope." +commands.deny = ["batch"] diff --git a/plugins/notification/permissions/autogenerated/commands/cancel.toml b/plugins/notification/permissions/autogenerated/commands/cancel.toml new file mode 100644 index 00000000..91efeaa0 --- /dev/null +++ b/plugins/notification/permissions/autogenerated/commands/cancel.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-cancel" +description = "Enables the cancel command without any pre-configured scope." +commands.allow = ["cancel"] + +[[permission]] +identifier = "deny-cancel" +description = "Denies the cancel command without any pre-configured scope." +commands.deny = ["cancel"] diff --git a/plugins/notification/permissions/autogenerated/commands/check_permissions.toml b/plugins/notification/permissions/autogenerated/commands/check_permissions.toml new file mode 100644 index 00000000..f5af08b1 --- /dev/null +++ b/plugins/notification/permissions/autogenerated/commands/check_permissions.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-check-permissions" +description = "Enables the check_permissions command without any pre-configured scope." +commands.allow = ["check_permissions"] + +[[permission]] +identifier = "deny-check-permissions" +description = "Denies the check_permissions command without any pre-configured scope." +commands.deny = ["check_permissions"] diff --git a/plugins/notification/permissions/autogenerated/commands/create_channel.toml b/plugins/notification/permissions/autogenerated/commands/create_channel.toml new file mode 100644 index 00000000..2c931474 --- /dev/null +++ b/plugins/notification/permissions/autogenerated/commands/create_channel.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-create-channel" +description = "Enables the create_channel command without any pre-configured scope." +commands.allow = ["create_channel"] + +[[permission]] +identifier = "deny-create-channel" +description = "Denies the create_channel command without any pre-configured scope." +commands.deny = ["create_channel"] diff --git a/plugins/notification/permissions/autogenerated/commands/delete_channel.toml b/plugins/notification/permissions/autogenerated/commands/delete_channel.toml new file mode 100644 index 00000000..0adaf2bb --- /dev/null +++ b/plugins/notification/permissions/autogenerated/commands/delete_channel.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-delete-channel" +description = "Enables the delete_channel command without any pre-configured scope." +commands.allow = ["delete_channel"] + +[[permission]] +identifier = "deny-delete-channel" +description = "Denies the delete_channel command without any pre-configured scope." +commands.deny = ["delete_channel"] diff --git a/plugins/notification/permissions/autogenerated/commands/get_active.toml b/plugins/notification/permissions/autogenerated/commands/get_active.toml new file mode 100644 index 00000000..b841eb85 --- /dev/null +++ b/plugins/notification/permissions/autogenerated/commands/get_active.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-get-active" +description = "Enables the get_active command without any pre-configured scope." +commands.allow = ["get_active"] + +[[permission]] +identifier = "deny-get-active" +description = "Denies the get_active command without any pre-configured scope." +commands.deny = ["get_active"] diff --git a/plugins/notification/permissions/autogenerated/commands/get_pending.toml b/plugins/notification/permissions/autogenerated/commands/get_pending.toml new file mode 100644 index 00000000..f3bae7a8 --- /dev/null +++ b/plugins/notification/permissions/autogenerated/commands/get_pending.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-get-pending" +description = "Enables the get_pending command without any pre-configured scope." +commands.allow = ["get_pending"] + +[[permission]] +identifier = "deny-get-pending" +description = "Denies the get_pending command without any pre-configured scope." +commands.deny = ["get_pending"] diff --git a/plugins/notification/permissions/autogenerated/commands/list_channels.toml b/plugins/notification/permissions/autogenerated/commands/list_channels.toml new file mode 100644 index 00000000..cb20cd57 --- /dev/null +++ b/plugins/notification/permissions/autogenerated/commands/list_channels.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-list-channels" +description = "Enables the list_channels command without any pre-configured scope." +commands.allow = ["list_channels"] + +[[permission]] +identifier = "deny-list-channels" +description = "Denies the list_channels command without any pre-configured scope." +commands.deny = ["list_channels"] diff --git a/plugins/notification/permissions/autogenerated/commands/permission_state.toml b/plugins/notification/permissions/autogenerated/commands/permission_state.toml new file mode 100644 index 00000000..dddcd86f --- /dev/null +++ b/plugins/notification/permissions/autogenerated/commands/permission_state.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-permission-state" +description = "Enables the permission_state command without any pre-configured scope." +commands.allow = ["permission_state"] + +[[permission]] +identifier = "deny-permission-state" +description = "Denies the permission_state command without any pre-configured scope." +commands.deny = ["permission_state"] diff --git a/plugins/notification/permissions/autogenerated/commands/register_action_types.toml b/plugins/notification/permissions/autogenerated/commands/register_action_types.toml new file mode 100644 index 00000000..cb5aa89f --- /dev/null +++ b/plugins/notification/permissions/autogenerated/commands/register_action_types.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-register-action-types" +description = "Enables the register_action_types command without any pre-configured scope." +commands.allow = ["register_action_types"] + +[[permission]] +identifier = "deny-register-action-types" +description = "Denies the register_action_types command without any pre-configured scope." +commands.deny = ["register_action_types"] diff --git a/plugins/notification/permissions/autogenerated/commands/register_listener.toml b/plugins/notification/permissions/autogenerated/commands/register_listener.toml new file mode 100644 index 00000000..48363c0d --- /dev/null +++ b/plugins/notification/permissions/autogenerated/commands/register_listener.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-register-listener" +description = "Enables the register_listener command without any pre-configured scope." +commands.allow = ["register_listener"] + +[[permission]] +identifier = "deny-register-listener" +description = "Denies the register_listener command without any pre-configured scope." +commands.deny = ["register_listener"] diff --git a/plugins/notification/permissions/autogenerated/commands/remove_active.toml b/plugins/notification/permissions/autogenerated/commands/remove_active.toml new file mode 100644 index 00000000..9ad2add1 --- /dev/null +++ b/plugins/notification/permissions/autogenerated/commands/remove_active.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-remove-active" +description = "Enables the remove_active command without any pre-configured scope." +commands.allow = ["remove_active"] + +[[permission]] +identifier = "deny-remove-active" +description = "Denies the remove_active command without any pre-configured scope." +commands.deny = ["remove_active"] diff --git a/plugins/notification/permissions/autogenerated/commands/show.toml b/plugins/notification/permissions/autogenerated/commands/show.toml new file mode 100644 index 00000000..3d4cbf38 --- /dev/null +++ b/plugins/notification/permissions/autogenerated/commands/show.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-show" +description = "Enables the show command without any pre-configured scope." +commands.allow = ["show"] + +[[permission]] +identifier = "deny-show" +description = "Denies the show command without any pre-configured scope." +commands.deny = ["show"] diff --git a/plugins/notification/permissions/autogenerated/reference.md b/plugins/notification/permissions/autogenerated/reference.md index 44cbd31b..7186a421 100644 --- a/plugins/notification/permissions/autogenerated/reference.md +++ b/plugins/notification/permissions/autogenerated/reference.md @@ -1,30 +1,455 @@ -# Permissions +## Default Permission -## allow-is-permission-granted +This permission set configures which +notification features are by default exposed. + +#### Granted Permissions + +It allows all notification related features. + + + +#### This default permission set includes the following: + +- `allow-is-permission-granted` +- `allow-request-permission` +- `allow-notify` +- `allow-register-action-types` +- `allow-register-listener` +- `allow-cancel` +- `allow-get-pending` +- `allow-remove-active` +- `allow-get-active` +- `allow-check-permissions` +- `allow-show` +- `allow-batch` +- `allow-list-channels` +- `allow-delete-channel` +- `allow-create-channel` +- `allow-permission-state` + +## Permission Table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IdentifierDescription
+ +`notification:allow-batch` + + + +Enables the batch command without any pre-configured scope. + +
+ +`notification:deny-batch` + + + +Denies the batch command without any pre-configured scope. + +
+ +`notification:allow-cancel` + + + +Enables the cancel command without any pre-configured scope. + +
+ +`notification:deny-cancel` + + + +Denies the cancel command without any pre-configured scope. + +
+ +`notification:allow-check-permissions` + + + +Enables the check_permissions command without any pre-configured scope. + +
+ +`notification:deny-check-permissions` + + + +Denies the check_permissions command without any pre-configured scope. + +
+ +`notification:allow-create-channel` + + + +Enables the create_channel command without any pre-configured scope. + +
+ +`notification:deny-create-channel` + + + +Denies the create_channel command without any pre-configured scope. + +
+ +`notification:allow-delete-channel` + + + +Enables the delete_channel command without any pre-configured scope. + +
+ +`notification:deny-delete-channel` + + + +Denies the delete_channel command without any pre-configured scope. + +
+ +`notification:allow-get-active` + + + +Enables the get_active command without any pre-configured scope. + +
+ +`notification:deny-get-active` + + + +Denies the get_active command without any pre-configured scope. + +
+ +`notification:allow-get-pending` + + + +Enables the get_pending command without any pre-configured scope. + +
+ +`notification:deny-get-pending` + + + +Denies the get_pending command without any pre-configured scope. + +
+ +`notification:allow-is-permission-granted` + + Enables the is_permission_granted command without any pre-configured scope. -## deny-is-permission-granted +
+ +`notification:deny-is-permission-granted` + + Denies the is_permission_granted command without any pre-configured scope. -## allow-notify +
+ +`notification:allow-list-channels` + + + +Enables the list_channels command without any pre-configured scope. + +
+ +`notification:deny-list-channels` + + + +Denies the list_channels command without any pre-configured scope. + +
+ +`notification:allow-notify` + + Enables the notify command without any pre-configured scope. -## deny-notify +
+ +`notification:deny-notify` + + Denies the notify command without any pre-configured scope. -## allow-request-permission +
+ +`notification:allow-permission-state` + + + +Enables the permission_state command without any pre-configured scope. + +
+ +`notification:deny-permission-state` + + + +Denies the permission_state command without any pre-configured scope. + +
+ +`notification:allow-register-action-types` + + + +Enables the register_action_types command without any pre-configured scope. + +
+ +`notification:deny-register-action-types` + + + +Denies the register_action_types command without any pre-configured scope. + +
+ +`notification:allow-register-listener` + + + +Enables the register_listener command without any pre-configured scope. + +
+ +`notification:deny-register-listener` + + + +Denies the register_listener command without any pre-configured scope. + +
+ +`notification:allow-remove-active` + + + +Enables the remove_active command without any pre-configured scope. + +
+ +`notification:deny-remove-active` + + + +Denies the remove_active command without any pre-configured scope. + +
+ +`notification:allow-request-permission` + + Enables the request_permission command without any pre-configured scope. -## deny-request-permission +
+ +`notification:deny-request-permission` + + Denies the request_permission command without any pre-configured scope. -## default +
+ +`notification:allow-show` + + + +Enables the show command without any pre-configured scope. + +
+ +`notification:deny-show` + + -Allows requesting permission, checking permission state and sending notifications +Denies the show command without any pre-configured scope. +
diff --git a/plugins/notification/permissions/default.toml b/plugins/notification/permissions/default.toml index 2bd85142..00b4e1d0 100644 --- a/plugins/notification/permissions/default.toml +++ b/plugins/notification/permissions/default.toml @@ -1,8 +1,30 @@ "$schema" = "schemas/schema.json" [default] -description = "Allows requesting permission, checking permission state and sending notifications" +description = """ +This permission set configures which +notification features are by default exposed. + +#### Granted Permissions + +It allows all notification related features. + +""" + permissions = [ "allow-is-permission-granted", "allow-request-permission", "allow-notify", + "allow-register-action-types", + "allow-register-listener", + "allow-cancel", + "allow-get-pending", + "allow-remove-active", + "allow-get-active", + "allow-check-permissions", + "allow-show", + "allow-batch", + "allow-list-channels", + "allow-delete-channel", + "allow-create-channel", + "allow-permission-state", ] diff --git a/plugins/notification/permissions/schemas/schema.json b/plugins/notification/permissions/schemas/schema.json index a027f1ff..26703a8a 100644 --- a/plugins/notification/permissions/schemas/schema.json +++ b/plugins/notification/permissions/schemas/schema.json @@ -17,7 +17,6 @@ }, "set": { "description": "A list of permissions sets defined", - "default": [], "type": "array", "items": { "$ref": "#/definitions/PermissionSet" @@ -50,7 +49,7 @@ "minimum": 1.0 }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -112,7 +111,7 @@ "type": "string" }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri internal convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -132,12 +131,21 @@ }, "scope": { "description": "Allowed or denied scoped when using this permission.", - "default": {}, "allOf": [ { "$ref": "#/definitions/Scopes" } ] + }, + "platforms": { + "description": "Target platforms this permission applies. By default all platforms are affected by this permission.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Target" + } } } }, @@ -164,7 +172,7 @@ } }, "Scopes": { - "description": "A restriction of the command/endpoint functionality.\n\nIt can be of any serde serializable type and is used for allowing or preventing certain actions inside a Tauri command.\n\nThe scope is passed to the command and handled/enforced by the command itself.", + "description": "An argument for fine grained behavior control of Tauri commands.\n\nIt can be of any serde serializable type and is used to allow or prevent certain actions inside a Tauri command. The configured scope is passed to the command and will be enforced by the command implementation.\n\n## Example\n\n```json { \"allow\": [{ \"path\": \"$HOME/**\" }], \"deny\": [{ \"path\": \"$HOME/secret.txt\" }] } ```", "type": "object", "properties": { "allow": { @@ -178,7 +186,7 @@ } }, "deny": { - "description": "Data that defines what is denied by the scope.", + "description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.", "type": [ "array", "null" @@ -243,57 +251,246 @@ } ] }, - "PermissionKind": { - "type": "string", + "Target": { + "description": "Platform target.", "oneOf": [ { - "description": "allow-is-permission-granted -> Enables the is_permission_granted command without any pre-configured scope.", + "description": "MacOS.", "type": "string", "enum": [ - "allow-is-permission-granted" + "macOS" ] }, { - "description": "deny-is-permission-granted -> Denies the is_permission_granted command without any pre-configured scope.", + "description": "Windows.", "type": "string", "enum": [ - "deny-is-permission-granted" + "windows" ] }, { - "description": "allow-notify -> Enables the notify command without any pre-configured scope.", + "description": "Linux.", "type": "string", "enum": [ - "allow-notify" + "linux" ] }, { - "description": "deny-notify -> Denies the notify command without any pre-configured scope.", + "description": "Android.", "type": "string", "enum": [ - "deny-notify" + "android" ] }, { - "description": "allow-request-permission -> Enables the request_permission command without any pre-configured scope.", + "description": "iOS.", "type": "string", "enum": [ - "allow-request-permission" + "iOS" ] + } + ] + }, + "PermissionKind": { + "type": "string", + "oneOf": [ + { + "description": "Enables the batch command without any pre-configured scope.", + "type": "string", + "const": "allow-batch", + "markdownDescription": "Enables the batch command without any pre-configured scope." }, { - "description": "deny-request-permission -> Denies the request_permission command without any pre-configured scope.", + "description": "Denies the batch command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-request-permission" - ] + "const": "deny-batch", + "markdownDescription": "Denies the batch command without any pre-configured scope." }, { - "description": "default -> Allows requesting permission, checking permission state and sending notifications", + "description": "Enables the cancel command without any pre-configured scope.", "type": "string", - "enum": [ - "default" - ] + "const": "allow-cancel", + "markdownDescription": "Enables the cancel command without any pre-configured scope." + }, + { + "description": "Denies the cancel command without any pre-configured scope.", + "type": "string", + "const": "deny-cancel", + "markdownDescription": "Denies the cancel command without any pre-configured scope." + }, + { + "description": "Enables the check_permissions command without any pre-configured scope.", + "type": "string", + "const": "allow-check-permissions", + "markdownDescription": "Enables the check_permissions command without any pre-configured scope." + }, + { + "description": "Denies the check_permissions command without any pre-configured scope.", + "type": "string", + "const": "deny-check-permissions", + "markdownDescription": "Denies the check_permissions command without any pre-configured scope." + }, + { + "description": "Enables the create_channel command without any pre-configured scope.", + "type": "string", + "const": "allow-create-channel", + "markdownDescription": "Enables the create_channel command without any pre-configured scope." + }, + { + "description": "Denies the create_channel command without any pre-configured scope.", + "type": "string", + "const": "deny-create-channel", + "markdownDescription": "Denies the create_channel command without any pre-configured scope." + }, + { + "description": "Enables the delete_channel command without any pre-configured scope.", + "type": "string", + "const": "allow-delete-channel", + "markdownDescription": "Enables the delete_channel command without any pre-configured scope." + }, + { + "description": "Denies the delete_channel command without any pre-configured scope.", + "type": "string", + "const": "deny-delete-channel", + "markdownDescription": "Denies the delete_channel command without any pre-configured scope." + }, + { + "description": "Enables the get_active command without any pre-configured scope.", + "type": "string", + "const": "allow-get-active", + "markdownDescription": "Enables the get_active command without any pre-configured scope." + }, + { + "description": "Denies the get_active command without any pre-configured scope.", + "type": "string", + "const": "deny-get-active", + "markdownDescription": "Denies the get_active command without any pre-configured scope." + }, + { + "description": "Enables the get_pending command without any pre-configured scope.", + "type": "string", + "const": "allow-get-pending", + "markdownDescription": "Enables the get_pending command without any pre-configured scope." + }, + { + "description": "Denies the get_pending command without any pre-configured scope.", + "type": "string", + "const": "deny-get-pending", + "markdownDescription": "Denies the get_pending command without any pre-configured scope." + }, + { + "description": "Enables the is_permission_granted command without any pre-configured scope.", + "type": "string", + "const": "allow-is-permission-granted", + "markdownDescription": "Enables the is_permission_granted command without any pre-configured scope." + }, + { + "description": "Denies the is_permission_granted command without any pre-configured scope.", + "type": "string", + "const": "deny-is-permission-granted", + "markdownDescription": "Denies the is_permission_granted command without any pre-configured scope." + }, + { + "description": "Enables the list_channels command without any pre-configured scope.", + "type": "string", + "const": "allow-list-channels", + "markdownDescription": "Enables the list_channels command without any pre-configured scope." + }, + { + "description": "Denies the list_channels command without any pre-configured scope.", + "type": "string", + "const": "deny-list-channels", + "markdownDescription": "Denies the list_channels command without any pre-configured scope." + }, + { + "description": "Enables the notify command without any pre-configured scope.", + "type": "string", + "const": "allow-notify", + "markdownDescription": "Enables the notify command without any pre-configured scope." + }, + { + "description": "Denies the notify command without any pre-configured scope.", + "type": "string", + "const": "deny-notify", + "markdownDescription": "Denies the notify command without any pre-configured scope." + }, + { + "description": "Enables the permission_state command without any pre-configured scope.", + "type": "string", + "const": "allow-permission-state", + "markdownDescription": "Enables the permission_state command without any pre-configured scope." + }, + { + "description": "Denies the permission_state command without any pre-configured scope.", + "type": "string", + "const": "deny-permission-state", + "markdownDescription": "Denies the permission_state command without any pre-configured scope." + }, + { + "description": "Enables the register_action_types command without any pre-configured scope.", + "type": "string", + "const": "allow-register-action-types", + "markdownDescription": "Enables the register_action_types command without any pre-configured scope." + }, + { + "description": "Denies the register_action_types command without any pre-configured scope.", + "type": "string", + "const": "deny-register-action-types", + "markdownDescription": "Denies the register_action_types command without any pre-configured scope." + }, + { + "description": "Enables the register_listener command without any pre-configured scope.", + "type": "string", + "const": "allow-register-listener", + "markdownDescription": "Enables the register_listener command without any pre-configured scope." + }, + { + "description": "Denies the register_listener command without any pre-configured scope.", + "type": "string", + "const": "deny-register-listener", + "markdownDescription": "Denies the register_listener command without any pre-configured scope." + }, + { + "description": "Enables the remove_active command without any pre-configured scope.", + "type": "string", + "const": "allow-remove-active", + "markdownDescription": "Enables the remove_active command without any pre-configured scope." + }, + { + "description": "Denies the remove_active command without any pre-configured scope.", + "type": "string", + "const": "deny-remove-active", + "markdownDescription": "Denies the remove_active command without any pre-configured scope." + }, + { + "description": "Enables the request_permission command without any pre-configured scope.", + "type": "string", + "const": "allow-request-permission", + "markdownDescription": "Enables the request_permission command without any pre-configured scope." + }, + { + "description": "Denies the request_permission command without any pre-configured scope.", + "type": "string", + "const": "deny-request-permission", + "markdownDescription": "Denies the request_permission command without any pre-configured scope." + }, + { + "description": "Enables the show command without any pre-configured scope.", + "type": "string", + "const": "allow-show", + "markdownDescription": "Enables the show command without any pre-configured scope." + }, + { + "description": "Denies the show command without any pre-configured scope.", + "type": "string", + "const": "deny-show", + "markdownDescription": "Denies the show command without any pre-configured scope." + }, + { + "description": "This permission set configures which\nnotification features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all notification related features.\n\n\n#### This default permission set includes:\n\n- `allow-is-permission-granted`\n- `allow-request-permission`\n- `allow-notify`\n- `allow-register-action-types`\n- `allow-register-listener`\n- `allow-cancel`\n- `allow-get-pending`\n- `allow-remove-active`\n- `allow-get-active`\n- `allow-check-permissions`\n- `allow-show`\n- `allow-batch`\n- `allow-list-channels`\n- `allow-delete-channel`\n- `allow-create-channel`\n- `allow-permission-state`", + "type": "string", + "const": "default", + "markdownDescription": "This permission set configures which\nnotification features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all notification related features.\n\n\n#### This default permission set includes:\n\n- `allow-is-permission-granted`\n- `allow-request-permission`\n- `allow-notify`\n- `allow-register-action-types`\n- `allow-register-listener`\n- `allow-cancel`\n- `allow-get-pending`\n- `allow-remove-active`\n- `allow-get-active`\n- `allow-check-permissions`\n- `allow-show`\n- `allow-batch`\n- `allow-list-channels`\n- `allow-delete-channel`\n- `allow-create-channel`\n- `allow-permission-state`" } ] } diff --git a/plugins/notification/rollup.config.js b/plugins/notification/rollup.config.js index 0aed70d6..a7dbd4f6 100644 --- a/plugins/notification/rollup.config.js +++ b/plugins/notification/rollup.config.js @@ -2,21 +2,21 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { createConfig } from "../../shared/rollup.config.js"; -import { nodeResolve } from "@rollup/plugin-node-resolve"; -import typescript from "@rollup/plugin-typescript"; -import terser from "@rollup/plugin-terser"; +import { createConfig } from '../../shared/rollup.config.js' +import { nodeResolve } from '@rollup/plugin-node-resolve' +import typescript from '@rollup/plugin-typescript' +import terser from '@rollup/plugin-terser' export default createConfig({ additionalConfigs: { - input: "guest-js/init.ts", + input: 'guest-js/init.ts', output: { - file: "src/init-iife.js", - format: "iife", + file: 'src/init-iife.js', + format: 'iife' }, plugins: [typescript(), terser(), nodeResolve()], onwarn: (warning) => { - throw Object.assign(new Error(), warning); - }, - }, -}); + throw Object.assign(new Error(), warning) + } + } +}) diff --git a/plugins/notification/src/api-iife.js b/plugins/notification/src/api-iife.js deleted file mode 100644 index 3d8c020a..00000000 --- a/plugins/notification/src/api-iife.js +++ /dev/null @@ -1 +0,0 @@ -if("__TAURI__"in window){var __TAURI_PLUGIN_NOTIFICATION__=function(n){"use strict";function e(n,e,i,t){if("a"===i&&!t)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?n!==e||!t:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?t:"a"===i?t.call(n):t?t.value:e.get(n)}var i,t,o,r;"function"==typeof SuppressedError&&SuppressedError;class a{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,i.set(this,(()=>{})),this.id=function(n,e=!1){return window.__TAURI_INTERNALS__.transformCallback(n,e)}((n=>{e(this,i,"f").call(this,n)}))}set onmessage(n){!function(n,e,i,t,o){if("m"===t)throw new TypeError("Private method is not writable");if("a"===t&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?n!==e||!o:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===t?o.call(n,i):o?o.value=i:e.set(n,i)}(this,i,n,"f")}get onmessage(){return e(this,i,"f")}toJSON(){return`__CHANNEL__:${this.id}`}}i=new WeakMap;class c{constructor(n,e,i){this.plugin=n,this.event=e,this.channelId=i}async unregister(){return u(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}}async function s(n,e,i){const t=new a;return t.onmessage=i,u(`plugin:${n}|register_listener`,{event:e,handler:t}).then((()=>new c(n,e,t.id)))}async function u(n,e={},i){return window.__TAURI_INTERNALS__.invoke(n,e,i)}n.ScheduleEvery=void 0,(t=n.ScheduleEvery||(n.ScheduleEvery={})).Year="year",t.Month="month",t.TwoWeeks="twoWeeks",t.Week="week",t.Day="day",t.Hour="hour",t.Minute="minute",t.Second="second";return n.Importance=void 0,(o=n.Importance||(n.Importance={}))[o.None=0]="None",o[o.Min=1]="Min",o[o.Low=2]="Low",o[o.Default=3]="Default",o[o.High=4]="High",n.Visibility=void 0,(r=n.Visibility||(n.Visibility={}))[r.Secret=-1]="Secret",r[r.Private=0]="Private",r[r.Public=1]="Public",n.Schedule=class{static at(n,e=!1,i=!1){return{at:{date:n,repeating:e,allowWhileIdle:i},interval:void 0,every:void 0}}static interval(n,e=!1){return{at:void 0,interval:{interval:n,allowWhileIdle:e},every:void 0}}static every(n,e,i=!1){return{at:void 0,interval:void 0,every:{interval:n,count:e,allowWhileIdle:i}}}},n.active=async function(){return u("plugin:notification|get_active")},n.cancel=async function(n){return u("plugin:notification|cancel",{notifications:n})},n.cancelAll=async function(){return u("plugin:notification|cancel")},n.channels=async function(){return u("plugin:notification|listChannels")},n.createChannel=async function(n){return u("plugin:notification|create_channel",{...n})},n.isPermissionGranted=async function(){return"default"!==window.Notification.permission?Promise.resolve("granted"===window.Notification.permission):u("plugin:notification|is_permission_granted")},n.onAction=async function(n){return s("notification","actionPerformed",n)},n.onNotificationReceived=async function(n){return s("notification","notification",n)},n.pending=async function(){return u("plugin:notification|get_pending")},n.registerActionTypes=async function(n){return u("plugin:notification|register_action_types",{types:n})},n.removeActive=async function(n){return u("plugin:notification|remove_active",{notifications:n})},n.removeAllActive=async function(){return u("plugin:notification|remove_active")},n.removeChannel=async function(n){return u("plugin:notification|delete_channel",{id:n})},n.requestPermission=async function(){return window.Notification.requestPermission()},n.sendNotification=function(n){"string"==typeof n?new window.Notification(n):new window.Notification(n.title,n)},n}({});Object.defineProperty(window.__TAURI__,"notification",{value:__TAURI_PLUGIN_NOTIFICATION__})} diff --git a/plugins/notification/src/commands.rs b/plugins/notification/src/commands.rs index 4af85585..99b96c5b 100644 --- a/plugins/notification/src/commands.rs +++ b/plugins/notification/src/commands.rs @@ -2,9 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -use tauri::{command, AppHandle, Runtime, State}; +use tauri::{command, plugin::PermissionState, AppHandle, Runtime, State}; -use crate::{Notification, NotificationData, PermissionState, Result}; +use crate::{Notification, NotificationData, Result}; #[command] pub(crate) async fn is_permission_granted( @@ -15,7 +15,7 @@ pub(crate) async fn is_permission_granted( match state { PermissionState::Granted => Ok(Some(true)), PermissionState::Denied => Ok(Some(false)), - PermissionState::Unknown => Ok(None), + PermissionState::Prompt | PermissionState::PromptWithRationale => Ok(None), } } diff --git a/plugins/notification/src/desktop.rs b/plugins/notification/src/desktop.rs index be3c348e..47279225 100644 --- a/plugins/notification/src/desktop.rs +++ b/plugins/notification/src/desktop.rs @@ -3,9 +3,12 @@ // SPDX-License-Identifier: MIT use serde::de::DeserializeOwned; -use tauri::{plugin::PluginApi, AppHandle, Runtime}; +use tauri::{ + plugin::{PermissionState, PluginApi}, + AppHandle, Runtime, +}; -use crate::{models::*, NotificationBuilder}; +use crate::NotificationBuilder; pub fn init( app: &AppHandle, @@ -15,6 +18,8 @@ pub fn init( } /// Access to the notification APIs. +/// +/// You can get an instance of this type via [`NotificationExt`](crate::NotificationExt) pub struct Notification(AppHandle); impl crate::NotificationBuilder { @@ -156,11 +161,11 @@ mod imp { /// /// - **Windows**: Not supported on Windows 7. If your app targets it, enable the `windows7-compat` feature and use [`Self::notify`]. #[cfg_attr( - all(not(doc_cfg), feature = "windows7-compat"), + all(not(docsrs), feature = "windows7-compat"), deprecated = "This function does not work on Windows 7. Use `Self::notify` instead." )] pub fn show(self) -> crate::Result<()> { - let mut notification = crate::notify_rust::Notification::new(); + let mut notification = notify_rust::Notification::new(); if let Some(body) = self.body { notification.body(&body); } @@ -186,10 +191,10 @@ mod imp { } #[cfg(target_os = "macos")] { - let _ = crate::notify_rust::set_application(if cfg!(feature = "custom-protocol") { - &self.identifier - } else { + let _ = notify_rust::set_application(if tauri::is_dev() { "com.apple.Terminal" + } else { + &self.identifier }); } @@ -220,7 +225,7 @@ mod imp { /// .expect("error while running tauri application"); /// ``` #[cfg(feature = "windows7-compat")] - #[cfg_attr(doc_cfg, doc(cfg(feature = "windows7-compat")))] + #[cfg_attr(docsrs, doc(cfg(feature = "windows7-compat")))] #[allow(unused_variables)] pub fn notify(self, app: &tauri::AppHandle) -> crate::Result<()> { #[cfg(windows)] @@ -247,9 +252,8 @@ mod imp { #[cfg(all(windows, feature = "windows7-compat"))] fn notify_win7(self, app: &tauri::AppHandle) -> crate::Result<()> { - let app = app.clone(); - let default_window_icon = app.default_window_icon().cloned(); - let _ = app.run_on_main_thread(move || { + let app_ = app.clone(); + let _ = app.clone().run_on_main_thread(move || { let mut notification = win7_notifications::Notification::new(); if let Some(body) = self.body { notification.body(&body); @@ -257,13 +261,8 @@ mod imp { if let Some(title) = self.title { notification.summary(&title); } - if let Some(tauri::Icon::Rgba { - rgba, - width, - height, - }) = default_window_icon - { - notification.icon(rgba, width, height); + if let Some(icon) = app_.default_window_icon() { + notification.icon(icon.rgba().to_vec(), icon.width(), icon.height()); } let _ = notification.show(); }); diff --git a/plugins/notification/src/init-iife.js b/plugins/notification/src/init-iife.js index b7e206b0..30bff97d 100644 --- a/plugins/notification/src/init-iife.js +++ b/plugins/notification/src/init-iife.js @@ -1 +1 @@ -!function(){"use strict";async function i(i,n={},t){return window.__TAURI_INTERNALS__.invoke(i,n,t)}"function"==typeof SuppressedError&&SuppressedError,function(){let n=!1,t="default";function o(i){n=!0,window.Notification.permission=i,n=!1}window.Notification=function(n,t){const o=t||{};!function(n){"object"==typeof n&&Object.freeze(n),i("plugin:notification|notify",{options:"string"==typeof n?{title:n}:n})}(Object.assign(o,{title:n}))},window.Notification.requestPermission=function(){return i("plugin:notification|request_permission").then((i=>(o("prompt"===i?"default":i),i)))},Object.defineProperty(window.Notification,"permission",{enumerable:!0,get:()=>t,set:i=>{if(!n)throw new Error("Readonly property");t=i}}),("default"!==window.Notification.permission?Promise.resolve("granted"===window.Notification.permission):i("plugin:notification|is_permission_granted")).then((function(i){o(null===i?"default":i?"granted":"denied")}))}()}(); +!function(){"use strict";async function i(i,n={},t){return window.__TAURI_INTERNALS__.invoke(i,n,t)}"function"==typeof SuppressedError&&SuppressedError,function(){let n=!1,t="default";function o(i){n=!0,window.Notification.permission=i,n=!1}window.Notification=function(n,t){const o=t||{};!async function(n){"object"==typeof n&&Object.freeze(n),await i("plugin:notification|notify",{options:"string"==typeof n?{title:n}:n})}(Object.assign(o,{title:n}))},window.Notification.requestPermission=async function(){return await i("plugin:notification|request_permission").then((i=>(o("prompt"===i||"prompt-with-rationale"===i?"default":i),i)))},Object.defineProperty(window.Notification,"permission",{enumerable:!0,get:()=>t,set:i=>{if(!n)throw new Error("Readonly property");t=i}}),async function(){return"default"!==window.Notification.permission||__TEMPLATE_windows__?await Promise.resolve("granted"===window.Notification.permission):await i("plugin:notification|is_permission_granted")}().then((function(i){o(null===i?"default":i?"granted":"denied")}))}()}(); diff --git a/plugins/notification/src/lib.rs b/plugins/notification/src/lib.rs index 408a0f79..9ca33d63 100644 --- a/plugins/notification/src/lib.rs +++ b/plugins/notification/src/lib.rs @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -//! [![](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/notification/banner.png)](https://github.com/tauri-apps/plugins-workspace/tree/v2/plugins/notification) -//! //! Send message notifications (brief auto-expiring OS window element) to your user. Can also be used with the Notification Web API. #![doc( @@ -22,6 +20,7 @@ use tauri::{ }; pub use models::*; +pub use tauri::plugin::PermissionState; #[cfg(desktop)] mod desktop; @@ -32,15 +31,12 @@ mod commands; mod error; mod models; -#[allow(dead_code, unused_imports, deprecated, clippy::derivable_impls)] -mod notify_rust; - pub use error::{Error, Result}; #[cfg(desktop)] -use desktop::Notification; +pub use desktop::Notification; #[cfg(mobile)] -use mobile::Notification; +pub use mobile::Notification; /// The notification builder. #[derive(Debug)] @@ -124,7 +120,7 @@ impl NotificationBuilder { /// Identifier used to group multiple notifications. /// - /// https://developer.apple.com/documentation/usernotifications/unmutablenotificationcontent/1649872-threadidentifier + /// pub fn group(mut self, group: impl Into) -> Self { self.data.group.replace(group.into()); self @@ -211,7 +207,7 @@ impl NotificationBuilder { } } -/// Extensions to [`tauri::App`], [`tauri::AppHandle`] and [`tauri::Window`] to access the notification APIs. +/// Extensions to [`tauri::App`], [`tauri::AppHandle`], [`tauri::WebviewWindow`], [`tauri::Webview`] and [`tauri::Window`] to access the notification APIs. pub trait NotificationExt { fn notification(&self) -> &Notification; } @@ -224,15 +220,16 @@ impl> crate::NotificationExt for T { /// Initializes the plugin. pub fn init() -> TauriPlugin { - let mut init_script = include_str!("init-iife.js").to_string(); - init_script.push_str(include_str!("api-iife.js")); Builder::new("notification") .invoke_handler(tauri::generate_handler![ commands::notify, commands::request_permission, commands::is_permission_granted ]) - .js_init_script(init_script) + .js_init_script(include_str!("init-iife.js").replace( + "__TEMPLATE_windows__", + if cfg!(windows) { "true" } else { "false" }, + )) .setup(|app, api| { #[cfg(mobile)] let notification = mobile::init(app, api)?; diff --git a/plugins/notification/src/mobile.rs b/plugins/notification/src/mobile.rs index b786ed5c..edfef728 100644 --- a/plugins/notification/src/mobile.rs +++ b/plugins/notification/src/mobile.rs @@ -4,7 +4,7 @@ use serde::{de::DeserializeOwned, Deserialize}; use tauri::{ - plugin::{PluginApi, PluginHandle}, + plugin::{PermissionState, PluginApi, PluginHandle}, AppHandle, Runtime, }; @@ -40,6 +40,8 @@ impl crate::NotificationBuilder { } /// Access to the notification APIs. +/// +/// You can get an instance of this type via [`NotificationExt`](crate::NotificationExt) pub struct Notification(PluginHandle); impl Notification { diff --git a/plugins/notification/src/models.rs b/plugins/notification/src/models.rs index aa290dd3..02134e4d 100644 --- a/plugins/notification/src/models.rs +++ b/plugins/notification/src/models.rs @@ -209,51 +209,6 @@ impl Default for NotificationData { } } -/// Permission state. -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum PermissionState { - /// Permission access has been granted. - Granted, - /// Permission access has been denied. - Denied, - /// Unknown state. Must request permission. - Unknown, -} - -impl Display for PermissionState { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Self::Granted => write!(f, "granted"), - Self::Denied => write!(f, "denied"), - Self::Unknown => write!(f, "Unknown"), - } - } -} - -impl Serialize for PermissionState { - fn serialize(&self, serializer: S) -> std::result::Result - where - S: Serializer, - { - serializer.serialize_str(self.to_string().as_ref()) - } -} - -impl<'de> Deserialize<'de> for PermissionState { - fn deserialize(deserializer: D) -> std::result::Result - where - D: Deserializer<'de>, - { - let s = String::deserialize(deserializer)?; - match s.to_lowercase().as_str() { - "granted" => Ok(Self::Granted), - "denied" => Ok(Self::Denied), - "prompt" => Ok(Self::Unknown), - _ => Err(DeError::custom(format!("unknown permission state '{s}'"))), - } - } -} - #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] pub struct PendingNotification { @@ -352,6 +307,7 @@ impl ActiveNotification { } } +#[cfg(mobile)] #[derive(Debug, Serialize)] #[serde(rename_all = "camelCase")] pub struct ActionType { @@ -364,6 +320,7 @@ pub struct ActionType { hidden_previews_show_subtitle: bool, } +#[cfg(mobile)] #[derive(Debug, Serialize)] #[serde(rename_all = "camelCase")] pub struct Action { diff --git a/plugins/notification/src/notify_rust/error.rs b/plugins/notification/src/notify_rust/error.rs deleted file mode 100644 index 923bf713..00000000 --- a/plugins/notification/src/notify_rust/error.rs +++ /dev/null @@ -1,161 +0,0 @@ -#![allow(missing_docs)] - -#[cfg(all(feature = "images", unix, not(target_os = "macos")))] -use super::image::ImageError; -use std::{fmt, num}; -/// Convenient wrapper around `std::Result`. -pub type Result = ::std::result::Result; - -#[cfg(target_os = "macos")] -pub use super::macos::{ApplicationError, MacOsError, NotificationError}; - -/// The Error type. -#[derive(Debug)] -pub struct Error { - kind: ErrorKind, -} - -/// The kind of an error. -#[derive(Debug)] -#[non_exhaustive] -pub enum ErrorKind { - /// only here for backwards compatibility - Msg(String), - - #[cfg(all(feature = "dbus", unix, not(target_os = "macos")))] - Dbus(dbus::Error), - - #[cfg(all(feature = "zbus", unix, not(target_os = "macos")))] - Zbus(zbus::Error), - - #[cfg(target_os = "macos")] - MacNotificationSys(mac_notification_sys::error::Error), - - Parse(num::ParseIntError), - - SpecVersion(String), - - Conversion(String), - - #[cfg(all(feature = "images", unix, not(target_os = "macos")))] - Image(ImageError), - - ImplementationMissing, -} - -impl fmt::Display for Error { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self.kind { - #[cfg(all(feature = "dbus", unix, not(target_os = "macos")))] - ErrorKind::Dbus(ref e) => write!(f, "{}", e), - - #[cfg(all(feature = "zbus", unix, not(target_os = "macos")))] - ErrorKind::Zbus(ref e) => write!(f, "{}", e), - - #[cfg(target_os = "macos")] - ErrorKind::MacNotificationSys(ref e) => write!(f, "{}", e), - - ErrorKind::Parse(ref e) => write!(f, "Parsing Error: {}", e), - ErrorKind::Conversion(ref e) => write!(f, "Conversion Error: {}", e), - ErrorKind::SpecVersion(ref e) | ErrorKind::Msg(ref e) => write!(f, "{}", e), - #[cfg(all(feature = "images", unix, not(target_os = "macos")))] - ErrorKind::Image(ref e) => write!(f, "{}", e), - ErrorKind::ImplementationMissing => write!( - f, - r#"No Dbus implementation available, please compile with either feature ="z" or feature="d""# - ), - } - } -} - -impl std::error::Error for Error {} - -impl From<&str> for Error { - fn from(e: &str) -> Error { - Error { - kind: ErrorKind::Msg(e.into()), - } - } -} - -#[cfg(all(feature = "dbus", unix, not(target_os = "macos")))] -impl From for Error { - fn from(e: dbus::Error) -> Error { - Error { - kind: ErrorKind::Dbus(e), - } - } -} - -#[cfg(all(feature = "zbus", unix, not(target_os = "macos")))] -impl From for Error { - fn from(e: zbus::Error) -> Error { - Error { - kind: ErrorKind::Zbus(e), - } - } -} - -#[cfg(target_os = "macos")] -impl From for Error { - fn from(e: mac_notification_sys::error::Error) -> Error { - Error { - kind: ErrorKind::MacNotificationSys(e), - } - } -} - -#[cfg(all(feature = "images", unix, not(target_os = "macos")))] -impl From for Error { - fn from(e: ImageError) -> Error { - Error { - kind: ErrorKind::Image(e), - } - } -} - -impl From for Error { - fn from(e: num::ParseIntError) -> Error { - Error { - kind: ErrorKind::Parse(e), - } - } -} - -impl From for Error { - fn from(kind: ErrorKind) -> Error { - Error { kind } - } -} - -/// Just the usual bail macro -#[macro_export] -#[doc(hidden)] -macro_rules! bail { - ($e:expr) => { - return Err($e.into()); - }; - ($fmt:expr, $($arg:tt)+) => { - return Err(format!($fmt, $($arg)+).into()); - }; -} - -/// Exits a function early with an `Error` if the condition is not satisfied. -/// -/// Similar to `assert!`, `ensure!` takes a condition and exits the function -/// if the condition fails. Unlike `assert!`, `ensure!` returns an `Error`, -/// it does not panic. -#[macro_export(local_inner_macros)] -#[doc(hidden)] -macro_rules! ensure { - ($cond:expr, $e:expr) => { - if !($cond) { - bail!($e); - } - }; - ($cond:expr, $fmt:expr, $($arg:tt)*) => { - if !($cond) { - bail!($fmt, $($arg)*); - } - }; -} diff --git a/plugins/notification/src/notify_rust/hints.rs b/plugins/notification/src/notify_rust/hints.rs deleted file mode 100644 index 9513abeb..00000000 --- a/plugins/notification/src/notify_rust/hints.rs +++ /dev/null @@ -1,245 +0,0 @@ -#![cfg_attr(rustfmt, rustfmt_skip)] - -#[cfg(all(feature = "zbus", unix, not(target_os = "macos")))] -use zbus::zvariant; - -#[cfg(all(unix, not(target_os = "macos")))] -pub(crate) mod message; - -#[cfg(all(feature = "images", any(feature = "dbus", feature = "zbus"), unix, not(target_os = "macos")))] -use super::image::Image; - -#[cfg(all(feature = "images", feature = "zbus", unix, not(target_os = "macos")))] -use super::image::image_spec_str; -use super::Urgency; - -#[cfg(all(feature = "zbus", unix, not(target_os = "macos")))] use super::notification::Notification; -#[cfg(all(feature = "zbus", unix, not(target_os = "macos")))] use std::collections::HashMap; - -mod constants; - -#[cfg(all(unix, not(target_os = "macos")))] -#[derive(Eq, PartialEq, Hash, Clone, Debug)] -pub(crate) enum CustomHintType { - Int, - String, -} - -/// `Hints` allow you to pass extra information to the server. -/// -/// Many of these are standardized by either: -/// -/// * -/// * -/// -/// Which of these are actually implemented depends strongly on the Notification server you talk to. -/// Usually the [`get_capabilities()`](`crate::get_capabilities`) gives some clues, but the standards usually mention much more -/// than is actually available. -/// -/// you pass these to [`Notification::hint`] -#[derive(Eq, PartialEq, Hash, Clone, Debug)] -pub enum Hint { - /// If true, server may interpret action identifiers as named icons and display those. - ActionIcons(bool), - - /// Check out: - /// - /// * - /// * - Category(String), - - /// Name of the DesktopEntry representing the calling application. In case of "firefox.desktop" - /// use "firefox". May be used to retrieve the correct icon. - DesktopEntry(String), - - /// Image as raw data - #[cfg(all(feature = "images", unix, not(target_os = "macos")))] - ImageData(Image), - - /// Display the image at this path. - ImagePath(String), - - /// This does not work on all servers, however timeout=0 will do the job - Resident(bool), - - /// Play the sound at this path. - SoundFile(String), - - /// A themeable named sound from the freedesktop.org [sound naming specification](http://0pointer.de/public/sound-naming-spec.html) to play when the notification pops up. Similar to icon-name, only for sounds. An example would be "message-new-instant". - SoundName(String), - - /// Suppress the notification sound. - SuppressSound(bool), - - /// When set the server will treat the notification as transient and by-pass the server's persistence capability, if it should exist. - Transient(bool), - - /// Lets the notification point to a certain 'x' position on the screen. - /// Requires `Y`. - X(i32), - - /// Lets the notification point to a certain 'y' position on the screen. - /// Requires `X`. - Y(i32), - - /// Pass me a Urgency, either Low, Normal or Critical - Urgency(Urgency), - - /// If you want to pass something entirely different. - Custom(String, String), - - /// A custom numerical (integer) hint - CustomInt(String, i32), - - /// Only used by this NotificationServer implementation - Invalid // TODO find a better solution to this -} - -impl Hint { - /// Get the `bool` representation of this hint. - pub fn as_bool(&self) -> Option { - match *self { - | Hint::ActionIcons(inner) - | Hint::Resident(inner) - | Hint::SuppressSound(inner) - | Hint::Transient(inner) => Some(inner), - _ => None - } - } - - /// Get the `i32` representation of this hint. - pub fn as_i32(&self) -> Option { - match *self { - Hint::X(inner) | Hint::Y(inner) => Some(inner), - _ => None - } - } - - /// Get the `&str` representation of this hint. - pub fn as_str(&self) -> Option<&str> { - match *self { - Hint::DesktopEntry(ref inner) | - Hint::ImagePath(ref inner) | - Hint::SoundFile(ref inner) | - Hint::SoundName(ref inner) => Some(inner), - _ => None - } - } - - /// convenience converting a name and value into a hint - pub fn from_key_val(name: &str, value: &str) -> Result { - match (name,value){ - (constants::ACTION_ICONS,val) => val.parse::().map(Hint::ActionIcons).map_err(|e|e.to_string()), - (constants::CATEGORY, val) => Ok(Hint::Category(val.to_owned())), - (constants::DESKTOP_ENTRY, val) => Ok(Hint::DesktopEntry(val.to_owned())), - (constants::IMAGE_PATH, val) => Ok(Hint::ImagePath(val.to_owned())), - (constants::RESIDENT, val) => val.parse::().map(Hint::Resident).map_err(|e|e.to_string()), - (constants::SOUND_FILE, val) => Ok(Hint::SoundFile(val.to_owned())), - (constants::SOUND_NAME, val) => Ok(Hint::SoundName(val.to_owned())), - (constants::SUPPRESS_SOUND, val) => val.parse::().map(Hint::SuppressSound).map_err(|e|e.to_string()), - (constants::TRANSIENT, val) => val.parse::().map(Hint::Transient).map_err(|e|e.to_string()), - (constants::X, val) => val.parse::().map(Hint::X).map_err(|e|e.to_string()), - (constants::Y, val) => val.parse::().map(Hint::Y).map_err(|e|e.to_string()), - _ => Err(String::from("unknown name")) - } - } -} - -#[cfg(all(unix, not(target_os = "macos")))] -impl Hint {} - -#[cfg(all(feature = "zbus", unix, not(target_os = "macos")))] -#[test] -fn test_hints_to_map() { - - // custom value should only be there once if the names are identical - - let n1 = super::Notification::new() - .hint(Hint::Custom("foo".into(), "bar1".into())) - .hint(Hint::Custom("foo".into(), "bar2".into())) - .hint(Hint::Custom("f00".into(), "bar3".into())) - .finalize(); - - assert_eq!(hints_to_map(&n1), maplit::hashmap!{ - "foo" => zvariant::Value::Str("bar2".into()), - "f00" => zvariant::Value::Str("bar3".into()) - }); -} - -#[cfg(all(feature = "zbus", unix, not(target_os = "macos")))] -pub(crate) fn hints_to_map(notification: &Notification) -> HashMap::<&str, zvariant::Value<'_>> { - notification - .get_hints() - .map(Into::into) - .collect() -} - -#[cfg(all(feature = "zbus", unix, not(target_os = "macos")))] -impl<'a> From<&'a Hint> for (&'a str, zvariant::Value<'a>) { - fn from(val: &'a Hint) -> Self { - use self::constants::*; - match val { - Hint::ActionIcons(value) => (ACTION_ICONS , zvariant::Value::Bool(*value)), // bool - Hint::Category(value) => (CATEGORY , zvariant::Value::Str(value.as_str().into())), - Hint::DesktopEntry(value) => (DESKTOP_ENTRY , zvariant::Value::Str(value.as_str().into())), - - #[cfg(all(feature = "zbus", feature = "images", unix, not(target_os = "macos")))] - //Hint::ImageData(image) => (image_spec(*crate::SPEC_VERSION).as_str(), ImagePayload::from(*image).into()), - Hint::ImageData(image) => ( - image_spec_str(*crate::SPEC_VERSION), - zvariant::Value::Structure( - image.to_tuple().into() - ) - ), - - - Hint::ImagePath(value) => (IMAGE_PATH , zvariant::Value::Str(value.as_str().into())), - Hint::Resident(value) => (RESIDENT , zvariant::Value::Bool(*value)), // bool - Hint::SoundFile(value) => (SOUND_FILE , zvariant::Value::Str(value.as_str().into())), - Hint::SoundName(value) => (SOUND_NAME , zvariant::Value::Str(value.as_str().into())), - Hint::SuppressSound(value) => (SUPPRESS_SOUND , zvariant::Value::Bool(*value)), - Hint::Transient(value) => (TRANSIENT , zvariant::Value::Bool(*value)), - Hint::X(value) => (X , zvariant::Value::I32(*value)), - Hint::Y(value) => (Y , zvariant::Value::I32(*value)), - Hint::Urgency(value) => (URGENCY , zvariant::Value::U8(*value as u8)), - Hint::Custom(key, val) => (key.as_str() , zvariant::Value::Str(val.as_str().into())), - Hint::CustomInt(key, val) => (key.as_str() , zvariant::Value::I32(*val)), - Hint::Invalid => (INVALID , zvariant::Value::Str(INVALID.into())) - } - } -} - - -#[cfg(all(feature = "dbus", unix, not(target_os = "macos")))] -impl<'a, A: dbus::arg::RefArg> From<(&'a String, &'a A)> for Hint { - fn from(pair: (&String, &A)) -> Self { - - let (key, variant) = pair; - match (key.as_ref(), variant.as_u64(), variant.as_i64(), variant.as_str().map(String::from)) { - - (constants::ACTION_ICONS, Some(1), _, _ ) => Hint::ActionIcons(true), - (constants::ACTION_ICONS, _, _, _ ) => Hint::ActionIcons(false), - (constants::URGENCY, level, _, _ ) => Hint::Urgency(level.into()), - (constants::CATEGORY, _, _, Some(name) ) => Hint::Category(name), - - (constants::DESKTOP_ENTRY, _, _, Some(entry)) => Hint::DesktopEntry(entry), - (constants::IMAGE_PATH, _, _, Some(path) ) => Hint::ImagePath(path), - (constants::RESIDENT, Some(1), _, _ ) => Hint::Resident(true), - (constants::RESIDENT, _, _, _ ) => Hint::Resident(false), - - (constants::SOUND_FILE, _, _, Some(path) ) => Hint::SoundFile(path), - (constants::SOUND_NAME, _, _, Some(name) ) => Hint::SoundName(name), - (constants::SUPPRESS_SOUND, Some(1), _, _ ) => Hint::SuppressSound(true), - (constants::SUPPRESS_SOUND, _, _, _ ) => Hint::SuppressSound(false), - (constants::TRANSIENT, Some(1), _, _ ) => Hint::Transient(true), - (constants::TRANSIENT, _, _, _ ) => Hint::Transient(false), - (constants::X, _, Some(x), _ ) => Hint::X(x as i32), - (constants::Y, _, Some(y), _ ) => Hint::Y(y as i32), - - other => { - eprintln!("Invalid Hint {:#?} ", other); - Hint::Invalid - } - } - } -} diff --git a/plugins/notification/src/notify_rust/hints/constants.rs b/plugins/notification/src/notify_rust/hints/constants.rs deleted file mode 100644 index a7c666c1..00000000 --- a/plugins/notification/src/notify_rust/hints/constants.rs +++ /dev/null @@ -1,17 +0,0 @@ -#![allow(dead_code)] - -pub const ACTION_ICONS: &str = "action-icons"; -pub const CATEGORY: &str = "category"; -pub const DESKTOP_ENTRY: &str = "desktop-entry"; -pub const IMAGE_PATH: &str = "image-path"; -pub const RESIDENT: &str = "resident"; -pub const SOUND_FILE: &str = "sound-file"; -pub const SOUND_NAME: &str = "sound-name"; -pub const SUPPRESS_SOUND: &str = "suppress-sound"; -pub const TRANSIENT: &str = "transient"; -pub const X: &str = "x"; -pub const Y: &str = "y"; -pub const URGENCY: &str = "urgency"; - - -pub const INVALID: &str = "invalid"; \ No newline at end of file diff --git a/plugins/notification/src/notify_rust/hints/message.rs b/plugins/notification/src/notify_rust/hints/message.rs deleted file mode 100644 index 4e8d0e70..00000000 --- a/plugins/notification/src/notify_rust/hints/message.rs +++ /dev/null @@ -1,159 +0,0 @@ -//! `Hints` allow you to pass extra information to the server. -//! -//! Many of these are standardized by either: -//! -//! [galago-project spec](http://www.galago-project.org/specs/notification/0.9/x344.html) or -//! [gnome notification-spec](https://developer.gnome.org/notification-spec/#hints) -//! -//! Which of these are actually implemented depends strongly on the Notification server you talk to. -//! Usually the `get_capabilities()` gives some clues, but the standards usually mention much more -//! than is actually available. -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(dead_code, unused_imports)] - - -use super::{Hint, constants::*}; -use super::Urgency; - -#[cfg(all(feature = "images", unix, not(target_os = "macos")))] -use super::image::*; - -use std::collections::{HashMap, HashSet}; -#[cfg(feature = "dbus")] -use dbus::arg::{messageitem::MessageItem, RefArg}; - -/// All currently implemented `Hints` that can be sent. -/// -/// as found on -#[derive(Eq, PartialEq, Hash, Clone, Debug)] -pub(crate) struct HintMessage(Hint); - -#[cfg(feature = "dbus")] -impl HintMessage { - pub fn wrap_hint(hint: Hint) -> (MessageItem, MessageItem) { - Self::from(hint).into() - } -} - -impl From for HintMessage { - fn from(hint: Hint) -> Self { - HintMessage(hint) - } -} - -impl std::ops::Deref for HintMessage { - type Target = Hint; - - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -#[cfg(feature = "dbus")] -impl<'a, A: RefArg> From<(&'a String, &'a A)> for HintMessage { - fn from(pair: (&String, &A)) -> Self { - - let (key, variant) = pair; - match (key.as_ref(), variant.as_u64(), variant.as_i64(), variant.as_str().map(String::from)) { - - (ACTION_ICONS, Some(1), _, _ ) => Hint::ActionIcons(true), - (ACTION_ICONS, _, _, _ ) => Hint::ActionIcons(false), - (URGENCY, level, _, _ ) => Hint::Urgency(level.into()), - (CATEGORY, _, _, Some(name) ) => Hint::Category(name), - - (DESKTOP_ENTRY, _, _, Some(entry)) => Hint::DesktopEntry(entry), - (IMAGE_PATH, _, _, Some(path) ) => Hint::ImagePath(path), - (RESIDENT, Some(1), _, _ ) => Hint::Resident(true), - (RESIDENT, _, _, _ ) => Hint::Resident(false), - - (SOUND_FILE, _, _, Some(path) ) => Hint::SoundFile(path), - (SOUND_NAME, _, _, Some(name) ) => Hint::SoundName(name), - (SUPPRESS_SOUND, Some(1), _, _ ) => Hint::SuppressSound(true), - (SUPPRESS_SOUND, _, _, _ ) => Hint::SuppressSound(false), - (TRANSIENT, Some(1), _, _ ) => Hint::Transient(true), - (TRANSIENT, _, _, _ ) => Hint::Transient(false), - (X, _, Some(x), _ ) => Hint::X(x as i32), - (Y, _, Some(y), _ ) => Hint::Y(y as i32), - - other => { - eprintln!("Invalid Hint{:#?} ", other); - Hint::Invalid - } - }.into() - } -} - -#[cfg(feature = "dbus")] -impl From for (MessageItem, MessageItem) { - fn from(hint: HintMessage) -> Self { - - let (key, value): (String, MessageItem) = match hint.0 { - Hint::ActionIcons(value) => (ACTION_ICONS .to_owned(), MessageItem::Bool(value)), // bool - Hint::Category(ref value) => (CATEGORY .to_owned(), MessageItem::Str(value.clone())), - Hint::DesktopEntry(ref value) => (DESKTOP_ENTRY .to_owned(), MessageItem::Str(value.clone())), - #[cfg(all(feature = "images", unix, not(target_os ="macos")))] - Hint::ImageData(image) => (image_spec(*crate::SPEC_VERSION), ImageMessage::from(image).into()), - Hint::ImagePath(ref value) => (IMAGE_PATH .to_owned(), MessageItem::Str(value.clone())), - Hint::Resident(value) => (RESIDENT .to_owned(), MessageItem::Bool(value)), // bool - Hint::SoundFile(ref value) => (SOUND_FILE .to_owned(), MessageItem::Str(value.clone())), - Hint::SoundName(ref value) => (SOUND_NAME .to_owned(), MessageItem::Str(value.clone())), - Hint::SuppressSound(value) => (SUPPRESS_SOUND .to_owned(), MessageItem::Bool(value)), - Hint::Transient(value) => (TRANSIENT .to_owned(), MessageItem::Bool(value)), - Hint::X(value) => (X .to_owned(), MessageItem::Int32(value)), - Hint::Y(value) => (Y .to_owned(), MessageItem::Int32(value)), - Hint::Urgency(value) => (URGENCY .to_owned(), MessageItem::Byte(value as u8)), - Hint::Custom(ref key, ref val) => (key .to_owned(), MessageItem::Str(val.to_owned ())), - Hint::CustomInt(ref key, val) => (key .to_owned(), MessageItem::Int32(val)), - Hint::Invalid => ("invalid" .to_owned(), MessageItem::Str("Invalid".to_owned())) - }; - - (MessageItem::Str(key), MessageItem::Variant(Box::new(value))) - } -} - - -// TODO: deprecated, Prefer the DBus Arg and RefArg APIs -#[cfg(feature = "dbus")] -impl From<(&MessageItem, &MessageItem)> for HintMessage { - fn from ((key, mut value): (&MessageItem, &MessageItem)) -> Self { - use Hint as Hint; - - // If this is a variant, consider the thing inside it - // If it's a nested variant, keep drilling down until we get a real value - while let MessageItem::Variant(inner) = value { - value = inner; - } - - let is_stringy = value.inner::<&str>().is_ok(); - - match key.inner::<&str>() { - Ok(CATEGORY) => value.inner::<&str>().map(String::from).map(Hint::Category), - Ok(ACTION_ICONS) => value.inner().map(Hint::ActionIcons), - Ok(DESKTOP_ENTRY) => value.inner::<&str>().map(String::from).map(Hint::DesktopEntry), - Ok(IMAGE_PATH) => value.inner::<&str>().map(String::from).map(Hint::ImagePath), - Ok(RESIDENT) => value.inner().map(Hint::Resident), - Ok(SOUND_FILE) => value.inner::<&str>().map(String::from).map(Hint::SoundFile), - Ok(SOUND_NAME) => value.inner::<&str>().map(String::from).map(Hint::SoundName), - Ok(SUPPRESS_SOUND) => value.inner().map(Hint::SuppressSound), - Ok(TRANSIENT) => value.inner().map(Hint::Transient), - Ok(X) => value.inner().map(Hint::X), - Ok(Y) => value.inner().map(Hint::Y), - Ok(URGENCY) => value.inner().map(|i| match i { - 0 => Urgency::Low, - 2 => Urgency::Critical, - _ => Urgency::Normal - }).map(Hint::Urgency), - Ok(k) if is_stringy => value.inner::<&str>().map(|v| Hint::Custom(k.to_string(), v.to_string())), - Ok(k) => value.inner().map(|v| Hint::CustomInt(k.to_string(), v)), - _ => Err(()), - }.unwrap_or(Hint::Invalid) - .into() - } -} - - -#[allow(missing_docs)] -#[cfg(feature = "dbus")] -pub(crate) fn hints_from_variants(hints: &HashMap) -> HashSet { - hints.iter().map(Into::into).collect() -} diff --git a/plugins/notification/src/notify_rust/hints/tests.rs b/plugins/notification/src/notify_rust/hints/tests.rs deleted file mode 100644 index 23759c4a..00000000 --- a/plugins/notification/src/notify_rust/hints/tests.rs +++ /dev/null @@ -1,85 +0,0 @@ -#![cfg(all(test, unix, not(target_os = "macos")))] - -use dbus::arg::messageitem::MessageItem as Item; -use ctor::ctor; - -use super::*; -use self::Hint as Hint; -use super::Urgency::*; - - -#[ctor] -fn init_color_backtrace() { - color_backtrace::install(); -} - -#[test] -fn hint_to_item() { - let category = &Hint::Category("test-me".to_owned()); - let (k, v) = category.into(); - - let test_k = Item::Str("category".into()); - let test_v = Item::Variant(Box::new(Item::Str("test-me".into()))); - - assert_eq!(k, test_k); - assert_eq!(v, test_v); -} - -#[test] -fn urgency() { - let low = &Hint::Urgency(Low); - let (k, v) = low.into(); - - let test_k = Item::Str("urgency".into()); - let test_v = Item::Variant(Box::new(Item::Byte(0))); - - assert_eq!(k, test_k); - assert_eq!(v, test_v); -} - -#[test] -fn simple_hint_to_item() { - let old_hint = &Hint::Custom("foo".into(), "bar".into()); - - let (k, v) = old_hint.into(); - let hint: Hint = (&k, &v).into(); - - assert_eq!(old_hint, &hint); -} - -#[test] -#[cfg(all(feature = "images", unix, not(target_os = "macos")))] -fn imagedata_hint_to_item() { - let hint = &Hint::ImageData(Image::from_rgb(1, 1, vec![0, 0, 0]).unwrap()); - let item: MessageItem = hint.into(); - let test_item = Item::DictEntry( - Box::new(Item::Str(image_spec(*::SPEC_VERSION))), - Box::new(Item::Variant(Box::new(Item::Struct(vec![ - Item::Int32(1), - Item::Int32(1), - Item::Int32(3), - Item::Bool(false), - Item::Int32(8), - Item::Int32(3), - Item::Array(dbus::MessageItemArray::new(vec![ - Item::Byte(0), - Item::Byte(0), - Item::Byte(0), - ],"ay".into()).unwrap()) - ])))) - ); - assert_eq!(item, test_item); -} - -#[test] -#[cfg(all(feature = "images", unix, not(target_os = "macos")))] -fn imagedata_hint_to_item_with_spec() { - let key = image_spec(Version::new(1, 0)); - assert_eq!(key, String::from("icon_data")); - - let key = image_spec(Version::new(1, 1)); - assert_eq!(key, String::from("image_data")); - - let key = image_spec(Version::new(1, 2)); - assert_eq!(key, String::from("image-data")); -} diff --git a/plugins/notification/src/notify_rust/image.rs b/plugins/notification/src/notify_rust/image.rs deleted file mode 100644 index 27e33038..00000000 --- a/plugins/notification/src/notify_rust/image.rs +++ /dev/null @@ -1,229 +0,0 @@ -#[cfg(feature = "dbus")] -use dbus::arg::messageitem::{MessageItem, MessageItemArray}; -pub use image::DynamicImage; - -use std::cmp::Ordering; -use std::convert::TryFrom; -use std::error::Error; -use std::fmt; -use std::path::Path; - -use super::miniver::Version; - -mod constants { - pub const IMAGE_DATA: &str = "image-data"; - pub const IMAGE_DATA_1_1: &str = "image_data"; - pub const IMAGE_DATA_1_0: &str = "icon_data"; -} - -/// Image representation for images. Send via `Notification::image_data()` -#[derive(PartialEq, Eq, Debug, Clone, Hash)] -pub struct Image { - width: i32, - height: i32, - rowstride: i32, - alpha: bool, - bits_per_sample: i32, - channels: i32, - data: Vec, -} - -impl Image { - fn from_raw_data( - width: i32, - height: i32, - data: Vec, - channels: i32, - bits_per_sample: i32, - alpha: bool, - ) -> Result { - const MAX_SIZE: i32 = 0x0fff_ffff; - if width > MAX_SIZE || height > MAX_SIZE { - return Err(ImageError::TooBig); - } - - if data.len() != (width * height * channels) as usize { - Err(ImageError::WrongDataSize) - } else { - Ok(Self { - width, - height, - bits_per_sample, - channels, - data, - rowstride: width * channels, - alpha, - }) - } - } - - /// Creates an image from a raw vector of bytes - pub fn from_rgb(width: i32, height: i32, data: Vec) -> Result { - let channels = 3i32; - let bits_per_sample = 8; - Self::from_raw_data(width, height, data, channels, bits_per_sample, false) - } - - /// Creates an image from a raw vector of bytes with alpha - pub fn from_rgba(width: i32, height: i32, data: Vec) -> Result { - let channels = 4i32; - let bits_per_sample = 8; - Self::from_raw_data(width, height, data, channels, bits_per_sample, true) - } - - /// Attempts to open the given path as image - pub fn open + Sized>(path: T) -> Result { - let dyn_img = image::open(&path).map_err(ImageError::CantOpen)?; - Image::try_from(dyn_img) - } - - #[cfg(all(feature = "images", feature = "zbus"))] - pub(crate) fn to_tuple(&self) -> (i32, i32, i32, bool, i32, i32, Vec) { - ( - self.width, - self.height, - self.rowstride, - self.alpha, - self.bits_per_sample, - self.channels, - self.data.clone(), - ) - } -} - -impl TryFrom for Image { - type Error = ImageError; - - fn try_from(dyn_img: DynamicImage) -> Result { - match dyn_img { - DynamicImage::ImageRgb8(img) => Self::try_from(img), - DynamicImage::ImageRgba8(img) => Self::try_from(img), - _ => Err(ImageError::CantConvert), - } - } -} - -impl TryFrom for Image { - type Error = ImageError; - - fn try_from(img: image::RgbImage) -> Result { - let (width, height) = img.dimensions(); - let image_data = img.into_raw(); - Image::from_rgb(width as i32, height as i32, image_data) - } -} - -impl TryFrom for Image { - type Error = ImageError; - - fn try_from(img: image::RgbaImage) -> Result { - let (width, height) = img.dimensions(); - let image_data = img.into_raw(); - Image::from_rgba(width as i32, height as i32, image_data) - } -} - -/// Errors that can occur when creating an Image -#[derive(Debug)] -pub enum ImageError { - /// The given image is too big. DBus only has 32 bits for width / height - TooBig, - /// The given bytes don't match the width, height and channel count - WrongDataSize, - /// Can't open given path - CantOpen(image::ImageError), - /// Can't convert from given input - CantConvert, -} - -impl Error for ImageError { - fn source(&self) -> Option<&(dyn Error + 'static)> { - use ImageError::*; - match self { - TooBig | WrongDataSize | CantConvert => None, - CantOpen(e) => Some(e), - } - } -} - -impl fmt::Display for ImageError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - use ImageError::*; - match self { - TooBig => writeln!( - f, - "The given image is too big. DBus only has 32 bits for width / height" - ), - WrongDataSize => writeln!( - f, - "The given bytes don't match the width, height and channel count" - ), - CantOpen(e) => writeln!(f, "Can't open given path {}", e), - CantConvert => writeln!(f, "Can't convert from given input"), - } - } -} - -/// matching image data key for each spec version -#[cfg(feature = "dbus")] -pub(crate) fn image_spec(version: Version) -> String { - match version.cmp(&Version::new(1, 1)) { - Ordering::Less => constants::IMAGE_DATA_1_0.to_owned(), - Ordering::Equal => constants::IMAGE_DATA_1_1.to_owned(), - Ordering::Greater => constants::IMAGE_DATA.to_owned(), - } -} - -/// matching image data key for each spec version -#[cfg(feature = "zbus")] -pub(crate) fn image_spec_str(version: Version) -> &'static str { - match version.cmp(&Version::new(1, 1)) { - Ordering::Less => constants::IMAGE_DATA_1_0, - Ordering::Equal => constants::IMAGE_DATA_1_1, - Ordering::Greater => constants::IMAGE_DATA, - } -} - -#[cfg(feature = "dbus")] -pub struct ImageMessage(Image); - -#[cfg(feature = "dbus")] -impl From for ImageMessage { - fn from(hint: Image) -> Self { - ImageMessage(hint) - } -} - -impl From for ImageError { - fn from(image_error: image::ImageError) -> Self { - ImageError::CantOpen(image_error) - } -} - -#[cfg(feature = "dbus")] -impl std::ops::Deref for ImageMessage { - type Target = Image; - - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -#[cfg(feature = "dbus")] -impl From for MessageItem { - fn from(img_msg: ImageMessage) -> Self { - let img = img_msg.0; - - let bytes = img.data.into_iter().map(MessageItem::Byte).collect(); - - MessageItem::Struct(vec![ - MessageItem::Int32(img.width), - MessageItem::Int32(img.height), - MessageItem::Int32(img.rowstride), - MessageItem::Bool(img.alpha), - MessageItem::Int32(img.bits_per_sample), - MessageItem::Int32(img.channels), - MessageItem::Array(MessageItemArray::new(bytes, "ay".into()).unwrap()), - ]) - } -} diff --git a/plugins/notification/src/notify_rust/macos.rs b/plugins/notification/src/notify_rust/macos.rs deleted file mode 100644 index c886c0a7..00000000 --- a/plugins/notification/src/notify_rust/macos.rs +++ /dev/null @@ -1,61 +0,0 @@ -use super::{error::*, notification::Notification}; - -pub use mac_notification_sys::error::{ApplicationError, Error as MacOsError, NotificationError}; - -use std::ops::{Deref, DerefMut}; - -/// A handle to a shown notification. -/// -/// This keeps a connection alive to ensure actions work on certain desktops. -#[derive(Debug)] -pub struct NotificationHandle { - notification: Notification, -} - -impl NotificationHandle { - #[allow(missing_docs)] - pub fn new(notification: Notification) -> NotificationHandle { - NotificationHandle { notification } - } -} - -impl Deref for NotificationHandle { - type Target = Notification; - - fn deref(&self) -> &Notification { - &self.notification - } -} - -/// Allow to easily modify notification properties -impl DerefMut for NotificationHandle { - fn deref_mut(&mut self) -> &mut Notification { - &mut self.notification - } -} - -pub(crate) fn show_notification(notification: &Notification) -> Result { - mac_notification_sys::Notification::default() - .title(notification.summary.as_str()) - .message(¬ification.body) - .maybe_subtitle(notification.subtitle.as_deref()) - .maybe_sound(notification.sound_name.as_deref()) - .send()?; - - Ok(NotificationHandle::new(notification.clone())) -} - -pub(crate) fn schedule_notification( - notification: &Notification, - delivery_date: f64, -) -> Result { - mac_notification_sys::Notification::default() - .title(notification.summary.as_str()) - .message(¬ification.body) - .maybe_subtitle(notification.subtitle.as_deref()) - .maybe_sound(notification.sound_name.as_deref()) - .delivery_date(delivery_date) - .send()?; - - Ok(NotificationHandle::new(notification.clone())) -} diff --git a/plugins/notification/src/notify_rust/miniver.rs b/plugins/notification/src/notify_rust/miniver.rs deleted file mode 100644 index 5c8deb83..00000000 --- a/plugins/notification/src/notify_rust/miniver.rs +++ /dev/null @@ -1,75 +0,0 @@ -use super::error::*; -use std::str::FromStr; - -#[derive(Copy, Clone, Eq, Debug)] -pub struct Version { - pub major: u64, - pub minor: u64, -} - -impl Version { - #[allow(dead_code)] - pub fn new(major: u64, minor: u64) -> Self { - Self { major, minor } - } -} - -impl FromStr for Version { - type Err = Error; - fn from_str(s: &str) -> Result { - let vv = s.split('.').collect::>(); - match (vv.first(), vv.get(1)) { - (Some(maj), Some(min)) => Ok(Version { - major: maj.parse()?, - minor: min.parse()?, - }), - _ => Err(ErrorKind::SpecVersion(s.into()).into()), - } - } -} - -use std::cmp; - -impl PartialOrd for Version { - fn partial_cmp(&self, other: &Version) -> Option { - Some(self.cmp(other)) - } -} - -impl PartialEq for Version { - fn eq(&self, other: &Version) -> bool { - self.major == other.major && self.minor == other.minor - } -} - -impl Ord for Version { - fn cmp(&self, other: &Version) -> cmp::Ordering { - match self.major.cmp(&other.major) { - cmp::Ordering::Equal => {} - r => return r, - } - match self.minor.cmp(&other.minor) { - cmp::Ordering::Equal => {} - r => return r, - } - cmp::Ordering::Equal - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn version_parsing() { - assert_eq!("1.3".parse::().unwrap(), Version::new(1, 3)); - } - - #[test] - fn version_comparison() { - assert!(Version::new(1, 3) >= Version::new(1, 2)); - assert!(Version::new(1, 2) >= Version::new(1, 2)); - assert!(Version::new(1, 2) == Version::new(1, 2)); - assert!(Version::new(1, 1) <= Version::new(1, 2)); - } -} diff --git a/plugins/notification/src/notify_rust/mod.rs b/plugins/notification/src/notify_rust/mod.rs deleted file mode 100644 index 6177db84..00000000 --- a/plugins/notification/src/notify_rust/mod.rs +++ /dev/null @@ -1,173 +0,0 @@ -//! Desktop Notifications for Rust. -//! -//! Desktop notifications are popup messages generated to notify the user of certain events. -//! -//! ## Platform Support -//! -//! This library was originally conceived with the [XDG](https://en.wikipedia.org/wiki/XDG) notification specification in mind. -//! Since version 3.3 this crate also builds on macOS, however the semantics of the [XDG](https://en.wikipedia.org/wiki/XDG) specification and macOS `NSNotifications` -//! are quite different. -//! Therefore only a very small subset of functions is supported on macOS. -//! Certain methods don't have any effect there, others will explicitly fail to compile, -//! in these cases you will have to add platform specific toggles to your code. -//! For more see [platform differences](#platform-differences) -//! -//! # Platform Differences -//!
-//! ✔︎ = works
-//! ❌ = will not compile -//! -//! ## `Notification` -//! | method | XDG | macOS | windows | -//! |---------------------|-------|-------|---------| -//! | `fn appname(...)` | ✔︎ | | | -//! | `fn summary(...)` | ✔︎ | ✔︎ | ✔︎ | -//! | `fn subtitle(...)` | | ✔︎ | ✔︎ | -//! | `fn body(...)` | ✔︎ | ✔︎ | ✔︎ | -//! | `fn icon(...)` | ✔︎ | | | -//! | `fn auto_icon(...)`| ✔︎ | | | -//! | `fn hint(...)` | ✔︎ | ❌ | ❌ | -//! | `fn timeout(...)` | ✔︎ | | ✔︎ | -//! | `fn urgency(...)` | ✔︎ | ❌ | ❌ | -//! | `fn action(...)` | ✔︎ | | | -//! | `fn id(...)` | ✔︎ | | | -//! | `fn finalize(...)` | ✔︎ | ✔︎ | ✔︎ | -//! | `fn show(...)` | ✔︎ | ✔︎ | ✔︎ | -//! -//! ## `NotificationHandle` -//! -//! | method | XDG | macOS | windows | -//! |--------------------------|-----|-------|---------| -//! | `fn wait_for_action(...)`| ✔︎ | ❌ | ❌ | -//! | `fn close(...)` | ✔︎ | ❌ | ❌ | -//! | `fn on_close(...)` | ✔︎ | ❌ | ❌ | -//! | `fn update(...)` | ✔︎ | ❌ | ❌ | -//! | `fn id(...)` | ✔︎ | ❌ | ❌ | -//! -//! ## Functions -//! -//! | | XDG | macOS | windows | -//! |--------------------------------------------|-----|-------|---------| -//! | `fn get_capabilities(...)` | ✔︎ | ❌ | ❌ | -//! | `fn get_server_information(...)` | ✔︎ | ❌ | ❌ | -//! | `fn set_application(...)` | ❌ | ✔︎ | ❌ | -//! | `fn get_bundle_identifier_or_default(...)` | ❌ | ✔︎ | ❌ | -//! -//! -//! ### Toggles -//! -//! Please use `target_os` toggles if you plan on using methods labeled with ❌. -//! -//! ```ignore -//! #[cfg(target_os = "macos")] -//! // or -//! // #### #[cfg(all(unix, not(target_os = "macos")))] -//! ``` -//!
-//! - -#![deny( - missing_copy_implementations, - trivial_casts, - trivial_numeric_casts, - unsafe_code, - unused_import_braces, - unused_qualifications -)] -#![warn( - missing_docs, - clippy::doc_markdown, - clippy::semicolon_if_nothing_returned, - clippy::single_match_else, - clippy::inconsistent_struct_constructor, - clippy::map_unwrap_or, - clippy::match_same_arms -)] - -#[cfg(all(feature = "dbus", unix, not(target_os = "macos")))] -extern crate dbus; - -#[cfg(target_os = "macos")] -extern crate mac_notification_sys; - -#[cfg(target_os = "windows")] -extern crate winrt_notification; - -#[macro_use] -#[cfg(all(feature = "images", unix, not(target_os = "macos")))] -extern crate lazy_static; - -pub mod error; -mod hints; -mod miniver; -mod notification; -mod timeout; -pub(crate) mod urgency; - -#[cfg(target_os = "macos")] -mod macos; - -#[cfg(target_os = "windows")] -mod windows; - -#[cfg(all(unix, not(target_os = "macos")))] -mod xdg; - -#[cfg(all(feature = "images", unix, not(target_os = "macos")))] -mod image; - -#[cfg(all(feature = "server", feature = "dbus", unix, not(target_os = "macos")))] -pub mod server; - -#[cfg(target_os = "macos")] -pub use mac_notification_sys::{get_bundle_identifier_or_default, set_application}; - -#[cfg(target_os = "macos")] -pub use macos::NotificationHandle; - -#[cfg(all( - any(feature = "dbus", feature = "zbus"), - unix, - not(target_os = "macos") -))] -pub use xdg::{ - dbus_stack, get_capabilities, get_server_information, handle_action, ActionResponse, - CloseHandler, CloseReason, DbusStack, NotificationHandle, -}; - -#[cfg(all(feature = "server", unix, not(target_os = "macos")))] -pub use xdg::stop_server; - -pub use hints::Hint; - -#[cfg(all(feature = "images", unix, not(target_os = "macos")))] -pub use image::{Image, ImageError}; - -#[cfg_attr( - target_os = "macos", - deprecated(note = "Urgency is not supported on macOS") -)] -pub use urgency::Urgency; - -pub use {notification::Notification, timeout::Timeout}; - -#[cfg(all(feature = "images", unix, not(target_os = "macos")))] -lazy_static! { - /// Read once at runtime. Needed for Images - pub static ref SPEC_VERSION: miniver::Version = - get_server_information() - .and_then(|info| info.spec_version.parse::()) - .unwrap_or_else(|_| miniver::Version::new(1,1)); -} -/// Return value of `get_server_information()`. -#[derive(Debug)] -pub struct ServerInformation { - /// The product name of the server. - pub name: String, - /// The vendor name. - pub vendor: String, - /// The server's version string. - pub version: String, - /// The specification version the server is compliant with. - pub spec_version: String, -} diff --git a/plugins/notification/src/notify_rust/notification.rs b/plugins/notification/src/notify_rust/notification.rs deleted file mode 100644 index 256941af..00000000 --- a/plugins/notification/src/notify_rust/notification.rs +++ /dev/null @@ -1,480 +0,0 @@ -#[cfg(all(unix, not(target_os = "macos")))] -use super::{ - hints::{CustomHintType, Hint}, - urgency::Urgency, - xdg, -}; - -#[cfg(all(unix, not(target_os = "macos"), feature = "images"))] -use super::image::Image; - -#[cfg(all(unix, target_os = "macos"))] -use super::macos; -#[cfg(target_os = "windows")] -use super::windows; - -use super::{error::*, timeout::Timeout}; - -#[cfg(all(unix, not(target_os = "macos")))] -use std::collections::{HashMap, HashSet}; - -// Returns the name of the current executable, used as a default for `Notification.appname`. -fn exe_name() -> String { - std::env::current_exe() - .unwrap() - .file_name() - .unwrap() - .to_str() - .unwrap() - .to_owned() -} - -/// Desktop notification. -/// -/// A desktop notification is configured via builder pattern, before it is launched with `show()`. -#[derive(Debug, Clone)] -#[non_exhaustive] -pub struct Notification { - /// Filled by default with executable name. - pub appname: String, - - /// Single line to summarize the content. - pub summary: String, - - /// Subtitle for macOS - pub subtitle: Option, - - /// Multiple lines possible, may support simple markup, - /// check out `get_capabilities()` -> `body-markup` and `body-hyperlinks`. - pub body: String, - - /// Use a file:// URI or a name in an icon theme, must be compliant freedesktop.org. - pub icon: String, - - /// Check out `Hint` - /// - /// # warning - /// this does not hold all hints, [`Hint::Custom`] and [`Hint::CustomInt`] are held elsewhere, - // /// please access hints via [`Notification::get_hints`]. - #[cfg(all(unix, not(target_os = "macos")))] - pub hints: HashSet, - - #[cfg(all(unix, not(target_os = "macos")))] - pub(crate) hints_unique: HashMap<(String, CustomHintType), Hint>, - - /// See `Notification::actions()` and `Notification::action()` - pub actions: Vec, - - #[cfg(target_os = "macos")] - pub(crate) sound_name: Option, - - #[cfg(target_os = "windows")] - pub(crate) sound_name: Option, - - #[cfg(target_os = "windows")] - pub(crate) path_to_image: Option, - - #[cfg(target_os = "windows")] - pub(crate) app_id: Option, - - #[cfg(all(unix, not(target_os = "macos")))] - pub(crate) bus: xdg::NotificationBus, - - /// Lifetime of the Notification in ms. Often not respected by server, sorry. - pub timeout: Timeout, // both gnome and galago want allow for -1 - - /// Only to be used on the receive end. Use Notification hand for updating. - pub(crate) id: Option, -} - -impl Notification { - /// Constructs a new Notification. - /// - /// Most fields are empty by default, only `appname` is initialized with the name of the current - /// executable. - /// The appname is used by some desktop environments to group notifications. - pub fn new() -> Notification { - Notification::default() - } - - /// This is for testing purposes only and will not work with actual implementations. - #[cfg(all(unix, not(target_os = "macos")))] - #[doc(hidden)] - #[deprecated(note = "this is a test only feature")] - pub fn at_bus(sub_bus: &str) -> Notification { - let bus = xdg::NotificationBus::custom(sub_bus) - .ok_or("invalid subpath") - .unwrap(); - Notification { - bus, - ..Notification::default() - } - } - - /// Overwrite the appname field used for Notification. - /// - /// # Platform Support - /// Please note that this method has no effect on macOS. Here you can only set the application via [`set_application()`](fn.set_application.html) - pub fn appname(&mut self, appname: &str) -> &mut Notification { - self.appname = appname.to_owned(); - self - } - - /// Set the `summary`. - /// - /// Often acts as title of the notification. For more elaborate content use the `body` field. - pub fn summary(&mut self, summary: &str) -> &mut Notification { - self.summary = summary.to_owned(); - self - } - - /// Set the `subtitle`. - /// - /// This is only useful on macOS, it's not part of the XDG specification and will therefore be eaten by gremlins under your CPU 😈🤘. - pub fn subtitle(&mut self, subtitle: &str) -> &mut Notification { - self.subtitle = Some(subtitle.to_owned()); - self - } - - /// Manual wrapper for `Hint::ImageData` - #[cfg(all(feature = "images", unix, not(target_os = "macos")))] - pub fn image_data(&mut self, image: Image) -> &mut Notification { - self.hint(Hint::ImageData(image)); - self - } - - /// Wrapper for `Hint::ImagePath` - #[cfg(all(unix, not(target_os = "macos")))] - pub fn image_path(&mut self, path: &str) -> &mut Notification { - self.hint(Hint::ImagePath(path.to_string())); - self - } - - /// Wrapper for `NotificationHint::ImagePath` - #[cfg(target_os = "windows")] - pub fn image_path(&mut self, path: &str) -> &mut Notification { - self.path_to_image = Some(path.to_string()); - self - } - - /// app's System.AppUserModel.ID - #[cfg(target_os = "windows")] - pub fn app_id(&mut self, app_id: &str) -> &mut Notification { - self.app_id = Some(app_id.to_string()); - self - } - - /// Wrapper for `Hint::ImageData` - #[cfg(all(feature = "images", unix, not(target_os = "macos")))] - pub fn image + Sized>( - &mut self, - path: T, - ) -> Result<&mut Notification> { - let img = Image::open(&path)?; - self.hint(Hint::ImageData(img)); - Ok(self) - } - - /// Wrapper for `Hint::SoundName` - #[cfg(all(unix, not(target_os = "macos")))] - pub fn sound_name(&mut self, name: &str) -> &mut Notification { - self.hint(Hint::SoundName(name.to_owned())); - self - } - - /// Set the `sound_name` for the `NSUserNotification` - #[cfg(any(target_os = "macos", target_os = "windows"))] - pub fn sound_name(&mut self, name: &str) -> &mut Notification { - self.sound_name = Some(name.to_owned()); - self - } - - /// Set the content of the `body` field. - /// - /// Multiline textual content of the notification. - /// Each line should be treated as a paragraph. - /// Simple html markup should be supported, depending on the server implementation. - pub fn body(&mut self, body: &str) -> &mut Notification { - self.body = body.to_owned(); - self - } - - /// Set the `icon` field. - /// - /// You can use common icon names here, usually those in `/usr/share/icons` - /// can all be used. - /// You can also use an absolute path to file. - /// - /// # Platform support - /// macOS does not have support manually setting the icon. However you can pretend to be another app using [`set_application()`](fn.set_application.html) - pub fn icon(&mut self, icon: &str) -> &mut Notification { - self.icon = icon.to_owned(); - self - } - - /// Set the `icon` field automatically. - /// - /// This looks at your binary's name and uses it to set the icon. - /// - /// # Platform support - /// macOS does not support manually setting the icon. However you can pretend to be another app using [`set_application()`](fn.set_application.html) - pub fn auto_icon(&mut self) -> &mut Notification { - self.icon = exe_name(); - self - } - - /// Adds a hint. - /// - /// This method will add a hint to the internal hint [`HashSet`]. - /// Hints must be of type [`Hint`]. - /// - /// Many of these are again wrapped by more convenient functions such as: - /// - /// * `sound_name(...)` - /// * `urgency(...)` - /// * [`image(...)`](#method.image) or - /// * [`image_data(...)`](#method.image_data) - /// * [`image_path(...)`](#method.image_path) - /// - /// # Platform support - /// Most of these hints don't even have an effect on the big XDG Desktops, they are completely tossed on macOS. - #[cfg(all(unix, not(target_os = "macos")))] - pub fn hint(&mut self, hint: Hint) -> &mut Notification { - match hint { - Hint::CustomInt(k, v) => { - self.hints_unique - .insert((k.clone(), CustomHintType::Int), Hint::CustomInt(k, v)); - } - Hint::Custom(k, v) => { - self.hints_unique - .insert((k.clone(), CustomHintType::String), Hint::Custom(k, v)); - } - _ => { - self.hints.insert(hint); - } - } - self - } - - #[cfg(all(unix, not(target_os = "macos")))] - pub(crate) fn get_hints(&self) -> impl Iterator { - self.hints.iter().chain(self.hints_unique.values()) - } - - /// Set the `timeout`. - /// - /// Accepts multiple types that implement `Into`. - /// - /// ## `i31` - /// - /// This sets the time (in milliseconds) from the time the notification is displayed until it is - /// closed again by the Notification Server. - /// According to [specification](https://developer.gnome.org/notification-spec/) - /// -1 will leave the timeout to be set by the server and - /// 0 will cause the notification never to expire. - - /// ## [Duration](`std::time::Duration`) - /// - /// When passing a [`Duration`](`std::time::Duration`) we will try convert it into milliseconds. - /// - /// # Platform support - /// This only works on XDG Desktops, macOS does not support manually setting the timeout. - pub fn timeout>(&mut self, timeout: T) -> &mut Notification { - self.timeout = timeout.into(); - self - } - - /// Set the `urgency`. - /// - /// Pick between Medium, Low and High. - /// - /// # Platform support - /// Most Desktops on linux and bsd are far too relaxed to pay any attention to this. - /// In macOS this does not exist - #[cfg(all(unix, not(target_os = "macos")))] - pub fn urgency(&mut self, urgency: Urgency) -> &mut Notification { - self.hint(Hint::Urgency(urgency)); // TODO impl as T where T: Into - self - } - - /// Set `actions`. - /// - /// To quote - /// - /// > Actions are sent over as a list of pairs. - /// > Each even element in the list (starting at index 0) represents the identifier for the action. - /// > Each odd element in the list is the localized string that will be displayed to the user.y - /// - /// There is nothing fancy going on here yet. - /// **Careful! This replaces the internal list of actions!** - /// - /// (xdg only) - #[deprecated(note = "please use .action() only")] - pub fn actions(&mut self, actions: Vec) -> &mut Notification { - self.actions = actions; - self - } - - /// Add an action. - /// - /// This adds a single action to the internal list of actions. - /// - /// (xdg only) - pub fn action(&mut self, identifier: &str, label: &str) -> &mut Notification { - self.actions.push(identifier.to_owned()); - self.actions.push(label.to_owned()); - self - } - - /// Set an Id ahead of time - /// - /// Setting the id ahead of time allows overriding a known other notification. - /// Though if you want to update a notification, it is easier to use the `update()` method of - /// the `NotificationHandle` object that `show()` returns. - /// - /// (xdg only) - pub fn id(&mut self, id: u32) -> &mut Notification { - self.id = Some(id); - self - } - - /// Finalizes a Notification. - /// - /// Part of the builder pattern, returns a complete copy of the built notification. - pub fn finalize(&self) -> Notification { - self.clone() - } - - /// Schedules a Notification - /// - /// Sends a Notification at the specified date. - #[cfg(all(target_os = "macos", feature = "chrono"))] - pub fn schedule( - &self, - delivery_date: chrono::DateTime, - ) -> Result { - macos::schedule_notification(self, delivery_date.timestamp() as f64) - } - - /// Schedules a Notification - /// - /// Sends a Notification at the specified timestamp. - /// This is a raw `f64`, if that is a bit too raw for you please activate the feature `"chrono"`, - /// then you can use `Notification::schedule()` instead, which accepts a `chrono::DateTime`. - #[cfg(target_os = "macos")] - pub fn schedule_raw(&self, timestamp: f64) -> Result { - macos::schedule_notification(self, timestamp) - } - - /// Sends Notification to D-Bus. - /// - /// Returns a handle to a notification - #[cfg(all(unix, not(target_os = "macos")))] - pub fn show(&self) -> Result { - xdg::show_notification(self) - } - - /// Sends Notification to D-Bus. - /// - /// Returns a handle to a notification - #[cfg(all(unix, not(target_os = "macos")))] - #[cfg(all(feature = "async", feature = "zbus"))] - pub async fn show_async(&self) -> Result { - xdg::show_notification_async(self).await - } - - /// Sends Notification to D-Bus. - /// - /// Returns a handle to a notification - #[cfg(all(unix, not(target_os = "macos")))] - #[cfg(feature = "async")] - // #[cfg(test)] - pub async fn show_async_at_bus(&self, sub_bus: &str) -> Result { - let bus = super::xdg::NotificationBus::custom(sub_bus).ok_or("invalid subpath")?; - super::xdg::show_notification_async_at_bus(self, bus).await - } - - /// Sends Notification to `NSUserNotificationCenter`. - /// - /// Returns an `Ok` no matter what, since there is currently no way of telling the success of - /// the notification. - #[cfg(target_os = "macos")] - pub fn show(&self) -> Result { - macos::show_notification(self) - } - - /// Sends Notification to `NSUserNotificationCenter`. - /// - /// Returns an `Ok` no matter what, since there is currently no way of telling the success of - /// the notification. - #[cfg(target_os = "windows")] - pub fn show(&self) -> Result<()> { - windows::show_notification(self) - } - - /// Wraps `show()` but prints notification to stdout. - #[cfg(all(unix, not(target_os = "macos")))] - #[deprecated = "this was never meant to be public API"] - pub fn show_debug(&mut self) -> Result { - println!( - "Notification:\n{appname}: ({icon}) {summary:?} {body:?}\nhints: [{hints:?}]\n", - appname = self.appname, - summary = self.summary, - body = self.body, - hints = self.hints, - icon = self.icon, - ); - self.show() - } -} - -impl Default for Notification { - #[cfg(all(unix, not(target_os = "macos")))] - fn default() -> Notification { - Notification { - appname: exe_name(), - summary: String::new(), - subtitle: None, - body: String::new(), - icon: String::new(), - hints: HashSet::new(), - hints_unique: HashMap::new(), - actions: Vec::new(), - timeout: Timeout::Default, - bus: Default::default(), - id: None, - } - } - - #[cfg(target_os = "macos")] - fn default() -> Notification { - Notification { - appname: exe_name(), - summary: String::new(), - subtitle: None, - body: String::new(), - icon: String::new(), - actions: Vec::new(), - timeout: Timeout::Default, - sound_name: Default::default(), - id: None, - } - } - - #[cfg(target_os = "windows")] - fn default() -> Notification { - Notification { - appname: exe_name(), - summary: String::new(), - subtitle: None, - body: String::new(), - icon: String::new(), - actions: Vec::new(), - timeout: Timeout::Default, - sound_name: Default::default(), - id: None, - path_to_image: None, - app_id: None, - } - } -} diff --git a/plugins/notification/src/notify_rust/server.rs b/plugins/notification/src/notify_rust/server.rs deleted file mode 100644 index c6802ece..00000000 --- a/plugins/notification/src/notify_rust/server.rs +++ /dev/null @@ -1,238 +0,0 @@ -//! **Experimental** server taking the place of your Desktop Environment's Notification Server. -//! -//! This is not nearly meant for anything but testing, as it only prints notifications to stdout. -//! It does not respond properly either yet. -//! -//! This server will not replace an already running notification server. -//! - -#![allow(unused_imports, unused_variables, dead_code)] - -use std::cell::Cell; -use std::collections::{HashMap, HashSet}; -use std::sync::{Arc, Mutex}; - -#[cfg(feature = "dbus")] -use dbus::{ - arg::{self, RefArg}, - ffidisp::{BusType, Connection, NameFlag}, - tree::{self, Factory, Interface, MTFn, MTSync, Tree}, - Path, -}; - -use super::xdg::{NOTIFICATION_NAMESPACE, NOTIFICATION_OBJECTPATH}; -use super::{Hint, Notification, Timeout}; - -static DBUS_ERROR_FAILED: &str = "org.freedesktop.DBus.Error.Failed"; -/// Version of the crate equals the version server. -pub const VERSION: &str = env!("CARGO_PKG_VERSION"); - -/// An **experimental** notification server. -/// See [the module level documentation](index.html) for more. -#[derive(Debug, Default)] -pub struct NotificationServer { - /// Counter for generating notification ids - counter: Mutex>, - - /// A flag that stops the server - stopped: Mutex>, -} - -impl NotificationServer { - fn count_up(&self) { - if let Ok(counter) = self.counter.lock() { - counter.set(counter.get() + 1); - } - } - - fn stop(&self) { - if let Ok(stop) = self.stopped.lock() { - stop.set(true); - } - } - - fn is_stopped(&self) -> bool { - if let Ok(stop) = self.stopped.lock() { - stop.get() - } else { - true - } - } - - /// Create a new `NotificationServer` instance. - pub fn create() -> Arc { - Arc::new(NotificationServer::default()) - } - // pub fn notify_mothod(&mut self, closure: F) - // -> Method - // where F: Fn(&Notification) - // { - - // fn handle_notification - - /// Start listening for incoming notifications - pub fn start(me: &Arc, closure: F) - where - F: Fn(&Notification), - { - let connection = Connection::get_private(BusType::Session).unwrap(); - - connection.release_name(NOTIFICATION_NAMESPACE).unwrap(); - connection - .register_name(NOTIFICATION_NAMESPACE, NameFlag::ReplaceExisting as u32) - .unwrap(); - connection - .register_object_path(NOTIFICATION_OBJECTPATH) - .unwrap(); - - let mytex = Arc::new(Mutex::new(me.clone())); - - let factory = Factory::new_fn::<()>(); // D::Tree = () - let tree = factory.tree(()).add( - factory - .object_path(NOTIFICATION_OBJECTPATH, ()) - .introspectable() - .add( - factory - .interface(NOTIFICATION_NAMESPACE, ()) - .add_m(method_notify(&factory, closure)) - .add_m(method_close_notification(&factory)) - .add_m(Self::stop_server(mytex.clone(), &factory)) - // .add_signal(method_notification_closed(&factory)) - // .add_signal(method_action_invoked(&factory)) - .add_m(method_get_capabilities(&factory)) - .add_m(method_get_server_information(&factory)), - ), - ); - - connection.add_handler(tree); - - while !me.is_stopped() { - // Wait for incoming messages. This will block up to one second. - // Discard the result - relevant messages have already been handled. - if let Some(received) = connection.incoming(1000).next() { - println!("RECEIVED {:?}", received); - } - } - } - - fn stop_server( - me: Arc>>, - factory: &Factory, - ) -> tree::Method, ()> { - factory - .method("Stop", (), move |minfo| { - if let Ok(me) = me.lock() { - me.stop(); - println!("STOPPING"); - Ok(vec![]) - } else { - Err(tree::MethodErr::failed(&String::from("nope!"))) - } - }) - .out_arg(("", "u")) - } -} - -fn hints_from_variants(hints: &HashMap) -> HashSet { - hints.iter().map(Into::into).collect() -} - -fn method_notify( - factory: &Factory, - on_notification: F, -) -> tree::Method, ()> -where - F: Fn(&Notification), -{ - factory - .method("Notify", (), move |minfo| { - let mut i = minfo.msg.iter_init(); - let appname: String = i.read()?; - let replaces_id: u32 = i.read()?; - let icon: String = i.read()?; - let summary: String = i.read()?; - let body: String = i.read()?; - let actions: Vec = i.read()?; - let hints: ::std::collections::HashMap>> = - i.read()?; - let timeout: i32 = i.read()?; - println!("hints {:?} ", hints); - - // let arg0 = try!(d.notify(app_name, replaces_id, app_icon, summary, body, actions, hints, timeout)); - let notification = Notification { - appname, - icon, - summary, - body, - actions, - hints: hints_from_variants(&hints), - timeout: Timeout::from(timeout), - id: if replaces_id == 0 { - None - } else { - Some(replaces_id) - }, - subtitle: None, - }; - - on_notification(¬ification); - - let arg0 = 43; - let rm = minfo.msg.method_return(); - let rm = rm.append1(arg0); - Ok(vec![rm]) - }) - .in_arg(("app_name", "s")) - .in_arg(("replaces_id", "u")) - .in_arg(("app_icon", "s")) - .in_arg(("summary", "s")) - .in_arg(("body", "s")) - .in_arg(("actions", "as")) - .in_arg(("hints", "a{sv}")) - .in_arg(("timeout", "i")) - .out_arg(("", "u")) -} - -fn method_close_notification(factory: &Factory) -> tree::Method, ()> { - factory - .method("CloseNotification", (), |minfo| { - let i = minfo.msg.iter_init(); - let rm = minfo.msg.method_return(); - Ok(vec![rm]) - }) - .in_arg(("id", "u")) -} - -fn method_get_capabilities(factory: &Factory) -> tree::Method, ()> { - factory - .method("GetCapabilities", (), |minfo| { - let caps: Vec = vec![]; - let rm = minfo.msg.method_return(); - let rm = rm.append1(caps); - Ok(vec![rm]) - }) - .out_arg(("caps", "as")) -} - -fn method_get_server_information(factory: &Factory) -> tree::Method, ()> { - factory - .method("GetServerInformation", (), |minfo| { - let (name, vendor, version, spec_version) = ( - "notify-rust", - "notify-rust", - env!("CARGO_PKG_VERSION"), - "0.0.0", - ); - let rm = minfo.msg.method_return(); - let rm = rm.append1(name); - let rm = rm.append1(vendor); - let rm = rm.append1(version); - let rm = rm.append1(spec_version); - Ok(vec![rm]) - }) - .out_arg(("name", "s")) - .out_arg(("vendor", "s")) - .out_arg(("version", "s")) - .out_arg(("spec_version", "s")) -} diff --git a/plugins/notification/src/notify_rust/timeout.rs b/plugins/notification/src/notify_rust/timeout.rs deleted file mode 100644 index 6b76a55a..00000000 --- a/plugins/notification/src/notify_rust/timeout.rs +++ /dev/null @@ -1,102 +0,0 @@ -use std::{convert::TryInto, num::ParseIntError, str::FromStr, time::Duration}; - -/// Describes the timeout of a notification -/// -/// # `FromStr` -/// You can also parse a `Timeout` from a `&str`. -#[derive(Debug, Copy, Clone, PartialEq, Eq)] -pub enum Timeout { - /// Expires according to server default. - /// - /// Whatever that might be... - Default, - - /// Do not expire, user will have to close this manually. - Never, - - /// Expire after n milliseconds. - Milliseconds(u32), -} - -impl Default for Timeout { - fn default() -> Self { - Timeout::Default - } -} - -#[test] -fn timeout_from_i32() { - assert_eq!(Timeout::from(234), Timeout::Milliseconds(234)); - assert_eq!(Timeout::from(-234), Timeout::Default); - assert_eq!(Timeout::from(0), Timeout::Never); -} - -impl From for Timeout { - fn from(int: i32) -> Timeout { - use std::cmp::Ordering::*; - match int.cmp(&0) { - Greater => Timeout::Milliseconds(int as u32), - Less => Timeout::Default, - Equal => Timeout::Never, - } - } -} - -impl From for Timeout { - fn from(duration: Duration) -> Timeout { - if duration.is_zero() { - Timeout::Never - } else if duration.as_millis() > u32::MAX.into() { - Timeout::Default - } else { - Timeout::Milliseconds(duration.as_millis().try_into().unwrap_or(u32::MAX)) - } - } -} - -impl From for i32 { - fn from(timeout: Timeout) -> Self { - match timeout { - Timeout::Default => -1, - Timeout::Never => 0, - Timeout::Milliseconds(ms) => ms as i32, - } - } -} - -impl FromStr for Timeout { - type Err = ParseIntError; - - fn from_str(s: &str) -> Result { - match s { - "default" => Ok(Timeout::Default), - "never" => Ok(Timeout::Never), - milliseconds => Ok(Timeout::Milliseconds(u32::from_str(milliseconds)?)), - } - } -} - -pub struct TimeoutMessage(Timeout); - -impl From for TimeoutMessage { - fn from(hint: Timeout) -> Self { - TimeoutMessage(hint) - } -} - -impl std::ops::Deref for TimeoutMessage { - type Target = Timeout; - - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -#[cfg(all(feature = "dbus", unix, not(target_os = "macos")))] -impl TryFrom<&dbus::arg::messageitem::MessageItem> for TimeoutMessage { - type Error = (); - - fn try_from(mi: &dbus::arg::messageitem::MessageItem) -> Result { - mi.inner::().map(|i| TimeoutMessage(i.into())) - } -} diff --git a/plugins/notification/src/notify_rust/urgency.rs b/plugins/notification/src/notify_rust/urgency.rs deleted file mode 100644 index eeddf763..00000000 --- a/plugins/notification/src/notify_rust/urgency.rs +++ /dev/null @@ -1,74 +0,0 @@ -use super::error::ErrorKind; -use std::convert::TryFrom; - -/// Levels of Urgency. -/// -/// # Specification -/// > Developers must use their own judgement when deciding the urgency of a notification. Typically, if the majority of programs are using the same level for a specific type of urgency, other applications should follow them. -/// > -/// > For low and normal urgencies, server implementations may display the notifications how they choose. They should, however, have a sane expiration timeout dependent on the urgency level. -/// > -/// > **Critical notifications should not automatically expire**, as they are things that the user will most likely want to know about. They should only be closed when the user dismisses them, for example, by clicking on the notification. -/// -/// — see [Galago](http://www.galago-project.org/specs/notification/0.9/x320.html) or [Gnome](https://developer.gnome.org/notification-spec/#urgency-levels) specification. -#[derive(Eq, PartialEq, Hash, Copy, Clone, Debug)] -pub enum Urgency { - /// The behavior for `Low` urgency depends on the notification server. - Low = 0, - /// The behavior for `Normal` urgency depends on the notification server. - Normal = 1, - /// A critical notification will not time out. - Critical = 2, -} - -impl TryFrom<&str> for Urgency { - type Error = super::error::Error; - - #[rustfmt::skip] - fn try_from(string: &str) -> Result { - match string.to_lowercase().as_ref() { - "low" | - "lo" => Ok(Urgency::Low), - "normal" | - "medium" => Ok(Urgency::Normal), - "critical" | - "high" | - "hi" => Ok(Urgency::Critical), - _ => Err(ErrorKind::Conversion(format!("invalid input {:?}", string)).into()) - } - } -} - -impl From> for Urgency { - fn from(maybe_int: Option) -> Urgency { - match maybe_int { - Some(0) => Urgency::Low, - Some(x) if x >= 2 => Urgency::Critical, - _ => Urgency::Normal, - } - } -} - -// TODO: remove this in v5.0 -#[cfg(not(feature = "server"))] -impl From for Urgency { - fn from(int: u64) -> Urgency { - match int { - 0 => Urgency::Low, - 1 => Urgency::Normal, - 2..=std::u64::MAX => Urgency::Critical, - } - } -} - -// TODO: make this the default in v5.0 -#[cfg(feature = "server")] -impl From for Urgency { - fn from(int: u8) -> Urgency { - match int { - 0 => Urgency::Low, - 1 => Urgency::Normal, - 2..=std::u8::MAX => Urgency::Critical, - } - } -} diff --git a/plugins/notification/src/notify_rust/windows.rs b/plugins/notification/src/notify_rust/windows.rs deleted file mode 100644 index 423aae99..00000000 --- a/plugins/notification/src/notify_rust/windows.rs +++ /dev/null @@ -1,40 +0,0 @@ -use winrt_notification::Toast; - -pub use super::{error::*, notification::Notification, timeout::Timeout}; - -use std::{path::Path, str::FromStr}; - -pub(crate) fn show_notification(notification: &Notification) -> Result<()> { - let sound = match ¬ification.sound_name { - Some(chosen_sound_name) => winrt_notification::Sound::from_str(chosen_sound_name).ok(), - None => None, - }; - - let duration = match notification.timeout { - Timeout::Default => winrt_notification::Duration::Short, - Timeout::Never => winrt_notification::Duration::Long, - Timeout::Milliseconds(t) => { - if t >= 25000 { - winrt_notification::Duration::Long - } else { - winrt_notification::Duration::Short - } - } - }; - - let powershell_app_id = &Toast::POWERSHELL_APP_ID.to_string(); - let app_id = ¬ification.app_id.as_ref().unwrap_or(powershell_app_id); - let mut toast = Toast::new(app_id) - .title(¬ification.summary) - .text1(notification.subtitle.as_ref().map_or("", AsRef::as_ref)) // subtitle - .text2(¬ification.body) - .sound(sound) - .duration(duration); - if let Some(image_path) = ¬ification.path_to_image { - toast = toast.image(Path::new(&image_path), ""); - } - - toast - .show() - .map_err(|e| Error::from(ErrorKind::Msg(format!("{:?}", e)))) -} diff --git a/plugins/notification/src/notify_rust/xdg/bus.rs b/plugins/notification/src/notify_rust/xdg/bus.rs deleted file mode 100644 index cd6c1cca..00000000 --- a/plugins/notification/src/notify_rust/xdg/bus.rs +++ /dev/null @@ -1,68 +0,0 @@ -use super::super::xdg::NOTIFICATION_DEFAULT_BUS; - -fn skip_first_slash(s: &str) -> &str { - if let Some('/') = s.chars().next() { - &s[1..] - } else { - s - } -} - -use std::path::PathBuf; - -type BusNameType = std::borrow::Cow<'static, str>; - -#[derive(Clone, Debug)] -pub struct NotificationBus(BusNameType); - -impl Default for NotificationBus { - #[cfg(feature = "zbus")] - fn default() -> Self { - Self( - zbus::names::WellKnownName::from_static_str(NOTIFICATION_DEFAULT_BUS) - .unwrap() - .to_string() - .into(), - ) - } - - #[cfg(all(feature = "dbus", not(feature = "zbus")))] - fn default() -> Self { - Self( - dbus::strings::BusName::from_slice(NOTIFICATION_DEFAULT_BUS) - .unwrap() - .to_string() - .into(), - ) - } -} - -impl NotificationBus { - fn namespaced_custom(custom_path: &str) -> Option { - // abusing path for semantic join - skip_first_slash( - PathBuf::from("/de/hoodie/Notification") - .join(custom_path) - .to_str()?, - ) - .replace('/', ".") - .into() - } - - #[cfg(feature = "zbus")] - pub fn custom(custom_path: &str) -> Option { - let name = - zbus::names::WellKnownName::try_from(Self::namespaced_custom(custom_path)?).ok()?; - Some(Self(name.to_string().into())) - } - - #[cfg(all(feature = "dbus", not(feature = "zbus")))] - pub fn custom(custom_path: &str) -> Option { - let name = dbus::strings::BusName::new(Self::namespaced_custom(custom_path)?).ok()?; - Some(Self(name.to_string().into())) - } - - pub fn into_name(self) -> BusNameType { - self.0 - } -} diff --git a/plugins/notification/src/notify_rust/xdg/dbus_rs.rs b/plugins/notification/src/notify_rust/xdg/dbus_rs.rs deleted file mode 100644 index b1658122..00000000 --- a/plugins/notification/src/notify_rust/xdg/dbus_rs.rs +++ /dev/null @@ -1,328 +0,0 @@ -use dbus::{ - arg::messageitem::{MessageItem, MessageItemArray}, - ffidisp::{BusType, Connection, ConnectionItem}, - Message, -}; - -use super::{ - bus::NotificationBus, ActionResponse, ActionResponseHandler, CloseReason, - NOTIFICATION_INTERFACE, -}; - -use super::super::{ - error::*, - hints::message::HintMessage, - notification::Notification, - xdg::{ServerInformation, NOTIFICATION_OBJECTPATH}, -}; - -pub mod bus { - - use super::super::super::xdg::NOTIFICATION_DEFAULT_BUS; - - fn skip_first_slash(s: &str) -> &str { - if let Some('/') = s.chars().next() { - &s[1..] - } else { - s - } - } - - use std::path::PathBuf; - - type BusNameType = dbus::strings::BusName<'static>; - - #[derive(Clone, Debug)] - pub struct NotificationBus(BusNameType); - - impl Default for NotificationBus { - fn default() -> Self { - Self(dbus::strings::BusName::from_slice(NOTIFICATION_DEFAULT_BUS).unwrap()) - } - } - - impl NotificationBus { - fn namespaced_custom(custom_path: &str) -> Option { - // abusing path for semantic join - skip_first_slash( - PathBuf::from("/de/hoodie/Notification") - .join(custom_path) - .to_str()?, - ) - .replace('/', ".") - .into() - } - - pub fn custom(custom_path: &str) -> Option { - let name = dbus::strings::BusName::new(Self::namespaced_custom(custom_path)?).ok()?; - Some(Self(name)) - } - - pub fn into_name(self) -> BusNameType { - self.0 - } - } -} - -/// A handle to a shown notification. -/// -/// This keeps a connection alive to ensure actions work on certain desktops. -#[derive(Debug)] -pub struct DbusNotificationHandle { - pub(crate) id: u32, - pub(crate) connection: Connection, - pub(crate) notification: Notification, -} - -impl DbusNotificationHandle { - pub(crate) fn new( - id: u32, - connection: Connection, - notification: Notification, - ) -> DbusNotificationHandle { - DbusNotificationHandle { - id, - connection, - notification, - } - } - - pub fn wait_for_action(self, invocation_closure: impl ActionResponseHandler) { - wait_for_action_signal(&self.connection, self.id, invocation_closure); - } - - pub fn close(self) { - let mut message = build_message("CloseNotification", Default::default()); - message.append_items(&[self.id.into()]); - let _ = self.connection.send(message); // If closing fails there's nothing we could do anyway - } - - pub fn on_close(self, closure: F) - where - F: FnOnce(CloseReason), - { - self.wait_for_action(|action: &ActionResponse| { - if let ActionResponse::Closed(reason) = action { - closure(*reason); - } - }); - } - - pub fn update(&mut self) { - self.id = send_notification_via_connection(&self.notification, self.id, &self.connection) - .unwrap(); - } -} - -pub fn send_notification_via_connection( - notification: &Notification, - id: u32, - connection: &Connection, -) -> Result { - send_notification_via_connection_at_bus(notification, id, connection, Default::default()) -} - -pub fn send_notification_via_connection_at_bus( - notification: &Notification, - id: u32, - connection: &Connection, - bus: NotificationBus, -) -> Result { - let mut message = build_message("Notify", bus); - let timeout: i32 = notification.timeout.into(); - message.append_items(&[ - notification.appname.to_owned().into(), // appname - id.into(), // notification to update - notification.icon.to_owned().into(), // icon - notification.summary.to_owned().into(), // summary (title) - notification.body.to_owned().into(), // body - pack_actions(notification), // actions - pack_hints(notification)?, // hints - timeout.into(), // timeout - ]); - - let reply = connection.send_with_reply_and_block(message, 2000)?; - - match reply.get_items().first() { - Some(MessageItem::UInt32(ref id)) => Ok(*id), - _ => Ok(0), - } -} - -pub fn connect_and_send_notification( - notification: &Notification, -) -> Result { - let bus = notification.bus.clone(); - connect_and_send_notification_at_bus(notification, bus) -} - -pub fn connect_and_send_notification_at_bus( - notification: &Notification, - bus: NotificationBus, -) -> Result { - let connection = Connection::get_private(BusType::Session)?; - let inner_id = notification.id.unwrap_or(0); - let id = send_notification_via_connection_at_bus(notification, inner_id, &connection, bus)?; - - Ok(DbusNotificationHandle::new( - id, - connection, - notification.clone(), - )) -} - -fn build_message(method_name: &str, bus: NotificationBus) -> Message { - Message::new_method_call( - bus.into_name(), - NOTIFICATION_OBJECTPATH, - NOTIFICATION_INTERFACE, - method_name, - ) - .unwrap_or_else(|_| panic!("Error building message call {:?}.", method_name)) -} - -pub fn pack_hints(notification: &Notification) -> Result { - if !notification.hints.is_empty() || !notification.hints_unique.is_empty() { - let hints = notification - .get_hints() - .cloned() - .map(HintMessage::wrap_hint) - .collect::>(); - - if let Ok(array) = MessageItem::new_dict(hints) { - return Ok(array); - } - } - - Ok(MessageItem::Array( - MessageItemArray::new(vec![], "a{sv}".into()).unwrap(), - )) -} - -pub fn pack_actions(notification: &Notification) -> MessageItem { - if !notification.actions.is_empty() { - let mut actions = vec![]; - for action in ¬ification.actions { - actions.push(action.to_owned().into()); - } - if let Ok(array) = MessageItem::new_array(actions) { - return array; - } - } - - MessageItem::Array(MessageItemArray::new(vec![], "as".into()).unwrap()) -} - -pub fn get_capabilities() -> Result> { - let mut capabilities = vec![]; - - let message = build_message("GetCapabilities", Default::default()); - let connection = Connection::get_private(BusType::Session)?; - let reply = connection.send_with_reply_and_block(message, 2000)?; - - if let Some(MessageItem::Array(items)) = reply.get_items().first() { - for item in items.iter() { - if let MessageItem::Str(ref cap) = *item { - capabilities.push(cap.clone()); - } - } - } - - Ok(capabilities) -} - -fn unwrap_message_string(item: Option<&MessageItem>) -> String { - match item { - Some(MessageItem::Str(value)) => value.to_owned(), - _ => "".to_owned(), - } -} - -#[allow(clippy::get_first)] -pub fn get_server_information() -> Result { - let message = build_message("GetServerInformation", Default::default()); - let connection = Connection::get_private(BusType::Session)?; - let reply = connection.send_with_reply_and_block(message, 2000)?; - - let items = reply.get_items(); - - Ok(ServerInformation { - name: unwrap_message_string(items.get(0)), - vendor: unwrap_message_string(items.get(1)), - version: unwrap_message_string(items.get(2)), - spec_version: unwrap_message_string(items.get(3)), - }) -} - -/// Listens for the `ActionInvoked(UInt32, String)` Signal. -/// -/// No need to use this, check out `Notification::show_and_wait_for_action(FnOnce(action:&str))` -pub fn handle_action(id: u32, func: impl ActionResponseHandler) { - let connection = Connection::get_private(BusType::Session).unwrap(); - wait_for_action_signal(&connection, id, func); -} - -// Listens for the `ActionInvoked(UInt32, String)` signal. -fn wait_for_action_signal(connection: &Connection, id: u32, handler: impl ActionResponseHandler) { - connection - .add_match(&format!( - "interface='{}',member='ActionInvoked'", - NOTIFICATION_INTERFACE - )) - .unwrap(); - connection - .add_match(&format!( - "interface='{}',member='NotificationClosed'", - NOTIFICATION_INTERFACE - )) - .unwrap(); - - for item in connection.iter(1000) { - if let ConnectionItem::Signal(message) = item { - let items = message.get_items(); - - let (path, interface, member) = ( - message.path().map_or_else(String::new, |p| { - p.into_cstring().to_string_lossy().into_owned() - }), - message.interface().map_or_else(String::new, |p| { - p.into_cstring().to_string_lossy().into_owned() - }), - message.member().map_or_else(String::new, |p| { - p.into_cstring().to_string_lossy().into_owned() - }), - ); - match (path.as_str(), interface.as_str(), member.as_str()) { - // match (protocol.unwrap(), iface.unwrap(), member.unwrap()) { - // Action Invoked - (path, interface, "ActionInvoked") - if path == NOTIFICATION_OBJECTPATH && interface == NOTIFICATION_INTERFACE => - { - if let (&MessageItem::UInt32(nid), MessageItem::Str(ref action)) = - (&items[0], &items[1]) - { - if nid == id { - handler.call(&ActionResponse::Custom(action)); - break; - } - } - } - - // Notification Closed - (path, interface, "NotificationClosed") - if path == NOTIFICATION_OBJECTPATH && interface == NOTIFICATION_INTERFACE => - { - if let (&MessageItem::UInt32(nid), &MessageItem::UInt32(reason)) = - (&items[0], &items[1]) - { - if nid == id { - handler.call(&ActionResponse::Closed(reason.into())); - break; - } - } - } - (..) => (), - } - } - } -} diff --git a/plugins/notification/src/notify_rust/xdg/mod.rs b/plugins/notification/src/notify_rust/xdg/mod.rs deleted file mode 100644 index 3012b570..00000000 --- a/plugins/notification/src/notify_rust/xdg/mod.rs +++ /dev/null @@ -1,544 +0,0 @@ -//! This module contains `XDG` and `DBus` specific code. -//! -//! it should not be available under any platform other than `(unix, not(target_os = "macos"))` - -#[cfg(feature = "dbus")] -use dbus::ffidisp::Connection as DbusConnection; -#[cfg(feature = "zbus")] -use zbus::{block_on, zvariant}; - -use super::{error::*, notification::Notification}; - -use std::ops::{Deref, DerefMut}; - -#[cfg(feature = "dbus")] -mod dbus_rs; -#[cfg(all(feature = "dbus", not(feature = "zbus")))] -use dbus_rs::bus; - -#[cfg(feature = "zbus")] -mod zbus_rs; -#[cfg(all(feature = "zbus", not(feature = "dbus")))] -use zbus_rs::bus; - -#[cfg(all(feature = "dbus", feature = "zbus"))] -mod bus; - -// #[cfg(all(feature = "server", feature = "dbus", unix, not(target_os = "macos")))] -// pub mod server_dbus; - -// #[cfg(all(feature = "server", feature = "zbus", unix, not(target_os = "macos")))] -// pub mod server_zbus; - -// #[cfg(all(feature = "server", unix, not(target_os = "macos")))] -// pub mod server; - -#[cfg(not(feature = "debug_namespace"))] -#[doc(hidden)] -pub static NOTIFICATION_DEFAULT_BUS: &str = "org.freedesktop.Notifications"; - -#[cfg(feature = "debug_namespace")] -#[doc(hidden)] -// #[deprecated] -pub static NOTIFICATION_DEFAULT_BUS: &str = "de.hoodie.Notifications"; - -#[doc(hidden)] -pub static NOTIFICATION_INTERFACE: &str = "org.freedesktop.Notifications"; - -#[doc(hidden)] -pub static NOTIFICATION_OBJECTPATH: &str = "/org/freedesktop/Notifications"; - -pub(crate) use bus::NotificationBus; - -#[derive(Debug)] -enum NotificationHandleInner { - #[cfg(feature = "dbus")] - Dbus(dbus_rs::DbusNotificationHandle), - - #[cfg(feature = "zbus")] - Zbus(zbus_rs::ZbusNotificationHandle), -} - -/// A handle to a shown notification. -/// -/// This keeps a connection alive to ensure actions work on certain desktops. -#[derive(Debug)] -pub struct NotificationHandle { - inner: NotificationHandleInner, -} - -#[allow(dead_code)] -impl NotificationHandle { - #[cfg(feature = "dbus")] - pub(crate) fn for_dbus( - id: u32, - connection: DbusConnection, - notification: Notification, - ) -> NotificationHandle { - NotificationHandle { - inner: dbus_rs::DbusNotificationHandle::new(id, connection, notification).into(), - } - } - - #[cfg(feature = "zbus")] - pub(crate) fn for_zbus( - id: u32, - connection: zbus::Connection, - notification: Notification, - ) -> NotificationHandle { - NotificationHandle { - inner: zbus_rs::ZbusNotificationHandle::new(id, connection, notification).into(), - } - } - - /// Waits for the user to act on a notification and then calls - /// `invocation_closure` with the name of the corresponding action. - pub fn wait_for_action(self, invocation_closure: F) - where - F: FnOnce(&str), - { - match self.inner { - #[cfg(feature = "dbus")] - NotificationHandleInner::Dbus(inner) => { - inner.wait_for_action(|action: &ActionResponse| match action { - ActionResponse::Custom(action) => invocation_closure(action), - ActionResponse::Closed(_reason) => invocation_closure("__closed"), // FIXME: remove backward compatibility with 5.0 - }); - } - - #[cfg(feature = "zbus")] - NotificationHandleInner::Zbus(inner) => { - block_on( - inner.wait_for_action(|action: &ActionResponse| match action { - ActionResponse::Custom(action) => invocation_closure(action), - ActionResponse::Closed(_reason) => invocation_closure("__closed"), // FIXME: remove backward compatibility with 5.0 - }), - ); - } - }; - } - - /// Manually close the notification - pub fn close(self) { - match self.inner { - #[cfg(feature = "dbus")] - NotificationHandleInner::Dbus(inner) => inner.close(), - #[cfg(feature = "zbus")] - NotificationHandleInner::Zbus(inner) => block_on(inner.close()), - } - } - - /// Executes a closure after the notification has closed. - pub fn on_close(self, handler: impl CloseHandler) { - match self.inner { - #[cfg(feature = "dbus")] - NotificationHandleInner::Dbus(inner) => { - inner.wait_for_action(|action: &ActionResponse| { - if let ActionResponse::Closed(reason) = action { - handler.call(*reason); - } - }); - } - #[cfg(feature = "zbus")] - NotificationHandleInner::Zbus(inner) => { - block_on(inner.wait_for_action(|action: &ActionResponse| { - if let ActionResponse::Closed(reason) = action { - handler.call(*reason); - } - })); - } - }; - } - - pub fn update(&mut self) { - match self.inner { - #[cfg(feature = "dbus")] - NotificationHandleInner::Dbus(ref mut inner) => inner.update(), - #[cfg(feature = "zbus")] - NotificationHandleInner::Zbus(ref mut inner) => inner.update(), - } - } - - /// Returns the Handle's id. - pub fn id(&self) -> u32 { - match self.inner { - #[cfg(feature = "dbus")] - NotificationHandleInner::Dbus(ref inner) => inner.id, - #[cfg(feature = "zbus")] - NotificationHandleInner::Zbus(ref inner) => inner.id, - } - } -} - -/// Required for `DerefMut` -impl Deref for NotificationHandle { - type Target = Notification; - - fn deref(&self) -> &Notification { - match self.inner { - #[cfg(feature = "dbus")] - NotificationHandleInner::Dbus(ref inner) => &inner.notification, - #[cfg(feature = "zbus")] - NotificationHandleInner::Zbus(ref inner) => &inner.notification, - } - } -} - -/// Allow you to easily modify notification properties -impl DerefMut for NotificationHandle { - fn deref_mut(&mut self) -> &mut Notification { - match self.inner { - #[cfg(feature = "dbus")] - NotificationHandleInner::Dbus(ref mut inner) => &mut inner.notification, - #[cfg(feature = "zbus")] - NotificationHandleInner::Zbus(ref mut inner) => &mut inner.notification, - } - } -} - -#[cfg(feature = "dbus")] -impl From for NotificationHandleInner { - fn from(handle: dbus_rs::DbusNotificationHandle) -> NotificationHandleInner { - NotificationHandleInner::Dbus(handle) - } -} - -#[cfg(feature = "zbus")] -impl From for NotificationHandleInner { - fn from(handle: zbus_rs::ZbusNotificationHandle) -> NotificationHandleInner { - NotificationHandleInner::Zbus(handle) - } -} - -#[cfg(feature = "dbus")] -impl From for NotificationHandle { - fn from(handle: dbus_rs::DbusNotificationHandle) -> NotificationHandle { - NotificationHandle { - inner: handle.into(), - } - } -} - -#[cfg(feature = "zbus")] -impl From for NotificationHandle { - fn from(handle: zbus_rs::ZbusNotificationHandle) -> NotificationHandle { - NotificationHandle { - inner: handle.into(), - } - } -} - -// here be public functions - -// TODO: breaking change, wait for 5.0 -// #[cfg(all(feature = "dbus", feature = "zbus"))] -//compile_error!("the z and d features are mutually exclusive"); - -#[cfg(all( - not(any(feature = "dbus", feature = "zbus")), - unix, - not(target_os = "macos") -))] -compile_error!("you have to build with either zbus or dbus turned on"); - -/// Which Dbus implementation are we using? -#[derive(Copy, Clone, Debug)] -pub enum DbusStack { - /// using [dbus-rs](https://docs.rs/dbus-rs) - Dbus, - /// using [zbus](https://docs.rs/zbus) - Zbus, -} - -#[cfg(all(feature = "dbus", feature = "zbus"))] -const DBUS_SWITCH_VAR: &str = "DBUSRS"; - -#[cfg(all(feature = "zbus", not(feature = "dbus")))] -pub(crate) fn show_notification(notification: &Notification) -> Result { - block_on(zbus_rs::connect_and_send_notification(notification)).map(Into::into) -} - -#[cfg(all(feature = "async", feature = "zbus"))] -pub(crate) async fn show_notification_async( - notification: &Notification, -) -> Result { - zbus_rs::connect_and_send_notification(notification) - .await - .map(Into::into) -} - -#[cfg(all(feature = "async", feature = "zbus"))] -pub(crate) async fn show_notification_async_at_bus( - notification: &Notification, - bus: NotificationBus, -) -> Result { - zbus_rs::connect_and_send_notification_at_bus(notification, bus) - .await - .map(Into::into) -} - -#[cfg(all(feature = "dbus", not(feature = "zbus")))] -pub(crate) fn show_notification(notification: &Notification) -> Result { - dbus_rs::connect_and_send_notification(notification).map(Into::into) -} - -#[cfg(all(feature = "dbus", feature = "zbus"))] -pub(crate) fn show_notification(notification: &Notification) -> Result { - if std::env::var(DBUS_SWITCH_VAR).is_ok() { - dbus_rs::connect_and_send_notification(notification).map(Into::into) - } else { - block_on(zbus_rs::connect_and_send_notification(notification)).map(Into::into) - } -} - -/// Get the currently used [`DbusStack`] -/// -/// (zbus only) -#[cfg(all(feature = "zbus", not(feature = "dbus")))] -pub fn dbus_stack() -> Option { - Some(DbusStack::Zbus) -} - -/// Get the currently used [`DbusStack`] -/// -/// (dbus-rs only) -#[cfg(all(feature = "dbus", not(feature = "zbus")))] -pub fn dbus_stack() -> Option { - Some(DbusStack::Dbus) -} - -/// Get the currently used [`DbusStack`] -/// -/// both dbus-rs and zbus, switch via `$ZBUS_NOTIFICATION` -#[cfg(all(feature = "dbus", feature = "zbus"))] -pub fn dbus_stack() -> Option { - Some(if std::env::var(DBUS_SWITCH_VAR).is_ok() { - DbusStack::Dbus - } else { - DbusStack::Zbus - }) -} - -/// Get the currently used [`DbusStack`] -/// -/// neither zbus nor dbus-rs are configured -#[cfg(all(not(feature = "dbus"), not(feature = "zbus")))] -pub fn dbus_stack() -> Option { - None -} - -/// Get list of all capabilities of the running notification server. -/// -/// (zbus only) -#[cfg(all(feature = "zbus", not(feature = "dbus")))] -pub fn get_capabilities() -> Result> { - block_on(zbus_rs::get_capabilities()) -} - -/// Get list of all capabilities of the running notification server. -/// -/// (dbus-rs only) -#[cfg(all(feature = "dbus", not(feature = "zbus")))] -pub fn get_capabilities() -> Result> { - dbus_rs::get_capabilities() -} - -/// Get list of all capabilities of the running notification server. -/// -/// both dbus-rs and zbus, switch via `$ZBUS_NOTIFICATION` -#[cfg(all(feature = "dbus", feature = "zbus"))] -pub fn get_capabilities() -> Result> { - if std::env::var(DBUS_SWITCH_VAR).is_ok() { - dbus_rs::get_capabilities() - } else { - block_on(zbus_rs::get_capabilities()) - } -} - -/// Returns a struct containing `ServerInformation`. -/// -/// This struct contains `name`, `vendor`, `version` and `spec_version` of the notification server -/// running. -/// -/// (zbus only) -#[cfg(all(feature = "zbus", not(feature = "dbus")))] -pub fn get_server_information() -> Result { - block_on(zbus_rs::get_server_information()) -} - -/// Returns a struct containing `ServerInformation`. -/// -/// This struct contains `name`, `vendor`, `version` and `spec_version` of the notification server -/// running. -/// -/// (dbus-rs only) -#[cfg(all(feature = "dbus", not(feature = "zbus")))] -pub fn get_server_information() -> Result { - dbus_rs::get_server_information() -} - -/// Returns a struct containing `ServerInformation`. -/// -/// This struct contains `name`, `vendor`, `version` and `spec_version` of the notification server -/// running. -/// -/// both dbus-rs and zbus, switch via `$ZBUS_NOTIFICATION` -#[cfg(all(feature = "dbus", feature = "zbus"))] -pub fn get_server_information() -> Result { - if std::env::var(DBUS_SWITCH_VAR).is_ok() { - dbus_rs::get_server_information() - } else { - block_on(zbus_rs::get_server_information()) - } -} - -/// Return value of `get_server_information()`. -#[derive(Debug, serde::Deserialize)] -#[cfg_attr(feature = "zbus", derive(zvariant::Type))] -pub struct ServerInformation { - /// The product name of the server. - pub name: String, - /// The vendor name. - pub vendor: String, - /// The server's version string. - pub version: String, - /// The specification version the server is compliant with. - pub spec_version: String, -} - -/// Strictly internal. -/// The NotificationServer implemented here exposes a "Stop" function. -/// stops the notification server -#[cfg(all(feature = "server", unix, not(target_os = "macos")))] -#[doc(hidden)] -pub fn stop_server() { - #[cfg(feature = "dbus")] - dbus_rs::stop_server() -} - -/// Listens for the `ActionInvoked(UInt32, String)` Signal. -/// -/// No need to use this, check out [`NotificationHandle::wait_for_action`] -/// (xdg only) -#[cfg(all(feature = "zbus", not(feature = "dbus")))] -// #[deprecated(note="please use [`NotificationHandle::wait_for_action`]")] -pub fn handle_action(id: u32, func: F) -where - F: FnOnce(&ActionResponse), -{ - block_on(zbus_rs::handle_action(id, func)); -} - -/// Listens for the `ActionInvoked(UInt32, String)` Signal. -/// -/// No need to use this, check out [`NotificationHandle::wait_for_action`] -/// (xdg only) -#[cfg(all(feature = "dbus", not(feature = "zbus")))] -// #[deprecated(note="please use `NotificationHandle::wait_for_action`")] -pub fn handle_action(id: u32, func: F) -where - F: FnOnce(&ActionResponse), -{ - dbus_rs::handle_action(id, func); -} - -/// Listens for the `ActionInvoked(UInt32, String)` Signal. -/// -/// No need to use this, check out [`NotificationHandle::wait_for_action`] -/// both dbus-rs and zbus, switch via `$ZBUS_NOTIFICATION` -#[cfg(all(feature = "dbus", feature = "zbus"))] -// #[deprecated(note="please use `NotificationHandle::wait_for_action`")] -pub fn handle_action(id: u32, func: F) -where - F: FnOnce(&ActionResponse), -{ - if std::env::var(DBUS_SWITCH_VAR).is_ok() { - dbus_rs::handle_action(id, func); - } else { - block_on(zbus_rs::handle_action(id, func)); - } -} - -/// Reason passed to `NotificationClosed` Signal -/// -/// ## Specification -/// As listed under [Table 8. `NotificationClosed` Parameters](https://specifications.freedesktop.org/notification-spec/latest/ar01s09.html#idm46350804042704) -#[derive(Copy, Clone, Debug)] -pub enum CloseReason { - /// The notification expired - Expired, - /// The notification was dismissed by the user - Dismissed, - /// The notification was closed by a call to `CloseNotification` - CloseAction, - /// Undefined/Reserved reason - Other(u32), -} - -impl From for CloseReason { - fn from(raw_reason: u32) -> Self { - match raw_reason { - 1 => CloseReason::Expired, - 2 => CloseReason::Dismissed, - 3 => CloseReason::CloseAction, - other => CloseReason::Other(other), - } - } -} - -/// Helper Trait implemented by `Fn()` -pub trait ActionResponseHandler { - fn call(self, response: &ActionResponse); -} - -// impl ActionResponseHandler for F -impl ActionResponseHandler for F -where - F: FnOnce(&ActionResponse), -{ - fn call(self, res: &ActionResponse) { - (self)(res); - } -} - -/// Response to an action -pub enum ActionResponse<'a> { - /// Custom Action configured by the Notification. - Custom(&'a str), - - /// The Notification was closed. - Closed(CloseReason), -} - -impl<'a> From<&'a str> for ActionResponse<'a> { - fn from(raw: &'a str) -> Self { - Self::Custom(raw) - } -} - -/// Your handy callback for the `Close` signal of your Notification. -/// -/// This is implemented by `Fn()` and `Fn(CloseReason)`, so there is probably no good reason for you to manually implement this trait. -/// Should you find one anyway, please notify me and I'll gladly remove this obviously redundant comment. -pub trait CloseHandler { - /// This is called with the [`CloseReason`]. - fn call(&self, reason: CloseReason); -} - -impl CloseHandler for F -where - F: Fn(CloseReason), -{ - fn call(&self, reason: CloseReason) { - self(reason); - } -} - -impl CloseHandler<()> for F -where - F: Fn(), -{ - fn call(&self, _: CloseReason) { - self(); - } -} diff --git a/plugins/notification/src/notify_rust/xdg/zbus_rs.rs b/plugins/notification/src/notify_rust/xdg/zbus_rs.rs deleted file mode 100644 index 7bf7017a..00000000 --- a/plugins/notification/src/notify_rust/xdg/zbus_rs.rs +++ /dev/null @@ -1,285 +0,0 @@ -use super::super::{error::*, notification::Notification, xdg}; -use zbus::{export::futures_util::TryStreamExt, MatchRule}; - -use super::{bus::NotificationBus, ActionResponse, ActionResponseHandler, CloseReason}; - -pub mod bus { - - use super::super::super::xdg::NOTIFICATION_DEFAULT_BUS; - - fn skip_first_slash(s: &str) -> &str { - if let Some('/') = s.chars().next() { - &s[1..] - } else { - s - } - } - - use std::path::PathBuf; - - type BusNameType = zbus::names::WellKnownName<'static>; - - #[derive(Clone, Debug)] - pub struct NotificationBus(BusNameType); - - impl Default for NotificationBus { - #[cfg(feature = "zbus")] - fn default() -> Self { - Self(zbus::names::WellKnownName::from_static_str(NOTIFICATION_DEFAULT_BUS).unwrap()) - } - } - - impl NotificationBus { - fn namespaced_custom(custom_path: &str) -> Option { - // abusing path for semantic join - skip_first_slash( - PathBuf::from("/de/hoodie/Notification") - .join(custom_path) - .to_str()?, - ) - .replace('/', ".") - .into() - } - - pub fn custom(custom_path: &str) -> Option { - let name = - zbus::names::WellKnownName::try_from(Self::namespaced_custom(custom_path)?).ok()?; - Some(Self(name)) - } - - pub fn into_name(self) -> BusNameType { - self.0 - } - } -} - -/// A handle to a shown notification. -/// -/// This keeps a connection alive to ensure actions work on certain desktops. -#[derive(Debug)] -pub struct ZbusNotificationHandle { - pub(crate) id: u32, - pub(crate) connection: zbus::Connection, - pub(crate) notification: Notification, -} - -impl ZbusNotificationHandle { - pub(crate) fn new( - id: u32, - connection: zbus::Connection, - notification: Notification, - ) -> ZbusNotificationHandle { - ZbusNotificationHandle { - id, - connection, - notification, - } - } - - pub async fn wait_for_action(self, invocation_closure: impl ActionResponseHandler) { - wait_for_action_signal(&self.connection, self.id, invocation_closure).await; - } - - pub async fn close_fallible(self) -> Result<()> { - self.connection - .call_method( - Some(self.notification.bus.clone().into_name()), - xdg::NOTIFICATION_OBJECTPATH, - Some(xdg::NOTIFICATION_INTERFACE), - "CloseNotification", - &(self.id), - ) - .await?; - Ok(()) - } - - pub async fn close(self) { - self.close_fallible().await.unwrap(); - } - - pub fn on_close(self, closure: F) - where - F: FnOnce(CloseReason), - { - zbus::block_on(self.wait_for_action(|action: &ActionResponse| { - if let ActionResponse::Closed(reason) = action { - closure(*reason); - } - })); - } - - pub fn update_fallible(&mut self) -> Result<()> { - self.id = zbus::block_on(send_notification_via_connection( - &self.notification, - self.id, - &self.connection, - ))?; - Ok(()) - } - - pub fn update(&mut self) { - self.update_fallible().unwrap(); - } -} - -async fn send_notification_via_connection( - notification: &Notification, - id: u32, - connection: &zbus::Connection, -) -> Result { - send_notification_via_connection_at_bus(notification, id, connection, Default::default()).await -} - -async fn send_notification_via_connection_at_bus( - notification: &Notification, - id: u32, - connection: &zbus::Connection, - bus: NotificationBus, -) -> Result { - let reply: u32 = connection - .call_method( - Some(bus.into_name()), - xdg::NOTIFICATION_OBJECTPATH, - Some(xdg::NOTIFICATION_INTERFACE), - "Notify", - &( - ¬ification.appname, - id, - ¬ification.icon, - ¬ification.summary, - ¬ification.body, - ¬ification.actions, - super::super::hints::hints_to_map(notification), - i32::from(notification.timeout), - ), - ) - .await? - .body() - .deserialize()?; - Ok(reply) -} - -pub async fn connect_and_send_notification( - notification: &Notification, -) -> Result { - let bus = notification.bus.clone(); - connect_and_send_notification_at_bus(notification, bus).await -} - -pub(crate) async fn connect_and_send_notification_at_bus( - notification: &Notification, - bus: NotificationBus, -) -> Result { - let connection = zbus::Connection::session().await?; - let inner_id = notification.id.unwrap_or(0); - let id = - send_notification_via_connection_at_bus(notification, inner_id, &connection, bus).await?; - - Ok(ZbusNotificationHandle::new( - id, - connection, - notification.clone(), - )) -} - -pub async fn get_capabilities_at_bus(bus: NotificationBus) -> Result> { - let connection = zbus::Connection::session().await?; - let info: Vec = connection - .call_method( - Some(bus.into_name()), - xdg::NOTIFICATION_OBJECTPATH, - Some(xdg::NOTIFICATION_INTERFACE), - "GetCapabilities", - &(), - ) - .await? - .body() - .deserialize()?; - Ok(info) -} - -pub async fn get_capabilities() -> Result> { - get_capabilities_at_bus(Default::default()).await -} - -pub async fn get_server_information_at_bus(bus: NotificationBus) -> Result { - let connection = zbus::Connection::session().await?; - let info: xdg::ServerInformation = connection - .call_method( - Some(bus.into_name()), - xdg::NOTIFICATION_OBJECTPATH, - Some(xdg::NOTIFICATION_INTERFACE), - "GetServerInformation", - &(), - ) - .await? - .body() - .deserialize()?; - - Ok(info) -} - -pub async fn get_server_information() -> Result { - get_server_information_at_bus(Default::default()).await -} - -/// Listens for the `ActionInvoked(UInt32, String)` Signal. -/// -/// No need to use this, check out `Notification::show_and_wait_for_action(FnOnce(action:&str))` -pub async fn handle_action(id: u32, func: impl ActionResponseHandler) { - let connection = zbus::Connection::session().await.unwrap(); - wait_for_action_signal(&connection, id, func).await; -} - -async fn wait_for_action_signal( - connection: &zbus::Connection, - id: u32, - handler: impl ActionResponseHandler, -) { - let action_signal_rule = MatchRule::builder() - .msg_type(zbus::MessageType::Signal) - .interface(xdg::NOTIFICATION_INTERFACE) - .unwrap() - .member("ActionInvoked") - .unwrap() - .build(); - - let proxy = zbus::fdo::DBusProxy::new(connection).await.unwrap(); - proxy.add_match_rule(action_signal_rule).await.unwrap(); - - let close_signal_rule = MatchRule::builder() - .msg_type(zbus::MessageType::Signal) - .interface(xdg::NOTIFICATION_INTERFACE) - .unwrap() - .member("NotificationClosed") - .unwrap() - .build(); - proxy.add_match_rule(close_signal_rule).await.unwrap(); - - while let Ok(Some(msg)) = zbus::MessageStream::from(connection).try_next().await { - let header = msg.header(); - if let zbus::MessageType::Signal = header.message_type() { - match header.member() { - Some(name) if name == "ActionInvoked" => { - match msg.body().deserialize::<(u32, String)>() { - Ok((nid, action)) if nid == id => { - handler.call(&ActionResponse::Custom(&action)); - break; - } - _ => {} - } - } - Some(name) if name == "NotificationClosed" => { - match msg.body().deserialize::<(u32, u32)>() { - Ok((nid, reason)) if nid == id => { - handler.call(&ActionResponse::Closed(reason.into())); - break; - } - _ => {} - } - } - _ => {} - } - } - } -} diff --git a/plugins/opener/CHANGELOG.md b/plugins/opener/CHANGELOG.md new file mode 100644 index 00000000..67fa0a65 --- /dev/null +++ b/plugins/opener/CHANGELOG.md @@ -0,0 +1,34 @@ +# Changelog + +## \[2.2.6] + +- [`1a984659`](https://github.com/tauri-apps/plugins-workspace/commit/1a9846599b6a71faf330845847a30f6bf9735898) ([#2469](https://github.com/tauri-apps/plugins-workspace/pull/2469) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Update `objc2` crate to 0.6. No user facing changes. +- [`71f95c9f`](https://github.com/tauri-apps/plugins-workspace/commit/71f95c9f05b29cf1be586849614c0b007757c15d) ([#2445](https://github.com/tauri-apps/plugins-workspace/pull/2445) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Updated `windows` crate to 0.60 to match Tauri 2.3.0. No user facing changes. + +## \[2.2.5] + +- [`5b821181`](https://github.com/tauri-apps/plugins-workspace/commit/5b8211815825ddae2dcc0c00520e0cfdff002763) ([#2332](https://github.com/tauri-apps/plugins-workspace/pull/2332) by [@betamos](https://github.com/tauri-apps/plugins-workspace/../../betamos)) Fix broken JS commands `opener.openPath` and `opener.openUrl` on mobile. + +## \[2.2.4] + +- [`da5c59e2`](https://github.com/tauri-apps/plugins-workspace/commit/da5c59e2fe879d177e3cfd52fcacce85440423cb) ([#2271](https://github.com/tauri-apps/plugins-workspace/pull/2271) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Updated `zbus` dependency to version 5. No API changes. + +## \[2.2.3] + +- [`a9ac1e3c`](https://github.com/tauri-apps/plugins-workspace/commit/a9ac1e3c939cec4338a9422ef02323c1d4dde6cd) ([#2253](https://github.com/tauri-apps/plugins-workspace/pull/2253) by [@betamos](https://github.com/tauri-apps/plugins-workspace/../../betamos)) Return an error in `open_path` if the file does not exist when opening with default application. + +## \[2.2.2] + +- [`ee0f65de`](https://github.com/tauri-apps/plugins-workspace/commit/ee0f65de5c645c244c5f0b638e0e0aab687cb9bf) ([#2207](https://github.com/tauri-apps/plugins-workspace/pull/2207) by [@universalappfactory](https://github.com/tauri-apps/plugins-workspace/../../universalappfactory)) Fixed OpenerPlugin packagename for android + +## \[2.2.1] + +- [`18dffc9d`](https://github.com/tauri-apps/plugins-workspace/commit/18dffc9dfecaf0c900e233e041d9ca36c92834b5) ([#2189](https://github.com/tauri-apps/plugins-workspace/pull/2189) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Fix usage on iOS. + +## \[2.2.0] + +- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other. + +## \[2.0.0] + +- [`383e636a`](https://github.com/tauri-apps/plugins-workspace/commit/383e636a8e595aec1300999a8aeb7d9bf8c14632) ([#2019](https://github.com/tauri-apps/plugins-workspace/pull/2019) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Initial Release diff --git a/plugins/opener/Cargo.toml b/plugins/opener/Cargo.toml new file mode 100644 index 00000000..4ea4ec57 --- /dev/null +++ b/plugins/opener/Cargo.toml @@ -0,0 +1,67 @@ +[package] +name = "tauri-plugin-opener" +version = "2.2.6" +description = "Open files and URLs using their default application." +edition = { workspace = true } +authors = { workspace = true } +license = { workspace = true } +repository = { workspace = true } +links = "tauri-plugin-opener" + +[package.metadata.docs.rs] +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs"] + +# Platforms supported by the plugin +# Support levels are "full", "partial", "none", "unknown" +# Details of the support level are left to plugin maintainer +[package.metadata.platforms.support] +windows = { level = "full", notes = "" } +linux = { level = "full", notes = "" } +macos = { level = "full", notes = "" } +android = { level = "partial", notes = "Only allows to open URLs via `open`" } +ios = { level = "partial", notes = "Only allows to open URLs via `open`" } + + +[build-dependencies] +tauri-plugin = { workspace = true, features = ["build"] } +schemars = { workspace = true } +serde = { workspace = true } + +[dependencies] +serde = { workspace = true } +serde_json = { workspace = true } +tauri = { workspace = true } +thiserror = { workspace = true } +open = { version = "5", features = ["shellexecute-on-windows"] } +glob = { workspace = true } + +[target."cfg(windows)".dependencies] +dunce = { workspace = true } + +[target."cfg(windows)".dependencies.windows] +version = "0.61" +features = [ + "Win32_Foundation", + "Win32_UI_Shell_Common", + "Win32_UI_WindowsAndMessaging", + "Win32_System_Com", + "Win32_System_Registry", +] + +[target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"netbsd\", target_os = \"openbsd\"))".dependencies] +zbus = { workspace = true } +url = { workspace = true } + +[target."cfg(target_os = \"macos\")".dependencies.objc2-app-kit] +version = "0.3" +default-features = false +features = ["std", "NSWorkspace"] + +[target."cfg(target_os = \"macos\")".dependencies.objc2-foundation] +version = "0.3" +default-features = false +features = ["std", "NSURL", "NSArray", "NSString"] + +[target.'cfg(target_os = "ios")'.dependencies] +tauri = { workspace = true, features = ["wry"] } diff --git a/plugins/opener/LICENSE.spdx b/plugins/opener/LICENSE.spdx new file mode 100644 index 00000000..cdd0df5a --- /dev/null +++ b/plugins/opener/LICENSE.spdx @@ -0,0 +1,20 @@ +SPDXVersion: SPDX-2.1 +DataLicense: CC0-1.0 +PackageName: tauri +DataFormat: SPDXRef-1 +PackageSupplier: Organization: The Tauri Programme in the Commons Conservancy +PackageHomePage: https://tauri.app +PackageLicenseDeclared: Apache-2.0 +PackageLicenseDeclared: MIT +PackageCopyrightText: 2019-2022, The Tauri Programme in the Commons Conservancy +PackageSummary: Tauri is a rust project that enables developers to make secure +and small desktop applications using a web frontend. + +PackageComment: The package includes the following libraries; see +Relationship information. + +Created: 2019-05-20T09:00:00Z +PackageDownloadLocation: git://github.com/tauri-apps/tauri +PackageDownloadLocation: git+https://github.com/tauri-apps/tauri.git +PackageDownloadLocation: git+ssh://github.com/tauri-apps/tauri.git +Creator: Person: Daniel Thompson-Yvetot \ No newline at end of file diff --git a/plugins/opener/LICENSE_APACHE-2.0 b/plugins/opener/LICENSE_APACHE-2.0 new file mode 100644 index 00000000..4947287f --- /dev/null +++ b/plugins/opener/LICENSE_APACHE-2.0 @@ -0,0 +1,177 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/plugins/opener/LICENSE_MIT b/plugins/opener/LICENSE_MIT new file mode 100644 index 00000000..4d754725 --- /dev/null +++ b/plugins/opener/LICENSE_MIT @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 - Present Tauri Apps Contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/plugins/opener/README.md b/plugins/opener/README.md new file mode 100644 index 00000000..71509eaa --- /dev/null +++ b/plugins/opener/README.md @@ -0,0 +1,145 @@ +![opener](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/opener/banner.png) + + + +| Platform | Supported | +| -------- | --------- | +| Linux | ✓ | +| Windows | ✓ | +| macOS | ✓ | +| Android | ? | +| iOS | ? | + +## Install + +_This plugin requires a Rust version of at least **1.77.2**_ + +There are three general methods of installation that we can recommend. + +1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked) +2. Pull sources directly from Github using git tags / revision hashes (most secure) +3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use) + +Install the Core plugin by adding the following to your `Cargo.toml` file: + +`src-tauri/Cargo.toml` + +```toml +[dependencies] +tauri-plugin-opener = "2.0.0" +# alternatively with Git: +tauri-plugin-opener = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } +``` + +You can install the JavaScript Guest bindings using your preferred JavaScript package manager: + +> Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use. + + + +```sh +pnpm add @tauri-apps/plugin-opener +# or +npm add @tauri-apps/plugin-opener +# or +yarn add @tauri-apps/plugin-opener + +# alternatively with Git: +pnpm add https://github.com/tauri-apps/tauri-plugin-opener#v2 +# or +npm add https://github.com/tauri-apps/tauri-plugin-opener#v2 +# or +yarn add https://github.com/tauri-apps/tauri-plugin-opener#v2 +``` + +## Usage + +First you need to register the core plugin with Tauri: + +`src-tauri/src/lib.rs` + +```rust +fn main() { + tauri::Builder::default() + .plugin(tauri_plugin_opener::init()) + .run(tauri::generate_context!()) + .expect("error while running tauri application"); +} +``` + +Afterwards all the plugin's APIs are available through the JavaScript guest bindings: + +```javascript +import { openUrl, openPath, revealItemInDir } from '@tauri-apps/plugin-opener' + +// Opens the URL in the default browser +await openUrl('https://example.com') +// Or with a specific browser/app +await openUrl('https://example.com', 'firefox') + +// Opens the path with the system's default app +await openPath('/path/to/file') +// Or with a specific app +await openPath('/path/to/file', 'firefox') + +// Reveal a path with the system's default explorer +await revealItemInDir('/path/to/file') +``` + +### Usage from Rust + +You can also use those APIs from Rust: + +```rust +use tauri_plugin_opener::OpenerExt; + +fn main() { + tauri::Builder::default() + .plugin(tauri_plugin_opener::init()) + .setup(|app| { + let opener = app.opener(); + + // Opens the URL in the default browser + opener.open_url("https://example.com", None::<&str>)?; + // Or with a specific browser/app + opener.open_url("https://example.com", Some("firefox"))?; + + // Opens the path with the system's default app + opener.open_path("/path/to/file", None::<&str>)?; + // Or with a specific app + opener.open_path("/path/to/file", Some("firefox"))?; + + // Reveal a path with the system's default explorer + opener.reveal_item_in_dir("/path/to/file")?; + Ok(()) + }) + .run(tauri::generate_context!()) + .expect("error while running tauri application"); +} +``` + +## Contributing + +PRs accepted. Please make sure to read the Contributing Guide before making a pull request. + +## Partners + + + + + + + +
+ + CrabNebula + +
+ +For the complete list of sponsors please visit our [website](https://tauri.app#sponsors) and [Open Collective](https://opencollective.com/tauri). + +## License + +Code: (c) 2015 - Present - The Tauri Programme within The Commons Conservancy. + +MIT or MIT/Apache 2.0 where applicable. diff --git a/plugins/opener/SECURITY.md b/plugins/opener/SECURITY.md new file mode 100644 index 00000000..4f09bbac --- /dev/null +++ b/plugins/opener/SECURITY.md @@ -0,0 +1,23 @@ +# Security Policy + +**Do not report security vulnerabilities through public GitHub issues.** + +**Please use the [Private Vulnerability Disclosure](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability) feature of GitHub.** + +Include as much of the following information: + +- Type of issue (e.g. improper input parsing, privilege escalation, etc.) +- The location of the affected source code (tag/branch/commit or direct URL) +- Any special configuration required to reproduce the issue +- The distribution affected or used to help us with reproduction of the issue +- Step-by-step instructions to reproduce the issue +- Ideally a reproduction repository +- Impact of the issue, including how an attacker might exploit the issue + +We prefer to receive reports in English. + +## Contact + +Please disclose a vulnerability or security relevant issue here: [https://github.com/tauri-apps/plugins-workspace/security/advisories/new](https://github.com/tauri-apps/plugins-workspace/security/advisories/new). + +Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app). diff --git a/plugins/deep-link/.gitignore b/plugins/opener/android/.gitignore similarity index 53% rename from plugins/deep-link/.gitignore rename to plugins/opener/android/.gitignore index 1b0b469d..c0f21ec2 100644 --- a/plugins/deep-link/.gitignore +++ b/plugins/opener/android/.gitignore @@ -1 +1,2 @@ +/build /.tauri diff --git a/plugins/opener/android/build.gradle.kts b/plugins/opener/android/build.gradle.kts new file mode 100644 index 00000000..9dcce212 --- /dev/null +++ b/plugins/opener/android/build.gradle.kts @@ -0,0 +1,39 @@ +plugins { + id("com.android.library") + id("org.jetbrains.kotlin.android") +} + +android { + namespace = "app.tauri.opener" + compileSdk = 34 + + defaultConfig { + minSdk = 24 + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles("consumer-rules.pro") + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = "1.8" + } +} + +dependencies { + implementation("androidx.core:core-ktx:1.9.0") + implementation("com.fasterxml.jackson.core:jackson-databind:2.15.3") + implementation(project(":tauri-android")) +} diff --git a/plugins/opener/android/proguard-rules.pro b/plugins/opener/android/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/plugins/opener/android/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/plugins/opener/android/settings.gradle b/plugins/opener/android/settings.gradle new file mode 100644 index 00000000..14a752e4 --- /dev/null +++ b/plugins/opener/android/settings.gradle @@ -0,0 +1,2 @@ +include ':tauri-android' +project(':tauri-android').projectDir = new File('./.tauri/tauri-api') diff --git a/plugins/opener/android/src/main/AndroidManifest.xml b/plugins/opener/android/src/main/AndroidManifest.xml new file mode 100644 index 00000000..9a40236b --- /dev/null +++ b/plugins/opener/android/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/plugins/opener/android/src/main/java/OpenerPlugin.kt b/plugins/opener/android/src/main/java/OpenerPlugin.kt new file mode 100644 index 00000000..16b76032 --- /dev/null +++ b/plugins/opener/android/src/main/java/OpenerPlugin.kt @@ -0,0 +1,30 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +package app.tauri.opener + +import android.app.Activity +import android.content.Intent +import android.net.Uri +import app.tauri.annotation.Command +import app.tauri.annotation.TauriPlugin +import app.tauri.plugin.Invoke +import app.tauri.plugin.Plugin +import java.io.File + +@TauriPlugin +class OpenerPlugin(private val activity: Activity) : Plugin(activity) { + @Command + fun open(invoke: Invoke) { + try { + val url = invoke.parseArgs(String::class.java) + val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url)) + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + activity.applicationContext?.startActivity(intent) + invoke.resolve() + } catch (ex: Exception) { + invoke.reject(ex.message) + } + } +} diff --git a/plugins/opener/api-iife.js b/plugins/opener/api-iife.js new file mode 100644 index 00000000..30415a61 --- /dev/null +++ b/plugins/opener/api-iife.js @@ -0,0 +1 @@ +if("__TAURI__"in window){var __TAURI_PLUGIN_OPENER__=function(n){"use strict";async function e(n,e={},_){return window.__TAURI_INTERNALS__.invoke(n,e,_)}return"function"==typeof SuppressedError&&SuppressedError,n.openPath=async function(n,_){await e("plugin:opener|open_path",{path:n,with:_})},n.openUrl=async function(n,_){await e("plugin:opener|open_url",{url:n,with:_})},n.revealItemInDir=async function(n){return e("plugin:opener|reveal_item_in_dir",{path:n})},n}({});Object.defineProperty(window.__TAURI__,"opener",{value:__TAURI_PLUGIN_OPENER__})} diff --git a/plugins/opener/build.rs b/plugins/opener/build.rs new file mode 100644 index 00000000..fbad4d3a --- /dev/null +++ b/plugins/opener/build.rs @@ -0,0 +1,136 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use std::path::PathBuf; + +#[path = "src/scope_entry.rs"] +#[allow(dead_code)] +mod scope; + +/// Opener scope application. +#[derive(schemars::JsonSchema)] +#[serde(untagged)] +#[allow(unused)] +enum Application { + /// Open in default application. + Default, + /// If true, allow open with any application. + Enable(bool), + /// Allow specific application to open with. + App(String), +} + +impl Default for Application { + fn default() -> Self { + Self::Default + } +} + +/// Opener scope entry. +#[derive(schemars::JsonSchema)] +#[serde(untagged)] +#[allow(unused)] +enum OpenerScopeEntry { + Url { + /// A URL that can be opened by the webview when using the Opener APIs. + /// + /// Wildcards can be used following the UNIX glob pattern. + /// + /// Examples: + /// + /// - "https://*" : allows all HTTPS origin + /// + /// - "https://*.github.com/tauri-apps/tauri": allows any subdomain of "github.com" with the "tauri-apps/api" path + /// + /// - "https://myapi.service.com/users/*": allows access to any URLs that begins with "https://myapi.service.com/users/" + url: String, + /// An application to open this url with, for example: firefox. + #[serde(default)] + app: Application, + }, + Path { + /// A path that can be opened by the webview when using the Opener APIs. + /// + /// The pattern can start with a variable that resolves to a system base directory. + /// The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, + /// `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, + /// `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, + /// `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`. + path: PathBuf, + /// An application to open this path with, for example: xdg-open. + #[serde(default)] + app: Application, + }, +} + +// Ensure `OpenerScopeEntry` and `scope::EntryRaw` is kept in sync +fn _f() { + match (scope::EntryRaw::Url { + url: String::new(), + app: scope::Application::Enable(true), + }) { + scope::EntryRaw::Url { url, app } => OpenerScopeEntry::Url { + url, + app: match app { + scope::Application::Enable(p) => Application::Enable(p), + scope::Application::App(p) => Application::App(p), + scope::Application::Default => Application::Default, + }, + }, + scope::EntryRaw::Path { path, app } => OpenerScopeEntry::Path { + path, + app: match app { + scope::Application::Enable(p) => Application::Enable(p), + scope::Application::App(p) => Application::App(p), + scope::Application::Default => Application::Default, + }, + }, + }; + match (OpenerScopeEntry::Url { + url: String::new(), + app: Application::Enable(true), + }) { + OpenerScopeEntry::Url { url, app } => scope::EntryRaw::Url { + url, + app: match app { + Application::Enable(p) => scope::Application::Enable(p), + Application::App(p) => scope::Application::App(p), + Application::Default => scope::Application::Default, + }, + }, + OpenerScopeEntry::Path { path, app } => scope::EntryRaw::Path { + path, + app: match app { + Application::Enable(p) => scope::Application::Enable(p), + Application::App(p) => scope::Application::App(p), + Application::Default => scope::Application::Default, + }, + }, + }; +} + +const COMMANDS: &[&str] = &["open_url", "open_path", "reveal_item_in_dir"]; + +fn main() { + tauri_plugin::Builder::new(COMMANDS) + .global_api_script_path("./api-iife.js") + .android_path("android") + .ios_path("ios") + .global_scope_schema(schemars::schema_for!(OpenerScopeEntry)) + .build(); + + let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap(); + let mobile = target_os == "ios" || target_os == "android"; + alias("desktop", !mobile); + alias("mobile", mobile); +} + +// creates a cfg alias if `has_feature` is true. +// `alias` must be a snake case string. +fn alias(alias: &str, has_feature: bool) { + println!("cargo:rustc-check-cfg=cfg({alias})"); + if has_feature { + println!("cargo:rustc-cfg={alias}"); + } +} diff --git a/plugins/opener/guest-js/index.ts b/plugins/opener/guest-js/index.ts new file mode 100644 index 00000000..ade956a6 --- /dev/null +++ b/plugins/opener/guest-js/index.ts @@ -0,0 +1,92 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +/** + * Open files and URLs using their default application. + * + * ## Security + * + * This API has a scope configuration that forces you to restrict the files and urls to be opened. + * + * ### Restricting access to the {@link open | `open`} API + * + * On the configuration object, `open: true` means that the {@link open} API can be used with any URL, + * as the argument is validated with the `^((mailto:\w+)|(tel:\w+)|(https?://\w+)).+` regex. + * You can change that regex by changing the boolean value to a string, e.g. `open: ^https://github.com/`. + * + * @module + */ + +import { invoke } from '@tauri-apps/api/core' + +/** + * Opens a url with the system's default app, or the one specified with {@linkcode openWith}. + * + * @example + * ```typescript + * import { openUrl } from '@tauri-apps/plugin-opener'; + * + * // opens the given URL on the default browser: + * await openUrl('https://github.com/tauri-apps/tauri'); + * // opens the given URL using `firefox`: + * await openUrl('https://github.com/tauri-apps/tauri', 'firefox'); + * ``` + * + * @param url The URL to open. + * @param openWith The app to open the URL with. If not specified, defaults to the system default application for the specified url type. + * + * @since 2.0.0 + */ +export async function openUrl(url: string, openWith?: string): Promise { + await invoke('plugin:opener|open_url', { + url, + with: openWith + }) +} + +/** + * Opens a path with the system's default app, or the one specified with {@linkcode openWith}. + * + * @example + * ```typescript + * import { openPath } from '@tauri-apps/plugin-opener'; + * + * // opens a file using the default program: + * await openPath('/path/to/file'); + * // opens a file using `vlc` command on Windows. + * await openPath('C:/path/to/file', 'vlc'); + * ``` + * + * @param path The path to open. + * @param openWith The app to open the path with. If not specified, defaults to the system default application for the specified path type. + * + * @since 2.0.0 + */ +export async function openPath(path: string, openWith?: string): Promise { + await invoke('plugin:opener|open_path', { + path, + with: openWith + }) +} + +/** + * Reveal a path with the system's default explorer. + * + * #### Platform-specific: + * + * - **Android / iOS:** Unsupported. + * + * @example + * ```typescript + * import { revealItemInDir } from '@tauri-apps/plugin-opener'; + * await revealItemInDir('/path/to/file'); + * ``` + * + * @param path The path to reveal. + * + * @since 2.0.0 + */ +export async function revealItemInDir(path: string) { + return invoke('plugin:opener|reveal_item_in_dir', { path }) +} diff --git a/plugins/opener/guest-js/init.ts b/plugins/opener/guest-js/init.ts new file mode 100644 index 00000000..6f81141a --- /dev/null +++ b/plugins/opener/guest-js/init.ts @@ -0,0 +1,61 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +import { invoke } from '@tauri-apps/api/core' + +// open
links with the API +window.addEventListener('click', function (evt) { + // return early if + if ( + // event was prevented + evt.defaultPrevented + // or not a left click + || evt.button !== 0 + // or meta key pressed + || evt.metaKey + // or al key pressed + || evt.altKey + ) + return + + const a = evt + .composedPath() + .find((el) => el instanceof Node && el.nodeName.toUpperCase() === 'A') as + | HTMLAnchorElement + | undefined + + // return early if + if ( + // not tirggered from element + !a + // or doesn't have a href + || !a.href + // or not supposed to be open in a new tab + || !( + a.target === '_blank' + // or ctrl key pressed + || evt.ctrlKey + // or shift key pressed + || evt.shiftKey + ) + ) + return + + const url = new URL(a.href) + + // return early if + if ( + // same origin (internal navigation) + url.origin === window.location.origin + // not default protocols + || ['http:', 'https:', 'mailto:', 'tel:'].every((p) => url.protocol !== p) + ) + return + + evt.preventDefault() + + void invoke('plugin:opener|open_url', { + url + }) +}) diff --git a/plugins/opener/ios/Package.resolved b/plugins/opener/ios/Package.resolved new file mode 100644 index 00000000..5f998e0e --- /dev/null +++ b/plugins/opener/ios/Package.resolved @@ -0,0 +1,16 @@ +{ + "object": { + "pins": [ + { + "package": "SwiftRs", + "repositoryURL": "https://github.com/Brendonovich/swift-rs", + "state": { + "branch": null, + "revision": "b5ed223fcdab165bc21219c1925dc1e77e2bef5e", + "version": "1.0.6" + } + } + ] + }, + "version": 1 +} diff --git a/plugins/opener/ios/Package.swift b/plugins/opener/ios/Package.swift new file mode 100644 index 00000000..8d06936e --- /dev/null +++ b/plugins/opener/ios/Package.swift @@ -0,0 +1,34 @@ +// swift-tools-version:5.3 +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +import PackageDescription + +let package = Package( + name: "tauri-plugin-opener", + platforms: [ + .macOS(.v10_13), + .iOS(.v13), + ], + products: [ + // Products define the executables and libraries a package produces, and make them visible to other packages. + .library( + name: "tauri-plugin-opener", + type: .static, + targets: ["tauri-plugin-opener"]) + ], + dependencies: [ + .package(name: "Tauri", path: "../.tauri/tauri-api") + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages this package depends on. + .target( + name: "tauri-plugin-opener", + dependencies: [ + .byName(name: "Tauri") + ], + path: "Sources") + ] +) diff --git a/plugins/opener/ios/Sources/OpenerPlugin.swift b/plugins/opener/ios/Sources/OpenerPlugin.swift new file mode 100644 index 00000000..81ff76b4 --- /dev/null +++ b/plugins/opener/ios/Sources/OpenerPlugin.swift @@ -0,0 +1,32 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +import Foundation +import SwiftRs +import Tauri +import UIKit +import WebKit + +class OpenerPlugin: Plugin { + @objc public func open(_ invoke: Invoke) throws { + do { + let urlString = try invoke.parseArgs(String.self) + if let url = URL(string: urlString) { + if #available(iOS 10, *) { + UIApplication.shared.open(url, options: [:]) + } else { + UIApplication.shared.openURL(url) + } + } + invoke.resolve() + } catch { + invoke.reject(error.localizedDescription) + } + } +} + +@_cdecl("init_plugin_opener") +func initPlugin() -> Plugin { + return OpenerPlugin() +} diff --git a/plugins/opener/package.json b/plugins/opener/package.json new file mode 100644 index 00000000..9d828d44 --- /dev/null +++ b/plugins/opener/package.json @@ -0,0 +1,30 @@ +{ + "name": "@tauri-apps/plugin-opener", + "version": "2.2.6", + "description": "Open files and URLs using their default application.", + "license": "MIT OR Apache-2.0", + "authors": [ + "Tauri Programme within The Commons Conservancy" + ], + "repository": "https://github.com/tauri-apps/plugins-workspace", + "type": "module", + "types": "./dist-js/index.d.ts", + "main": "./dist-js/index.cjs", + "module": "./dist-js/index.js", + "exports": { + "types": "./dist-js/index.d.ts", + "import": "./dist-js/index.js", + "require": "./dist-js/index.cjs" + }, + "scripts": { + "build": "rollup -c" + }, + "files": [ + "dist-js", + "README.md", + "LICENSE" + ], + "dependencies": { + "@tauri-apps/api": "^2.0.0" + } +} diff --git a/plugins/opener/permissions/allow-default-urls.toml b/plugins/opener/permissions/allow-default-urls.toml new file mode 100644 index 00000000..93495b89 --- /dev/null +++ b/plugins/opener/permissions/allow-default-urls.toml @@ -0,0 +1,17 @@ +"$schema" = "schemas/schema.json" + +[[permission]] +identifier = "allow-default-urls" +description = "This enables opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application." + +[[permission.scope.allow]] +url = "mailto:*" + +[[permission.scope.allow]] +url = "tel:*" + +[[permission.scope.allow]] +url = "http://*" + +[[permission.scope.allow]] +url = "https://*" diff --git a/plugins/opener/permissions/autogenerated/commands/open_path.toml b/plugins/opener/permissions/autogenerated/commands/open_path.toml new file mode 100644 index 00000000..ae67b939 --- /dev/null +++ b/plugins/opener/permissions/autogenerated/commands/open_path.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-open-path" +description = "Enables the open_path command without any pre-configured scope." +commands.allow = ["open_path"] + +[[permission]] +identifier = "deny-open-path" +description = "Denies the open_path command without any pre-configured scope." +commands.deny = ["open_path"] diff --git a/plugins/opener/permissions/autogenerated/commands/open_url.toml b/plugins/opener/permissions/autogenerated/commands/open_url.toml new file mode 100644 index 00000000..f1e694b1 --- /dev/null +++ b/plugins/opener/permissions/autogenerated/commands/open_url.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-open-url" +description = "Enables the open_url command without any pre-configured scope." +commands.allow = ["open_url"] + +[[permission]] +identifier = "deny-open-url" +description = "Denies the open_url command without any pre-configured scope." +commands.deny = ["open_url"] diff --git a/plugins/opener/permissions/autogenerated/commands/reveal_item_in_dir.toml b/plugins/opener/permissions/autogenerated/commands/reveal_item_in_dir.toml new file mode 100644 index 00000000..e669620f --- /dev/null +++ b/plugins/opener/permissions/autogenerated/commands/reveal_item_in_dir.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-reveal-item-in-dir" +description = "Enables the reveal_item_in_dir command without any pre-configured scope." +commands.allow = ["reveal_item_in_dir"] + +[[permission]] +identifier = "deny-reveal-item-in-dir" +description = "Denies the reveal_item_in_dir command without any pre-configured scope." +commands.deny = ["reveal_item_in_dir"] diff --git a/plugins/opener/permissions/autogenerated/reference.md b/plugins/opener/permissions/autogenerated/reference.md new file mode 100644 index 00000000..6ad6ba1f --- /dev/null +++ b/plugins/opener/permissions/autogenerated/reference.md @@ -0,0 +1,111 @@ +## Default Permission + +This permission set allows opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application +as well as reveal file in directories using default file explorer + +#### This default permission set includes the following: + +- `allow-open-url` +- `allow-reveal-item-in-dir` +- `allow-default-urls` + +## Permission Table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IdentifierDescription
+ +`opener:allow-default-urls` + + + +This enables opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application. + +
+ +`opener:allow-open-path` + + + +Enables the open_path command without any pre-configured scope. + +
+ +`opener:deny-open-path` + + + +Denies the open_path command without any pre-configured scope. + +
+ +`opener:allow-open-url` + + + +Enables the open_url command without any pre-configured scope. + +
+ +`opener:deny-open-url` + + + +Denies the open_url command without any pre-configured scope. + +
+ +`opener:allow-reveal-item-in-dir` + + + +Enables the reveal_item_in_dir command without any pre-configured scope. + +
+ +`opener:deny-reveal-item-in-dir` + + + +Denies the reveal_item_in_dir command without any pre-configured scope. + +
diff --git a/plugins/opener/permissions/default.toml b/plugins/opener/permissions/default.toml new file mode 100644 index 00000000..846d6e51 --- /dev/null +++ b/plugins/opener/permissions/default.toml @@ -0,0 +1,10 @@ +"$schema" = "schemas/schema.json" + +[default] +description = """This permission set allows opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application +as well as reveal file in directories using default file explorer""" +permissions = [ + "allow-open-url", + "allow-reveal-item-in-dir", + "allow-default-urls", +] diff --git a/plugins/opener/permissions/schemas/schema.json b/plugins/opener/permissions/schemas/schema.json new file mode 100644 index 00000000..78c80ba3 --- /dev/null +++ b/plugins/opener/permissions/schemas/schema.json @@ -0,0 +1,348 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PermissionFile", + "description": "Permission file that can define a default permission, a set of permissions or a list of inlined permissions.", + "type": "object", + "properties": { + "default": { + "description": "The default permission set for the plugin", + "anyOf": [ + { + "$ref": "#/definitions/DefaultPermission" + }, + { + "type": "null" + } + ] + }, + "set": { + "description": "A list of permissions sets defined", + "type": "array", + "items": { + "$ref": "#/definitions/PermissionSet" + } + }, + "permission": { + "description": "A list of inlined permissions", + "default": [], + "type": "array", + "items": { + "$ref": "#/definitions/Permission" + } + } + }, + "definitions": { + "DefaultPermission": { + "description": "The default permission set of the plugin.\n\nWorks similarly to a permission with the \"default\" identifier.", + "type": "object", + "required": [ + "permissions" + ], + "properties": { + "version": { + "description": "The version of the permission.", + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 1.0 + }, + "description": { + "description": "Human-readable description of what the permission does. Tauri convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", + "type": [ + "string", + "null" + ] + }, + "permissions": { + "description": "All permissions this set contains.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "PermissionSet": { + "description": "A set of direct permissions grouped together under a new name.", + "type": "object", + "required": [ + "description", + "identifier", + "permissions" + ], + "properties": { + "identifier": { + "description": "A unique identifier for the permission.", + "type": "string" + }, + "description": { + "description": "Human-readable description of what the permission does.", + "type": "string" + }, + "permissions": { + "description": "All permissions this set contains.", + "type": "array", + "items": { + "$ref": "#/definitions/PermissionKind" + } + } + } + }, + "Permission": { + "description": "Descriptions of explicit privileges of commands.\n\nIt can enable commands to be accessible in the frontend of the application.\n\nIf the scope is defined it can be used to fine grain control the access of individual or multiple commands.", + "type": "object", + "required": [ + "identifier" + ], + "properties": { + "version": { + "description": "The version of the permission.", + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 1.0 + }, + "identifier": { + "description": "A unique identifier for the permission.", + "type": "string" + }, + "description": { + "description": "Human-readable description of what the permission does. Tauri internal convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", + "type": [ + "string", + "null" + ] + }, + "commands": { + "description": "Allowed or denied commands when using this permission.", + "default": { + "allow": [], + "deny": [] + }, + "allOf": [ + { + "$ref": "#/definitions/Commands" + } + ] + }, + "scope": { + "description": "Allowed or denied scoped when using this permission.", + "allOf": [ + { + "$ref": "#/definitions/Scopes" + } + ] + }, + "platforms": { + "description": "Target platforms this permission applies. By default all platforms are affected by this permission.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Target" + } + } + } + }, + "Commands": { + "description": "Allowed and denied commands inside a permission.\n\nIf two commands clash inside of `allow` and `deny`, it should be denied by default.", + "type": "object", + "properties": { + "allow": { + "description": "Allowed command.", + "default": [], + "type": "array", + "items": { + "type": "string" + } + }, + "deny": { + "description": "Denied command, which takes priority.", + "default": [], + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "Scopes": { + "description": "An argument for fine grained behavior control of Tauri commands.\n\nIt can be of any serde serializable type and is used to allow or prevent certain actions inside a Tauri command. The configured scope is passed to the command and will be enforced by the command implementation.\n\n## Example\n\n```json { \"allow\": [{ \"path\": \"$HOME/**\" }], \"deny\": [{ \"path\": \"$HOME/secret.txt\" }] } ```", + "type": "object", + "properties": { + "allow": { + "description": "Data that defines what is allowed by the scope.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + }, + "deny": { + "description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + "Value": { + "description": "All supported ACL values.", + "anyOf": [ + { + "description": "Represents a null JSON value.", + "type": "null" + }, + { + "description": "Represents a [`bool`].", + "type": "boolean" + }, + { + "description": "Represents a valid ACL [`Number`].", + "allOf": [ + { + "$ref": "#/definitions/Number" + } + ] + }, + { + "description": "Represents a [`String`].", + "type": "string" + }, + { + "description": "Represents a list of other [`Value`]s.", + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + }, + { + "description": "Represents a map of [`String`] keys to [`Value`]s.", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/Value" + } + } + ] + }, + "Number": { + "description": "A valid ACL number.", + "anyOf": [ + { + "description": "Represents an [`i64`].", + "type": "integer", + "format": "int64" + }, + { + "description": "Represents a [`f64`].", + "type": "number", + "format": "double" + } + ] + }, + "Target": { + "description": "Platform target.", + "oneOf": [ + { + "description": "MacOS.", + "type": "string", + "enum": [ + "macOS" + ] + }, + { + "description": "Windows.", + "type": "string", + "enum": [ + "windows" + ] + }, + { + "description": "Linux.", + "type": "string", + "enum": [ + "linux" + ] + }, + { + "description": "Android.", + "type": "string", + "enum": [ + "android" + ] + }, + { + "description": "iOS.", + "type": "string", + "enum": [ + "iOS" + ] + } + ] + }, + "PermissionKind": { + "type": "string", + "oneOf": [ + { + "description": "This enables opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application.", + "type": "string", + "const": "allow-default-urls", + "markdownDescription": "This enables opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application." + }, + { + "description": "Enables the open_path command without any pre-configured scope.", + "type": "string", + "const": "allow-open-path", + "markdownDescription": "Enables the open_path command without any pre-configured scope." + }, + { + "description": "Denies the open_path command without any pre-configured scope.", + "type": "string", + "const": "deny-open-path", + "markdownDescription": "Denies the open_path command without any pre-configured scope." + }, + { + "description": "Enables the open_url command without any pre-configured scope.", + "type": "string", + "const": "allow-open-url", + "markdownDescription": "Enables the open_url command without any pre-configured scope." + }, + { + "description": "Denies the open_url command without any pre-configured scope.", + "type": "string", + "const": "deny-open-url", + "markdownDescription": "Denies the open_url command without any pre-configured scope." + }, + { + "description": "Enables the reveal_item_in_dir command without any pre-configured scope.", + "type": "string", + "const": "allow-reveal-item-in-dir", + "markdownDescription": "Enables the reveal_item_in_dir command without any pre-configured scope." + }, + { + "description": "Denies the reveal_item_in_dir command without any pre-configured scope.", + "type": "string", + "const": "deny-reveal-item-in-dir", + "markdownDescription": "Denies the reveal_item_in_dir command without any pre-configured scope." + }, + { + "description": "This permission set allows opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application\nas well as reveal file in directories using default file explorer\n#### This default permission set includes:\n\n- `allow-open-url`\n- `allow-reveal-item-in-dir`\n- `allow-default-urls`", + "type": "string", + "const": "default", + "markdownDescription": "This permission set allows opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application\nas well as reveal file in directories using default file explorer\n#### This default permission set includes:\n\n- `allow-open-url`\n- `allow-reveal-item-in-dir`\n- `allow-default-urls`" + } + ] + } + } +} \ No newline at end of file diff --git a/plugins/opener/rollup.config.js b/plugins/opener/rollup.config.js new file mode 100644 index 00000000..a7dbd4f6 --- /dev/null +++ b/plugins/opener/rollup.config.js @@ -0,0 +1,22 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +import { createConfig } from '../../shared/rollup.config.js' +import { nodeResolve } from '@rollup/plugin-node-resolve' +import typescript from '@rollup/plugin-typescript' +import terser from '@rollup/plugin-terser' + +export default createConfig({ + additionalConfigs: { + input: 'guest-js/init.ts', + output: { + file: 'src/init-iife.js', + format: 'iife' + }, + plugins: [typescript(), terser(), nodeResolve()], + onwarn: (warning) => { + throw Object.assign(new Error(), warning) + } + } +}) diff --git a/plugins/opener/src/commands.rs b/plugins/opener/src/commands.rs new file mode 100644 index 00000000..b00d5306 --- /dev/null +++ b/plugins/opener/src/commands.rs @@ -0,0 +1,75 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use std::path::{Path, PathBuf}; + +use tauri::{ + ipc::{CommandScope, GlobalScope}, + AppHandle, Runtime, +}; + +use crate::{scope::Scope, Error, OpenerExt}; + +#[tauri::command] +pub async fn open_url( + app: AppHandle, + command_scope: CommandScope, + global_scope: GlobalScope, + url: String, + with: Option, +) -> crate::Result<()> { + let scope = Scope::new( + &app, + command_scope + .allows() + .iter() + .chain(global_scope.allows()) + .collect(), + command_scope + .denies() + .iter() + .chain(global_scope.denies()) + .collect(), + ); + + if scope.is_url_allowed(&url, with.as_deref()) { + app.opener().open_url(url, with) + } else { + Err(Error::ForbiddenUrl { url, with }) + } +} + +#[tauri::command] +pub async fn open_path( + app: AppHandle, + command_scope: CommandScope, + global_scope: GlobalScope, + path: String, + with: Option, +) -> crate::Result<()> { + let scope = Scope::new( + &app, + command_scope + .allows() + .iter() + .chain(global_scope.allows()) + .collect(), + command_scope + .denies() + .iter() + .chain(global_scope.denies()) + .collect(), + ); + + if scope.is_path_allowed(Path::new(&path), with.as_deref())? { + app.opener().open_path(path, with) + } else { + Err(Error::ForbiddenPath { path, with }) + } +} + +#[tauri::command] +pub async fn reveal_item_in_dir(path: PathBuf) -> crate::Result<()> { + crate::reveal_item_in_dir(path) +} diff --git a/plugins/opener/src/error.rs b/plugins/opener/src/error.rs new file mode 100644 index 00000000..157922fc --- /dev/null +++ b/plugins/opener/src/error.rs @@ -0,0 +1,54 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use std::path::PathBuf; + +use serde::{Serialize, Serializer}; + +#[derive(Debug, thiserror::Error)] +#[non_exhaustive] +pub enum Error { + #[cfg(mobile)] + #[error(transparent)] + PluginInvoke(#[from] tauri::plugin::mobile::PluginInvokeError), + #[error(transparent)] + Tauri(#[from] tauri::Error), + #[error(transparent)] + Io(#[from] std::io::Error), + #[error(transparent)] + Json(#[from] serde_json::Error), + #[error("unknown program {0}")] + UnknownProgramName(String), + #[error("Not allowed to open path {}{}", .path, .with.as_ref().map(|w| format!(" with {w}")).unwrap_or_default())] + ForbiddenPath { path: String, with: Option }, + #[error("Not allowed to open url {}{}", .url, .with.as_ref().map(|w| format!(" with {w}")).unwrap_or_default())] + ForbiddenUrl { url: String, with: Option }, + #[error("API not supported on the current platform")] + UnsupportedPlatform, + #[error(transparent)] + #[cfg(windows)] + Win32Error(#[from] windows::core::Error), + #[error("Path doesn't have a parent: {0}")] + NoParent(PathBuf), + #[error("Failed to convert path to file:// url")] + FailedToConvertPathToFileUrl, + #[error(transparent)] + #[cfg(any( + target_os = "linux", + target_os = "dragonfly", + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd" + ))] + Zbus(#[from] zbus::Error), +} + +impl Serialize for Error { + fn serialize(&self, serializer: S) -> std::result::Result + where + S: Serializer, + { + serializer.serialize_str(self.to_string().as_ref()) + } +} diff --git a/plugins/opener/src/init-iife.js b/plugins/opener/src/init-iife.js new file mode 100644 index 00000000..51f6f068 --- /dev/null +++ b/plugins/opener/src/init-iife.js @@ -0,0 +1 @@ +!function(){"use strict";"function"==typeof SuppressedError&&SuppressedError,window.addEventListener("click",(function(e){if(e.defaultPrevented||0!==e.button||e.metaKey||e.altKey)return;const t=e.composedPath().find((e=>e instanceof Node&&"A"===e.nodeName.toUpperCase()));if(!t||!t.href||"_blank"!==t.target&&!e.ctrlKey&&!e.shiftKey)return;const n=new URL(t.href);n.origin===window.location.origin||["http:","https:","mailto:","tel:"].every((e=>n.protocol!==e))||(e.preventDefault(),async function(e,t={},n){window.__TAURI_INTERNALS__.invoke(e,t,n)}("plugin:opener|open_url",{url:n}))}))}(); diff --git a/plugins/opener/src/lib.rs b/plugins/opener/src/lib.rs new file mode 100644 index 00000000..9934b0fc --- /dev/null +++ b/plugins/opener/src/lib.rs @@ -0,0 +1,221 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use std::path::Path; + +use tauri::{plugin::TauriPlugin, Manager, Runtime}; + +#[cfg(mobile)] +use tauri::plugin::PluginHandle; +#[cfg(target_os = "android")] +const PLUGIN_IDENTIFIER: &str = "app.tauri.opener"; +#[cfg(target_os = "ios")] +tauri::ios_plugin_binding!(init_plugin_opener); + +mod commands; +mod error; +mod open; +mod reveal_item_in_dir; +mod scope; +mod scope_entry; + +pub use error::Error; +type Result = std::result::Result; + +pub use open::{open_path, open_url}; +pub use reveal_item_in_dir::reveal_item_in_dir; + +pub struct Opener { + // we use `fn() -> R` to slicence the unused generic error + // while keeping this struct `Send + Sync` without requiring `R` to be + #[cfg(not(mobile))] + _marker: std::marker::PhantomData R>, + #[cfg(mobile)] + mobile_plugin_handle: PluginHandle, +} + +impl Opener { + /// Open a url with a default or specific program. + /// + /// # Examples + /// + /// ```rust,no_run + /// use tauri_plugin_opener::OpenerExt; + /// + /// tauri::Builder::default() + /// .setup(|app| { + /// // open the given URL on the system default browser + /// app.opener().open_url("https://github.com/tauri-apps/tauri", None::<&str>)?; + /// Ok(()) + /// }); + /// ``` + /// + /// ## Platform-specific: + /// + /// - **Android / iOS**: Always opens using default program. + #[cfg(desktop)] + pub fn open_url(&self, url: impl Into, with: Option>) -> Result<()> { + crate::open::open(url.into(), with.map(Into::into)) + } + + /// Open a url with a default or specific program. + /// + /// # Examples + /// + /// ```rust,no_run + /// use tauri_plugin_opener::OpenerExt; + /// + /// tauri::Builder::default() + /// .setup(|app| { + /// // open the given URL on the system default browser + /// app.opener().open_url("https://github.com/tauri-apps/tauri", None::<&str>)?; + /// Ok(()) + /// }); + /// ``` + /// + /// ## Platform-specific: + /// + /// - **Android / iOS**: Always opens using default program. + #[cfg(mobile)] + pub fn open_url(&self, url: impl Into, _with: Option>) -> Result<()> { + self.mobile_plugin_handle + .run_mobile_plugin("open", url.into()) + .map_err(Into::into) + } + + /// Open a path with a default or specific program. + /// + /// # Examples + /// + /// ```rust,no_run + /// use tauri_plugin_opener::OpenerExt; + /// + /// tauri::Builder::default() + /// .setup(|app| { + /// // open the given path on the system default explorer + /// app.opener().open_path("/path/to/file", None::<&str>)?; + /// Ok(()) + /// }); + /// ``` + /// + /// ## Platform-specific: + /// + /// - **Android / iOS**: Always opens using default program. + #[cfg(desktop)] + pub fn open_path( + &self, + path: impl Into, + with: Option>, + ) -> Result<()> { + crate::open::open(path.into(), with.map(Into::into)) + } + + /// Open a path with a default or specific program. + /// + /// # Examples + /// + /// ```rust,no_run + /// use tauri_plugin_opener::OpenerExt; + /// + /// tauri::Builder::default() + /// .setup(|app| { + /// // open the given path on the system default explorer + /// app.opener().open_path("/path/to/file", None::<&str>)?; + /// Ok(()) + /// }); + /// ``` + /// + /// ## Platform-specific: + /// + /// - **Android / iOS**: Always opens using default program. + #[cfg(mobile)] + pub fn open_path( + &self, + path: impl Into, + _with: Option>, + ) -> Result<()> { + self.mobile_plugin_handle + .run_mobile_plugin("open", path.into()) + .map_err(Into::into) + } + + pub fn reveal_item_in_dir>(&self, p: P) -> Result<()> { + crate::reveal_item_in_dir::reveal_item_in_dir(p) + } +} + +/// Extensions to [`tauri::App`], [`tauri::AppHandle`], [`tauri::WebviewWindow`], [`tauri::Webview`] and [`tauri::Window`] to access the opener APIs. +pub trait OpenerExt { + fn opener(&self) -> &Opener; +} + +impl> OpenerExt for T { + fn opener(&self) -> &Opener { + self.state::>().inner() + } +} + +/// The opener plugin Builder. +pub struct Builder { + open_js_links_on_click: bool, +} + +impl Default for Builder { + fn default() -> Self { + Self { + open_js_links_on_click: true, + } + } +} + +impl Builder { + /// Create a new opener plugin Builder. + pub fn new() -> Self { + Self::default() + } + + /// Whether the plugin should inject a JS script to open URLs in default browser + /// when clicking on `` elements that has `_blank` target, or when pressing `Ctrl` or `Shift` while clicking it. + /// + /// Enabled by default for `http:`, `https:`, `mailto:`, `tel:` links. + pub fn open_js_links_on_click(mut self, open: bool) -> Self { + self.open_js_links_on_click = open; + self + } + + /// Build and Initializes the plugin. + pub fn build(self) -> TauriPlugin { + let mut builder = tauri::plugin::Builder::new("opener") + .setup(|app, _api| { + #[cfg(target_os = "android")] + let handle = _api.register_android_plugin(PLUGIN_IDENTIFIER, "OpenerPlugin")?; + #[cfg(target_os = "ios")] + let handle = _api.register_ios_plugin(init_plugin_opener)?; + + app.manage(Opener { + #[cfg(not(mobile))] + _marker: std::marker::PhantomData:: R>, + #[cfg(mobile)] + mobile_plugin_handle: handle, + }); + Ok(()) + }) + .invoke_handler(tauri::generate_handler![ + commands::open_url, + commands::open_path, + commands::reveal_item_in_dir + ]); + + if self.open_js_links_on_click { + builder = builder.js_init_script(include_str!("init-iife.js").to_string()); + } + + builder.build() + } +} + +/// Initializes the plugin. +pub fn init() -> TauriPlugin { + Builder::default().build() +} diff --git a/plugins/opener/src/open.rs b/plugins/opener/src/open.rs new file mode 100644 index 00000000..a3d46c50 --- /dev/null +++ b/plugins/opener/src/open.rs @@ -0,0 +1,61 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +//! Types and functions related to shell. + +use std::{ffi::OsStr, path::Path}; + +pub(crate) fn open, S: AsRef>(path: P, with: Option) -> crate::Result<()> { + match with { + Some(program) => ::open::with_detached(path, program.as_ref()), + None => ::open::that_detached(path), + } + .map_err(Into::into) +} + +/// Opens URL with the program specified in `with`, or system default if `None`. +/// +/// ## Platform-specific: +/// +/// - **Android / iOS**: Always opens using default program. +/// +/// # Examples +/// +/// ```rust,no_run +/// tauri::Builder::default() +/// .setup(|app| { +/// // open the given URL on the system default browser +/// tauri_plugin_opener::open_url("https://github.com/tauri-apps/tauri", None::<&str>)?; +/// Ok(()) +/// }); +/// ``` +pub fn open_url, S: AsRef>(url: P, with: Option) -> crate::Result<()> { + let url = url.as_ref(); + open(url, with) +} + +/// Opens path with the program specified in `with`, or system default if `None`. +/// +/// ## Platform-specific: +/// +/// - **Android / iOS**: Always opens using default program. +/// +/// # Examples +/// +/// ```rust,no_run +/// tauri::Builder::default() +/// .setup(|app| { +/// // open the given URL on the system default explorer +/// tauri_plugin_opener::open_path("/path/to/file", None::<&str>)?; +/// Ok(()) +/// }); +/// ``` +pub fn open_path, S: AsRef>(path: P, with: Option) -> crate::Result<()> { + let path = path.as_ref(); + if with.is_none() { + // Returns an IO error if not exists, and besides `exists()` is a shorthand for `metadata()` + _ = path.metadata()?; + } + open(path, with) +} diff --git a/plugins/opener/src/reveal_item_in_dir.rs b/plugins/opener/src/reveal_item_in_dir.rs new file mode 100644 index 00000000..6e3dfc2c --- /dev/null +++ b/plugins/opener/src/reveal_item_in_dir.rs @@ -0,0 +1,196 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use std::path::Path; + +/// Reveal a path the system's default explorer. +/// +/// ## Platform-specific: +/// +/// - **Android / iOS:** Unsupported. +pub fn reveal_item_in_dir>(path: P) -> crate::Result<()> { + let path = path.as_ref().canonicalize()?; + + #[cfg(any( + windows, + target_os = "macos", + target_os = "linux", + target_os = "dragonfly", + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd" + ))] + return imp::reveal_item_in_dir(&path); + + #[cfg(not(any( + windows, + target_os = "macos", + target_os = "linux", + target_os = "dragonfly", + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd" + )))] + Err(crate::Error::UnsupportedPlatform) +} + +#[cfg(windows)] +mod imp { + use super::*; + + use windows::{ + core::{w, HSTRING, PCWSTR}, + Win32::{ + Foundation::ERROR_FILE_NOT_FOUND, + System::Com::CoInitialize, + UI::{ + Shell::{ + ILCreateFromPathW, ILFree, SHOpenFolderAndSelectItems, ShellExecuteExW, + SHELLEXECUTEINFOW, + }, + WindowsAndMessaging::SW_SHOWNORMAL, + }, + }, + }; + + pub fn reveal_item_in_dir(path: &Path) -> crate::Result<()> { + let file = dunce::simplified(path); + + let _ = unsafe { CoInitialize(None) }; + + let dir = file + .parent() + .ok_or_else(|| crate::Error::NoParent(file.to_path_buf()))?; + + let dir = HSTRING::from(dir); + let dir_item = unsafe { ILCreateFromPathW(&dir) }; + + let file_h = HSTRING::from(file); + let file_item = unsafe { ILCreateFromPathW(&file_h) }; + + unsafe { + if let Err(e) = SHOpenFolderAndSelectItems(dir_item, Some(&[file_item]), 0) { + // from https://github.com/electron/electron/blob/10d967028af2e72382d16b7e2025d243b9e204ae/shell/common/platform_util_win.cc#L302 + // On some systems, the above call mysteriously fails with "file not + // found" even though the file is there. In these cases, ShellExecute() + // seems to work as a fallback (although it won't select the file). + if e.code().0 == ERROR_FILE_NOT_FOUND.0 as i32 { + let is_dir = file.is_dir(); + let mut info = SHELLEXECUTEINFOW { + cbSize: std::mem::size_of::() as _, + nShow: SW_SHOWNORMAL.0, + lpFile: PCWSTR(dir.as_ptr()), + lpClass: if is_dir { w!("folder") } else { PCWSTR::null() }, + lpVerb: if is_dir { + w!("explore") + } else { + PCWSTR::null() + }, + ..std::mem::zeroed() + }; + + ShellExecuteExW(&mut info).inspect_err(|_| { + ILFree(Some(dir_item)); + ILFree(Some(file_item)); + })?; + } + } + } + + unsafe { + ILFree(Some(dir_item)); + ILFree(Some(file_item)); + } + + Ok(()) + } +} + +#[cfg(any( + target_os = "linux", + target_os = "dragonfly", + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd" +))] +mod imp { + + use std::collections::HashMap; + + use super::*; + + pub fn reveal_item_in_dir(path: &Path) -> crate::Result<()> { + let connection = zbus::blocking::Connection::session()?; + + reveal_with_filemanager1(path, &connection) + .or_else(|_| reveal_with_open_uri_portal(path, &connection)) + } + + fn reveal_with_filemanager1( + path: &Path, + connection: &zbus::blocking::Connection, + ) -> crate::Result<()> { + let uri = url::Url::from_file_path(path) + .map_err(|_| crate::Error::FailedToConvertPathToFileUrl)?; + + #[zbus::proxy( + interface = "org.freedesktop.FileManager1", + default_service = "org.freedesktop.FileManager1", + default_path = "/org/freedesktop/FileManager1" + )] + trait FileManager1 { + async fn ShowItems(&self, name: Vec<&str>, arg2: &str) -> crate::Result<()>; + } + + let proxy = FileManager1ProxyBlocking::new(connection)?; + + proxy.ShowItems(vec![uri.as_str()], "") + } + + fn reveal_with_open_uri_portal( + path: &Path, + connection: &zbus::blocking::Connection, + ) -> crate::Result<()> { + let uri = url::Url::from_file_path(path) + .map_err(|_| crate::Error::FailedToConvertPathToFileUrl)?; + + #[zbus::proxy( + interface = "org.freedesktop.portal.Desktop", + default_service = "org.freedesktop.portal.OpenURI", + default_path = "/org/freedesktop/portal/desktop" + )] + trait PortalDesktop { + async fn OpenDirectory( + &self, + arg1: &str, + name: &str, + arg3: HashMap<&str, &str>, + ) -> crate::Result<()>; + } + + let proxy = PortalDesktopProxyBlocking::new(connection)?; + + proxy.OpenDirectory("", uri.as_str(), HashMap::new()) + } +} + +#[cfg(target_os = "macos")] +mod imp { + use super::*; + use objc2_app_kit::NSWorkspace; + use objc2_foundation::{NSArray, NSString, NSURL}; + pub fn reveal_item_in_dir(path: &Path) -> crate::Result<()> { + unsafe { + let path = path.to_string_lossy(); + let path = NSString::from_str(&path); + let urls = vec![NSURL::fileURLWithPath(&path)]; + let urls = NSArray::from_retained_slice(&urls); + + let workspace = NSWorkspace::new(); + workspace.activateFileViewerSelectingURLs(&urls); + } + + Ok(()) + } +} diff --git a/plugins/opener/src/scope.rs b/plugins/opener/src/scope.rs new file mode 100644 index 00000000..22c9787e --- /dev/null +++ b/plugins/opener/src/scope.rs @@ -0,0 +1,138 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use std::{ + marker::PhantomData, + path::{Path, PathBuf}, + sync::Arc, +}; + +use tauri::{ipc::ScopeObject, utils::acl::Value, AppHandle, Manager, Runtime}; + +use crate::{scope_entry::EntryRaw, Error}; + +pub use crate::scope_entry::Application; + +#[derive(Debug)] +pub enum Entry { + Url { + url: glob::Pattern, + app: Application, + }, + Path { + path: Option, + app: Application, + }, +} + +impl ScopeObject for Entry { + type Error = Error; + + fn deserialize( + app_handle: &AppHandle, + raw: Value, + ) -> std::result::Result { + serde_json::from_value(raw.into()) + .and_then(|raw| { + let entry = match raw { + EntryRaw::Url { url, app } => Entry::Url { + url: glob::Pattern::new(&url) + .map_err(|e| serde::de::Error::custom(e.to_string()))?, + app, + }, + EntryRaw::Path { path, app } => { + let path = match app_handle.path().parse(path) { + Ok(path) => Some(path), + #[cfg(not(target_os = "android"))] + Err(tauri::Error::UnknownPath) => None, + Err(err) => return Err(serde::de::Error::custom(err.to_string())), + }; + + Entry::Path { path, app } + } + }; + + Ok(entry) + }) + .map_err(Into::into) + } +} + +impl Application { + fn matches(&self, a: Option<&str>) -> bool { + match self { + Self::Default => a.is_none(), + Self::Enable(enable) => *enable, + Self::App(program) => Some(program.as_str()) == a, + } + } +} + +impl Entry { + fn path(&self) -> Option { + match self { + Self::Url { .. } => None, + Self::Path { path, .. } => path.clone(), + } + } + + fn matches_url(&self, u: &str, a: Option<&str>) -> bool { + match self { + Self::Url { url, app } => url.matches(u) && app.matches(a), + Self::Path { .. } => false, + } + } + + fn matches_path_program(&self, a: Option<&str>) -> bool { + match self { + Self::Url { .. } => false, + Self::Path { app, .. } => app.matches(a), + } + } +} + +#[derive(Debug)] +pub struct Scope<'a, R: Runtime, M: Manager> { + allowed: Vec<&'a Arc>, + denied: Vec<&'a Arc>, + manager: &'a M, + _marker: PhantomData, +} + +impl<'a, R: Runtime, M: Manager> Scope<'a, R, M> { + pub(crate) fn new( + manager: &'a M, + allowed: Vec<&'a Arc>, + denied: Vec<&'a Arc>, + ) -> Self { + Self { + manager, + allowed, + denied, + _marker: PhantomData, + } + } + + pub fn is_url_allowed(&self, url: &str, with: Option<&str>) -> bool { + let denied = self.denied.iter().any(|e| e.matches_url(url, with)); + if denied { + false + } else { + self.allowed.iter().any(|e| e.matches_url(url, with)) + } + } + + pub fn is_path_allowed(&self, path: &Path, with: Option<&str>) -> crate::Result { + let fs_scope = tauri::fs::Scope::new( + self.manager, + &tauri::utils::config::FsScope::Scope { + allow: self.allowed.iter().filter_map(|e| e.path()).collect(), + deny: self.denied.iter().filter_map(|e| e.path()).collect(), + require_literal_leading_dot: None, + }, + )?; + + Ok(fs_scope.is_allowed(path) && self.allowed.iter().any(|e| e.matches_path_program(with))) + } +} diff --git a/plugins/opener/src/scope_entry.rs b/plugins/opener/src/scope_entry.rs new file mode 100644 index 00000000..cf9004a2 --- /dev/null +++ b/plugins/opener/src/scope_entry.rs @@ -0,0 +1,36 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use std::path::PathBuf; + +use serde::Deserialize; + +#[derive(Deserialize, Debug)] +#[serde(untagged)] +pub enum Application { + Default, + Enable(bool), + App(String), +} + +impl Default for Application { + fn default() -> Self { + Self::Default + } +} + +#[derive(Deserialize)] +#[serde(untagged, rename_all = "camelCase")] +pub(crate) enum EntryRaw { + Url { + url: String, + #[serde(default)] + app: Application, + }, + Path { + path: PathBuf, + #[serde(default)] + app: Application, + }, +} diff --git a/plugins/opener/tsconfig.json b/plugins/opener/tsconfig.json new file mode 100644 index 00000000..5098169a --- /dev/null +++ b/plugins/opener/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../tsconfig.base.json", + "include": ["guest-js/*.ts"] +} diff --git a/plugins/os/CHANGELOG.md b/plugins/os/CHANGELOG.md index 6355fe2e..415953e4 100644 --- a/plugins/os/CHANGELOG.md +++ b/plugins/os/CHANGELOG.md @@ -1,5 +1,64 @@ # Changelog +## \[2.2.1] + +- [`a1b3fa27`](https://github.com/tauri-apps/plugins-workspace/commit/a1b3fa27f11022c9b6622b4fab12d93239eb05de) ([#2515](https://github.com/tauri-apps/plugins-workspace/pull/2515) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Re-exported the `Geolocation`, `Haptics`, `Notification`, and `Os` structs so that they show up on docs.rs. + +## \[2.2.0] + +- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other. + +## \[2.0.1] + +- [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7. + +## \[2.0.0] + +- [`e2c4dfb6`](https://github.com/tauri-apps/plugins-workspace/commit/e2c4dfb6af43e5dd8d9ceba232c315f5febd55c1) Update to tauri v2 stable release. + +## \[2.0.0-rc.1] + +- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri 2.0.0-rc.8 + +## \[2.0.0-rc.0] + +- [`9887d1`](https://github.com/tauri-apps/plugins-workspace/commit/9887d14bd0e971c4c0f5c1188fc4005d3fc2e29e) Update to tauri RC. + +## \[2.0.0-beta.8] + +- [`99d6ac0f`](https://github.com/tauri-apps/plugins-workspace/commit/99d6ac0f9506a6a4a1aa59c728157190a7441af6) ([#1606](https://github.com/tauri-apps/plugins-workspace/pull/1606) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) The JS packages now specify the *minimum* `@tauri-apps/api` version instead of a single exact version. +- [`6de87966`](https://github.com/tauri-apps/plugins-workspace/commit/6de87966ecc00ad9d91c25be452f1f46bd2b7e1f) ([#1597](https://github.com/tauri-apps/plugins-workspace/pull/1597) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Update to tauri beta.25. + +## \[2.0.0-beta.7] + +- [`40ef9a81`](https://github.com/tauri-apps/plugins-workspace/commit/40ef9a818fb03457819c1d72ea84de57fbf868ba) ([#1514](https://github.com/tauri-apps/plugins-workspace/pull/1514) by [@fynntang](https://github.com/tauri-apps/plugins-workspace/../../fynntang)) **Changed:** `platform`, `arch`, `type`, `family`, `version` and `exe_extension` functions in the documentation examples to better reflect that these functions are synchronous. +- [`22a17980`](https://github.com/tauri-apps/plugins-workspace/commit/22a17980ff4f6f8c40adb1b8f4ffc6dae2fe7e30) ([#1537](https://github.com/tauri-apps/plugins-workspace/pull/1537) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri beta.24. + +## \[2.0.0-beta.6] + +- [`0959fe37`](https://github.com/tauri-apps/plugins-workspace/commit/0959fe3757250c6dea6247edb20e6ab468f20511) ([#1353](https://github.com/tauri-apps/plugins-workspace/pull/1353) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) **Breaking** Changed `platform`, `arch`, `type`, `family`, `version` and `exe_extension` functions to be sync. +- [`76daee7a`](https://github.com/tauri-apps/plugins-workspace/commit/76daee7aafece34de3092c86e531cf9eb1138989) ([#1512](https://github.com/tauri-apps/plugins-workspace/pull/1512) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Update to tauri beta.23. + +## \[2.0.0-beta.5] + +- [`9013854f`](https://github.com/tauri-apps/plugins-workspace/commit/9013854f42a49a230b9dbb9d02774765528a923f)([#1382](https://github.com/tauri-apps/plugins-workspace/pull/1382)) Update to tauri beta.22. + +## \[2.0.0-beta.4] + +- [`430bd6f4`](https://github.com/tauri-apps/plugins-workspace/commit/430bd6f4f379bee5d232ae6b098ae131db7f178a)([#1363](https://github.com/tauri-apps/plugins-workspace/pull/1363)) Update to tauri beta.20. + +## \[2.0.0-beta.3] + +- [`bd1ed590`](https://github.com/tauri-apps/plugins-workspace/commit/bd1ed5903ffcce5500310dac1e59e8c67674ef1e)([#1237](https://github.com/tauri-apps/plugins-workspace/pull/1237)) Update to tauri beta.17. + +## \[2.0.0-beta.3] + +- [`a04ea2f`](https://github.com/tauri-apps/plugins-workspace/commit/a04ea2f38294d5a3987578283badc8eec87a7752)([#1071](https://github.com/tauri-apps/plugins-workspace/pull/1071)) The global API script is now only added to the binary when the `withGlobalTauri` config is true. + +## \[2.0.0-beta.2] + +- [`99bea25`](https://github.com/tauri-apps/plugins-workspace/commit/99bea2559c2c0648c2519c50a18cd124dacef57b)([#1005](https://github.com/tauri-apps/plugins-workspace/pull/1005)) Update to tauri beta.8. + ## \[2.0.0-beta.1] - [`569defb`](https://github.com/tauri-apps/plugins-workspace/commit/569defbe9492e38938554bb7bdc1be9151456d21) Update to tauri beta.4. @@ -47,10 +106,3 @@ ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - te to alpha.11. - -## \[2.0.0-alpha.0] - -- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - ae67\`]\(https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! -717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/os/Cargo.toml b/plugins/os/Cargo.toml index 5be5846f..424b7581 100644 --- a/plugins/os/Cargo.toml +++ b/plugins/os/Cargo.toml @@ -1,19 +1,27 @@ [package] name = "tauri-plugin-os" -version = "2.0.0-beta.1" +version = "2.2.1" description = "Read information about the operating system." edition = { workspace = true } authors = { workspace = true } license = { workspace = true } rust-version = { workspace = true } +repository = { workspace = true } links = "tauri-plugin-os" [package.metadata.docs.rs] -rustc-args = [ "--cfg", "docsrs" ] -rustdoc-args = [ "--cfg", "docsrs" ] +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs"] + +[package.metadata.platforms.support] +windows = { level = "full", notes = "" } +linux = { level = "full", notes = "" } +macos = { level = "full", notes = "" } +android = { level = "full", notes = "" } +ios = { level = "full", notes = "" } [build-dependencies] -tauri-plugin = { workspace = true, features = [ "build" ] } +tauri-plugin = { workspace = true, features = ["build"] } [dependencies] serde = { workspace = true } @@ -23,5 +31,5 @@ log = { workspace = true } thiserror = { workspace = true } os_info = "3" sys-locale = "0.3" -gethostname = "0.4" +gethostname = "1.0" serialize-to-javascript = "=0.1.1" diff --git a/plugins/os/README.md b/plugins/os/README.md index 6e518911..f6679504 100644 --- a/plugins/os/README.md +++ b/plugins/os/README.md @@ -2,9 +2,17 @@ Read information about the operating system. +| Platform | Supported | +| -------- | --------- | +| Linux | ✓ | +| Windows | ✓ | +| macOS | ✓ | +| Android | ✓ | +| iOS | ✓ | + ## Install -_This plugin requires a Rust version of at least **1.75**_ +_This plugin requires a Rust version of at least **1.77.2**_ There are three general methods of installation that we can recommend. @@ -18,7 +26,7 @@ Install the Core plugin by adding the following to your `Cargo.toml` file: ```toml [dependencies] -tauri-plugin-os = "2.0.0-beta" +tauri-plugin-os = "2.0.0" # alternatively with Git: tauri-plugin-os = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` @@ -46,7 +54,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-os#v2 First you need to register the core plugin with Tauri: -`src-tauri/src/main.rs` +`src-tauri/src/lib.rs` ```rust fn main() { @@ -60,8 +68,8 @@ fn main() { Afterwards all the plugin's APIs are available through the JavaScript guest bindings: ```javascript -import { version } from "@tauri-apps/plugin-os"; -const osVersion = await version(); +import { version } from '@tauri-apps/plugin-os' +const osVersion = await version() ``` ## Contributing diff --git a/plugins/os/SECURITY.md b/plugins/os/SECURITY.md new file mode 100644 index 00000000..4f09bbac --- /dev/null +++ b/plugins/os/SECURITY.md @@ -0,0 +1,23 @@ +# Security Policy + +**Do not report security vulnerabilities through public GitHub issues.** + +**Please use the [Private Vulnerability Disclosure](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability) feature of GitHub.** + +Include as much of the following information: + +- Type of issue (e.g. improper input parsing, privilege escalation, etc.) +- The location of the affected source code (tag/branch/commit or direct URL) +- Any special configuration required to reproduce the issue +- The distribution affected or used to help us with reproduction of the issue +- Step-by-step instructions to reproduce the issue +- Ideally a reproduction repository +- Impact of the issue, including how an attacker might exploit the issue + +We prefer to receive reports in English. + +## Contact + +Please disclose a vulnerability or security relevant issue here: [https://github.com/tauri-apps/plugins-workspace/security/advisories/new](https://github.com/tauri-apps/plugins-workspace/security/advisories/new). + +Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app). diff --git a/plugins/os/api-iife.js b/plugins/os/api-iife.js new file mode 100644 index 00000000..2b7924de --- /dev/null +++ b/plugins/os/api-iife.js @@ -0,0 +1 @@ +if("__TAURI__"in window){var __TAURI_PLUGIN_OS__=function(_){"use strict";async function n(_,n={},o){return window.__TAURI_INTERNALS__.invoke(_,n,o)}return"function"==typeof SuppressedError&&SuppressedError,_.arch=function(){return window.__TAURI_OS_PLUGIN_INTERNALS__.arch},_.eol=function(){return window.__TAURI_OS_PLUGIN_INTERNALS__.eol},_.exeExtension=function(){return window.__TAURI_OS_PLUGIN_INTERNALS__.exe_extension},_.family=function(){return window.__TAURI_OS_PLUGIN_INTERNALS__.family},_.hostname=async function(){return await n("plugin:os|hostname")},_.locale=async function(){return await n("plugin:os|locale")},_.platform=function(){return window.__TAURI_OS_PLUGIN_INTERNALS__.platform},_.type=function(){return window.__TAURI_OS_PLUGIN_INTERNALS__.os_type},_.version=function(){return window.__TAURI_OS_PLUGIN_INTERNALS__.version},_}({});Object.defineProperty(window.__TAURI__,"os",{value:__TAURI_PLUGIN_OS__})} diff --git a/plugins/os/build.rs b/plugins/os/build.rs index 91dca73e..f108f965 100644 --- a/plugins/os/build.rs +++ b/plugins/os/build.rs @@ -14,5 +14,7 @@ const COMMANDS: &[&str] = &[ ]; fn main() { - tauri_plugin::Builder::new(COMMANDS).build(); + tauri_plugin::Builder::new(COMMANDS) + .global_api_script_path("./api-iife.js") + .build(); } diff --git a/plugins/os/guest-js/index.ts b/plugins/os/guest-js/index.ts index 152d0f72..697ae8ed 100644 --- a/plugins/os/guest-js/index.ts +++ b/plugins/os/guest-js/index.ts @@ -8,43 +8,49 @@ * @module */ -import { invoke } from "@tauri-apps/api/core"; +import { invoke } from '@tauri-apps/api/core' /** @ignore */ declare global { interface Window { __TAURI_OS_PLUGIN_INTERNALS__: { - eol: string; - }; + eol: string + os_type: OsType + platform: Platform + family: Family + version: string + arch: Arch + exe_extension: string + } } } type Platform = - | "linux" - | "macos" - | "ios" - | "freebsd" - | "dragonfly" - | "netbsd" - | "openbsd" - | "solaris" - | "android" - | "windows"; - -type OsType = "linux" | "windows" | "macos" | "ios" | "android"; + | 'linux' + | 'macos' + | 'ios' + | 'freebsd' + | 'dragonfly' + | 'netbsd' + | 'openbsd' + | 'solaris' + | 'android' + | 'windows' + +type OsType = 'linux' | 'windows' | 'macos' | 'ios' | 'android' type Arch = - | "x86" - | "x86_64" - | "arm" - | "aarch64" - | "mips" - | "mips64" - | "powerpc" - | "powerpc64" - | "riscv64" - | "s390x" - | "sparc64"; + | 'x86' + | 'x86_64' + | 'arm' + | 'aarch64' + | 'mips' + | 'mips64' + | 'powerpc' + | 'powerpc64' + | 'riscv64' + | 's390x' + | 'sparc64' /** * Returns the operating system-specific end-of-line marker. @@ -53,8 +59,8 @@ type Arch = * * @since 2.0.0 * */ -function eol() { - return window.__TAURI_OS_PLUGIN_INTERNALS__.eol; +function eol(): string { + return window.__TAURI_OS_PLUGIN_INTERNALS__.eol } /** @@ -64,14 +70,14 @@ function eol() { * @example * ```typescript * import { platform } from '@tauri-apps/plugin-os'; - * const platformName = await platform(); + * const platformName = platform(); * ``` * * @since 2.0.0 * */ -async function platform(): Promise { - return invoke("plugin:os|platform"); +function platform(): Platform { + return window.__TAURI_OS_PLUGIN_INTERNALS__.platform } /** @@ -79,29 +85,29 @@ async function platform(): Promise { * @example * ```typescript * import { version } from '@tauri-apps/plugin-os'; - * const osVersion = await version(); + * const osVersion = version(); * ``` * * @since 2.0.0 */ -async function version(): Promise { - return invoke("plugin:os|version"); +function version(): string { + return window.__TAURI_OS_PLUGIN_INTERNALS__.version } -type Family = "unix" | "windows"; +type Family = 'unix' | 'windows' /** * Returns the current operating system family. Possible values are `'unix'`, `'windows'`. * @example * ```typescript * import { family } from '@tauri-apps/plugin-os'; - * const family = await family(); + * const family = family(); * ``` * * @since 2.0.0 */ -async function family(): Promise { - return invoke("plugin:os|family"); +function family(): Family { + return window.__TAURI_OS_PLUGIN_INTERNALS__.family } /** @@ -109,13 +115,13 @@ async function family(): Promise { * @example * ```typescript * import { type } from '@tauri-apps/plugin-os'; - * const osType = await type(); + * const osType = type(); * ``` * * @since 2.0.0 */ -async function type(): Promise { - return invoke("plugin:os|os_type"); +function type(): OsType { + return window.__TAURI_OS_PLUGIN_INTERNALS__.os_type } /** @@ -124,44 +130,44 @@ async function type(): Promise { * @example * ```typescript * import { arch } from '@tauri-apps/plugin-os'; - * const archName = await arch(); + * const archName = arch(); * ``` * * @since 2.0.0 */ -async function arch(): Promise { - return invoke("plugin:os|arch"); +function arch(): Arch { + return window.__TAURI_OS_PLUGIN_INTERNALS__.arch } /** - * Returns a String with a `BCP-47` language tag inside. If the locale couldn’t be obtained, `null` is returned instead. + * Returns the file extension, if any, used for executable binaries on this platform. Possible values are `'exe'` and `''` (empty string). * @example * ```typescript - * import { locale } from '@tauri-apps/plugin-os'; - * const locale = await locale(); - * if (locale) { - * // use the locale string here - * } + * import { exeExtension } from '@tauri-apps/plugin-os'; + * const exeExt = exeExtension(); * ``` * * @since 2.0.0 */ -async function locale(): Promise { - return invoke("plugin:os|locale"); +function exeExtension(): string { + return window.__TAURI_OS_PLUGIN_INTERNALS__.exe_extension } /** - * Returns the file extension, if any, used for executable binaries on this platform. Possible values are `'exe'` and `''` (empty string). + * Returns a String with a `BCP-47` language tag inside. If the locale couldn’t be obtained, `null` is returned instead. * @example * ```typescript - * import { exeExtension } from '@tauri-apps/plugin-os'; - * const exeExt = await exeExtension(); + * import { locale } from '@tauri-apps/plugin-os'; + * const locale = await locale(); + * if (locale) { + * // use the locale string here + * } * ``` * * @since 2.0.0 */ -async function exeExtension(): Promise { - return invoke("plugin:os|exe_extension"); +async function locale(): Promise { + return await invoke('plugin:os|locale') } /** @@ -173,7 +179,7 @@ async function exeExtension(): Promise { * ``` */ async function hostname(): Promise { - return invoke("plugin:os|hostname"); + return await invoke('plugin:os|hostname') } export { @@ -185,6 +191,6 @@ export { arch, locale, exeExtension, - hostname, -}; -export type { Platform, OsType, Arch, Family }; + hostname +} +export type { Platform, OsType, Arch, Family } diff --git a/plugins/os/package.json b/plugins/os/package.json index 53fbd680..840f5352 100644 --- a/plugins/os/package.json +++ b/plugins/os/package.json @@ -1,10 +1,11 @@ { "name": "@tauri-apps/plugin-os", - "version": "2.0.0-beta.1", - "license": "MIT or APACHE-2.0", + "version": "2.2.1", + "license": "MIT OR Apache-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" ], + "repository": "https://github.com/tauri-apps/plugins-workspace", "type": "module", "types": "./dist-js/index.d.ts", "main": "./dist-js/index.cjs", @@ -23,6 +24,6 @@ "LICENSE" ], "dependencies": { - "@tauri-apps/api": "2.0.0-beta.2" + "@tauri-apps/api": "^2.0.0" } } diff --git a/plugins/os/permissions/autogenerated/reference.md b/plugins/os/permissions/autogenerated/reference.md index f8d334fb..9ed7385e 100644 --- a/plugins/os/permissions/autogenerated/reference.md +++ b/plugins/os/permissions/autogenerated/reference.md @@ -1,66 +1,239 @@ -# Permissions +## Default Permission -## allow-arch +This permission set configures which +operating system information are available +to gather from the frontend. + +#### Granted Permissions + +All information except the host name are available. + + + +#### This default permission set includes the following: + +- `allow-arch` +- `allow-exe-extension` +- `allow-family` +- `allow-locale` +- `allow-os-type` +- `allow-platform` +- `allow-version` + +## Permission Table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IdentifierDescription
+ +`os:allow-arch` + + Enables the arch command without any pre-configured scope. -## deny-arch +
+ +`os:deny-arch` + + Denies the arch command without any pre-configured scope. -## allow-exe-extension +
+ +`os:allow-exe-extension` + + Enables the exe_extension command without any pre-configured scope. -## deny-exe-extension +
+ +`os:deny-exe-extension` + + Denies the exe_extension command without any pre-configured scope. -## allow-family +
+ +`os:allow-family` + + Enables the family command without any pre-configured scope. -## deny-family +
+ +`os:deny-family` + + Denies the family command without any pre-configured scope. -## allow-hostname +
+ +`os:allow-hostname` + + Enables the hostname command without any pre-configured scope. -## deny-hostname +
+ +`os:deny-hostname` + + Denies the hostname command without any pre-configured scope. -## allow-locale +
+ +`os:allow-locale` + + Enables the locale command without any pre-configured scope. -## deny-locale +
+ +`os:deny-locale` + + Denies the locale command without any pre-configured scope. -## allow-os-type +
+ +`os:allow-os-type` + + Enables the os_type command without any pre-configured scope. -## deny-os-type +
+ +`os:deny-os-type` + + Denies the os_type command without any pre-configured scope. -## allow-platform +
+ +`os:allow-platform` + + Enables the platform command without any pre-configured scope. -## deny-platform +
+ +`os:deny-platform` + + Denies the platform command without any pre-configured scope. -## allow-version +
+ +`os:allow-version` + + Enables the version command without any pre-configured scope. -## deny-version +
+ +`os:deny-version` + + Denies the version command without any pre-configured scope. +
diff --git a/plugins/os/permissions/default.toml b/plugins/os/permissions/default.toml new file mode 100644 index 00000000..217b389c --- /dev/null +++ b/plugins/os/permissions/default.toml @@ -0,0 +1,23 @@ +"$schema" = "schemas/schema.json" + +[default] +description = """ +This permission set configures which +operating system information are available +to gather from the frontend. + +#### Granted Permissions + +All information except the host name are available. + +""" + +permissions = [ + "allow-arch", + "allow-exe-extension", + "allow-family", + "allow-locale", + "allow-os-type", + "allow-platform", + "allow-version", +] diff --git a/plugins/os/permissions/schemas/schema.json b/plugins/os/permissions/schemas/schema.json index 95211ceb..36680b44 100644 --- a/plugins/os/permissions/schemas/schema.json +++ b/plugins/os/permissions/schemas/schema.json @@ -17,7 +17,6 @@ }, "set": { "description": "A list of permissions sets defined", - "default": [], "type": "array", "items": { "$ref": "#/definitions/PermissionSet" @@ -50,7 +49,7 @@ "minimum": 1.0 }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -112,7 +111,7 @@ "type": "string" }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri internal convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -132,12 +131,21 @@ }, "scope": { "description": "Allowed or denied scoped when using this permission.", - "default": {}, "allOf": [ { "$ref": "#/definitions/Scopes" } ] + }, + "platforms": { + "description": "Target platforms this permission applies. By default all platforms are affected by this permission.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Target" + } } } }, @@ -164,7 +172,7 @@ } }, "Scopes": { - "description": "A restriction of the command/endpoint functionality.\n\nIt can be of any serde serializable type and is used for allowing or preventing certain actions inside a Tauri command.\n\nThe scope is passed to the command and handled/enforced by the command itself.", + "description": "An argument for fine grained behavior control of Tauri commands.\n\nIt can be of any serde serializable type and is used to allow or prevent certain actions inside a Tauri command. The configured scope is passed to the command and will be enforced by the command implementation.\n\n## Example\n\n```json { \"allow\": [{ \"path\": \"$HOME/**\" }], \"deny\": [{ \"path\": \"$HOME/secret.txt\" }] } ```", "type": "object", "properties": { "allow": { @@ -178,7 +186,7 @@ } }, "deny": { - "description": "Data that defines what is denied by the scope.", + "description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.", "type": [ "array", "null" @@ -243,120 +251,150 @@ } ] }, - "PermissionKind": { - "type": "string", + "Target": { + "description": "Platform target.", "oneOf": [ { - "description": "allow-arch -> Enables the arch command without any pre-configured scope.", + "description": "MacOS.", "type": "string", "enum": [ - "allow-arch" + "macOS" ] }, { - "description": "deny-arch -> Denies the arch command without any pre-configured scope.", + "description": "Windows.", "type": "string", "enum": [ - "deny-arch" + "windows" ] }, { - "description": "allow-exe-extension -> Enables the exe_extension command without any pre-configured scope.", + "description": "Linux.", "type": "string", "enum": [ - "allow-exe-extension" + "linux" ] }, { - "description": "deny-exe-extension -> Denies the exe_extension command without any pre-configured scope.", + "description": "Android.", "type": "string", "enum": [ - "deny-exe-extension" + "android" ] }, { - "description": "allow-family -> Enables the family command without any pre-configured scope.", + "description": "iOS.", "type": "string", "enum": [ - "allow-family" + "iOS" ] + } + ] + }, + "PermissionKind": { + "type": "string", + "oneOf": [ + { + "description": "Enables the arch command without any pre-configured scope.", + "type": "string", + "const": "allow-arch", + "markdownDescription": "Enables the arch command without any pre-configured scope." }, { - "description": "deny-family -> Denies the family command without any pre-configured scope.", + "description": "Denies the arch command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-family" - ] + "const": "deny-arch", + "markdownDescription": "Denies the arch command without any pre-configured scope." }, { - "description": "allow-hostname -> Enables the hostname command without any pre-configured scope.", + "description": "Enables the exe_extension command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-hostname" - ] + "const": "allow-exe-extension", + "markdownDescription": "Enables the exe_extension command without any pre-configured scope." }, { - "description": "deny-hostname -> Denies the hostname command without any pre-configured scope.", + "description": "Denies the exe_extension command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-hostname" - ] + "const": "deny-exe-extension", + "markdownDescription": "Denies the exe_extension command without any pre-configured scope." }, { - "description": "allow-locale -> Enables the locale command without any pre-configured scope.", + "description": "Enables the family command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-locale" - ] + "const": "allow-family", + "markdownDescription": "Enables the family command without any pre-configured scope." }, { - "description": "deny-locale -> Denies the locale command without any pre-configured scope.", + "description": "Denies the family command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-locale" - ] + "const": "deny-family", + "markdownDescription": "Denies the family command without any pre-configured scope." }, { - "description": "allow-os-type -> Enables the os_type command without any pre-configured scope.", + "description": "Enables the hostname command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-os-type" - ] + "const": "allow-hostname", + "markdownDescription": "Enables the hostname command without any pre-configured scope." }, { - "description": "deny-os-type -> Denies the os_type command without any pre-configured scope.", + "description": "Denies the hostname command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-os-type" - ] + "const": "deny-hostname", + "markdownDescription": "Denies the hostname command without any pre-configured scope." }, { - "description": "allow-platform -> Enables the platform command without any pre-configured scope.", + "description": "Enables the locale command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-platform" - ] + "const": "allow-locale", + "markdownDescription": "Enables the locale command without any pre-configured scope." }, { - "description": "deny-platform -> Denies the platform command without any pre-configured scope.", + "description": "Denies the locale command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-platform" - ] + "const": "deny-locale", + "markdownDescription": "Denies the locale command without any pre-configured scope." }, { - "description": "allow-version -> Enables the version command without any pre-configured scope.", + "description": "Enables the os_type command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-version" - ] + "const": "allow-os-type", + "markdownDescription": "Enables the os_type command without any pre-configured scope." }, { - "description": "deny-version -> Denies the version command without any pre-configured scope.", + "description": "Denies the os_type command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-version" - ] + "const": "deny-os-type", + "markdownDescription": "Denies the os_type command without any pre-configured scope." + }, + { + "description": "Enables the platform command without any pre-configured scope.", + "type": "string", + "const": "allow-platform", + "markdownDescription": "Enables the platform command without any pre-configured scope." + }, + { + "description": "Denies the platform command without any pre-configured scope.", + "type": "string", + "const": "deny-platform", + "markdownDescription": "Denies the platform command without any pre-configured scope." + }, + { + "description": "Enables the version command without any pre-configured scope.", + "type": "string", + "const": "allow-version", + "markdownDescription": "Enables the version command without any pre-configured scope." + }, + { + "description": "Denies the version command without any pre-configured scope.", + "type": "string", + "const": "deny-version", + "markdownDescription": "Denies the version command without any pre-configured scope." + }, + { + "description": "This permission set configures which\noperating system information are available\nto gather from the frontend.\n\n#### Granted Permissions\n\nAll information except the host name are available.\n\n\n#### This default permission set includes:\n\n- `allow-arch`\n- `allow-exe-extension`\n- `allow-family`\n- `allow-locale`\n- `allow-os-type`\n- `allow-platform`\n- `allow-version`", + "type": "string", + "const": "default", + "markdownDescription": "This permission set configures which\noperating system information are available\nto gather from the frontend.\n\n#### Granted Permissions\n\nAll information except the host name are available.\n\n\n#### This default permission set includes:\n\n- `allow-arch`\n- `allow-exe-extension`\n- `allow-family`\n- `allow-locale`\n- `allow-os-type`\n- `allow-platform`\n- `allow-version`" } ] } diff --git a/plugins/os/rollup.config.js b/plugins/os/rollup.config.js index 977dfac8..1f349ec8 100644 --- a/plugins/os/rollup.config.js +++ b/plugins/os/rollup.config.js @@ -2,6 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { createConfig } from "../../shared/rollup.config.js"; +import { createConfig } from '../../shared/rollup.config.js' -export default createConfig(); +export default createConfig() diff --git a/plugins/os/src/api-iife.js b/plugins/os/src/api-iife.js deleted file mode 100644 index ef02e2da..00000000 --- a/plugins/os/src/api-iife.js +++ /dev/null @@ -1 +0,0 @@ -if("__TAURI__"in window){var __TAURI_PLUGIN_OS__=function(n){"use strict";async function o(n,o={},e){return window.__TAURI_INTERNALS__.invoke(n,o,e)}return"function"==typeof SuppressedError&&SuppressedError,n.arch=async function(){return o("plugin:os|arch")},n.eol=function(){return window.__TAURI_OS_PLUGIN_INTERNALS__.eol},n.exeExtension=async function(){return o("plugin:os|exe_extension")},n.family=async function(){return o("plugin:os|family")},n.hostname=async function(){return o("plugin:os|hostname")},n.locale=async function(){return o("plugin:os|locale")},n.platform=async function(){return o("plugin:os|platform")},n.type=async function(){return o("plugin:os|os_type")},n.version=async function(){return o("plugin:os|version")},n}({});Object.defineProperty(window.__TAURI__,"os",{value:__TAURI_PLUGIN_OS__})} diff --git a/plugins/os/src/commands.rs b/plugins/os/src/commands.rs index fdfa09a0..b10c7f5d 100644 --- a/plugins/os/src/commands.rs +++ b/plugins/os/src/commands.rs @@ -2,36 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -#[tauri::command] -pub fn platform() -> &'static str { - crate::platform() -} - -#[tauri::command] -pub fn version() -> String { - crate::version().to_string() -} - -#[tauri::command] -pub fn os_type() -> String { - crate::type_().to_string() -} - -#[tauri::command] -pub fn family() -> &'static str { - crate::family() -} - -#[tauri::command] -pub fn arch() -> &'static str { - crate::arch() -} - -#[tauri::command] -pub fn exe_extension() -> &'static str { - crate::exe_extension() -} - #[tauri::command] pub fn locale() -> Option { crate::locale() diff --git a/plugins/os/src/init.js b/plugins/os/src/init.js index a26d35aa..97eeab3a 100644 --- a/plugins/os/src/init.js +++ b/plugins/os/src/init.js @@ -3,10 +3,14 @@ // SPDX-License-Identifier: MIT // eslint-disable-next-line -Object.defineProperty(window, "__TAURI_OS_PLUGIN_INTERNALS__", { +Object.defineProperty(window, '__TAURI_OS_PLUGIN_INTERNALS__', { value: { eol: __TEMPLATE_eol__, - }, -}); - -__RAW_global_os_api__; + os_type: __TEMPLATE_os_type__, + platform: __TEMPLATE_platform__, + family: __TEMPLATE_family__, + version: __TEMPLATE_version__, + arch: __TEMPLATE_arch__, + exe_extension: __TEMPLATE_exe_extension__ + } +}) diff --git a/plugins/os/src/lib.rs b/plugins/os/src/lib.rs index fab629d5..50ab89ee 100644 --- a/plugins/os/src/lib.rs +++ b/plugins/os/src/lib.rs @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -//! [![](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/os/banner.png)](https://github.com/tauri-apps/plugins-workspace/tree/v2/plugins/os) -//! //! Read information about the operating system. #![doc( @@ -90,7 +88,7 @@ pub fn exe_extension() -> &'static str { std::env::consts::EXE_EXTENSION } -/// Returns the current operating system locale with the `BCP-47` language tag. If the locale couldn’t be obtained, `None` is returned instead. +/// Returns the current operating system locale with the `BCP-47` language tag. If the locale couldn't be obtained, `None` is returned instead. pub fn locale() -> Option { sys_locale::get_locale() } @@ -102,33 +100,42 @@ pub fn hostname() -> String { #[derive(Template)] #[default_template("./init.js")] -struct InitJavascript { - #[raw] - global_os_api: &'static str, +struct InitJavascript<'a> { eol: &'static str, + os_type: String, + platform: &'a str, + family: &'a str, + version: String, + arch: &'a str, + exe_extension: &'a str, } -pub fn init() -> TauriPlugin { - let init_js = InitJavascript { - global_os_api: include_str!("api-iife.js"), - #[cfg(windows)] - eol: "\r\n", - #[cfg(not(windows))] - eol: "\n", +impl InitJavascript<'_> { + fn new() -> Self { + Self { + #[cfg(windows)] + eol: "\r\n", + #[cfg(not(windows))] + eol: "\n", + os_type: crate::type_().to_string(), + platform: crate::platform(), + family: crate::family(), + version: crate::version().to_string(), + arch: crate::arch(), + exe_extension: crate::exe_extension(), + } } - .render_default(&Default::default()) - // this will never fail with the above global_os_api eol values - .unwrap(); +} + +pub fn init() -> TauriPlugin { + let init_js = InitJavascript::new() + .render_default(&Default::default()) + // this will never fail with the above global_os_api values + .unwrap(); Builder::new("os") .js_init_script(init_js.to_string()) .invoke_handler(tauri::generate_handler![ - commands::platform, - commands::version, - commands::os_type, - commands::family, - commands::arch, - commands::exe_extension, commands::locale, commands::hostname ]) diff --git a/plugins/persisted-scope/CHANGELOG.md b/plugins/persisted-scope/CHANGELOG.md index 6d5c6514..244b6d0f 100644 --- a/plugins/persisted-scope/CHANGELOG.md +++ b/plugins/persisted-scope/CHANGELOG.md @@ -1,5 +1,190 @@ # Changelog +## \[2.2.1] + +### Dependencies + +- Upgraded to `fs@2.2.1` + +## \[2.2.0] + +- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other. + +### Dependencies + +- Upgraded to `fs@2.2.0` + +## \[2.1.1] + +### Dependencies + +- Upgraded to `fs@2.1.1` + +## \[2.1.0] + +- [`fecfd553`](https://github.com/tauri-apps/plugins-workspace/commit/fecfd5533a6452f054fbcd909021f12b0dce834f) ([#2070](https://github.com/tauri-apps/plugins-workspace/pull/2070) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) **Breaking Change:** Replaced the custom `tauri_plugin_fs::Scope` struct with `tauri::fs::Scope`. + +### Dependencies + +- Upgraded to `fs@2.1.0` + +## \[2.0.3] + +### Dependencies + +- Upgraded to `fs@2.0.3` + +## \[2.0.2] + +### Dependencies + +- Upgraded to `fs@2.0.2` + +## \[2.0.1] + +- [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7. + +### Dependencies + +- Upgraded to `fs@2.0.1` + +## \[2.0.0] + +- [`e2c4dfb6`](https://github.com/tauri-apps/plugins-workspace/commit/e2c4dfb6af43e5dd8d9ceba232c315f5febd55c1) Update to tauri v2 stable release. + +### Dependencies + +- Upgraded to `fs@2.0.0` + +## \[2.0.0-rc.6] + +### Dependencies + +- Upgraded to `fs@2.0.0-rc.6` + +## \[2.0.0-rc.5] + +### Dependencies + +- Upgraded to `fs@2.0.0-rc.5` + +## \[2.0.0-rc.4] + +### Dependencies + +- Upgraded to `fs@2.0.0-rc.4` + +## \[2.0.0-rc.3] + +### Dependencies + +- Upgraded to `fs@2.0.0-rc.3` + +## \[2.0.0-rc.2] + +### Dependencies + +- Upgraded to `fs@2.0.0-rc.2` + +## \[2.0.0-rc.1] + +- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri 2.0.0-rc.8 + +### Dependencies + +- Upgraded to `fs@2.0.0-rc.1` + +## \[2.0.0-rc.0] + +- [`9887d1`](https://github.com/tauri-apps/plugins-workspace/commit/9887d14bd0e971c4c0f5c1188fc4005d3fc2e29e) Update to tauri RC. + +### Dependencies + +- Upgraded to `fs@2.0.0-rc.0` + +## \[2.0.0-beta.12] + +- [`e847cedc`](https://github.com/tauri-apps/plugins-workspace/commit/e847cedc1f46f3e7a2ad81ea579b620bc5b992d7) ([#1402](https://github.com/tauri-apps/plugins-workspace/pull/1402) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Use no default features on tauri for all plugins so that consumers can use `default-features = false` on tauri, note that this will still enable wry feature on iOS +- [`6de87966`](https://github.com/tauri-apps/plugins-workspace/commit/6de87966ecc00ad9d91c25be452f1f46bd2b7e1f) ([#1597](https://github.com/tauri-apps/plugins-workspace/pull/1597) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Update to tauri beta.25. + +### Dependencies + +- Upgraded to `fs@2.0.0-beta.12` + +## \[2.0.0-beta.11] + +- [`22a17980`](https://github.com/tauri-apps/plugins-workspace/commit/22a17980ff4f6f8c40adb1b8f4ffc6dae2fe7e30) ([#1537](https://github.com/tauri-apps/plugins-workspace/pull/1537) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri beta.24. + +### Dependencies + +- Upgraded to `fs@2.0.0-beta.11` + +## \[2.0.0-beta.10] + +- [`76daee7a`](https://github.com/tauri-apps/plugins-workspace/commit/76daee7aafece34de3092c86e531cf9eb1138989) ([#1512](https://github.com/tauri-apps/plugins-workspace/pull/1512) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Update to tauri beta.23. + +### Dependencies + +- Upgraded to `fs@2.0.0-beta.10` + +## \[2.0.0-beta.9] + +- [`9013854f`](https://github.com/tauri-apps/plugins-workspace/commit/9013854f42a49a230b9dbb9d02774765528a923f)([#1382](https://github.com/tauri-apps/plugins-workspace/pull/1382)) Update to tauri beta.22. + +### Dependencies + +- Upgraded to `fs@2.0.0-beta.9` + +## \[2.0.0-beta.8] + +- [`430bd6f4`](https://github.com/tauri-apps/plugins-workspace/commit/430bd6f4f379bee5d232ae6b098ae131db7f178a)([#1363](https://github.com/tauri-apps/plugins-workspace/pull/1363)) Update to tauri beta.20. + +### Dependencies + +- Upgraded to `fs@2.0.0-beta.8` + +## \[2.0.0-beta.7] + +- [`bd1ed590`](https://github.com/tauri-apps/plugins-workspace/commit/bd1ed5903ffcce5500310dac1e59e8c67674ef1e)([#1237](https://github.com/tauri-apps/plugins-workspace/pull/1237)) Update to tauri beta.17. + +### Dependencies + +- Upgraded to `fs@2.0.0-beta.7` + +## \[2.0.0-beta.6] + +### Dependencies + +- Upgraded to `fs@2.0.0-beta.6` + +## \[2.0.0-beta.5] + +### Dependencies + +- Upgraded to `fs@2.0.0-beta.5` + +## \[2.0.0-beta.4] + +### Dependencies + +- Upgraded to `fs@2.0.0-beta.4` + +## \[2.0.0-beta.3] + +- [`a04ea2f`](https://github.com/tauri-apps/plugins-workspace/commit/a04ea2f38294d5a3987578283badc8eec87a7752)([#1071](https://github.com/tauri-apps/plugins-workspace/pull/1071)) The global API script is now only added to the binary when the `withGlobalTauri` config is true. + +### Dependencies + +- Upgraded to `fs@2.0.0-beta.3` + +## \[2.0.0-beta.2] + +- [`99bea25`](https://github.com/tauri-apps/plugins-workspace/commit/99bea2559c2c0648c2519c50a18cd124dacef57b)([#1005](https://github.com/tauri-apps/plugins-workspace/pull/1005)) Update to tauri beta.8. + +### Dependencies + +- Upgraded to `fs@2.0.0-beta.2` + ## \[2.0.0-beta.1] - [`14f381a`](https://github.com/tauri-apps/plugins-workspace/commit/14f381acf8fe690acecc676922c6f05939b95734) Update MSRV to 1.75. diff --git a/plugins/persisted-scope/Cargo.toml b/plugins/persisted-scope/Cargo.toml index c8f75f0f..7927774d 100644 --- a/plugins/persisted-scope/Cargo.toml +++ b/plugins/persisted-scope/Cargo.toml @@ -1,15 +1,23 @@ [package] name = "tauri-plugin-persisted-scope" -version = "2.0.0-beta.1" +version = "2.2.1" description = "Save filesystem and asset scopes and restore them when the app is reopened." authors = { workspace = true } license = { workspace = true } edition = { workspace = true } rust-version = { workspace = true } +repository = { workspace = true } [package.metadata.docs.rs] -rustc-args = [ "--cfg", "docsrs" ] -rustdoc-args = [ "--cfg", "docsrs" ] +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs"] + +[package.metadata.platforms.support] +windows = { level = "full", notes = "" } +linux = { level = "full", notes = "" } +macos = { level = "full", notes = "" } +android = { level = "full", notes = "" } +ios = { level = "full", notes = "" } [dependencies] serde = { workspace = true } @@ -19,7 +27,7 @@ log = { workspace = true } thiserror = { workspace = true } aho-corasick = "1" bincode = "1" -tauri-plugin-fs = { path = "../fs", version = "2.0.0-beta.1" } +tauri-plugin-fs = { path = "../fs", version = "2.2.1" } [features] -protocol-asset = [ "tauri/protocol-asset" ] +protocol-asset = ["tauri/protocol-asset"] diff --git a/plugins/persisted-scope/README.md b/plugins/persisted-scope/README.md index 9621b0f5..c3ec88fe 100644 --- a/plugins/persisted-scope/README.md +++ b/plugins/persisted-scope/README.md @@ -2,9 +2,17 @@ Save filesystem and asset scopes and restore them when the app is reopened. +| Platform | Supported | +| -------- | --------- | +| Linux | ✓ | +| Windows | ✓ | +| macOS | ✓ | +| Android | ✓ | +| iOS | ✓ | + ## Install -_This plugin requires a Rust version of at least **1.75**_ +_This plugin requires a Rust version of at least **1.77.2**_ There are three general methods of installation that we can recommend. @@ -18,7 +26,7 @@ Install the Core plugin by adding the following to your `Cargo.toml` file: ```toml [dependencies] -tauri-plugin-persisted-scope = "2.0.0-beta" +tauri-plugin-persisted-scope = "2.0.0" # alternatively with Git: tauri-plugin-persisted-scope = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` @@ -27,7 +35,7 @@ tauri-plugin-persisted-scope = { git = "https://github.com/tauri-apps/plugins-wo First you need to register the core plugin with Tauri: -`src-tauri/src/main.rs` +`src-tauri/src/lib.rs` ```rust fn main() { diff --git a/plugins/persisted-scope/SECURITY.md b/plugins/persisted-scope/SECURITY.md new file mode 100644 index 00000000..4f09bbac --- /dev/null +++ b/plugins/persisted-scope/SECURITY.md @@ -0,0 +1,23 @@ +# Security Policy + +**Do not report security vulnerabilities through public GitHub issues.** + +**Please use the [Private Vulnerability Disclosure](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability) feature of GitHub.** + +Include as much of the following information: + +- Type of issue (e.g. improper input parsing, privilege escalation, etc.) +- The location of the affected source code (tag/branch/commit or direct URL) +- Any special configuration required to reproduce the issue +- The distribution affected or used to help us with reproduction of the issue +- Step-by-step instructions to reproduce the issue +- Ideally a reproduction repository +- Impact of the issue, including how an attacker might exploit the issue + +We prefer to receive reports in English. + +## Contact + +Please disclose a vulnerability or security relevant issue here: [https://github.com/tauri-apps/plugins-workspace/security/advisories/new](https://github.com/tauri-apps/plugins-workspace/security/advisories/new). + +Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app). diff --git a/plugins/persisted-scope/src/lib.rs b/plugins/persisted-scope/src/lib.rs index d9988f8e..6ced7b24 100644 --- a/plugins/persisted-scope/src/lib.rs +++ b/plugins/persisted-scope/src/lib.rs @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -//! [![](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/persisted-scope/banner.png)](https://github.com/tauri-apps/plugins-workspace/tree/v2/plugins/persisted-scope) -//! //! Save filesystem and asset scopes and restore them when the app is reopened. #![doc( @@ -16,13 +14,11 @@ use serde::{Deserialize, Serialize}; use tauri::{ plugin::{Builder, TauriPlugin}, - scope::fs::Pattern as GlobPattern, Manager, Runtime, }; use tauri_plugin_fs::FsExt; use std::{ - collections::HashSet, fs::{create_dir_all, File}, io::Write, path::Path, @@ -46,81 +42,6 @@ const PATTERNS: &[&str] = &[ ]; const REPLACE_WITH: &[&str] = &[r"[", r"]", r"?", r"*", r"\?", r"\\?\", r"\\?\"]; -trait ScopeExt { - type Pattern: ToString; - - fn allow_file(&self, path: &Path); - fn allow_directory(&self, path: &Path, recursive: bool); - - fn forbid_file(&self, path: &Path); - fn forbid_directory(&self, path: &Path, recursive: bool); - - fn allowed_patterns(&self) -> HashSet; - fn forbidden_patterns(&self) -> HashSet; -} - -impl ScopeExt for tauri::scope::fs::Scope { - type Pattern = GlobPattern; - - fn allow_file(&self, path: &Path) { - let _ = tauri::scope::fs::Scope::allow_file(self, path); - } - - fn allow_directory(&self, path: &Path, recursive: bool) { - let _ = tauri::scope::fs::Scope::allow_directory(self, path, recursive); - } - - fn forbid_file(&self, path: &Path) { - let _ = tauri::scope::fs::Scope::forbid_file(self, path); - } - - fn forbid_directory(&self, path: &Path, recursive: bool) { - let _ = tauri::scope::fs::Scope::forbid_directory(self, path, recursive); - } - - fn allowed_patterns(&self) -> HashSet { - tauri::scope::fs::Scope::allowed_patterns(self) - } - - fn forbidden_patterns(&self) -> HashSet { - tauri::scope::fs::Scope::forbidden_patterns(self) - } -} - -impl ScopeExt for tauri_plugin_fs::Scope { - type Pattern = String; - - fn allow_file(&self, path: &Path) { - tauri_plugin_fs::Scope::allow_file(self, path); - } - - fn allow_directory(&self, path: &Path, recursive: bool) { - tauri_plugin_fs::Scope::allow_directory(self, path, recursive); - } - - fn forbid_file(&self, path: &Path) { - tauri_plugin_fs::Scope::forbid_file(self, path); - } - - fn forbid_directory(&self, path: &Path, recursive: bool) { - tauri_plugin_fs::Scope::forbid_directory(self, path, recursive); - } - - fn allowed_patterns(&self) -> HashSet { - self.allowed() - .into_iter() - .map(|p| p.to_string_lossy().to_string()) - .collect() - } - - fn forbidden_patterns(&self) -> HashSet { - self.forbidden() - .into_iter() - .map(|p| p.to_string_lossy().to_string()) - .collect() - } -} - #[derive(Debug, thiserror::Error)] enum Error { #[error(transparent)] @@ -181,41 +102,41 @@ fn fix_directory(path_str: &str) -> &Path { path } -fn allow_path(scope: &impl ScopeExt, path: &str) { +fn allow_path(scope: &tauri::fs::Scope, path: &str) { let target_type = detect_scope_type(path); match target_type { TargetType::File => { - scope.allow_file(Path::new(path)); + let _ = scope.allow_file(Path::new(path)); } TargetType::Directory => { // We remove the '*' at the end of it, else it will be escaped by the pattern. - scope.allow_directory(fix_directory(path), false); + let _ = scope.allow_directory(fix_directory(path), false); } TargetType::RecursiveDirectory => { // We remove the '**' at the end of it, else it will be escaped by the pattern. - scope.allow_directory(fix_directory(path), true); + let _ = scope.allow_directory(fix_directory(path), true); } } } -fn forbid_path(scope: &impl ScopeExt, path: &str) { +fn forbid_path(scope: &tauri::fs::Scope, path: &str) { let target_type = detect_scope_type(path); match target_type { TargetType::File => { - scope.forbid_file(Path::new(path)); + let _ = scope.forbid_file(Path::new(path)); } TargetType::Directory => { - scope.forbid_directory(fix_directory(path), false); + let _ = scope.forbid_directory(fix_directory(path), false); } TargetType::RecursiveDirectory => { - scope.forbid_directory(fix_directory(path), true); + let _ = scope.forbid_directory(fix_directory(path), true); } } } -fn save_scopes(scope: &impl ScopeExt, app_dir: &Path, scope_state_path: &Path) { +fn save_scopes(scope: &tauri::fs::Scope, app_dir: &Path, scope_state_path: &Path) { let scope = Scope { allowed_paths: scope .allowed_patterns() @@ -252,8 +173,11 @@ pub fn init() -> TauriPlugin { #[cfg(feature = "protocol-asset")] let asset_scope_state_path = app_dir.join(ASSET_SCOPE_STATE_FILENAME); - if let Some(fs_scope) = fs_scope { - fs_scope.forbid_file(&fs_scope_state_path); + if let Some(fs_scope) = &fs_scope { + let _ = fs_scope.forbid_file(&fs_scope_state_path); + } else { + #[cfg(debug_assertions)] + eprintln!("Please make sure to register the `fs` plugin before the `persisted-scope` plugin!"); } #[cfg(feature = "protocol-asset")] let _ = asset_protocol_scope.forbid_file(&asset_scope_state_path); @@ -262,7 +186,7 @@ pub fn init() -> TauriPlugin { // We will still save some semi-broken values because the scope events are quite spammy and we don't want to reduce runtime performance any further. let ac = AhoCorasick::new(PATTERNS).unwrap(/* This should be impossible to fail since we're using a small static input */); - if let Some(fs_scope) = fs_scope { + if let Some(fs_scope) = &fs_scope { if fs_scope_state_path.exists() { let scope: Scope = std::fs::read(&fs_scope_state_path) .map_err(Error::from) @@ -307,11 +231,11 @@ pub fn init() -> TauriPlugin { #[cfg(feature = "protocol-asset")] let app_dir_ = app_dir.clone(); - if let Some(fs_scope) = fs_scope { + if let Some(fs_scope) = &fs_scope { let app_ = app.clone(); fs_scope.listen(move |event| { - if let tauri_plugin_fs::ScopeEvent::PathAllowed(_) = event { - save_scopes(app_.fs_scope(), &app_dir, &fs_scope_state_path); + if let tauri::fs::Event::PathAllowed(_) = event { + save_scopes(&app_.fs_scope(), &app_dir, &fs_scope_state_path); } }); } diff --git a/plugins/positioner/.gitignore b/plugins/positioner/.gitignore deleted file mode 100644 index b512c09d..00000000 --- a/plugins/positioner/.gitignore +++ /dev/null @@ -1 +0,0 @@ -node_modules \ No newline at end of file diff --git a/plugins/positioner/CHANGELOG.md b/plugins/positioner/CHANGELOG.md index ebf02bd3..3070b168 100644 --- a/plugins/positioner/CHANGELOG.md +++ b/plugins/positioner/CHANGELOG.md @@ -1,5 +1,74 @@ # Changelog +## \[2.2.0] + +- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other. + +## \[2.1.0] + +- [`4db62635`](https://github.com/tauri-apps/plugins-workspace/commit/4db626354c8e29e37bedcf94787a8dd36ce21c55) ([#2076](https://github.com/tauri-apps/plugins-workspace/pull/2076) by [@jakobwesthoff](https://github.com/tauri-apps/plugins-workspace/../../jakobwesthoff)) Add `moveWindowConstrained` function that is similar to `moveWindow` but constrains the window to the screen dimensions in case of tray icon positions. + +## \[2.0.1] + +- [`3c1f3874`](https://github.com/tauri-apps/plugins-workspace/commit/3c1f3874f4c828637b3aa983cba13c77427faf58) ([#1911](https://github.com/tauri-apps/plugins-workspace/pull/1911) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Added missing permission for `handleIconState` and fixed its event processing logic. + +## \[2.0.1] + +- [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7. + +## \[2.0.0] + +- [`e2c4dfb6`](https://github.com/tauri-apps/plugins-workspace/commit/e2c4dfb6af43e5dd8d9ceba232c315f5febd55c1) Update to tauri v2 stable release. + +## \[2.0.0-rc.2] + +- [`2f7e32b5`](https://github.com/tauri-apps/plugins-workspace/commit/2f7e32b5e07454d6c0cf3ab03f8af8da74c4a8a7) ([#1822](https://github.com/tauri-apps/plugins-workspace/pull/1822) by [@jbolda](https://github.com/tauri-apps/plugins-workspace/../../jbolda)) `handleIconState` function for use in JavaScript event handlers. This allows one to update the TrayIcon state through JavaScript and fully create and handle the TrayIcon without requiring Rust (and the side-effect of creating a TrayIcon). + +## \[2.0.0-rc.1] + +- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri 2.0.0-rc.8 + +## \[2.0.0-rc.0] + +- [`9887d1`](https://github.com/tauri-apps/plugins-workspace/commit/9887d14bd0e971c4c0f5c1188fc4005d3fc2e29e) Update to tauri RC. + +## \[2.0.0-beta.8] + +- [`99d6ac0f`](https://github.com/tauri-apps/plugins-workspace/commit/99d6ac0f9506a6a4a1aa59c728157190a7441af6) ([#1606](https://github.com/tauri-apps/plugins-workspace/pull/1606) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) The JS packages now specify the *minimum* `@tauri-apps/api` version instead of a single exact version. +- [`6de87966`](https://github.com/tauri-apps/plugins-workspace/commit/6de87966ecc00ad9d91c25be452f1f46bd2b7e1f) ([#1597](https://github.com/tauri-apps/plugins-workspace/pull/1597) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Update to tauri beta.25. + +## \[2.0.0-beta.7] + +- [`22a17980`](https://github.com/tauri-apps/plugins-workspace/commit/22a17980ff4f6f8c40adb1b8f4ffc6dae2fe7e30) ([#1537](https://github.com/tauri-apps/plugins-workspace/pull/1537) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri beta.24. + +## \[2.0.0-beta.6] + +- [`76daee7a`](https://github.com/tauri-apps/plugins-workspace/commit/76daee7aafece34de3092c86e531cf9eb1138989) ([#1512](https://github.com/tauri-apps/plugins-workspace/pull/1512) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Update to tauri beta.23. + +## \[2.0.0-beta.5] + +- [`9013854f`](https://github.com/tauri-apps/plugins-workspace/commit/9013854f42a49a230b9dbb9d02774765528a923f)([#1382](https://github.com/tauri-apps/plugins-workspace/pull/1382)) Update to tauri beta.22. + +## \[2.0.0-beta.4] + +- [`430bd6f4`](https://github.com/tauri-apps/plugins-workspace/commit/430bd6f4f379bee5d232ae6b098ae131db7f178a)([#1363](https://github.com/tauri-apps/plugins-workspace/pull/1363)) Update to tauri beta.20. + +## \[2.0.0-beta.5] + +- [`d9de5b19`](https://github.com/tauri-apps/plugins-workspace/commit/d9de5b19d1e950c06f0915ae92a862acb266d108)([#1283](https://github.com/tauri-apps/plugins-workspace/pull/1283)) Implement `WindowExt` for `WebviewWindow`. + +## \[2.0.0-beta.3] + +- [`bd1ed590`](https://github.com/tauri-apps/plugins-workspace/commit/bd1ed5903ffcce5500310dac1e59e8c67674ef1e)([#1237](https://github.com/tauri-apps/plugins-workspace/pull/1237)) Update to tauri beta.17. + +## \[2.0.0-beta.3] + +- [`a04ea2f`](https://github.com/tauri-apps/plugins-workspace/commit/a04ea2f38294d5a3987578283badc8eec87a7752)([#1071](https://github.com/tauri-apps/plugins-workspace/pull/1071)) The global API script is now only added to the binary when the `withGlobalTauri` config is true. + +## \[2.0.0-beta.2] + +- [`99bea25`](https://github.com/tauri-apps/plugins-workspace/commit/99bea2559c2c0648c2519c50a18cd124dacef57b)([#1005](https://github.com/tauri-apps/plugins-workspace/pull/1005)) Update to tauri beta.8. + ## \[2.0.0-beta.1] - [`569defb`](https://github.com/tauri-apps/plugins-workspace/commit/569defbe9492e38938554bb7bdc1be9151456d21) Update to tauri beta.4. @@ -36,6 +105,11 @@ - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! +## \[1.0.5] + +- `TrayLeft`, `TrayRight` and `TrayCenter` will now position the window according to the tray position relative to the monitor dimensions to prevent windows being displayed partially off-screen. + - [3d27909](https://github.com/tauri-apps/plugins-workspace/commit/3d279094d44be78cdc5d1de3938f1414e13db6b0) fix(positioner): Prevent tray relative windows from being moved off-screen ([#291](https://github.com/tauri-apps/plugins-workspace/pull/291)) on 2023-09-27 + ## \[0.2.7] - Update Tauri to v1.0.0 @@ -87,18 +161,3 @@ ## \[0.1.0] - Update package/crate metadata - - [119d9c4](https://www.github.com/JonasKruckenberg/tauri-plugin-positioner/commit/119d9c47639e1df16f5520a08f039bdb6f39532b) update metadata on 2021-11-19 - - [39e517c](https://www.github.com/JonasKruckenberg/tauri-plugin-positioner/commit/39e517c145a4a901839ae9b46e296370ce6ababf) Update update-metadata.md on 2021-11-19 - data on 2021-11-19 - - [39e517c](https://www.github.com/JonasKruckenberg/tauri-plugin-positioner/commit/39e517c145a4a901839ae9b46e296370ce6ababf) Update update-metadata.md on 2021-11-19 - nberg/tauri-plugin-positioner/commit/119d9c47639e1df16f5520a08f039bdb6f39532b) update metadata on 2021-11-19 - - [39e517c](https://www.github.com/JonasKruckenberg/tauri-plugin-positioner/commit/39e517c145a4a901839ae9b46e296370ce6ababf) Update update-metadata.md on 2021-11-19 - data on 2021-11-19 - - [39e517c](https://www.github.com/JonasKruckenberg/tauri-plugin-positioner/commit/39e517c145a4a901839ae9b46e296370ce6ababf) Update update-metadata.md on 2021-11-19 - [39e517c](https://www.github.com/JonasKruckenberg/tauri-plugin-positioner/commit/39e517c145a4a901839ae9b46e296370ce6ababf) Update update-metadata.md on 2021-11-19 - data on 2021-11-19 - - [39e517c](https://www.github.com/JonasKruckenberg/tauri-plugin-positioner/commit/39e517c145a4a901839ae9b46e296370ce6ababf) Update update-metadata.md on 2021-11-19 - \-19 - data on 2021-11-19 - - [39e517c](https://www.github.com/JonasKruckenberg/tauri-plugin-positioner/commit/39e517c145a4a901839ae9b46e296370ce6ababf) Update update-metadata.md on 2021-11-19 -m/JonasKruckenberg/tauri-plugin-positioner/commit/39e517c145a4a901839ae9b46e296370ce6ababf) Update update-metadata.md on 2021-11-19 diff --git a/plugins/positioner/Cargo.toml b/plugins/positioner/Cargo.toml index 1e4b5730..3123f44c 100644 --- a/plugins/positioner/Cargo.toml +++ b/plugins/positioner/Cargo.toml @@ -1,19 +1,27 @@ [package] name = "tauri-plugin-positioner" -version = "2.0.0-beta.1" +version = "2.2.0" description = "Position your windows at well-known locations." authors = { workspace = true } license = { workspace = true } edition = { workspace = true } rust-version = { workspace = true } +repository = { workspace = true } links = "tauri-plugin-positioner" [package.metadata.docs.rs] -rustc-args = [ "--cfg", "docsrs" ] -rustdoc-args = [ "--cfg", "docsrs" ] +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs"] + +[package.metadata.platforms.support] +windows = { level = "full", notes = "" } +linux = { level = "full", notes = "" } +macos = { level = "full", notes = "" } +android = { level = "none", notes = "" } +ios = { level = "none", notes = "" } [build-dependencies] -tauri-plugin = { workspace = true, features = [ "build" ] } +tauri-plugin = { workspace = true, features = ["build"] } [dependencies] serde = { workspace = true } @@ -24,4 +32,4 @@ thiserror = { workspace = true } serde_repr = "0.1" [features] -tray-icon = [ "tauri/tray-icon" ] +tray-icon = ["tauri/tray-icon"] diff --git a/plugins/positioner/README.md b/plugins/positioner/README.md index 4dd31413..8a86160d 100644 --- a/plugins/positioner/README.md +++ b/plugins/positioner/README.md @@ -4,9 +4,17 @@ Position your windows at well-known locations. This plugin is a port of [electron-positioner](https://github.com/jenslind/electron-positioner) for Tauri. +| Platform | Supported | +| -------- | --------- | +| Linux | ✓ | +| Windows | ✓ | +| macOS | ✓ | +| Android | x | +| iOS | x | + ## Install -_This plugin requires a Rust version of at least **1.75**_ +_This plugin requires a Rust version of at least **1.77.2**_ There are three general methods of installation that we can recommend. @@ -20,7 +28,7 @@ Install the Core plugin by adding the following to your `Cargo.toml` file: ```toml [dependencies] -tauri-plugin-positioner = "2.0.0-beta" +tauri-plugin-positioner = "2.0.0" # alternatively with Git: tauri-plugin-positioner = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` @@ -48,27 +56,69 @@ yarn add https://github.com/tauri-apps/tauri-plugin-positioner#v2 First you need to register the core plugin with Tauri: -`src-tauri/src/main.rs` +`src-tauri/src/lib.rs` ```rust +use tauri::tray::TrayIconBuilder; + fn main() { tauri::Builder::default() .plugin(tauri_plugin_positioner::init()) // This is required to get tray-relative positions to work - .on_system_tray_event(|app, event| { - tauri_plugin_positioner::on_tray_event(app, &event); + .setup(|app| { + // note that this will create a new TrayIcon + TrayIconBuilder::new() + .on_tray_icon_event(|app, event| { + tauri_plugin_positioner::on_tray_event(app.app_handle(), &event); + }) + .build(app)?; + Ok(()) }) .run(tauri::generate_context!()) .expect("error while running tauri application"); } ``` +Alternatively, you may handle the tray events through JavaScript. Register the plugin as previously noted. + +```rust +fn main() { + tauri::Builder::default() + .plugin(tauri_plugin_positioner::init()) + .run(tauri::generate_context!()) + .expect("error while running tauri application"); +} +``` + +And in JavaScript, the `action` passed to the TrayIcon should include the handler. + +```javascript +import { + moveWindow, + Position, + handleIconState, +} from "@tauri-apps/plugin-positioner"; + +const action = async (event: TrayIconEvent) => { + // add the handle in the action to update the state + await handleIconState(event); + + if (event.type === "Click") { + // note this option requires enabling the `tray-icon` + // feature in the Cargo.toml + await moveWindow(Position.TrayLeft); + } +}; + +const tray = await TrayIcon.new({ id: "main", action }); +``` + Afterwards all the plugin's APIs are available through the JavaScript guest bindings: ```javascript -import { move_window, Position } from "@tauri-apps/plugin-positioner"; +import { moveWindow, Position } from '@tauri-apps/plugin-positioner' -move_window(Position.TopRight); +moveWindow(Position.TopRight) ``` If you only intend on moving the window from rust code, you can import the Window trait extension instead of registering the plugin: diff --git a/plugins/positioner/SECURITY.md b/plugins/positioner/SECURITY.md new file mode 100644 index 00000000..4f09bbac --- /dev/null +++ b/plugins/positioner/SECURITY.md @@ -0,0 +1,23 @@ +# Security Policy + +**Do not report security vulnerabilities through public GitHub issues.** + +**Please use the [Private Vulnerability Disclosure](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability) feature of GitHub.** + +Include as much of the following information: + +- Type of issue (e.g. improper input parsing, privilege escalation, etc.) +- The location of the affected source code (tag/branch/commit or direct URL) +- Any special configuration required to reproduce the issue +- The distribution affected or used to help us with reproduction of the issue +- Step-by-step instructions to reproduce the issue +- Ideally a reproduction repository +- Impact of the issue, including how an attacker might exploit the issue + +We prefer to receive reports in English. + +## Contact + +Please disclose a vulnerability or security relevant issue here: [https://github.com/tauri-apps/plugins-workspace/security/advisories/new](https://github.com/tauri-apps/plugins-workspace/security/advisories/new). + +Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app). diff --git a/plugins/positioner/api-iife.js b/plugins/positioner/api-iife.js new file mode 100644 index 00000000..dda21778 --- /dev/null +++ b/plugins/positioner/api-iife.js @@ -0,0 +1 @@ +if("__TAURI__"in window){var __TAURI_PLUGIN_POSITIONER__=function(t){"use strict";async function o(t,o={},e){return window.__TAURI_INTERNALS__.invoke(t,o,e)}var e;return"function"==typeof SuppressedError&&SuppressedError,t.Position=void 0,(e=t.Position||(t.Position={}))[e.TopLeft=0]="TopLeft",e[e.TopRight=1]="TopRight",e[e.BottomLeft=2]="BottomLeft",e[e.BottomRight=3]="BottomRight",e[e.TopCenter=4]="TopCenter",e[e.BottomCenter=5]="BottomCenter",e[e.LeftCenter=6]="LeftCenter",e[e.RightCenter=7]="RightCenter",e[e.Center=8]="Center",e[e.TrayLeft=9]="TrayLeft",e[e.TrayBottomLeft=10]="TrayBottomLeft",e[e.TrayRight=11]="TrayRight",e[e.TrayBottomRight=12]="TrayBottomRight",e[e.TrayCenter=13]="TrayCenter",e[e.TrayBottomCenter=14]="TrayBottomCenter",t.handleIconState=async function(t){await o("plugin:positioner|set_tray_icon_state",{position:t.rect.position,size:t.rect.size})},t.moveWindow=async function(t){await o("plugin:positioner|move_window",{position:t})},t.moveWindowConstrained=async function(t){await o("plugin:positioner|move_window_constrained",{position:t})},t}({});Object.defineProperty(window.__TAURI__,"positioner",{value:__TAURI_PLUGIN_POSITIONER__})} diff --git a/plugins/positioner/build.rs b/plugins/positioner/build.rs index 1fc5acfb..830c61fb 100644 --- a/plugins/positioner/build.rs +++ b/plugins/positioner/build.rs @@ -2,8 +2,14 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -const COMMANDS: &[&str] = &["move_window"]; +const COMMANDS: &[&str] = &[ + "move_window", + "move_window_constrained", + "set_tray_icon_state", +]; fn main() { - tauri_plugin::Builder::new(COMMANDS).build(); + tauri_plugin::Builder::new(COMMANDS) + .global_api_script_path("./api-iife.js") + .build(); } diff --git a/plugins/positioner/guest-js/index.ts b/plugins/positioner/guest-js/index.ts index aba39831..74d0295e 100644 --- a/plugins/positioner/guest-js/index.ts +++ b/plugins/positioner/guest-js/index.ts @@ -3,7 +3,8 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { invoke } from "@tauri-apps/api/core"; +import { invoke } from '@tauri-apps/api/core' +import type { TrayIconEvent } from '@tauri-apps/api/tray' /** * Well known window positions. @@ -23,7 +24,7 @@ export enum Position { TrayRight, TrayBottomRight, TrayCenter, - TrayBottomCenter, + TrayBottomCenter } /** @@ -33,7 +34,27 @@ export enum Position { * @param to The {@link Position} to move to. */ export async function moveWindow(to: Position): Promise { - await invoke("plugin:positioner|move_window", { - position: to, - }); + await invoke('plugin:positioner|move_window', { + position: to + }) +} + +/** + * Moves the `Window` to the given {@link Position} using `WindowExt.move_window_constrained()` + * + * This move operation constrains the window to the screen dimensions in case of + * tray-icon positions. + * @param to The (tray) {@link Position} to move to. + */ +export async function moveWindowConstrained(to: Position): Promise { + await invoke('plugin:positioner|move_window_constrained', { + position: to + }) +} + +export async function handleIconState(event: TrayIconEvent): Promise { + await invoke('plugin:positioner|set_tray_icon_state', { + position: event.rect.position, + size: event.rect.size + }) } diff --git a/plugins/positioner/package.json b/plugins/positioner/package.json index d1ed0729..fd57b990 100644 --- a/plugins/positioner/package.json +++ b/plugins/positioner/package.json @@ -1,11 +1,12 @@ { "name": "@tauri-apps/plugin-positioner", - "version": "2.0.0-beta.1", + "version": "2.2.0", "description": "Position your windows at well-known locations.", - "license": "MIT or APACHE-2.0", + "license": "MIT OR Apache-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" ], + "repository": "https://github.com/tauri-apps/plugins-workspace", "type": "module", "types": "./dist-js/index.d.ts", "main": "./dist-js/index.cjs", @@ -24,6 +25,6 @@ "LICENSE" ], "dependencies": { - "@tauri-apps/api": "2.0.0-beta.2" + "@tauri-apps/api": "^2.0.0" } } diff --git a/plugins/positioner/permissions/autogenerated/commands/move_window_constrained.toml b/plugins/positioner/permissions/autogenerated/commands/move_window_constrained.toml new file mode 100644 index 00000000..80343990 --- /dev/null +++ b/plugins/positioner/permissions/autogenerated/commands/move_window_constrained.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-move-window-constrained" +description = "Enables the move_window_constrained command without any pre-configured scope." +commands.allow = ["move_window_constrained"] + +[[permission]] +identifier = "deny-move-window-constrained" +description = "Denies the move_window_constrained command without any pre-configured scope." +commands.deny = ["move_window_constrained"] diff --git a/plugins/positioner/permissions/autogenerated/commands/set_tray_icon_state.toml b/plugins/positioner/permissions/autogenerated/commands/set_tray_icon_state.toml new file mode 100644 index 00000000..6b85f635 --- /dev/null +++ b/plugins/positioner/permissions/autogenerated/commands/set_tray_icon_state.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-set-tray-icon-state" +description = "Enables the set_tray_icon_state command without any pre-configured scope." +commands.allow = ["set_tray_icon_state"] + +[[permission]] +identifier = "deny-set-tray-icon-state" +description = "Denies the set_tray_icon_state command without any pre-configured scope." +commands.deny = ["set_tray_icon_state"] diff --git a/plugins/positioner/permissions/autogenerated/reference.md b/plugins/positioner/permissions/autogenerated/reference.md index 60d18ba5..f6e09133 100644 --- a/plugins/positioner/permissions/autogenerated/reference.md +++ b/plugins/positioner/permissions/autogenerated/reference.md @@ -1,14 +1,97 @@ -# Permissions +## Default Permission -## allow-move-window +Allows the moveWindow and handleIconState APIs + +#### This default permission set includes the following: + +- `allow-move-window` +- `allow-move-window-constrained` +- `allow-set-tray-icon-state` + +## Permission Table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IdentifierDescription
+ +`positioner:allow-move-window` + + Enables the move_window command without any pre-configured scope. -## deny-move-window +
+ +`positioner:deny-move-window` + + Denies the move_window command without any pre-configured scope. -## default +
+ +`positioner:allow-move-window-constrained` + + + +Enables the move_window_constrained command without any pre-configured scope. + +
+ +`positioner:deny-move-window-constrained` + + + +Denies the move_window_constrained command without any pre-configured scope. + +
+ +`positioner:allow-set-tray-icon-state` + + + +Enables the set_tray_icon_state command without any pre-configured scope. + +
+ +`positioner:deny-set-tray-icon-state` + + -Allows the move_window command +Denies the set_tray_icon_state command without any pre-configured scope. +
diff --git a/plugins/positioner/permissions/default.toml b/plugins/positioner/permissions/default.toml index b0b3b3e2..7fc3c3d9 100644 --- a/plugins/positioner/permissions/default.toml +++ b/plugins/positioner/permissions/default.toml @@ -1,4 +1,8 @@ "$schema" = "schemas/schema.json" [default] -description = "Allows the move_window command" -permissions = ["allow-move-window"] +description = "Allows the moveWindow and handleIconState APIs" +permissions = [ + "allow-move-window", + "allow-move-window-constrained", + "allow-set-tray-icon-state", +] diff --git a/plugins/positioner/permissions/schemas/schema.json b/plugins/positioner/permissions/schemas/schema.json index b5c0d3ae..b0fc760a 100644 --- a/plugins/positioner/permissions/schemas/schema.json +++ b/plugins/positioner/permissions/schemas/schema.json @@ -17,7 +17,6 @@ }, "set": { "description": "A list of permissions sets defined", - "default": [], "type": "array", "items": { "$ref": "#/definitions/PermissionSet" @@ -50,7 +49,7 @@ "minimum": 1.0 }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -112,7 +111,7 @@ "type": "string" }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri internal convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -132,12 +131,21 @@ }, "scope": { "description": "Allowed or denied scoped when using this permission.", - "default": {}, "allOf": [ { "$ref": "#/definitions/Scopes" } ] + }, + "platforms": { + "description": "Target platforms this permission applies. By default all platforms are affected by this permission.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Target" + } } } }, @@ -164,7 +172,7 @@ } }, "Scopes": { - "description": "A restriction of the command/endpoint functionality.\n\nIt can be of any serde serializable type and is used for allowing or preventing certain actions inside a Tauri command.\n\nThe scope is passed to the command and handled/enforced by the command itself.", + "description": "An argument for fine grained behavior control of Tauri commands.\n\nIt can be of any serde serializable type and is used to allow or prevent certain actions inside a Tauri command. The configured scope is passed to the command and will be enforced by the command implementation.\n\n## Example\n\n```json { \"allow\": [{ \"path\": \"$HOME/**\" }], \"deny\": [{ \"path\": \"$HOME/secret.txt\" }] } ```", "type": "object", "properties": { "allow": { @@ -178,7 +186,7 @@ } }, "deny": { - "description": "Data that defines what is denied by the scope.", + "description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.", "type": [ "array", "null" @@ -243,29 +251,90 @@ } ] }, - "PermissionKind": { - "type": "string", + "Target": { + "description": "Platform target.", "oneOf": [ { - "description": "allow-move-window -> Enables the move_window command without any pre-configured scope.", + "description": "MacOS.", "type": "string", "enum": [ - "allow-move-window" + "macOS" ] }, { - "description": "deny-move-window -> Denies the move_window command without any pre-configured scope.", + "description": "Windows.", "type": "string", "enum": [ - "deny-move-window" + "windows" ] }, { - "description": "default -> Allows the move_window command", + "description": "Linux.", "type": "string", "enum": [ - "default" + "linux" ] + }, + { + "description": "Android.", + "type": "string", + "enum": [ + "android" + ] + }, + { + "description": "iOS.", + "type": "string", + "enum": [ + "iOS" + ] + } + ] + }, + "PermissionKind": { + "type": "string", + "oneOf": [ + { + "description": "Enables the move_window command without any pre-configured scope.", + "type": "string", + "const": "allow-move-window", + "markdownDescription": "Enables the move_window command without any pre-configured scope." + }, + { + "description": "Denies the move_window command without any pre-configured scope.", + "type": "string", + "const": "deny-move-window", + "markdownDescription": "Denies the move_window command without any pre-configured scope." + }, + { + "description": "Enables the move_window_constrained command without any pre-configured scope.", + "type": "string", + "const": "allow-move-window-constrained", + "markdownDescription": "Enables the move_window_constrained command without any pre-configured scope." + }, + { + "description": "Denies the move_window_constrained command without any pre-configured scope.", + "type": "string", + "const": "deny-move-window-constrained", + "markdownDescription": "Denies the move_window_constrained command without any pre-configured scope." + }, + { + "description": "Enables the set_tray_icon_state command without any pre-configured scope.", + "type": "string", + "const": "allow-set-tray-icon-state", + "markdownDescription": "Enables the set_tray_icon_state command without any pre-configured scope." + }, + { + "description": "Denies the set_tray_icon_state command without any pre-configured scope.", + "type": "string", + "const": "deny-set-tray-icon-state", + "markdownDescription": "Denies the set_tray_icon_state command without any pre-configured scope." + }, + { + "description": "Allows the moveWindow and handleIconState APIs\n#### This default permission set includes:\n\n- `allow-move-window`\n- `allow-move-window-constrained`\n- `allow-set-tray-icon-state`", + "type": "string", + "const": "default", + "markdownDescription": "Allows the moveWindow and handleIconState APIs\n#### This default permission set includes:\n\n- `allow-move-window`\n- `allow-move-window-constrained`\n- `allow-set-tray-icon-state`" } ] } diff --git a/plugins/positioner/rollup.config.js b/plugins/positioner/rollup.config.js index 977dfac8..1f349ec8 100644 --- a/plugins/positioner/rollup.config.js +++ b/plugins/positioner/rollup.config.js @@ -2,6 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { createConfig } from "../../shared/rollup.config.js"; +import { createConfig } from '../../shared/rollup.config.js' -export default createConfig(); +export default createConfig() diff --git a/plugins/positioner/src/api-iife.js b/plugins/positioner/src/api-iife.js deleted file mode 100644 index d0c8ba69..00000000 --- a/plugins/positioner/src/api-iife.js +++ /dev/null @@ -1 +0,0 @@ -if("__TAURI__"in window){var __TAURI_PLUGIN_POSITIONER__=function(t){"use strict";var o;return"function"==typeof SuppressedError&&SuppressedError,t.Position=void 0,(o=t.Position||(t.Position={}))[o.TopLeft=0]="TopLeft",o[o.TopRight=1]="TopRight",o[o.BottomLeft=2]="BottomLeft",o[o.BottomRight=3]="BottomRight",o[o.TopCenter=4]="TopCenter",o[o.BottomCenter=5]="BottomCenter",o[o.LeftCenter=6]="LeftCenter",o[o.RightCenter=7]="RightCenter",o[o.Center=8]="Center",o[o.TrayLeft=9]="TrayLeft",o[o.TrayBottomLeft=10]="TrayBottomLeft",o[o.TrayRight=11]="TrayRight",o[o.TrayBottomRight=12]="TrayBottomRight",o[o.TrayCenter=13]="TrayCenter",o[o.TrayBottomCenter=14]="TrayBottomCenter",t.moveWindow=async function(t){await async function(t,o={},e){return window.__TAURI_INTERNALS__.invoke(t,o,e)}("plugin:positioner|move_window",{position:t})},t}({});Object.defineProperty(window.__TAURI__,"positioner",{value:__TAURI_PLUGIN_POSITIONER__})} diff --git a/plugins/positioner/src/ext.rs b/plugins/positioner/src/ext.rs index 36ec7f91..b3d405ea 100644 --- a/plugins/positioner/src/ext.rs +++ b/plugins/positioner/src/ext.rs @@ -8,7 +8,9 @@ use crate::Tray; use serde_repr::Deserialize_repr; #[cfg(feature = "tray-icon")] use tauri::Manager; -use tauri::{PhysicalPosition, PhysicalSize, Result, Runtime, Window}; +#[cfg(feature = "tray-icon")] +use tauri::Monitor; +use tauri::{PhysicalPosition, PhysicalSize, Result, Runtime, WebviewWindow, Window}; /// Well known window positions. #[derive(Debug, Deserialize_repr)] @@ -41,167 +43,265 @@ pub enum Position { pub trait WindowExt { /// Moves the [`Window`] to the given [`Position`] /// - /// All positions are relative to the **current** screen. + /// All (non-tray) positions are relative to the **current** screen. fn move_window(&self, position: Position) -> Result<()>; + #[cfg(feature = "tray-icon")] + /// Moves the [`Window`] to the given [`Position`] while constraining Tray Positions to the dimensions of the screen. + /// + /// All non-tray positions will not be constrained by this method. + /// + /// This method allows you to position your Tray Windows without having them + /// cut off on the screen borders. + fn move_window_constrained(&self, position: Position) -> Result<()>; +} + +impl WindowExt for WebviewWindow { + fn move_window(&self, pos: Position) -> Result<()> { + self.as_ref().window().move_window(pos) + } + + #[cfg(feature = "tray-icon")] + fn move_window_constrained(&self, position: Position) -> Result<()> { + self.as_ref().window().move_window_constrained(position) + } } impl WindowExt for Window { + #[cfg(feature = "tray-icon")] + fn move_window_constrained(&self, position: Position) -> Result<()> { + // Diverge to basic move_window, if the position is not a tray position + if !matches!( + position, + Position::TrayLeft + | Position::TrayBottomLeft + | Position::TrayRight + | Position::TrayBottomRight + | Position::TrayCenter + | Position::TrayBottomCenter + ) { + return self.move_window(position); + } + + let window_position = calculate_position(self, position)?; + let monitor = get_monitor_for_tray_icon(self)?; + if let Some(monitor) = monitor { + let monitor_size = monitor.size(); + let monitor_position = monitor.position(); + let window_size = self.outer_size()?; + + let right_border_monitor = monitor_position.x as f64 + monitor_size.width as f64; + let left_border_monitor = monitor_position.x as f64; + let right_border_window = window_position.x as f64 + window_size.width as f64; + let left_border_window = window_position.x as f64; + + let constrained_x = if left_border_window < left_border_monitor { + left_border_monitor + } else if right_border_window > right_border_monitor { + right_border_monitor - window_size.width as f64 + } else { + window_position.x as f64 + }; + + let bottom_border_monitor = monitor_position.y as f64 + monitor_size.height as f64; + let top_border_monitor = monitor_position.y as f64; + let bottom_border_window = window_position.y as f64 + window_size.height as f64; + let top_border_window = window_position.y as f64; + + let constrained_y = if top_border_window < top_border_monitor { + top_border_monitor + } else if bottom_border_window > bottom_border_monitor { + bottom_border_monitor - window_size.height as f64 + } else { + window_position.y as f64 + }; + + self.set_position(PhysicalPosition::new(constrained_x, constrained_y))?; + } else { + // Fallback on non constrained positioning + self.set_position(window_position)?; + } + + Ok(()) + } + fn move_window(&self, pos: Position) -> Result<()> { - use Position::*; - - let screen = self.current_monitor()?.unwrap(); - let screen_position = screen.position(); - let screen_size = PhysicalSize:: { - width: screen.size().width as i32, - height: screen.size().height as i32, - }; - let window_size = PhysicalSize:: { - width: self.outer_size()?.width as i32, - height: self.outer_size()?.height as i32, - }; + let position = calculate_position(self, pos)?; + self.set_position(position) + } +} + +#[cfg(feature = "tray-icon")] +/// Retrieve the monitor, where the tray icon is located on. +fn get_monitor_for_tray_icon(window: &Window) -> Result> { + let tray_position = window + .state::() + .0 + .lock() + .unwrap() + .map(|(pos, _)| pos) + .unwrap_or_default(); + + window.monitor_from_point(tray_position.x, tray_position.y) +} + +/// Calculate the top-left position of the window based on the given +/// [`Position`]. +fn calculate_position( + window: &Window, + pos: Position, +) -> Result> { + use Position::*; + + let screen = window.current_monitor()?.unwrap(); + // Only use the screen_position for the Tray independent positioning, + // because a tray event may not be called on the currently active monitor. + let screen_position = screen.position(); + let screen_size = PhysicalSize:: { + width: screen.size().width as i32, + height: screen.size().height as i32, + }; + let window_size = PhysicalSize:: { + width: window.outer_size()?.width as i32, + height: window.outer_size()?.height as i32, + }; + #[cfg(feature = "tray-icon")] + let (tray_position, tray_size) = window + .state::() + .0 + .lock() + .unwrap() + .map(|(pos, size)| { + ( + Some((pos.x as i32, pos.y as i32)), + Some((size.width as i32, size.height as i32)), + ) + }) + .unwrap_or_default(); + + let physical_pos = match pos { + TopLeft => *screen_position, + TopRight => PhysicalPosition { + x: screen_position.x + (screen_size.width - window_size.width), + y: screen_position.y, + }, + BottomLeft => PhysicalPosition { + x: screen_position.x, + y: screen_size.height - (window_size.height - screen_position.y), + }, + BottomRight => PhysicalPosition { + x: screen_position.x + (screen_size.width - window_size.width), + y: screen_size.height - (window_size.height - screen_position.y), + }, + TopCenter => PhysicalPosition { + x: screen_position.x + ((screen_size.width / 2) - (window_size.width / 2)), + y: screen_position.y, + }, + BottomCenter => PhysicalPosition { + x: screen_position.x + ((screen_size.width / 2) - (window_size.width / 2)), + y: screen_size.height - (window_size.height - screen_position.y), + }, + LeftCenter => PhysicalPosition { + x: screen_position.x, + y: screen_position.y + (screen_size.height / 2) - (window_size.height / 2), + }, + RightCenter => PhysicalPosition { + x: screen_position.x + (screen_size.width - window_size.width), + y: screen_position.y + (screen_size.height / 2) - (window_size.height / 2), + }, + Center => PhysicalPosition { + x: screen_position.x + ((screen_size.width / 2) - (window_size.width / 2)), + y: screen_position.y + (screen_size.height / 2) - (window_size.height / 2), + }, #[cfg(feature = "tray-icon")] - let (tray_position, tray_size) = self - .state::() - .0 - .lock() - .unwrap() - .map(|(pos, size)| { - ( - Some((pos.x as i32, pos.y as i32)), - Some((size.width as i32, size.height as i32)), - ) - }) - .unwrap_or_default(); - - let physical_pos = match pos { - TopLeft => *screen_position, - TopRight => PhysicalPosition { - x: screen_position.x + (screen_size.width - window_size.width), - y: screen_position.y, - }, - BottomLeft => PhysicalPosition { - x: screen_position.x, - y: screen_size.height - (window_size.height - screen_position.y), - }, - BottomRight => PhysicalPosition { - x: screen_position.x + (screen_size.width - window_size.width), - y: screen_size.height - (window_size.height - screen_position.y), - }, - TopCenter => PhysicalPosition { - x: screen_position.x + ((screen_size.width / 2) - (window_size.width / 2)), - y: screen_position.y, - }, - BottomCenter => PhysicalPosition { - x: screen_position.x + ((screen_size.width / 2) - (window_size.width / 2)), - y: screen_size.height - (window_size.height - screen_position.y), - }, - LeftCenter => PhysicalPosition { - x: screen_position.x, - y: screen_position.y + (screen_size.height / 2) - (window_size.height / 2), - }, - RightCenter => PhysicalPosition { - x: screen_position.x + (screen_size.width - window_size.width), - y: screen_position.y + (screen_size.height / 2) - (window_size.height / 2), - }, - Center => PhysicalPosition { - x: screen_position.x + ((screen_size.width / 2) - (window_size.width / 2)), - y: screen_position.y + (screen_size.height / 2) - (window_size.height / 2), - }, - #[cfg(feature = "tray-icon")] - TrayLeft => { - if let (Some((tray_x, tray_y)), Some((_, _tray_height))) = - (tray_position, tray_size) - { - let y = tray_y - window_size.height; - // Choose y value based on the target OS - #[cfg(target_os = "windows")] - let y = if y < 0 { tray_y + _tray_height } else { y }; - - #[cfg(target_os = "macos")] - let y = if y < 0 { tray_y } else { y }; - - PhysicalPosition { x: tray_x, y } - } else { - panic!("Tray position not set"); - } + TrayLeft => { + if let (Some((tray_x, tray_y)), Some((_, _tray_height))) = (tray_position, tray_size) { + let y = tray_y - window_size.height; + // Choose y value based on the target OS + #[cfg(target_os = "windows")] + let y = if y < 0 { tray_y + _tray_height } else { y }; + + #[cfg(target_os = "macos")] + let y = if y < 0 { tray_y } else { y }; + + PhysicalPosition { x: tray_x, y } + } else { + panic!("Tray position not set"); } - #[cfg(feature = "tray-icon")] - TrayBottomLeft => { - if let Some((tray_x, tray_y)) = tray_position { - PhysicalPosition { - x: tray_x, - y: tray_y, - } - } else { - panic!("Tray position not set"); + } + #[cfg(feature = "tray-icon")] + TrayBottomLeft => { + if let Some((tray_x, tray_y)) = tray_position { + PhysicalPosition { + x: tray_x, + y: tray_y, } + } else { + panic!("Tray position not set"); } - #[cfg(feature = "tray-icon")] - TrayRight => { - if let (Some((tray_x, tray_y)), Some((tray_width, _tray_height))) = - (tray_position, tray_size) - { - let y = tray_y - window_size.height; - // Choose y value based on the target OS - #[cfg(target_os = "windows")] - let y = if y < 0 { tray_y + _tray_height } else { y }; - - #[cfg(target_os = "macos")] - let y = if y < 0 { tray_y } else { y }; - - PhysicalPosition { - x: tray_x + tray_width, - y, - } - } else { - panic!("Tray position not set"); + } + #[cfg(feature = "tray-icon")] + TrayRight => { + if let (Some((tray_x, tray_y)), Some((tray_width, _tray_height))) = + (tray_position, tray_size) + { + let y = tray_y - window_size.height; + // Choose y value based on the target OS + #[cfg(target_os = "windows")] + let y = if y < 0 { tray_y + _tray_height } else { y }; + + #[cfg(target_os = "macos")] + let y = if y < 0 { tray_y } else { y }; + + PhysicalPosition { + x: tray_x + tray_width, + y, } + } else { + panic!("Tray position not set"); } - #[cfg(feature = "tray-icon")] - TrayBottomRight => { - if let (Some((tray_x, tray_y)), Some((tray_width, _))) = (tray_position, tray_size) - { - PhysicalPosition { - x: tray_x + tray_width, - y: tray_y, - } - } else { - panic!("Tray position not set"); + } + #[cfg(feature = "tray-icon")] + TrayBottomRight => { + if let (Some((tray_x, tray_y)), Some((tray_width, _))) = (tray_position, tray_size) { + PhysicalPosition { + x: tray_x + tray_width, + y: tray_y, } + } else { + panic!("Tray position not set"); } - #[cfg(feature = "tray-icon")] - TrayCenter => { - if let (Some((tray_x, tray_y)), Some((tray_width, _tray_height))) = - (tray_position, tray_size) - { - let x = tray_x + tray_width / 2 - window_size.width / 2; - let y = tray_y - window_size.height; - // Choose y value based on the target OS - #[cfg(target_os = "windows")] - let y = if y < 0 { tray_y + _tray_height } else { y }; - - #[cfg(target_os = "macos")] - let y = if y < 0 { tray_y } else { y }; - - PhysicalPosition { x, y } - } else { - panic!("Tray position not set"); - } + } + #[cfg(feature = "tray-icon")] + TrayCenter => { + if let (Some((tray_x, tray_y)), Some((tray_width, _tray_height))) = + (tray_position, tray_size) + { + let x = tray_x + tray_width / 2 - window_size.width / 2; + let y = tray_y - window_size.height; + // Choose y value based on the target OS + #[cfg(target_os = "windows")] + let y = if y < 0 { tray_y + _tray_height } else { y }; + + #[cfg(target_os = "macos")] + let y = if y < 0 { tray_y } else { y }; + + PhysicalPosition { x, y } + } else { + panic!("Tray position not set"); } - #[cfg(feature = "tray-icon")] - TrayBottomCenter => { - if let (Some((tray_x, tray_y)), Some((tray_width, _))) = (tray_position, tray_size) - { - PhysicalPosition { - x: tray_x + (tray_width / 2) - (window_size.width / 2), - y: tray_y, - } - } else { - panic!("Tray position not set"); + } + #[cfg(feature = "tray-icon")] + TrayBottomCenter => { + if let (Some((tray_x, tray_y)), Some((tray_width, _))) = (tray_position, tray_size) { + PhysicalPosition { + x: tray_x + (tray_width / 2) - (window_size.width / 2), + y: tray_y, } + } else { + panic!("Tray position not set"); } - }; + } + }; - self.set_position(tauri::Position::Physical(physical_pos)) - } + Ok(physical_pos) } diff --git a/plugins/positioner/src/lib.rs b/plugins/positioner/src/lib.rs index 6c5b735e..59d0c3c1 100644 --- a/plugins/positioner/src/lib.rs +++ b/plugins/positioner/src/lib.rs @@ -3,8 +3,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -//! [![](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/positioner/banner.png)](https://github.com/tauri-apps/plugins-workspace/tree/v2/plugins/positioner) -//! //! A plugin for Tauri that helps position your windows at well-known locations. //! //! # Cargo features @@ -35,14 +33,22 @@ struct Tray(std::sync::Mutex, PhysicalSize)>> #[cfg(feature = "tray-icon")] pub fn on_tray_event(app: &AppHandle, event: &TrayIconEvent) { - let position = PhysicalPosition { - x: event.x, - y: event.y, - }; - let size = PhysicalSize { - width: event.icon_rect.right - event.icon_rect.left, - height: event.icon_rect.bottom - event.icon_rect.top, + let (position, size) = { + match event { + TrayIconEvent::Click { rect, .. } + | TrayIconEvent::Enter { rect, .. } + | TrayIconEvent::Leave { rect, .. } + | TrayIconEvent::Move { rect, .. } => { + // tray-icon emits PhysicalSize so the scale factor should not matter. + let size = rect.size.to_physical(1.0); + let position = rect.position.to_physical(1.0); + (position, size) + } + + _ => return, + } }; + app.state::() .0 .lock() @@ -55,11 +61,38 @@ async fn move_window(window: tauri::Window, position: Position) - window.move_window(position) } +#[cfg(feature = "tray-icon")] +#[tauri::command] +async fn move_window_constrained( + window: tauri::Window, + position: Position, +) -> Result<()> { + window.move_window_constrained(position) +} + +#[cfg(feature = "tray-icon")] +#[tauri::command] +fn set_tray_icon_state( + app: AppHandle, + position: PhysicalPosition, + size: PhysicalSize, +) { + app.state::() + .0 + .lock() + .unwrap() + .replace((position, size)); +} + /// The Tauri plugin that exposes [`WindowExt::move_window`] to the webview. pub fn init() -> TauriPlugin { - let plugin = plugin::Builder::new("positioner") - .js_init_script(include_str!("api-iife.js").to_string()) - .invoke_handler(tauri::generate_handler![move_window]); + let plugin = plugin::Builder::new("positioner").invoke_handler(tauri::generate_handler![ + move_window, + #[cfg(feature = "tray-icon")] + move_window_constrained, + #[cfg(feature = "tray-icon")] + set_tray_icon_state + ]); #[cfg(feature = "tray-icon")] let plugin = plugin.setup(|app_handle, _api| { diff --git a/plugins/process/CHANGELOG.md b/plugins/process/CHANGELOG.md index 84b71e6f..12cb7136 100644 --- a/plugins/process/CHANGELOG.md +++ b/plugins/process/CHANGELOG.md @@ -1,5 +1,62 @@ # Changelog +## \[2.2.1] + +- [`d2aef2fd`](https://github.com/tauri-apps/plugins-workspace/commit/d2aef2fddbdfad6526935c55ac10a94171a4f5f5) ([#2581](https://github.com/tauri-apps/plugins-workspace/pull/2581)) Migrate restart to use tauri's new `AppHandle::request_restart` method + +## \[2.2.0] + +- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other. + +## \[2.0.1] + +- [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7. + +## \[2.0.0] + +- [`e2c4dfb6`](https://github.com/tauri-apps/plugins-workspace/commit/e2c4dfb6af43e5dd8d9ceba232c315f5febd55c1) Update to tauri v2 stable release. + +## \[2.0.0-rc.1] + +- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri 2.0.0-rc.8 + +## \[2.0.0-rc.0] + +- [`9887d1`](https://github.com/tauri-apps/plugins-workspace/commit/9887d14bd0e971c4c0f5c1188fc4005d3fc2e29e) Update to tauri RC. + +## \[2.0.0-beta.8] + +- [`99d6ac0f`](https://github.com/tauri-apps/plugins-workspace/commit/99d6ac0f9506a6a4a1aa59c728157190a7441af6) ([#1606](https://github.com/tauri-apps/plugins-workspace/pull/1606) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) The JS packages now specify the *minimum* `@tauri-apps/api` version instead of a single exact version. +- [`6de87966`](https://github.com/tauri-apps/plugins-workspace/commit/6de87966ecc00ad9d91c25be452f1f46bd2b7e1f) ([#1597](https://github.com/tauri-apps/plugins-workspace/pull/1597) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Update to tauri beta.25. + +## \[2.0.0-beta.7] + +- [`22a17980`](https://github.com/tauri-apps/plugins-workspace/commit/22a17980ff4f6f8c40adb1b8f4ffc6dae2fe7e30) ([#1537](https://github.com/tauri-apps/plugins-workspace/pull/1537) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri beta.24. + +## \[2.0.0-beta.6] + +- [`76daee7a`](https://github.com/tauri-apps/plugins-workspace/commit/76daee7aafece34de3092c86e531cf9eb1138989) ([#1512](https://github.com/tauri-apps/plugins-workspace/pull/1512) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Update to tauri beta.23. + +## \[2.0.0-beta.5] + +- [`9013854f`](https://github.com/tauri-apps/plugins-workspace/commit/9013854f42a49a230b9dbb9d02774765528a923f)([#1382](https://github.com/tauri-apps/plugins-workspace/pull/1382)) Update to tauri beta.22. + +## \[2.0.0-beta.4] + +- [`430bd6f4`](https://github.com/tauri-apps/plugins-workspace/commit/430bd6f4f379bee5d232ae6b098ae131db7f178a)([#1363](https://github.com/tauri-apps/plugins-workspace/pull/1363)) Update to tauri beta.20. + +## \[2.0.0-beta.3] + +- [`bd1ed590`](https://github.com/tauri-apps/plugins-workspace/commit/bd1ed5903ffcce5500310dac1e59e8c67674ef1e)([#1237](https://github.com/tauri-apps/plugins-workspace/pull/1237)) Update to tauri beta.17. + +## \[2.0.0-beta.3] + +- [`a04ea2f`](https://github.com/tauri-apps/plugins-workspace/commit/a04ea2f38294d5a3987578283badc8eec87a7752)([#1071](https://github.com/tauri-apps/plugins-workspace/pull/1071)) The global API script is now only added to the binary when the `withGlobalTauri` config is true. + +## \[2.0.0-beta.2] + +- [`99bea25`](https://github.com/tauri-apps/plugins-workspace/commit/99bea2559c2c0648c2519c50a18cd124dacef57b)([#1005](https://github.com/tauri-apps/plugins-workspace/pull/1005)) Update to tauri beta.8. + ## \[2.0.0-beta.1] - [`569defb`](https://github.com/tauri-apps/plugins-workspace/commit/569defbe9492e38938554bb7bdc1be9151456d21) Update to tauri beta.4. @@ -35,10 +92,3 @@ ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - te to alpha.11. - -## \[2.0.0-alpha.0] - -- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - ae67\`]\(https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! -717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/process/Cargo.toml b/plugins/process/Cargo.toml index 5d1b2e1a..8ccf62c5 100644 --- a/plugins/process/Cargo.toml +++ b/plugins/process/Cargo.toml @@ -1,19 +1,27 @@ [package] name = "tauri-plugin-process" -version = "2.0.0-beta.1" +version = "2.2.1" description = "Access the current process of your Tauri application." edition = { workspace = true } authors = { workspace = true } license = { workspace = true } rust-version = { workspace = true } +repository = { workspace = true } links = "tauri-plugin-process" [package.metadata.docs.rs] -rustc-args = [ "--cfg", "docsrs" ] -rustdoc-args = [ "--cfg", "docsrs" ] +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs"] + +[package.metadata.platforms.support] +windows = { level = "full", notes = "" } +linux = { level = "full", notes = "" } +macos = { level = "full", notes = "" } +android = { level = "none", notes = "" } +ios = { level = "none", notes = "" } [build-dependencies] -tauri-plugin = { workspace = true, features = [ "build" ] } +tauri-plugin = { workspace = true, features = ["build"] } [dependencies] tauri = { workspace = true } diff --git a/plugins/process/README.md b/plugins/process/README.md index 515539d3..9f75bacb 100644 --- a/plugins/process/README.md +++ b/plugins/process/README.md @@ -2,9 +2,17 @@ This plugin provides APIs to access the current process. To spawn child processes, see the [`shell`](https://github.com/tauri-apps/tauri-plugin-shell) plugin. +| Platform | Supported | +| -------- | --------- | +| Linux | ✓ | +| Windows | ✓ | +| macOS | ✓ | +| Android | x | +| iOS | x | + ## Install -_This plugin requires a Rust version of at least **1.75**_ +_This plugin requires a Rust version of at least **1.77.2**_ There are three general methods of installation that we can recommend. @@ -18,7 +26,7 @@ Install the Core plugin by adding the following to your `Cargo.toml` file: ```toml [dependencies] -tauri-plugin-process = "2.0.0-beta" +tauri-plugin-process = "2.0.0" # alternatively with Git: tauri-plugin-process = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` @@ -46,7 +54,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-process#v2 First you need to register the core plugin with Tauri: -`src-tauri/src/main.rs` +`src-tauri/src/lib.rs` ```rust fn main() { @@ -60,11 +68,11 @@ fn main() { Afterwards all the plugin's APIs are available through the JavaScript guest bindings: ```javascript -import { exit, relaunch } from "@tauri-apps/plugin-process"; +import { exit, relaunch } from '@tauri-apps/plugin-process' // exit the app with the given status code -await exit(0); +await exit(0) // restart the app -await relaunch(); +await relaunch() ``` ## Contributing diff --git a/plugins/process/SECURITY.md b/plugins/process/SECURITY.md new file mode 100644 index 00000000..4f09bbac --- /dev/null +++ b/plugins/process/SECURITY.md @@ -0,0 +1,23 @@ +# Security Policy + +**Do not report security vulnerabilities through public GitHub issues.** + +**Please use the [Private Vulnerability Disclosure](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability) feature of GitHub.** + +Include as much of the following information: + +- Type of issue (e.g. improper input parsing, privilege escalation, etc.) +- The location of the affected source code (tag/branch/commit or direct URL) +- Any special configuration required to reproduce the issue +- The distribution affected or used to help us with reproduction of the issue +- Step-by-step instructions to reproduce the issue +- Ideally a reproduction repository +- Impact of the issue, including how an attacker might exploit the issue + +We prefer to receive reports in English. + +## Contact + +Please disclose a vulnerability or security relevant issue here: [https://github.com/tauri-apps/plugins-workspace/security/advisories/new](https://github.com/tauri-apps/plugins-workspace/security/advisories/new). + +Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app). diff --git a/plugins/process/api-iife.js b/plugins/process/api-iife.js new file mode 100644 index 00000000..b214396e --- /dev/null +++ b/plugins/process/api-iife.js @@ -0,0 +1 @@ +if("__TAURI__"in window){var __TAURI_PLUGIN_PROCESS__=function(_){"use strict";async function n(_,n={},e){return window.__TAURI_INTERNALS__.invoke(_,n,e)}return"function"==typeof SuppressedError&&SuppressedError,_.exit=async function(_=0){await n("plugin:process|exit",{code:_})},_.relaunch=async function(){await n("plugin:process|restart")},_}({});Object.defineProperty(window.__TAURI__,"process",{value:__TAURI_PLUGIN_PROCESS__})} diff --git a/plugins/process/build.rs b/plugins/process/build.rs index e9d6cfda..e412b34e 100644 --- a/plugins/process/build.rs +++ b/plugins/process/build.rs @@ -5,5 +5,7 @@ const COMMANDS: &[&str] = &["exit", "restart"]; fn main() { - tauri_plugin::Builder::new(COMMANDS).build(); + tauri_plugin::Builder::new(COMMANDS) + .global_api_script_path("./api-iife.js") + .build(); } diff --git a/plugins/process/guest-js/index.ts b/plugins/process/guest-js/index.ts index 2d30b346..da15831a 100644 --- a/plugins/process/guest-js/index.ts +++ b/plugins/process/guest-js/index.ts @@ -7,7 +7,7 @@ * @module */ -import { invoke } from "@tauri-apps/api/core"; +import { invoke } from '@tauri-apps/api/core' /** * Exits immediately with the given `exitCode`. @@ -23,7 +23,7 @@ import { invoke } from "@tauri-apps/api/core"; * @since 2.0.0 */ async function exit(code = 0): Promise { - return invoke("plugin:process|exit", { code }); + await invoke('plugin:process|exit', { code }) } /** @@ -39,7 +39,7 @@ async function exit(code = 0): Promise { * @since 2.0.0 */ async function relaunch(): Promise { - return invoke("plugin:process|restart"); + await invoke('plugin:process|restart') } -export { exit, relaunch }; +export { exit, relaunch } diff --git a/plugins/process/package.json b/plugins/process/package.json index eb7a8af5..fdb2ad49 100644 --- a/plugins/process/package.json +++ b/plugins/process/package.json @@ -1,10 +1,11 @@ { "name": "@tauri-apps/plugin-process", - "version": "2.0.0-beta.1", - "license": "MIT or APACHE-2.0", + "version": "2.2.1", + "license": "MIT OR Apache-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" ], + "repository": "https://github.com/tauri-apps/plugins-workspace", "type": "module", "types": "./dist-js/index.d.ts", "main": "./dist-js/index.cjs", @@ -23,6 +24,6 @@ "LICENSE" ], "dependencies": { - "@tauri-apps/api": "2.0.0-beta.2" + "@tauri-apps/api": "^2.0.0" } } diff --git a/plugins/process/permissions/autogenerated/reference.md b/plugins/process/permissions/autogenerated/reference.md index a5822a92..6cb15b5f 100644 --- a/plugins/process/permissions/autogenerated/reference.md +++ b/plugins/process/permissions/autogenerated/reference.md @@ -1,18 +1,77 @@ -# Permissions +## Default Permission -## allow-exit +This permission set configures which +process features are by default exposed. + +#### Granted Permissions + +This enables to quit via `allow-exit` and restart via `allow-restart` +the application. + + +#### This default permission set includes the following: + +- `allow-exit` +- `allow-restart` + +## Permission Table + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IdentifierDescription
+ +`process:allow-exit` + + Enables the exit command without any pre-configured scope. -## deny-exit +
+ +`process:deny-exit` + + Denies the exit command without any pre-configured scope. -## allow-restart +
+ +`process:allow-restart` + + Enables the restart command without any pre-configured scope. -## deny-restart +
+ +`process:deny-restart` + + Denies the restart command without any pre-configured scope. +
diff --git a/plugins/process/permissions/default.toml b/plugins/process/permissions/default.toml new file mode 100644 index 00000000..69a9b00d --- /dev/null +++ b/plugins/process/permissions/default.toml @@ -0,0 +1,14 @@ +"$schema" = "schemas/schema.json" + +[default] +description = """ +This permission set configures which +process features are by default exposed. + +#### Granted Permissions + +This enables to quit via `allow-exit` and restart via `allow-restart` +the application. +""" + +permissions = ["allow-exit", "allow-restart"] diff --git a/plugins/process/permissions/schemas/schema.json b/plugins/process/permissions/schemas/schema.json index 37d49a04..9d68fc63 100644 --- a/plugins/process/permissions/schemas/schema.json +++ b/plugins/process/permissions/schemas/schema.json @@ -17,7 +17,6 @@ }, "set": { "description": "A list of permissions sets defined", - "default": [], "type": "array", "items": { "$ref": "#/definitions/PermissionSet" @@ -50,7 +49,7 @@ "minimum": 1.0 }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -112,7 +111,7 @@ "type": "string" }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri internal convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -132,12 +131,21 @@ }, "scope": { "description": "Allowed or denied scoped when using this permission.", - "default": {}, "allOf": [ { "$ref": "#/definitions/Scopes" } ] + }, + "platforms": { + "description": "Target platforms this permission applies. By default all platforms are affected by this permission.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Target" + } } } }, @@ -164,7 +172,7 @@ } }, "Scopes": { - "description": "A restriction of the command/endpoint functionality.\n\nIt can be of any serde serializable type and is used for allowing or preventing certain actions inside a Tauri command.\n\nThe scope is passed to the command and handled/enforced by the command itself.", + "description": "An argument for fine grained behavior control of Tauri commands.\n\nIt can be of any serde serializable type and is used to allow or prevent certain actions inside a Tauri command. The configured scope is passed to the command and will be enforced by the command implementation.\n\n## Example\n\n```json { \"allow\": [{ \"path\": \"$HOME/**\" }], \"deny\": [{ \"path\": \"$HOME/secret.txt\" }] } ```", "type": "object", "properties": { "allow": { @@ -178,7 +186,7 @@ } }, "deny": { - "description": "Data that defines what is denied by the scope.", + "description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.", "type": [ "array", "null" @@ -243,36 +251,78 @@ } ] }, - "PermissionKind": { - "type": "string", + "Target": { + "description": "Platform target.", "oneOf": [ { - "description": "allow-exit -> Enables the exit command without any pre-configured scope.", + "description": "MacOS.", "type": "string", "enum": [ - "allow-exit" + "macOS" ] }, { - "description": "deny-exit -> Denies the exit command without any pre-configured scope.", + "description": "Windows.", "type": "string", "enum": [ - "deny-exit" + "windows" ] }, { - "description": "allow-restart -> Enables the restart command without any pre-configured scope.", + "description": "Linux.", "type": "string", "enum": [ - "allow-restart" + "linux" ] }, { - "description": "deny-restart -> Denies the restart command without any pre-configured scope.", + "description": "Android.", "type": "string", "enum": [ - "deny-restart" + "android" ] + }, + { + "description": "iOS.", + "type": "string", + "enum": [ + "iOS" + ] + } + ] + }, + "PermissionKind": { + "type": "string", + "oneOf": [ + { + "description": "Enables the exit command without any pre-configured scope.", + "type": "string", + "const": "allow-exit", + "markdownDescription": "Enables the exit command without any pre-configured scope." + }, + { + "description": "Denies the exit command without any pre-configured scope.", + "type": "string", + "const": "deny-exit", + "markdownDescription": "Denies the exit command without any pre-configured scope." + }, + { + "description": "Enables the restart command without any pre-configured scope.", + "type": "string", + "const": "allow-restart", + "markdownDescription": "Enables the restart command without any pre-configured scope." + }, + { + "description": "Denies the restart command without any pre-configured scope.", + "type": "string", + "const": "deny-restart", + "markdownDescription": "Denies the restart command without any pre-configured scope." + }, + { + "description": "This permission set configures which\nprocess features are by default exposed.\n\n#### Granted Permissions\n\nThis enables to quit via `allow-exit` and restart via `allow-restart`\nthe application.\n\n#### This default permission set includes:\n\n- `allow-exit`\n- `allow-restart`", + "type": "string", + "const": "default", + "markdownDescription": "This permission set configures which\nprocess features are by default exposed.\n\n#### Granted Permissions\n\nThis enables to quit via `allow-exit` and restart via `allow-restart`\nthe application.\n\n#### This default permission set includes:\n\n- `allow-exit`\n- `allow-restart`" } ] } diff --git a/plugins/process/rollup.config.js b/plugins/process/rollup.config.js index 977dfac8..1f349ec8 100644 --- a/plugins/process/rollup.config.js +++ b/plugins/process/rollup.config.js @@ -2,6 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { createConfig } from "../../shared/rollup.config.js"; +import { createConfig } from '../../shared/rollup.config.js' -export default createConfig(); +export default createConfig() diff --git a/plugins/process/src/api-iife.js b/plugins/process/src/api-iife.js deleted file mode 100644 index df87d8c9..00000000 --- a/plugins/process/src/api-iife.js +++ /dev/null @@ -1 +0,0 @@ -if("__TAURI__"in window){var __TAURI_PLUGIN_PROCESS__=function(n){"use strict";async function r(n,r={},_){return window.__TAURI_INTERNALS__.invoke(n,r,_)}return"function"==typeof SuppressedError&&SuppressedError,n.exit=async function(n=0){return r("plugin:process|exit",{code:n})},n.relaunch=async function(){return r("plugin:process|restart")},n}({});Object.defineProperty(window.__TAURI__,"process",{value:__TAURI_PLUGIN_PROCESS__})} diff --git a/plugins/process/src/commands.rs b/plugins/process/src/commands.rs index 2c27a3d2..3777294a 100644 --- a/plugins/process/src/commands.rs +++ b/plugins/process/src/commands.rs @@ -11,5 +11,5 @@ pub fn exit(app: AppHandle, code: i32) { #[tauri::command] pub fn restart(app: AppHandle) { - app.restart() + app.request_restart() } diff --git a/plugins/process/src/lib.rs b/plugins/process/src/lib.rs index 2de82914..b83d8964 100644 --- a/plugins/process/src/lib.rs +++ b/plugins/process/src/lib.rs @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -//! [![](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/process/banner.png)](https://github.com/tauri-apps/plugins-workspace/tree/v2/plugins/process) -//! //! This plugin provides APIs to access the current process. To spawn child processes, see the [`shell`](https://github.com/tauri-apps/tauri-plugin-shell) plugin. #![doc( @@ -20,7 +18,6 @@ mod commands; pub fn init() -> TauriPlugin { Builder::new("process") - .js_init_script(include_str!("api-iife.js").to_string()) .invoke_handler(tauri::generate_handler![commands::exit, commands::restart]) .build() } diff --git a/plugins/shell/CHANGELOG.md b/plugins/shell/CHANGELOG.md index 13d76c86..9af199bf 100644 --- a/plugins/shell/CHANGELOG.md +++ b/plugins/shell/CHANGELOG.md @@ -1,5 +1,93 @@ # Changelog +## \[2.2.1] + +### bug + +- [`9cf0390a`](https://github.com/tauri-apps/plugins-workspace/commit/9cf0390a52497e273db1a1b613a0e26827aa327c) Apply the default open validation regex `^((mailto:\w+)|(tel:\w+)|(https?://\w+)).+` when the open configuration is not set, preventing unchecked input from being used in this scenario (previously the plugin would skip validation when it should disable all calls). This keeps backwards compatibility while still fixing this vulnerability. + The scope is no longer validated for Rust calls via `ShellExt::shell()` so if you need to block JavaScript from calling the API you can simply set `tauri.conf.json > plugins > shell > open` to `false`. + +## \[2.2.0] + +- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other. + +## \[2.0.1] + +- [`51ddf6a7`](https://github.com/tauri-apps/plugins-workspace/commit/51ddf6a71544acfb261ffc9393dab1342da0a219) ([#1881](https://github.com/tauri-apps/plugins-workspace/pull/1881) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) On Windows, Fix `open` JS API hanging and freezing the app. + +## \[2.0.1] + +- [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7. + +## \[2.0.0] + +- [`e2c4dfb6`](https://github.com/tauri-apps/plugins-workspace/commit/e2c4dfb6af43e5dd8d9ceba232c315f5febd55c1) Update to tauri v2 stable release. + +## \[2.0.0-rc.4] + +- [`44273b98`](https://github.com/tauri-apps/plugins-workspace/commit/44273b988957a254eff715d6be7547d2ace882e1) ([#1839](https://github.com/tauri-apps/plugins-workspace/pull/1839) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Fix the plugin schema requiring to set `sidecar` property when it is in fact optional. + +## \[2.0.0-rc.1] + +- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri 2.0.0-rc.8 + +## \[2.0.0-rc.2] + +- [`b9147758`](https://github.com/tauri-apps/plugins-workspace/commit/b914775898c2bee7ceb20bd17ee595005cd17a64) ([#1679](https://github.com/tauri-apps/plugins-workspace/pull/1679) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Explicitly set a minimum macOS version for the Swift package. + +## \[2.0.0-rc.1] + +### changes + +- [`6b079cfd`](https://github.com/tauri-apps/plugins-workspace/commit/6b079cfdd107c94abc2c7300f6af00bac3ff4040) ([#1649](https://github.com/tauri-apps/plugins-workspace/pull/1649) by [@ahqsoftwares](https://github.com/tauri-apps/plugins-workspace/../../ahqsoftwares)) Remove targetSdk from build.kts files as it is deprecated and will be removed from DSL v9.0 + +## \[2.0.0-rc.0] + +- [`9887d1`](https://github.com/tauri-apps/plugins-workspace/commit/9887d14bd0e971c4c0f5c1188fc4005d3fc2e29e) Update to tauri RC. +- [`34df132f`](https://github.com/tauri-apps/plugins-workspace/commit/34df132fb14212ba7330adc9ccd64267751950c8) ([#1603](https://github.com/tauri-apps/plugins-workspace/pull/1603)) Change the `open` scope validator regex to match on the entire string. +- [`34df132f`](https://github.com/tauri-apps/plugins-workspace/commit/34df132fb14212ba7330adc9ccd64267751950c8) ([#1603](https://github.com/tauri-apps/plugins-workspace/pull/1603)) Change the `execute` scope argument validator regex to match on the entire string by default. + If this behavior is not desired check the `raw` boolean configuration option that is available along the `validator` string. + +## \[2.0.0-beta.9] + +- [`99d6ac0f`](https://github.com/tauri-apps/plugins-workspace/commit/99d6ac0f9506a6a4a1aa59c728157190a7441af6) ([#1606](https://github.com/tauri-apps/plugins-workspace/pull/1606) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) The JS packages now specify the *minimum* `@tauri-apps/api` version instead of a single exact version. +- [`6de87966`](https://github.com/tauri-apps/plugins-workspace/commit/6de87966ecc00ad9d91c25be452f1f46bd2b7e1f) ([#1597](https://github.com/tauri-apps/plugins-workspace/pull/1597) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Update to tauri beta.25. + +## \[2.0.0-beta.8] + +- [`22a17980`](https://github.com/tauri-apps/plugins-workspace/commit/22a17980ff4f6f8c40adb1b8f4ffc6dae2fe7e30) ([#1537](https://github.com/tauri-apps/plugins-workspace/pull/1537) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri beta.24. + +## \[2.0.0-beta.7] + +- [`76daee7a`](https://github.com/tauri-apps/plugins-workspace/commit/76daee7aafece34de3092c86e531cf9eb1138989) ([#1512](https://github.com/tauri-apps/plugins-workspace/pull/1512) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Update to tauri beta.23. + +## \[2.0.0-beta.6] + +- [`9013854f`](https://github.com/tauri-apps/plugins-workspace/commit/9013854f42a49a230b9dbb9d02774765528a923f)([#1382](https://github.com/tauri-apps/plugins-workspace/pull/1382)) Update to tauri beta.22. + +## \[2.0.0-beta.5] + +- [`430bd6f4`](https://github.com/tauri-apps/plugins-workspace/commit/430bd6f4f379bee5d232ae6b098ae131db7f178a)([#1363](https://github.com/tauri-apps/plugins-workspace/pull/1363)) Update to tauri beta.20. + +## \[2.0.0-beta.4] + +- [`eb1679b9`](https://github.com/tauri-apps/plugins-workspace/commit/eb1679b99780e5d2b867f5649a1ccc2f3f70ab56)([#1299](https://github.com/tauri-apps/plugins-workspace/pull/1299)) Fix `Command.execute` API including extra new lines. +- [`eb1679b9`](https://github.com/tauri-apps/plugins-workspace/commit/eb1679b99780e5d2b867f5649a1ccc2f3f70ab56)([#1299](https://github.com/tauri-apps/plugins-workspace/pull/1299)) Improve the speed of the JS `Command.execute` API + +## \[2.0.0-beta.3] + +- [`bd1ed590`](https://github.com/tauri-apps/plugins-workspace/commit/bd1ed5903ffcce5500310dac1e59e8c67674ef1e)([#1237](https://github.com/tauri-apps/plugins-workspace/pull/1237)) Update to tauri beta.17. + +## \[2.0.0-beta.3] + +- [`a04ea2f`](https://github.com/tauri-apps/plugins-workspace/commit/a04ea2f38294d5a3987578283badc8eec87a7752)([#1071](https://github.com/tauri-apps/plugins-workspace/pull/1071)) The global API script is now only added to the binary when the `withGlobalTauri` config is true. +- [`040004a`](https://github.com/tauri-apps/plugins-workspace/commit/040004a6b9fbb89161d1b5764d79428dfe693776)([#1069](https://github.com/tauri-apps/plugins-workspace/pull/1069)) Change shell's schema property name `command` to `cmd`. + +## \[2.0.0-beta.2] + +- [`9586eab`](https://github.com/tauri-apps/plugins-workspace/commit/9586eabd5a96673e4d976757777f470ae358d68a)([#1021](https://github.com/tauri-apps/plugins-workspace/pull/1021)) On Windows, fix `open` can't open file if the file is being used by a program. +- [`99bea25`](https://github.com/tauri-apps/plugins-workspace/commit/99bea2559c2c0648c2519c50a18cd124dacef57b)([#1005](https://github.com/tauri-apps/plugins-workspace/pull/1005)) Update to tauri beta.8. + ## \[2.0.0-beta.1] - [`569defb`](https://github.com/tauri-apps/plugins-workspace/commit/569defbe9492e38938554bb7bdc1be9151456d21) Update to tauri beta.4. @@ -35,18 +123,3 @@ ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - d `Command::arg`, `Command::env` and changed `Command::new` input type. -- [`52ef0ad`](https://github.com/tauri-apps/plugins-workspace/commit/52ef0addd84a1737a4e1a4b07113a30d3d496fa1)([#463](https://github.com/tauri-apps/plugins-workspace/pull/463)) Ensure the launched process is detached so it can out-live your tauri app and does not shutdown with it. -- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11. - -## \[2.0.0-alpha.0] - -- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - .com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - ins-workspace/pull/555)) Update to alpha.11. - -## \[2.0.0-alpha.0] - -- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - .com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! -717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/shell/Cargo.toml b/plugins/shell/Cargo.toml index f4d957ce..f3f1248c 100644 --- a/plugins/shell/Cargo.toml +++ b/plugins/shell/Cargo.toml @@ -1,31 +1,42 @@ [package] name = "tauri-plugin-shell" -version = "2.0.0-beta.1" +version = "2.2.1" description = "Access the system shell. Allows you to spawn child processes and manage files and URLs using their default application." edition = { workspace = true } authors = { workspace = true } license = { workspace = true } rust-version = { workspace = true } +repository = { workspace = true } links = "tauri-plugin-shell" [package.metadata.docs.rs] -rustc-args = [ "--cfg", "docsrs" ] -rustdoc-args = [ "--cfg", "docsrs" ] +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs"] + +[package.metadata.platforms.support] +windows = { level = "full", notes = "" } +linux = { level = "full", notes = "" } +macos = { level = "full", notes = "" } +android = { level = "partial", notes = "Only allows to open URLs via `open`" } +ios = { level = "partial", notes = "Only allows to open URLs via `open`" } [build-dependencies] -tauri-plugin = { workspace = true, features = [ "build" ] } +tauri-plugin = { workspace = true, features = ["build"] } schemars = { workspace = true } serde = { workspace = true } [dependencies] serde = { workspace = true } -schemars = { workspace = true } serde_json = { workspace = true } tauri = { workspace = true } +tokio = { version = "1", features = ["time"] } log = { workspace = true } thiserror = { workspace = true } shared_child = "1" regex = "1" -open = "4" +open = { version = "5", features = ["shellexecute-on-windows"] } encoding_rs = "0.8" os_pipe = "1" + +[target.'cfg(target_os = "ios")'.dependencies] +tauri = { workspace = true, features = ["wry"] } diff --git a/plugins/shell/README.md b/plugins/shell/README.md index d97899e2..5f309b8c 100644 --- a/plugins/shell/README.md +++ b/plugins/shell/README.md @@ -2,9 +2,17 @@ Access the system shell. Allows you to spawn child processes and manage files and URLs using their default application. +| Platform | Supported | +| -------- | --------- | +| Linux | ✓ | +| Windows | ✓ | +| macOS | ✓ | +| Android | ✓ | +| iOS | ✓ | + ## Install -_This plugin requires a Rust version of at least **1.75**_ +_This plugin requires a Rust version of at least **1.77.2**_ There are three general methods of installation that we can recommend. @@ -18,7 +26,7 @@ Install the Core plugin by adding the following to your `Cargo.toml` file: ```toml [dependencies] -tauri-plugin-shell = "2.0.0-beta" +tauri-plugin-shell = "2.0.0" # alternatively with Git: tauri-plugin-shell = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` @@ -46,7 +54,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-shell#v2 First you need to register the core plugin with Tauri: -`src-tauri/src/main.rs` +`src-tauri/src/lib.rs` ```rust fn main() { @@ -60,8 +68,8 @@ fn main() { Afterwards all the plugin's APIs are available through the JavaScript guest bindings: ```javascript -import { Command } from "@tauri-apps/plugin-shell"; -Command.create("git", ["commit", "-m", "the commit message"]); +import { Command } from '@tauri-apps/plugin-shell' +Command.create('git', ['commit', '-m', 'the commit message']) ``` ## Contributing diff --git a/plugins/shell/SECURITY.md b/plugins/shell/SECURITY.md new file mode 100644 index 00000000..4f09bbac --- /dev/null +++ b/plugins/shell/SECURITY.md @@ -0,0 +1,23 @@ +# Security Policy + +**Do not report security vulnerabilities through public GitHub issues.** + +**Please use the [Private Vulnerability Disclosure](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability) feature of GitHub.** + +Include as much of the following information: + +- Type of issue (e.g. improper input parsing, privilege escalation, etc.) +- The location of the affected source code (tag/branch/commit or direct URL) +- Any special configuration required to reproduce the issue +- The distribution affected or used to help us with reproduction of the issue +- Step-by-step instructions to reproduce the issue +- Ideally a reproduction repository +- Impact of the issue, including how an attacker might exploit the issue + +We prefer to receive reports in English. + +## Contact + +Please disclose a vulnerability or security relevant issue here: [https://github.com/tauri-apps/plugins-workspace/security/advisories/new](https://github.com/tauri-apps/plugins-workspace/security/advisories/new). + +Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app). diff --git a/plugins/shell/android/.gitignore b/plugins/shell/android/.gitignore new file mode 100644 index 00000000..c0f21ec2 --- /dev/null +++ b/plugins/shell/android/.gitignore @@ -0,0 +1,2 @@ +/build +/.tauri diff --git a/plugins/shell/android/build.gradle.kts b/plugins/shell/android/build.gradle.kts new file mode 100644 index 00000000..88082c65 --- /dev/null +++ b/plugins/shell/android/build.gradle.kts @@ -0,0 +1,39 @@ +plugins { + id("com.android.library") + id("org.jetbrains.kotlin.android") +} + +android { + namespace = "app.tauri.shell" + compileSdk = 34 + + defaultConfig { + minSdk = 24 + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles("consumer-rules.pro") + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = "1.8" + } +} + +dependencies { + implementation("androidx.core:core-ktx:1.9.0") + implementation("com.fasterxml.jackson.core:jackson-databind:2.15.3") + implementation(project(":tauri-android")) +} diff --git a/plugins/shell/android/proguard-rules.pro b/plugins/shell/android/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/plugins/shell/android/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/plugins/shell/android/settings.gradle b/plugins/shell/android/settings.gradle new file mode 100644 index 00000000..14a752e4 --- /dev/null +++ b/plugins/shell/android/settings.gradle @@ -0,0 +1,2 @@ +include ':tauri-android' +project(':tauri-android').projectDir = new File('./.tauri/tauri-api') diff --git a/plugins/shell/android/src/main/AndroidManifest.xml b/plugins/shell/android/src/main/AndroidManifest.xml new file mode 100644 index 00000000..9a40236b --- /dev/null +++ b/plugins/shell/android/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/plugins/shell/android/src/main/java/ShellPlugin.kt b/plugins/shell/android/src/main/java/ShellPlugin.kt new file mode 100644 index 00000000..2268bc26 --- /dev/null +++ b/plugins/shell/android/src/main/java/ShellPlugin.kt @@ -0,0 +1,30 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +package app.tauri.shell + +import android.app.Activity +import android.content.Intent +import android.net.Uri +import app.tauri.annotation.Command +import app.tauri.annotation.TauriPlugin +import app.tauri.plugin.Invoke +import app.tauri.plugin.Plugin +import java.io.File + +@TauriPlugin +class ShellPlugin(private val activity: Activity) : Plugin(activity) { + @Command + fun open(invoke: Invoke) { + try { + val url = invoke.parseArgs(String::class.java) + val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url)) + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + activity.applicationContext?.startActivity(intent) + invoke.resolve() + } catch (ex: Exception) { + invoke.reject(ex.message) + } + } +} \ No newline at end of file diff --git a/plugins/shell/api-iife.js b/plugins/shell/api-iife.js new file mode 100644 index 00000000..07ef37fc --- /dev/null +++ b/plugins/shell/api-iife.js @@ -0,0 +1 @@ +if("__TAURI__"in window){var __TAURI_PLUGIN_SHELL__=function(e){"use strict";function t(e,t,s,i){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?i:"a"===s?i.call(e):i?i.value:t.get(e)}function s(e,t,s,i,n){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,s),s}var i,n,r,o;"function"==typeof SuppressedError&&SuppressedError;const a="__TAURI_TO_IPC_KEY__";class h{constructor(e){i.set(this,void 0),n.set(this,0),r.set(this,[]),o.set(this,void 0),s(this,i,e||(()=>{})),this.id=function(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}((e=>{const a=e.index;if("end"in e)return void(a==t(this,n,"f")?this.cleanupCallback():s(this,o,a));const h=e.message;if(a==t(this,n,"f")){for(t(this,i,"f").call(this,h),s(this,n,t(this,n,"f")+1);t(this,n,"f")in t(this,r,"f");){const e=t(this,r,"f")[t(this,n,"f")];t(this,i,"f").call(this,e),delete t(this,r,"f")[t(this,n,"f")],s(this,n,t(this,n,"f")+1)}t(this,n,"f")===t(this,o,"f")&&this.cleanupCallback()}else t(this,r,"f")[a]=h}))}cleanupCallback(){Reflect.deleteProperty(window,`_${this.id}`)}set onmessage(e){s(this,i,e)}get onmessage(){return t(this,i,"f")}[(i=new WeakMap,n=new WeakMap,r=new WeakMap,o=new WeakMap,a)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[a]()}}async function c(e,t={},s){return window.__TAURI_INTERNALS__.invoke(e,t,s)}class l{constructor(){this.eventListeners=Object.create(null)}addListener(e,t){return this.on(e,t)}removeListener(e,t){return this.off(e,t)}on(e,t){return e in this.eventListeners?this.eventListeners[e].push(t):this.eventListeners[e]=[t],this}once(e,t){const s=i=>{this.removeListener(e,s),t(i)};return this.addListener(e,s)}off(e,t){return e in this.eventListeners&&(this.eventListeners[e]=this.eventListeners[e].filter((e=>e!==t))),this}removeAllListeners(e){return e?delete this.eventListeners[e]:this.eventListeners=Object.create(null),this}emit(e,t){if(e in this.eventListeners){const s=this.eventListeners[e];for(const e of s)e(t);return!0}return!1}listenerCount(e){return e in this.eventListeners?this.eventListeners[e].length:0}prependListener(e,t){return e in this.eventListeners?this.eventListeners[e].unshift(t):this.eventListeners[e]=[t],this}prependOnceListener(e,t){const s=i=>{this.removeListener(e,s),t(i)};return this.prependListener(e,s)}}class u{constructor(e){this.pid=e}async write(e){await c("plugin:shell|stdin_write",{pid:this.pid,buffer:e})}async kill(){await c("plugin:shell|kill",{cmd:"killChild",pid:this.pid})}}class p extends l{constructor(e,t=[],s){super(),this.stdout=new l,this.stderr=new l,this.program=e,this.args="string"==typeof t?[t]:t,this.options=s??{}}static create(e,t=[],s){return new p(e,t,s)}static sidecar(e,t=[],s){const i=new p(e,t,s);return i.options.sidecar=!0,i}async spawn(){const e=this.program,t=this.args,s=this.options;"object"==typeof t&&Object.freeze(t);const i=new h;return i.onmessage=e=>{switch(e.event){case"Error":this.emit("error",e.payload);break;case"Terminated":this.emit("close",e.payload);break;case"Stdout":this.stdout.emit("data",e.payload);break;case"Stderr":this.stderr.emit("data",e.payload)}},await c("plugin:shell|spawn",{program:e,args:t,options:s,onEvent:i}).then((e=>new u(e)))}async execute(){const e=this.program,t=this.args,s=this.options;return"object"==typeof t&&Object.freeze(t),await c("plugin:shell|execute",{program:e,args:t,options:s})}}return e.Child=u,e.Command=p,e.EventEmitter=l,e.open=async function(e,t){await c("plugin:shell|open",{path:e,with:t})},e}({});Object.defineProperty(window.__TAURI__,"shell",{value:__TAURI_PLUGIN_SHELL__})} diff --git a/plugins/shell/build.rs b/plugins/shell/build.rs index f3ff751d..4e19ccd8 100644 --- a/plugins/shell/build.rs +++ b/plugins/shell/build.rs @@ -2,13 +2,188 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT +use std::path::PathBuf; + +use schemars::JsonSchema; + #[path = "src/scope_entry.rs"] mod scope_entry; -const COMMANDS: &[&str] = &["execute", "stdin_write", "kill", "open"]; +/// A command argument allowed to be executed by the webview API. +#[derive(Debug, PartialEq, Eq, Clone, Hash, schemars::JsonSchema)] +#[serde(untagged, deny_unknown_fields)] +#[non_exhaustive] +pub enum ShellScopeEntryAllowedArg { + /// A non-configurable argument that is passed to the command in the order it was specified. + Fixed(String), + + /// A variable that is set while calling the command from the webview API. + /// + Var { + /// [regex] validator to require passed values to conform to an expected input. + /// + /// This will require the argument value passed to this variable to match the `validator` regex + /// before it will be executed. + /// + /// The regex string is by default surrounded by `^...$` to match the full string. + /// For example the `https?://\w+` regex would be registered as `^https?://\w+$`. + /// + /// [regex]: + validator: String, + + /// Marks the validator as a raw regex, meaning the plugin should not make any modification at runtime. + /// + /// This means the regex will not match on the entire string by default, which might + /// be exploited if your regex allow unexpected input to be considered valid. + /// When using this option, make sure your regex is correct. + #[serde(default)] + raw: bool, + }, +} + +/// A set of command arguments allowed to be executed by the webview API. +/// +/// A value of `true` will allow any arguments to be passed to the command. `false` will disable all +/// arguments. A list of [`ShellScopeEntryAllowedArg`] will set those arguments as the only valid arguments to +/// be passed to the attached command configuration. +#[derive(Debug, PartialEq, Eq, Clone, Hash, JsonSchema)] +#[serde(untagged, deny_unknown_fields)] +#[non_exhaustive] +pub enum ShellScopeEntryAllowedArgs { + /// Use a simple boolean to allow all or disable all arguments to this command configuration. + Flag(bool), + + /// A specific set of [`ShellScopeEntryAllowedArg`] that are valid to call for the command configuration. + List(Vec), +} + +impl Default for ShellScopeEntryAllowedArgs { + fn default() -> Self { + Self::Flag(false) + } +} + +/// Shell scope entry. +#[derive(JsonSchema)] +#[serde(untagged, deny_unknown_fields)] +#[allow(unused)] +pub(crate) enum ShellScopeEntry { + Command { + /// The name for this allowed shell command configuration. + /// + /// This name will be used inside of the webview API to call this command along with + /// any specified arguments. + name: String, + /// The command name. + /// It can start with a variable that resolves to a system base directory. + /// The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, + /// `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, + /// `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, + /// `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`. + // use default just so the schema doesn't flag it as required + #[serde(rename = "cmd")] + command: PathBuf, + /// The allowed arguments for the command execution. + #[serde(default)] + args: ShellScopeEntryAllowedArgs, + }, + Sidecar { + /// The name for this allowed shell command configuration. + /// + /// This name will be used inside of the webview API to call this command along with + /// any specified arguments. + name: String, + /// The allowed arguments for the command execution. + #[serde(default)] + args: ShellScopeEntryAllowedArgs, + /// If this command is a sidecar command. + sidecar: bool, + }, +} + +// Ensure `ShellScopeEntry` and `scope_entry::EntryRaw` +// and `ShellScopeEntryAllowedArg` and `ShellAllowedArg` +// and `ShellScopeEntryAllowedArgs` and `ShellAllowedArgs` +// are kept in sync +#[allow(clippy::unnecessary_operation)] +fn _f() { + match (ShellScopeEntry::Sidecar { + name: String::new(), + args: ShellScopeEntryAllowedArgs::Flag(false), + sidecar: true, + }) { + ShellScopeEntry::Command { + name, + command, + args, + } => scope_entry::EntryRaw { + name, + command: Some(command), + args: match args { + ShellScopeEntryAllowedArgs::Flag(flag) => scope_entry::ShellAllowedArgs::Flag(flag), + ShellScopeEntryAllowedArgs::List(vec) => scope_entry::ShellAllowedArgs::List( + vec.into_iter() + .map(|s| match s { + ShellScopeEntryAllowedArg::Fixed(fixed) => { + scope_entry::ShellAllowedArg::Fixed(fixed) + } + ShellScopeEntryAllowedArg::Var { validator, raw } => { + scope_entry::ShellAllowedArg::Var { validator, raw } + } + }) + .collect(), + ), + }, + sidecar: false, + }, + ShellScopeEntry::Sidecar { + name, + args, + sidecar, + } => scope_entry::EntryRaw { + name, + command: None, + args: match args { + ShellScopeEntryAllowedArgs::Flag(flag) => scope_entry::ShellAllowedArgs::Flag(flag), + ShellScopeEntryAllowedArgs::List(vec) => scope_entry::ShellAllowedArgs::List( + vec.into_iter() + .map(|s| match s { + ShellScopeEntryAllowedArg::Fixed(fixed) => { + scope_entry::ShellAllowedArg::Fixed(fixed) + } + ShellScopeEntryAllowedArg::Var { validator, raw } => { + scope_entry::ShellAllowedArg::Var { validator, raw } + } + }) + .collect(), + ), + }, + sidecar, + }, + }; +} + +const COMMANDS: &[&str] = &["execute", "spawn", "stdin_write", "kill", "open"]; fn main() { tauri_plugin::Builder::new(COMMANDS) - .global_scope_schema(schemars::schema_for!(scope_entry::Entry)) + .global_api_script_path("./api-iife.js") + .global_scope_schema(schemars::schema_for!(ShellScopeEntry)) + .android_path("android") + .ios_path("ios") .build(); + + let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap(); + let mobile = target_os == "ios" || target_os == "android"; + alias("desktop", !mobile); + alias("mobile", mobile); +} + +// creates a cfg alias if `has_feature` is true. +// `alias` must be a snake case string. +fn alias(alias: &str, has_feature: bool) { + println!("cargo:rustc-check-cfg=cfg({alias})"); + if has_feature { + println!("cargo:rustc-cfg={alias}"); + } } diff --git a/plugins/shell/guest-js/index.ts b/plugins/shell/guest-js/index.ts index d532206b..1ed2ac5d 100644 --- a/plugins/shell/guest-js/index.ts +++ b/plugins/shell/guest-js/index.ts @@ -18,11 +18,11 @@ * * ### Restricting access to the {@link Command | `Command`} APIs * - * The plugin configuration object has a `scope` field that defines an array of CLIs that can be used. + * The plugin permissions object has a `scope` field that defines an array of CLIs that can be used. * Each CLI is a configuration object `{ name: string, cmd: string, sidecar?: bool, args?: boolean | Arg[] }`. * * - `name`: the unique identifier of the command, passed to the {@link Command.create | Command.create function}. - * If it's a sidecar, this must be the value defined on `tauri.conf.json > tauri > bundle > externalBin`. + * If it's a sidecar, this must be the value defined on `tauri.conf.json > bundle > externalBin`. * - `cmd`: the program that is executed on this configuration. If it's a sidecar, this value is ignored. * - `sidecar`: whether the object configures a sidecar or a system program. * - `args`: the arguments that can be passed to the program. By default no arguments are allowed. @@ -35,12 +35,13 @@ * * CLI: `git commit -m "the commit message"` * - * Configuration: + * Capability: * ```json * { - * "plugins": { - * "shell": { - * "scope": [ + * "permissions": [ + * { + * "identifier": "shell:allow-execute", + * "allow": [ * { * "name": "run-git-commit", * "cmd": "git", @@ -48,7 +49,7 @@ * } * ] * } - * } + * ] * } * ``` * Usage: @@ -62,27 +63,27 @@ * @module */ -import { invoke, Channel } from "@tauri-apps/api/core"; +import { invoke, Channel } from '@tauri-apps/api/core' /** * @since 2.0.0 */ interface SpawnOptions { /** Current working directory. */ - cwd?: string; + cwd?: string /** Environment variables. set to `null` to clear the process env. */ - env?: Record; + env?: Record /** * Character encoding for stdout/stderr * * @since 2.0.0 * */ - encoding?: string; + encoding?: string } /** @ignore */ interface InternalSpawnOptions extends SpawnOptions { - sidecar?: boolean; + sidecar?: boolean } /** @@ -90,46 +91,13 @@ interface InternalSpawnOptions extends SpawnOptions { */ interface ChildProcess { /** Exit code of the process. `null` if the process was terminated by a signal on Unix. */ - code: number | null; + code: number | null /** If the process was terminated by a signal, represents that signal. */ - signal: number | null; + signal: number | null /** The data that the process wrote to `stdout`. */ - stdout: O; + stdout: O /** The data that the process wrote to `stderr`. */ - stderr: O; -} - -/** - * Spawns a process. - * - * @ignore - * @param program The name of the scoped command. - * @param onEventHandler Event handler. - * @param args Program arguments. - * @param options Configuration for the process spawn. - * @returns A promise resolving to the process id. - * - * @since 2.0.0 - */ -async function execute( - onEventHandler: (event: CommandEvent) => void, - program: string, - args: string | string[] = [], - options?: InternalSpawnOptions, -): Promise { - if (typeof args === "object") { - Object.freeze(args); - } - - const onEvent = new Channel>(); - onEvent.onmessage = onEventHandler; - - return invoke("plugin:shell|execute", { - program, - args, - options, - onEvent, - }); + stderr: O } /** @@ -140,7 +108,7 @@ class EventEmitter> { /** @ignore */ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any private eventListeners: Record void>> = - Object.create(null); + Object.create(null) /** * Alias for `emitter.on(eventName, listener)`. @@ -149,9 +117,9 @@ class EventEmitter> { */ addListener( eventName: N, - listener: (arg: E[typeof eventName]) => void, + listener: (arg: E[typeof eventName]) => void ): this { - return this.on(eventName, listener); + return this.on(eventName, listener) } /** @@ -161,9 +129,9 @@ class EventEmitter> { */ removeListener( eventName: N, - listener: (arg: E[typeof eventName]) => void, + listener: (arg: E[typeof eventName]) => void ): this { - return this.off(eventName, listener); + return this.off(eventName, listener) } /** @@ -178,16 +146,16 @@ class EventEmitter> { */ on( eventName: N, - listener: (arg: E[typeof eventName]) => void, + listener: (arg: E[typeof eventName]) => void ): this { if (eventName in this.eventListeners) { // eslint-disable-next-line security/detect-object-injection - this.eventListeners[eventName].push(listener); + this.eventListeners[eventName].push(listener) } else { // eslint-disable-next-line security/detect-object-injection - this.eventListeners[eventName] = [listener]; + this.eventListeners[eventName] = [listener] } - return this; + return this } /** @@ -200,14 +168,13 @@ class EventEmitter> { */ once( eventName: N, - listener: (arg: E[typeof eventName]) => void, + listener: (arg: E[typeof eventName]) => void ): this { const wrapper = (arg: E[typeof eventName]): void => { - this.removeListener(eventName, wrapper); - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - listener(arg); - }; - return this.addListener(eventName, wrapper); + this.removeListener(eventName, wrapper) + listener(arg) + } + return this.addListener(eventName, wrapper) } /** @@ -218,15 +185,15 @@ class EventEmitter> { */ off( eventName: N, - listener: (arg: E[typeof eventName]) => void, + listener: (arg: E[typeof eventName]) => void ): this { if (eventName in this.eventListeners) { // eslint-disable-next-line security/detect-object-injection this.eventListeners[eventName] = this.eventListeners[eventName].filter( - (l) => l !== listener, - ); + (l) => l !== listener + ) } - return this; + return this } /** @@ -238,13 +205,13 @@ class EventEmitter> { */ removeAllListeners(event?: N): this { if (event) { - // eslint-disable-next-line @typescript-eslint/no-dynamic-delete,security/detect-object-injection - delete this.eventListeners[event]; + // eslint-disable-next-line security/detect-object-injection + delete this.eventListeners[event] } else { // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - this.eventListeners = Object.create(null); + this.eventListeners = Object.create(null) } - return this; + return this } /** @@ -258,13 +225,12 @@ class EventEmitter> { */ emit(eventName: N, arg: E[typeof eventName]): boolean { if (eventName in this.eventListeners) { - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,security/detect-object-injection - const listeners = this.eventListeners[eventName]; - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - for (const listener of listeners) listener(arg); - return true; + // eslint-disable-next-line security/detect-object-injection + const listeners = this.eventListeners[eventName] + for (const listener of listeners) listener(arg) + return true } - return false; + return false } /** @@ -275,8 +241,8 @@ class EventEmitter> { listenerCount(eventName: N): number { if (eventName in this.eventListeners) // eslint-disable-next-line security/detect-object-injection - return this.eventListeners[eventName].length; - return 0; + return this.eventListeners[eventName].length + return 0 } /** @@ -291,16 +257,16 @@ class EventEmitter> { */ prependListener( eventName: N, - listener: (arg: E[typeof eventName]) => void, + listener: (arg: E[typeof eventName]) => void ): this { if (eventName in this.eventListeners) { // eslint-disable-next-line security/detect-object-injection - this.eventListeners[eventName].unshift(listener); + this.eventListeners[eventName].unshift(listener) } else { // eslint-disable-next-line security/detect-object-injection - this.eventListeners[eventName] = [listener]; + this.eventListeners[eventName] = [listener] } - return this; + return this } /** @@ -313,15 +279,15 @@ class EventEmitter> { */ prependOnceListener( eventName: N, - listener: (arg: E[typeof eventName]) => void, + listener: (arg: E[typeof eventName]) => void ): this { // eslint-disable-next-line @typescript-eslint/no-explicit-any const wrapper = (arg: any): void => { - this.removeListener(eventName, wrapper); + this.removeListener(eventName, wrapper) // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - listener(arg); - }; - return this.prependListener(eventName, wrapper); + listener(arg) + } + return this.prependListener(eventName, wrapper) } } @@ -330,10 +296,10 @@ class EventEmitter> { */ class Child { /** The child process `pid`. */ - pid: number; + pid: number constructor(pid: number) { - this.pid = pid; + this.pid = pid } /** @@ -353,12 +319,11 @@ class Child { * * @since 2.0.0 */ - async write(data: IOPayload): Promise { - return invoke("plugin:shell|stdin_write", { + async write(data: IOPayload | number[]): Promise { + await invoke('plugin:shell|stdin_write', { pid: this.pid, - // correctly serialize Uint8Arrays - buffer: typeof data === "string" ? data : Array.from(data), - }); + buffer: data + }) } /** @@ -369,20 +334,20 @@ class Child { * @since 2.0.0 */ async kill(): Promise { - return invoke("plugin:shell|kill", { - cmd: "killChild", - pid: this.pid, - }); + await invoke('plugin:shell|kill', { + cmd: 'killChild', + pid: this.pid + }) } } interface CommandEvents { - close: TerminatedPayload; - error: string; + close: TerminatedPayload + error: string } interface OutputEvents { - data: O; + data: O } /** @@ -408,15 +373,15 @@ interface OutputEvents { */ class Command extends EventEmitter { /** @ignore Program to execute. */ - private readonly program: string; + private readonly program: string /** @ignore Program arguments */ - private readonly args: string[]; + private readonly args: string[] /** @ignore Spawn options. */ - private readonly options: InternalSpawnOptions; + private readonly options: InternalSpawnOptions /** Event emitter for the `stdout`. Emits the `data` event. */ - readonly stdout = new EventEmitter>(); + readonly stdout = new EventEmitter>() /** Event emitter for the `stderr`. Emits the `data` event. */ - readonly stderr = new EventEmitter>(); + readonly stderr = new EventEmitter>() /** * @ignore @@ -430,25 +395,25 @@ class Command extends EventEmitter { private constructor( program: string, args: string | string[] = [], - options?: SpawnOptions, + options?: SpawnOptions ) { - super(); - this.program = program; - this.args = typeof args === "string" ? [args] : args; - this.options = options ?? {}; + super() + this.program = program + this.args = typeof args === 'string' ? [args] : args + this.options = options ?? {} } - static create(program: string, args?: string | string[]): Command; + static create(program: string, args?: string | string[]): Command static create( program: string, args?: string | string[], - options?: SpawnOptions & { encoding: "raw" }, - ): Command; + options?: SpawnOptions & { encoding: 'raw' } + ): Command static create( program: string, args?: string | string[], - options?: SpawnOptions, - ): Command; + options?: SpawnOptions + ): Command /** * Creates a command to execute the given program. @@ -465,22 +430,22 @@ class Command extends EventEmitter { static create( program: string, args: string | string[] = [], - options?: SpawnOptions, + options?: SpawnOptions ): Command { - return new Command(program, args, options); + return new Command(program, args, options) } - static sidecar(program: string, args?: string | string[]): Command; + static sidecar(program: string, args?: string | string[]): Command static sidecar( program: string, args?: string | string[], - options?: SpawnOptions & { encoding: "raw" }, - ): Command; + options?: SpawnOptions & { encoding: 'raw' } + ): Command static sidecar( program: string, args?: string | string[], - options?: SpawnOptions, - ): Command; + options?: SpawnOptions + ): Command /** * Creates a command to execute the given sidecar program. @@ -497,11 +462,11 @@ class Command extends EventEmitter { static sidecar( program: string, args: string | string[] = [], - options?: SpawnOptions, + options?: SpawnOptions ): Command { - const instance = new Command(program, args, options); - instance.options.sidecar = true; - return instance; + const instance = new Command(program, args, options) + instance.options.sidecar = true + return instance } /** @@ -512,27 +477,38 @@ class Command extends EventEmitter { * @since 2.0.0 */ async spawn(): Promise { - return execute( - (event) => { - switch (event.event) { - case "Error": - this.emit("error", event.payload); - break; - case "Terminated": - this.emit("close", event.payload); - break; - case "Stdout": - this.stdout.emit("data", event.payload); - break; - case "Stderr": - this.stderr.emit("data", event.payload); - break; - } - }, - this.program, - this.args, - this.options, - ).then((pid) => new Child(pid)); + const program = this.program + const args = this.args + const options = this.options + + if (typeof args === 'object') { + Object.freeze(args) + } + + const onEvent = new Channel>() + onEvent.onmessage = (event) => { + switch (event.event) { + case 'Error': + this.emit('error', event.payload) + break + case 'Terminated': + this.emit('close', event.payload) + break + case 'Stdout': + this.stdout.emit('data', event.payload) + break + case 'Stderr': + this.stderr.emit('data', event.payload) + break + } + } + + return await invoke('plugin:shell|spawn', { + program, + args, + options, + onEvent + }).then((pid) => new Child(pid)) } /** @@ -552,40 +528,19 @@ class Command extends EventEmitter { * @since 2.0.0 */ async execute(): Promise> { - return new Promise((resolve, reject) => { - this.on("error", reject); - - const stdout: O[] = []; - const stderr: O[] = []; - this.stdout.on("data", (line: O) => { - stdout.push(line); - }); - this.stderr.on("data", (line: O) => { - stderr.push(line); - }); - - this.on("close", (payload: TerminatedPayload) => { - resolve({ - code: payload.code, - signal: payload.signal, - stdout: this.collectOutput(stdout) as O, - stderr: this.collectOutput(stderr) as O, - }); - }); - - this.spawn().catch(reject); - }); - } + const program = this.program + const args = this.args + const options = this.options - /** @ignore */ - private collectOutput(events: O[]): string | Uint8Array { - if (this.options.encoding === "raw") { - return events.reduce((p, c) => { - return new Uint8Array([...p, ...(c as Uint8Array), 10]); - }, new Uint8Array()); - } else { - return events.join("\n"); + if (typeof args === 'object') { + Object.freeze(args) } + + return await invoke>('plugin:shell|execute', { + program, + args, + options + }) } } @@ -593,8 +548,8 @@ class Command extends EventEmitter { * Describes the event message received from the command. */ interface Event { - event: T; - payload: V; + event: T + payload: V } /** @@ -602,20 +557,20 @@ interface Event { */ interface TerminatedPayload { /** Exit code of the process. `null` if the process was terminated by a signal on Unix. */ - code: number | null; + code: number | null /** If the process was terminated by a signal, represents that signal. */ - signal: number | null; + signal: number | null } /** Event payload type */ -type IOPayload = string | Uint8Array; +type IOPayload = string | Uint8Array /** Events emitted by the child process. */ type CommandEvent = - | Event<"Stdout", O> - | Event<"Stderr", O> - | Event<"Terminated", TerminatedPayload> - | Event<"Error", string>; + | Event<'Stdout', O> + | Event<'Stderr', O> + | Event<'Terminated', TerminatedPayload> + | Event<'Error', string> /** * Opens a path or URL with the system's default app, @@ -644,18 +599,18 @@ type CommandEvent = * @since 2.0.0 */ async function open(path: string, openWith?: string): Promise { - return invoke("plugin:shell|open", { + await invoke('plugin:shell|open', { path, - with: openWith, - }); + with: openWith + }) } -export { Command, Child, EventEmitter, open }; +export { Command, Child, EventEmitter, open } export type { IOPayload, CommandEvents, TerminatedPayload, OutputEvents, ChildProcess, - SpawnOptions, -}; + SpawnOptions +} diff --git a/plugins/shell/guest-js/init.ts b/plugins/shell/guest-js/init.ts index 4f6eea2e..b7e68a15 100644 --- a/plugins/shell/guest-js/init.ts +++ b/plugins/shell/guest-js/init.ts @@ -2,39 +2,39 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { invoke } from "@tauri-apps/api/core"; +import { invoke } from '@tauri-apps/api/core' // open links with the API -function openLinks() { - document.querySelector("body")?.addEventListener("click", function (e) { - let target = e.target as HTMLElement; - while (target != null) { - if (target.matches("a")) { - const t = target as HTMLAnchorElement; +function openLinks(): void { + document.querySelector('body')?.addEventListener('click', function (e) { + let target: HTMLElement | null = e.target as HTMLElement + while (target) { + if (target.matches('a')) { + const t = target as HTMLAnchorElement if ( - t.href && - ["http://", "https://", "mailto:", "tel:"].some((v) => - t.href.startsWith(v), - ) && - t.target === "_blank" + t.href !== '' + && ['http://', 'https://', 'mailto:', 'tel:'].some((v) => + t.href.startsWith(v) + ) + && t.target === '_blank' ) { - invoke("plugin:shell|open", { - path: t.href, - }); - e.preventDefault(); + void invoke('plugin:shell|open', { + path: t.href + }) + e.preventDefault() } - break; + break } - target = target.parentElement as HTMLElement; + target = target.parentElement } - }); + }) } if ( - document.readyState === "complete" || - document.readyState === "interactive" + document.readyState === 'complete' + || document.readyState === 'interactive' ) { - openLinks(); + openLinks() } else { - window.addEventListener("DOMContentLoaded", openLinks, true); + window.addEventListener('DOMContentLoaded', openLinks, true) } diff --git a/plugins/shell/ios/Package.resolved b/plugins/shell/ios/Package.resolved new file mode 100644 index 00000000..5f998e0e --- /dev/null +++ b/plugins/shell/ios/Package.resolved @@ -0,0 +1,16 @@ +{ + "object": { + "pins": [ + { + "package": "SwiftRs", + "repositoryURL": "https://github.com/Brendonovich/swift-rs", + "state": { + "branch": null, + "revision": "b5ed223fcdab165bc21219c1925dc1e77e2bef5e", + "version": "1.0.6" + } + } + ] + }, + "version": 1 +} diff --git a/plugins/shell/ios/Package.swift b/plugins/shell/ios/Package.swift new file mode 100644 index 00000000..c7b2a7aa --- /dev/null +++ b/plugins/shell/ios/Package.swift @@ -0,0 +1,34 @@ +// swift-tools-version:5.3 +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +import PackageDescription + +let package = Package( + name: "tauri-plugin-shell", + platforms: [ + .macOS(.v10_13), + .iOS(.v13), + ], + products: [ + // Products define the executables and libraries a package produces, and make them visible to other packages. + .library( + name: "tauri-plugin-shell", + type: .static, + targets: ["tauri-plugin-shell"]) + ], + dependencies: [ + .package(name: "Tauri", path: "../.tauri/tauri-api") + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages this package depends on. + .target( + name: "tauri-plugin-shell", + dependencies: [ + .byName(name: "Tauri") + ], + path: "Sources") + ] +) diff --git a/plugins/shell/ios/Sources/ShellPlugin.swift b/plugins/shell/ios/Sources/ShellPlugin.swift new file mode 100644 index 00000000..0fcb7dac --- /dev/null +++ b/plugins/shell/ios/Sources/ShellPlugin.swift @@ -0,0 +1,34 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +import Foundation + +import SwiftRs +import Tauri +import UIKit +import WebKit + +class ShellPlugin: Plugin { + + @objc public func open(_ invoke: Invoke) throws { + do { + let urlString = try invoke.parseArgs(String.self) + if let url = URL(string: urlString) { + if #available(iOS 10, *) { + UIApplication.shared.open(url, options: [:]) + } else { + UIApplication.shared.openURL(url) + } + } + invoke.resolve() + } catch { + invoke.reject(error.localizedDescription) + } + } +} + +@_cdecl("init_plugin_shell") +func initPlugin() -> Plugin { + return ShellPlugin() +} diff --git a/plugins/shell/package.json b/plugins/shell/package.json index fbaecb14..e42394c8 100644 --- a/plugins/shell/package.json +++ b/plugins/shell/package.json @@ -1,10 +1,11 @@ { "name": "@tauri-apps/plugin-shell", - "version": "2.0.0-beta.1", - "license": "MIT or APACHE-2.0", + "version": "2.2.1", + "license": "MIT OR Apache-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" ], + "repository": "https://github.com/tauri-apps/plugins-workspace", "type": "module", "types": "./dist-js/index.d.ts", "main": "./dist-js/index.cjs", @@ -23,6 +24,6 @@ "LICENSE" ], "dependencies": { - "@tauri-apps/api": "2.0.0-beta.2" + "@tauri-apps/api": "^2.0.0" } } diff --git a/plugins/shell/permissions/autogenerated/commands/spawn.toml b/plugins/shell/permissions/autogenerated/commands/spawn.toml new file mode 100644 index 00000000..a3802d2a --- /dev/null +++ b/plugins/shell/permissions/autogenerated/commands/spawn.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-spawn" +description = "Enables the spawn command without any pre-configured scope." +commands.allow = ["spawn"] + +[[permission]] +identifier = "deny-spawn" +description = "Denies the spawn command without any pre-configured scope." +commands.deny = ["spawn"] diff --git a/plugins/shell/permissions/autogenerated/reference.md b/plugins/shell/permissions/autogenerated/reference.md index 93f94f3d..d2b86f8a 100644 --- a/plugins/shell/permissions/autogenerated/reference.md +++ b/plugins/shell/permissions/autogenerated/reference.md @@ -1,34 +1,155 @@ -# Permissions +## Default Permission -## allow-execute +This permission set configures which +shell functionality is exposed by default. + +#### Granted Permissions + +It allows to use the `open` functionality with a reasonable +scope pre-configured. It will allow opening `http(s)://`, +`tel:` and `mailto:` links. + + +#### This default permission set includes the following: + +- `allow-open` + +## Permission Table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IdentifierDescription
+ +`shell:allow-execute` + + Enables the execute command without any pre-configured scope. -## deny-execute +
+ +`shell:deny-execute` + + Denies the execute command without any pre-configured scope. -## allow-kill +
+ +`shell:allow-kill` + + Enables the kill command without any pre-configured scope. -## deny-kill +
+ +`shell:deny-kill` + + Denies the kill command without any pre-configured scope. -## allow-open +
+ +`shell:allow-open` + + Enables the open command without any pre-configured scope. -## deny-open +
+ +`shell:deny-open` + + Denies the open command without any pre-configured scope. -## allow-stdin-write +
+ +`shell:allow-spawn` + + + +Enables the spawn command without any pre-configured scope. + +
+ +`shell:deny-spawn` + + + +Denies the spawn command without any pre-configured scope. + +
+ +`shell:allow-stdin-write` + + Enables the stdin_write command without any pre-configured scope. -## deny-stdin-write +
+ +`shell:deny-stdin-write` + + Denies the stdin_write command without any pre-configured scope. +
diff --git a/plugins/shell/permissions/default.toml b/plugins/shell/permissions/default.toml new file mode 100644 index 00000000..dba2ea20 --- /dev/null +++ b/plugins/shell/permissions/default.toml @@ -0,0 +1,15 @@ +"$schema" = "schemas/schema.json" + +[default] +description = """ +This permission set configures which +shell functionality is exposed by default. + +#### Granted Permissions + +It allows to use the `open` functionality with a reasonable +scope pre-configured. It will allow opening `http(s)://`, +`tel:` and `mailto:` links. +""" + +permissions = ["allow-open"] diff --git a/plugins/shell/permissions/schemas/schema.json b/plugins/shell/permissions/schemas/schema.json index ff5a12e1..9a198981 100644 --- a/plugins/shell/permissions/schemas/schema.json +++ b/plugins/shell/permissions/schemas/schema.json @@ -17,7 +17,6 @@ }, "set": { "description": "A list of permissions sets defined", - "default": [], "type": "array", "items": { "$ref": "#/definitions/PermissionSet" @@ -50,7 +49,7 @@ "minimum": 1.0 }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -112,7 +111,7 @@ "type": "string" }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri internal convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -132,12 +131,21 @@ }, "scope": { "description": "Allowed or denied scoped when using this permission.", - "default": {}, "allOf": [ { "$ref": "#/definitions/Scopes" } ] + }, + "platforms": { + "description": "Target platforms this permission applies. By default all platforms are affected by this permission.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Target" + } } } }, @@ -164,7 +172,7 @@ } }, "Scopes": { - "description": "A restriction of the command/endpoint functionality.\n\nIt can be of any serde serializable type and is used for allowing or preventing certain actions inside a Tauri command.\n\nThe scope is passed to the command and handled/enforced by the command itself.", + "description": "An argument for fine grained behavior control of Tauri commands.\n\nIt can be of any serde serializable type and is used to allow or prevent certain actions inside a Tauri command. The configured scope is passed to the command and will be enforced by the command implementation.\n\n## Example\n\n```json { \"allow\": [{ \"path\": \"$HOME/**\" }], \"deny\": [{ \"path\": \"$HOME/secret.txt\" }] } ```", "type": "object", "properties": { "allow": { @@ -178,7 +186,7 @@ } }, "deny": { - "description": "Data that defines what is denied by the scope.", + "description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.", "type": [ "array", "null" @@ -243,64 +251,114 @@ } ] }, - "PermissionKind": { - "type": "string", + "Target": { + "description": "Platform target.", "oneOf": [ { - "description": "allow-execute -> Enables the execute command without any pre-configured scope.", + "description": "MacOS.", "type": "string", "enum": [ - "allow-execute" + "macOS" ] }, { - "description": "deny-execute -> Denies the execute command without any pre-configured scope.", + "description": "Windows.", "type": "string", "enum": [ - "deny-execute" + "windows" ] }, { - "description": "allow-kill -> Enables the kill command without any pre-configured scope.", + "description": "Linux.", "type": "string", "enum": [ - "allow-kill" + "linux" ] }, { - "description": "deny-kill -> Denies the kill command without any pre-configured scope.", + "description": "Android.", "type": "string", "enum": [ - "deny-kill" + "android" ] }, { - "description": "allow-open -> Enables the open command without any pre-configured scope.", + "description": "iOS.", "type": "string", "enum": [ - "allow-open" + "iOS" ] + } + ] + }, + "PermissionKind": { + "type": "string", + "oneOf": [ + { + "description": "Enables the execute command without any pre-configured scope.", + "type": "string", + "const": "allow-execute", + "markdownDescription": "Enables the execute command without any pre-configured scope." }, { - "description": "deny-open -> Denies the open command without any pre-configured scope.", + "description": "Denies the execute command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-open" - ] + "const": "deny-execute", + "markdownDescription": "Denies the execute command without any pre-configured scope." }, { - "description": "allow-stdin-write -> Enables the stdin_write command without any pre-configured scope.", + "description": "Enables the kill command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-stdin-write" - ] + "const": "allow-kill", + "markdownDescription": "Enables the kill command without any pre-configured scope." }, { - "description": "deny-stdin-write -> Denies the stdin_write command without any pre-configured scope.", + "description": "Denies the kill command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-stdin-write" - ] + "const": "deny-kill", + "markdownDescription": "Denies the kill command without any pre-configured scope." + }, + { + "description": "Enables the open command without any pre-configured scope.", + "type": "string", + "const": "allow-open", + "markdownDescription": "Enables the open command without any pre-configured scope." + }, + { + "description": "Denies the open command without any pre-configured scope.", + "type": "string", + "const": "deny-open", + "markdownDescription": "Denies the open command without any pre-configured scope." + }, + { + "description": "Enables the spawn command without any pre-configured scope.", + "type": "string", + "const": "allow-spawn", + "markdownDescription": "Enables the spawn command without any pre-configured scope." + }, + { + "description": "Denies the spawn command without any pre-configured scope.", + "type": "string", + "const": "deny-spawn", + "markdownDescription": "Denies the spawn command without any pre-configured scope." + }, + { + "description": "Enables the stdin_write command without any pre-configured scope.", + "type": "string", + "const": "allow-stdin-write", + "markdownDescription": "Enables the stdin_write command without any pre-configured scope." + }, + { + "description": "Denies the stdin_write command without any pre-configured scope.", + "type": "string", + "const": "deny-stdin-write", + "markdownDescription": "Denies the stdin_write command without any pre-configured scope." + }, + { + "description": "This permission set configures which\nshell functionality is exposed by default.\n\n#### Granted Permissions\n\nIt allows to use the `open` functionality with a reasonable\nscope pre-configured. It will allow opening `http(s)://`,\n`tel:` and `mailto:` links.\n\n#### This default permission set includes:\n\n- `allow-open`", + "type": "string", + "const": "default", + "markdownDescription": "This permission set configures which\nshell functionality is exposed by default.\n\n#### Granted Permissions\n\nIt allows to use the `open` functionality with a reasonable\nscope pre-configured. It will allow opening `http(s)://`,\n`tel:` and `mailto:` links.\n\n#### This default permission set includes:\n\n- `allow-open`" } ] } diff --git a/plugins/shell/rollup.config.js b/plugins/shell/rollup.config.js index 0aed70d6..a7dbd4f6 100644 --- a/plugins/shell/rollup.config.js +++ b/plugins/shell/rollup.config.js @@ -2,21 +2,21 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { createConfig } from "../../shared/rollup.config.js"; -import { nodeResolve } from "@rollup/plugin-node-resolve"; -import typescript from "@rollup/plugin-typescript"; -import terser from "@rollup/plugin-terser"; +import { createConfig } from '../../shared/rollup.config.js' +import { nodeResolve } from '@rollup/plugin-node-resolve' +import typescript from '@rollup/plugin-typescript' +import terser from '@rollup/plugin-terser' export default createConfig({ additionalConfigs: { - input: "guest-js/init.ts", + input: 'guest-js/init.ts', output: { - file: "src/init-iife.js", - format: "iife", + file: 'src/init-iife.js', + format: 'iife' }, plugins: [typescript(), terser(), nodeResolve()], onwarn: (warning) => { - throw Object.assign(new Error(), warning); - }, - }, -}); + throw Object.assign(new Error(), warning) + } + } +}) diff --git a/plugins/shell/src/api-iife.js b/plugins/shell/src/api-iife.js deleted file mode 100644 index a64b8710..00000000 --- a/plugins/shell/src/api-iife.js +++ /dev/null @@ -1 +0,0 @@ -if("__TAURI__"in window){var __TAURI_PLUGIN_SHELL__=function(e){"use strict";function t(e,t,s,r){if("a"===s&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?r:"a"===s?r.call(e):r?r.value:t.get(e)}var s;"function"==typeof SuppressedError&&SuppressedError;class r{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,s.set(this,(()=>{})),this.id=function(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}((e=>{t(this,s,"f").call(this,e)}))}set onmessage(e){!function(e,t,s,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===r?n.call(e,s):n?n.value=s:t.set(e,s)}(this,s,e,"f")}get onmessage(){return t(this,s,"f")}toJSON(){return`__CHANNEL__:${this.id}`}}async function n(e,t={},s){return window.__TAURI_INTERNALS__.invoke(e,t,s)}s=new WeakMap;class i{constructor(){this.eventListeners=Object.create(null)}addListener(e,t){return this.on(e,t)}removeListener(e,t){return this.off(e,t)}on(e,t){return e in this.eventListeners?this.eventListeners[e].push(t):this.eventListeners[e]=[t],this}once(e,t){const s=r=>{this.removeListener(e,s),t(r)};return this.addListener(e,s)}off(e,t){return e in this.eventListeners&&(this.eventListeners[e]=this.eventListeners[e].filter((e=>e!==t))),this}removeAllListeners(e){return e?delete this.eventListeners[e]:this.eventListeners=Object.create(null),this}emit(e,t){if(e in this.eventListeners){const s=this.eventListeners[e];for(const e of s)e(t);return!0}return!1}listenerCount(e){return e in this.eventListeners?this.eventListeners[e].length:0}prependListener(e,t){return e in this.eventListeners?this.eventListeners[e].unshift(t):this.eventListeners[e]=[t],this}prependOnceListener(e,t){const s=r=>{this.removeListener(e,s),t(r)};return this.prependListener(e,s)}}class o{constructor(e){this.pid=e}async write(e){return n("plugin:shell|stdin_write",{pid:this.pid,buffer:"string"==typeof e?e:Array.from(e)})}async kill(){return n("plugin:shell|kill",{cmd:"killChild",pid:this.pid})}}class a extends i{constructor(e,t=[],s){super(),this.stdout=new i,this.stderr=new i,this.program=e,this.args="string"==typeof t?[t]:t,this.options=s??{}}static create(e,t=[],s){return new a(e,t,s)}static sidecar(e,t=[],s){const r=new a(e,t,s);return r.options.sidecar=!0,r}async spawn(){return async function(e,t,s=[],i){"object"==typeof s&&Object.freeze(s);const o=new r;return o.onmessage=e,n("plugin:shell|execute",{program:t,args:s,options:i,onEvent:o})}((e=>{switch(e.event){case"Error":this.emit("error",e.payload);break;case"Terminated":this.emit("close",e.payload);break;case"Stdout":this.stdout.emit("data",e.payload);break;case"Stderr":this.stderr.emit("data",e.payload)}}),this.program,this.args,this.options).then((e=>new o(e)))}async execute(){return new Promise(((e,t)=>{this.on("error",t);const s=[],r=[];this.stdout.on("data",(e=>{s.push(e)})),this.stderr.on("data",(e=>{r.push(e)})),this.on("close",(t=>{e({code:t.code,signal:t.signal,stdout:this.collectOutput(s),stderr:this.collectOutput(r)})})),this.spawn().catch(t)}))}collectOutput(e){return"raw"===this.options.encoding?e.reduce(((e,t)=>new Uint8Array([...e,...t,10])),new Uint8Array):e.join("\n")}}return e.Child=o,e.Command=a,e.EventEmitter=i,e.open=async function(e,t){return n("plugin:shell|open",{path:e,with:t})},e}({});Object.defineProperty(window.__TAURI__,"shell",{value:__TAURI_PLUGIN_SHELL__})} diff --git a/plugins/shell/src/commands.rs b/plugins/shell/src/commands.rs index 050713a3..5275e9b9 100644 --- a/plugins/shell/src/commands.rs +++ b/plugins/shell/src/commands.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -use std::{collections::HashMap, path::PathBuf, string::FromUtf8Error}; +use std::{collections::HashMap, future::Future, path::PathBuf, pin::Pin, string::FromUtf8Error}; use encoding_rs::Encoding; use serde::{Deserialize, Serialize}; @@ -11,8 +11,9 @@ use tauri::{ Manager, Runtime, State, Window, }; +#[allow(deprecated)] +use crate::open::Program; use crate::{ - open::Program, process::{CommandEvent, TerminatedPayload}, scope::ExecuteArgs, Shell, @@ -23,7 +24,7 @@ type ChildId = u32; #[derive(Debug, Clone, Serialize)] #[serde(tag = "event", content = "payload")] #[non_exhaustive] -enum JSCommandEvent { +pub enum JSCommandEvent { /// Stderr bytes until a newline (\n) or carriage return (\r) is found. Stderr(Buffer), /// Stdout bytes until a newline (\n) or carriage return (\r) is found. @@ -94,18 +95,15 @@ fn default_env() -> Option> { Some(HashMap::default()) } -#[allow(clippy::too_many_arguments)] -#[tauri::command] -pub fn execute( +#[inline(always)] +fn prepare_cmd( window: Window, - shell: State<'_, Shell>, program: String, args: ExecuteArgs, - on_event: Channel, options: CommandOptions, command_scope: CommandScope, global_scope: GlobalScope, -) -> crate::Result { +) -> crate::Result<(crate::process::Command, EncodingWrapper)> { let scope = crate::scope::ShellScope { scopes: command_scope .allows() @@ -151,10 +149,14 @@ pub fn execute( } else { command = command.env_clear(); } + let encoding = match options.encoding { Option::None => EncodingWrapper::Text(None), Some(encoding) => match encoding.as_str() { - "raw" => EncodingWrapper::Raw, + "raw" => { + command = command.set_raw_out(true); + EncodingWrapper::Raw + } _ => { if let Some(text_encoding) = Encoding::for_label(encoding.as_bytes()) { EncodingWrapper::Text(Some(text_encoding)) @@ -165,6 +167,81 @@ pub fn execute( }, }; + Ok((command, encoding)) +} + +#[derive(Serialize)] +#[serde(untagged)] +enum Output { + String(String), + Raw(Vec), +} + +#[derive(Serialize)] +pub struct ChildProcessReturn { + code: Option, + signal: Option, + stdout: Output, + stderr: Output, +} + +#[allow(clippy::too_many_arguments)] +#[tauri::command] +pub async fn execute( + window: Window, + program: String, + args: ExecuteArgs, + options: CommandOptions, + command_scope: CommandScope, + global_scope: GlobalScope, +) -> crate::Result { + let (command, encoding) = + prepare_cmd(window, program, args, options, command_scope, global_scope)?; + + let mut command: std::process::Command = command.into(); + let output = command.output()?; + + let (stdout, stderr) = match encoding { + EncodingWrapper::Text(Some(encoding)) => ( + Output::String(encoding.decode_with_bom_removal(&output.stdout).0.into()), + Output::String(encoding.decode_with_bom_removal(&output.stderr).0.into()), + ), + EncodingWrapper::Text(None) => ( + Output::String(String::from_utf8(output.stdout)?), + Output::String(String::from_utf8(output.stderr)?), + ), + EncodingWrapper::Raw => (Output::Raw(output.stdout), Output::Raw(output.stderr)), + }; + + #[cfg(unix)] + use std::os::unix::process::ExitStatusExt; + + Ok(ChildProcessReturn { + code: output.status.code(), + #[cfg(windows)] + signal: None, + #[cfg(unix)] + signal: output.status.signal(), + stdout, + stderr, + }) +} + +#[allow(clippy::too_many_arguments)] +#[tauri::command] +pub fn spawn( + window: Window, + shell: State<'_, Shell>, + program: String, + args: ExecuteArgs, + on_event: Channel, + options: CommandOptions, + command_scope: CommandScope, + global_scope: GlobalScope, +) -> crate::Result { + let (command, encoding) = + prepare_cmd(window, program, args, options, command_scope, global_scope)?; + let (mut rx, child) = command.spawn()?; let pid = child.pid(); @@ -177,7 +254,21 @@ pub fn execute( children.lock().unwrap().remove(&pid); }; let js_event = JSCommandEvent::new(event, encoding); - let _ = on_event.send(&js_event); + + if on_event.send(js_event.clone()).is_err() { + fn send<'a>( + on_event: &'a Channel, + js_event: &'a JSCommandEvent, + ) -> Pin + Send + 'a>> { + Box::pin(async move { + tokio::time::sleep(std::time::Duration::from_millis(15)).await; + if on_event.send(js_event.clone()).is_err() { + send(on_event, js_event).await; + } + }) + } + send(&on_event, &js_event).await; + } } }); @@ -212,12 +303,13 @@ pub fn kill( Ok(()) } +#[allow(deprecated)] #[tauri::command] -pub fn open( +pub async fn open( _window: Window, shell: State<'_, Shell>, path: String, with: Option, ) -> crate::Result<()> { - shell.open(path, with) + crate::open::open(Some(&shell.open_scope), path, with) } diff --git a/plugins/shell/src/config.rs b/plugins/shell/src/config.rs index 95390988..69a92ee1 100644 --- a/plugins/shell/src/config.rs +++ b/plugins/shell/src/config.rs @@ -18,6 +18,9 @@ pub struct Config { #[serde(untagged, deny_unknown_fields)] #[non_exhaustive] pub enum ShellAllowlistOpen { + /// Shell open API allowlist is not defined by the user. + /// In this case we add the default validation regex (same as [`Self::Flag(true)`]). + Unset, /// If the shell open API should be enabled. /// /// If enabled, the default validation regex (`^((mailto:\w+)|(tel:\w+)|(https?://\w+)).+`) is used. @@ -25,6 +28,9 @@ pub enum ShellAllowlistOpen { /// Enable the shell open API, with a custom regex that the opened path must match against. /// + /// The regex string is automatically surrounded by `^...$` to match the full string. + /// For example the `https?://\w+` regex would be registered as `^https?://\w+$`. + /// /// If using a custom regex to support a non-http(s) schema, care should be used to prevent values /// that allow flag-like strings to pass validation. e.g. `--enable-debugging`, `-i`, `/R`. Validate(String), @@ -32,6 +38,6 @@ pub enum ShellAllowlistOpen { impl Default for ShellAllowlistOpen { fn default() -> Self { - Self::Flag(false) + Self::Unset } } diff --git a/plugins/shell/src/error.rs b/plugins/shell/src/error.rs index c8af2343..652421b8 100644 --- a/plugins/shell/src/error.rs +++ b/plugins/shell/src/error.rs @@ -8,6 +8,9 @@ use serde::{Serialize, Serializer}; #[derive(Debug, thiserror::Error)] pub enum Error { + #[cfg(mobile)] + #[error(transparent)] + PluginInvoke(#[from] tauri::plugin::mobile::PluginInvokeError), #[error(transparent)] Io(#[from] std::io::Error), #[error("current executable path has no parent")] @@ -17,7 +20,7 @@ pub enum Error { #[error(transparent)] Scope(#[from] crate::scope::Error), /// Sidecar not allowed by the configuration. - #[error("sidecar not configured under `tauri.conf.json > tauri > bundle > externalBin`: {0}")] + #[error("sidecar not configured under `tauri.conf.json > bundle > externalBin`: {0}")] SidecarNotAllowed(PathBuf), /// Program not allowed by the scope. #[error("program not allowed on the configured shell scope: {0}")] @@ -27,6 +30,9 @@ pub enum Error { /// JSON error. #[error(transparent)] Json(#[from] serde_json::Error), + /// Utf8 error. + #[error(transparent)] + Utf8(#[from] std::string::FromUtf8Error), } impl Serialize for Error { diff --git a/plugins/shell/src/init-iife.js b/plugins/shell/src/init-iife.js index abc8a15f..3c91c81c 100644 --- a/plugins/shell/src/init-iife.js +++ b/plugins/shell/src/init-iife.js @@ -1 +1 @@ -!function(){"use strict";async function e(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}function t(){document.querySelector("body")?.addEventListener("click",(function(t){let n=t.target;for(;null!=n;){if(n.matches("a")){const r=n;r.href&&["http://","https://","mailto:","tel:"].some((e=>r.href.startsWith(e)))&&"_blank"===r.target&&(e("plugin:shell|open",{path:r.href}),t.preventDefault());break}n=n.parentElement}}))}"function"==typeof SuppressedError&&SuppressedError,"complete"===document.readyState||"interactive"===document.readyState?t():window.addEventListener("DOMContentLoaded",t,!0)}(); +!function(){"use strict";async function e(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}function t(){document.querySelector("body")?.addEventListener("click",(function(t){let n=t.target;for(;n;){if(n.matches("a")){const r=n;""!==r.href&&["http://","https://","mailto:","tel:"].some((e=>r.href.startsWith(e)))&&"_blank"===r.target&&(e("plugin:shell|open",{path:r.href}),t.preventDefault());break}n=n.parentElement}}))}"function"==typeof SuppressedError&&SuppressedError,"complete"===document.readyState||"interactive"===document.readyState?t():window.addEventListener("DOMContentLoaded",t,!0)}(); diff --git a/plugins/shell/src/lib.rs b/plugins/shell/src/lib.rs index b01f3e30..c9503731 100644 --- a/plugins/shell/src/lib.rs +++ b/plugins/shell/src/lib.rs @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -//! [![](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/shell/banner.png)](https://github.com/tauri-apps/plugins-workspace/tree/v2/plugins/shell) -//! //! Access the system shell. Allows you to spawn child processes and manage files and URLs using their default application. #![doc( @@ -28,6 +26,8 @@ use tauri::{ mod commands; mod config; mod error; +#[deprecated(since = "2.1.0", note = "Use tauri-plugin-opener instead.")] +#[allow(deprecated)] pub mod open; pub mod process; mod scope; @@ -35,11 +35,21 @@ mod scope_entry; pub use error::Error; type Result = std::result::Result; + +#[cfg(mobile)] +use tauri::plugin::PluginHandle; +#[cfg(target_os = "android")] +const PLUGIN_IDENTIFIER: &str = "app.tauri.shell"; +#[cfg(target_os = "ios")] +tauri::ios_plugin_binding!(init_plugin_shell); + type ChildStore = Arc>>; pub struct Shell { #[allow(dead_code)] app: AppHandle, + #[cfg(mobile)] + mobile_plugin_handle: PluginHandle, open_scope: scope::OpenScope, children: ChildStore, } @@ -61,8 +71,22 @@ impl Shell { /// Open a (url) path with a default or specific browser opening program. /// /// See [`crate::open::open`] for how it handles security-related measures. + #[cfg(desktop)] + #[deprecated(since = "2.1.0", note = "Use tauri-plugin-opener instead.")] + #[allow(deprecated)] pub fn open(&self, path: impl Into, with: Option) -> Result<()> { - open::open(&self.open_scope, path.into(), with).map_err(Into::into) + open::open(None, path.into(), with) + } + + /// Open a (url) path with a default or specific browser opening program. + /// + /// See [`crate::open::open`] for how it handles security-related measures. + #[cfg(mobile)] + #[deprecated(since = "2.1.0", note = "Use tauri-plugin-opener instead.")] + pub fn open(&self, path: impl Into, _with: Option) -> Result<()> { + self.mobile_plugin_handle + .run_mobile_plugin("open", path.into()) + .map_err(Into::into) } } @@ -77,13 +101,11 @@ impl> ShellExt for T { } pub fn init() -> TauriPlugin> { - let mut init_script = include_str!("init-iife.js").to_string(); - init_script.push_str(include_str!("api-iife.js")); - Builder::>::new("shell") - .js_init_script(init_script) + .js_init_script(include_str!("init-iife.js").to_string()) .invoke_handler(tauri::generate_handler![ commands::execute, + commands::spawn, commands::stdin_write, commands::kill, commands::open @@ -91,10 +113,19 @@ pub fn init() -> TauriPlugin> { .setup(|app, api| { let default_config = config::Config::default(); let config = api.config().as_ref().unwrap_or(&default_config); + + #[cfg(target_os = "android")] + let handle = api.register_android_plugin(PLUGIN_IDENTIFIER, "ShellPlugin")?; + #[cfg(target_os = "ios")] + let handle = api.register_ios_plugin(init_plugin_shell)?; + app.manage(Shell { app: app.clone(), children: Default::default(), open_scope: open_scope(&config.open), + + #[cfg(mobile)] + mobile_plugin_handle: handle, }); Ok(()) }) @@ -116,12 +147,14 @@ pub fn init() -> TauriPlugin> { fn open_scope(open: &config::ShellAllowlistOpen) -> scope::OpenScope { let shell_scope_open = match open { config::ShellAllowlistOpen::Flag(false) => None, - config::ShellAllowlistOpen::Flag(true) => { + // we want to add a basic regex validation even if the config is not set + config::ShellAllowlistOpen::Unset | config::ShellAllowlistOpen::Flag(true) => { Some(Regex::new(r"^((mailto:\w+)|(tel:\w+)|(https?://\w+)).+").unwrap()) } config::ShellAllowlistOpen::Validate(validator) => { + let regex = format!("^{validator}$"); let validator = - Regex::new(validator).unwrap_or_else(|e| panic!("invalid regex {validator}: {e}")); + Regex::new(®ex).unwrap_or_else(|e| panic!("invalid regex {regex}: {e}")); Some(validator) } }; diff --git a/plugins/shell/src/open.rs b/plugins/shell/src/open.rs index 8366b45b..6958a832 100644 --- a/plugins/shell/src/open.rs +++ b/plugins/shell/src/open.rs @@ -10,6 +10,7 @@ use crate::scope::OpenScope; use std::str::FromStr; /// Program to use on the [`open()`] call. +#[deprecated(since = "2.1.0", note = "Use tauri-plugin-opener instead.")] pub enum Program { /// Use the `open` program. Open, @@ -117,6 +118,21 @@ impl Program { /// Ok(()) /// }); /// ``` -pub fn open>(scope: &OpenScope, path: P, with: Option) -> crate::Result<()> { - scope.open(path.as_ref(), with).map_err(Into::into) +#[deprecated(since = "2.1.0", note = "Use tauri-plugin-opener instead.")] +pub fn open>( + scope: Option<&OpenScope>, + path: P, + with: Option, +) -> crate::Result<()> { + // validate scope if we have any (JS calls) + if let Some(scope) = scope { + scope.open(path.as_ref(), with).map_err(Into::into) + } else { + // when running directly from Rust code we don't need to validate the path + match with.map(Program::name) { + Some(program) => ::open::with_detached(path.as_ref(), program), + None => ::open::that_detached(path.as_ref()), + } + .map_err(Into::into) + } } diff --git a/plugins/shell/src/process/mod.rs b/plugins/shell/src/process/mod.rs index fdb26897..44f037b0 100644 --- a/plugins/shell/src/process/mod.rs +++ b/plugins/shell/src/process/mod.rs @@ -4,7 +4,7 @@ use std::{ ffi::OsStr, - io::{BufReader, Write}, + io::{BufRead, BufReader, Write}, path::{Path, PathBuf}, process::{Command as StdCommand, Stdio}, sync::{Arc, RwLock}, @@ -41,11 +41,13 @@ pub struct TerminatedPayload { #[derive(Debug, Clone)] #[non_exhaustive] pub enum CommandEvent { - /// Stderr bytes until a newline (\n) or carriage return (\r) is found. + /// If configured for raw output, all bytes written to stderr. + /// Otherwise, bytes until a newline (\n) or carriage return (\r) is found. Stderr(Vec), - /// Stdout bytes until a newline (\n) or carriage return (\r) is found. + /// If configured for raw output, all bytes written to stdout. + /// Otherwise, bytes until a newline (\n) or carriage return (\r) is found. Stdout(Vec), - /// An error happened waiting for the command to finish or converting the stdout/stderr bytes to an UTF-8 string. + /// An error happened waiting for the command to finish or converting the stdout/stderr bytes to a UTF-8 string. Error(String), /// Command process terminated. Terminated(TerminatedPayload), @@ -53,7 +55,10 @@ pub enum CommandEvent { /// The type to spawn commands. #[derive(Debug)] -pub struct Command(StdCommand); +pub struct Command { + cmd: StdCommand, + raw_out: bool, +} /// Spawned child process. #[derive(Debug)] @@ -122,7 +127,7 @@ fn relative_command_path(command: &Path) -> crate::Result { impl From for StdCommand { fn from(cmd: Command) -> StdCommand { - cmd.0 + cmd.cmd } } @@ -136,7 +141,10 @@ impl Command { #[cfg(windows)] command.creation_flags(CREATE_NO_WINDOW); - Self(command) + Self { + cmd: command, + raw_out: false, + } } pub(crate) fn new_sidecar>(program: S) -> crate::Result { @@ -146,7 +154,7 @@ impl Command { /// Appends an argument to the command. #[must_use] pub fn arg>(mut self, arg: S) -> Self { - self.0.arg(arg); + self.cmd.arg(arg); self } @@ -157,14 +165,14 @@ impl Command { I: IntoIterator, S: AsRef, { - self.0.args(args); + self.cmd.args(args); self } /// Clears the entire environment map for the child process. #[must_use] pub fn env_clear(mut self) -> Self { - self.0.env_clear(); + self.cmd.env_clear(); self } @@ -175,7 +183,7 @@ impl Command { K: AsRef, V: AsRef, { - self.0.env(key, value); + self.cmd.env(key, value); self } @@ -187,14 +195,20 @@ impl Command { K: AsRef, V: AsRef, { - self.0.envs(envs); + self.cmd.envs(envs); self } /// Sets the working directory for the child process. #[must_use] pub fn current_dir>(mut self, current_dir: P) -> Self { - self.0.current_dir(current_dir); + self.cmd.current_dir(current_dir); + self + } + + /// Configures the reader to output bytes from the child process exactly as received + pub fn set_raw_out(mut self, raw_out: bool) -> Self { + self.raw_out = raw_out; self } @@ -229,6 +243,7 @@ impl Command { /// }); /// ``` pub fn spawn(self) -> crate::Result<(Receiver, CommandChild)> { + let raw = self.raw_out; let mut command: StdCommand = self.into(); let (stdout_reader, stdout_writer) = pipe()?; let (stderr_reader, stderr_writer) = pipe()?; @@ -249,12 +264,14 @@ impl Command { guard.clone(), stdout_reader, CommandEvent::Stdout, + raw, ); spawn_pipe_reader( tx.clone(), guard.clone(), stderr_reader, CommandEvent::Stderr, + raw, ); spawn(move || { @@ -359,35 +376,74 @@ impl Command { } } +fn read_raw_bytes) -> CommandEvent + Send + Copy + 'static>( + mut reader: BufReader, + tx: Sender, + wrapper: F, +) { + loop { + let result = reader.fill_buf(); + match result { + Ok(buf) => { + let length = buf.len(); + if length == 0 { + break; + } + let tx_ = tx.clone(); + let _ = block_on_task(async move { tx_.send(wrapper(buf.to_vec())).await }); + reader.consume(length); + } + Err(e) => { + let tx_ = tx.clone(); + let _ = block_on_task( + async move { tx_.send(CommandEvent::Error(e.to_string())).await }, + ); + } + } + } +} + +fn read_line) -> CommandEvent + Send + Copy + 'static>( + mut reader: BufReader, + tx: Sender, + wrapper: F, +) { + loop { + let mut buf = Vec::new(); + match tauri::utils::io::read_line(&mut reader, &mut buf) { + Ok(n) => { + if n == 0 { + break; + } + let tx_ = tx.clone(); + let _ = block_on_task(async move { tx_.send(wrapper(buf)).await }); + } + Err(e) => { + let tx_ = tx.clone(); + let _ = block_on_task( + async move { tx_.send(CommandEvent::Error(e.to_string())).await }, + ); + break; + } + } + } +} + fn spawn_pipe_reader) -> CommandEvent + Send + Copy + 'static>( tx: Sender, guard: Arc>, pipe_reader: PipeReader, wrapper: F, + raw_out: bool, ) { spawn(move || { let _lock = guard.read().unwrap(); - let mut reader = BufReader::new(pipe_reader); - - loop { - let mut buf = Vec::new(); - match tauri::utils::io::read_line(&mut reader, &mut buf) { - Ok(n) => { - if n == 0 { - break; - } - let tx_ = tx.clone(); - let _ = block_on_task(async move { tx_.send(wrapper(buf)).await }); - } - Err(e) => { - let tx_ = tx.clone(); - let _ = - block_on_task( - async move { tx_.send(CommandEvent::Error(e.to_string())).await }, - ); - break; - } - } + let reader = BufReader::new(pipe_reader); + + if raw_out { + read_raw_bytes(reader, tx, wrapper); + } else { + read_line(reader, tx, wrapper); } }); } diff --git a/plugins/shell/src/scope.rs b/plugins/shell/src/scope.rs index 6351196b..35fdeaff 100644 --- a/plugins/shell/src/scope.rs +++ b/plugins/shell/src/scope.rs @@ -2,6 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT +use std::sync::Arc; + +#[allow(deprecated)] use crate::open::Program; use crate::process::Command; @@ -86,9 +89,14 @@ impl ScopeObject for ScopeAllowedCommand { crate::scope_entry::ShellAllowedArg::Fixed(fixed) => { crate::scope::ScopeAllowedArg::Fixed(fixed) } - crate::scope_entry::ShellAllowedArg::Var { validator } => { - let validator = Regex::new(&validator) - .unwrap_or_else(|e| panic!("invalid regex {validator}: {e}")); + crate::scope_entry::ShellAllowedArg::Var { validator, raw } => { + let regex = if raw { + validator + } else { + format!("^{validator}$") + }; + let validator = Regex::new(®ex) + .unwrap_or_else(|e| panic!("invalid regex {regex}: {e}")); crate::scope::ScopeAllowedArg::Var { validator } } }); @@ -134,6 +142,7 @@ impl ScopeAllowedArg { /// Scope for the open command pub struct OpenScope { /// The validation regex that `shell > open` paths must match against. + /// When set to `None`, no values are accepted. pub open: Option, } @@ -141,7 +150,7 @@ pub struct OpenScope { #[derive(Clone)] pub struct ShellScope<'a> { /// All allowed commands, using their unique command name as the keys. - pub scopes: Vec<&'a ScopeAllowedCommand>, + pub scopes: Vec<&'a Arc>, } /// All errors that can happen while validating a scoped command. @@ -194,6 +203,7 @@ impl OpenScope { /// /// The path is validated against the `plugins > shell > open` validation regex, which /// defaults to `^((mailto:\w+)|(tel:\w+)|(https?://\w+)).+`. + #[allow(deprecated)] pub fn open(&self, path: &str, with: Option) -> Result<(), Error> { // ensure we pass validation if the configuration has one if let Some(regex) = &self.open { @@ -203,6 +213,12 @@ impl OpenScope { validation: regex.as_str().into(), }); } + } else { + log::warn!("open() command called but the plugin configuration denies calls from JavaScript; set `tauri.conf.json > plugins > shell > open` to true or a validation regex string"); + return Err(Error::Validation { + index: 0, + validation: "tauri^".to_string(), // purposefully impossible regex + }); } // The prevention of argument escaping is handled by the usage of std::process::Command::arg by @@ -215,7 +231,7 @@ impl OpenScope { } } -impl<'a> ShellScope<'a> { +impl ShellScope<'_> { /// Validates argument inputs and creates a Tauri sidecar [`Command`]. pub fn prepare_sidecar( &self, @@ -288,7 +304,7 @@ impl<'a> ShellScope<'a> { .map(|s| { std::path::PathBuf::from(s) .components() - .last() + .next_back() .unwrap() .as_os_str() .to_string_lossy() diff --git a/plugins/shell/src/scope_entry.rs b/plugins/shell/src/scope_entry.rs index aac8e695..59839178 100644 --- a/plugins/shell/src/scope_entry.rs +++ b/plugins/shell/src/scope_entry.rs @@ -7,28 +7,23 @@ use serde::{de::Error as DeError, Deserialize, Deserializer}; use std::path::PathBuf; /// A command allowed to be executed by the webview API. -#[derive(Debug, Clone, PartialEq, Eq, Hash, schemars::JsonSchema)] -pub struct Entry { - /// The name for this allowed shell command configuration. - /// - /// This name will be used inside of the webview API to call this command along with - /// any specified arguments. - pub name: String, - - /// The command name. - /// It can start with a variable that resolves to a system base directory. - /// The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, - /// `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, - /// `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, - /// `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`. - // use default just so the schema doesn't flag it as required - pub command: PathBuf, - - /// The allowed arguments for the command execution. - pub args: ShellAllowedArgs, +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub(crate) struct Entry { + pub(crate) name: String, + pub(crate) command: PathBuf, + pub(crate) args: ShellAllowedArgs, + pub(crate) sidecar: bool, +} - /// If this command is a sidecar command. - pub sidecar: bool, +#[derive(Deserialize)] +pub(crate) struct EntryRaw { + pub(crate) name: String, + #[serde(rename = "cmd")] + pub(crate) command: Option, + #[serde(default)] + pub(crate) args: ShellAllowedArgs, + #[serde(default)] + pub(crate) sidecar: bool, } impl<'de> Deserialize<'de> for Entry { @@ -36,18 +31,7 @@ impl<'de> Deserialize<'de> for Entry { where D: Deserializer<'de>, { - #[derive(Deserialize)] - struct InnerEntry { - name: String, - #[serde(rename = "cmd")] - command: Option, - #[serde(default)] - args: ShellAllowedArgs, - #[serde(default)] - sidecar: bool, - } - - let config = InnerEntry::deserialize(deserializer)?; + let config = EntryRaw::deserialize(deserializer)?; if !config.sidecar && config.command.is_none() { return Err(DeError::custom( @@ -64,19 +48,11 @@ impl<'de> Deserialize<'de> for Entry { } } -/// A set of command arguments allowed to be executed by the webview API. -/// -/// A value of `true` will allow any arguments to be passed to the command. `false` will disable all -/// arguments. A list of [`ShellAllowedArg`] will set those arguments as the only valid arguments to -/// be passed to the attached command configuration. -#[derive(Debug, PartialEq, Eq, Clone, Hash, Deserialize, schemars::JsonSchema)] +#[derive(Debug, PartialEq, Eq, Clone, Hash, Deserialize)] #[serde(untagged, deny_unknown_fields)] #[non_exhaustive] pub enum ShellAllowedArgs { - /// Use a simple boolean to allow all or disable all arguments to this command configuration. Flag(bool), - - /// A specific set of [`ShellAllowedArg`] that are valid to call for the command configuration. List(Vec), } @@ -86,23 +62,14 @@ impl Default for ShellAllowedArgs { } } -/// A command argument allowed to be executed by the webview API. -#[derive(Debug, PartialEq, Eq, Clone, Hash, Deserialize, schemars::JsonSchema)] +#[derive(Debug, PartialEq, Eq, Clone, Hash, Deserialize)] #[serde(untagged, deny_unknown_fields)] #[non_exhaustive] pub enum ShellAllowedArg { - /// A non-configurable argument that is passed to the command in the order it was specified. Fixed(String), - - /// A variable that is set while calling the command from the webview API. - /// Var { - /// [regex] validator to require passed values to conform to an expected input. - /// - /// This will require the argument value passed to this variable to match the `validator` regex - /// before it will be executed. - /// - /// [regex]: https://docs.rs/regex/latest/regex/#syntax validator: String, + #[serde(default)] + raw: bool, }, } diff --git a/plugins/single-instance/CHANGELOG.md b/plugins/single-instance/CHANGELOG.md index f25e89a6..54969994 100644 --- a/plugins/single-instance/CHANGELOG.md +++ b/plugins/single-instance/CHANGELOG.md @@ -1,5 +1,128 @@ # Changelog +## \[2.2.3] + +### Dependencies + +- Upgraded to `deep-link@2.2.1` + +## \[2.2.2] + +- [`1ab5f157`](https://github.com/tauri-apps/plugins-workspace/commit/1ab5f1576333174095bc7dad4bef7a8576bb29ab) ([#2452](https://github.com/tauri-apps/plugins-workspace/pull/2452) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Fixed `null pointer dereference` panic on rust nightly on Windows. + +## \[2.2.1] + +- [`da5c59e2`](https://github.com/tauri-apps/plugins-workspace/commit/da5c59e2fe879d177e3cfd52fcacce85440423cb) ([#2271](https://github.com/tauri-apps/plugins-workspace/pull/2271) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Updated `zbus` dependency to version 5. No API changes. + +## \[2.2.0] + +- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other. + +### Dependencies + +- Upgraded to `deep-link@2.1.0` + +## \[2.0.2] + +### Dependencies + +- Upgraded to `deep-link@2.0.2` + +## \[2.0.1] + +- [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7. + +### Dependencies + +- Upgraded to `deep-link@2.0.1` + +## \[2.0.0] + +- [`e2c4dfb6`](https://github.com/tauri-apps/plugins-workspace/commit/e2c4dfb6af43e5dd8d9ceba232c315f5febd55c1) Update to tauri v2 stable release. + +### Dependencies + +- Upgraded to `deep-link@2.0.0` + +## \[2.0.0-rc.5] + +### Dependencies + +- Upgraded to `deep-link@2.0.0-rc.7` + +## \[2.0.0-rc.4] + +### Dependencies + +- Upgraded to `deep-link@2.0.0-rc.6` + +## \[2.0.0-rc.3] + +- [`b2269333`](https://github.com/tauri-apps/plugins-workspace/commit/b2269333e39afe32629a11763a8e25d0b12b132b) ([#1766](https://github.com/tauri-apps/plugins-workspace/pull/1766) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Put deep link integration behined a feature + +### Dependencies + +- Upgraded to `deep-link@2.0.0-rc.5` + +## \[2.0.0-rc.2] + +- [`64a6240f`](https://github.com/tauri-apps/plugins-workspace/commit/64a6240f79fcd52267c8d721b727ae695055d7ff) ([#1759](https://github.com/tauri-apps/plugins-workspace/pull/1759) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Integrate with the deep link plugin out of the box. + +### Dependencies + +- Upgraded to `deep-link@2.0.0-rc.4` + +## \[2.0.0-rc.1] + +- [`3c52f30e`](https://github.com/tauri-apps/plugins-workspace/commit/3c52f30ea4ec29c51f7021aa7871614d72e43258) ([#1665](https://github.com/tauri-apps/plugins-workspace/pull/1665) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Updated `windows-sys` crate to `0.59` +- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri 2.0.0-rc.8 + +## \[2.0.0-rc.0] + +- [`9887d1`](https://github.com/tauri-apps/plugins-workspace/commit/9887d14bd0e971c4c0f5c1188fc4005d3fc2e29e) Update to tauri RC. + +## \[2.0.0-beta.12] + +- [`e847cedc`](https://github.com/tauri-apps/plugins-workspace/commit/e847cedc1f46f3e7a2ad81ea579b620bc5b992d7) ([#1402](https://github.com/tauri-apps/plugins-workspace/pull/1402) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Use no default features on tauri for all plugins so that consumers can use `default-features = false` on tauri, note that this will still enable wry feature on iOS +- [`6de87966`](https://github.com/tauri-apps/plugins-workspace/commit/6de87966ecc00ad9d91c25be452f1f46bd2b7e1f) ([#1597](https://github.com/tauri-apps/plugins-workspace/pull/1597) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Update to tauri beta.25. + +## \[2.0.0-beta.11] + +- [`22a17980`](https://github.com/tauri-apps/plugins-workspace/commit/22a17980ff4f6f8c40adb1b8f4ffc6dae2fe7e30) ([#1537](https://github.com/tauri-apps/plugins-workspace/pull/1537) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri beta.24. + +## \[2.0.0-beta.10] + +- [`76daee7a`](https://github.com/tauri-apps/plugins-workspace/commit/76daee7aafece34de3092c86e531cf9eb1138989) ([#1512](https://github.com/tauri-apps/plugins-workspace/pull/1512) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Update to tauri beta.23. + +## \[2.0.0-beta.9] + +- [`9013854f`](https://github.com/tauri-apps/plugins-workspace/commit/9013854f42a49a230b9dbb9d02774765528a923f)([#1382](https://github.com/tauri-apps/plugins-workspace/pull/1382)) Update to tauri beta.22. + +## \[2.0.0-beta.8] + +- [`430bd6f4`](https://github.com/tauri-apps/plugins-workspace/commit/430bd6f4f379bee5d232ae6b098ae131db7f178a)([#1363](https://github.com/tauri-apps/plugins-workspace/pull/1363)) Update to tauri beta.20. + +## \[2.0.0-beta.7] + +- [`bd1ed590`](https://github.com/tauri-apps/plugins-workspace/commit/bd1ed5903ffcce5500310dac1e59e8c67674ef1e)([#1237](https://github.com/tauri-apps/plugins-workspace/pull/1237)) Update to tauri beta.17. + +## \[2.0.0-beta.6] + +- [`ed46dca`](https://github.com/tauri-apps/plugins-workspace/commit/ed46dca74ff3947dbbcb26a7b571c129bf925698) Added the `semver` feature flag to make the single instance mechanism only trigger for semver compatible versions. + +## \[2.0.0-beta.5] + +- [`dabac0e`](https://github.com/tauri-apps/plugins-workspace/commit/dabac0eedfd6e6d192c6c5a214e708b3c0223f6f)([#1035](https://github.com/tauri-apps/plugins-workspace/pull/1035)) Added implementation for MacOS. + +## \[2.0.0-beta.4] + +- [`a04ea2f`](https://github.com/tauri-apps/plugins-workspace/commit/a04ea2f38294d5a3987578283badc8eec87a7752)([#1071](https://github.com/tauri-apps/plugins-workspace/pull/1071)) The global API script is now only added to the binary when the `withGlobalTauri` config is true. + +## \[2.0.0-beta.3] + +- [`2397ec5`](https://github.com/tauri-apps/plugins-workspace/commit/2397ec5937e594397e533925ccd257cae30b4cd1)([#1019](https://github.com/tauri-apps/plugins-workspace/pull/1019)) Fix doesn't shutdown immediately. +- [`99bea25`](https://github.com/tauri-apps/plugins-workspace/commit/99bea2559c2c0648c2519c50a18cd124dacef57b)([#1005](https://github.com/tauri-apps/plugins-workspace/pull/1005)) Update to tauri beta.8. + ## \[2.0.0-beta.2] - [`6d1e621`](https://github.com/tauri-apps/plugins-workspace/commit/6d1e6218b5877ef91f589f790f7251acda9c9605)([#981](https://github.com/tauri-apps/plugins-workspace/pull/981)) Fix `zbus::blocking::connection::Builder` import. diff --git a/plugins/single-instance/Cargo.toml b/plugins/single-instance/Cargo.toml index 7a5fb072..eb019767 100644 --- a/plugins/single-instance/Cargo.toml +++ b/plugins/single-instance/Cargo.toml @@ -1,26 +1,36 @@ [package] name = "tauri-plugin-single-instance" -version = "2.0.0-beta.2" +version = "2.2.3" description = "Ensure a single instance of your tauri app is running." authors = { workspace = true } license = { workspace = true } edition = { workspace = true } rust-version = { workspace = true } -exclude = [ "/examples" ] +repository = { workspace = true } +exclude = ["/examples"] [package.metadata.docs.rs] -rustc-args = [ "--cfg", "docsrs" ] -rustdoc-args = [ "--cfg", "docsrs" ] +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs"] + +[package.metadata.platforms.support] +windows = { level = "full", notes = "" } +linux = { level = "full", notes = "" } +macos = { level = "full", notes = "" } +android = { level = "none", notes = "" } +ios = { level = "none", notes = "" } [dependencies] serde = { workspace = true } serde_json = { workspace = true } tauri = { workspace = true } -log = { workspace = true } +tracing = { workspace = true } thiserror = { workspace = true } +tauri-plugin-deep-link = { path = "../deep-link", version = "2.2.1", optional = true } +semver = { version = "1", optional = true } [target."cfg(target_os = \"windows\")".dependencies.windows-sys] -version = "0.52" +version = "0.59" features = [ "Win32_System_Threading", "Win32_System_DataExchange", @@ -28,8 +38,12 @@ features = [ "Win32_UI_WindowsAndMessaging", "Win32_Security", "Win32_System_LibraryLoader", - "Win32_Graphics_Gdi" + "Win32_Graphics_Gdi", ] [target."cfg(target_os = \"linux\")".dependencies] -zbus = "4" +zbus = { workspace = true } + +[features] +semver = ["dep:semver"] +deep-link = ["dep:tauri-plugin-deep-link"] diff --git a/plugins/single-instance/README.md b/plugins/single-instance/README.md index b72b7612..711be6ae 100644 --- a/plugins/single-instance/README.md +++ b/plugins/single-instance/README.md @@ -2,9 +2,17 @@ Ensure a single instance of your tauri app is running. +| Platform | Supported | +| -------- | --------- | +| Linux | ✓ | +| Windows | ✓ | +| macOS | ✓ | +| Android | x | +| iOS | x | + ## Install -_This plugin requires a Rust version of at least **1.75**_ +_This plugin requires a Rust version of at least **1.77.2**_ There are three general methods of installation that we can recommend. @@ -18,7 +26,7 @@ Install the Core plugin by adding the following to your `Cargo.toml` file: ```toml [dependencies] -tauri-plugin-single-instance = "2.0.0-beta" +tauri-plugin-single-instance = "2.0.0" # alternatively with Git: tauri-plugin-single-instance = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` @@ -27,29 +35,30 @@ tauri-plugin-single-instance = { git = "https://github.com/tauri-apps/plugins-wo First you need to register the core plugin with Tauri: -`src-tauri/src/main.rs` +`src-tauri/src/lib.rs` ```rust use tauri::{Manager}; #[derive(Clone, serde::Serialize)] struct Payload { - args: Vec, - cwd: String, + args: Vec, + cwd: String, } fn main() { tauri::Builder::default() .plugin(tauri_plugin_single_instance::init(|app, argv, cwd| { println!("{}, {argv:?}, {cwd}", app.package_info().name); - - app.emit_all("single-instance", Payload { args: argv, cwd }).unwrap(); + app.emit("single-instance", Payload { args: argv, cwd }).unwrap(); })) .run(tauri::generate_context!()) .expect("error while running tauri application"); } ``` +Note that currently, plugins run in the order they were added in to the builder, so make sure that this plugin is registered first. + ## Contributing PRs accepted. Please make sure to read the Contributing Guide before making a pull request. diff --git a/plugins/single-instance/SECURITY.md b/plugins/single-instance/SECURITY.md new file mode 100644 index 00000000..4f09bbac --- /dev/null +++ b/plugins/single-instance/SECURITY.md @@ -0,0 +1,23 @@ +# Security Policy + +**Do not report security vulnerabilities through public GitHub issues.** + +**Please use the [Private Vulnerability Disclosure](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability) feature of GitHub.** + +Include as much of the following information: + +- Type of issue (e.g. improper input parsing, privilege escalation, etc.) +- The location of the affected source code (tag/branch/commit or direct URL) +- Any special configuration required to reproduce the issue +- The distribution affected or used to help us with reproduction of the issue +- Step-by-step instructions to reproduce the issue +- Ideally a reproduction repository +- Impact of the issue, including how an attacker might exploit the issue + +We prefer to receive reports in English. + +## Contact + +Please disclose a vulnerability or security relevant issue here: [https://github.com/tauri-apps/plugins-workspace/security/advisories/new](https://github.com/tauri-apps/plugins-workspace/security/advisories/new). + +Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app). diff --git a/plugins/single-instance/examples/vanilla/package.json b/plugins/single-instance/examples/vanilla/package.json index 0a0e8683..d1d0828e 100644 --- a/plugins/single-instance/examples/vanilla/package.json +++ b/plugins/single-instance/examples/vanilla/package.json @@ -4,11 +4,11 @@ "description": "", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "tauri": "tauri" }, "author": "", "license": "MIT", "devDependencies": { - "@tauri-apps/cli": "2.0.0-beta.3" + "@tauri-apps/cli": "2.5.0" } } diff --git a/plugins/single-instance/examples/vanilla/src-tauri/Cargo.toml b/plugins/single-instance/examples/vanilla/src-tauri/Cargo.toml index 13da3100..d764081c 100644 --- a/plugins/single-instance/examples/vanilla/src-tauri/Cargo.toml +++ b/plugins/single-instance/examples/vanilla/src-tauri/Cargo.toml @@ -2,19 +2,20 @@ name = "single-instance-example" version = "0.1.0" description = "A Tauri App" -authors = [ "You" ] +authors = ["You"] repository = "" edition = "2021" -rust-version = "1.75" +rust-version = "1.77.2" [dependencies] -serde_json = { workspace = true } serde = { workspace = true } -tauri = { workspace = true } +serde_json = { workspace = true } +tauri = { workspace = true, features = ["wry", "compression"] } tauri-plugin-single-instance = { path = "../../../" } +tauri-plugin-cli = { path = "../../../../cli" } [build-dependencies] tauri-build = { workspace = true } [features] -custom-protocol = [ "tauri/custom-protocol" ] +prod = ["tauri/custom-protocol"] diff --git a/plugins/single-instance/examples/vanilla/src-tauri/build.rs b/plugins/single-instance/examples/vanilla/src-tauri/build.rs index b055ec37..5ebf8d2f 100644 --- a/plugins/single-instance/examples/vanilla/src-tauri/build.rs +++ b/plugins/single-instance/examples/vanilla/src-tauri/build.rs @@ -3,5 +3,5 @@ // SPDX-License-Identifier: MIT fn main() { - tauri_build::build() + tauri_build::build() } diff --git a/plugins/single-instance/examples/vanilla/src-tauri/rustfmt.toml b/plugins/single-instance/examples/vanilla/src-tauri/rustfmt.toml deleted file mode 100644 index 550a0985..00000000 --- a/plugins/single-instance/examples/vanilla/src-tauri/rustfmt.toml +++ /dev/null @@ -1,14 +0,0 @@ -max_width = 100 -hard_tabs = false -tab_spaces = 2 -newline_style = "Auto" -use_small_heuristics = "Default" -reorder_imports = true -reorder_modules = true -remove_nested_parens = true -edition = "2021" -merge_derives = true -use_try_shorthand = false -use_field_init_shorthand = false -force_explicit_abi = true -imports_granularity = "Crate" diff --git a/plugins/single-instance/examples/vanilla/src-tauri/src/main.rs b/plugins/single-instance/examples/vanilla/src-tauri/src/main.rs index 0b93460d..e736c4f3 100644 --- a/plugins/single-instance/examples/vanilla/src-tauri/src/main.rs +++ b/plugins/single-instance/examples/vanilla/src-tauri/src/main.rs @@ -3,15 +3,15 @@ // SPDX-License-Identifier: MIT #![cfg_attr( - all(not(debug_assertions), target_os = "windows"), - windows_subsystem = "windows" + all(not(debug_assertions), target_os = "windows"), + windows_subsystem = "windows" )] fn main() { - tauri::Builder::default() - .plugin(tauri_plugin_single_instance::init(|app, argv, cwd| { - println!("{}, {argv:?}, {cwd}", app.package_info().name); - })) - .run(tauri::generate_context!()) - .expect("error while running tauri application"); + tauri::Builder::default() + .plugin(tauri_plugin_single_instance::init(|app, argv, cwd| { + println!("{}, {argv:?}, {cwd}", app.package_info().name); + })) + .run(tauri::generate_context!()) + .expect("error while running tauri application"); } diff --git a/plugins/single-instance/examples/vanilla/src-tauri/tauri.conf.json b/plugins/single-instance/examples/vanilla/src-tauri/tauri.conf.json index 8f9a852d..41623cc5 100644 --- a/plugins/single-instance/examples/vanilla/src-tauri/tauri.conf.json +++ b/plugins/single-instance/examples/vanilla/src-tauri/tauri.conf.json @@ -29,5 +29,17 @@ "icons/icon.icns", "icons/icon.ico" ] + }, + "plugins": { + "cli": { + "description": "Testing single-instance on MacOS", + "args": [ + { + "name": "somearg", + "index": 1, + "takesValue": true + } + ] + } } } diff --git a/plugins/single-instance/src/lib.rs b/plugins/single-instance/src/lib.rs index 715c894e..03fd1ed7 100644 --- a/plugins/single-instance/src/lib.rs +++ b/plugins/single-instance/src/lib.rs @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -//! [![](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/single-instance/banner.png)](https://github.com/tauri-apps/plugins-workspace/tree/v2/plugins/single-instance) -//! //! Ensure a single instance of your tauri app is running. #![doc( @@ -24,13 +22,22 @@ mod platform_impl; #[path = "platform_impl/macos.rs"] mod platform_impl; +#[cfg(feature = "semver")] +mod semver_compat; + pub(crate) type SingleInstanceCallback = dyn FnMut(&AppHandle, Vec, String) + Send + Sync + 'static; pub fn init, Vec, String) + Send + Sync + 'static>( - f: F, + mut f: F, ) -> TauriPlugin { - platform_impl::init(Box::new(f)) + platform_impl::init(Box::new(move |app, args, cwd| { + #[cfg(feature = "deep-link")] + if let Some(deep_link) = app.try_state::>() { + deep_link.handle_cli_arguments(args.iter()); + } + f(app, args, cwd) + })) } pub fn destroy>(manager: &M) { diff --git a/plugins/single-instance/src/platform_impl/linux.rs b/plugins/single-instance/src/platform_impl/linux.rs index c613a0d6..3136074f 100644 --- a/plugins/single-instance/src/platform_impl/linux.rs +++ b/plugins/single-instance/src/platform_impl/linux.rs @@ -2,7 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -#![cfg(target_os = "linux")] +#[cfg(feature = "semver")] +use crate::semver_compat::semver_compat_string; use crate::SingleInstanceCallback; use tauri::{ @@ -28,6 +29,15 @@ impl SingleInstanceDBus { } } +#[cfg(feature = "semver")] +fn dbus_id(config: &Config, version: semver::Version) -> String { + let mut id = config.identifier.replace(['.', '-'], "_"); + id.push('_'); + id.push_str(semver_compat_string(version).as_str()); + id +} + +#[cfg(not(feature = "semver"))] fn dbus_id(config: &Config) -> String { config.identifier.replace(['.', '-'], "_") } @@ -35,7 +45,11 @@ fn dbus_id(config: &Config) -> String { pub fn init(f: Box>) -> TauriPlugin { plugin::Builder::new("single-instance") .setup(|app, _api| { + #[cfg(feature = "semver")] + let id = dbus_id(app.config(), app.package_info().version.clone()); + #[cfg(not(feature = "semver"))] let id = dbus_id(app.config()); + let single_instance_dbus = SingleInstanceDBus { callback: f, app_handle: app.clone(), @@ -70,7 +84,8 @@ pub fn init(f: Box>) -> TauriPlugin { ), ); } - std::process::exit(0) + app.cleanup_before_exit(); + std::process::exit(0); } _ => {} } @@ -87,7 +102,15 @@ pub fn init(f: Box>) -> TauriPlugin { pub fn destroy>(manager: &M) { if let Some(connection) = manager.try_state::() { - let dbus_name = format!("org.{}.SingleInstance", dbus_id(manager.config())); + #[cfg(feature = "semver")] + let id = dbus_id( + manager.config(), + manager.app_handle().package_info().version.clone(), + ); + #[cfg(not(feature = "semver"))] + let id = dbus_id(manager.config()); + + let dbus_name = format!("org.{id}.SingleInstance",); let _ = connection.0.release_name(dbus_name); } } diff --git a/plugins/single-instance/src/platform_impl/macos.rs b/plugins/single-instance/src/platform_impl/macos.rs index 170ff0e0..63991513 100644 --- a/plugins/single-instance/src/platform_impl/macos.rs +++ b/plugins/single-instance/src/platform_impl/macos.rs @@ -2,15 +2,132 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -#![cfg(target_os = "macos")] +use std::{ + io::{BufWriter, Error, ErrorKind, Read, Write}, + os::unix::net::{UnixListener, UnixStream}, + path::PathBuf, +}; +#[cfg(feature = "semver")] +use crate::semver_compat::semver_compat_string; use crate::SingleInstanceCallback; use tauri::{ plugin::{self, TauriPlugin}, - Manager, Runtime, + AppHandle, Config, Manager, RunEvent, Runtime, }; -pub fn init(_f: Box>) -> TauriPlugin { - plugin::Builder::new("single-instance").build() + +pub fn init(cb: Box>) -> TauriPlugin { + plugin::Builder::new("single-instance") + .setup(|app, _api| { + let socket = socket_path(app.config(), app.package_info()); + + // Notify the singleton which may or may not exist. + match notify_singleton(&socket) { + Ok(_) => { + std::process::exit(0); + } + Err(e) => { + match e.kind() { + ErrorKind::NotFound | ErrorKind::ConnectionRefused => { + // This process claims itself as singleton as likely none exists + socket_cleanup(&socket); + listen_for_other_instances(&socket, app.clone(), cb); + } + _ => { + tracing::debug!( + "single_instance failed to notify - launching normally: {}", + e + ); + } + } + } + } + Ok(()) + }) + .on_event(|app, event| { + if let RunEvent::Exit = event { + destroy(app); + } + }) + .build() +} + +pub fn destroy>(manager: &M) { + let socket = socket_path(manager.config(), manager.package_info()); + socket_cleanup(&socket); +} + +fn socket_path(config: &Config, _package_info: &tauri::PackageInfo) -> PathBuf { + let identifier = config.identifier.replace(['.', '-'].as_ref(), "_"); + + #[cfg(feature = "semver")] + let identifier = format!( + "{identifier}_{}", + semver_compat_string(_package_info.version.clone()), + ); + + // Use /tmp as socket path must be shorter than 100 chars. + PathBuf::from(format!("/tmp/{}_si.sock", identifier)) +} + +fn socket_cleanup(socket: &PathBuf) { + let _ = std::fs::remove_file(socket); } -pub fn destroy>(_manager: &M) {} +fn notify_singleton(socket: &PathBuf) -> Result<(), Error> { + let stream = UnixStream::connect(socket)?; + let mut bf = BufWriter::new(&stream); + let cwd = std::env::current_dir() + .unwrap_or_default() + .to_str() + .unwrap_or_default() + .to_string(); + bf.write_all(cwd.as_bytes())?; + bf.write_all(b"\0\0")?; + let args_joined = std::env::args().collect::>().join("\0"); + bf.write_all(args_joined.as_bytes())?; + bf.flush()?; + drop(bf); + Ok(()) +} + +fn listen_for_other_instances( + socket: &PathBuf, + app: AppHandle, + mut cb: Box>, +) { + match UnixListener::bind(socket) { + Ok(listener) => { + tauri::async_runtime::spawn(async move { + for stream in listener.incoming() { + match stream { + Ok(mut stream) => { + let mut s = String::new(); + match stream.read_to_string(&mut s) { + Ok(_) => { + let (cwd, args) = s.split_once("\0\0").unwrap_or_default(); + let args: Vec = + args.split('\0').map(String::from).collect(); + cb(app.app_handle(), args, cwd.to_string()); + } + Err(e) => { + tracing::debug!("single_instance failed to be notified: {e}") + } + } + } + Err(err) => { + tracing::debug!("single_instance failed to be notified: {}", err); + continue; + } + } + } + }); + } + Err(err) => { + tracing::error!( + "single_instance failed to listen to other processes - launching normally: {}", + err + ); + } + } +} diff --git a/plugins/single-instance/src/platform_impl/windows.rs b/plugins/single-instance/src/platform_impl/windows.rs index f66b2d1a..832d0803 100644 --- a/plugins/single-instance/src/platform_impl/windows.rs +++ b/plugins/single-instance/src/platform_impl/windows.rs @@ -2,7 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -#![cfg(target_os = "windows")] +#[cfg(feature = "semver")] +use crate::semver_compat::semver_compat_string; use crate::SingleInstanceCallback; use std::ffi::CStr; @@ -19,21 +20,47 @@ use windows_sys::Win32::{ }, UI::WindowsAndMessaging::{ self as w32wm, CreateWindowExW, DefWindowProcW, DestroyWindow, FindWindowW, - RegisterClassExW, SendMessageW, GWL_STYLE, GWL_USERDATA, WINDOW_LONG_PTR_INDEX, - WM_COPYDATA, WM_DESTROY, WNDCLASSEXW, WS_EX_LAYERED, WS_EX_NOACTIVATE, WS_EX_TOOLWINDOW, - WS_EX_TRANSPARENT, WS_OVERLAPPED, WS_POPUP, WS_VISIBLE, + RegisterClassExW, SendMessageW, CREATESTRUCTW, GWLP_USERDATA, GWL_STYLE, + WINDOW_LONG_PTR_INDEX, WM_COPYDATA, WM_CREATE, WM_DESTROY, WNDCLASSEXW, WS_EX_LAYERED, + WS_EX_NOACTIVATE, WS_EX_TOOLWINDOW, WS_EX_TRANSPARENT, WS_OVERLAPPED, WS_POPUP, WS_VISIBLE, }, }; +const WMCOPYDATA_SINGLE_INSTANCE_DATA: usize = 1542; + struct MutexHandle(isize); + struct TargetWindowHandle(isize); -const WMCOPYDATA_SINGLE_INSTANCE_DATA: usize = 1542; +struct UserData { + app: AppHandle, + callback: Box>, +} + +impl UserData { + unsafe fn from_hwnd_raw(hwnd: HWND) -> *mut Self { + GetWindowLongPtrW(hwnd, GWLP_USERDATA) as *mut Self + } -pub fn init(f: Box>) -> TauriPlugin { + unsafe fn from_hwnd<'a>(hwnd: HWND) -> &'a mut Self { + &mut *Self::from_hwnd_raw(hwnd) + } + + fn run_callback(&mut self, args: Vec, cwd: String) { + (self.callback)(&self.app, args, cwd) + } +} + +pub fn init(callback: Box>) -> TauriPlugin { plugin::Builder::new("single-instance") .setup(|app, _api| { - let id = &app.config().identifier; + #[allow(unused_mut)] + let mut id = app.config().identifier.clone(); + #[cfg(feature = "semver")] + { + id.push('_'); + id.push_str(semver_compat_string(app.package_info().version.clone()).as_str()); + } let class_name = encode_wide(format!("{id}-sic")); let window_name = encode_wide(format!("{id}-siw")); @@ -46,38 +73,37 @@ pub fn init(f: Box>) -> TauriPlugin { unsafe { let hwnd = FindWindowW(class_name.as_ptr(), window_name.as_ptr()); - if hwnd != 0 { - let data = format!( - "{}|{}\0", - std::env::current_dir() - .unwrap_or_default() - .to_str() - .unwrap_or_default(), - std::env::args().collect::>().join("|") - ); + if !hwnd.is_null() { + let cwd = std::env::current_dir().unwrap_or_default(); + let cwd = cwd.to_str().unwrap_or_default(); + + let args = std::env::args().collect::>().join("|"); + + let data = format!("{cwd}|{args}\0",); + let bytes = data.as_bytes(); let cds = COPYDATASTRUCT { dwData: WMCOPYDATA_SINGLE_INSTANCE_DATA, cbData: bytes.len() as _, lpData: bytes.as_ptr() as _, }; + SendMessageW(hwnd, WM_COPYDATA, 0, &cds as *const _ as _); - app.exit(0); + + app.cleanup_before_exit(); + std::process::exit(0); } } } else { - app.manage(MutexHandle(hmutex)); + app.manage(MutexHandle(hmutex as _)); - let hwnd = create_event_target_window::(&class_name, &window_name); - unsafe { - SetWindowLongPtrW( - hwnd, - GWL_USERDATA, - Box::into_raw(Box::new((app.clone(), f))) as _, - ) + let userdata = UserData { + app: app.clone(), + callback, }; - - app.manage(TargetWindowHandle(hwnd)); + let userdata = Box::into_raw(Box::new(userdata)); + let hwnd = create_event_target_window::(&class_name, &window_name, userdata); + app.manage(TargetWindowHandle(hwnd as _)); } Ok(()) @@ -93,12 +119,12 @@ pub fn init(f: Box>) -> TauriPlugin { pub fn destroy>(manager: &M) { if let Some(hmutex) = manager.try_state::() { unsafe { - ReleaseMutex(hmutex.0); - CloseHandle(hmutex.0); + ReleaseMutex(hmutex.0 as _); + CloseHandle(hmutex.0 as _); } } if let Some(hwnd) = manager.try_state::() { - unsafe { DestroyWindow(hwnd.0) }; + unsafe { DestroyWindow(hwnd.0 as _) }; } } @@ -108,32 +134,43 @@ unsafe extern "system" fn single_instance_window_proc( wparam: WPARAM, lparam: LPARAM, ) -> LRESULT { - let data_ptr = GetWindowLongPtrW(hwnd, GWL_USERDATA) - as *mut (AppHandle, Box>); - let (app_handle, callback) = &mut *data_ptr; - match msg { + WM_CREATE => { + let create_struct = &*(lparam as *const CREATESTRUCTW); + let userdata = create_struct.lpCreateParams as *const UserData; + SetWindowLongPtrW(hwnd, GWLP_USERDATA, userdata as _); + 0 + } + WM_COPYDATA => { let cds_ptr = lparam as *const COPYDATASTRUCT; if (*cds_ptr).dwData == WMCOPYDATA_SINGLE_INSTANCE_DATA { + let userdata = UserData::::from_hwnd(hwnd); + let data = CStr::from_ptr((*cds_ptr).lpData as _).to_string_lossy(); let mut s = data.split('|'); let cwd = s.next().unwrap(); let args = s.map(|s| s.to_string()).collect(); - callback(app_handle, args, cwd.to_string()); + + userdata.run_callback(args, cwd.to_string()); } 1 } WM_DESTROY => { - let _ = Box::from_raw(data_ptr); + let userdata = UserData::::from_hwnd_raw(hwnd); + drop(Box::from_raw(userdata)); 0 } _ => DefWindowProcW(hwnd, msg, wparam, lparam), } } -fn create_event_target_window(class_name: &[u16], window_name: &[u16]) -> HWND { +fn create_event_target_window( + class_name: &[u16], + window_name: &[u16], + userdata: *const UserData, +) -> HWND { unsafe { let class = WNDCLASSEXW { cbSize: std::mem::size_of::() as u32, @@ -142,12 +179,12 @@ fn create_event_target_window(class_name: &[u16], window_name: &[u16 cbClsExtra: 0, cbWndExtra: 0, hInstance: GetModuleHandleW(std::ptr::null()), - hIcon: 0, - hCursor: 0, - hbrBackground: 0, + hIcon: std::ptr::null_mut(), + hCursor: std::ptr::null_mut(), + hbrBackground: std::ptr::null_mut(), lpszMenuName: std::ptr::null(), lpszClassName: class_name.as_ptr(), - hIconSm: 0, + hIconSm: std::ptr::null_mut(), }; RegisterClassExW(&class); @@ -171,10 +208,10 @@ fn create_event_target_window(class_name: &[u16], window_name: &[u16 0, 0, 0, - 0, - 0, + std::ptr::null_mut(), + std::ptr::null_mut(), GetModuleHandleW(std::ptr::null()), - std::ptr::null(), + userdata as _, ); SetWindowLongPtrW( hwnd, diff --git a/plugins/single-instance/src/semver_compat.rs b/plugins/single-instance/src/semver_compat.rs new file mode 100644 index 00000000..80487cae --- /dev/null +++ b/plugins/single-instance/src/semver_compat.rs @@ -0,0 +1,19 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +/// Takes a version and spits out a String with trailing _x, thus only considering the digits +/// relevant regarding semver compatibility +pub fn semver_compat_string(version: semver::Version) -> String { + // for pre-release always treat each version separately + if !version.pre.is_empty() { + return version.to_string().replace(['.', '-'], "_"); + } + match version.major { + 0 => match version.minor { + 0 => format!("0_0_{}", version.patch), + _ => format!("0_{}_x", version.minor), + }, + _ => format!("{}_x_x", version.major), + } +} diff --git a/plugins/sql/.gitignore b/plugins/sql/.gitignore deleted file mode 100644 index b512c09d..00000000 --- a/plugins/sql/.gitignore +++ /dev/null @@ -1 +0,0 @@ -node_modules \ No newline at end of file diff --git a/plugins/sql/CHANGELOG.md b/plugins/sql/CHANGELOG.md index 57dc46dd..a80c3ff1 100644 --- a/plugins/sql/CHANGELOG.md +++ b/plugins/sql/CHANGELOG.md @@ -1,5 +1,86 @@ # Changelog +## \[2.2.0] + +- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other. + +## \[2.0.2] + +- [`31956469`](https://github.com/tauri-apps/plugins-workspace/commit/319564699638c080b73d506bcaad186ecc4a8236) ([#1928](https://github.com/tauri-apps/plugins-workspace/pull/1928) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Fixed the QueryResult typing by marking `lastInsertId` as optional to reflect postgres-only changes made in the 2.0.0 release. + +## \[2.0.3] + +- [`90ef77c8`](https://github.com/tauri-apps/plugins-workspace/commit/90ef77c8723ac9d0ba7bd3b52a80a2b14843ff99) ([#2038](https://github.com/tauri-apps/plugins-workspace/pull/2038) by [@johncarmack1984](https://github.com/tauri-apps/plugins-workspace/../../johncarmack1984)) Allow blocking on async code without creating a nested runtime. + +## \[2.0.1] + +- [`0ca4cc91`](https://github.com/tauri-apps/plugins-workspace/commit/0ca4cc914c5ea995c98f9e60a2ab49827c219350) ([#1963](https://github.com/tauri-apps/plugins-workspace/pull/1963) by [@yoggys](https://github.com/tauri-apps/plugins-workspace/../../yoggys)) Fixed incorrect documentation of the select method in the Database class. + +## \[2.0.1] + +- [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7. + +## \[2.0.0] + +- [`e2c4dfb6`](https://github.com/tauri-apps/plugins-workspace/commit/e2c4dfb6af43e5dd8d9ceba232c315f5febd55c1) Update to tauri v2 stable release. + +## \[2.0.0-rc.3] + +- [`30bcf5dc`](https://github.com/tauri-apps/plugins-workspace/commit/30bcf5dcc22e1bb1fb983a8d2887edc39404e6df) ([#1838](https://github.com/tauri-apps/plugins-workspace/pull/1838) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) It is now possible to enable multiple SQL backends at the same time. There will be no compile error anymore if no backends are enabled! + +## \[2.0.0-rc.2] + +- [`0dd97d91`](https://github.com/tauri-apps/plugins-workspace/commit/0dd97d911569cdedab07f504b708036d62ff83c1) ([#1375](https://github.com/tauri-apps/plugins-workspace/pull/1375) by [@KauanCurbani](https://github.com/tauri-apps/plugins-workspace/../../KauanCurbani)) Added support for `UUID` columns to the postgres implementation. + +## \[2.0.0-rc.1] + +- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri 2.0.0-rc.8 + +## \[2.0.0-rc.0] + +- [`9887d1`](https://github.com/tauri-apps/plugins-workspace/commit/9887d14bd0e971c4c0f5c1188fc4005d3fc2e29e) Update to tauri RC. + +## \[2.0.0-beta.8] + +- [`99d6ac0f`](https://github.com/tauri-apps/plugins-workspace/commit/99d6ac0f9506a6a4a1aa59c728157190a7441af6) ([#1606](https://github.com/tauri-apps/plugins-workspace/pull/1606) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) The JS packages now specify the *minimum* `@tauri-apps/api` version instead of a single exact version. +- [`6de87966`](https://github.com/tauri-apps/plugins-workspace/commit/6de87966ecc00ad9d91c25be452f1f46bd2b7e1f) ([#1597](https://github.com/tauri-apps/plugins-workspace/pull/1597) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Update to tauri beta.25. + +## \[2.0.0-beta.10] + +- [`37cb9a66`](https://github.com/tauri-apps/plugins-workspace/commit/37cb9a6681b948908cd9443340f6b23401607df7) ([#1575](https://github.com/tauri-apps/plugins-workspace/pull/1575) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Update sqlx to 0.8 - Check out their changelog for behavior changes: https://github.com/launchbadge/sqlx/blob/main/CHANGELOG.md#080---2024-07-22 + +## \[2.0.0-beta.7] + +- [`22a17980`](https://github.com/tauri-apps/plugins-workspace/commit/22a17980ff4f6f8c40adb1b8f4ffc6dae2fe7e30) ([#1537](https://github.com/tauri-apps/plugins-workspace/pull/1537) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri beta.24. + +## \[2.0.0-beta.6] + +- [`76daee7a`](https://github.com/tauri-apps/plugins-workspace/commit/76daee7aafece34de3092c86e531cf9eb1138989) ([#1512](https://github.com/tauri-apps/plugins-workspace/pull/1512) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Update to tauri beta.23. + +## \[2.0.0-beta.7] + +- [`4216c051`](https://github.com/tauri-apps/plugins-workspace/commit/4216c0517fd1dcb29d0162dc2fc15291472a2b00) ([#1381](https://github.com/tauri-apps/plugins-workspace/pull/1381) by [@thewh1teagle](https://github.com/tauri-apps/plugins-workspace/../../thewh1teagle)) Made `DbInstances` public for managing database instances directly from `Rust`. + +## \[2.0.0-beta.5] + +- [`9013854f`](https://github.com/tauri-apps/plugins-workspace/commit/9013854f42a49a230b9dbb9d02774765528a923f)([#1382](https://github.com/tauri-apps/plugins-workspace/pull/1382)) Update to tauri beta.22. + +## \[2.0.0-beta.4] + +- [`430bd6f4`](https://github.com/tauri-apps/plugins-workspace/commit/430bd6f4f379bee5d232ae6b098ae131db7f178a)([#1363](https://github.com/tauri-apps/plugins-workspace/pull/1363)) Update to tauri beta.20. + +## \[2.0.0-beta.3] + +- [`bd1ed590`](https://github.com/tauri-apps/plugins-workspace/commit/bd1ed5903ffcce5500310dac1e59e8c67674ef1e)([#1237](https://github.com/tauri-apps/plugins-workspace/pull/1237)) Update to tauri beta.17. + +## \[2.0.0-beta.3] + +- [`a04ea2f`](https://github.com/tauri-apps/plugins-workspace/commit/a04ea2f38294d5a3987578283badc8eec87a7752)([#1071](https://github.com/tauri-apps/plugins-workspace/pull/1071)) The global API script is now only added to the binary when the `withGlobalTauri` config is true. + +## \[2.0.0-beta.2] + +- [`99bea25`](https://github.com/tauri-apps/plugins-workspace/commit/99bea2559c2c0648c2519c50a18cd124dacef57b)([#1005](https://github.com/tauri-apps/plugins-workspace/pull/1005)) Update to tauri beta.8. + ## \[2.0.0-beta.1] - [`569defb`](https://github.com/tauri-apps/plugins-workspace/commit/569defbe9492e38938554bb7bdc1be9151456d21) Update to tauri beta.4. @@ -35,20 +116,3 @@ ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - te to alpha.11. - -## \[2.0.0-alpha.0] - -- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - to alpha.11. - -## \[2.0.0-alpha.0] - -- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - te to alpha.11. - -## \[2.0.0-alpha.0] - -- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - ae67\`]\(https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! -717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/sql/Cargo.toml b/plugins/sql/Cargo.toml index d74c3f86..0449a4be 100644 --- a/plugins/sql/Cargo.toml +++ b/plugins/sql/Cargo.toml @@ -1,20 +1,28 @@ [package] name = "tauri-plugin-sql" -version = "2.0.0-beta.1" +version = "2.2.0" description = "Interface with SQL databases." authors = { workspace = true } license = { workspace = true } edition = { workspace = true } rust-version = { workspace = true } +repository = { workspace = true } links = "tauri-plugin-sql" [package.metadata.docs.rs] -features = [ "sqlite" ] -rustc-args = [ "--cfg", "docsrs" ] -rustdoc-args = [ "--cfg", "docsrs" ] +features = ["sqlite"] +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs"] + +[package.metadata.platforms.support] +windows = { level = "full", notes = "" } +linux = { level = "full", notes = "" } +macos = { level = "full", notes = "" } +android = { level = "full", notes = "" } +ios = { level = "full", notes = "" } [build-dependencies] -tauri-plugin = { workspace = true, features = [ "build" ] } +tauri-plugin = { workspace = true, features = ["build"] } [dependencies] serde = { workspace = true } @@ -23,11 +31,13 @@ tauri = { workspace = true } log = { workspace = true } thiserror = { workspace = true } futures-core = "0.3" -sqlx = { version = "0.7", features = [ "json", "time" ] } +sqlx = { version = "0.8", features = ["json", "time"] } time = "0.3" -tokio = { version = "1", features = [ "sync" ] } +tokio = { version = "1", features = ["sync"] } +indexmap = { version = "2", features = ["serde"] } [features] -sqlite = [ "sqlx/sqlite", "sqlx/runtime-tokio" ] -mysql = [ "sqlx/mysql", "sqlx/runtime-tokio-rustls" ] -postgres = [ "sqlx/postgres", "sqlx/runtime-tokio-rustls" ] +sqlite = ["sqlx/sqlite", "sqlx/runtime-tokio"] +mysql = ["sqlx/mysql", "sqlx/runtime-tokio-rustls"] +postgres = ["sqlx/postgres", "sqlx/runtime-tokio-rustls"] +# TODO: bundled-cipher etc diff --git a/plugins/sql/README.md b/plugins/sql/README.md index 770db6b1..1df02e21 100644 --- a/plugins/sql/README.md +++ b/plugins/sql/README.md @@ -2,9 +2,17 @@ Interface with SQL databases through [sqlx](https://github.com/launchbadge/sqlx). It supports the `sqlite`, `mysql` and `postgres` drivers, enabled by a Cargo feature. +| Platform | Supported | +| -------- | --------- | +| Linux | ✓ | +| Windows | ✓ | +| macOS | ✓ | +| Android | ✓ | +| iOS | x | + ## Install -_This plugin requires a Rust version of at least **1.75**_ +_This plugin requires a Rust version of at least **1.77.2**_ There are three general methods of installation that we can recommend. @@ -19,7 +27,7 @@ Install the Core plugin by adding the following to your `Cargo.toml` file: ```toml [dependencies.tauri-plugin-sql] features = ["sqlite"] # or "postgres", or "mysql" -version = "2.0.0-beta" +version = "2.0.0" # alternatively with Git git = "https://github.com/tauri-apps/plugins-workspace" branch = "v2" @@ -48,7 +56,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-sql#v2 First you need to register the core plugin with Tauri: -`src-tauri/src/main.rs` +`src-tauri/src/lib.rs` ```rust fn main() { @@ -62,16 +70,16 @@ fn main() { Afterwards all the plugin's APIs are available through the JavaScript guest bindings: ```javascript -import Database from "@tauri-apps/plugin-sql"; +import Database from '@tauri-apps/plugin-sql' -// sqlite. The path is relative to `tauri::api::path::BaseDirectory::App`. -const db = await Database.load("sqlite:test.db"); +// sqlite. The path is relative to `tauri::api::path::BaseDirectory::AppConfig`. +const db = await Database.load('sqlite:test.db') // mysql -const db = await Database.load("mysql://user:pass@host/database"); +const db = await Database.load('mysql://user:pass@host/database') // postgres -const db = await Database.load("postgres://postgres:password@localhost/test"); +const db = await Database.load('postgres://postgres:password@localhost/test') -await db.execute("INSERT INTO ..."); +await db.execute('INSERT INTO ...') ``` ## Syntax @@ -84,25 +92,25 @@ We use sqlx as our underlying library, adopting their query syntax: ```javascript // INSERT and UPDATE examples for sqlite and postgres const result = await db.execute( - "INSERT into todos (id, title, status) VALUES ($1, $2, $3)", - [todos.id, todos.title, todos.status], -); + 'INSERT into todos (id, title, status) VALUES ($1, $2, $3)', + [todos.id, todos.title, todos.status] +) const result = await db.execute( - "UPDATE todos SET title = $1, completed = $2 WHERE id = $3", - [todos.title, todos.status, todos.id], -); + 'UPDATE todos SET title = $1, status = $2 WHERE id = $3', + [todos.title, todos.status, todos.id] +) // INSERT and UPDATE examples for mysql const result = await db.execute( - "INSERT into todos (id, title, status) VALUES (?, ?, ?)", - [todos.id, todos.title, todos.status], -); + 'INSERT into todos (id, title, status) VALUES (?, ?, ?)', + [todos.id, todos.title, todos.status] +) const result = await db.execute( - "UPDATE todos SET title = ?, completed = ? WHERE id = ?", - [todos.title, todos.status, todos.id], -); + 'UPDATE todos SET title = ?, status = ? WHERE id = ?', + [todos.title, todos.status, todos.id] +) ``` ## Migrations @@ -158,7 +166,26 @@ fn main() { ### Applying Migrations -Migrations are applied automatically when the plugin is initialized. The plugin runs these migrations against the database specified by the connection string. Ensure that the migrations are defined in the correct order and are idempotent (safe to run multiple times). +To apply the migrations when the plugin is initialized, add the connection string to the `tauri.conf.json` file: + +```json +{ + "plugins": { + "sql": { + "preload": ["sqlite:mydatabase.db"] + } + } +} +``` + +Alternatively, the client side `load()` also runs the migrations for a given connection string: + +```ts +import Database from '@tauri-apps/plugin-sql' +const db = await Database.load('sqlite:mydatabase.db') +``` + +Ensure that the migrations are defined in the correct order and are safe to run multiple times. ### Migration Management diff --git a/plugins/sql/SECURITY.md b/plugins/sql/SECURITY.md new file mode 100644 index 00000000..4f09bbac --- /dev/null +++ b/plugins/sql/SECURITY.md @@ -0,0 +1,23 @@ +# Security Policy + +**Do not report security vulnerabilities through public GitHub issues.** + +**Please use the [Private Vulnerability Disclosure](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability) feature of GitHub.** + +Include as much of the following information: + +- Type of issue (e.g. improper input parsing, privilege escalation, etc.) +- The location of the affected source code (tag/branch/commit or direct URL) +- Any special configuration required to reproduce the issue +- The distribution affected or used to help us with reproduction of the issue +- Step-by-step instructions to reproduce the issue +- Ideally a reproduction repository +- Impact of the issue, including how an attacker might exploit the issue + +We prefer to receive reports in English. + +## Contact + +Please disclose a vulnerability or security relevant issue here: [https://github.com/tauri-apps/plugins-workspace/security/advisories/new](https://github.com/tauri-apps/plugins-workspace/security/advisories/new). + +Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app). diff --git a/plugins/sql/src/api-iife.js b/plugins/sql/api-iife.js similarity index 100% rename from plugins/sql/src/api-iife.js rename to plugins/sql/api-iife.js diff --git a/plugins/sql/build.rs b/plugins/sql/build.rs index e74fdb42..fbbca422 100644 --- a/plugins/sql/build.rs +++ b/plugins/sql/build.rs @@ -5,5 +5,7 @@ const COMMANDS: &[&str] = &["load", "execute", "select", "close"]; fn main() { - tauri_plugin::Builder::new(COMMANDS).build(); + tauri_plugin::Builder::new(COMMANDS) + .global_api_script_path("./api-iife.js") + .build(); } diff --git a/plugins/sql/guest-js/index.ts b/plugins/sql/guest-js/index.ts index 9e96f3db..11d39e70 100644 --- a/plugins/sql/guest-js/index.ts +++ b/plugins/sql/guest-js/index.ts @@ -2,20 +2,20 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { invoke } from "@tauri-apps/api/core"; +import { invoke } from '@tauri-apps/api/core' export interface QueryResult { /** The number of rows affected by the query. */ - rowsAffected: number; + rowsAffected: number /** * The last inserted `id`. * - * This value is always `0` when using the Postgres driver. If the + * This value is not set for Postgres databases. If the * last inserted id is required on Postgres, the `select` function * must be used, with a `RETURNING` clause * (`INSERT INTO todos (title) VALUES ($1) RETURNING id`). */ - lastInsertId: number; + lastInsertId?: number } /** @@ -25,9 +25,9 @@ export interface QueryResult { * communicating with the rust side of the sql plugin. */ export default class Database { - path: string; + path: string constructor(path: string) { - this.path = path; + this.path = path } /** @@ -46,11 +46,11 @@ export default class Database { * ``` */ static async load(path: string): Promise { - const _path = await invoke("plugin:sql|load", { - db: path, - }); + const _path = await invoke('plugin:sql|load', { + db: path + }) - return new Database(_path); + return new Database(_path) } /** @@ -70,7 +70,7 @@ export default class Database { * ``` */ static get(path: string): Database { - return new Database(path); + return new Database(path) } /** @@ -107,18 +107,19 @@ export default class Database { */ async execute(query: string, bindValues?: unknown[]): Promise { const [rowsAffected, lastInsertId] = await invoke<[number, number]>( - "plugin:sql|execute", + 'plugin:sql|execute', { db: this.path, query, - values: bindValues ?? [], - }, - ); + values: bindValues ?? [] + } + ) return { lastInsertId, - rowsAffected, - }; + rowsAffected + } } + /** * **select** * @@ -128,23 +129,23 @@ export default class Database { * ```ts * // for sqlite & postgres * const result = await db.select( - * "SELECT * from todos WHERE id = $1", id + * "SELECT * from todos WHERE id = $1", [ id ] * ); * * // for mysql * const result = await db.select( - * "SELECT * from todos WHERE id = ?", id + * "SELECT * from todos WHERE id = ?", [ id ] * ); * ``` */ async select(query: string, bindValues?: unknown[]): Promise { - const result = await invoke("plugin:sql|select", { + const result = await invoke('plugin:sql|select', { db: this.path, query, - values: bindValues ?? [], - }); + values: bindValues ?? [] + }) - return result; + return result } /** @@ -159,9 +160,9 @@ export default class Database { * @param db - Optionally state the name of a database if you are managing more than one. Otherwise, all database pools will be in scope. */ async close(db?: string): Promise { - const success = await invoke("plugin:sql|close", { - db, - }); - return success; + const success = await invoke('plugin:sql|close', { + db + }) + return success } } diff --git a/plugins/sql/package.json b/plugins/sql/package.json index 211988bc..162df528 100644 --- a/plugins/sql/package.json +++ b/plugins/sql/package.json @@ -1,11 +1,12 @@ { "name": "@tauri-apps/plugin-sql", - "version": "2.0.0-beta.1", + "version": "2.2.0", "description": "Interface with SQL databases", - "license": "MIT or APACHE-2.0", + "license": "MIT OR Apache-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" ], + "repository": "https://github.com/tauri-apps/plugins-workspace", "type": "module", "types": "./dist-js/index.d.ts", "main": "./dist-js/index.cjs", @@ -24,6 +25,6 @@ "LICENSE" ], "dependencies": { - "@tauri-apps/api": "2.0.0-beta.2" + "@tauri-apps/api": "^2.0.0" } } diff --git a/plugins/sql/permissions/autogenerated/reference.md b/plugins/sql/permissions/autogenerated/reference.md index a9734e01..e09044c4 100644 --- a/plugins/sql/permissions/autogenerated/reference.md +++ b/plugins/sql/permissions/autogenerated/reference.md @@ -1,34 +1,133 @@ -# Permissions +## Default Permission -## allow-close +### Default Permissions + +This permission set configures what kind of +database operations are available from the sql plugin. + +### Granted Permissions + +All reading related operations are enabled. +Also allows to load or close a connection. + + + +#### This default permission set includes the following: + +- `allow-close` +- `allow-load` +- `allow-select` + +## Permission Table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IdentifierDescription
+ +`sql:allow-close` + + Enables the close command without any pre-configured scope. -## deny-close +
+ +`sql:deny-close` + + Denies the close command without any pre-configured scope. -## allow-execute +
+ +`sql:allow-execute` + + Enables the execute command without any pre-configured scope. -## deny-execute +
+ +`sql:deny-execute` + + Denies the execute command without any pre-configured scope. -## allow-load +
+ +`sql:allow-load` + + Enables the load command without any pre-configured scope. -## deny-load +
+ +`sql:deny-load` + + Denies the load command without any pre-configured scope. -## allow-select +
+ +`sql:allow-select` + + Enables the select command without any pre-configured scope. -## deny-select +
+ +`sql:deny-select` + + Denies the select command without any pre-configured scope. +
diff --git a/plugins/sql/permissions/default.toml b/plugins/sql/permissions/default.toml new file mode 100644 index 00000000..eb5fa555 --- /dev/null +++ b/plugins/sql/permissions/default.toml @@ -0,0 +1,16 @@ +"$schema" = "schemas/schema.json" + +[default] +description = """ +### Default Permissions + +This permission set configures what kind of +database operations are available from the sql plugin. + +### Granted Permissions + +All reading related operations are enabled. +Also allows to load or close a connection. + +""" +permissions = ["allow-close", "allow-load", "allow-select"] diff --git a/plugins/sql/permissions/schemas/schema.json b/plugins/sql/permissions/schemas/schema.json index 72346618..488a953c 100644 --- a/plugins/sql/permissions/schemas/schema.json +++ b/plugins/sql/permissions/schemas/schema.json @@ -17,7 +17,6 @@ }, "set": { "description": "A list of permissions sets defined", - "default": [], "type": "array", "items": { "$ref": "#/definitions/PermissionSet" @@ -50,7 +49,7 @@ "minimum": 1.0 }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -112,7 +111,7 @@ "type": "string" }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri internal convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -132,12 +131,21 @@ }, "scope": { "description": "Allowed or denied scoped when using this permission.", - "default": {}, "allOf": [ { "$ref": "#/definitions/Scopes" } ] + }, + "platforms": { + "description": "Target platforms this permission applies. By default all platforms are affected by this permission.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Target" + } } } }, @@ -164,7 +172,7 @@ } }, "Scopes": { - "description": "A restriction of the command/endpoint functionality.\n\nIt can be of any serde serializable type and is used for allowing or preventing certain actions inside a Tauri command.\n\nThe scope is passed to the command and handled/enforced by the command itself.", + "description": "An argument for fine grained behavior control of Tauri commands.\n\nIt can be of any serde serializable type and is used to allow or prevent certain actions inside a Tauri command. The configured scope is passed to the command and will be enforced by the command implementation.\n\n## Example\n\n```json { \"allow\": [{ \"path\": \"$HOME/**\" }], \"deny\": [{ \"path\": \"$HOME/secret.txt\" }] } ```", "type": "object", "properties": { "allow": { @@ -178,7 +186,7 @@ } }, "deny": { - "description": "Data that defines what is denied by the scope.", + "description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.", "type": [ "array", "null" @@ -243,64 +251,102 @@ } ] }, - "PermissionKind": { - "type": "string", + "Target": { + "description": "Platform target.", "oneOf": [ { - "description": "allow-close -> Enables the close command without any pre-configured scope.", + "description": "MacOS.", "type": "string", "enum": [ - "allow-close" + "macOS" ] }, { - "description": "deny-close -> Denies the close command without any pre-configured scope.", + "description": "Windows.", "type": "string", "enum": [ - "deny-close" + "windows" ] }, { - "description": "allow-execute -> Enables the execute command without any pre-configured scope.", + "description": "Linux.", "type": "string", "enum": [ - "allow-execute" + "linux" ] }, { - "description": "deny-execute -> Denies the execute command without any pre-configured scope.", + "description": "Android.", "type": "string", "enum": [ - "deny-execute" + "android" ] }, { - "description": "allow-load -> Enables the load command without any pre-configured scope.", + "description": "iOS.", "type": "string", "enum": [ - "allow-load" + "iOS" ] + } + ] + }, + "PermissionKind": { + "type": "string", + "oneOf": [ + { + "description": "Enables the close command without any pre-configured scope.", + "type": "string", + "const": "allow-close", + "markdownDescription": "Enables the close command without any pre-configured scope." }, { - "description": "deny-load -> Denies the load command without any pre-configured scope.", + "description": "Denies the close command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-load" - ] + "const": "deny-close", + "markdownDescription": "Denies the close command without any pre-configured scope." }, { - "description": "allow-select -> Enables the select command without any pre-configured scope.", + "description": "Enables the execute command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-select" - ] + "const": "allow-execute", + "markdownDescription": "Enables the execute command without any pre-configured scope." }, { - "description": "deny-select -> Denies the select command without any pre-configured scope.", + "description": "Denies the execute command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-select" - ] + "const": "deny-execute", + "markdownDescription": "Denies the execute command without any pre-configured scope." + }, + { + "description": "Enables the load command without any pre-configured scope.", + "type": "string", + "const": "allow-load", + "markdownDescription": "Enables the load command without any pre-configured scope." + }, + { + "description": "Denies the load command without any pre-configured scope.", + "type": "string", + "const": "deny-load", + "markdownDescription": "Denies the load command without any pre-configured scope." + }, + { + "description": "Enables the select command without any pre-configured scope.", + "type": "string", + "const": "allow-select", + "markdownDescription": "Enables the select command without any pre-configured scope." + }, + { + "description": "Denies the select command without any pre-configured scope.", + "type": "string", + "const": "deny-select", + "markdownDescription": "Denies the select command without any pre-configured scope." + }, + { + "description": "### Default Permissions\n\nThis permission set configures what kind of\ndatabase operations are available from the sql plugin.\n\n### Granted Permissions\n\nAll reading related operations are enabled.\nAlso allows to load or close a connection.\n\n\n#### This default permission set includes:\n\n- `allow-close`\n- `allow-load`\n- `allow-select`", + "type": "string", + "const": "default", + "markdownDescription": "### Default Permissions\n\nThis permission set configures what kind of\ndatabase operations are available from the sql plugin.\n\n### Granted Permissions\n\nAll reading related operations are enabled.\nAlso allows to load or close a connection.\n\n\n#### This default permission set includes:\n\n- `allow-close`\n- `allow-load`\n- `allow-select`" } ] } diff --git a/plugins/sql/rollup.config.js b/plugins/sql/rollup.config.js index 977dfac8..1f349ec8 100644 --- a/plugins/sql/rollup.config.js +++ b/plugins/sql/rollup.config.js @@ -2,6 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { createConfig } from "../../shared/rollup.config.js"; +import { createConfig } from '../../shared/rollup.config.js' -export default createConfig(); +export default createConfig() diff --git a/plugins/sql/src/commands.rs b/plugins/sql/src/commands.rs new file mode 100644 index 00000000..760d00b2 --- /dev/null +++ b/plugins/sql/src/commands.rs @@ -0,0 +1,80 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use indexmap::IndexMap; +use serde_json::Value as JsonValue; +use sqlx::migrate::Migrator; +use tauri::{command, AppHandle, Runtime, State}; + +use crate::{DbInstances, DbPool, Error, LastInsertId, Migrations}; + +#[command] +pub(crate) async fn load( + app: AppHandle, + db_instances: State<'_, DbInstances>, + migrations: State<'_, Migrations>, + db: String, +) -> Result { + let pool = DbPool::connect(&db, &app).await?; + + if let Some(migrations) = migrations.0.lock().await.remove(&db) { + let migrator = Migrator::new(migrations).await?; + pool.migrate(&migrator).await?; + } + + db_instances.0.write().await.insert(db.clone(), pool); + + Ok(db) +} + +/// Allows the database connection(s) to be closed; if no database +/// name is passed in then _all_ database connection pools will be +/// shut down. +#[command] +pub(crate) async fn close( + db_instances: State<'_, DbInstances>, + db: Option, +) -> Result { + let instances = db_instances.0.read().await; + + let pools = if let Some(db) = db { + vec![db] + } else { + instances.keys().cloned().collect() + }; + + for pool in pools { + let db = instances.get(&pool).ok_or(Error::DatabaseNotLoaded(pool))?; + db.close().await; + } + + Ok(true) +} + +/// Execute a command against the database +#[command] +pub(crate) async fn execute( + db_instances: State<'_, DbInstances>, + db: String, + query: String, + values: Vec, +) -> Result<(u64, LastInsertId), crate::Error> { + let instances = db_instances.0.read().await; + + let db = instances.get(&db).ok_or(Error::DatabaseNotLoaded(db))?; + db.execute(query, values).await +} + +#[command] +pub(crate) async fn select( + db_instances: State<'_, DbInstances>, + db: String, + query: String, + values: Vec, +) -> Result>, crate::Error> { + let instances = db_instances.0.read().await; + + let db = instances.get(&db).ok_or(Error::DatabaseNotLoaded(db))?; + db.select(query, values).await +} diff --git a/plugins/sql/src/decode/mod.rs b/plugins/sql/src/decode/mod.rs index 50fb3c78..0a2d2cdd 100644 --- a/plugins/sql/src/decode/mod.rs +++ b/plugins/sql/src/decode/mod.rs @@ -3,17 +3,8 @@ // SPDX-License-Identifier: MIT #[cfg(feature = "mysql")] -mod mysql; +pub(crate) mod mysql; #[cfg(feature = "postgres")] -mod postgres; +pub(crate) mod postgres; #[cfg(feature = "sqlite")] -mod sqlite; - -#[cfg(feature = "mysql")] -pub(crate) use mysql::to_json; - -#[cfg(feature = "postgres")] -pub(crate) use postgres::to_json; - -#[cfg(feature = "sqlite")] -pub(crate) use sqlite::to_json; +pub(crate) mod sqlite; diff --git a/plugins/sql/src/decode/postgres.rs b/plugins/sql/src/decode/postgres.rs index e38ad025..6f689dce 100644 --- a/plugins/sql/src/decode/postgres.rs +++ b/plugins/sql/src/decode/postgres.rs @@ -14,7 +14,7 @@ pub(crate) fn to_json(v: PgValueRef) -> Result { } let res = match v.type_info().name() { - "CHAR" | "VARCHAR" | "TEXT" | "NAME" => { + "CHAR" | "VARCHAR" | "TEXT" | "NAME" | "UUID" => { if let Ok(v) = ValueRef::to_owned(&v).try_decode() { JsonValue::String(v) } else { diff --git a/plugins/authenticator/src/error.rs b/plugins/sql/src/error.rs similarity index 62% rename from plugins/authenticator/src/error.rs rename to plugins/sql/src/error.rs index 214706e6..5ac845b8 100644 --- a/plugins/authenticator/src/error.rs +++ b/plugins/sql/src/error.rs @@ -7,13 +7,15 @@ use serde::{Serialize, Serializer}; #[derive(Debug, thiserror::Error)] pub enum Error { #[error(transparent)] - Base64Decode(#[from] base64::DecodeError), + Sql(#[from] sqlx::Error), #[error(transparent)] - JSON(#[from] serde_json::Error), - #[error(transparent)] - U2F(#[from] crate::u2f_crate::u2ferror::U2fError), - #[error(transparent)] - Auth(#[from] authenticator::errors::AuthenticatorError), + Migration(#[from] sqlx::migrate::MigrateError), + #[error("invalid connection url: {0}")] + InvalidDbUrl(String), + #[error("database {0} not loaded")] + DatabaseNotLoaded(String), + #[error("unsupported datatype: {0}")] + UnsupportedDatatype(String), } impl Serialize for Error { diff --git a/plugins/sql/src/lib.rs b/plugins/sql/src/lib.rs index f25ede21..56b2a3a6 100644 --- a/plugins/sql/src/lib.rs +++ b/plugins/sql/src/lib.rs @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -//! [![](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/sql/banner.png)](https://github.com/tauri-apps/plugins-workspace/tree/v2/plugins/sql) -//! //! Interface with SQL databases through [sqlx](https://github.com/launchbadge/sqlx). It supports the `sqlite`, `mysql` and `postgres` drivers, enabled by a Cargo feature. #![doc( @@ -11,20 +9,179 @@ html_favicon_url = "https://github.com/tauri-apps/tauri/raw/dev/app-icon.png" )] -#[cfg(any( - all(feature = "sqlite", feature = "mysql"), - all(feature = "sqlite", feature = "postgres"), - all(feature = "mysql", feature = "postgres") -))] -compile_error!( - "Only one database driver can be enabled. Set the feature flag for the driver of your choice." -); +mod commands; +mod decode; +mod error; +mod wrapper; -#[cfg(not(any(feature = "sqlite", feature = "mysql", feature = "postgres")))] -compile_error!( - "Database driver not defined. Please set the feature flag for the driver of your choice." -); +pub use error::Error; +pub use wrapper::DbPool; -mod decode; -mod plugin; -pub use plugin::*; +use futures_core::future::BoxFuture; +use serde::{Deserialize, Serialize}; +use sqlx::{ + error::BoxDynError, + migrate::{Migration as SqlxMigration, MigrationSource, MigrationType, Migrator}, +}; +use tauri::{ + plugin::{Builder as PluginBuilder, TauriPlugin}, + Manager, RunEvent, Runtime, +}; +use tokio::sync::{Mutex, RwLock}; + +use std::collections::HashMap; + +#[derive(Default)] +pub struct DbInstances(pub RwLock>); + +#[derive(Serialize)] +#[serde(untagged)] +pub(crate) enum LastInsertId { + #[cfg(feature = "sqlite")] + Sqlite(i64), + #[cfg(feature = "mysql")] + MySql(u64), + #[cfg(feature = "postgres")] + Postgres(()), + #[cfg(not(any(feature = "sqlite", feature = "mysql", feature = "postgres")))] + None, +} + +struct Migrations(Mutex>); + +#[derive(Default, Clone, Deserialize)] +pub struct PluginConfig { + #[serde(default)] + preload: Vec, +} + +#[derive(Debug)] +pub enum MigrationKind { + Up, + Down, +} + +impl From for MigrationType { + fn from(kind: MigrationKind) -> Self { + match kind { + MigrationKind::Up => Self::ReversibleUp, + MigrationKind::Down => Self::ReversibleDown, + } + } +} + +/// A migration definition. +#[derive(Debug)] +pub struct Migration { + pub version: i64, + pub description: &'static str, + pub sql: &'static str, + pub kind: MigrationKind, +} + +#[derive(Debug)] +struct MigrationList(Vec); + +impl MigrationSource<'static> for MigrationList { + fn resolve(self) -> BoxFuture<'static, std::result::Result, BoxDynError>> { + Box::pin(async move { + let mut migrations = Vec::new(); + for migration in self.0 { + if matches!(migration.kind, MigrationKind::Up) { + migrations.push(SqlxMigration::new( + migration.version, + migration.description.into(), + migration.kind.into(), + migration.sql.into(), + false, + )); + } + } + Ok(migrations) + }) + } +} + +/// Allows blocking on async code without creating a nested runtime. +fn run_async_command(cmd: F) -> F::Output { + if tokio::runtime::Handle::try_current().is_ok() { + tokio::task::block_in_place(|| tokio::runtime::Handle::current().block_on(cmd)) + } else { + tauri::async_runtime::block_on(cmd) + } +} + +/// Tauri SQL plugin builder. +#[derive(Default)] +pub struct Builder { + migrations: Option>, +} + +impl Builder { + pub fn new() -> Self { + #[cfg(not(any(feature = "sqlite", feature = "mysql", feature = "postgres")))] + eprintln!("No sql driver enabled. Please set at least one of the \"sqlite\", \"mysql\", \"postgres\" feature flags."); + + Self::default() + } + + /// Add migrations to a database. + #[must_use] + pub fn add_migrations(mut self, db_url: &str, migrations: Vec) -> Self { + self.migrations + .get_or_insert(Default::default()) + .insert(db_url.to_string(), MigrationList(migrations)); + self + } + + pub fn build(mut self) -> TauriPlugin> { + PluginBuilder::>::new("sql") + .invoke_handler(tauri::generate_handler![ + commands::load, + commands::execute, + commands::select, + commands::close + ]) + .setup(|app, api| { + let config = api.config().clone().unwrap_or_default(); + + run_async_command(async move { + let instances = DbInstances::default(); + let mut lock = instances.0.write().await; + + for db in config.preload { + let pool = DbPool::connect(&db, app).await?; + + if let Some(migrations) = + self.migrations.as_mut().and_then(|mm| mm.remove(&db)) + { + let migrator = Migrator::new(migrations).await?; + pool.migrate(&migrator).await?; + } + + lock.insert(db, pool); + } + drop(lock); + + app.manage(instances); + app.manage(Migrations(Mutex::new( + self.migrations.take().unwrap_or_default(), + ))); + + Ok(()) + }) + }) + .on_event(|app, event| { + if let RunEvent::Exit = event { + run_async_command(async move { + let instances = &*app.state::(); + let instances = instances.0.read().await; + for value in instances.values() { + value.close().await; + } + }); + } + }) + .build() + } +} diff --git a/plugins/sql/src/plugin.rs b/plugins/sql/src/plugin.rs deleted file mode 100644 index f2a95279..00000000 --- a/plugins/sql/src/plugin.rs +++ /dev/null @@ -1,342 +0,0 @@ -// Copyright 2019-2023 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT - -use futures_core::future::BoxFuture; -use serde::{ser::Serializer, Deserialize, Serialize}; -use serde_json::Value as JsonValue; -use sqlx::{ - error::BoxDynError, - migrate::{ - MigrateDatabase, Migration as SqlxMigration, MigrationSource, MigrationType, Migrator, - }, - Column, Pool, Row, -}; -use tauri::{ - command, - plugin::{Builder as PluginBuilder, TauriPlugin}, - AppHandle, Manager, RunEvent, Runtime, State, -}; -use tokio::sync::Mutex; - -use std::collections::HashMap; - -#[cfg(feature = "sqlite")] -use std::{fs::create_dir_all, path::PathBuf}; - -#[cfg(feature = "sqlite")] -type Db = sqlx::sqlite::Sqlite; -#[cfg(feature = "mysql")] -type Db = sqlx::mysql::MySql; -#[cfg(feature = "postgres")] -type Db = sqlx::postgres::Postgres; - -#[cfg(feature = "sqlite")] -type LastInsertId = i64; -#[cfg(not(feature = "sqlite"))] -type LastInsertId = u64; - -#[derive(Debug, thiserror::Error)] -pub enum Error { - #[error(transparent)] - Sql(#[from] sqlx::Error), - #[error(transparent)] - Migration(#[from] sqlx::migrate::MigrateError), - #[error("database {0} not loaded")] - DatabaseNotLoaded(String), - #[error("unsupported datatype: {0}")] - UnsupportedDatatype(String), -} - -impl Serialize for Error { - fn serialize(&self, serializer: S) -> std::result::Result - where - S: Serializer, - { - serializer.serialize_str(self.to_string().as_ref()) - } -} - -type Result = std::result::Result; - -#[cfg(feature = "sqlite")] -/// Resolves the App's **file path** from the `AppHandle` context -/// object -fn app_path(app: &AppHandle) -> PathBuf { - app.path().app_config_dir().expect("No App path was found!") -} - -#[cfg(feature = "sqlite")] -/// Maps the user supplied DB connection string to a connection string -/// with a fully qualified file path to the App's designed "app_path" -fn path_mapper(mut app_path: PathBuf, connection_string: &str) -> String { - app_path.push( - connection_string - .split_once(':') - .expect("Couldn't parse the connection string for DB!") - .1, - ); - - format!( - "sqlite:{}", - app_path - .to_str() - .expect("Problem creating fully qualified path to Database file!") - ) -} - -#[derive(Default)] -struct DbInstances(Mutex>>); - -struct Migrations(Mutex>); - -#[derive(Default, Clone, Deserialize)] -pub struct PluginConfig { - #[serde(default)] - preload: Vec, -} - -#[derive(Debug)] -pub enum MigrationKind { - Up, - Down, -} - -impl From for MigrationType { - fn from(kind: MigrationKind) -> Self { - match kind { - MigrationKind::Up => Self::ReversibleUp, - MigrationKind::Down => Self::ReversibleDown, - } - } -} - -/// A migration definition. -#[derive(Debug)] -pub struct Migration { - pub version: i64, - pub description: &'static str, - pub sql: &'static str, - pub kind: MigrationKind, -} - -#[derive(Debug)] -struct MigrationList(Vec); - -impl MigrationSource<'static> for MigrationList { - fn resolve(self) -> BoxFuture<'static, std::result::Result, BoxDynError>> { - Box::pin(async move { - let mut migrations = Vec::new(); - for migration in self.0 { - if matches!(migration.kind, MigrationKind::Up) { - migrations.push(SqlxMigration::new( - migration.version, - migration.description.into(), - migration.kind.into(), - migration.sql.into(), - )); - } - } - Ok(migrations) - }) - } -} - -#[command] -async fn load( - #[allow(unused_variables)] app: AppHandle, - db_instances: State<'_, DbInstances>, - migrations: State<'_, Migrations>, - db: String, -) -> Result { - #[cfg(feature = "sqlite")] - let fqdb = path_mapper(app_path(&app), &db); - #[cfg(not(feature = "sqlite"))] - let fqdb = db.clone(); - - #[cfg(feature = "sqlite")] - create_dir_all(app_path(&app)).expect("Problem creating App directory!"); - - if !Db::database_exists(&fqdb).await.unwrap_or(false) { - Db::create_database(&fqdb).await?; - } - let pool = Pool::connect(&fqdb).await?; - - if let Some(migrations) = migrations.0.lock().await.remove(&db) { - let migrator = Migrator::new(migrations).await?; - migrator.run(&pool).await?; - } - - db_instances.0.lock().await.insert(db.clone(), pool); - Ok(db) -} - -/// Allows the database connection(s) to be closed; if no database -/// name is passed in then _all_ database connection pools will be -/// shut down. -#[command] -async fn close(db_instances: State<'_, DbInstances>, db: Option) -> Result { - let mut instances = db_instances.0.lock().await; - - let pools = if let Some(db) = db { - vec![db] - } else { - instances.keys().cloned().collect() - }; - - for pool in pools { - let db = instances - .get_mut(&pool) // - .ok_or(Error::DatabaseNotLoaded(pool))?; - db.close().await; - } - - Ok(true) -} - -/// Execute a command against the database -#[command] -async fn execute( - db_instances: State<'_, DbInstances>, - db: String, - query: String, - values: Vec, -) -> Result<(u64, LastInsertId)> { - let mut instances = db_instances.0.lock().await; - - let db = instances.get_mut(&db).ok_or(Error::DatabaseNotLoaded(db))?; - let mut query = sqlx::query(&query); - for value in values { - if value.is_null() { - query = query.bind(None::); - } else if value.is_string() { - query = query.bind(value.as_str().unwrap().to_owned()) - } else if let Some(number) = value.as_number() { - query = query.bind(number.as_f64().unwrap_or_default()) - } else { - query = query.bind(value); - } - } - let result = query.execute(&*db).await?; - #[cfg(feature = "sqlite")] - let r = Ok((result.rows_affected(), result.last_insert_rowid())); - #[cfg(feature = "mysql")] - let r = Ok((result.rows_affected(), result.last_insert_id())); - #[cfg(feature = "postgres")] - let r = Ok((result.rows_affected(), 0)); - r -} - -#[command] -async fn select( - db_instances: State<'_, DbInstances>, - db: String, - query: String, - values: Vec, -) -> Result>> { - let mut instances = db_instances.0.lock().await; - let db = instances.get_mut(&db).ok_or(Error::DatabaseNotLoaded(db))?; - let mut query = sqlx::query(&query); - for value in values { - if value.is_null() { - query = query.bind(None::); - } else if value.is_string() { - query = query.bind(value.as_str().unwrap().to_owned()) - } else if let Some(number) = value.as_number() { - query = query.bind(number.as_f64().unwrap_or_default()) - } else { - query = query.bind(value); - } - } - let rows = query.fetch_all(&*db).await?; - let mut values = Vec::new(); - for row in rows { - let mut value = HashMap::default(); - for (i, column) in row.columns().iter().enumerate() { - let v = row.try_get_raw(i)?; - - let v = crate::decode::to_json(v)?; - - value.insert(column.name().to_string(), v); - } - - values.push(value); - } - - Ok(values) -} - -/// Tauri SQL plugin builder. -#[derive(Default)] -pub struct Builder { - migrations: Option>, -} - -impl Builder { - pub fn new() -> Self { - Self::default() - } - - /// Add migrations to a database. - #[must_use] - pub fn add_migrations(mut self, db_url: &str, migrations: Vec) -> Self { - self.migrations - .get_or_insert(Default::default()) - .insert(db_url.to_string(), MigrationList(migrations)); - self - } - - pub fn build(mut self) -> TauriPlugin> { - PluginBuilder::>::new("sql") - .js_init_script(include_str!("api-iife.js").to_string()) - .invoke_handler(tauri::generate_handler![load, execute, select, close]) - .setup(|app, api| { - let config = api.config().clone().unwrap_or_default(); - - #[cfg(feature = "sqlite")] - create_dir_all(app_path(app)).expect("problems creating App directory!"); - - tauri::async_runtime::block_on(async move { - let instances = DbInstances::default(); - let mut lock = instances.0.lock().await; - for db in config.preload { - #[cfg(feature = "sqlite")] - let fqdb = path_mapper(app_path(app), &db); - #[cfg(not(feature = "sqlite"))] - let fqdb = db.clone(); - - if !Db::database_exists(&fqdb).await.unwrap_or(false) { - Db::create_database(&fqdb).await?; - } - let pool = Pool::connect(&fqdb).await?; - - if let Some(migrations) = self.migrations.as_mut().unwrap().remove(&db) { - let migrator = Migrator::new(migrations).await?; - migrator.run(&pool).await?; - } - lock.insert(db, pool); - } - drop(lock); - - app.manage(instances); - app.manage(Migrations(Mutex::new( - self.migrations.take().unwrap_or_default(), - ))); - - Ok(()) - }) - }) - .on_event(|app, event| { - if let RunEvent::Exit = event { - tauri::async_runtime::block_on(async move { - let instances = &*app.state::(); - let instances = instances.0.lock().await; - for value in instances.values() { - value.close().await; - } - }); - } - }) - .build() - } -} diff --git a/plugins/sql/src/wrapper.rs b/plugins/sql/src/wrapper.rs new file mode 100644 index 00000000..d47b2d1c --- /dev/null +++ b/plugins/sql/src/wrapper.rs @@ -0,0 +1,333 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +#[cfg(feature = "sqlite")] +use std::fs::create_dir_all; + +use indexmap::IndexMap; +use serde_json::Value as JsonValue; +#[cfg(any(feature = "sqlite", feature = "mysql", feature = "postgres"))] +use sqlx::{migrate::MigrateDatabase, Column, Executor, Pool, Row}; +#[cfg(any(feature = "sqlite", feature = "mysql", feature = "postgres"))] +use tauri::Manager; +use tauri::{AppHandle, Runtime}; + +#[cfg(feature = "mysql")] +use sqlx::MySql; +#[cfg(feature = "postgres")] +use sqlx::Postgres; +#[cfg(feature = "sqlite")] +use sqlx::Sqlite; + +use crate::LastInsertId; + +pub enum DbPool { + #[cfg(feature = "sqlite")] + Sqlite(Pool), + #[cfg(feature = "mysql")] + MySql(Pool), + #[cfg(feature = "postgres")] + Postgres(Pool), + #[cfg(not(any(feature = "sqlite", feature = "mysql", feature = "postgres")))] + None, +} + +// public methods +/* impl DbPool { + /// Get the inner Sqlite Pool. Returns None for MySql and Postgres pools. + #[cfg(feature = "sqlite")] + pub fn sqlite(&self) -> Option<&Pool> { + match self { + DbPool::Sqlite(pool) => Some(pool), + _ => None, + } + } + + /// Get the inner MySql Pool. Returns None for Sqlite and Postgres pools. + #[cfg(feature = "mysql")] + pub fn mysql(&self) -> Option<&Pool> { + match self { + DbPool::MySql(pool) => Some(pool), + _ => None, + } + } + + /// Get the inner Postgres Pool. Returns None for MySql and Sqlite pools. + #[cfg(feature = "postgres")] + pub fn postgres(&self) -> Option<&Pool> { + match self { + DbPool::Postgres(pool) => Some(pool), + _ => None, + } + } +} */ + +// private methods +impl DbPool { + pub(crate) async fn connect( + conn_url: &str, + _app: &AppHandle, + ) -> Result { + match conn_url + .split_once(':') + .ok_or_else(|| crate::Error::InvalidDbUrl(conn_url.to_string()))? + .0 + { + #[cfg(feature = "sqlite")] + "sqlite" => { + let app_path = _app + .path() + .app_config_dir() + .expect("No App config path was found!"); + + create_dir_all(&app_path).expect("Couldn't create app config dir"); + + let conn_url = &path_mapper(app_path, conn_url); + + if !Sqlite::database_exists(conn_url).await.unwrap_or(false) { + Sqlite::create_database(conn_url).await?; + } + Ok(Self::Sqlite(Pool::connect(conn_url).await?)) + } + #[cfg(feature = "mysql")] + "mysql" => { + if !MySql::database_exists(conn_url).await.unwrap_or(false) { + MySql::create_database(conn_url).await?; + } + Ok(Self::MySql(Pool::connect(conn_url).await?)) + } + #[cfg(feature = "postgres")] + "postgres" => { + if !Postgres::database_exists(conn_url).await.unwrap_or(false) { + Postgres::create_database(conn_url).await?; + } + Ok(Self::Postgres(Pool::connect(conn_url).await?)) + } + #[cfg(not(any(feature = "sqlite", feature = "postgres", feature = "mysql")))] + _ => Err(crate::Error::InvalidDbUrl(format!( + "{conn_url} - No database driver enabled!" + ))), + #[cfg(any(feature = "sqlite", feature = "postgres", feature = "mysql"))] + _ => Err(crate::Error::InvalidDbUrl(conn_url.to_string())), + } + } + + pub(crate) async fn migrate( + &self, + _migrator: &sqlx::migrate::Migrator, + ) -> Result<(), crate::Error> { + match self { + #[cfg(feature = "sqlite")] + DbPool::Sqlite(pool) => _migrator.run(pool).await?, + #[cfg(feature = "mysql")] + DbPool::MySql(pool) => _migrator.run(pool).await?, + #[cfg(feature = "postgres")] + DbPool::Postgres(pool) => _migrator.run(pool).await?, + #[cfg(not(any(feature = "sqlite", feature = "mysql", feature = "postgres")))] + DbPool::None => (), + } + Ok(()) + } + + pub(crate) async fn close(&self) { + match self { + #[cfg(feature = "sqlite")] + DbPool::Sqlite(pool) => pool.close().await, + #[cfg(feature = "mysql")] + DbPool::MySql(pool) => pool.close().await, + #[cfg(feature = "postgres")] + DbPool::Postgres(pool) => pool.close().await, + #[cfg(not(any(feature = "sqlite", feature = "mysql", feature = "postgres")))] + DbPool::None => (), + } + } + + pub(crate) async fn execute( + &self, + _query: String, + _values: Vec, + ) -> Result<(u64, LastInsertId), crate::Error> { + Ok(match self { + #[cfg(feature = "sqlite")] + DbPool::Sqlite(pool) => { + let mut query = sqlx::query(&_query); + for value in _values { + if value.is_null() { + query = query.bind(None::); + } else if value.is_string() { + query = query.bind(value.as_str().unwrap().to_owned()) + } else if let Some(number) = value.as_number() { + query = query.bind(number.as_f64().unwrap_or_default()) + } else { + query = query.bind(value); + } + } + let result = pool.execute(query).await?; + ( + result.rows_affected(), + LastInsertId::Sqlite(result.last_insert_rowid()), + ) + } + #[cfg(feature = "mysql")] + DbPool::MySql(pool) => { + let mut query = sqlx::query(&_query); + for value in _values { + if value.is_null() { + query = query.bind(None::); + } else if value.is_string() { + query = query.bind(value.as_str().unwrap().to_owned()) + } else if let Some(number) = value.as_number() { + query = query.bind(number.as_f64().unwrap_or_default()) + } else { + query = query.bind(value); + } + } + let result = pool.execute(query).await?; + ( + result.rows_affected(), + LastInsertId::MySql(result.last_insert_id()), + ) + } + #[cfg(feature = "postgres")] + DbPool::Postgres(pool) => { + let mut query = sqlx::query(&_query); + for value in _values { + if value.is_null() { + query = query.bind(None::); + } else if value.is_string() { + query = query.bind(value.as_str().unwrap().to_owned()) + } else if let Some(number) = value.as_number() { + query = query.bind(number.as_f64().unwrap_or_default()) + } else { + query = query.bind(value); + } + } + let result = pool.execute(query).await?; + (result.rows_affected(), LastInsertId::Postgres(())) + } + #[cfg(not(any(feature = "sqlite", feature = "mysql", feature = "postgres")))] + DbPool::None => (0, LastInsertId::None), + }) + } + + pub(crate) async fn select( + &self, + _query: String, + _values: Vec, + ) -> Result>, crate::Error> { + Ok(match self { + #[cfg(feature = "sqlite")] + DbPool::Sqlite(pool) => { + let mut query = sqlx::query(&_query); + for value in _values { + if value.is_null() { + query = query.bind(None::); + } else if value.is_string() { + query = query.bind(value.as_str().unwrap().to_owned()) + } else if let Some(number) = value.as_number() { + query = query.bind(number.as_f64().unwrap_or_default()) + } else { + query = query.bind(value); + } + } + let rows = pool.fetch_all(query).await?; + let mut values = Vec::new(); + for row in rows { + let mut value = IndexMap::default(); + for (i, column) in row.columns().iter().enumerate() { + let v = row.try_get_raw(i)?; + + let v = crate::decode::sqlite::to_json(v)?; + + value.insert(column.name().to_string(), v); + } + + values.push(value); + } + values + } + #[cfg(feature = "mysql")] + DbPool::MySql(pool) => { + let mut query = sqlx::query(&_query); + for value in _values { + if value.is_null() { + query = query.bind(None::); + } else if value.is_string() { + query = query.bind(value.as_str().unwrap().to_owned()) + } else if let Some(number) = value.as_number() { + query = query.bind(number.as_f64().unwrap_or_default()) + } else { + query = query.bind(value); + } + } + let rows = pool.fetch_all(query).await?; + let mut values = Vec::new(); + for row in rows { + let mut value = IndexMap::default(); + for (i, column) in row.columns().iter().enumerate() { + let v = row.try_get_raw(i)?; + + let v = crate::decode::mysql::to_json(v)?; + + value.insert(column.name().to_string(), v); + } + + values.push(value); + } + values + } + #[cfg(feature = "postgres")] + DbPool::Postgres(pool) => { + let mut query = sqlx::query(&_query); + for value in _values { + if value.is_null() { + query = query.bind(None::); + } else if value.is_string() { + query = query.bind(value.as_str().unwrap().to_owned()) + } else if let Some(number) = value.as_number() { + query = query.bind(number.as_f64().unwrap_or_default()) + } else { + query = query.bind(value); + } + } + let rows = pool.fetch_all(query).await?; + let mut values = Vec::new(); + for row in rows { + let mut value = IndexMap::default(); + for (i, column) in row.columns().iter().enumerate() { + let v = row.try_get_raw(i)?; + + let v = crate::decode::postgres::to_json(v)?; + + value.insert(column.name().to_string(), v); + } + + values.push(value); + } + values + } + #[cfg(not(any(feature = "sqlite", feature = "mysql", feature = "postgres")))] + DbPool::None => Vec::new(), + }) + } +} + +#[cfg(feature = "sqlite")] +/// Maps the user supplied DB connection string to a connection string +/// with a fully qualified file path to the App's designed "app_path" +fn path_mapper(mut app_path: std::path::PathBuf, connection_string: &str) -> String { + app_path.push( + connection_string + .split_once(':') + .expect("Couldn't parse the connection string for DB!") + .1, + ); + + format!( + "sqlite:{}", + app_path + .to_str() + .expect("Problem creating fully qualified path to Database file!") + ) +} diff --git a/plugins/store/.gitignore b/plugins/store/.gitignore deleted file mode 100644 index b512c09d..00000000 --- a/plugins/store/.gitignore +++ /dev/null @@ -1 +0,0 @@ -node_modules \ No newline at end of file diff --git a/plugins/store/CHANGELOG.md b/plugins/store/CHANGELOG.md index c71ad4c8..fa4e13b1 100644 --- a/plugins/store/CHANGELOG.md +++ b/plugins/store/CHANGELOG.md @@ -1,5 +1,88 @@ # Changelog +## \[2.2.0] + +- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other. + +## \[2.1.0] + +### feat + +- [`8c67d44a`](https://github.com/tauri-apps/plugins-workspace/commit/8c67d44aef60b1427019538d8420787ef35bd3d5) ([#1860](https://github.com/tauri-apps/plugins-workspace/pull/1860) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) - Add `getStore` + - Add an option to use pre-stored (de)serialize functions (registered on rust) + - Add `LazyStore` + +## \[2.0.1] + +- [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7. + +## \[2.0.0] + +- [`e2c4dfb6`](https://github.com/tauri-apps/plugins-workspace/commit/e2c4dfb6af43e5dd8d9ceba232c315f5febd55c1) Update to tauri v2 stable release. + +## \[2.0.0-rc.2] + +- [`f12d3560`](https://github.com/tauri-apps/plugins-workspace/commit/f12d35609ab84f536c0f087665fdc1f978af3093) ([#1550](https://github.com/tauri-apps/plugins-workspace/pull/1550) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) **Breaking change**: Removed the `Store` constructor and added the `createStore` API. + +## \[2.0.0-rc.1] + +- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri 2.0.0-rc.8 + +## \[2.0.0-rc.2] + +- [`b9147758`](https://github.com/tauri-apps/plugins-workspace/commit/b914775898c2bee7ceb20bd17ee595005cd17a64) ([#1679](https://github.com/tauri-apps/plugins-workspace/pull/1679) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Explicitly set a minimum macOS version for the Swift package. + +## \[2.0.0-rc.1] + +### changes + +- [`6b079cfd`](https://github.com/tauri-apps/plugins-workspace/commit/6b079cfdd107c94abc2c7300f6af00bac3ff4040) ([#1649](https://github.com/tauri-apps/plugins-workspace/pull/1649) by [@ahqsoftwares](https://github.com/tauri-apps/plugins-workspace/../../ahqsoftwares)) Remove targetSdk from build.kts files as it is deprecated and will be removed from DSL v9.0 + +## \[2.0.0-rc.0] + +- [`9887d1`](https://github.com/tauri-apps/plugins-workspace/commit/9887d14bd0e971c4c0f5c1188fc4005d3fc2e29e) Update to tauri RC. + +## \[2.0.0-beta.8] + +- [`99d6ac0f`](https://github.com/tauri-apps/plugins-workspace/commit/99d6ac0f9506a6a4a1aa59c728157190a7441af6) ([#1606](https://github.com/tauri-apps/plugins-workspace/pull/1606) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) The JS packages now specify the *minimum* `@tauri-apps/api` version instead of a single exact version. +- [`6de87966`](https://github.com/tauri-apps/plugins-workspace/commit/6de87966ecc00ad9d91c25be452f1f46bd2b7e1f) ([#1597](https://github.com/tauri-apps/plugins-workspace/pull/1597) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Update to tauri beta.25. + +## \[2.0.0-beta.7] + +- [`22a17980`](https://github.com/tauri-apps/plugins-workspace/commit/22a17980ff4f6f8c40adb1b8f4ffc6dae2fe7e30) ([#1537](https://github.com/tauri-apps/plugins-workspace/pull/1537) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri beta.24. + +## \[2.0.0-beta.6] + +- [`76daee7a`](https://github.com/tauri-apps/plugins-workspace/commit/76daee7aafece34de3092c86e531cf9eb1138989) ([#1512](https://github.com/tauri-apps/plugins-workspace/pull/1512) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Update to tauri beta.23. + +## \[2.0.0-beta.5] + +- [`9013854f`](https://github.com/tauri-apps/plugins-workspace/commit/9013854f42a49a230b9dbb9d02774765528a923f)([#1382](https://github.com/tauri-apps/plugins-workspace/pull/1382)) Update to tauri beta.22. + +## \[2.0.0-beta.4] + +- [`430bd6f4`](https://github.com/tauri-apps/plugins-workspace/commit/430bd6f4f379bee5d232ae6b098ae131db7f178a)([#1363](https://github.com/tauri-apps/plugins-workspace/pull/1363)) Update to tauri beta.20. + +## \[2.0.0-beta.3] + +- [`bd1ed590`](https://github.com/tauri-apps/plugins-workspace/commit/bd1ed5903ffcce5500310dac1e59e8c67674ef1e)([#1237](https://github.com/tauri-apps/plugins-workspace/pull/1237)) Update to tauri beta.17. + +## \[2.0.0-beta.5] + +- [`bb51a41`](https://github.com/tauri-apps/plugins-workspace/commit/bb51a41d67ebf989e8aedf10c4b1a7f9514d1bdf)([#1168](https://github.com/tauri-apps/plugins-workspace/pull/1168)) **Breaking Change:** All apis that return paths to the frontend will now remove the `\\?\` UNC prefix on Windows. + +## \[2.0.0-beta.4] + +- [`a04ea2f`](https://github.com/tauri-apps/plugins-workspace/commit/a04ea2f38294d5a3987578283badc8eec87a7752)([#1071](https://github.com/tauri-apps/plugins-workspace/pull/1071)) The global API script is now only added to the binary when the `withGlobalTauri` config is true. + +## \[2.0.0-beta.3] + +- [`79691e9`](https://github.com/tauri-apps/plugins-workspace/commit/79691e93e04b820e44dce1c7d91b8865fa6ccb14)([#1040](https://github.com/tauri-apps/plugins-workspace/pull/1040)) Fix `with_store` and `StoreCollection` changed to private in #1011 + +## \[2.0.0-beta.2] + +- [`99bea25`](https://github.com/tauri-apps/plugins-workspace/commit/99bea2559c2c0648c2519c50a18cd124dacef57b)([#1005](https://github.com/tauri-apps/plugins-workspace/pull/1005)) Update to tauri beta.8. + ## \[2.0.0-beta.1] - [`569defb`](https://github.com/tauri-apps/plugins-workspace/commit/569defbe9492e38938554bb7bdc1be9151456d21) Update to tauri beta.4. @@ -35,13 +118,3 @@ ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - te to alpha.11. - -## \[2.0.0-alpha.0] - -- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - ha.0] - -- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - ae67\`]\(https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! -717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/store/Cargo.toml b/plugins/store/Cargo.toml index a91d96e4..1ed19962 100644 --- a/plugins/store/Cargo.toml +++ b/plugins/store/Cargo.toml @@ -1,23 +1,39 @@ [package] name = "tauri-plugin-store" -version = "2.0.0-beta.1" +version = "2.2.0" description = "Simple, persistent key-value store." authors = { workspace = true } license = { workspace = true } edition = { workspace = true } rust-version = { workspace = true } +repository = { workspace = true } links = "tauri-plugin-store" [package.metadata.docs.rs] -rustc-args = [ "--cfg", "docsrs" ] -rustdoc-args = [ "--cfg", "docsrs" ] +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs"] + +[package.metadata.platforms.support] +windows = { level = "full", notes = "" } +linux = { level = "full", notes = "" } +macos = { level = "full", notes = "" } +android = { level = "full", notes = "" } +ios = { level = "full", notes = "" } [build-dependencies] -tauri-plugin = { workspace = true, features = [ "build" ] } +tauri-plugin = { workspace = true, features = ["build"] } [dependencies] serde = { workspace = true } serde_json = { workspace = true } tauri = { workspace = true } -log = { workspace = true } +tracing = { workspace = true } thiserror = { workspace = true } +dunce = { workspace = true } +tokio = { version = "1", features = ["sync", "time", "macros"] } + +[target.'cfg(target_os = "ios")'.dependencies] +tauri = { workspace = true, features = ["wry"] } + +[dev-dependencies] +tauri = { workspace = true, features = ["wry"] } diff --git a/plugins/store/README.md b/plugins/store/README.md index ad746854..8a2fcbf7 100644 --- a/plugins/store/README.md +++ b/plugins/store/README.md @@ -2,9 +2,17 @@ Simple, persistent key-value store. +| Platform | Supported | +| -------- | --------- | +| Linux | ✓ | +| Windows | ✓ | +| macOS | ✓ | +| Android | ✓ | +| iOS | ✓ | + ## Install -_This plugin requires a Rust version of at least **1.75**_ +_This plugin requires a Rust version of at least **1.77.2**_ There are three general methods of installation that we can recommend. @@ -18,7 +26,7 @@ Install the Core plugin by adding the following to your `Cargo.toml` file: ```toml [dependencies] -tauri-plugin-store = "2.0.0-beta" +tauri-plugin-store = "2.0.0" # alternatively with Git: tauri-plugin-store = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` @@ -46,7 +54,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-store#v2 First you need to register the core plugin with Tauri: -`src-tauri/src/main.rs` +`src-tauri/src/lib.rs` ```rust fn main() { @@ -59,58 +67,77 @@ fn main() { Afterwards all the plugin's APIs are available through the JavaScript guest bindings: -```javascript -import { Store } from "@tauri-apps/plugin-store"; +```typescript +import { Store } from '@tauri-apps/plugin-store' -const store = new Store(".settings.dat"); +const store = await Store.load('settings.json') -await store.set("some-key", { value: 5 }); +await store.set('some-key', { value: 5 }) -const val = await store.get("some-key"); -assert(val, { value: 5 }); +const val = await store.get<{ value: number }>('some-key') -await store.save(); // this manually saves the store, otherwise the store is only saved when your app is closed +if (val) { + console.log(val) +} else { + console.log('val is null') +} ``` -### Persisting values +### Persisting Values + +Modifications made to the store are automatically saved by default + +You can manually save a store with: -Values added to the store are not persisted between application loads unless: +```javascript +await store.save() +``` + +Stores are loaded automatically when used from the JavaScript bindings. +However, you can also load them manually later like so: -1. The application is closed gracefully (plugin automatically saves) -2. The store is manually saved (using `store.save()`) +```javascript +await store.load() +``` + +### LazyStore + +There's also a high level API `LazyStore` which only loads the store on first access, note that the options will be ignored if a `Store` with that path has already been created + +```typescript +import { LazyStore } from '@tauri-apps/plugin-store' + +const store = new LazyStore('settings.json') +``` ## Usage from Rust -You can also access Stores from Rust, you can create new stores: +You can also create `Store` instances directly in Rust: ```rust -use tauri_plugin_store::StoreBuilder; +use tauri_plugin_store::StoreExt; use serde_json::json; fn main() { tauri::Builder::default() .plugin(tauri_plugin_store::Builder::default().build()) .setup(|app| { - let mut store = StoreBuilder::new(app.handle(), "path/to/store.bin".parse()?).build(); + // This loads the store from disk + let store = app.store("app_data.json")?; - store.insert("a".to_string(), json!("b")) // note that values must be serd_json::Value to be compatible with JS + // Note that values must be serde_json::Value instances, + // otherwise, they will not be compatible with the JavaScript bindings. + store.set("a".to_string(), json!("b")); + Ok(()) }) .run(tauri::generate_context!()) .expect("error while running tauri application"); } ``` -As you may have noticed, the Store crated above isn't accessible to the frontend. To interoperate with stores created by JS use the exported `with_store` method: +### Frontend Interoperability -```rust -use tauri::Wry; -use tauri_plugin_store::with_store; - -let stores = app.state::>(); -let path = PathBuf::from("path/to/the/storefile"); - -with_store(app_handle, stores, path, |store| store.insert("a".to_string(), json!("b"))) -``` +The store created from both Rust side and JavaScript side are stored in the app's resource table and can be accessed by both sides, you can access it by using the same path, with `getStore` and `LazyStore` in the JavaScript side and `get_store` and `store` in the Rust side ## Contributing diff --git a/plugins/store/SECURITY.md b/plugins/store/SECURITY.md new file mode 100644 index 00000000..4f09bbac --- /dev/null +++ b/plugins/store/SECURITY.md @@ -0,0 +1,23 @@ +# Security Policy + +**Do not report security vulnerabilities through public GitHub issues.** + +**Please use the [Private Vulnerability Disclosure](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability) feature of GitHub.** + +Include as much of the following information: + +- Type of issue (e.g. improper input parsing, privilege escalation, etc.) +- The location of the affected source code (tag/branch/commit or direct URL) +- Any special configuration required to reproduce the issue +- The distribution affected or used to help us with reproduction of the issue +- Step-by-step instructions to reproduce the issue +- Ideally a reproduction repository +- Impact of the issue, including how an attacker might exploit the issue + +We prefer to receive reports in English. + +## Contact + +Please disclose a vulnerability or security relevant issue here: [https://github.com/tauri-apps/plugins-workspace/security/advisories/new](https://github.com/tauri-apps/plugins-workspace/security/advisories/new). + +Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app). diff --git a/plugins/store/api-iife.js b/plugins/store/api-iife.js new file mode 100644 index 00000000..61dc5df4 --- /dev/null +++ b/plugins/store/api-iife.js @@ -0,0 +1 @@ +if("__TAURI__"in window){var __TAURI_PLUGIN_STORE__=function(t){"use strict";var e,a;function r(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}async function s(t,e={},a){return window.__TAURI_INTERNALS__.invoke(t,e,a)}"function"==typeof SuppressedError&&SuppressedError;class i{get rid(){return function(t,e,a,r){if("function"==typeof e||!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===a?r:"a"===a?r.call(t):r?r.value:e.get(t)}(this,e,"f")}constructor(t){e.set(this,void 0),function(t,e,a){if("function"==typeof e||!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");e.set(t,a)}(this,e,t)}async close(){return s("plugin:resources|close",{rid:this.rid})}}async function n(t,e,a){const i={kind:"Any"};return s("plugin:event|listen",{event:t,target:i,handler:r(e)}).then((e=>async()=>async function(t,e){await s("plugin:event|unlisten",{event:t,eventId:e})}(t,e)))}async function o(t,e){return await u.load(t,e)}e=new WeakMap,function(t){t.WINDOW_RESIZED="tauri://resize",t.WINDOW_MOVED="tauri://move",t.WINDOW_CLOSE_REQUESTED="tauri://close-requested",t.WINDOW_DESTROYED="tauri://destroyed",t.WINDOW_FOCUS="tauri://focus",t.WINDOW_BLUR="tauri://blur",t.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",t.WINDOW_THEME_CHANGED="tauri://theme-changed",t.WINDOW_CREATED="tauri://window-created",t.WEBVIEW_CREATED="tauri://webview-created",t.DRAG_ENTER="tauri://drag-enter",t.DRAG_OVER="tauri://drag-over",t.DRAG_DROP="tauri://drag-drop",t.DRAG_LEAVE="tauri://drag-leave"}(a||(a={}));class u extends i{constructor(t){super(t)}static async load(t,e){const a=await s("plugin:store|load",{path:t,...e});return new u(a)}static async get(t){return await s("plugin:store|get_store",{path:t}).then((t=>t?new u(t):null))}async set(t,e){await s("plugin:store|set",{rid:this.rid,key:t,value:e})}async get(t){const[e,a]=await s("plugin:store|get",{rid:this.rid,key:t});return a?e:void 0}async has(t){return await s("plugin:store|has",{rid:this.rid,key:t})}async delete(t){return await s("plugin:store|delete",{rid:this.rid,key:t})}async clear(){await s("plugin:store|clear",{rid:this.rid})}async reset(){await s("plugin:store|reset",{rid:this.rid})}async keys(){return await s("plugin:store|keys",{rid:this.rid})}async values(){return await s("plugin:store|values",{rid:this.rid})}async entries(){return await s("plugin:store|entries",{rid:this.rid})}async length(){return await s("plugin:store|length",{rid:this.rid})}async reload(){await s("plugin:store|reload",{rid:this.rid})}async save(){await s("plugin:store|save",{rid:this.rid})}async onKeyChange(t,e){return await n("store://change",(a=>{a.payload.resourceId===this.rid&&a.payload.key===t&&e(a.payload.exists?a.payload.value:void 0)}))}async onChange(t){return await n("store://change",(e=>{e.payload.resourceId===this.rid&&t(e.payload.key,e.payload.exists?e.payload.value:void 0)}))}}return t.LazyStore=class{get store(){return this._store||(this._store=o(this.path,this.options)),this._store}constructor(t,e){this.path=t,this.options=e}async init(){await this.store}async set(t,e){return(await this.store).set(t,e)}async get(t){return(await this.store).get(t)}async has(t){return(await this.store).has(t)}async delete(t){return(await this.store).delete(t)}async clear(){await(await this.store).clear()}async reset(){await(await this.store).reset()}async keys(){return(await this.store).keys()}async values(){return(await this.store).values()}async entries(){return(await this.store).entries()}async length(){return(await this.store).length()}async reload(){await(await this.store).reload()}async save(){await(await this.store).save()}async onKeyChange(t,e){return(await this.store).onKeyChange(t,e)}async onChange(t){return(await this.store).onChange(t)}async close(){this._store&&await(await this._store).close()}},t.Store=u,t.getStore=async function(t){return await u.get(t)},t.load=o,t}({});Object.defineProperty(window.__TAURI__,"store",{value:__TAURI_PLUGIN_STORE__})} diff --git a/plugins/store/build.rs b/plugins/store/build.rs index 30ed3968..2e88d59a 100644 --- a/plugins/store/build.rs +++ b/plugins/store/build.rs @@ -3,10 +3,24 @@ // SPDX-License-Identifier: MIT const COMMANDS: &[&str] = &[ - "set", "get", "has", "delete", "clear", "reset", "keys", "values", "length", "entries", "load", + "load", + "get_store", + "set", + "get", + "has", + "delete", + "clear", + "reset", + "keys", + "values", + "entries", + "length", + "reload", "save", ]; fn main() { - tauri_plugin::Builder::new(COMMANDS).build(); + tauri_plugin::Builder::new(COMMANDS) + .global_api_script_path("./api-iife.js") + .build(); } diff --git a/plugins/store/examples/AppSettingsManager/.gitignore b/plugins/store/examples/AppSettingsManager/.gitignore new file mode 100644 index 00000000..a9b26d1f --- /dev/null +++ b/plugins/store/examples/AppSettingsManager/.gitignore @@ -0,0 +1,24 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +#dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/plugins/store/examples/AppSettingsManager/.vscode/extensions.json b/plugins/store/examples/AppSettingsManager/.vscode/extensions.json new file mode 100644 index 00000000..24d7cc6d --- /dev/null +++ b/plugins/store/examples/AppSettingsManager/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["tauri-apps.tauri-vscode", "rust-lang.rust-analyzer"] +} diff --git a/plugins/store/examples/AppSettingsManager/README.md b/plugins/store/examples/AppSettingsManager/README.md new file mode 100644 index 00000000..b381dcf5 --- /dev/null +++ b/plugins/store/examples/AppSettingsManager/README.md @@ -0,0 +1,7 @@ +# Tauri + Vanilla TS + +This template should help get you started developing with Tauri in vanilla HTML, CSS and Typescript. + +## Recommended IDE Setup + +- [VS Code](https://code.visualstudio.com/) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer) diff --git a/plugins/deep-link/examples/app/src-tauri/gen/apple/assets/.gitkeep b/plugins/store/examples/AppSettingsManager/dist/.gitkeep similarity index 100% rename from plugins/deep-link/examples/app/src-tauri/gen/apple/assets/.gitkeep rename to plugins/store/examples/AppSettingsManager/dist/.gitkeep diff --git a/plugins/store/examples/AppSettingsManager/index.html b/plugins/store/examples/AppSettingsManager/index.html new file mode 100644 index 00000000..7c268692 --- /dev/null +++ b/plugins/store/examples/AppSettingsManager/index.html @@ -0,0 +1,54 @@ + + + + + + + Tauri App + + + + + + + + diff --git a/plugins/store/examples/AppSettingsManager/package.json b/plugins/store/examples/AppSettingsManager/package.json new file mode 100644 index 00000000..59fe89da --- /dev/null +++ b/plugins/store/examples/AppSettingsManager/package.json @@ -0,0 +1,15 @@ +{ + "private": true, + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc && vite build", + "preview": "vite preview", + "tauri": "tauri" + }, + "devDependencies": { + "@tauri-apps/cli": "2.5.0", + "typescript": "^5.7.3", + "vite": "^6.2.6" + } +} diff --git a/plugins/store/examples/AppSettingsManager/src-tauri/.gitignore b/plugins/store/examples/AppSettingsManager/src-tauri/.gitignore new file mode 100644 index 00000000..043cc4af --- /dev/null +++ b/plugins/store/examples/AppSettingsManager/src-tauri/.gitignore @@ -0,0 +1,4 @@ +# Generated by Cargo +# will have compiled files and executables +/target/ +gen/schemas diff --git a/plugins/store/examples/AppSettingsManager/src-tauri/Cargo.toml b/plugins/store/examples/AppSettingsManager/src-tauri/Cargo.toml new file mode 100644 index 00000000..7c60d516 --- /dev/null +++ b/plugins/store/examples/AppSettingsManager/src-tauri/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "app_settings_manager" +version = "0.0.0" +description = "A Tauri App" +authors = ["you"] +license = "" +repository = "" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[build-dependencies] +tauri-build = { workspace = true } + +[dependencies] +tauri = { workspace = true, features = ["wry", "compression"] } +serde = { workspace = true } +serde_json = { workspace = true } +tauri-plugin-store = { path = "../../../" } + +[features] +# this feature is used for production builds or when `devPath` points to the filesystem +# DO NOT REMOVE!! +prod = ["tauri/custom-protocol"] diff --git a/plugins/store/examples/AppSettingsManager/src-tauri/build.rs b/plugins/store/examples/AppSettingsManager/src-tauri/build.rs new file mode 100644 index 00000000..5ebf8d2f --- /dev/null +++ b/plugins/store/examples/AppSettingsManager/src-tauri/build.rs @@ -0,0 +1,7 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +fn main() { + tauri_build::build() +} diff --git a/plugins/store/examples/AppSettingsManager/src-tauri/icons/128x128.png b/plugins/store/examples/AppSettingsManager/src-tauri/icons/128x128.png new file mode 100644 index 00000000..6be5e50e Binary files /dev/null and b/plugins/store/examples/AppSettingsManager/src-tauri/icons/128x128.png differ diff --git a/plugins/store/examples/AppSettingsManager/src-tauri/icons/128x128@2x.png b/plugins/store/examples/AppSettingsManager/src-tauri/icons/128x128@2x.png new file mode 100644 index 00000000..e81becee Binary files /dev/null and b/plugins/store/examples/AppSettingsManager/src-tauri/icons/128x128@2x.png differ diff --git a/plugins/store/examples/AppSettingsManager/src-tauri/icons/32x32.png b/plugins/store/examples/AppSettingsManager/src-tauri/icons/32x32.png new file mode 100644 index 00000000..a437dd51 Binary files /dev/null and b/plugins/store/examples/AppSettingsManager/src-tauri/icons/32x32.png differ diff --git a/plugins/store/examples/AppSettingsManager/src-tauri/icons/Square107x107Logo.png b/plugins/store/examples/AppSettingsManager/src-tauri/icons/Square107x107Logo.png new file mode 100644 index 00000000..0ca4f271 Binary files /dev/null and b/plugins/store/examples/AppSettingsManager/src-tauri/icons/Square107x107Logo.png differ diff --git a/plugins/store/examples/AppSettingsManager/src-tauri/icons/Square142x142Logo.png b/plugins/store/examples/AppSettingsManager/src-tauri/icons/Square142x142Logo.png new file mode 100644 index 00000000..b81f8203 Binary files /dev/null and b/plugins/store/examples/AppSettingsManager/src-tauri/icons/Square142x142Logo.png differ diff --git a/plugins/store/examples/AppSettingsManager/src-tauri/icons/Square150x150Logo.png b/plugins/store/examples/AppSettingsManager/src-tauri/icons/Square150x150Logo.png new file mode 100644 index 00000000..624c7bfb Binary files /dev/null and b/plugins/store/examples/AppSettingsManager/src-tauri/icons/Square150x150Logo.png differ diff --git a/plugins/store/examples/AppSettingsManager/src-tauri/icons/Square284x284Logo.png b/plugins/store/examples/AppSettingsManager/src-tauri/icons/Square284x284Logo.png new file mode 100644 index 00000000..c021d2ba Binary files /dev/null and b/plugins/store/examples/AppSettingsManager/src-tauri/icons/Square284x284Logo.png differ diff --git a/plugins/store/examples/AppSettingsManager/src-tauri/icons/Square30x30Logo.png b/plugins/store/examples/AppSettingsManager/src-tauri/icons/Square30x30Logo.png new file mode 100644 index 00000000..62197002 Binary files /dev/null and b/plugins/store/examples/AppSettingsManager/src-tauri/icons/Square30x30Logo.png differ diff --git a/plugins/store/examples/AppSettingsManager/src-tauri/icons/Square310x310Logo.png b/plugins/store/examples/AppSettingsManager/src-tauri/icons/Square310x310Logo.png new file mode 100644 index 00000000..f9bc0483 Binary files /dev/null and b/plugins/store/examples/AppSettingsManager/src-tauri/icons/Square310x310Logo.png differ diff --git a/plugins/store/examples/AppSettingsManager/src-tauri/icons/Square44x44Logo.png b/plugins/store/examples/AppSettingsManager/src-tauri/icons/Square44x44Logo.png new file mode 100644 index 00000000..d5fbfb2a Binary files /dev/null and b/plugins/store/examples/AppSettingsManager/src-tauri/icons/Square44x44Logo.png differ diff --git a/plugins/store/examples/AppSettingsManager/src-tauri/icons/Square71x71Logo.png b/plugins/store/examples/AppSettingsManager/src-tauri/icons/Square71x71Logo.png new file mode 100644 index 00000000..63440d79 Binary files /dev/null and b/plugins/store/examples/AppSettingsManager/src-tauri/icons/Square71x71Logo.png differ diff --git a/plugins/store/examples/AppSettingsManager/src-tauri/icons/Square89x89Logo.png b/plugins/store/examples/AppSettingsManager/src-tauri/icons/Square89x89Logo.png new file mode 100644 index 00000000..f3f705af Binary files /dev/null and b/plugins/store/examples/AppSettingsManager/src-tauri/icons/Square89x89Logo.png differ diff --git a/plugins/store/examples/AppSettingsManager/src-tauri/icons/StoreLogo.png b/plugins/store/examples/AppSettingsManager/src-tauri/icons/StoreLogo.png new file mode 100644 index 00000000..45563882 Binary files /dev/null and b/plugins/store/examples/AppSettingsManager/src-tauri/icons/StoreLogo.png differ diff --git a/plugins/store/examples/AppSettingsManager/src-tauri/icons/icon.icns b/plugins/store/examples/AppSettingsManager/src-tauri/icons/icon.icns new file mode 100644 index 00000000..12a5bcee Binary files /dev/null and b/plugins/store/examples/AppSettingsManager/src-tauri/icons/icon.icns differ diff --git a/plugins/store/examples/AppSettingsManager/src-tauri/icons/icon.ico b/plugins/store/examples/AppSettingsManager/src-tauri/icons/icon.ico new file mode 100644 index 00000000..b3636e4b Binary files /dev/null and b/plugins/store/examples/AppSettingsManager/src-tauri/icons/icon.ico differ diff --git a/plugins/store/examples/AppSettingsManager/src-tauri/icons/icon.png b/plugins/store/examples/AppSettingsManager/src-tauri/icons/icon.png new file mode 100644 index 00000000..e1cd2619 Binary files /dev/null and b/plugins/store/examples/AppSettingsManager/src-tauri/icons/icon.png differ diff --git a/plugins/store/examples/AppSettingsManager/src-tauri/src/app/mod.rs b/plugins/store/examples/AppSettingsManager/src-tauri/src/app/mod.rs new file mode 100644 index 00000000..e8c1bb01 --- /dev/null +++ b/plugins/store/examples/AppSettingsManager/src-tauri/src/app/mod.rs @@ -0,0 +1,5 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +pub mod settings; diff --git a/plugins/store/examples/AppSettingsManager/src-tauri/src/app/settings.rs b/plugins/store/examples/AppSettingsManager/src-tauri/src/app/settings.rs new file mode 100644 index 00000000..30514a00 --- /dev/null +++ b/plugins/store/examples/AppSettingsManager/src-tauri/src/app/settings.rs @@ -0,0 +1,32 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use tauri_plugin_store::Store; + +#[derive(Debug, Clone)] +pub struct AppSettings { + pub launch_at_login: bool, + pub theme: String, +} + +impl AppSettings { + pub fn load_from_store( + store: &Store, + ) -> Result> { + let launch_at_login = store + .get("appSettings.launchAtLogin") + .and_then(|v| v.as_bool()) + .unwrap_or(false); + + let theme = store + .get("appSettings.theme") + .and_then(|v| v.as_str().map(String::from)) + .unwrap_or_else(|| "dark".to_owned()); + + Ok(AppSettings { + launch_at_login, + theme, + }) + } +} diff --git a/plugins/store/examples/AppSettingsManager/src-tauri/src/main.rs b/plugins/store/examples/AppSettingsManager/src-tauri/src/main.rs new file mode 100644 index 00000000..f20db4fc --- /dev/null +++ b/plugins/store/examples/AppSettingsManager/src-tauri/src/main.rs @@ -0,0 +1,47 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +// Prevents additional console window on Windows in release, DO NOT REMOVE!! +#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] + +use serde_json::json; +use tauri::Listener; +use tauri_plugin_store::StoreExt; + +mod app; +use app::settings::AppSettings; + +fn main() { + tauri::Builder::default() + .plugin(tauri_plugin_store::Builder::new().build()) + .setup(|app| { + // Init store and load it from disk + let store = app.store("settings.json")?; + app.listen("store://change", |event| { + dbg!(event); + }); + let app_settings = AppSettings::load_from_store(&store); + match app_settings { + Ok(app_settings) => { + let theme = app_settings.theme; + let launch_at_login = app_settings.launch_at_login; + + println!("theme {theme}"); + println!("launch_at_login {launch_at_login}"); + store.set( + "appSettings", + json!({ "theme": theme, "launchAtLogin": launch_at_login }), + ); + } + Err(err) => { + eprintln!("Error loading settings: {err}"); + // Handle the error case if needed + return Err(err); // Convert the error to a Box and return Err(err) here + } + } + Ok(()) + }) + .run(tauri::generate_context!()) + .expect("error while running tauri application"); +} diff --git a/plugins/store/examples/AppSettingsManager/src-tauri/tauri.conf.json b/plugins/store/examples/AppSettingsManager/src-tauri/tauri.conf.json new file mode 100644 index 00000000..d3f60daa --- /dev/null +++ b/plugins/store/examples/AppSettingsManager/src-tauri/tauri.conf.json @@ -0,0 +1,34 @@ +{ + "productName": "app", + "version": "0.1.0", + "identifier": "com.tauri.app-settings-manager", + "build": { + "devUrl": "http://localhost:1420", + "frontendDist": "../dist" + }, + "app": { + "windows": [ + { + "title": "app", + "width": 800, + "height": 600, + "resizable": true, + "fullscreen": false + } + ], + "security": { + "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: http://tauri.localhost 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'" + } + }, + "bundle": { + "active": true, + "targets": "all", + "icon": [ + "icons/32x32.png", + "icons/128x128.png", + "icons/128x128@2x.png", + "icons/icon.icns", + "icons/icon.ico" + ] + } +} diff --git a/plugins/store/examples/AppSettingsManager/src/assets/tauri.svg b/plugins/store/examples/AppSettingsManager/src/assets/tauri.svg new file mode 100644 index 00000000..31b62c92 --- /dev/null +++ b/plugins/store/examples/AppSettingsManager/src/assets/tauri.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/plugins/store/examples/AppSettingsManager/src/assets/typescript.svg b/plugins/store/examples/AppSettingsManager/src/assets/typescript.svg new file mode 100644 index 00000000..30a5edd3 --- /dev/null +++ b/plugins/store/examples/AppSettingsManager/src/assets/typescript.svg @@ -0,0 +1,25 @@ + + + + + + + + diff --git a/plugins/store/examples/AppSettingsManager/src/assets/vite.svg b/plugins/store/examples/AppSettingsManager/src/assets/vite.svg new file mode 100644 index 00000000..e7b8dfb1 --- /dev/null +++ b/plugins/store/examples/AppSettingsManager/src/assets/vite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/plugins/store/examples/AppSettingsManager/src/main.ts b/plugins/store/examples/AppSettingsManager/src/main.ts new file mode 100644 index 00000000..57cbe4b7 --- /dev/null +++ b/plugins/store/examples/AppSettingsManager/src/main.ts @@ -0,0 +1,9 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +window.addEventListener('DOMContentLoaded', () => { + document.querySelector('#greet-form')?.addEventListener('submit', (e) => { + e.preventDefault() + }) +}) diff --git a/plugins/store/examples/AppSettingsManager/src/styles.css b/plugins/store/examples/AppSettingsManager/src/styles.css new file mode 100644 index 00000000..f7de85bf --- /dev/null +++ b/plugins/store/examples/AppSettingsManager/src/styles.css @@ -0,0 +1,109 @@ +:root { + font-family: Inter, Avenir, Helvetica, Arial, sans-serif; + font-size: 16px; + line-height: 24px; + font-weight: 400; + + color: #0f0f0f; + background-color: #f6f6f6; + + font-synthesis: none; + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + -webkit-text-size-adjust: 100%; +} + +.container { + margin: 0; + padding-top: 10vh; + display: flex; + flex-direction: column; + justify-content: center; + text-align: center; +} + +.logo { + height: 6em; + padding: 1.5em; + will-change: filter; + transition: 0.75s; +} + +.logo.tauri:hover { + filter: drop-shadow(0 0 2em #24c8db); +} + +.row { + display: flex; + justify-content: center; +} + +a { + font-weight: 500; + color: #646cff; + text-decoration: inherit; +} + +a:hover { + color: #535bf2; +} + +h1 { + text-align: center; +} + +input, +button { + border-radius: 8px; + border: 1px solid transparent; + padding: 0.6em 1.2em; + font-size: 1em; + font-weight: 500; + font-family: inherit; + color: #0f0f0f; + background-color: #ffffff; + transition: border-color 0.25s; + box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2); +} + +button { + cursor: pointer; +} + +button:hover { + border-color: #396cd8; +} +button:active { + border-color: #396cd8; + background-color: #e8e8e8; +} + +input, +button { + outline: none; +} + +#greet-input { + margin-right: 5px; +} + +@media (prefers-color-scheme: dark) { + :root { + color: #f6f6f6; + background-color: #2f2f2f; + } + + a:hover { + color: #24c8db; + } + + input, + button { + color: #ffffff; + background-color: #0f0f0f98; + } + button:active { + background-color: #0f0f0f69; + } +} diff --git a/plugins/store/examples/AppSettingsManager/tsconfig.json b/plugins/store/examples/AppSettingsManager/tsconfig.json new file mode 100644 index 00000000..75abdef2 --- /dev/null +++ b/plugins/store/examples/AppSettingsManager/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "target": "ES2020", + "useDefineForClassFields": true, + "module": "ESNext", + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true + }, + "include": ["src"] +} diff --git a/plugins/store/examples/AppSettingsManager/vite.config.ts b/plugins/store/examples/AppSettingsManager/vite.config.ts new file mode 100644 index 00000000..661eb233 --- /dev/null +++ b/plugins/store/examples/AppSettingsManager/vite.config.ts @@ -0,0 +1,21 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +import { defineConfig } from 'vite' + +// https://vitejs.dev/config/ +export default defineConfig(async () => ({ + // Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build` + // + // 1. prevent vite from obscuring rust errors + clearScreen: false, + // 2. tauri expects a fixed port, fail if that port is not available + server: { + port: 1420, + strictPort: true + }, + // 3. to make use of `TAURI_DEBUG` and other env variables + // https://tauri.studio/v1/api/config#buildconfig.beforedevcommand + envPrefix: ['VITE_', 'TAURI_'] +})) diff --git a/plugins/store/guest-js/index.ts b/plugins/store/guest-js/index.ts index e567f8eb..1df89fd5 100644 --- a/plugins/store/guest-js/index.ts +++ b/plugins/store/guest-js/index.ts @@ -2,25 +2,318 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { listen, UnlistenFn } from "@tauri-apps/api/event"; +import { listen, type UnlistenFn } from '@tauri-apps/api/event' -import { invoke } from "@tauri-apps/api/core"; +import { invoke, Resource } from '@tauri-apps/api/core' interface ChangePayload { - path: string; - key: string; - value: T | null; + path: string + resourceId?: number + key: string + value: T + exists: boolean +} + +/** + * Options to create a store + */ +export type StoreOptions = { + /** + * Auto save on modification with debounce duration in milliseconds, it's 100ms by default, pass in `false` to disable it + */ + autoSave?: boolean | number + /** + * Name of a serialize function registered in the rust side plugin builder + */ + serializeFnName?: string + /** + * Name of a deserialize function registered in the rust side plugin builder + */ + deserializeFnName?: string + /** + * Force create a new store with default values even if it already exists. + */ + createNew?: boolean +} + +/** + * Create a new Store or load the existing store with the path. + * + * @example + * ```typescript + * import { Store } from '@tauri-apps/api/store'; + * const store = await Store.load('store.json'); + * ``` + * + * @param path Path to save the store in `app_data_dir` + * @param options Store configuration options + */ +export async function load( + path: string, + options?: StoreOptions +): Promise { + return await Store.load(path, options) +} + +/** + * Gets an already loaded store. + * + * If the store is not loaded, returns `null`. In this case you must {@link Store.load load} it. + * + * This function is more useful when you already know the store is loaded + * and just need to access its instance. Prefer {@link Store.load} otherwise. + * + * @example + * ```typescript + * import { getStore } from '@tauri-apps/api/store'; + * const store = await getStore('store.json'); + * ``` + * + * @param path Path of the store. + */ +export async function getStore(path: string): Promise { + return await Store.get(path) +} + +/** + * A lazy loaded key-value store persisted by the backend layer. + */ +export class LazyStore implements IStore { + private _store?: Promise + + private get store(): Promise { + if (!this._store) { + this._store = load(this.path, this.options) + } + return this._store + } + + /** + * Note that the options are not applied if someone else already created the store + * @param path Path to save the store in `app_data_dir` + * @param options Store configuration options + */ + constructor( + private readonly path: string, + private readonly options?: StoreOptions + ) {} + + /** + * Init/load the store if it's not loaded already + */ + async init(): Promise { + await this.store + } + + async set(key: string, value: unknown): Promise { + return (await this.store).set(key, value) + } + + async get(key: string): Promise { + return (await this.store).get(key) + } + + async has(key: string): Promise { + return (await this.store).has(key) + } + + async delete(key: string): Promise { + return (await this.store).delete(key) + } + + async clear(): Promise { + await (await this.store).clear() + } + + async reset(): Promise { + await (await this.store).reset() + } + + async keys(): Promise { + return (await this.store).keys() + } + + async values(): Promise { + return (await this.store).values() + } + + async entries(): Promise> { + return (await this.store).entries() + } + + async length(): Promise { + return (await this.store).length() + } + + async reload(): Promise { + await (await this.store).reload() + } + + async save(): Promise { + await (await this.store).save() + } + + async onKeyChange( + key: string, + cb: (value: T | undefined) => void + ): Promise { + return (await this.store).onKeyChange(key, cb) + } + + async onChange( + cb: (key: string, value: T | undefined) => void + ): Promise { + return (await this.store).onChange(cb) + } + + async close(): Promise { + if (this._store) { + await (await this._store).close() + } + } } /** * A key-value store persisted by the backend layer. */ -export class Store { - path: string; - constructor(path: string) { - this.path = path; +export class Store extends Resource implements IStore { + private constructor(rid: number) { + super(rid) } + /** + * Create a new Store or load the existing store with the path. + * + * @example + * ```typescript + * import { Store } from '@tauri-apps/api/store'; + * const store = await Store.load('store.json'); + * ``` + * + * @param path Path to save the store in `app_data_dir` + * @param options Store configuration options + */ + static async load(path: string, options?: StoreOptions): Promise { + const rid = await invoke('plugin:store|load', { + path, + ...options + }) + return new Store(rid) + } + + /** + * Gets an already loaded store. + * + * If the store is not loaded, returns `null`. In this case you must {@link Store.load load} it. + * + * This function is more useful when you already know the store is loaded + * and just need to access its instance. Prefer {@link Store.load} otherwise. + * + * @example + * ```typescript + * import { Store } from '@tauri-apps/api/store'; + * let store = await Store.get('store.json'); + * if (!store) { + * store = await Store.load('store.json'); + * } + * ``` + * + * @param path Path of the store. + */ + static async get(path: string): Promise { + return await invoke('plugin:store|get_store', { path }).then( + (rid) => (rid ? new Store(rid) : null) + ) + } + + async set(key: string, value: unknown): Promise { + await invoke('plugin:store|set', { + rid: this.rid, + key, + value + }) + } + + async get(key: string): Promise { + const [value, exists] = await invoke<[T, boolean]>('plugin:store|get', { + rid: this.rid, + key + }) + return exists ? value : undefined + } + + async has(key: string): Promise { + return await invoke('plugin:store|has', { + rid: this.rid, + key + }) + } + + async delete(key: string): Promise { + return await invoke('plugin:store|delete', { + rid: this.rid, + key + }) + } + + async clear(): Promise { + await invoke('plugin:store|clear', { rid: this.rid }) + } + + async reset(): Promise { + await invoke('plugin:store|reset', { rid: this.rid }) + } + + async keys(): Promise { + return await invoke('plugin:store|keys', { rid: this.rid }) + } + + async values(): Promise { + return await invoke('plugin:store|values', { rid: this.rid }) + } + + async entries(): Promise> { + return await invoke('plugin:store|entries', { rid: this.rid }) + } + + async length(): Promise { + return await invoke('plugin:store|length', { rid: this.rid }) + } + + async reload(): Promise { + await invoke('plugin:store|reload', { rid: this.rid }) + } + + async save(): Promise { + await invoke('plugin:store|save', { rid: this.rid }) + } + + async onKeyChange( + key: string, + cb: (value: T | undefined) => void + ): Promise { + return await listen>('store://change', (event) => { + if (event.payload.resourceId === this.rid && event.payload.key === key) { + cb(event.payload.exists ? event.payload.value : undefined) + } + }) + } + + async onChange( + cb: (key: string, value: T | undefined) => void + ): Promise { + return await listen>('store://change', (event) => { + if (event.payload.resourceId === this.rid) { + cb( + event.payload.key, + event.payload.exists ? event.payload.value : undefined + ) + } + }) + } +} + +interface IStore { /** * Inserts a key-value pair into the store. * @@ -28,26 +321,15 @@ export class Store { * @param value * @returns */ - async set(key: string, value: unknown): Promise { - return await invoke("plugin:store|set", { - path: this.path, - key, - value, - }); - } + set(key: string, value: unknown): Promise /** - * Returns the value for the given `key` or `null` the key does not exist. + * Returns the value for the given `key` or `undefined` if the key does not exist. * * @param key * @returns */ - async get(key: string): Promise { - return await invoke("plugin:store|get", { - path: this.path, - key, - }); - } + get(key: string): Promise /** * Returns `true` if the given `key` exists in the store. @@ -55,12 +337,7 @@ export class Store { * @param key * @returns */ - async has(key: string): Promise { - return await invoke("plugin:store|has", { - path: this.path, - key, - }); - } + has(key: string): Promise /** * Removes a key-value pair from the store. @@ -68,107 +345,67 @@ export class Store { * @param key * @returns */ - async delete(key: string): Promise { - return await invoke("plugin:store|delete", { - path: this.path, - key, - }); - } + delete(key: string): Promise /** * Clears the store, removing all key-value pairs. * - * Note: To clear the storage and reset it to it's `default` value, use `reset` instead. + * Note: To clear the storage and reset it to its `default` value, use {@linkcode reset} instead. * @returns */ - async clear(): Promise { - return await invoke("plugin:store|clear", { - path: this.path, - }); - } + clear(): Promise /** - * Resets the store to it's `default` value. + * Resets the store to its `default` value. * - * If no default value has been set, this method behaves identical to `clear`. + * If no default value has been set, this method behaves identical to {@linkcode clear}. * @returns */ - async reset(): Promise { - return await invoke("plugin:store|reset", { - path: this.path, - }); - } + reset(): Promise /** - * Returns a list of all key in the store. + * Returns a list of all keys in the store. * * @returns */ - async keys(): Promise { - return await invoke("plugin:store|keys", { - path: this.path, - }); - } + keys(): Promise /** * Returns a list of all values in the store. * * @returns */ - async values(): Promise { - return await invoke("plugin:store|values", { - path: this.path, - }); - } + values(): Promise /** * Returns a list of all entries in the store. * * @returns */ - async entries(): Promise> { - return await invoke("plugin:store|entries", { - path: this.path, - }); - } + entries(): Promise> /** * Returns the number of key-value pairs in the store. * * @returns */ - async length(): Promise { - return await invoke("plugin:store|length", { - path: this.path, - }); - } + length(): Promise /** - * Attempts to load the on-disk state at the stores `path` into memory. + * Attempts to load the on-disk state at the store's `path` into memory. * * This method is useful if the on-disk state was edited by the user and you want to synchronize the changes. * * Note: This method does not emit change events. * @returns */ - async load(): Promise { - return await invoke("plugin:store|load", { - path: this.path, - }); - } + reload(): Promise /** - * Saves the store to disk at the stores `path`. - * - * As the store is only persisted to disk before the apps exit, changes might be lost in a crash. - * This method lets you persist the store to disk whenever you deem necessary. + * Saves the store to disk at the store's `path`. * @returns */ - async save(): Promise { - return await invoke("plugin:store|save", { - path: this.path, - }); - } + save(): Promise /** * Listen to changes on a store key. @@ -178,16 +415,10 @@ export class Store { * * @since 2.0.0 */ - async onKeyChange( + onKeyChange( key: string, - cb: (value: T | null) => void, - ): Promise { - return await listen>("store://change", (event) => { - if (event.payload.path === this.path && event.payload.key === key) { - cb(event.payload.value); - } - }); - } + cb: (value: T | undefined) => void + ): Promise /** * Listen to changes on the store. @@ -196,13 +427,13 @@ export class Store { * * @since 2.0.0 */ - async onChange( - cb: (key: string, value: T | null) => void, - ): Promise { - return await listen>("store://change", (event) => { - if (event.payload.path === this.path) { - cb(event.payload.key, event.payload.value); - } - }); - } + onChange( + cb: (key: string, value: T | undefined) => void + ): Promise + + /** + * Close the store and cleans up this resource from memory. + * **You should not call any method on this object anymore and should drop any reference to it.** + */ + close(): Promise } diff --git a/plugins/store/package.json b/plugins/store/package.json index 3f92f163..a3a28e66 100644 --- a/plugins/store/package.json +++ b/plugins/store/package.json @@ -1,11 +1,12 @@ { "name": "@tauri-apps/plugin-store", - "version": "2.0.0-beta.1", + "version": "2.2.0", "description": "Simple, persistent key-value store.", - "license": "MIT or APACHE-2.0", + "license": "MIT OR Apache-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" ], + "repository": "https://github.com/tauri-apps/plugins-workspace", "type": "module", "types": "./dist-js/index.d.ts", "main": "./dist-js/index.cjs", @@ -24,6 +25,6 @@ "LICENSE" ], "dependencies": { - "@tauri-apps/api": "2.0.0-beta.2" + "@tauri-apps/api": "^2.0.0" } } diff --git a/plugins/store/permissions/autogenerated/commands/get_store.toml b/plugins/store/permissions/autogenerated/commands/get_store.toml new file mode 100644 index 00000000..7c19173a --- /dev/null +++ b/plugins/store/permissions/autogenerated/commands/get_store.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-get-store" +description = "Enables the get_store command without any pre-configured scope." +commands.allow = ["get_store"] + +[[permission]] +identifier = "deny-get-store" +description = "Denies the get_store command without any pre-configured scope." +commands.deny = ["get_store"] diff --git a/plugins/store/permissions/autogenerated/commands/reload.toml b/plugins/store/permissions/autogenerated/commands/reload.toml new file mode 100644 index 00000000..92e25253 --- /dev/null +++ b/plugins/store/permissions/autogenerated/commands/reload.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-reload" +description = "Enables the reload command without any pre-configured scope." +commands.allow = ["reload"] + +[[permission]] +identifier = "deny-reload" +description = "Denies the reload command without any pre-configured scope." +commands.deny = ["reload"] diff --git a/plugins/store/permissions/autogenerated/reference.md b/plugins/store/permissions/autogenerated/reference.md index fd626ff7..7b7d1016 100644 --- a/plugins/store/permissions/autogenerated/reference.md +++ b/plugins/store/permissions/autogenerated/reference.md @@ -1,98 +1,401 @@ -# Permissions +## Default Permission -## allow-clear +This permission set configures what kind of +operations are available from the store plugin. + +#### Granted Permissions + +All operations are enabled by default. + + + +#### This default permission set includes the following: + +- `allow-load` +- `allow-get-store` +- `allow-set` +- `allow-get` +- `allow-has` +- `allow-delete` +- `allow-clear` +- `allow-reset` +- `allow-keys` +- `allow-values` +- `allow-entries` +- `allow-length` +- `allow-reload` +- `allow-save` + +## Permission Table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IdentifierDescription
+ +`store:allow-clear` + + Enables the clear command without any pre-configured scope. -## deny-clear +
+ +`store:deny-clear` + + Denies the clear command without any pre-configured scope. -## allow-delete +
+ +`store:allow-delete` + + Enables the delete command without any pre-configured scope. -## deny-delete +
+ +`store:deny-delete` + + Denies the delete command without any pre-configured scope. -## allow-entries +
+ +`store:allow-entries` + + Enables the entries command without any pre-configured scope. -## deny-entries +
+ +`store:deny-entries` + + Denies the entries command without any pre-configured scope. -## allow-get +
+ +`store:allow-get` + + Enables the get command without any pre-configured scope. -## deny-get +
+ +`store:deny-get` + + Denies the get command without any pre-configured scope. -## allow-has +
+ +`store:allow-get-store` + + + +Enables the get_store command without any pre-configured scope. + +
+ +`store:deny-get-store` + + + +Denies the get_store command without any pre-configured scope. + +
+ +`store:allow-has` + + Enables the has command without any pre-configured scope. -## deny-has +
+ +`store:deny-has` + + Denies the has command without any pre-configured scope. -## allow-keys +
+ +`store:allow-keys` + + Enables the keys command without any pre-configured scope. -## deny-keys +
+ +`store:deny-keys` + + Denies the keys command without any pre-configured scope. -## allow-length +
+ +`store:allow-length` + + Enables the length command without any pre-configured scope. -## deny-length +
+ +`store:deny-length` + + Denies the length command without any pre-configured scope. -## allow-load +
+ +`store:allow-load` + + Enables the load command without any pre-configured scope. -## deny-load +
+ +`store:deny-load` + + Denies the load command without any pre-configured scope. -## allow-reset +
+ +`store:allow-reload` + + + +Enables the reload command without any pre-configured scope. + +
+ +`store:deny-reload` + + + +Denies the reload command without any pre-configured scope. + +
+ +`store:allow-reset` + + Enables the reset command without any pre-configured scope. -## deny-reset +
+ +`store:deny-reset` + + Denies the reset command without any pre-configured scope. -## allow-save +
+ +`store:allow-save` + + Enables the save command without any pre-configured scope. -## deny-save +
+ +`store:deny-save` + + Denies the save command without any pre-configured scope. -## allow-set +
+ +`store:allow-set` + + Enables the set command without any pre-configured scope. -## deny-set +
+ +`store:deny-set` + + Denies the set command without any pre-configured scope. -## allow-values +
+ +`store:allow-values` + + Enables the values command without any pre-configured scope. -## deny-values +
+ +`store:deny-values` + + Denies the values command without any pre-configured scope. +
diff --git a/plugins/store/permissions/default.toml b/plugins/store/permissions/default.toml new file mode 100644 index 00000000..3a3e4b3a --- /dev/null +++ b/plugins/store/permissions/default.toml @@ -0,0 +1,28 @@ +"$schema" = "schemas/schema.json" + +[default] +description = """ +This permission set configures what kind of +operations are available from the store plugin. + +#### Granted Permissions + +All operations are enabled by default. + +""" +permissions = [ + "allow-load", + "allow-get-store", + "allow-set", + "allow-get", + "allow-has", + "allow-delete", + "allow-clear", + "allow-reset", + "allow-keys", + "allow-values", + "allow-entries", + "allow-length", + "allow-reload", + "allow-save", +] diff --git a/plugins/store/permissions/schemas/schema.json b/plugins/store/permissions/schemas/schema.json index dd004c0b..af475189 100644 --- a/plugins/store/permissions/schemas/schema.json +++ b/plugins/store/permissions/schemas/schema.json @@ -17,7 +17,6 @@ }, "set": { "description": "A list of permissions sets defined", - "default": [], "type": "array", "items": { "$ref": "#/definitions/PermissionSet" @@ -50,7 +49,7 @@ "minimum": 1.0 }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -112,7 +111,7 @@ "type": "string" }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri internal convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -132,12 +131,21 @@ }, "scope": { "description": "Allowed or denied scoped when using this permission.", - "default": {}, "allOf": [ { "$ref": "#/definitions/Scopes" } ] + }, + "platforms": { + "description": "Target platforms this permission applies. By default all platforms are affected by this permission.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Target" + } } } }, @@ -164,7 +172,7 @@ } }, "Scopes": { - "description": "A restriction of the command/endpoint functionality.\n\nIt can be of any serde serializable type and is used for allowing or preventing certain actions inside a Tauri command.\n\nThe scope is passed to the command and handled/enforced by the command itself.", + "description": "An argument for fine grained behavior control of Tauri commands.\n\nIt can be of any serde serializable type and is used to allow or prevent certain actions inside a Tauri command. The configured scope is passed to the command and will be enforced by the command implementation.\n\n## Example\n\n```json { \"allow\": [{ \"path\": \"$HOME/**\" }], \"deny\": [{ \"path\": \"$HOME/secret.txt\" }] } ```", "type": "object", "properties": { "allow": { @@ -178,7 +186,7 @@ } }, "deny": { - "description": "Data that defines what is denied by the scope.", + "description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.", "type": [ "array", "null" @@ -243,176 +251,222 @@ } ] }, - "PermissionKind": { - "type": "string", + "Target": { + "description": "Platform target.", "oneOf": [ { - "description": "allow-clear -> Enables the clear command without any pre-configured scope.", + "description": "MacOS.", "type": "string", "enum": [ - "allow-clear" + "macOS" ] }, { - "description": "deny-clear -> Denies the clear command without any pre-configured scope.", + "description": "Windows.", "type": "string", "enum": [ - "deny-clear" + "windows" ] }, { - "description": "allow-delete -> Enables the delete command without any pre-configured scope.", + "description": "Linux.", "type": "string", "enum": [ - "allow-delete" + "linux" ] }, { - "description": "deny-delete -> Denies the delete command without any pre-configured scope.", + "description": "Android.", "type": "string", "enum": [ - "deny-delete" + "android" ] }, { - "description": "allow-entries -> Enables the entries command without any pre-configured scope.", + "description": "iOS.", "type": "string", "enum": [ - "allow-entries" + "iOS" ] + } + ] + }, + "PermissionKind": { + "type": "string", + "oneOf": [ + { + "description": "Enables the clear command without any pre-configured scope.", + "type": "string", + "const": "allow-clear", + "markdownDescription": "Enables the clear command without any pre-configured scope." }, { - "description": "deny-entries -> Denies the entries command without any pre-configured scope.", + "description": "Denies the clear command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-entries" - ] + "const": "deny-clear", + "markdownDescription": "Denies the clear command without any pre-configured scope." }, { - "description": "allow-get -> Enables the get command without any pre-configured scope.", + "description": "Enables the delete command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-get" - ] + "const": "allow-delete", + "markdownDescription": "Enables the delete command without any pre-configured scope." }, { - "description": "deny-get -> Denies the get command without any pre-configured scope.", + "description": "Denies the delete command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-get" - ] + "const": "deny-delete", + "markdownDescription": "Denies the delete command without any pre-configured scope." }, { - "description": "allow-has -> Enables the has command without any pre-configured scope.", + "description": "Enables the entries command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-has" - ] + "const": "allow-entries", + "markdownDescription": "Enables the entries command without any pre-configured scope." }, { - "description": "deny-has -> Denies the has command without any pre-configured scope.", + "description": "Denies the entries command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-has" - ] + "const": "deny-entries", + "markdownDescription": "Denies the entries command without any pre-configured scope." }, { - "description": "allow-keys -> Enables the keys command without any pre-configured scope.", + "description": "Enables the get command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-keys" - ] + "const": "allow-get", + "markdownDescription": "Enables the get command without any pre-configured scope." }, { - "description": "deny-keys -> Denies the keys command without any pre-configured scope.", + "description": "Denies the get command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-keys" - ] + "const": "deny-get", + "markdownDescription": "Denies the get command without any pre-configured scope." }, { - "description": "allow-length -> Enables the length command without any pre-configured scope.", + "description": "Enables the get_store command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-length" - ] + "const": "allow-get-store", + "markdownDescription": "Enables the get_store command without any pre-configured scope." }, { - "description": "deny-length -> Denies the length command without any pre-configured scope.", + "description": "Denies the get_store command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-length" - ] + "const": "deny-get-store", + "markdownDescription": "Denies the get_store command without any pre-configured scope." }, { - "description": "allow-load -> Enables the load command without any pre-configured scope.", + "description": "Enables the has command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-load" - ] + "const": "allow-has", + "markdownDescription": "Enables the has command without any pre-configured scope." }, { - "description": "deny-load -> Denies the load command without any pre-configured scope.", + "description": "Denies the has command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-load" - ] + "const": "deny-has", + "markdownDescription": "Denies the has command without any pre-configured scope." }, { - "description": "allow-reset -> Enables the reset command without any pre-configured scope.", + "description": "Enables the keys command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-reset" - ] + "const": "allow-keys", + "markdownDescription": "Enables the keys command without any pre-configured scope." }, { - "description": "deny-reset -> Denies the reset command without any pre-configured scope.", + "description": "Denies the keys command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-reset" - ] + "const": "deny-keys", + "markdownDescription": "Denies the keys command without any pre-configured scope." }, { - "description": "allow-save -> Enables the save command without any pre-configured scope.", + "description": "Enables the length command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-save" - ] + "const": "allow-length", + "markdownDescription": "Enables the length command without any pre-configured scope." }, { - "description": "deny-save -> Denies the save command without any pre-configured scope.", + "description": "Denies the length command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-save" - ] + "const": "deny-length", + "markdownDescription": "Denies the length command without any pre-configured scope." }, { - "description": "allow-set -> Enables the set command without any pre-configured scope.", + "description": "Enables the load command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-set" - ] + "const": "allow-load", + "markdownDescription": "Enables the load command without any pre-configured scope." }, { - "description": "deny-set -> Denies the set command without any pre-configured scope.", + "description": "Denies the load command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-set" - ] + "const": "deny-load", + "markdownDescription": "Denies the load command without any pre-configured scope." }, { - "description": "allow-values -> Enables the values command without any pre-configured scope.", + "description": "Enables the reload command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-values" - ] + "const": "allow-reload", + "markdownDescription": "Enables the reload command without any pre-configured scope." }, { - "description": "deny-values -> Denies the values command without any pre-configured scope.", + "description": "Denies the reload command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-values" - ] + "const": "deny-reload", + "markdownDescription": "Denies the reload command without any pre-configured scope." + }, + { + "description": "Enables the reset command without any pre-configured scope.", + "type": "string", + "const": "allow-reset", + "markdownDescription": "Enables the reset command without any pre-configured scope." + }, + { + "description": "Denies the reset command without any pre-configured scope.", + "type": "string", + "const": "deny-reset", + "markdownDescription": "Denies the reset command without any pre-configured scope." + }, + { + "description": "Enables the save command without any pre-configured scope.", + "type": "string", + "const": "allow-save", + "markdownDescription": "Enables the save command without any pre-configured scope." + }, + { + "description": "Denies the save command without any pre-configured scope.", + "type": "string", + "const": "deny-save", + "markdownDescription": "Denies the save command without any pre-configured scope." + }, + { + "description": "Enables the set command without any pre-configured scope.", + "type": "string", + "const": "allow-set", + "markdownDescription": "Enables the set command without any pre-configured scope." + }, + { + "description": "Denies the set command without any pre-configured scope.", + "type": "string", + "const": "deny-set", + "markdownDescription": "Denies the set command without any pre-configured scope." + }, + { + "description": "Enables the values command without any pre-configured scope.", + "type": "string", + "const": "allow-values", + "markdownDescription": "Enables the values command without any pre-configured scope." + }, + { + "description": "Denies the values command without any pre-configured scope.", + "type": "string", + "const": "deny-values", + "markdownDescription": "Denies the values command without any pre-configured scope." + }, + { + "description": "This permission set configures what kind of\noperations are available from the store plugin.\n\n#### Granted Permissions\n\nAll operations are enabled by default.\n\n\n#### This default permission set includes:\n\n- `allow-load`\n- `allow-get-store`\n- `allow-set`\n- `allow-get`\n- `allow-has`\n- `allow-delete`\n- `allow-clear`\n- `allow-reset`\n- `allow-keys`\n- `allow-values`\n- `allow-entries`\n- `allow-length`\n- `allow-reload`\n- `allow-save`", + "type": "string", + "const": "default", + "markdownDescription": "This permission set configures what kind of\noperations are available from the store plugin.\n\n#### Granted Permissions\n\nAll operations are enabled by default.\n\n\n#### This default permission set includes:\n\n- `allow-load`\n- `allow-get-store`\n- `allow-set`\n- `allow-get`\n- `allow-has`\n- `allow-delete`\n- `allow-clear`\n- `allow-reset`\n- `allow-keys`\n- `allow-values`\n- `allow-entries`\n- `allow-length`\n- `allow-reload`\n- `allow-save`" } ] } diff --git a/plugins/store/rollup.config.js b/plugins/store/rollup.config.js index 977dfac8..1f349ec8 100644 --- a/plugins/store/rollup.config.js +++ b/plugins/store/rollup.config.js @@ -2,6 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { createConfig } from "../../shared/rollup.config.js"; +import { createConfig } from '../../shared/rollup.config.js' -export default createConfig(); +export default createConfig() diff --git a/plugins/store/src/api-iife.js b/plugins/store/src/api-iife.js deleted file mode 100644 index 15eaf751..00000000 --- a/plugins/store/src/api-iife.js +++ /dev/null @@ -1 +0,0 @@ -if("__TAURI__"in window){var __TAURI_PLUGIN_STORE__=function(t){"use strict";function a(t,a=!1){return window.__TAURI_INTERNALS__.transformCallback(t,a)}async function e(t,a={},e){return window.__TAURI_INTERNALS__.invoke(t,a,e)}var n;async function r(t,n,r){const i="string"==typeof r?.target?{kind:"AnyLabel",label:r.target}:r?.target??{kind:"Any"};return e("plugin:event|listen",{event:t,target:i,handler:a(n)}).then((a=>async()=>async function(t,a){await e("plugin:event|unlisten",{event:t,eventId:a})}(t,a)))}"function"==typeof SuppressedError&&SuppressedError,function(t){t.WINDOW_RESIZED="tauri://resize",t.WINDOW_MOVED="tauri://move",t.WINDOW_CLOSE_REQUESTED="tauri://close-requested",t.WINDOW_DESTROYED="tauri://destroyed",t.WINDOW_FOCUS="tauri://focus",t.WINDOW_BLUR="tauri://blur",t.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",t.WINDOW_THEME_CHANGED="tauri://theme-changed",t.WEBVIEW_CREATED="tauri://webview-created",t.FILE_DROP="tauri://file-drop",t.FILE_DROP_HOVER="tauri://file-drop-hover",t.FILE_DROP_CANCELLED="tauri://file-drop-cancelled"}(n||(n={}));return t.Store=class{constructor(t){this.path=t}async set(t,a){return await e("plugin:store|set",{path:this.path,key:t,value:a})}async get(t){return await e("plugin:store|get",{path:this.path,key:t})}async has(t){return await e("plugin:store|has",{path:this.path,key:t})}async delete(t){return await e("plugin:store|delete",{path:this.path,key:t})}async clear(){return await e("plugin:store|clear",{path:this.path})}async reset(){return await e("plugin:store|reset",{path:this.path})}async keys(){return await e("plugin:store|keys",{path:this.path})}async values(){return await e("plugin:store|values",{path:this.path})}async entries(){return await e("plugin:store|entries",{path:this.path})}async length(){return await e("plugin:store|length",{path:this.path})}async load(){return await e("plugin:store|load",{path:this.path})}async save(){return await e("plugin:store|save",{path:this.path})}async onKeyChange(t,a){return await r("store://change",(e=>{e.payload.path===this.path&&e.payload.key===t&&a(e.payload.value)}))}async onChange(t){return await r("store://change",(a=>{a.payload.path===this.path&&t(a.payload.key,a.payload.value)}))}},t}({});Object.defineProperty(window.__TAURI__,"store",{value:__TAURI_PLUGIN_STORE__})} diff --git a/plugins/store/src/error.rs b/plugins/store/src/error.rs index 0a04bb09..ef5ee593 100644 --- a/plugins/store/src/error.rs +++ b/plugins/store/src/error.rs @@ -3,7 +3,8 @@ // SPDX-License-Identifier: MIT use serde::{Serialize, Serializer}; -use std::path::PathBuf; + +pub type Result = std::result::Result; /// The error types. #[derive(thiserror::Error, Debug)] @@ -19,9 +20,15 @@ pub enum Error { /// IO error. #[error(transparent)] Io(#[from] std::io::Error), - /// Store not found - #[error("Store \"{0}\" not found")] - NotFound(PathBuf), + // /// Store already exists + // #[error("Store at \"{0}\" already exists")] + // AlreadyExists(PathBuf), + /// Serialize function not found + #[error("Serialize Function \"{0}\" not found")] + SerializeFunctionNotFound(String), + /// Deserialize function not found + #[error("Deserialize Function \"{0}\" not found")] + DeserializeFunctionNotFound(String), /// Some Tauri API failed #[error(transparent)] Tauri(#[from] tauri::Error), diff --git a/plugins/store/src/lib.rs b/plugins/store/src/lib.rs index f76752f8..0e59cd81 100644 --- a/plugins/store/src/lib.rs +++ b/plugins/store/src/lib.rs @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -//! [![](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/store/banner.png)](https://github.com/tauri-apps/plugins-workspace/tree/v2/plugins/store) -//! //! Simple, persistent key-value store. #![doc( @@ -11,315 +9,431 @@ html_favicon_url = "https://github.com/tauri-apps/tauri/raw/dev/app-icon.png" )] -pub use error::Error; -use log::warn; -use serde::Serialize; +pub use error::{Error, Result}; +use serde::{Deserialize, Serialize}; pub use serde_json::Value as JsonValue; use std::{ collections::HashMap, path::{Path, PathBuf}, - sync::Mutex, + sync::{Arc, Mutex}, + time::Duration, }; -pub use store::{Store, StoreBuilder}; +pub use store::{resolve_store_path, DeserializeFn, SerializeFn, Store, StoreBuilder}; use tauri::{ plugin::{self, TauriPlugin}, - AppHandle, Manager, RunEvent, Runtime, State, + AppHandle, Manager, ResourceId, RunEvent, Runtime, State, }; mod error; mod store; #[derive(Serialize, Clone)] +#[serde(rename_all = "camelCase")] struct ChangePayload<'a> { path: &'a Path, + resource_id: Option, key: &'a str, - value: &'a JsonValue, + value: Option<&'a JsonValue>, + exists: bool, } -#[derive(Default)] -pub struct StoreCollection { - stores: Mutex>>, - frozen: bool, +#[derive(Debug)] +struct StoreState { + stores: Arc>>, + serialize_fns: HashMap, + deserialize_fns: HashMap, + default_serialize: SerializeFn, + default_deserialize: DeserializeFn, } -pub fn with_store) -> Result>( +#[derive(Serialize, Deserialize)] +#[serde(untagged)] +enum AutoSave { + DebounceDuration(u64), + Bool(bool), +} + +fn builder( app: AppHandle, - collection: State<'_, StoreCollection>, - path: impl AsRef, - f: F, -) -> Result { - let mut stores = collection.stores.lock().expect("mutex poisoned"); - - let path = path.as_ref(); - if !stores.contains_key(path) { - if collection.frozen { - return Err(Error::NotFound(path.to_path_buf())); - } - let mut store = StoreBuilder::new(path).build(app); - // ignore loading errors, just use the default - if let Err(err) = store.load() { - warn!( - "Failed to load store {:?} from disk: {}. Falling back to default values.", - path, err - ); + store_state: State<'_, StoreState>, + path: PathBuf, + auto_save: Option, + serialize_fn_name: Option, + deserialize_fn_name: Option, + create_new: bool, +) -> Result> { + let mut builder = app.store_builder(path); + if let Some(auto_save) = auto_save { + match auto_save { + AutoSave::DebounceDuration(duration) => { + builder = builder.auto_save(Duration::from_millis(duration)); + } + AutoSave::Bool(false) => { + builder = builder.disable_auto_save(); + } + _ => {} } - stores.insert(path.to_path_buf(), store); } - f(stores - .get_mut(path) - .expect("failed to retrieve store. This is a bug!")) + if let Some(serialize_fn_name) = serialize_fn_name { + let serialize_fn = store_state + .serialize_fns + .get(&serialize_fn_name) + .ok_or_else(|| crate::Error::SerializeFunctionNotFound(serialize_fn_name))?; + builder = builder.serialize(*serialize_fn); + } + + if let Some(deserialize_fn_name) = deserialize_fn_name { + let deserialize_fn = store_state + .deserialize_fns + .get(&deserialize_fn_name) + .ok_or_else(|| crate::Error::DeserializeFunctionNotFound(deserialize_fn_name))?; + builder = builder.deserialize(*deserialize_fn); + } + + if create_new { + builder = builder.create_new(); + } + + Ok(builder) } #[tauri::command] -async fn set( +async fn load( app: AppHandle, - stores: State<'_, StoreCollection>, + store_state: State<'_, StoreState>, path: PathBuf, - key: String, - value: JsonValue, -) -> Result<(), Error> { - with_store(app, stores, path, |store| store.insert(key, value)) + auto_save: Option, + serialize_fn_name: Option, + deserialize_fn_name: Option, + create_new: Option, +) -> Result { + let builder = builder( + app, + store_state, + path, + auto_save, + serialize_fn_name, + deserialize_fn_name, + create_new.unwrap_or_default(), + )?; + let (_, rid) = builder.build_inner()?; + Ok(rid) } #[tauri::command] -async fn get( +async fn get_store( app: AppHandle, - stores: State<'_, StoreCollection>, + store_state: State<'_, StoreState>, path: PathBuf, - key: String, -) -> Result, Error> { - with_store(app, stores, path, |store| Ok(store.get(key).cloned())) +) -> Result> { + let stores = store_state.stores.lock().unwrap(); + Ok(stores.get(&resolve_store_path(&app, path)?).copied()) } #[tauri::command] -async fn has( +async fn set( app: AppHandle, - stores: State<'_, StoreCollection>, - path: PathBuf, + rid: ResourceId, key: String, -) -> Result { - with_store(app, stores, path, |store| Ok(store.has(key))) + value: JsonValue, +) -> Result<()> { + let store = app.resources_table().get::>(rid)?; + store.set(key, value); + Ok(()) } #[tauri::command] -async fn delete( +async fn get( app: AppHandle, - stores: State<'_, StoreCollection>, - path: PathBuf, + rid: ResourceId, key: String, -) -> Result { - with_store(app, stores, path, |store| store.delete(key)) +) -> Result<(Option, bool)> { + let store = app.resources_table().get::>(rid)?; + let value = store.get(key); + let exists = value.is_some(); + Ok((value, exists)) } #[tauri::command] -async fn clear( - app: AppHandle, - stores: State<'_, StoreCollection>, - path: PathBuf, -) -> Result<(), Error> { - with_store(app, stores, path, |store| store.clear()) +async fn has(app: AppHandle, rid: ResourceId, key: String) -> Result { + let store = app.resources_table().get::>(rid)?; + Ok(store.has(key)) } #[tauri::command] -async fn reset( - app: AppHandle, - collection: State<'_, StoreCollection>, - path: PathBuf, -) -> Result<(), Error> { - with_store(app, collection, path, |store| store.reset()) +async fn delete(app: AppHandle, rid: ResourceId, key: String) -> Result { + let store = app.resources_table().get::>(rid)?; + Ok(store.delete(key)) } #[tauri::command] -async fn keys( - app: AppHandle, - stores: State<'_, StoreCollection>, - path: PathBuf, -) -> Result, Error> { - with_store(app, stores, path, |store| { - Ok(store.keys().cloned().collect()) - }) +async fn clear(app: AppHandle, rid: ResourceId) -> Result<()> { + let store = app.resources_table().get::>(rid)?; + store.clear(); + Ok(()) } #[tauri::command] -async fn values( - app: AppHandle, - stores: State<'_, StoreCollection>, - path: PathBuf, -) -> Result, Error> { - with_store(app, stores, path, |store| { - Ok(store.values().cloned().collect()) - }) +async fn reset(app: AppHandle, rid: ResourceId) -> Result<()> { + let store = app.resources_table().get::>(rid)?; + store.reset(); + Ok(()) } #[tauri::command] -async fn entries( - app: AppHandle, - stores: State<'_, StoreCollection>, - path: PathBuf, -) -> Result, Error> { - with_store(app, stores, path, |store| { - Ok(store - .entries() - .map(|(k, v)| (k.to_owned(), v.to_owned())) - .collect()) - }) +async fn keys(app: AppHandle, rid: ResourceId) -> Result> { + let store = app.resources_table().get::>(rid)?; + Ok(store.keys()) } #[tauri::command] -async fn length( - app: AppHandle, - stores: State<'_, StoreCollection>, - path: PathBuf, -) -> Result { - with_store(app, stores, path, |store| Ok(store.len())) +async fn values(app: AppHandle, rid: ResourceId) -> Result> { + let store = app.resources_table().get::>(rid)?; + Ok(store.values()) } #[tauri::command] -async fn load( +async fn entries( app: AppHandle, - stores: State<'_, StoreCollection>, - path: PathBuf, -) -> Result<(), Error> { - with_store(app, stores, path, |store| store.load()) + rid: ResourceId, +) -> Result> { + let store = app.resources_table().get::>(rid)?; + Ok(store.entries()) } #[tauri::command] -async fn save( - app: AppHandle, - stores: State<'_, StoreCollection>, - path: PathBuf, -) -> Result<(), Error> { - with_store(app, stores, path, |store| store.save()) +async fn length(app: AppHandle, rid: ResourceId) -> Result { + let store = app.resources_table().get::>(rid)?; + Ok(store.length()) } -// #[derive(Default)] -pub struct Builder { - stores: HashMap>, - frozen: bool, +#[tauri::command] +async fn reload(app: AppHandle, rid: ResourceId) -> Result<()> { + let store = app.resources_table().get::>(rid)?; + store.reload() } -impl Default for Builder { - fn default() -> Self { - Self { - stores: Default::default(), - frozen: false, - } - } +#[tauri::command] +async fn save(app: AppHandle, rid: ResourceId) -> Result<()> { + let store = app.resources_table().get::>(rid)?; + store.save() } -impl Builder { - pub fn new() -> Self { - Self::default() - } - - /// Registers a store with the plugin. +pub trait StoreExt { + /// Create a store or load an existing store with default settings at the given path. + /// + /// If the store is already loaded, its instance is automatically returned. /// /// # Examples /// /// ``` - /// use tauri_plugin_store::{StoreBuilder, Builder}; + /// use tauri_plugin_store::StoreExt; /// /// tauri::Builder::default() + /// .plugin(tauri_plugin_store::Builder::default().build()) /// .setup(|app| { - /// let store = StoreBuilder::new("store.bin").build(app.handle().clone()); - /// let builder = Builder::default().store(store); + /// let store = app.store("my-store")?; /// Ok(()) /// }); /// ``` - pub fn store(mut self, store: Store) -> Self { - self.stores.insert(store.path.clone(), store); - self - } - - /// Registers multiple stores with the plugin. + fn store(&self, path: impl AsRef) -> Result>>; + /// Get a store builder. + /// + /// The builder can be used to configure the store. + /// To use the default settings see [`Self::store`]. /// /// # Examples /// /// ``` - /// use tauri_plugin_store::{StoreBuilder, Builder}; + /// use tauri_plugin_store::StoreExt; + /// use std::time::Duration; /// /// tauri::Builder::default() + /// .plugin(tauri_plugin_store::Builder::default().build()) /// .setup(|app| { - /// let store = StoreBuilder::new("store.bin").build(app.handle().clone()); - /// let builder = Builder::default().stores([store]); + /// let store = app.store_builder("users.json").auto_save(Duration::from_secs(1)).build()?; /// Ok(()) /// }); /// ``` - pub fn stores>>(mut self, stores: T) -> Self { - self.stores = stores - .into_iter() - .map(|store| (store.path.clone(), store)) - .collect(); - self - } - - /// Freezes the collection. + fn store_builder(&self, path: impl AsRef) -> StoreBuilder; + /// Get a handle of an already loaded store. + /// + /// If the store is not loaded or does not exist, it returns `None`. /// - /// This causes requests for plugins that haven't been registered to fail + /// Note that using this function can cause race conditions if you fallback to creating or loading the store, + /// so you should consider using [`Self::store`] if you are not sure if the store is loaded or not. /// /// # Examples /// /// ``` - /// use tauri_plugin_store::{StoreBuilder, Builder}; + /// use tauri_plugin_store::StoreExt; /// /// tauri::Builder::default() + /// .plugin(tauri_plugin_store::Builder::default().build()) /// .setup(|app| { - /// let store = StoreBuilder::new("store.bin").build(app.handle().clone()); - /// app.handle().plugin(Builder::default().freeze().build()); + /// let store = if let Some(s) = app.get_store("store.json") { + /// s + /// } else { + /// // this is not thread safe; if another thread is doing the same load/create, + /// // there will be a race condition; in this case we could remove the get_store + /// // and only run app.store() as it will return the existing store if it has been loaded + /// app.store("store.json")? + /// }; /// Ok(()) /// }); /// ``` - pub fn freeze(mut self) -> Self { - self.frozen = true; + fn get_store(&self, path: impl AsRef) -> Option>>; +} + +impl> StoreExt for T { + fn store(&self, path: impl AsRef) -> Result>> { + StoreBuilder::new(self.app_handle(), path).build() + } + + fn store_builder(&self, path: impl AsRef) -> StoreBuilder { + StoreBuilder::new(self.app_handle(), path) + } + + fn get_store(&self, path: impl AsRef) -> Option>> { + let collection = self.state::(); + let stores = collection.stores.lock().unwrap(); + stores + .get(&resolve_store_path(self.app_handle(), path.as_ref()).ok()?) + .and_then(|rid| self.resources_table().get(*rid).ok()) + } +} + +fn default_serialize( + cache: &HashMap, +) -> std::result::Result, Box> { + Ok(serde_json::to_vec_pretty(&cache)?) +} + +fn default_deserialize( + bytes: &[u8], +) -> std::result::Result, Box> { + serde_json::from_slice(bytes).map_err(Into::into) +} + +pub struct Builder { + serialize_fns: HashMap, + deserialize_fns: HashMap, + default_serialize: SerializeFn, + default_deserialize: DeserializeFn, +} + +impl Default for Builder { + fn default() -> Self { + Self { + serialize_fns: Default::default(), + deserialize_fns: Default::default(), + default_serialize, + default_deserialize, + } + } +} + +impl Builder { + pub fn new() -> Self { + Self::default() + } + + /// Register a serialize function to access it from the JavaScript side + /// + /// # Examples + /// + /// ``` + /// fn no_pretty_json( + /// cache: &std::collections::HashMap, + /// ) -> Result, Box> { + /// Ok(serde_json::to_vec(&cache)?) + /// } + /// + /// tauri::Builder::default() + /// .plugin( + /// tauri_plugin_store::Builder::default() + /// .register_serialize_fn("no-pretty-json".to_owned(), no_pretty_json) + /// .build(), + /// ); + /// ``` + pub fn register_serialize_fn(mut self, name: String, serialize_fn: SerializeFn) -> Self { + self.serialize_fns.insert(name, serialize_fn); self } - /// Builds the plugin. + /// Register a deserialize function to access it from the JavaScript side + pub fn register_deserialize_fn(mut self, name: String, deserialize_fn: DeserializeFn) -> Self { + self.deserialize_fns.insert(name, deserialize_fn); + self + } + + /// Use this serialize function for stores by default /// /// # Examples /// /// ``` - /// use tauri_plugin_store::{StoreBuilder, Builder}; + /// fn no_pretty_json( + /// cache: &std::collections::HashMap, + /// ) -> Result, Box> { + /// Ok(serde_json::to_vec(&cache)?) + /// } + /// + /// tauri::Builder::default() + /// .plugin( + /// tauri_plugin_store::Builder::default() + /// .default_serialize_fn(no_pretty_json) + /// .build(), + /// ); + /// ``` + pub fn default_serialize_fn(mut self, serialize_fn: SerializeFn) -> Self { + self.default_serialize = serialize_fn; + self + } + + /// Use this deserialize function for stores by default + pub fn default_deserialize_fn(mut self, deserialize_fn: DeserializeFn) -> Self { + self.default_deserialize = deserialize_fn; + self + } + + /// Builds the plugin. + /// + /// # Examples /// + /// ``` /// tauri::Builder::default() + /// .plugin(tauri_plugin_store::Builder::default().build()) /// .setup(|app| { - /// let store = StoreBuilder::new("store.bin").build(app.handle().clone()); - /// app.handle().plugin(Builder::default().build()); + /// let store = tauri_plugin_store::StoreBuilder::new(app, "store.bin").build()?; /// Ok(()) /// }); /// ``` - pub fn build(mut self) -> TauriPlugin { + pub fn build(self) -> TauriPlugin { plugin::Builder::new("store") - .js_init_script(include_str!("api-iife.js").to_string()) .invoke_handler(tauri::generate_handler![ - set, get, has, delete, clear, reset, keys, values, length, entries, load, save + load, get_store, set, get, has, delete, clear, reset, keys, values, length, + entries, reload, save, ]) .setup(move |app_handle, _api| { - for (path, store) in self.stores.iter_mut() { - // ignore loading errors, just use the default - if let Err(err) = store.load() { - warn!( - "Failed to load store {:?} from disk: {}. Falling back to default values.", - path, err - ); - } - } - - app_handle.manage(StoreCollection { - stores: Mutex::new(self.stores), - frozen: self.frozen, + app_handle.manage(StoreState { + stores: Arc::new(Mutex::new(HashMap::new())), + serialize_fns: self.serialize_fns, + deserialize_fns: self.deserialize_fns, + default_serialize: self.default_serialize, + default_deserialize: self.default_deserialize, }); - Ok(()) }) .on_event(|app_handle, event| { if let RunEvent::Exit = event { - let collection = app_handle.state::>(); - - for store in collection.stores.lock().expect("mutex poisoned").values() { - if let Err(err) = store.save() { - eprintln!("failed to save store {:?} with error {:?}", store.path, err); + let collection = app_handle.state::(); + let stores = collection.stores.lock().unwrap(); + for (path, rid) in stores.iter() { + if let Ok(store) = app_handle.resources_table().get::>(*rid) { + if let Err(err) = store.save() { + tracing::error!("failed to save store {path:?} with error {err:?}"); + } } } } diff --git a/plugins/store/src/store.rs b/plugins/store/src/store.rs index 1a7b6e1b..1dc5e1d2 100644 --- a/plugins/store/src/store.rs +++ b/plugins/store/src/store.rs @@ -2,62 +2,70 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -use crate::{ChangePayload, Error}; +use crate::{ChangePayload, StoreState}; use serde_json::Value as JsonValue; use std::{ collections::HashMap, - fs::{create_dir_all, read, File}, - io::Write, + fs, path::{Path, PathBuf}, + sync::{Arc, Mutex}, + time::Duration, +}; +use tauri::{path::BaseDirectory, AppHandle, Emitter, Manager, Resource, ResourceId, Runtime}; +use tokio::{ + select, + sync::mpsc::{unbounded_channel, UnboundedSender}, + time::sleep, }; -use tauri::{AppHandle, Manager, Runtime}; -type SerializeFn = +pub type SerializeFn = fn(&HashMap) -> Result, Box>; -type DeserializeFn = +pub type DeserializeFn = fn(&[u8]) -> Result, Box>; -fn default_serialize( - cache: &HashMap, -) -> Result, Box> { - Ok(serde_json::to_vec(&cache)?) -} - -fn default_deserialize( - bytes: &[u8], -) -> Result, Box> { - serde_json::from_slice(bytes).map_err(Into::into) +pub fn resolve_store_path( + app: &AppHandle, + path: impl AsRef, +) -> crate::Result { + Ok(dunce::simplified(&app.path().resolve(path, BaseDirectory::AppData)?).to_path_buf()) } /// Builds a [`Store`] -pub struct StoreBuilder { +pub struct StoreBuilder { + app: AppHandle, path: PathBuf, defaults: Option>, - cache: HashMap, - serialize: SerializeFn, - deserialize: DeserializeFn, + serialize_fn: SerializeFn, + deserialize_fn: DeserializeFn, + auto_save: Option, + create_new: bool, } -impl StoreBuilder { +impl StoreBuilder { /// Creates a new [`StoreBuilder`]. /// /// # Examples /// ``` - /// # fn main() -> Result<(), Box> { - /// use tauri_plugin_store::StoreBuilder; - /// - /// let builder = StoreBuilder::new("store.bin"); - /// - /// # Ok(()) - /// # } + /// tauri::Builder::default() + /// .plugin(tauri_plugin_store::Builder::default().build()) + /// .setup(|app| { + /// let builder = tauri_plugin_store::StoreBuilder::new(app, "store.bin"); + /// Ok(()) + /// }); /// ``` - pub fn new>(path: P) -> Self { + pub fn new, P: AsRef>(manager: &M, path: P) -> Self { + let app = manager.app_handle().clone(); + let state = app.state::(); + let serialize_fn = state.default_serialize; + let deserialize_fn = state.default_deserialize; Self { + app, path: path.as_ref().to_path_buf(), defaults: None, - cache: Default::default(), - serialize: default_serialize, - deserialize: default_deserialize, + serialize_fn, + deserialize_fn, + auto_save: Some(Duration::from_millis(100)), + create_new: false, } } @@ -65,39 +73,39 @@ impl StoreBuilder { /// /// # Examples /// ``` - /// # fn main() -> Result<(), Box> { - /// use tauri_plugin_store::StoreBuilder; - /// use std::collections::HashMap; - /// - /// let mut defaults = HashMap::new(); - /// - /// defaults.insert("foo".to_string(), "bar".into()); - /// - /// let builder = StoreBuilder::new("store.bin") - /// .defaults(defaults); + /// tauri::Builder::default() + /// .plugin(tauri_plugin_store::Builder::default().build()) + /// .setup(|app| { + /// let mut defaults = std::collections::HashMap::new(); + /// defaults.insert("foo".to_string(), "bar".into()); /// - /// # Ok(()) - /// # } + /// let store = tauri_plugin_store::StoreBuilder::new(app, "store.bin") + /// .defaults(defaults) + /// .build()?; + /// Ok(()) + /// }); + /// ``` pub fn defaults(mut self, defaults: HashMap) -> Self { - self.cache = defaults.clone(); self.defaults = Some(defaults); self } - /// Inserts multiple key-value pairs. + /// Inserts multiple default key-value pairs. /// /// # Examples /// ``` - /// # fn main() -> Result<(), Box> { - /// use tauri_plugin_store::StoreBuilder; - /// - /// let builder = StoreBuilder::new("store.bin") - /// .default("foo".to_string(), "bar".into()); - /// - /// # Ok(()) - /// # } - pub fn default(mut self, key: String, value: JsonValue) -> Self { - self.cache.insert(key.clone(), value.clone()); + /// tauri::Builder::default() + /// .plugin(tauri_plugin_store::Builder::default().build()) + /// .setup(|app| { + /// let store = tauri_plugin_store::StoreBuilder::new(app, "store.bin") + /// .default("foo".to_string(), "bar") + /// .build()?; + /// Ok(()) + /// }); + /// ``` + pub fn default(mut self, key: impl Into, value: impl Into) -> Self { + let key = key.into(); + let value = value.into(); self.defaults .get_or_insert(HashMap::new()) .insert(key, value); @@ -108,16 +116,17 @@ impl StoreBuilder { /// /// # Examples /// ``` - /// # fn main() -> Result<(), Box> { - /// use tauri_plugin_store::StoreBuilder; - /// - /// let builder = StoreBuilder::new("store.json") - /// .serialize(|cache| serde_json::to_vec(&cache).map_err(Into::into)); - /// - /// # Ok(()) - /// # } + /// tauri::Builder::default() + /// .plugin(tauri_plugin_store::Builder::default().build()) + /// .setup(|app| { + /// let store = tauri_plugin_store::StoreBuilder::new(app, "store.json") + /// .serialize(|cache| serde_json::to_vec(&cache).map_err(Into::into)) + /// .build()?; + /// Ok(()) + /// }); + /// ``` pub fn serialize(mut self, serialize: SerializeFn) -> Self { - self.serialize = serialize; + self.serialize_fn = serialize; self } @@ -125,192 +134,443 @@ impl StoreBuilder { /// /// # Examples /// ``` - /// # fn main() -> Result<(), Box> { - /// use tauri_plugin_store::StoreBuilder; - /// - /// let builder = StoreBuilder::new("store.json") - /// .deserialize(|bytes| serde_json::from_slice(&bytes).map_err(Into::into)); - /// - /// # Ok(()) - /// # } + /// tauri::Builder::default() + /// .plugin(tauri_plugin_store::Builder::default().build()) + /// .setup(|app| { + /// let store = tauri_plugin_store::StoreBuilder::new(app, "store.json") + /// .deserialize(|bytes| serde_json::from_slice(&bytes).map_err(Into::into)) + /// .build()?; + /// Ok(()) + /// }); + /// ``` pub fn deserialize(mut self, deserialize: DeserializeFn) -> Self { - self.deserialize = deserialize; + self.deserialize_fn = deserialize; self } - /// Builds the [`Store`]. + /// Auto save on modified with a debounce duration /// /// # Examples /// ``` /// tauri::Builder::default() + /// .plugin(tauri_plugin_store::Builder::default().build()) /// .setup(|app| { - /// let store = tauri_plugin_store::StoreBuilder::new("store.json").build(app.handle().clone()); + /// let store = tauri_plugin_store::StoreBuilder::new(app, "store.json") + /// .auto_save(std::time::Duration::from_millis(100)) + /// .build()?; /// Ok(()) /// }); /// ``` - pub fn build(self, app: AppHandle) -> Store { - Store { - app, - path: self.path, - defaults: self.defaults, - cache: self.cache, - serialize: self.serialize, - deserialize: self.deserialize, + pub fn auto_save(mut self, debounce_duration: Duration) -> Self { + self.auto_save = Some(debounce_duration); + self + } + + /// Disable auto save on modified with a debounce duration. + pub fn disable_auto_save(mut self) -> Self { + self.auto_save = None; + self + } + + /// Force create a new store with default values even if it already exists. + pub fn create_new(mut self) -> Self { + self.create_new = true; + self + } + + pub(crate) fn build_inner(mut self) -> crate::Result<(Arc>, ResourceId)> { + let stores = self.app.state::().stores.clone(); + let mut stores = stores.lock().unwrap(); + + self.path = resolve_store_path(&self.app, self.path)?; + + if self.create_new { + if let Some(rid) = stores.remove(&self.path) { + let _ = self.app.resources_table().take::>(rid); + } + } else if let Some(rid) = stores.get(&self.path) { + return Ok((self.app.resources_table().get(*rid).unwrap(), *rid)); + } + + // if stores.contains_key(&self.path) { + // return Err(crate::Error::AlreadyExists(self.path)); + // } + + let mut store_inner = StoreInner::new( + self.app.clone(), + self.path.clone(), + self.defaults.take(), + self.serialize_fn, + self.deserialize_fn, + ); + + if !self.create_new { + let _ = store_inner.load(); } + + let store = Store { + auto_save: self.auto_save, + auto_save_debounce_sender: Arc::new(Mutex::new(None)), + store: Arc::new(Mutex::new(store_inner)), + }; + + let store = Arc::new(store); + let rid = self.app.resources_table().add_arc(store.clone()); + stores.insert(self.path, rid); + + Ok((store, rid)) + } + + /// Load the existing store with the same path or creates a new [`Store`]. + /// + /// If a store with the same path has already been loaded its instance is returned. + /// + /// # Examples + /// ``` + /// tauri::Builder::default() + /// .plugin(tauri_plugin_store::Builder::default().build()) + /// .setup(|app| { + /// let store = tauri_plugin_store::StoreBuilder::new(app, "store.json").build(); + /// Ok(()) + /// }); + /// ``` + pub fn build(self) -> crate::Result>> { + let (store, _) = self.build_inner()?; + Ok(store) } } +enum AutoSaveMessage { + Reset, + Cancel, +} + #[derive(Clone)] -pub struct Store { +struct StoreInner { app: AppHandle, - pub(crate) path: PathBuf, - defaults: Option>, + path: PathBuf, cache: HashMap, - serialize: SerializeFn, - deserialize: DeserializeFn, + defaults: Option>, + serialize_fn: SerializeFn, + deserialize_fn: DeserializeFn, } -impl Store { - /// Update the store from the on-disk state - pub fn load(&mut self) -> Result<(), Error> { - let app_dir = self - .app - .path() - .app_data_dir() - .expect("failed to resolve app dir"); - let store_path = app_dir.join(&self.path); +impl StoreInner { + fn new( + app: AppHandle, + path: PathBuf, + defaults: Option>, + serialize_fn: SerializeFn, + deserialize_fn: DeserializeFn, + ) -> Self { + Self { + app, + path, + cache: defaults.clone().unwrap_or_default(), + defaults, + serialize_fn, + deserialize_fn, + } + } - let bytes = read(store_path)?; + /// Saves the store to disk at the store's `path`. + pub fn save(&self) -> crate::Result<()> { + fs::create_dir_all(self.path.parent().expect("invalid store path"))?; - self.cache - .extend((self.deserialize)(&bytes).map_err(Error::Deserialize)?); + let bytes = (self.serialize_fn)(&self.cache).map_err(crate::Error::Serialize)?; + fs::write(&self.path, bytes)?; Ok(()) } - /// Saves the store to disk - pub fn save(&self) -> Result<(), Error> { - let app_dir = self - .app - .path() - .app_data_dir() - .expect("failed to resolve app dir"); - let store_path = app_dir.join(&self.path); - - create_dir_all(store_path.parent().expect("invalid store path"))?; + /// Update the store from the on-disk state + pub fn load(&mut self) -> crate::Result<()> { + let bytes = fs::read(&self.path)?; - let bytes = (self.serialize)(&self.cache).map_err(Error::Serialize)?; - let mut f = File::create(&store_path)?; - f.write_all(&bytes)?; + self.cache + .extend((self.deserialize_fn)(&bytes).map_err(crate::Error::Deserialize)?); Ok(()) } - pub fn insert(&mut self, key: String, value: JsonValue) -> Result<(), Error> { + /// Inserts a key-value pair into the store. + pub fn set(&mut self, key: impl Into, value: impl Into) { + let key = key.into(); + let value = value.into(); self.cache.insert(key.clone(), value.clone()); - self.app.emit( - "store://change", - ChangePayload { - path: &self.path, - key: &key, - value: &value, - }, - )?; - - Ok(()) + let _ = self.emit_change_event(&key, Some(&value)); } + /// Returns a reference to the value corresponding to the key. pub fn get(&self, key: impl AsRef) -> Option<&JsonValue> { self.cache.get(key.as_ref()) } + /// Returns `true` if the given `key` exists in the store. pub fn has(&self, key: impl AsRef) -> bool { self.cache.contains_key(key.as_ref()) } - pub fn delete(&mut self, key: impl AsRef) -> Result { + /// Removes a key-value pair from the store. + pub fn delete(&mut self, key: impl AsRef) -> bool { let flag = self.cache.remove(key.as_ref()).is_some(); if flag { - self.app.emit( - "store://change", - ChangePayload { - path: &self.path, - key: key.as_ref(), - value: &JsonValue::Null, - }, - )?; + let _ = self.emit_change_event(key.as_ref(), None); } - Ok(flag) + flag } - pub fn clear(&mut self) -> Result<(), Error> { + /// Clears the store, removing all key-value pairs. + /// + /// Note: To clear the storage and reset it to its `default` value, use [`reset`](Self::reset) instead. + pub fn clear(&mut self) { let keys: Vec = self.cache.keys().cloned().collect(); self.cache.clear(); - for key in keys { - self.app.emit( - "store://change", - ChangePayload { - path: &self.path, - key: &key, - value: &JsonValue::Null, - }, - )?; + for key in &keys { + let _ = self.emit_change_event(key, None); } - Ok(()) } - pub fn reset(&mut self) -> Result<(), Error> { - let has_defaults = self.defaults.is_some(); - - if has_defaults { - if let Some(defaults) = &self.defaults { - for (key, value) in &self.cache { - if defaults.get(key) != Some(value) { - let _ = self.app.emit( - "store://change", - ChangePayload { - path: &self.path, - key, - value: defaults.get(key).unwrap_or(&JsonValue::Null), - }, - ); - } + /// Resets the store to its `default` value. + /// + /// If no default value has been set, this method behaves identical to [`clear`](Self::clear). + pub fn reset(&mut self) { + if let Some(defaults) = &self.defaults { + for (key, value) in &self.cache { + if defaults.get(key) != Some(value) { + let _ = self.emit_change_event(key, defaults.get(key)); } - self.cache = defaults.clone(); } - Ok(()) + for (key, value) in defaults { + if !self.cache.contains_key(key) { + let _ = self.emit_change_event(key, Some(value)); + } + } + self.cache.clone_from(defaults); } else { self.clear() } } + /// An iterator visiting all keys in arbitrary order. pub fn keys(&self) -> impl Iterator { self.cache.keys() } + /// An iterator visiting all values in arbitrary order. pub fn values(&self) -> impl Iterator { self.cache.values() } + /// An iterator visiting all key-value pairs in arbitrary order. pub fn entries(&self) -> impl Iterator { self.cache.iter() } + /// Returns the number of elements in the store. pub fn len(&self) -> usize { self.cache.len() } + /// Returns true if the store contains no elements. pub fn is_empty(&self) -> bool { self.cache.is_empty() } + + fn emit_change_event(&self, key: &str, value: Option<&JsonValue>) -> crate::Result<()> { + let state = self.app.state::(); + let stores = state.stores.lock().unwrap(); + let exists = value.is_some(); + self.app.emit( + "store://change", + ChangePayload { + path: &self.path, + resource_id: stores.get(&self.path).copied(), + key, + value, + exists, + }, + )?; + Ok(()) + } } -impl std::fmt::Debug for Store { +impl std::fmt::Debug for StoreInner { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("Store") .field("path", &self.path) - .field("defaults", &self.defaults) .field("cache", &self.cache) .finish() } } + +pub struct Store { + auto_save: Option, + auto_save_debounce_sender: Arc>>>, + store: Arc>>, +} + +impl Resource for Store { + fn close(self: Arc) { + let store = self.store.lock().unwrap(); + let state = store.app.state::(); + let mut stores = state.stores.lock().unwrap(); + stores.remove(&store.path); + } +} + +impl Store { + // /// Do something with the inner store, + // /// useful for batching some work if you need higher performance + // pub fn with_store(&self, f: impl FnOnce(&mut StoreInner) -> T) -> T { + // let mut store = self.store.lock().unwrap(); + // f(&mut store) + // } + + /// Inserts a key-value pair into the store. + pub fn set(&self, key: impl Into, value: impl Into) { + self.store.lock().unwrap().set(key.into(), value.into()); + let _ = self.trigger_auto_save(); + } + + /// Returns the value for the given `key` or `None` if the key does not exist. + pub fn get(&self, key: impl AsRef) -> Option { + self.store.lock().unwrap().get(key).cloned() + } + + /// Returns `true` if the given `key` exists in the store. + pub fn has(&self, key: impl AsRef) -> bool { + self.store.lock().unwrap().has(key) + } + + /// Removes a key-value pair from the store. + pub fn delete(&self, key: impl AsRef) -> bool { + let deleted = self.store.lock().unwrap().delete(key); + if deleted { + let _ = self.trigger_auto_save(); + } + deleted + } + + /// Clears the store, removing all key-value pairs. + /// + /// Note: To clear the storage and reset it to its `default` value, use [`reset`](Self::reset) instead. + pub fn clear(&self) { + self.store.lock().unwrap().clear(); + let _ = self.trigger_auto_save(); + } + + /// Resets the store to its `default` value. + /// + /// If no default value has been set, this method behaves identical to [`clear`](Self::clear). + pub fn reset(&self) { + self.store.lock().unwrap().reset(); + let _ = self.trigger_auto_save(); + } + + /// Returns a list of all keys in the store. + pub fn keys(&self) -> Vec { + self.store.lock().unwrap().keys().cloned().collect() + } + + /// Returns a list of all values in the store. + pub fn values(&self) -> Vec { + self.store.lock().unwrap().values().cloned().collect() + } + + /// Returns a list of all key-value pairs in the store. + pub fn entries(&self) -> Vec<(String, JsonValue)> { + self.store + .lock() + .unwrap() + .entries() + .map(|(k, v)| (k.to_owned(), v.to_owned())) + .collect() + } + + /// Returns the number of elements in the store. + pub fn length(&self) -> usize { + self.store.lock().unwrap().len() + } + + /// Returns true if the store contains no elements. + pub fn is_empty(&self) -> bool { + self.store.lock().unwrap().is_empty() + } + + /// Update the store from the on-disk state + pub fn reload(&self) -> crate::Result<()> { + self.store.lock().unwrap().load() + } + + /// Saves the store to disk at the store's `path`. + pub fn save(&self) -> crate::Result<()> { + if let Some(sender) = self.auto_save_debounce_sender.lock().unwrap().take() { + let _ = sender.send(AutoSaveMessage::Cancel); + } + self.store.lock().unwrap().save() + } + + /// Removes the store from the resource table + pub fn close_resource(&self) { + let store = self.store.lock().unwrap(); + let app = store.app.clone(); + let state = app.state::(); + let stores = state.stores.lock().unwrap(); + if let Some(rid) = stores.get(&store.path).copied() { + drop(store); + drop(stores); + let _ = app.resources_table().close(rid); + } + } + + fn trigger_auto_save(&self) -> crate::Result<()> { + let Some(auto_save_delay) = self.auto_save else { + return Ok(()); + }; + if auto_save_delay.is_zero() { + return self.save(); + } + let mut auto_save_debounce_sender = self.auto_save_debounce_sender.lock().unwrap(); + if let Some(ref sender) = *auto_save_debounce_sender { + let _ = sender.send(AutoSaveMessage::Reset); + return Ok(()); + } + let (sender, mut receiver) = unbounded_channel(); + auto_save_debounce_sender.replace(sender); + drop(auto_save_debounce_sender); + let store = self.store.clone(); + let auto_save_debounce_sender = self.auto_save_debounce_sender.clone(); + tauri::async_runtime::spawn(async move { + loop { + select! { + should_cancel = receiver.recv() => { + if matches!(should_cancel, Some(AutoSaveMessage::Cancel) | None) { + return; + } + } + _ = sleep(auto_save_delay) => { + auto_save_debounce_sender.lock().unwrap().take(); + let _ = store.lock().unwrap().save(); + return; + } + }; + } + }); + Ok(()) + } + + fn apply_pending_auto_save(&self) { + // Cancel and save if auto save is pending + if let Some(sender) = self.auto_save_debounce_sender.lock().unwrap().take() { + let _ = sender.send(AutoSaveMessage::Cancel); + let _ = self.save(); + }; + } +} + +impl Drop for Store { + fn drop(&mut self) { + self.apply_pending_auto_save(); + } +} diff --git a/plugins/stronghold/.gitignore b/plugins/stronghold/.gitignore deleted file mode 100644 index b512c09d..00000000 --- a/plugins/stronghold/.gitignore +++ /dev/null @@ -1 +0,0 @@ -node_modules \ No newline at end of file diff --git a/plugins/stronghold/CHANGELOG.md b/plugins/stronghold/CHANGELOG.md index 32977003..5d7ea2d1 100644 --- a/plugins/stronghold/CHANGELOG.md +++ b/plugins/stronghold/CHANGELOG.md @@ -1,5 +1,58 @@ # Changelog +## \[2.2.0] + +- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other. + +## \[2.0.1] + +- [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7. + +## \[2.0.0] + +- [`e2c4dfb6`](https://github.com/tauri-apps/plugins-workspace/commit/e2c4dfb6af43e5dd8d9ceba232c315f5febd55c1) Update to tauri v2 stable release. + +## \[2.0.0-rc.1] + +- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri 2.0.0-rc.8 + +## \[2.0.0-rc.0] + +- [`9887d1`](https://github.com/tauri-apps/plugins-workspace/commit/9887d14bd0e971c4c0f5c1188fc4005d3fc2e29e) Update to tauri RC. + +## \[2.0.0-beta.8] + +- [`99d6ac0f`](https://github.com/tauri-apps/plugins-workspace/commit/99d6ac0f9506a6a4a1aa59c728157190a7441af6) ([#1606](https://github.com/tauri-apps/plugins-workspace/pull/1606) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) The JS packages now specify the *minimum* `@tauri-apps/api` version instead of a single exact version. +- [`6de87966`](https://github.com/tauri-apps/plugins-workspace/commit/6de87966ecc00ad9d91c25be452f1f46bd2b7e1f) ([#1597](https://github.com/tauri-apps/plugins-workspace/pull/1597) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Update to tauri beta.25. + +## \[2.0.0-beta.7] + +- [`22a17980`](https://github.com/tauri-apps/plugins-workspace/commit/22a17980ff4f6f8c40adb1b8f4ffc6dae2fe7e30) ([#1537](https://github.com/tauri-apps/plugins-workspace/pull/1537) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri beta.24. + +## \[2.0.0-beta.6] + +- [`76daee7a`](https://github.com/tauri-apps/plugins-workspace/commit/76daee7aafece34de3092c86e531cf9eb1138989) ([#1512](https://github.com/tauri-apps/plugins-workspace/pull/1512) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Update to tauri beta.23. + +## \[2.0.0-beta.5] + +- [`9013854f`](https://github.com/tauri-apps/plugins-workspace/commit/9013854f42a49a230b9dbb9d02774765528a923f)([#1382](https://github.com/tauri-apps/plugins-workspace/pull/1382)) Update to tauri beta.22. + +## \[2.0.0-beta.4] + +- [`430bd6f4`](https://github.com/tauri-apps/plugins-workspace/commit/430bd6f4f379bee5d232ae6b098ae131db7f178a)([#1363](https://github.com/tauri-apps/plugins-workspace/pull/1363)) Update to tauri beta.20. + +## \[2.0.0-beta.3] + +- [`bd1ed590`](https://github.com/tauri-apps/plugins-workspace/commit/bd1ed5903ffcce5500310dac1e59e8c67674ef1e)([#1237](https://github.com/tauri-apps/plugins-workspace/pull/1237)) Update to tauri beta.17. + +## \[2.0.0-beta.3] + +- [`a04ea2f`](https://github.com/tauri-apps/plugins-workspace/commit/a04ea2f38294d5a3987578283badc8eec87a7752)([#1071](https://github.com/tauri-apps/plugins-workspace/pull/1071)) The global API script is now only added to the binary when the `withGlobalTauri` config is true. + +## \[2.0.0-beta.2] + +- [`99bea25`](https://github.com/tauri-apps/plugins-workspace/commit/99bea2559c2c0648c2519c50a18cd124dacef57b)([#1005](https://github.com/tauri-apps/plugins-workspace/pull/1005)) Update to tauri beta.8. + ## \[2.0.0-beta.1] - [`569defb`](https://github.com/tauri-apps/plugins-workspace/commit/569defbe9492e38938554bb7bdc1be9151456d21) Update to tauri beta.4. @@ -40,6 +93,3 @@ ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - \`]\(https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - \`]\(https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! -717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/stronghold/Cargo.toml b/plugins/stronghold/Cargo.toml index 8fb6f4a4..7d40957a 100644 --- a/plugins/stronghold/Cargo.toml +++ b/plugins/stronghold/Cargo.toml @@ -1,19 +1,27 @@ [package] name = "tauri-plugin-stronghold" -version = "2.0.0-beta.1" -description = "Store secrets and keys using the IOTA Stronghold encrypted database." +version = "2.2.0" +description = "Store secrets and keys using the IOTA Stronghold secret management engine." authors = { workspace = true } license = { workspace = true } edition = { workspace = true } rust-version = { workspace = true } +repository = { workspace = true } links = "tauri-plugin-stronghold" [package.metadata.docs.rs] -rustc-args = [ "--cfg", "docsrs" ] -rustdoc-args = [ "--cfg", "docsrs" ] +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs"] + +[package.metadata.platforms.support] +windows = { level = "full", notes = "" } +linux = { level = "full", notes = "" } +macos = { level = "full", notes = "" } +android = { level = "full", notes = "" } +ios = { level = "full", notes = "" } [build-dependencies] -tauri-plugin = { workspace = true, features = [ "build" ] } +tauri-plugin = { workspace = true, features = ["build"] } [dependencies] serde = { workspace = true } @@ -21,18 +29,18 @@ serde_json = { workspace = true } tauri = { workspace = true } log = { workspace = true } thiserror = { workspace = true } -iota_stronghold = "1" +iota_stronghold = "2" iota-crypto = "0.23" hex = "0.4" -zeroize = { version = "1", features = [ "zeroize_derive" ] } -rust-argon2 = { version = "1", optional = true } +zeroize = { version = "1", features = ["zeroize_derive"] } +rust-argon2 = { version = "2", optional = true } rand_chacha = { version = "0.3.1", optional = true } -rand_core = { version = "0.6.4", features = [ "getrandom" ], optional = true } +rand_core = { version = "0.6.4", features = ["getrandom"], optional = true } [dev-dependencies] rand = "0.8" rusty-fork = "0.3" [features] -default = [ "kdf" ] -kdf = [ "dep:rust-argon2", "dep:rand_chacha", "dep:rand_core" ] +default = ["kdf"] +kdf = ["dep:rust-argon2", "dep:rand_chacha", "dep:rand_core"] diff --git a/plugins/stronghold/README.md b/plugins/stronghold/README.md index 0b293a2d..6dd16519 100644 --- a/plugins/stronghold/README.md +++ b/plugins/stronghold/README.md @@ -1,10 +1,18 @@ ![plugin-stronghold](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/stronghold/banner.png) -Store secrets and keys using the [IOTA Stronghold](https://github.com/iotaledger/stronghold.rs) encrypted database and secure runtime. +Store secrets and keys using the [IOTA Stronghold](https://github.com/iotaledger/stronghold.rs) secret management engine. + +| Platform | Supported | +| -------- | --------- | +| Linux | ✓ | +| Windows | ✓ | +| macOS | ✓ | +| Android | ✓ | +| iOS | ✓ | ## Install -_This plugin requires a Rust version of at least **1.75**_ +_This plugin requires a Rust version of at least **1.77.2**_ There are three general methods of installation that we can recommend. @@ -18,14 +26,14 @@ Install the Core plugin by adding the following to your `Cargo.toml` file: ```toml [dependencies] -tauri-plugin-stronghold = "2.0.0-beta" +tauri-plugin-stronghold = "2.0.0" # alternatively with Git: tauri-plugin-stronghold = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` You can install the JavaScript Guest bindings using your preferred JavaScript package manager: -> Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use. +> Note: If your JavaScript package manager cannot install packages from git monorepos, you can still use the code by manually copying the [Guest bindings](./guest-js/index.ts) into your source files. ```sh pnpm add @tauri-apps/plugin-stronghold @@ -46,14 +54,31 @@ yarn add https://github.com/tauri-apps/tauri-plugin-stronghold#v2 First you need to register the core plugin with Tauri: -`src-tauri/src/main.rs` +`src-tauri/src/lib.rs` ```rust fn main() { tauri::Builder::default() .plugin(tauri_plugin_stronghold::Builder::new(|password| { - // TODO: hash the password here with e.g. argon2, blake2b or any other secure algorithm - todo!() + // Hash the password here with e.g. argon2, blake2b or any other secure algorithm + // Here is an example implementation using the `rust-argon2` crate for hashing the password + + use argon2::{hash_raw, Config, Variant, Version}; + + let config = Config { + lanes: 4, + mem_cost: 10_000, + time_cost: 10, + variant: Variant::Argon2id, + version: Version::Version13, + ..Default::default() + }; + + let salt = "your-salt".as_bytes(); + + let key = hash_raw(password.as_ref(), salt, &config).expect("failed to hash password"); + + key.to_vec() }) .build()) .run(tauri::generate_context!()) @@ -64,9 +89,57 @@ fn main() { Afterwards all the plugin's APIs are available through the JavaScript guest bindings: ```javascript -import { Stronghold, Location } from "@tauri-apps/plugin-stronghold"; +import { Stronghold, Location, Client } from "tauri-plugin-stronghold-api"; +import { appDataDir } from "@tauri-apps/api/path"; + +const initStronghold = async () => { + const vaultPath = `${await appDataDir()}/vault.hold`; + + const vaultKey = "The key to the vault"; + + const stronghold = await Stronghold.load(vaultPath, vaultKey); + + let client: Client; + + const clientName = "name your client"; + + try { + client = await hold.loadClient(clientName); + } catch { + client = await hold.createClient(clientName); + } + + return { + stronghold, + client, + }; +}; + +const { stronghold, client } = await initStronghold(); + +const store = client.getStore(); + +const key = "my_key"; + +// Insert a record to the store + +const data = Array.from(new TextEncoder().encode("Hello, World!")); + +await store.insert(key, data); + +// Read a record from store + +const data = await store.get(key); + +const value = new TextDecoder().decode(new Uint8Array(data)); + +// Save your updates + +await stronghold.save(); + +// Remove a record from store -// TODO +await store.remove(key); ``` ## Contributing diff --git a/plugins/stronghold/SECURITY.md b/plugins/stronghold/SECURITY.md new file mode 100644 index 00000000..4f09bbac --- /dev/null +++ b/plugins/stronghold/SECURITY.md @@ -0,0 +1,23 @@ +# Security Policy + +**Do not report security vulnerabilities through public GitHub issues.** + +**Please use the [Private Vulnerability Disclosure](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability) feature of GitHub.** + +Include as much of the following information: + +- Type of issue (e.g. improper input parsing, privilege escalation, etc.) +- The location of the affected source code (tag/branch/commit or direct URL) +- Any special configuration required to reproduce the issue +- The distribution affected or used to help us with reproduction of the issue +- Step-by-step instructions to reproduce the issue +- Ideally a reproduction repository +- Impact of the issue, including how an attacker might exploit the issue + +We prefer to receive reports in English. + +## Contact + +Please disclose a vulnerability or security relevant issue here: [https://github.com/tauri-apps/plugins-workspace/security/advisories/new](https://github.com/tauri-apps/plugins-workspace/security/advisories/new). + +Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app). diff --git a/plugins/stronghold/api-iife.js b/plugins/stronghold/api-iife.js new file mode 100644 index 00000000..aabe9ed2 --- /dev/null +++ b/plugins/stronghold/api-iife.js @@ -0,0 +1 @@ +if("__TAURI__"in window){var __TAURI_PLUGIN_STRONGHOLD__=function(t){"use strict";async function e(t,e={},r){return window.__TAURI_INTERNALS__.invoke(t,e,r)}"function"==typeof SuppressedError&&SuppressedError;class r{constructor(t,e){this.type=t,this.payload=e}static generic(t,e){return new r("Generic",{vault:t,record:e})}static counter(t,e){return new r("Counter",{vault:t,counter:e})}}class n{constructor(t){this.procedureArgs=t}async generateSLIP10Seed(t,r){return await e("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"SLIP10Generate",payload:{output:t,sizeBytes:r}}}).then((t=>Uint8Array.from(t)))}async deriveSLIP10(t,r,n,a){return await e("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"SLIP10Derive",payload:{chain:t,input:{type:r,payload:n},output:a}}}).then((t=>Uint8Array.from(t)))}async recoverBIP39(t,r,n){return await e("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"BIP39Recover",payload:{mnemonic:t,passphrase:n,output:r}}}).then((t=>Uint8Array.from(t)))}async generateBIP39(t,r){return await e("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"BIP39Generate",payload:{output:t,passphrase:r}}}).then((t=>Uint8Array.from(t)))}async getEd25519PublicKey(t){return await e("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"PublicKey",payload:{type:"Ed25519",privateKey:t}}}).then((t=>Uint8Array.from(t)))}async signEd25519(t,r){return await e("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"Ed25519Sign",payload:{privateKey:t,msg:r}}}).then((t=>Uint8Array.from(t)))}}class a{constructor(t,e){this.path=t,this.name=e}getVault(t){return new o(this.path,this.name,t)}getStore(){return new s(this.path,this.name)}}class s{constructor(t,e){this.path=t,this.client=e}async get(t){return await e("plugin:stronghold|get_store_record",{snapshotPath:this.path,client:this.client,key:t}).then((t=>t&&Uint8Array.from(t)))}async insert(t,r,n){await e("plugin:stronghold|save_store_record",{snapshotPath:this.path,client:this.client,key:t,value:r,lifetime:n})}async remove(t){return await e("plugin:stronghold|remove_store_record",{snapshotPath:this.path,client:this.client,key:t}).then((t=>t&&Uint8Array.from(t)))}}class o extends n{constructor(t,e,r){super({snapshotPath:t,client:e,vault:r}),this.path=t,this.client=e,this.name=r}async insert(t,r){await e("plugin:stronghold|save_secret",{snapshotPath:this.path,client:this.client,vault:this.name,recordPath:t,secret:r})}async remove(t){await e("plugin:stronghold|remove_secret",{snapshotPath:this.path,client:this.client,vault:this.name,recordPath:t.payload.record})}}class i{constructor(t){this.path=t}static async load(t,r){return await e("plugin:stronghold|initialize",{snapshotPath:t,password:r}).then((()=>new i(t)))}async unload(){await e("plugin:stronghold|destroy",{snapshotPath:this.path})}async loadClient(t){return await e("plugin:stronghold|load_client",{snapshotPath:this.path,client:t}).then((()=>new a(this.path,t)))}async createClient(t){return await e("plugin:stronghold|create_client",{snapshotPath:this.path,client:t}).then((()=>new a(this.path,t)))}async save(){await e("plugin:stronghold|save",{snapshotPath:this.path})}}return t.Client=a,t.Location=r,t.Store=s,t.Stronghold=i,t.Vault=o,t}({});Object.defineProperty(window.__TAURI__,"stronghold",{value:__TAURI_PLUGIN_STRONGHOLD__})} diff --git a/plugins/stronghold/build.rs b/plugins/stronghold/build.rs index 05404a1b..e9550e25 100644 --- a/plugins/stronghold/build.rs +++ b/plugins/stronghold/build.rs @@ -17,5 +17,7 @@ const COMMANDS: &[&str] = &[ ]; fn main() { - tauri_plugin::Builder::new(COMMANDS).build(); + tauri_plugin::Builder::new(COMMANDS) + .global_api_script_path("./api-iife.js") + .build(); } diff --git a/plugins/stronghold/guest-js/index.ts b/plugins/stronghold/guest-js/index.ts index bf39420b..c1945a21 100644 --- a/plugins/stronghold/guest-js/index.ts +++ b/plugins/stronghold/guest-js/index.ts @@ -2,122 +2,112 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { invoke } from "@tauri-apps/api/core"; +import { invoke } from '@tauri-apps/api/core' -type BytesDto = string | number[]; export type ClientPath = | string | Iterable | ArrayLike - | ArrayBuffer; + | ArrayBuffer export type VaultPath = | string | Iterable | ArrayLike - | ArrayBuffer; + | ArrayBuffer export type RecordPath = | string | Iterable | ArrayLike - | ArrayBuffer; + | ArrayBuffer export type StoreKey = | string | Iterable | ArrayLike - | ArrayBuffer; - -function toBytesDto( - v: ClientPath | VaultPath | RecordPath | StoreKey, -): string | number[] { - if (typeof v === "string") { - return v; - } - return Array.from(v instanceof ArrayBuffer ? new Uint8Array(v) : v); -} + | ArrayBuffer export interface ConnectionLimits { - maxPendingIncoming?: number; - maxPendingOutgoing?: number; - maxEstablishedIncoming?: number; - maxEstablishedOutgoing?: number; - maxEstablishedPerPeer?: number; - maxEstablishedTotal?: number; + maxPendingIncoming?: number + maxPendingOutgoing?: number + maxEstablishedIncoming?: number + maxEstablishedOutgoing?: number + maxEstablishedPerPeer?: number + maxEstablishedTotal?: number } export interface PeerAddress { - known: string[]; // multiaddr - use_relay_fallback: boolean; + known: string[] // multiaddr + use_relay_fallback: boolean } export interface AddressInfo { - peers: Map; - relays: string[]; // peers + peers: Map + relays: string[] // peers } export interface ClientAccess { - useVaultDefault?: boolean; - useVaultExceptions?: Map; - writeVaultDefault?: boolean; - writeVaultExceptions?: Map; - cloneVaultDefault?: boolean; - cloneVaultExceptions?: Map; - readStore?: boolean; - writeStore?: boolean; + useVaultDefault?: boolean + useVaultExceptions?: Map + writeVaultDefault?: boolean + writeVaultExceptions?: Map + cloneVaultDefault?: boolean + cloneVaultExceptions?: Map + readStore?: boolean + writeStore?: boolean } export interface Permissions { - default?: ClientAccess; - exceptions?: Map; + default?: ClientAccess + exceptions?: Map } export interface NetworkConfig { - requestTimeout?: Duration; - connectionTimeout?: Duration; - connectionsLimit?: ConnectionLimits; - enableMdns?: boolean; - enableRelay?: boolean; - addresses?: AddressInfo; - peerPermissions?: Map; - permissionsDefault?: Permissions; + requestTimeout?: Duration + connectionTimeout?: Duration + connectionsLimit?: ConnectionLimits + enableMdns?: boolean + enableRelay?: boolean + addresses?: AddressInfo + peerPermissions?: Map + permissionsDefault?: Permissions } /** A duration definition. */ export interface Duration { /** The number of whole seconds contained by this Duration. */ - secs: number; - /** The fractional part of this Duration, in nanoseconds. Must be greater or equal to 0 and smaller than 1e+9 (the max number of nanoseoncds in a second)*/ - nanos: number; + secs: number + /** The fractional part of this Duration, in nanoseconds. Must be greater or equal to 0 and smaller than 1e+9 (the max number of nanoseoncds in a second) */ + nanos: number } export class Location { - type: string; - payload: Record; + type: string + payload: Record constructor(type: string, payload: Record) { - this.type = type; - this.payload = payload; + this.type = type + this.payload = payload } static generic(vault: VaultPath, record: RecordPath): Location { - return new Location("Generic", { - vault: toBytesDto(vault), - record: toBytesDto(record), - }); + return new Location('Generic', { + vault, + record + }) } static counter(vault: VaultPath, counter: number): Location { - return new Location("Counter", { - vault: toBytesDto(vault), - counter, - }); + return new Location('Counter', { + vault, + counter + }) } } class ProcedureExecutor { - procedureArgs: Record; + procedureArgs: Record constructor(procedureArgs: Record) { - this.procedureArgs = procedureArgs; + this.procedureArgs = procedureArgs } /** @@ -129,18 +119,18 @@ class ProcedureExecutor { */ async generateSLIP10Seed( outputLocation: Location, - sizeBytes?: number, + sizeBytes?: number ): Promise { - return await invoke("plugin:stronghold|execute_procedure", { + return await invoke('plugin:stronghold|execute_procedure', { ...this.procedureArgs, procedure: { - type: "SLIP10Generate", + type: 'SLIP10Generate', payload: { output: outputLocation, - sizeBytes, - }, - }, - }).then((n) => Uint8Array.from(n)); + sizeBytes + } + } + }).then((n) => Uint8Array.from(n)) } /** @@ -154,24 +144,24 @@ class ProcedureExecutor { */ async deriveSLIP10( chain: number[], - source: "Seed" | "Key", + source: 'Seed' | 'Key', sourceLocation: Location, - outputLocation: Location, + outputLocation: Location ): Promise { - return await invoke("plugin:stronghold|execute_procedure", { + return await invoke('plugin:stronghold|execute_procedure', { ...this.procedureArgs, procedure: { - type: "SLIP10Derive", + type: 'SLIP10Derive', payload: { chain, input: { type: source, - payload: sourceLocation, + payload: sourceLocation }, - output: outputLocation, - }, - }, - }).then((n) => Uint8Array.from(n)); + output: outputLocation + } + } + }).then((n) => Uint8Array.from(n)) } /** @@ -185,19 +175,19 @@ class ProcedureExecutor { async recoverBIP39( mnemonic: string, outputLocation: Location, - passphrase?: string, + passphrase?: string ): Promise { - return await invoke("plugin:stronghold|execute_procedure", { + return await invoke('plugin:stronghold|execute_procedure', { ...this.procedureArgs, procedure: { - type: "BIP39Recover", + type: 'BIP39Recover', payload: { mnemonic, passphrase, - output: outputLocation, - }, - }, - }).then((n) => Uint8Array.from(n)); + output: outputLocation + } + } + }).then((n) => Uint8Array.from(n)) } /** @@ -209,18 +199,18 @@ class ProcedureExecutor { */ async generateBIP39( outputLocation: Location, - passphrase?: string, + passphrase?: string ): Promise { - return await invoke("plugin:stronghold|execute_procedure", { + return await invoke('plugin:stronghold|execute_procedure', { ...this.procedureArgs, procedure: { - type: "BIP39Generate", + type: 'BIP39Generate', payload: { output: outputLocation, - passphrase, - }, - }, - }).then((n) => Uint8Array.from(n)); + passphrase + } + } + }).then((n) => Uint8Array.from(n)) } /** @@ -231,16 +221,16 @@ class ProcedureExecutor { * @since 2.0.0 */ async getEd25519PublicKey(privateKeyLocation: Location): Promise { - return await invoke("plugin:stronghold|execute_procedure", { + return await invoke('plugin:stronghold|execute_procedure', { ...this.procedureArgs, procedure: { - type: "PublicKey", + type: 'PublicKey', payload: { - type: "Ed25519", - privateKey: privateKeyLocation, - }, - }, - }).then((n) => Uint8Array.from(n)); + type: 'Ed25519', + privateKey: privateKeyLocation + } + } + }).then((n) => Uint8Array.from(n)) } /** @@ -253,28 +243,28 @@ class ProcedureExecutor { */ async signEd25519( privateKeyLocation: Location, - msg: string, + msg: string ): Promise { - return await invoke("plugin:stronghold|execute_procedure", { + return await invoke('plugin:stronghold|execute_procedure', { ...this.procedureArgs, procedure: { - type: "Ed25519Sign", + type: 'Ed25519Sign', payload: { privateKey: privateKeyLocation, - msg, - }, - }, - }).then((n) => Uint8Array.from(n)); + msg + } + } + }).then((n) => Uint8Array.from(n)) } } export class Client { - path: string; - name: BytesDto; + path: string + name: ClientPath constructor(path: string, name: ClientPath) { - this.path = path; - this.name = toBytesDto(name); + this.path = path + this.name = name } /** @@ -284,54 +274,54 @@ export class Client { * @returns */ getVault(name: VaultPath): Vault { - return new Vault(this.path, this.name, toBytesDto(name)); + return new Vault(this.path, this.name, name) } getStore(): Store { - return new Store(this.path, this.name); + return new Store(this.path, this.name) } } export class Store { - path: string; - client: BytesDto; + path: string + client: ClientPath - constructor(path: string, client: BytesDto) { - this.path = path; - this.client = client; + constructor(path: string, client: ClientPath) { + this.path = path + this.client = client } async get(key: StoreKey): Promise { - return await invoke("plugin:stronghold|get_store_record", { + return await invoke('plugin:stronghold|get_store_record', { snapshotPath: this.path, client: this.client, - key: toBytesDto(key), - }).then((v) => (v != null ? Uint8Array.from(v) : null)); + key + }).then((v) => v && Uint8Array.from(v)) } async insert( key: StoreKey, value: number[], - lifetime?: Duration, + lifetime?: Duration ): Promise { - return await invoke("plugin:stronghold|save_store_record", { + await invoke('plugin:stronghold|save_store_record', { snapshotPath: this.path, client: this.client, - key: toBytesDto(key), + key, value, - lifetime, - }); + lifetime + }) } async remove(key: StoreKey): Promise { return await invoke( - "plugin:stronghold|remove_store_record", + 'plugin:stronghold|remove_store_record', { snapshotPath: this.path, client: this.client, - key: toBytesDto(key), - }, - ).then((v) => (v != null ? Uint8Array.from(v) : null)); + key + } + ).then((v) => v && Uint8Array.from(v)) } } @@ -342,20 +332,20 @@ export class Store { */ export class Vault extends ProcedureExecutor { /** The vault path. */ - path: string; - client: BytesDto; + path: string + client: ClientPath /** The vault name. */ - name: BytesDto; + name: VaultPath constructor(path: string, client: ClientPath, name: VaultPath) { super({ snapshotPath: path, client, - vault: name, - }); - this.path = path; - this.client = toBytesDto(client); - this.name = toBytesDto(name); + vault: name + }) + this.path = path + this.client = client + this.name = name } /** @@ -366,13 +356,13 @@ export class Vault extends ProcedureExecutor { * @returns */ async insert(recordPath: RecordPath, secret: number[]): Promise { - return await invoke("plugin:stronghold|save_secret", { + await invoke('plugin:stronghold|save_secret', { snapshotPath: this.path, client: this.client, vault: this.name, - recordPath: toBytesDto(recordPath), - secret, - }); + recordPath, + secret + }) } /** @@ -382,12 +372,12 @@ export class Vault extends ProcedureExecutor { * @returns */ async remove(location: Location): Promise { - return await invoke("plugin:stronghold|remove_secret", { + await invoke('plugin:stronghold|remove_secret', { snapshotPath: this.path, client: this.client, vault: this.name, - recordPath: location.payload.record, - }); + recordPath: location.payload.record + }) } } @@ -395,7 +385,7 @@ export class Vault extends ProcedureExecutor { * A representation of an access to a stronghold. */ export class Stronghold { - path: string; + path: string /** * Initializes a stronghold. @@ -404,7 +394,7 @@ export class Stronghold { * @param password */ private constructor(path: string) { - this.path = path; + this.path = path } /** @@ -413,33 +403,33 @@ export class Stronghold { * @returns */ static async load(path: string, password: string): Promise { - return await invoke("plugin:stronghold|initialize", { + return await invoke('plugin:stronghold|initialize', { snapshotPath: path, - password, - }).then(() => new Stronghold(path)); + password + }).then(() => new Stronghold(path)) } /** * Remove this instance from the cache. */ async unload(): Promise { - return await invoke("plugin:stronghold|destroy", { - snapshotPath: this.path, - }); + await invoke('plugin:stronghold|destroy', { + snapshotPath: this.path + }) } async loadClient(client: ClientPath): Promise { - return await invoke("plugin:stronghold|load_client", { + return await invoke('plugin:stronghold|load_client', { snapshotPath: this.path, - client: toBytesDto(client), - }).then(() => new Client(this.path, client)); + client + }).then(() => new Client(this.path, client)) } async createClient(client: ClientPath): Promise { - return await invoke("plugin:stronghold|create_client", { + return await invoke('plugin:stronghold|create_client', { snapshotPath: this.path, - client: toBytesDto(client), - }).then(() => new Client(this.path, client)); + client + }).then(() => new Client(this.path, client)) } /** @@ -447,8 +437,8 @@ export class Stronghold { * @returns */ async save(): Promise { - return await invoke("plugin:stronghold|save", { - snapshotPath: this.path, - }); + await invoke('plugin:stronghold|save', { + snapshotPath: this.path + }) } } diff --git a/plugins/stronghold/package.json b/plugins/stronghold/package.json index 9f519ace..87611e2a 100644 --- a/plugins/stronghold/package.json +++ b/plugins/stronghold/package.json @@ -1,11 +1,12 @@ { "name": "@tauri-apps/plugin-stronghold", - "version": "2.0.0-beta.1", + "version": "2.2.0", "description": "Store secrets and keys using the IOTA Stronghold encrypted database.", - "license": "MIT or APACHE-2.0", + "license": "MIT OR Apache-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" ], + "repository": "https://github.com/tauri-apps/plugins-workspace", "type": "module", "types": "./dist-js/index.d.ts", "main": "./dist-js/index.cjs", @@ -24,6 +25,6 @@ "LICENSE" ], "dependencies": { - "@tauri-apps/api": "2.0.0-beta.2" + "@tauri-apps/api": "^2.0.0" } } diff --git a/plugins/stronghold/permissions/autogenerated/reference.md b/plugins/stronghold/permissions/autogenerated/reference.md index 799ae7db..c00e56c3 100644 --- a/plugins/stronghold/permissions/autogenerated/reference.md +++ b/plugins/stronghold/permissions/autogenerated/reference.md @@ -1,90 +1,317 @@ -# Permissions +## Default Permission -## allow-create-client +This permission set configures what kind of +operations are available from the stronghold plugin. + +#### Granted Permissions + +All non-destructive operations are enabled by default. + + + +#### This default permission set includes the following: + +- `allow-create-client` +- `allow-get-store-record` +- `allow-initialize` +- `allow-execute-procedure` +- `allow-load-client` +- `allow-save-secret` +- `allow-save-store-record` +- `allow-save` + +## Permission Table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IdentifierDescription
+ +`stronghold:allow-create-client` + + Enables the create_client command without any pre-configured scope. -## deny-create-client +
+ +`stronghold:deny-create-client` + + Denies the create_client command without any pre-configured scope. -## allow-destroy +
+ +`stronghold:allow-destroy` + + Enables the destroy command without any pre-configured scope. -## deny-destroy +
+ +`stronghold:deny-destroy` + + Denies the destroy command without any pre-configured scope. -## allow-execute-procedure +
+ +`stronghold:allow-execute-procedure` + + Enables the execute_procedure command without any pre-configured scope. -## deny-execute-procedure +
+ +`stronghold:deny-execute-procedure` + + Denies the execute_procedure command without any pre-configured scope. -## allow-get-store-record +
+ +`stronghold:allow-get-store-record` + + Enables the get_store_record command without any pre-configured scope. -## deny-get-store-record +
+ +`stronghold:deny-get-store-record` + + Denies the get_store_record command without any pre-configured scope. -## allow-initialize +
+ +`stronghold:allow-initialize` + + Enables the initialize command without any pre-configured scope. -## deny-initialize +
+ +`stronghold:deny-initialize` + + Denies the initialize command without any pre-configured scope. -## allow-load-client +
+ +`stronghold:allow-load-client` + + Enables the load_client command without any pre-configured scope. -## deny-load-client +
+ +`stronghold:deny-load-client` + + Denies the load_client command without any pre-configured scope. -## allow-remove-secret +
+ +`stronghold:allow-remove-secret` + + Enables the remove_secret command without any pre-configured scope. -## deny-remove-secret +
+ +`stronghold:deny-remove-secret` + + Denies the remove_secret command without any pre-configured scope. -## allow-remove-store-record +
+ +`stronghold:allow-remove-store-record` + + Enables the remove_store_record command without any pre-configured scope. -## deny-remove-store-record +
+ +`stronghold:deny-remove-store-record` + + Denies the remove_store_record command without any pre-configured scope. -## allow-save +
+ +`stronghold:allow-save` + + Enables the save command without any pre-configured scope. -## deny-save +
+ +`stronghold:deny-save` + + Denies the save command without any pre-configured scope. -## allow-save-secret +
+ +`stronghold:allow-save-secret` + + Enables the save_secret command without any pre-configured scope. -## deny-save-secret +
+ +`stronghold:deny-save-secret` + + Denies the save_secret command without any pre-configured scope. -## allow-save-store-record +
+ +`stronghold:allow-save-store-record` + + Enables the save_store_record command without any pre-configured scope. -## deny-save-store-record +
+ +`stronghold:deny-save-store-record` + + Denies the save_store_record command without any pre-configured scope. +
diff --git a/plugins/stronghold/permissions/default.toml b/plugins/stronghold/permissions/default.toml new file mode 100644 index 00000000..c157fe7e --- /dev/null +++ b/plugins/stronghold/permissions/default.toml @@ -0,0 +1,22 @@ +"$schema" = "schemas/schema.json" + +[default] +description = """ +This permission set configures what kind of +operations are available from the stronghold plugin. + +#### Granted Permissions + +All non-destructive operations are enabled by default. + +""" +permissions = [ + "allow-create-client", + "allow-get-store-record", + "allow-initialize", + "allow-execute-procedure", + "allow-load-client", + "allow-save-secret", + "allow-save-store-record", + "allow-save", +] diff --git a/plugins/stronghold/permissions/schemas/schema.json b/plugins/stronghold/permissions/schemas/schema.json index 9535be4f..6af87c6a 100644 --- a/plugins/stronghold/permissions/schemas/schema.json +++ b/plugins/stronghold/permissions/schemas/schema.json @@ -17,7 +17,6 @@ }, "set": { "description": "A list of permissions sets defined", - "default": [], "type": "array", "items": { "$ref": "#/definitions/PermissionSet" @@ -50,7 +49,7 @@ "minimum": 1.0 }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -112,7 +111,7 @@ "type": "string" }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri internal convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -132,12 +131,21 @@ }, "scope": { "description": "Allowed or denied scoped when using this permission.", - "default": {}, "allOf": [ { "$ref": "#/definitions/Scopes" } ] + }, + "platforms": { + "description": "Target platforms this permission applies. By default all platforms are affected by this permission.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Target" + } } } }, @@ -164,7 +172,7 @@ } }, "Scopes": { - "description": "A restriction of the command/endpoint functionality.\n\nIt can be of any serde serializable type and is used for allowing or preventing certain actions inside a Tauri command.\n\nThe scope is passed to the command and handled/enforced by the command itself.", + "description": "An argument for fine grained behavior control of Tauri commands.\n\nIt can be of any serde serializable type and is used to allow or prevent certain actions inside a Tauri command. The configured scope is passed to the command and will be enforced by the command implementation.\n\n## Example\n\n```json { \"allow\": [{ \"path\": \"$HOME/**\" }], \"deny\": [{ \"path\": \"$HOME/secret.txt\" }] } ```", "type": "object", "properties": { "allow": { @@ -178,7 +186,7 @@ } }, "deny": { - "description": "Data that defines what is denied by the scope.", + "description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.", "type": [ "array", "null" @@ -243,162 +251,186 @@ } ] }, - "PermissionKind": { - "type": "string", + "Target": { + "description": "Platform target.", "oneOf": [ { - "description": "allow-create-client -> Enables the create_client command without any pre-configured scope.", + "description": "MacOS.", "type": "string", "enum": [ - "allow-create-client" + "macOS" ] }, { - "description": "deny-create-client -> Denies the create_client command without any pre-configured scope.", + "description": "Windows.", "type": "string", "enum": [ - "deny-create-client" + "windows" ] }, { - "description": "allow-destroy -> Enables the destroy command without any pre-configured scope.", + "description": "Linux.", "type": "string", "enum": [ - "allow-destroy" + "linux" ] }, { - "description": "deny-destroy -> Denies the destroy command without any pre-configured scope.", + "description": "Android.", "type": "string", "enum": [ - "deny-destroy" + "android" ] }, { - "description": "allow-execute-procedure -> Enables the execute_procedure command without any pre-configured scope.", + "description": "iOS.", "type": "string", "enum": [ - "allow-execute-procedure" + "iOS" ] + } + ] + }, + "PermissionKind": { + "type": "string", + "oneOf": [ + { + "description": "Enables the create_client command without any pre-configured scope.", + "type": "string", + "const": "allow-create-client", + "markdownDescription": "Enables the create_client command without any pre-configured scope." }, { - "description": "deny-execute-procedure -> Denies the execute_procedure command without any pre-configured scope.", + "description": "Denies the create_client command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-execute-procedure" - ] + "const": "deny-create-client", + "markdownDescription": "Denies the create_client command without any pre-configured scope." }, { - "description": "allow-get-store-record -> Enables the get_store_record command without any pre-configured scope.", + "description": "Enables the destroy command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-get-store-record" - ] + "const": "allow-destroy", + "markdownDescription": "Enables the destroy command without any pre-configured scope." }, { - "description": "deny-get-store-record -> Denies the get_store_record command without any pre-configured scope.", + "description": "Denies the destroy command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-get-store-record" - ] + "const": "deny-destroy", + "markdownDescription": "Denies the destroy command without any pre-configured scope." }, { - "description": "allow-initialize -> Enables the initialize command without any pre-configured scope.", + "description": "Enables the execute_procedure command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-initialize" - ] + "const": "allow-execute-procedure", + "markdownDescription": "Enables the execute_procedure command without any pre-configured scope." }, { - "description": "deny-initialize -> Denies the initialize command without any pre-configured scope.", + "description": "Denies the execute_procedure command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-initialize" - ] + "const": "deny-execute-procedure", + "markdownDescription": "Denies the execute_procedure command without any pre-configured scope." }, { - "description": "allow-load-client -> Enables the load_client command without any pre-configured scope.", + "description": "Enables the get_store_record command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-load-client" - ] + "const": "allow-get-store-record", + "markdownDescription": "Enables the get_store_record command without any pre-configured scope." }, { - "description": "deny-load-client -> Denies the load_client command without any pre-configured scope.", + "description": "Denies the get_store_record command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-load-client" - ] + "const": "deny-get-store-record", + "markdownDescription": "Denies the get_store_record command without any pre-configured scope." }, { - "description": "allow-remove-secret -> Enables the remove_secret command without any pre-configured scope.", + "description": "Enables the initialize command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-remove-secret" - ] + "const": "allow-initialize", + "markdownDescription": "Enables the initialize command without any pre-configured scope." }, { - "description": "deny-remove-secret -> Denies the remove_secret command without any pre-configured scope.", + "description": "Denies the initialize command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-remove-secret" - ] + "const": "deny-initialize", + "markdownDescription": "Denies the initialize command without any pre-configured scope." }, { - "description": "allow-remove-store-record -> Enables the remove_store_record command without any pre-configured scope.", + "description": "Enables the load_client command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-remove-store-record" - ] + "const": "allow-load-client", + "markdownDescription": "Enables the load_client command without any pre-configured scope." }, { - "description": "deny-remove-store-record -> Denies the remove_store_record command without any pre-configured scope.", + "description": "Denies the load_client command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-remove-store-record" - ] + "const": "deny-load-client", + "markdownDescription": "Denies the load_client command without any pre-configured scope." }, { - "description": "allow-save -> Enables the save command without any pre-configured scope.", + "description": "Enables the remove_secret command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-save" - ] + "const": "allow-remove-secret", + "markdownDescription": "Enables the remove_secret command without any pre-configured scope." }, { - "description": "deny-save -> Denies the save command without any pre-configured scope.", + "description": "Denies the remove_secret command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-save" - ] + "const": "deny-remove-secret", + "markdownDescription": "Denies the remove_secret command without any pre-configured scope." }, { - "description": "allow-save-secret -> Enables the save_secret command without any pre-configured scope.", + "description": "Enables the remove_store_record command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-save-secret" - ] + "const": "allow-remove-store-record", + "markdownDescription": "Enables the remove_store_record command without any pre-configured scope." }, { - "description": "deny-save-secret -> Denies the save_secret command without any pre-configured scope.", + "description": "Denies the remove_store_record command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-save-secret" - ] + "const": "deny-remove-store-record", + "markdownDescription": "Denies the remove_store_record command without any pre-configured scope." }, { - "description": "allow-save-store-record -> Enables the save_store_record command without any pre-configured scope.", + "description": "Enables the save command without any pre-configured scope.", "type": "string", - "enum": [ - "allow-save-store-record" - ] + "const": "allow-save", + "markdownDescription": "Enables the save command without any pre-configured scope." }, { - "description": "deny-save-store-record -> Denies the save_store_record command without any pre-configured scope.", + "description": "Denies the save command without any pre-configured scope.", "type": "string", - "enum": [ - "deny-save-store-record" - ] + "const": "deny-save", + "markdownDescription": "Denies the save command without any pre-configured scope." + }, + { + "description": "Enables the save_secret command without any pre-configured scope.", + "type": "string", + "const": "allow-save-secret", + "markdownDescription": "Enables the save_secret command without any pre-configured scope." + }, + { + "description": "Denies the save_secret command without any pre-configured scope.", + "type": "string", + "const": "deny-save-secret", + "markdownDescription": "Denies the save_secret command without any pre-configured scope." + }, + { + "description": "Enables the save_store_record command without any pre-configured scope.", + "type": "string", + "const": "allow-save-store-record", + "markdownDescription": "Enables the save_store_record command without any pre-configured scope." + }, + { + "description": "Denies the save_store_record command without any pre-configured scope.", + "type": "string", + "const": "deny-save-store-record", + "markdownDescription": "Denies the save_store_record command without any pre-configured scope." + }, + { + "description": "This permission set configures what kind of\noperations are available from the stronghold plugin.\n\n#### Granted Permissions\n\nAll non-destructive operations are enabled by default.\n\n\n#### This default permission set includes:\n\n- `allow-create-client`\n- `allow-get-store-record`\n- `allow-initialize`\n- `allow-execute-procedure`\n- `allow-load-client`\n- `allow-save-secret`\n- `allow-save-store-record`\n- `allow-save`", + "type": "string", + "const": "default", + "markdownDescription": "This permission set configures what kind of\noperations are available from the stronghold plugin.\n\n#### Granted Permissions\n\nAll non-destructive operations are enabled by default.\n\n\n#### This default permission set includes:\n\n- `allow-create-client`\n- `allow-get-store-record`\n- `allow-initialize`\n- `allow-execute-procedure`\n- `allow-load-client`\n- `allow-save-secret`\n- `allow-save-store-record`\n- `allow-save`" } ] } diff --git a/plugins/stronghold/rollup.config.js b/plugins/stronghold/rollup.config.js index 977dfac8..1f349ec8 100644 --- a/plugins/stronghold/rollup.config.js +++ b/plugins/stronghold/rollup.config.js @@ -2,6 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { createConfig } from "../../shared/rollup.config.js"; +import { createConfig } from '../../shared/rollup.config.js' -export default createConfig(); +export default createConfig() diff --git a/plugins/stronghold/src/api-iife.js b/plugins/stronghold/src/api-iife.js deleted file mode 100644 index b8f95ec4..00000000 --- a/plugins/stronghold/src/api-iife.js +++ /dev/null @@ -1 +0,0 @@ -if("__TAURI__"in window){var __TAURI_PLUGIN_STRONGHOLD__=function(t){"use strict";async function e(t,e={},r){return window.__TAURI_INTERNALS__.invoke(t,e,r)}function r(t){return"string"==typeof t?t:Array.from(t instanceof ArrayBuffer?new Uint8Array(t):t)}"function"==typeof SuppressedError&&SuppressedError;class n{constructor(t,e){this.type=t,this.payload=e}static generic(t,e){return new n("Generic",{vault:r(t),record:r(e)})}static counter(t,e){return new n("Counter",{vault:r(t),counter:e})}}class a{constructor(t){this.procedureArgs=t}async generateSLIP10Seed(t,r){return await e("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"SLIP10Generate",payload:{output:t,sizeBytes:r}}}).then((t=>Uint8Array.from(t)))}async deriveSLIP10(t,r,n,a){return await e("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"SLIP10Derive",payload:{chain:t,input:{type:r,payload:n},output:a}}}).then((t=>Uint8Array.from(t)))}async recoverBIP39(t,r,n){return await e("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"BIP39Recover",payload:{mnemonic:t,passphrase:n,output:r}}}).then((t=>Uint8Array.from(t)))}async generateBIP39(t,r){return await e("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"BIP39Generate",payload:{output:t,passphrase:r}}}).then((t=>Uint8Array.from(t)))}async getEd25519PublicKey(t){return await e("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"PublicKey",payload:{type:"Ed25519",privateKey:t}}}).then((t=>Uint8Array.from(t)))}async signEd25519(t,r){return await e("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"Ed25519Sign",payload:{privateKey:t,msg:r}}}).then((t=>Uint8Array.from(t)))}}class s{constructor(t,e){this.path=t,this.name=r(e)}getVault(t){return new i(this.path,this.name,r(t))}getStore(){return new o(this.path,this.name)}}class o{constructor(t,e){this.path=t,this.client=e}async get(t){return await e("plugin:stronghold|get_store_record",{snapshotPath:this.path,client:this.client,key:r(t)}).then((t=>null!=t?Uint8Array.from(t):null))}async insert(t,n,a){return await e("plugin:stronghold|save_store_record",{snapshotPath:this.path,client:this.client,key:r(t),value:n,lifetime:a})}async remove(t){return await e("plugin:stronghold|remove_store_record",{snapshotPath:this.path,client:this.client,key:r(t)}).then((t=>null!=t?Uint8Array.from(t):null))}}class i extends a{constructor(t,e,n){super({snapshotPath:t,client:e,vault:n}),this.path=t,this.client=r(e),this.name=r(n)}async insert(t,n){return await e("plugin:stronghold|save_secret",{snapshotPath:this.path,client:this.client,vault:this.name,recordPath:r(t),secret:n})}async remove(t){return await e("plugin:stronghold|remove_secret",{snapshotPath:this.path,client:this.client,vault:this.name,recordPath:t.payload.record})}}class h{constructor(t){this.path=t}static async load(t,r){return await e("plugin:stronghold|initialize",{snapshotPath:t,password:r}).then((()=>new h(t)))}async unload(){return await e("plugin:stronghold|destroy",{snapshotPath:this.path})}async loadClient(t){return await e("plugin:stronghold|load_client",{snapshotPath:this.path,client:r(t)}).then((()=>new s(this.path,t)))}async createClient(t){return await e("plugin:stronghold|create_client",{snapshotPath:this.path,client:r(t)}).then((()=>new s(this.path,t)))}async save(){return await e("plugin:stronghold|save",{snapshotPath:this.path})}}return t.Client=s,t.Location=n,t.Store=o,t.Stronghold=h,t.Vault=i,t}({});Object.defineProperty(window.__TAURI__,"stronghold",{value:__TAURI_PLUGIN_STRONGHOLD__})} diff --git a/plugins/stronghold/src/lib.rs b/plugins/stronghold/src/lib.rs index 9c09decd..23acc3a2 100644 --- a/plugins/stronghold/src/lib.rs +++ b/plugins/stronghold/src/lib.rs @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -//! [![](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/stronghold/banner.png)](https://github.com/tauri-apps/plugins-workspace/tree/v2/plugins/stronghold) -//! //! Store secrets and keys using the [IOTA Stronghold](https://github.com/iotaledger/stronghold.rs) encrypted database and secure runtime. #![doc( @@ -19,9 +17,10 @@ use std::{ time::Duration, }; +use crypto::keys::bip39; use iota_stronghold::{ procedures::{ - BIP39Generate, BIP39Recover, Chain, Ed25519Sign, KeyType as StrongholdKeyType, + BIP39Generate, BIP39Recover, Curve, Ed25519Sign, KeyType as StrongholdKeyType, MnemonicLanguage, PublicKey, Slip10Derive, Slip10DeriveInput, Slip10Generate, StrongholdProcedure, }, @@ -33,7 +32,7 @@ use tauri::{ plugin::{Builder as PluginBuilder, TauriPlugin}, Manager, Runtime, State, }; -use zeroize::Zeroize; +use zeroize::{Zeroize, Zeroizing}; #[cfg(feature = "kdf")] pub mod kdf; @@ -126,7 +125,7 @@ impl<'de> Deserialize<'de> for KeyType { { struct KeyTypeVisitor; - impl<'de> Visitor<'de> for KeyTypeVisitor { + impl Visitor<'_> for KeyTypeVisitor { type Value = KeyType; fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { @@ -199,7 +198,8 @@ impl From for StrongholdProcedure { input, output, } => StrongholdProcedure::Slip10Derive(Slip10Derive { - chain: Chain::from_u32_hardened(chain), + curve: Curve::Ed25519, + chain, input: input.into(), output: output.into(), }), @@ -208,13 +208,13 @@ impl From for StrongholdProcedure { passphrase, output, } => StrongholdProcedure::BIP39Recover(BIP39Recover { - mnemonic, - passphrase, + mnemonic: bip39::Mnemonic::from(mnemonic), + passphrase: bip39::Passphrase::from(passphrase.unwrap_or_default()), output: output.into(), }), ProcedureDto::BIP39Generate { passphrase, output } => { StrongholdProcedure::BIP39Generate(BIP39Generate { - passphrase, + passphrase: bip39::Passphrase::from(passphrase.unwrap_or_default()), output: output.into(), language: MnemonicLanguage::English, }) @@ -351,7 +351,10 @@ async fn save_secret( let client = get_client(collection, snapshot_path, client)?; client .vault(&vault) - .write_secret(Location::generic(vault, record_path), secret) + .write_secret( + Location::generic(vault, record_path), + Zeroizing::new(secret), + ) .map_err(Into::into) } @@ -456,19 +459,17 @@ impl Builder { pub fn build(self) -> TauriPlugin { let password_hash_function = self.password_hash_function; - let plugin_builder = PluginBuilder::new("stronghold") - .js_init_script(include_str!("api-iife.js").to_string()) - .setup(move |app, _api| { - app.manage(StrongholdCollection::default()); - app.manage(PasswordHashFunction(match password_hash_function { - #[cfg(feature = "kdf")] - PasswordHashFunctionKind::Argon2(path) => { - Box::new(move |p| kdf::KeyDerivation::argon2(p, &path)) - } - PasswordHashFunctionKind::Custom(f) => f, - })); - Ok(()) - }); + let plugin_builder = PluginBuilder::new("stronghold").setup(move |app, _api| { + app.manage(StrongholdCollection::default()); + app.manage(PasswordHashFunction(match password_hash_function { + #[cfg(feature = "kdf")] + PasswordHashFunctionKind::Argon2(path) => { + Box::new(move |p| kdf::KeyDerivation::argon2(p, &path)) + } + PasswordHashFunctionKind::Custom(f) => f, + })); + Ok(()) + }); Builder::invoke_stronghold_handlers_and_build(plugin_builder) } diff --git a/plugins/stronghold/src/stronghold.rs b/plugins/stronghold/src/stronghold.rs index 7da521bd..a5cadc26 100644 --- a/plugins/stronghold/src/stronghold.rs +++ b/plugins/stronghold/src/stronghold.rs @@ -6,6 +6,7 @@ use std::{convert::TryFrom, ops::Deref, path::Path}; use iota_stronghold::{KeyProvider, SnapshotPath}; use serde::{Serialize, Serializer}; +use zeroize::Zeroizing; pub type Result = std::result::Result; @@ -40,7 +41,7 @@ impl Stronghold { pub fn new>(path: P, password: Vec) -> Result { let path = SnapshotPath::from_path(path); let stronghold = iota_stronghold::Stronghold::default(); - let keyprovider = KeyProvider::try_from(password)?; + let keyprovider = KeyProvider::try_from(Zeroizing::new(password))?; if path.exists() { stronghold.load_snapshot(&keyprovider, &path)?; } diff --git a/plugins/updater/CHANGELOG.md b/plugins/updater/CHANGELOG.md index 16ffe235..ccf98564 100644 --- a/plugins/updater/CHANGELOG.md +++ b/plugins/updater/CHANGELOG.md @@ -1,5 +1,148 @@ # Changelog +## \[2.7.1] + +- [`c5b0f51c`](https://github.com/tauri-apps/plugins-workspace/commit/c5b0f51cfd911cca9317b59efc718b570980129b) ([#2621](https://github.com/tauri-apps/plugins-workspace/pull/2621) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Fix `check` and `download` overrides the `accept` header + +## \[2.7.0] + +### bug + +- [`2d731f80`](https://github.com/tauri-apps/plugins-workspace/commit/2d731f80224f74faf1b7170b25e04f5da1da49c8) ([#2573](https://github.com/tauri-apps/plugins-workspace/pull/2573)) Fix JS API `Update.date` not formatted to RFC 3339 +- [`0bc5d588`](https://github.com/tauri-apps/plugins-workspace/commit/0bc5d5887420ba1eb718254490b7995c771c0447) ([#2572](https://github.com/tauri-apps/plugins-workspace/pull/2572)) Fix `timeout` passed to `check` gets re-used by `download` and `downloadAndinstall` + +## \[2.6.1] + +- [`12c4537b`](https://github.com/tauri-apps/plugins-workspace/commit/12c4537b8e4fed29b415ff817434b664c0596dac) ([#2541](https://github.com/tauri-apps/plugins-workspace/pull/2541) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Add support to the `riscv64` architecture. + +## \[2.6.0] + +- [`faefcc9f`](https://github.com/tauri-apps/plugins-workspace/commit/faefcc9fd8c61f709d491649e255a7fcac82c09a) ([#2430](https://github.com/tauri-apps/plugins-workspace/pull/2430) by [@goenning](https://github.com/tauri-apps/plugins-workspace/../../goenning)) Add `UpdaterBuilder::configure_client` method on Rust side, to configure the `reqwest` client used to check and download the update. +- [`ac60d589`](https://github.com/tauri-apps/plugins-workspace/commit/ac60d589eca2bbc4aed040feb18da148e66ec171) ([#2513](https://github.com/tauri-apps/plugins-workspace/pull/2513) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Enhance error logging. + +## \[2.5.1] + +- [`6f881293`](https://github.com/tauri-apps/plugins-workspace/commit/6f881293fcd67838f6f3f8063f536292431dd1f7) ([#2439](https://github.com/tauri-apps/plugins-workspace/pull/2439) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Fixed an issue that caused the plugin to emit a `ReleaseNotFound` error instead of a `Reqwest` error when the http request in `check()` failed. + +## \[2.5.0] + +- [`5369898d`](https://github.com/tauri-apps/plugins-workspace/commit/5369898db7a6098e3e2f43436100ea556d405628) ([#2067](https://github.com/tauri-apps/plugins-workspace/pull/2067) by [@jLynx](https://github.com/tauri-apps/plugins-workspace/../../jLynx)) Fix update installation on macOS when using an user without admin privileges. +- [`5369898d`](https://github.com/tauri-apps/plugins-workspace/commit/5369898db7a6098e3e2f43436100ea556d405628) ([#2067](https://github.com/tauri-apps/plugins-workspace/pull/2067) by [@jLynx](https://github.com/tauri-apps/plugins-workspace/../../jLynx)) Remove the `UpdaterBuilder::new` function, use `UpdaterExt::updater_builder` instead. + +## \[2.4.0] + +- [`0afc9b6b`](https://github.com/tauri-apps/plugins-workspace/commit/0afc9b6be07bee1077f05a86285d977e57810ed9) ([#2325](https://github.com/tauri-apps/plugins-workspace/pull/2325) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) The `Update` struct/object will now contain a `raw_json`/`rawJson` property to be able to read parts of server's json response that are not handled by the plugin. + +## \[2.3.1] + +- [`57efb47c`](https://github.com/tauri-apps/plugins-workspace/commit/57efb47c116f880477f72f02a8e4239e88007d44) ([#2235](https://github.com/tauri-apps/plugins-workspace/pull/2235) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Add `Builder::header` and `Builder::headers` method to configure default headers for updater. + +## \[2.3.0] + +- [`829b6326`](https://github.com/tauri-apps/plugins-workspace/commit/829b63265030bc9c61d1738c4eaca0ffb3178677) ([#1919](https://github.com/tauri-apps/plugins-workspace/pull/1919) by [@n1ght-hunter](https://github.com/tauri-apps/plugins-workspace/../../n1ght-hunter)) Add `tauri_plugin_updater::Builder::default_version_comparator` method to set the default version comparator for the updater. + +## \[2.2.0] + +- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other. + +## \[2.1.0] + +- [`f8f2eefe`](https://github.com/tauri-apps/plugins-workspace/commit/f8f2eefe03ab231beafbd6a88d61b53d77f0400d) ([#1991](https://github.com/tauri-apps/plugins-workspace/pull/1991) by [@jLynx](https://github.com/tauri-apps/plugins-workspace/../../jLynx)) Added support for `.deb` package updates on Linux systems. + +## \[2.0.2] + +- [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7. + +## \[2.0.1] + +- [`9501cfa5`](https://github.com/tauri-apps/plugins-workspace/commit/9501cfa5f5385b2d7eb43a8378b322ee97cba06f) ([#1868](https://github.com/tauri-apps/plugins-workspace/pull/1868) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Fix configuration parser incorrectly warning about the endpoint scheme. + +## \[2.0.0] + +- [`e2c4dfb6`](https://github.com/tauri-apps/plugins-workspace/commit/e2c4dfb6af43e5dd8d9ceba232c315f5febd55c1) Update to tauri v2 stable release. + +## \[2.0.0-rc.4] + +- [`221f50f5`](https://github.com/tauri-apps/plugins-workspace/commit/221f50f53bd7a87dbd404e4cb1aaf502a5047785) ([#1816](https://github.com/tauri-apps/plugins-workspace/pull/1816) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Encode `+` when making updater requests which can be cause incorrectly interpolating the endpoint when using `{{current_version}}` in the endpoint where the current version contains a build number, for example `1.8.0+1`. +- [`04a0aea0`](https://github.com/tauri-apps/plugins-workspace/commit/04a0aea0ab9f8750200bc2fe5aff99c1c488082d) ([#1814](https://github.com/tauri-apps/plugins-workspace/pull/1814) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) **Breaking change**, Changed `UpdaterBuilder::endpoints` method to return a `Result`. +- [`04a0aea0`](https://github.com/tauri-apps/plugins-workspace/commit/04a0aea0ab9f8750200bc2fe5aff99c1c488082d) ([#1814](https://github.com/tauri-apps/plugins-workspace/pull/1814) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Add `dangerousInsecureTransportProtocol` config option to allow using insecure transport protocols, like `http` + +## \[2.0.0-rc.3] + +- [`d00519e3`](https://github.com/tauri-apps/plugins-workspace/commit/d00519e3e3a3234f9eb6c2ba82c92d4199f03e53) ([#1735](https://github.com/tauri-apps/plugins-workspace/pull/1735) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) This releases the changes from 2.0.0-rc.2 to crates.io. Please see the links below for the actual changes. + +## \[2.0.0-rc.2] + +- [`f8255e1d`](https://github.com/tauri-apps/plugins-workspace/commit/f8255e1db5df6cf562b9334fbefe5e62f4a28e0a) ([#1661](https://github.com/tauri-apps/plugins-workspace/pull/1661) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Add a second argument in `Update.download` and `Update.donloadAndInstall` JS APIs to modify headers and timeout when downloading the update. + +## \[2.0.0-rc.1] + +- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri 2.0.0-rc.8 + +## \[2.0.0-rc.1] + +- [`77013925`](https://github.com/tauri-apps/plugins-workspace/commit/7701392500f375340045880fce5fb8f867bfe670) ([#1636](https://github.com/tauri-apps/plugins-workspace/pull/1636) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Fixes the updater not preserving AppImage file permissions. +- [`5d170a54`](https://github.com/tauri-apps/plugins-workspace/commit/5d170a5444982dcc14135f6f1fc3e5da359f0eb0) ([#1671](https://github.com/tauri-apps/plugins-workspace/pull/1671) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri 2.0.0-rc.3. + +## \[2.0.0-rc.0] + +- [`9887d1`](https://github.com/tauri-apps/plugins-workspace/commit/9887d14bd0e971c4c0f5c1188fc4005d3fc2e29e) Update to tauri RC. + +## \[2.0.0-beta.8] + +- [`99d6ac0f`](https://github.com/tauri-apps/plugins-workspace/commit/99d6ac0f9506a6a4a1aa59c728157190a7441af6) ([#1606](https://github.com/tauri-apps/plugins-workspace/pull/1606) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) The JS packages now specify the *minimum* `@tauri-apps/api` version instead of a single exact version. +- [`6de87966`](https://github.com/tauri-apps/plugins-workspace/commit/6de87966ecc00ad9d91c25be452f1f46bd2b7e1f) ([#1597](https://github.com/tauri-apps/plugins-workspace/pull/1597) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Update to tauri beta.25. + +## \[2.0.0-beta.11] + +- [`f83b9e98`](https://github.com/tauri-apps/plugins-workspace/commit/f83b9e9813843df19b03b6af1018d848111b2a62) ([#1544](https://github.com/tauri-apps/plugins-workspace/pull/1544) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) On Windows, use a named tempfile with `--installer.exe` (or `.msi`) for v2 updater + + **Breaking Change**: `UpdaterBuilder::new` now takes one more argument `app_name: String` + +## \[2.0.0-beta.7] + +- [`22a17980`](https://github.com/tauri-apps/plugins-workspace/commit/22a17980ff4f6f8c40adb1b8f4ffc6dae2fe7e30) ([#1537](https://github.com/tauri-apps/plugins-workspace/pull/1537) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri beta.24. + +## \[2.0.0-beta.6] + +- [`76daee7a`](https://github.com/tauri-apps/plugins-workspace/commit/76daee7aafece34de3092c86e531cf9eb1138989) ([#1512](https://github.com/tauri-apps/plugins-workspace/pull/1512) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Update to tauri beta.23. + +## \[2.0.0-beta.8] + +- [`bf29a72b`](https://github.com/tauri-apps/plugins-workspace/commit/bf29a72baaff15214a21989df23081eee84e3b8b) ([#1454](https://github.com/tauri-apps/plugins-workspace/pull/1454) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Fix regression in updater plugin failing to update using `.msi` installer. + +## \[2.0.0-beta.5] + +- [`9013854f`](https://github.com/tauri-apps/plugins-workspace/commit/9013854f42a49a230b9dbb9d02774765528a923f)([#1382](https://github.com/tauri-apps/plugins-workspace/pull/1382)) Update to tauri beta.22. + +## \[2.0.0-beta.4] + +- [`430bd6f4`](https://github.com/tauri-apps/plugins-workspace/commit/430bd6f4f379bee5d232ae6b098ae131db7f178a)([#1363](https://github.com/tauri-apps/plugins-workspace/pull/1363)) Update to tauri beta.20. +- [`43224c5d`](https://github.com/tauri-apps/plugins-workspace/commit/43224c5d5cfe2dd676e79ebafe424027c62c51c3)([#1330](https://github.com/tauri-apps/plugins-workspace/pull/1330)) Add `Update.download` and `Update.install` functions to the JavaScript API + +## \[2.0.0-beta.3] + +- [`bd1ed590`](https://github.com/tauri-apps/plugins-workspace/commit/bd1ed5903ffcce5500310dac1e59e8c67674ef1e)([#1237](https://github.com/tauri-apps/plugins-workspace/pull/1237)) Update to tauri beta.17. + +## \[2.0.0-beta.4] + +- [`293f363`](https://github.com/tauri-apps/plugins-workspace/commit/293f363c0dccc43e8403729fdc8cc2b4311c2d5b)([#1175](https://github.com/tauri-apps/plugins-workspace/pull/1175)) Add a `on_before_exit` hook for cleanup before spawning the updater on Windows, defaults to `app.cleanup_before_exit` when used through `UpdaterExt` +- [`293f363`](https://github.com/tauri-apps/plugins-workspace/commit/293f363c0dccc43e8403729fdc8cc2b4311c2d5b)([#1175](https://github.com/tauri-apps/plugins-workspace/pull/1175)) **Breaking change:** The `rustls-tls` feature flag is now enabled by default. +- [`e3d41f4`](https://github.com/tauri-apps/plugins-workspace/commit/e3d41f4011bd3ea3ce281bb38bbe31d3709f8e0f)([#1191](https://github.com/tauri-apps/plugins-workspace/pull/1191)) Internally use the webview scoped resources table instead of the app one, so other webviews can't access other webviews resources. +- [`7e2fcc5`](https://github.com/tauri-apps/plugins-workspace/commit/7e2fcc5e74df7c3c718e40f75bfb0eafc7d69d8d)([#1146](https://github.com/tauri-apps/plugins-workspace/pull/1146)) Update dependencies to align with tauri 2.0.0-beta.14. +- [`e3d41f4`](https://github.com/tauri-apps/plugins-workspace/commit/e3d41f4011bd3ea3ce281bb38bbe31d3709f8e0f)([#1191](https://github.com/tauri-apps/plugins-workspace/pull/1191)) Update for tauri 2.0.0-beta.15. + +## \[2.0.0-beta.3] + +- [`4e37316`](https://github.com/tauri-apps/plugins-workspace/commit/4e37316af0d6532bf9a9bd0e712b5b14b0598285)([#1051](https://github.com/tauri-apps/plugins-workspace/pull/1051)) Fix deserialization of `windows > installerArgs` config field. +- [`4e37316`](https://github.com/tauri-apps/plugins-workspace/commit/4e37316af0d6532bf9a9bd0e712b5b14b0598285)([#1051](https://github.com/tauri-apps/plugins-workspace/pull/1051)) On Windows, fallback to `passive` install mode when not defined in config. +- [`a3b5396`](https://github.com/tauri-apps/plugins-workspace/commit/a3b5396113ca93912274f6890d9ef5b1a409587a)([#1054](https://github.com/tauri-apps/plugins-workspace/pull/1054)) Fix Windows powershell window flashing on update +- [`a04ea2f`](https://github.com/tauri-apps/plugins-workspace/commit/a04ea2f38294d5a3987578283badc8eec87a7752)([#1071](https://github.com/tauri-apps/plugins-workspace/pull/1071)) The global API script is now only added to the binary when the `withGlobalTauri` config is true. + +## \[2.0.0-beta.2] + +- [`99bea25`](https://github.com/tauri-apps/plugins-workspace/commit/99bea2559c2c0648c2519c50a18cd124dacef57b)([#1005](https://github.com/tauri-apps/plugins-workspace/pull/1005)) Update to tauri beta.8. + ## \[2.0.0-beta.1] - [`569defb`](https://github.com/tauri-apps/plugins-workspace/commit/569defbe9492e38938554bb7bdc1be9151456d21) Update to tauri beta.4. @@ -39,46 +182,3 @@ ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - ater. -- [`1cb8311`](https://github.com/tauri-apps/plugins-workspace/commit/1cb831183c63ba5bd3f72d8a482992f6467d950d)([#405](https://github.com/tauri-apps/plugins-workspace/pull/405)) Implement passive mode on NSIS and automatically restart after NSIS update. -- [`4ab90f0`](https://github.com/tauri-apps/plugins-workspace/commit/4ab90f048eab2918344f97dc8e04413a404e392d)([#431](https://github.com/tauri-apps/plugins-workspace/pull/431)) The updater plugin is recieving a few changes to improve consistency and ergonomics of the Rust and JS APIs - -## \[2.0.0-alpha.0] - -- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - 0f048eab2918344f97dc8e04413a404e392d)([#431](https://github.com/tauri-apps/plugins-workspace/pull/431)) The updater plugin is recieving a few changes to improve consistency and ergonomics of the Rust and JS APIs - -## \[2.0.0-alpha.0] - -- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - 1]\(https://github.com/tauri-apps/plugins-workspace/pull/431)) The updater plugin is recieving a few changes to improve consistency and ergonomics of the Rust and JS APIs - -## \[2.0.0-alpha.0] - -- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - 0f048eab2918344f97dc8e04413a404e392d)([#431](https://github.com/tauri-apps/plugins-workspace/pull/431)) The updater plugin is recieving a few changes to improve consistency and ergonomics of the Rust and JS APIs - -## \[2.0.0-alpha.0] - -- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - 918344f97dc8e04413a404e392d)([#431](https://github.com/tauri-apps/plugins-workspace/pull/431)) The updater plugin is recieving a few changes to improve consistency and ergonomics of the Rust and JS APIs - -## \[2.0.0-alpha.0] - -- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - 0f048eab2918344f97dc8e04413a404e392d)([#431](https://github.com/tauri-apps/plugins-workspace/pull/431)) The updater plugin is recieving a few changes to improve consistency and ergonomics of the Rust and JS APIs - -## \[2.0.0-alpha.0] - -- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - 1]\(https://github.com/tauri-apps/plugins-workspace/pull/431)) The updater plugin is recieving a few changes to improve consistency and ergonomics of the Rust and JS APIs - -## \[2.0.0-alpha.0] - -- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - 0f048eab2918344f97dc8e04413a404e392d)([#431](https://github.com/tauri-apps/plugins-workspace/pull/431)) The updater plugin is recieving a few changes to improve consistency and ergonomics of the Rust and JS APIs - -## \[2.0.0-alpha.0] - -- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! -717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/updater/Cargo.toml b/plugins/updater/Cargo.toml index e30345c9..a87dd149 100644 --- a/plugins/updater/Cargo.toml +++ b/plugins/updater/Cargo.toml @@ -1,50 +1,73 @@ [package] name = "tauri-plugin-updater" -version = "2.0.0-beta.1" +version = "2.7.1" description = "In-app updates for Tauri applications." edition = { workspace = true } authors = { workspace = true } license = { workspace = true } rust-version = { workspace = true } +repository = { workspace = true } links = "tauri-plugin-updater" [package.metadata.docs.rs] -rustc-args = [ "--cfg", "docsrs" ] -rustdoc-args = [ "--cfg", "docsrs" ] +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs"] +no-default-features = true +features = ["zip"] + +[package.metadata.platforms.support] +windows = { level = "full", notes = "" } +linux = { level = "full", notes = "" } +macos = { level = "full", notes = "" } +android = { level = "none", notes = "" } +ios = { level = "none", notes = "" } [build-dependencies] -tauri-plugin = { workspace = true, features = [ "build" ] } +tauri-plugin = { workspace = true, features = ["build"] } [dependencies] tauri = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } thiserror = { workspace = true } +log = { workspace = true } tokio = "1" -reqwest = { version = "0.11", default-features = false, features = [ "json", "stream" ] } +reqwest = { version = "0.12", default-features = false, features = [ + "json", + "stream", +] } url = { workspace = true } -http = "0.2" -dirs-next = "2" +http = "1" minisign-verify = "0.2" -time = { version = "0.3", features = [ "parsing", "formatting" ] } -base64 = "0.21" -percent-encoding = "2" -semver = { version = "1", features = [ "serde" ] } +time = { version = "0.3", features = ["parsing", "formatting"] } +base64 = "0.22" +semver = { version = "1", features = ["serde"] } futures-util = "0.3" tempfile = "3" -zip = "0.6" -tar = "0.4" +infer = "0.19" +percent-encoding = "2.3" [target."cfg(target_os = \"windows\")".dependencies] -zip = { version = "0.6", default-features = false } +zip = { version = "2", default-features = false, optional = true } +windows-sys = { version = "0.59.0", features = [ + "Win32_Foundation", + "Win32_UI_WindowsAndMessaging", + "Win32_UI_Shell", +] } -[target."cfg(any(target_os = \"macos\", target_os = \"linux\"))".dependencies] -flate2 = "1.0.27" +[target."cfg(target_os = \"linux\")".dependencies] +dirs = "6" +tar = { version = "0.4", optional = true } +flate2 = { version = "1", optional = true } -[dev-dependencies] -mockito = "0.31" +[target."cfg(target_os = \"macos\")".dependencies] +tar = "0.4" +flate2 = "1" +osakit = { version = "0.3", features = ["full"] } [features] -native-tls = [ "reqwest/native-tls" ] -native-tls-vendored = [ "reqwest/native-tls-vendored" ] -rustls-tls = [ "reqwest/rustls-tls" ] +default = ["rustls-tls", "zip"] +zip = ["dep:zip", "dep:tar", "dep:flate2"] +native-tls = ["reqwest/native-tls"] +native-tls-vendored = ["reqwest/native-tls-vendored"] +rustls-tls = ["reqwest/rustls-tls"] diff --git a/plugins/updater/README.md b/plugins/updater/README.md index 71e3b282..79fea467 100644 --- a/plugins/updater/README.md +++ b/plugins/updater/README.md @@ -2,11 +2,17 @@ In-app updates for Tauri applications. -- Supported platforms: Windows, Linux and macOS. +| Platform | Supported | +| -------- | --------- | +| Linux | ✓ | +| Windows | ✓ | +| macOS | ✓ | +| Android | x | +| iOS | x | ## Install -_This plugin requires a Rust version of at least **1.75**_ +_This plugin requires a Rust version of at least **1.77.2**_ There are three general methods of installation that we can recommend. @@ -21,7 +27,7 @@ Install the Core plugin by adding the following to your `Cargo.toml` file: ```toml # you can add the dependencies on the `[dependencies]` section if you do not target mobile [target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies] -tauri-plugin-updater = "2.0.0-beta" +tauri-plugin-updater = "2.0.0" # alternatively with Git: tauri-plugin-updater = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` @@ -49,7 +55,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-updater#v2 First you need to register the core plugin with Tauri: -`src-tauri/src/main.rs` +`src-tauri/src/lib.rs` ```rust fn main() { @@ -67,15 +73,17 @@ fn main() { Afterwards all the plugin's APIs are available through the JavaScript guest bindings: ```javascript -import { check } from "@tauri-apps/plugin-updater"; -import { relaunch } from "@tauri-apps/plugin-process"; -const update = await check(); -if (update?.available) { - await update.downloadAndInstall(); - await relaunch(); +import { check } from '@tauri-apps/plugin-updater' +import { relaunch } from '@tauri-apps/plugin-process' +const update = await check() +if (update) { + await update.downloadAndInstall() + await relaunch() } ``` +Note that for these APIs to work you have to properly configure the updater first and generate updater artifacts. Please refer to the [guide on our website](https://v2.tauri.app/plugin/updater/) for this. + ## Contributing PRs accepted. Please make sure to read the Contributing Guide before making a pull request. diff --git a/plugins/updater/SECURITY.md b/plugins/updater/SECURITY.md new file mode 100644 index 00000000..4f09bbac --- /dev/null +++ b/plugins/updater/SECURITY.md @@ -0,0 +1,23 @@ +# Security Policy + +**Do not report security vulnerabilities through public GitHub issues.** + +**Please use the [Private Vulnerability Disclosure](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability) feature of GitHub.** + +Include as much of the following information: + +- Type of issue (e.g. improper input parsing, privilege escalation, etc.) +- The location of the affected source code (tag/branch/commit or direct URL) +- Any special configuration required to reproduce the issue +- The distribution affected or used to help us with reproduction of the issue +- Step-by-step instructions to reproduce the issue +- Ideally a reproduction repository +- Impact of the issue, including how an attacker might exploit the issue + +We prefer to receive reports in English. + +## Contact + +Please disclose a vulnerability or security relevant issue here: [https://github.com/tauri-apps/plugins-workspace/security/advisories/new](https://github.com/tauri-apps/plugins-workspace/security/advisories/new). + +Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app). diff --git a/plugins/updater/api-iife.js b/plugins/updater/api-iife.js new file mode 100644 index 00000000..7c5ac665 --- /dev/null +++ b/plugins/updater/api-iife.js @@ -0,0 +1 @@ +if("__TAURI__"in window){var __TAURI_PLUGIN_UPDATER__=function(t){"use strict";function e(t,e,s,i){if("function"==typeof e||!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?i:"a"===s?i.call(t):i?i.value:e.get(t)}function s(t,e,s,i,n){if("function"==typeof e||!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,s),s}var i,n,a,r,o;"function"==typeof SuppressedError&&SuppressedError;const d="__TAURI_TO_IPC_KEY__";class l{constructor(t){i.set(this,void 0),n.set(this,0),a.set(this,[]),r.set(this,void 0),s(this,i,t||(()=>{})),this.id=function(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}((t=>{const o=t.index;if("end"in t)return void(o==e(this,n,"f")?this.cleanupCallback():s(this,r,o));const d=t.message;if(o==e(this,n,"f")){for(e(this,i,"f").call(this,d),s(this,n,e(this,n,"f")+1);e(this,n,"f")in e(this,a,"f");){const t=e(this,a,"f")[e(this,n,"f")];e(this,i,"f").call(this,t),delete e(this,a,"f")[e(this,n,"f")],s(this,n,e(this,n,"f")+1)}e(this,n,"f")===e(this,r,"f")&&this.cleanupCallback()}else e(this,a,"f")[o]=d}))}cleanupCallback(){Reflect.deleteProperty(window,`_${this.id}`)}set onmessage(t){s(this,i,t)}get onmessage(){return e(this,i,"f")}[(i=new WeakMap,n=new WeakMap,a=new WeakMap,r=new WeakMap,d)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[d]()}}async function c(t,e={},s){return window.__TAURI_INTERNALS__.invoke(t,e,s)}class h{get rid(){return e(this,o,"f")}constructor(t){o.set(this,void 0),s(this,o,t)}async close(){return c("plugin:resources|close",{rid:this.rid})}}o=new WeakMap;class u extends h{constructor(t){super(t.rid),this.available=!0,this.currentVersion=t.currentVersion,this.version=t.version,this.date=t.date,this.body=t.body,this.rawJson=t.rawJson}async download(t,e){const s=new l;t&&(s.onmessage=t);const i=await c("plugin:updater|download",{onEvent:s,rid:this.rid,...e});this.downloadedBytes=new h(i)}async install(){if(!this.downloadedBytes)throw new Error("Update.install called before Update.download");await c("plugin:updater|install",{updateRid:this.rid,bytesRid:this.downloadedBytes.rid}),this.downloadedBytes=void 0}async downloadAndInstall(t,e){const s=new l;t&&(s.onmessage=t),await c("plugin:updater|download_and_install",{onEvent:s,rid:this.rid,...e})}async close(){await(this.downloadedBytes?.close()),await super.close()}}return t.Update=u,t.check=async function(t){t?.headers&&(t.headers=Array.from(new Headers(t.headers).entries()));const e=await c("plugin:updater|check",{...t});return e?new u(e):null},t}({});Object.defineProperty(window.__TAURI__,"updater",{value:__TAURI_PLUGIN_UPDATER__})} diff --git a/plugins/updater/build.rs b/plugins/updater/build.rs index 6ba1a7d9..30f70b98 100644 --- a/plugins/updater/build.rs +++ b/plugins/updater/build.rs @@ -2,10 +2,12 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -const COMMANDS: &[&str] = &["check", "download_and_install"]; +const COMMANDS: &[&str] = &["check", "download", "install", "download_and_install"]; fn main() { - tauri_plugin::Builder::new(COMMANDS).build(); + tauri_plugin::Builder::new(COMMANDS) + .global_api_script_path("./api-iife.js") + .build(); let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap(); let mobile = target_os == "ios" || target_os == "android"; @@ -16,6 +18,7 @@ fn main() { // creates a cfg alias if `has_feature` is true. // `alias` must be a snake case string. fn alias(alias: &str, has_feature: bool) { + println!("cargo:rustc-check-cfg=cfg({alias})"); if has_feature { println!("cargo:rustc-cfg={alias}"); } diff --git a/plugins/updater/guest-js/index.ts b/plugins/updater/guest-js/index.ts index e3f8ec29..87f7929a 100644 --- a/plugins/updater/guest-js/index.ts +++ b/plugins/updater/guest-js/index.ts @@ -2,84 +2,141 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { invoke, Channel, Resource } from "@tauri-apps/api/core"; +import { invoke, Channel, Resource } from '@tauri-apps/api/core' -/** Options used to check for updates */ +/** Options used when checking for updates */ interface CheckOptions { /** * Request headers */ - headers?: HeadersInit; + headers?: HeadersInit /** - * Timeout in seconds + * Timeout in milliseconds */ - timeout?: number; + timeout?: number /** * A proxy url to be used when checking and downloading updates. */ - proxy?: string; + proxy?: string /** * Target identifier for the running application. This is sent to the backend. */ - target?: string; + target?: string +} + +/** Options used when downloading an update */ +interface DownloadOptions { + /** + * Request headers + */ + headers?: HeadersInit + /** + * Timeout in milliseconds + */ + timeout?: number } interface UpdateMetadata { - rid: number; - available: boolean; - currentVersion: string; - version: string; - date?: string; - body?: string; + rid: number + currentVersion: string + version: string + date?: string + body?: string + rawJson: Record } /** Updater download event */ type DownloadEvent = - | { event: "Started"; data: { contentLength?: number } } - | { event: "Progress"; data: { chunkLength: number } } - | { event: "Finished" }; + | { event: 'Started'; data: { contentLength?: number } } + | { event: 'Progress'; data: { chunkLength: number } } + | { event: 'Finished' } class Update extends Resource { - available: boolean; - currentVersion: string; - version: string; - date?: string; - body?: string; + // TODO: remove this field in v3 + /** @deprecated This is always true, check if the return value is `null` instead when using {@linkcode check} */ + available: boolean + currentVersion: string + version: string + date?: string + body?: string + rawJson: Record + private downloadedBytes?: Resource constructor(metadata: UpdateMetadata) { - super(metadata.rid); - this.available = metadata.available; - this.currentVersion = metadata.currentVersion; - this.version = metadata.version; - this.date = metadata.date; - this.body = metadata.body; + super(metadata.rid) + this.available = true + this.currentVersion = metadata.currentVersion + this.version = metadata.version + this.date = metadata.date + this.body = metadata.body + this.rawJson = metadata.rawJson + } + + /** Download the updater package */ + async download( + onEvent?: (progress: DownloadEvent) => void, + options?: DownloadOptions + ): Promise { + const channel = new Channel() + if (onEvent) { + channel.onmessage = onEvent + } + const downloadedBytesRid = await invoke('plugin:updater|download', { + onEvent: channel, + rid: this.rid, + ...options + }) + this.downloadedBytes = new Resource(downloadedBytesRid) + } + + /** Install downloaded updater package */ + async install(): Promise { + if (!this.downloadedBytes) { + throw new Error('Update.install called before Update.download') + } + + await invoke('plugin:updater|install', { + updateRid: this.rid, + bytesRid: this.downloadedBytes.rid + }) + + // Don't need to call close, we did it in rust side already + this.downloadedBytes = undefined } /** Downloads the updater package and installs it */ async downloadAndInstall( onEvent?: (progress: DownloadEvent) => void, + options?: DownloadOptions ): Promise { - const channel = new Channel(); + const channel = new Channel() if (onEvent) { - channel.onmessage = onEvent; + channel.onmessage = onEvent } - return invoke("plugin:updater|download_and_install", { + await invoke('plugin:updater|download_and_install', { onEvent: channel, rid: this.rid, - }); + ...options + }) + } + + async close(): Promise { + await this.downloadedBytes?.close() + await super.close() } } /** Check for updates, resolves to `null` if no updates are available */ async function check(options?: CheckOptions): Promise { if (options?.headers) { - options.headers = Array.from(new Headers(options.headers).entries()); + options.headers = Array.from(new Headers(options.headers).entries()) } - return invoke("plugin:updater|check", { - ...options, - }).then((meta) => (meta.available ? new Update(meta) : null)); + const metadata = await invoke('plugin:updater|check', { + ...options + }) + return metadata ? new Update(metadata) : null } -export type { CheckOptions, DownloadEvent }; -export { check, Update }; +export type { CheckOptions, DownloadOptions, DownloadEvent } +export { check, Update } diff --git a/plugins/updater/package.json b/plugins/updater/package.json index 15a8cf63..08a9a5dd 100644 --- a/plugins/updater/package.json +++ b/plugins/updater/package.json @@ -1,10 +1,11 @@ { "name": "@tauri-apps/plugin-updater", - "version": "2.0.0-beta.1", - "license": "MIT or APACHE-2.0", + "version": "2.7.1", + "license": "MIT OR Apache-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" ], + "repository": "https://github.com/tauri-apps/plugins-workspace", "type": "module", "types": "./dist-js/index.d.ts", "main": "./dist-js/index.cjs", @@ -23,6 +24,6 @@ "LICENSE" ], "dependencies": { - "@tauri-apps/api": "2.0.0-beta.2" + "@tauri-apps/api": "^2.0.0" } } diff --git a/plugins/updater/permissions/autogenerated/commands/download.toml b/plugins/updater/permissions/autogenerated/commands/download.toml new file mode 100644 index 00000000..896b30ce --- /dev/null +++ b/plugins/updater/permissions/autogenerated/commands/download.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-download" +description = "Enables the download command without any pre-configured scope." +commands.allow = ["download"] + +[[permission]] +identifier = "deny-download" +description = "Denies the download command without any pre-configured scope." +commands.deny = ["download"] diff --git a/plugins/updater/permissions/autogenerated/commands/install.toml b/plugins/updater/permissions/autogenerated/commands/install.toml new file mode 100644 index 00000000..4c6a29d4 --- /dev/null +++ b/plugins/updater/permissions/autogenerated/commands/install.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-install" +description = "Enables the install command without any pre-configured scope." +commands.allow = ["install"] + +[[permission]] +identifier = "deny-install" +description = "Denies the install command without any pre-configured scope." +commands.deny = ["install"] diff --git a/plugins/updater/permissions/autogenerated/reference.md b/plugins/updater/permissions/autogenerated/reference.md index 033690d4..74588fef 100644 --- a/plugins/updater/permissions/autogenerated/reference.md +++ b/plugins/updater/permissions/autogenerated/reference.md @@ -1,22 +1,132 @@ -# Permissions +## Default Permission -## allow-check +This permission set configures which kind of +updater functions are exposed to the frontend. + +#### Granted Permissions + +The full workflow from checking for updates to installing them +is enabled. + + + +#### This default permission set includes the following: + +- `allow-check` +- `allow-download` +- `allow-install` +- `allow-download-and-install` + +## Permission Table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IdentifierDescription
+ +`updater:allow-check` + + Enables the check command without any pre-configured scope. -## deny-check +
+ +`updater:deny-check` + + Denies the check command without any pre-configured scope. -## allow-download-and-install +
+ +`updater:allow-download` + + + +Enables the download command without any pre-configured scope. + +
+ +`updater:deny-download` + + + +Denies the download command without any pre-configured scope. + +
+ +`updater:allow-download-and-install` + + Enables the download_and_install command without any pre-configured scope. -## deny-download-and-install +
+ +`updater:deny-download-and-install` + + Denies the download_and_install command without any pre-configured scope. -## default +
+ +`updater:allow-install` + + + +Enables the install command without any pre-configured scope. + +
+ +`updater:deny-install` + + -Allows checking for new updates and installing them +Denies the install command without any pre-configured scope. +
diff --git a/plugins/updater/permissions/default.toml b/plugins/updater/permissions/default.toml index 857f9b5e..fcf08fa8 100644 --- a/plugins/updater/permissions/default.toml +++ b/plugins/updater/permissions/default.toml @@ -1,4 +1,18 @@ "$schema" = "schemas/schema.json" [default] -description = "Allows checking for new updates and installing them" -permissions = ["allow-check", "allow-download-and-install"] +description = """ +This permission set configures which kind of +updater functions are exposed to the frontend. + +#### Granted Permissions + +The full workflow from checking for updates to installing them +is enabled. + +""" +permissions = [ + "allow-check", + "allow-download", + "allow-install", + "allow-download-and-install", +] diff --git a/plugins/updater/permissions/schemas/schema.json b/plugins/updater/permissions/schemas/schema.json index e170fd1b..7f295916 100644 --- a/plugins/updater/permissions/schemas/schema.json +++ b/plugins/updater/permissions/schemas/schema.json @@ -17,7 +17,6 @@ }, "set": { "description": "A list of permissions sets defined", - "default": [], "type": "array", "items": { "$ref": "#/definitions/PermissionSet" @@ -50,7 +49,7 @@ "minimum": 1.0 }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -112,7 +111,7 @@ "type": "string" }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri internal convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -132,12 +131,21 @@ }, "scope": { "description": "Allowed or denied scoped when using this permission.", - "default": {}, "allOf": [ { "$ref": "#/definitions/Scopes" } ] + }, + "platforms": { + "description": "Target platforms this permission applies. By default all platforms are affected by this permission.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Target" + } } } }, @@ -164,7 +172,7 @@ } }, "Scopes": { - "description": "A restriction of the command/endpoint functionality.\n\nIt can be of any serde serializable type and is used for allowing or preventing certain actions inside a Tauri command.\n\nThe scope is passed to the command and handled/enforced by the command itself.", + "description": "An argument for fine grained behavior control of Tauri commands.\n\nIt can be of any serde serializable type and is used to allow or prevent certain actions inside a Tauri command. The configured scope is passed to the command and will be enforced by the command implementation.\n\n## Example\n\n```json { \"allow\": [{ \"path\": \"$HOME/**\" }], \"deny\": [{ \"path\": \"$HOME/secret.txt\" }] } ```", "type": "object", "properties": { "allow": { @@ -178,7 +186,7 @@ } }, "deny": { - "description": "Data that defines what is denied by the scope.", + "description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.", "type": [ "array", "null" @@ -243,45 +251,104 @@ } ] }, - "PermissionKind": { - "type": "string", + "Target": { + "description": "Platform target.", "oneOf": [ { - "description": "allow-check -> Enables the check command without any pre-configured scope.", + "description": "MacOS.", "type": "string", "enum": [ - "allow-check" + "macOS" ] }, { - "description": "deny-check -> Denies the check command without any pre-configured scope.", + "description": "Windows.", "type": "string", "enum": [ - "deny-check" + "windows" ] }, { - "description": "allow-download-and-install -> Enables the download_and_install command without any pre-configured scope.", + "description": "Linux.", "type": "string", "enum": [ - "allow-download-and-install" + "linux" ] }, { - "description": "deny-download-and-install -> Denies the download_and_install command without any pre-configured scope.", + "description": "Android.", "type": "string", "enum": [ - "deny-download-and-install" + "android" ] }, { - "description": "default -> Allows checking for new updates and installing them", + "description": "iOS.", "type": "string", "enum": [ - "default" + "iOS" ] } ] + }, + "PermissionKind": { + "type": "string", + "oneOf": [ + { + "description": "Enables the check command without any pre-configured scope.", + "type": "string", + "const": "allow-check", + "markdownDescription": "Enables the check command without any pre-configured scope." + }, + { + "description": "Denies the check command without any pre-configured scope.", + "type": "string", + "const": "deny-check", + "markdownDescription": "Denies the check command without any pre-configured scope." + }, + { + "description": "Enables the download command without any pre-configured scope.", + "type": "string", + "const": "allow-download", + "markdownDescription": "Enables the download command without any pre-configured scope." + }, + { + "description": "Denies the download command without any pre-configured scope.", + "type": "string", + "const": "deny-download", + "markdownDescription": "Denies the download command without any pre-configured scope." + }, + { + "description": "Enables the download_and_install command without any pre-configured scope.", + "type": "string", + "const": "allow-download-and-install", + "markdownDescription": "Enables the download_and_install command without any pre-configured scope." + }, + { + "description": "Denies the download_and_install command without any pre-configured scope.", + "type": "string", + "const": "deny-download-and-install", + "markdownDescription": "Denies the download_and_install command without any pre-configured scope." + }, + { + "description": "Enables the install command without any pre-configured scope.", + "type": "string", + "const": "allow-install", + "markdownDescription": "Enables the install command without any pre-configured scope." + }, + { + "description": "Denies the install command without any pre-configured scope.", + "type": "string", + "const": "deny-install", + "markdownDescription": "Denies the install command without any pre-configured scope." + }, + { + "description": "This permission set configures which kind of\nupdater functions are exposed to the frontend.\n\n#### Granted Permissions\n\nThe full workflow from checking for updates to installing them\nis enabled.\n\n\n#### This default permission set includes:\n\n- `allow-check`\n- `allow-download`\n- `allow-install`\n- `allow-download-and-install`", + "type": "string", + "const": "default", + "markdownDescription": "This permission set configures which kind of\nupdater functions are exposed to the frontend.\n\n#### Granted Permissions\n\nThe full workflow from checking for updates to installing them\nis enabled.\n\n\n#### This default permission set includes:\n\n- `allow-check`\n- `allow-download`\n- `allow-install`\n- `allow-download-and-install`" + } + ] } } } \ No newline at end of file diff --git a/plugins/updater/rollup.config.js b/plugins/updater/rollup.config.js index 977dfac8..1f349ec8 100644 --- a/plugins/updater/rollup.config.js +++ b/plugins/updater/rollup.config.js @@ -2,6 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { createConfig } from "../../shared/rollup.config.js"; +import { createConfig } from '../../shared/rollup.config.js' -export default createConfig(); +export default createConfig() diff --git a/plugins/updater/src/api-iife.js b/plugins/updater/src/api-iife.js deleted file mode 100644 index 2e443929..00000000 --- a/plugins/updater/src/api-iife.js +++ /dev/null @@ -1 +0,0 @@ -if("__TAURI__"in window){var __TAURI_PLUGIN_UPDATER__=function(e){"use strict";function r(e,r,t,n){if("a"===t&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof r?e!==r||!n:!r.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===t?n:"a"===t?n.call(e):n?n.value:r.get(e)}function t(e,r,t,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof r?e!==r||!s:!r.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(e,t):s?s.value=t:r.set(e,t),t}var n,s;"function"==typeof SuppressedError&&SuppressedError;class i{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,n.set(this,(()=>{})),this.id=function(e,r=!1){return window.__TAURI_INTERNALS__.transformCallback(e,r)}((e=>{r(this,n,"f").call(this,e)}))}set onmessage(e){t(this,n,e,"f")}get onmessage(){return r(this,n,"f")}toJSON(){return`__CHANNEL__:${this.id}`}}async function a(e,r={},t){return window.__TAURI_INTERNALS__.invoke(e,r,t)}n=new WeakMap;class o{get rid(){return r(this,s,"f")}constructor(e){s.set(this,void 0),t(this,s,e,"f")}async close(){return a("plugin:resources|close",{rid:this.rid})}}s=new WeakMap;class c extends o{constructor(e){super(e.rid),this.available=e.available,this.currentVersion=e.currentVersion,this.version=e.version,this.date=e.date,this.body=e.body}async downloadAndInstall(e){const r=new i;return e&&(r.onmessage=e),a("plugin:updater|download_and_install",{onEvent:r,rid:this.rid})}}return e.Update=c,e.check=async function(e){return e?.headers&&(e.headers=Array.from(new Headers(e.headers).entries())),a("plugin:updater|check",{...e}).then((e=>e.available?new c(e):null))},e}({});Object.defineProperty(window.__TAURI__,"updater",{value:__TAURI_PLUGIN_UPDATER__})} diff --git a/plugins/updater/src/commands.rs b/plugins/updater/src/commands.rs index 6d2668f2..ae84294f 100644 --- a/plugins/updater/src/commands.rs +++ b/plugins/updater/src/commands.rs @@ -4,13 +4,14 @@ use crate::{Result, Update, UpdaterExt}; +use http::{HeaderMap, HeaderName, HeaderValue}; use serde::Serialize; -use tauri::{ipc::Channel, AppHandle, Manager, ResourceId, Runtime}; +use tauri::{ipc::Channel, Manager, Resource, ResourceId, Runtime, Webview}; -use std::time::Duration; +use std::{str::FromStr, time::Duration}; use url::Url; -#[derive(Debug, Serialize)] +#[derive(Debug, Clone, Serialize)] #[serde(tag = "event", content = "data")] pub enum DownloadEvent { #[serde(rename_all = "camelCase")] @@ -27,30 +28,33 @@ pub enum DownloadEvent { #[derive(Serialize, Default)] #[serde(rename_all = "camelCase")] pub(crate) struct Metadata { - rid: Option, - available: bool, + rid: ResourceId, current_version: String, version: String, date: Option, body: Option, + raw_json: serde_json::Value, } +struct DownloadedBytes(pub Vec); +impl Resource for DownloadedBytes {} + #[tauri::command] pub(crate) async fn check( - app: AppHandle, + webview: Webview, headers: Option>, timeout: Option, proxy: Option, target: Option, -) -> Result { - let mut builder = app.updater_builder(); +) -> Result> { + let mut builder = webview.updater_builder(); if let Some(headers) = headers { for (k, v) in headers { builder = builder.header(k, v)?; } } if let Some(timeout) = timeout { - builder = builder.timeout(Duration::from_secs(timeout)); + builder = builder.timeout(Duration::from_millis(timeout)); } if let Some(ref proxy) = proxy { let url = Url::parse(proxy.as_str())?; @@ -62,26 +66,111 @@ pub(crate) async fn check( let updater = builder.build()?; let update = updater.check().await?; - let mut metadata = Metadata::default(); + if let Some(update) = update { - metadata.available = true; - metadata.current_version = update.current_version.clone(); - metadata.version = update.version.clone(); - metadata.date = update.date.map(|d| d.to_string()); - metadata.body = update.body.clone(); - metadata.rid = Some(app.resources_table().add(update)); + let formatted_date = if let Some(date) = update.date { + let formatted_date = date + .format(&time::format_description::well_known::Rfc3339) + .map_err(|_| crate::Error::FormatDate)?; + Some(formatted_date) + } else { + None + }; + let metadata = Metadata { + current_version: update.current_version.clone(), + version: update.version.clone(), + date: formatted_date, + body: update.body.clone(), + raw_json: update.raw_json.clone(), + rid: webview.resources_table().add(update), + }; + Ok(Some(metadata)) + } else { + Ok(None) + } +} + +#[tauri::command] +pub(crate) async fn download( + webview: Webview, + rid: ResourceId, + on_event: Channel, + headers: Option>, + timeout: Option, +) -> Result { + let update = webview.resources_table().get::(rid)?; + + let mut update = (*update).clone(); + + if let Some(headers) = headers { + let mut map = HeaderMap::new(); + for (k, v) in headers { + map.append(HeaderName::from_str(&k)?, HeaderValue::from_str(&v)?); + } + update.headers = map; + } + + if let Some(timeout) = timeout { + update.timeout = Some(Duration::from_millis(timeout)); } - Ok(metadata) + let mut first_chunk = true; + let bytes = update + .download( + |chunk_length, content_length| { + if first_chunk { + first_chunk = !first_chunk; + let _ = on_event.send(DownloadEvent::Started { content_length }); + } + let _ = on_event.send(DownloadEvent::Progress { chunk_length }); + }, + || { + let _ = on_event.send(DownloadEvent::Finished); + }, + ) + .await?; + + Ok(webview.resources_table().add(DownloadedBytes(bytes))) +} + +#[tauri::command] +pub(crate) async fn install( + webview: Webview, + update_rid: ResourceId, + bytes_rid: ResourceId, +) -> Result<()> { + let update = webview.resources_table().get::(update_rid)?; + let bytes = webview + .resources_table() + .get::(bytes_rid)?; + update.install(&bytes.0)?; + let _ = webview.resources_table().close(bytes_rid); + Ok(()) } #[tauri::command] pub(crate) async fn download_and_install( - app: AppHandle, + webview: Webview, rid: ResourceId, - on_event: Channel, + on_event: Channel, + headers: Option>, + timeout: Option, ) -> Result<()> { - let update = app.resources_table().get::(rid)?; + let update = webview.resources_table().get::(rid)?; + + let mut update = (*update).clone(); + + if let Some(headers) = headers { + let mut map = HeaderMap::new(); + for (k, v) in headers { + map.append(HeaderName::from_str(&k)?, HeaderValue::from_str(&v)?); + } + update.headers = map; + } + + if let Some(timeout) = timeout { + update.timeout = Some(Duration::from_millis(timeout)); + } let mut first_chunk = true; @@ -95,7 +184,7 @@ pub(crate) async fn download_and_install( let _ = on_event.send(DownloadEvent::Progress { chunk_length }); }, || { - let _ = on_event.send(&DownloadEvent::Finished); + let _ = on_event.send(DownloadEvent::Finished); }, ) .await?; diff --git a/plugins/updater/src/config.rs b/plugins/updater/src/config.rs index aea6a547..6b16bc01 100644 --- a/plugins/updater/src/config.rs +++ b/plugins/updater/src/config.rs @@ -32,6 +32,9 @@ impl WindowsUpdateInstallMode { /// Returns the associated nsis arguments. pub fn nsis_args(&self) -> &'static [&'static str] { + // `/P`: Passive + // `/S`: Silent + // `/R`: Restart match self { Self::Passive => &["/P", "/R"], Self::Quiet => &["/S", "/R"], @@ -46,7 +49,7 @@ impl Display for WindowsUpdateInstallMode { f, "{}", match self { - Self::BasicUi => "basicUI", + Self::BasicUi => "basicUi", Self::Quiet => "quiet", Self::Passive => "passive", } @@ -64,52 +67,92 @@ impl Default for WindowsUpdateInstallMode { #[serde(rename_all = "camelCase")] pub struct WindowsConfig { /// Additional arguments given to the NSIS or WiX installer. - #[serde(default, alias = "installer-args")] + #[serde( + default, + alias = "installer-args", + deserialize_with = "deserialize_os_string" + )] pub installer_args: Vec, - /// Updating mode, see [`WindowsUpdateInstallMode`] for more info. + /// Updating mode, defaults to `passive` mode. + /// + /// See [`WindowsUpdateInstallMode`] for more info. #[serde(default, alias = "install-mode")] pub install_mode: WindowsUpdateInstallMode, } +fn deserialize_os_string<'de, D>(deserializer: D) -> Result, D::Error> +where + D: Deserializer<'de>, +{ + Ok(Vec::::deserialize(deserializer)? + .into_iter() + .map(OsString::from) + .collect::>()) +} + /// Updater configuration. -#[derive(Debug, Clone, Deserialize, Default)] -#[serde(rename_all = "camelCase")] +#[derive(Debug, Clone, Default)] pub struct Config { + /// Dangerously allow using insecure transport protocols for update endpoints. + pub dangerous_insecure_transport_protocol: bool, /// Updater endpoints. - #[serde(default)] - pub endpoints: Vec, + pub endpoints: Vec, /// Signature public key. pub pubkey: String, /// The Windows configuration for the updater. pub windows: Option, } -/// A URL to an updater server. -/// -/// The URL must use the `https` scheme on production. -#[derive(Debug, PartialEq, Eq, Clone)] -pub struct UpdaterEndpoint(pub Url); - -impl std::fmt::Display for UpdaterEndpoint { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", self.0) - } -} - -impl<'de> Deserialize<'de> for UpdaterEndpoint { +impl<'de> Deserialize<'de> for Config { fn deserialize(deserializer: D) -> Result where D: Deserializer<'de>, { - let url = Url::deserialize(deserializer)?; - #[cfg(all(not(debug_assertions), not(feature = "schema")))] - { + #[derive(Deserialize)] + #[serde(rename_all = "camelCase")] + pub struct Config { + #[serde(default, alias = "dangerous-insecure-transport-protocol")] + pub dangerous_insecure_transport_protocol: bool, + #[serde(default)] + pub endpoints: Vec, + pub pubkey: String, + pub windows: Option, + } + + let config = Config::deserialize(deserializer)?; + + validate_endpoints( + &config.endpoints, + config.dangerous_insecure_transport_protocol, + ) + .map_err(serde::de::Error::custom)?; + + Ok(Self { + dangerous_insecure_transport_protocol: config.dangerous_insecure_transport_protocol, + endpoints: config.endpoints, + pubkey: config.pubkey, + windows: config.windows, + }) + } +} + +pub(crate) fn validate_endpoints( + endpoints: &[Url], + dangerous_insecure_transport_protocol: bool, +) -> crate::Result<()> { + if !dangerous_insecure_transport_protocol { + for url in endpoints { if url.scheme() != "https" { - return Err(serde::de::Error::custom( - "The configured updater endpoint must use the `https` protocol.", - )); + #[cfg(debug_assertions)] + { + eprintln!("[\x1b[33mWARNING\x1b[0m] The updater endpoint \"{url}\" doesn't use `https` protocol. This is allowed in development but will fail in release builds."); + eprintln!("[\x1b[33mWARNING\x1b[0m] if this is a desired behavior, you can enable `dangerousInsecureTransportProtocol` in the plugin configuration"); + } + #[cfg(not(debug_assertions))] + return Err(crate::Error::InsecureTransportProtocol); } } - Ok(Self(url)) } + + Ok(()) } diff --git a/plugins/updater/src/error.rs b/plugins/updater/src/error.rs index 43c0d2cb..b82e7d55 100644 --- a/plugins/updater/src/error.rs +++ b/plugins/updater/src/error.rs @@ -54,6 +54,7 @@ pub enum Error { /// UTF8 Errors in signature. #[error("The signature {0} could not be decoded, please check if it is a valid base64 string. The signature must be the contents of the `.sig` file generated by the Tauri bundler, as a string.")] SignatureUtf8(String), + #[cfg(all(target_os = "windows", feature = "zip"))] /// `zip` errors. #[error(transparent)] Extract(#[from] zip::result::ZipError), @@ -62,9 +63,26 @@ pub enum Error { TempDirNotOnSameMountPoint, #[error("binary for the current target not found in the archive")] BinaryNotFoundInArchive, + #[error("failed to create temporary directory")] + TempDirNotFound, + #[error("Authentication failed or was cancelled")] + AuthenticationFailed, + #[error("Failed to install .deb package")] + DebInstallFailed, + #[error("invalid updater binary format")] + InvalidUpdaterFormat, #[error(transparent)] Http(#[from] http::Error), #[error(transparent)] + InvalidHeaderValue(#[from] http::header::InvalidHeaderValue), + #[error(transparent)] + InvalidHeaderName(#[from] http::header::InvalidHeaderName), + #[error("Failed to format date")] + FormatDate, + /// The configured updater endpoint must use a secure protocol like `https` + #[error("The configured updater endpoint must use a secure protocol like `https`.")] + InsecureTransportProtocol, + #[error(transparent)] Tauri(#[from] tauri::Error), } diff --git a/plugins/updater/src/lib.rs b/plugins/updater/src/lib.rs index 8c0ea2cb..fb059e43 100644 --- a/plugins/updater/src/lib.rs +++ b/plugins/updater/src/lib.rs @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -//! [![](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/updater/banner.png)](https://github.com/tauri-apps/plugins-workspace/tree/v2/plugins/updater) -//! //! In-app updates for Tauri applications. //! //! - Supported platforms: Windows, Linux and macOS.crypted database and secure runtime. @@ -13,8 +11,10 @@ html_favicon_url = "https://github.com/tauri-apps/tauri/raw/dev/app-icon.png" )] -use std::ffi::{OsStr, OsString}; +use std::{ffi::OsString, sync::Arc}; +use http::{HeaderMap, HeaderName, HeaderValue}; +use semver::Version; use tauri::{ plugin::{Builder as PluginBuilder, TauriPlugin}, Manager, Runtime, @@ -29,7 +29,7 @@ pub use config::Config; pub use error::{Error, Result}; pub use updater::*; -/// Extension trait to use the updater on [`tauri::App`], [`tauri::AppHandle`] and [`tauri::Window`]. +/// Extensions to [`tauri::App`], [`tauri::AppHandle`], [`tauri::WebviewWindow`], [`tauri::Webview`] and [`tauri::Window`] to access the updater APIs. pub trait UpdaterExt { /// Gets the updater builder to build and updater /// that can manually check if an update is available. @@ -70,10 +70,14 @@ pub trait UpdaterExt { impl> UpdaterExt for T { fn updater_builder(&self) -> UpdaterBuilder { let app = self.app_handle(); - let version = app.package_info().version.clone(); - let UpdaterState { config, target } = self.state::().inner(); + let UpdaterState { + config, + target, + version_comparator, + headers, + } = self.state::().inner(); - let mut builder = UpdaterBuilder::new(version, config.clone()); + let mut builder = UpdaterBuilder::new(app, config.clone()).headers(headers.clone()); if let Some(target) = target { builder = builder.target(target); @@ -81,9 +85,11 @@ impl> UpdaterExt for T { let args = self.env().args_os; if !args.is_empty() { - builder = builder.installer_arg("/ARGS").installer_args(args); + builder = builder.current_exe_args(args); } + builder.version_comparator = version_comparator.clone(); + #[cfg(any( target_os = "linux", target_os = "dragonfly", @@ -98,6 +104,11 @@ impl> UpdaterExt for T { } } + let app_handle = app.app_handle().clone(); + builder = builder.on_before_exit(move || { + app_handle.cleanup_before_exit(); + }); + builder } @@ -109,6 +120,8 @@ impl> UpdaterExt for T { struct UpdaterState { target: Option, config: Config, + version_comparator: Option, + headers: HeaderMap, } #[derive(Default)] @@ -116,6 +129,8 @@ pub struct Builder { target: Option, pubkey: Option, installer_args: Vec, + headers: HeaderMap, + default_version_comparator: Option, } impl Builder { @@ -136,21 +151,17 @@ impl Builder { pub fn installer_args(mut self, args: I) -> Self where I: IntoIterator, - S: AsRef, + S: Into, { - let args = args - .into_iter() - .map(|a| a.as_ref().to_os_string()) - .collect::>(); - self.installer_args.extend_from_slice(&args); + self.installer_args.extend(args.into_iter().map(Into::into)); self } pub fn installer_arg(mut self, arg: S) -> Self where - S: AsRef, + S: Into, { - self.installer_args.push(arg.as_ref().to_os_string()); + self.installer_args.push(arg.into()); self } @@ -159,26 +170,64 @@ impl Builder { self } + pub fn header(mut self, key: K, value: V) -> Result + where + HeaderName: TryFrom, + >::Error: Into, + HeaderValue: TryFrom, + >::Error: Into, + { + let key: std::result::Result = key.try_into().map_err(Into::into); + let value: std::result::Result = + value.try_into().map_err(Into::into); + self.headers.insert(key?, value?); + + Ok(self) + } + + pub fn headers(mut self, headers: HeaderMap) -> Self { + self.headers = headers; + self + } + + pub fn default_version_comparator< + F: Fn(Version, RemoteRelease) -> bool + Send + Sync + 'static, + >( + mut self, + f: F, + ) -> Self { + self.default_version_comparator.replace(Arc::new(f)); + self + } + pub fn build(self) -> TauriPlugin { let pubkey = self.pubkey; let target = self.target; + let version_comparator = self.default_version_comparator; let installer_args = self.installer_args; + let headers = self.headers; PluginBuilder::::new("updater") - .js_init_script(include_str!("api-iife.js").to_string()) .setup(move |app, api| { let mut config = api.config().clone(); if let Some(pubkey) = pubkey { config.pubkey = pubkey; } if let Some(windows) = &mut config.windows { - windows.installer_args.extend_from_slice(&installer_args); + windows.installer_args.extend(installer_args); } - app.manage(UpdaterState { target, config }); + app.manage(UpdaterState { + target, + config, + version_comparator, + headers, + }); Ok(()) }) .invoke_handler(tauri::generate_handler![ commands::check, - commands::download_and_install + commands::download, + commands::install, + commands::download_and_install, ]) .build() } diff --git a/plugins/updater/src/updater.rs b/plugins/updater/src/updater.rs index a77d0af5..78fc0a9b 100644 --- a/plugins/updater/src/updater.rs +++ b/plugins/updater/src/updater.rs @@ -4,24 +4,29 @@ use std::{ collections::HashMap, - ffi::{OsStr, OsString}, - io::{Cursor, Read}, + ffi::OsString, + io::Cursor, path::{Path, PathBuf}, str::FromStr, + sync::Arc, time::Duration, }; +#[cfg(not(target_os = "macos"))] +use std::ffi::OsStr; + use base64::Engine; use futures_util::StreamExt; -use http::HeaderName; +use http::{header::ACCEPT, HeaderName}; use minisign_verify::{PublicKey, Signature}; +use percent_encoding::{AsciiSet, CONTROLS}; use reqwest::{ header::{HeaderMap, HeaderValue}, ClientBuilder, StatusCode, }; use semver::Version; use serde::{de::Error as DeError, Deserialize, Deserializer, Serialize}; -use tauri::{utils::platform::current_exe, Resource}; +use tauri::{utils::platform::current_exe, AppHandle, Resource, Runtime}; use time::OffsetDateTime; use url::Url; @@ -30,6 +35,8 @@ use crate::{ Config, }; +const UPDATER_USER_AGENT: &str = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"),); + #[derive(Debug, Deserialize, Serialize, Clone)] pub struct ReleaseManifestPlatform { /// Download URL for the platform @@ -88,10 +95,20 @@ impl RemoteRelease { } } +pub type OnBeforeExit = Arc; +pub type OnBeforeRequest = Arc ClientBuilder + Send + Sync + 'static>; +pub type VersionComparator = Arc bool + Send + Sync>; +type MainThreadClosure = Box; +type RunOnMainThread = + Box std::result::Result<(), tauri::Error> + Send + Sync + 'static>; + pub struct UpdaterBuilder { + #[allow(dead_code)] + run_on_main_thread: RunOnMainThread, + app_name: String, current_version: Version, config: Config, - version_comparator: Option bool + Send + Sync>>, + pub(crate) version_comparator: Option, executable_path: Option, target: Option, endpoints: Option>, @@ -99,17 +116,25 @@ pub struct UpdaterBuilder { timeout: Option, proxy: Option, installer_args: Vec, + current_exe_args: Vec, + on_before_exit: Option, + configure_client: Option, } impl UpdaterBuilder { - pub fn new(current_version: Version, config: crate::Config) -> Self { + pub(crate) fn new(app: &AppHandle, config: crate::Config) -> Self { + let app_ = app.clone(); + let run_on_main_thread = move |f| app_.run_on_main_thread(f); Self { + run_on_main_thread: Box::new(run_on_main_thread), installer_args: config .windows .as_ref() .map(|w| w.installer_args.clone()) .unwrap_or_default(), - current_version, + current_exe_args: Vec::new(), + app_name: app.package_info().name.clone(), + current_version: app.package_info().version.clone(), config, version_comparator: None, executable_path: None, @@ -118,6 +143,8 @@ impl UpdaterBuilder { headers: Default::default(), timeout: None, proxy: None, + on_before_exit: None, + configure_client: None, } } @@ -125,7 +152,7 @@ impl UpdaterBuilder { mut self, f: F, ) -> Self { - self.version_comparator = Some(Box::new(f)); + self.version_comparator = Some(Arc::new(f)); self } @@ -134,9 +161,14 @@ impl UpdaterBuilder { self } - pub fn endpoints(mut self, endpoints: Vec) -> Self { + pub fn endpoints(mut self, endpoints: Vec) -> Result { + crate::config::validate_endpoints( + &endpoints, + self.config.dangerous_insecure_transport_protocol, + )?; + self.endpoints.replace(endpoints); - self + Ok(self) } pub fn executable_path>(mut self, p: P) -> Self { @@ -159,6 +191,16 @@ impl UpdaterBuilder { Ok(self) } + pub fn headers(mut self, headers: HeaderMap) -> Self { + self.headers = headers; + self + } + + pub fn clear_headers(mut self) -> Self { + self.headers.clear(); + self + } + pub fn timeout(mut self, timeout: Duration) -> Self { self.timeout = Some(timeout); self @@ -176,22 +218,18 @@ impl UpdaterBuilder { pub fn installer_arg(mut self, arg: S) -> Self where - S: AsRef, + S: Into, { - self.installer_args.push(arg.as_ref().to_os_string()); + self.installer_args.push(arg.into()); self } pub fn installer_args(mut self, args: I) -> Self where I: IntoIterator, - S: AsRef, + S: Into, { - let args = args - .into_iter() - .map(|a| a.as_ref().to_os_string()) - .collect::>(); - self.installer_args.extend_from_slice(&args); + self.installer_args.extend(args.into_iter().map(Into::into)); self } @@ -200,10 +238,28 @@ impl UpdaterBuilder { self } + pub fn on_before_exit(mut self, f: F) -> Self { + self.on_before_exit.replace(Arc::new(f)); + self + } + + /// Allows you to modify the `reqwest` client builder before the HTTP request is sent. + /// + /// Note that `reqwest` crate may be updated in minor releases of tauri-plugin-updater. + /// Therefore it's recommended to pin the plugin to at least a minor version when you're using `configure_client`. + /// + pub fn configure_client ClientBuilder + Send + Sync + 'static>( + mut self, + f: F, + ) -> Self { + self.configure_client.replace(Arc::new(f)); + self + } + pub fn build(self) -> Result { let endpoints = self .endpoints - .unwrap_or_else(|| self.config.endpoints.iter().map(|e| e.0.clone()).collect()); + .unwrap_or_else(|| self.config.endpoints.clone()); if endpoints.is_empty() { return Err(Error::EmptyEndpoints); @@ -227,31 +283,49 @@ impl UpdaterBuilder { }; Ok(Updater { + run_on_main_thread: Arc::new(self.run_on_main_thread), config: self.config, + app_name: self.app_name, current_version: self.current_version, version_comparator: self.version_comparator, timeout: self.timeout, proxy: self.proxy, endpoints, installer_args: self.installer_args, + current_exe_args: self.current_exe_args, arch, target, json_target, headers: self.headers, extract_path, + on_before_exit: self.on_before_exit, + configure_client: self.configure_client, }) } } +impl UpdaterBuilder { + pub(crate) fn current_exe_args(mut self, args: I) -> Self + where + I: IntoIterator, + S: Into, + { + self.current_exe_args + .extend(args.into_iter().map(Into::into)); + self + } +} + pub struct Updater { + #[allow(dead_code)] + run_on_main_thread: Arc, config: Config, + app_name: String, current_version: Version, - version_comparator: Option bool + Send + Sync>>, + version_comparator: Option, timeout: Option, proxy: Option, endpoints: Vec, - #[allow(dead_code)] - installer_args: Vec, arch: &'static str, // The `{{target}}` variable we replace in the endpoint target: String, @@ -259,13 +333,21 @@ pub struct Updater { json_target: String, headers: HeaderMap, extract_path: PathBuf, + on_before_exit: Option, + configure_client: Option, + #[allow(unused)] + installer_args: Vec, + #[allow(unused)] + current_exe_args: Vec, } impl Updater { pub async fn check(&self) -> Result> { // we want JSON only let mut headers = self.headers.clone(); - headers.insert("Accept", HeaderValue::from_str("application/json").unwrap()); + if !headers.contains_key(ACCEPT) { + headers.insert(ACCEPT, HeaderValue::from_static("application/json")); + } // Set SSL certs for linux if they aren't available. #[cfg(target_os = "linux")] @@ -279,6 +361,7 @@ impl Updater { } let mut remote_release: Option = None; + let mut raw_json: Option = None; let mut last_error: Option = None; for url in &self.endpoints { // replace {{current_version}}, {{target}} and {{arch}} in the provided URL @@ -288,29 +371,40 @@ impl Updater { // https://releases.myapp.com/update/darwin/aarch64/1.0.0 // The main objective is if the update URL is defined via the Cargo.toml // the URL will be generated dynamically + let version = self.current_version.to_string(); + let version = version.as_bytes(); + const CONTROLS_ADD: &AsciiSet = &CONTROLS.add(b'+'); + let encoded_version = percent_encoding::percent_encode(version, CONTROLS_ADD); + let encoded_version = encoded_version.to_string(); + let url: Url = url .to_string() // url::Url automatically url-encodes the path components - .replace( - "%7B%7Bcurrent_version%7D%7D", - &self.current_version.to_string(), - ) + .replace("%7B%7Bcurrent_version%7D%7D", &encoded_version) .replace("%7B%7Btarget%7D%7D", &self.target) .replace("%7B%7Barch%7D%7D", self.arch) // but not query parameters - .replace("{{current_version}}", &self.current_version.to_string()) + .replace("{{current_version}}", &encoded_version) .replace("{{target}}", &self.target) .replace("{{arch}}", self.arch) .parse()?; - let mut request = ClientBuilder::new(); + log::debug!("checking for updates {url}"); + + let mut request = ClientBuilder::new().user_agent(UPDATER_USER_AGENT); if let Some(timeout) = self.timeout { request = request.timeout(timeout); } if let Some(ref proxy) = self.proxy { + log::debug!("using proxy {proxy}"); let proxy = reqwest::Proxy::all(proxy.as_str())?; request = request.proxy(proxy); } + + if let Some(ref configure_client) = self.configure_client { + request = configure_client(request); + } + let response = request .build()? .get(url) @@ -318,25 +412,43 @@ impl Updater { .send() .await; - if let Ok(res) = response { - if res.status().is_success() { - // no updates found! - if StatusCode::NO_CONTENT == res.status() { - return Ok(None); - }; - - match serde_json::from_value::(res.json().await?) - .map_err(Into::into) - { - Ok(release) => { - last_error = None; - remote_release = Some(release); - // we found a relase, break the loop - break; + match response { + Ok(res) => { + if res.status().is_success() { + // no updates found! + if StatusCode::NO_CONTENT == res.status() { + log::debug!("update endpoint returned 204 No Content"); + return Ok(None); + }; + + let update_response: serde_json::Value = res.json().await?; + log::debug!("update response: {update_response:?}"); + raw_json = Some(update_response.clone()); + match serde_json::from_value::(update_response) + .map_err(Into::into) + { + Ok(release) => { + log::debug!("parsed release response {release:?}"); + last_error = None; + remote_release = Some(release); + // we found a release, break the loop + break; + } + Err(err) => { + log::error!("failed to deserialize update response: {err}"); + last_error = Some(err) + } } - Err(err) => last_error = Some(err), + } else { + log::error!( + "update endpoint did not respond with a successful status code" + ); } } + Err(err) => { + log::error!("failed to check for updates: {err}"); + last_error = Some(err.into()) + } } } @@ -356,19 +468,25 @@ impl Updater { let update = if should_update { Some(Update { + run_on_main_thread: self.run_on_main_thread.clone(), config: self.config.clone(), + on_before_exit: self.on_before_exit.clone(), + app_name: self.app_name.clone(), current_version: self.current_version.to_string(), target: self.target.clone(), extract_path: self.extract_path.clone(), - installer_args: self.installer_args.clone(), version: release.version.to_string(), date: release.pub_date, download_url: release.download_url(&self.json_target)?.to_owned(), - body: release.notes.clone(), signature: release.signature(&self.json_target)?.to_owned(), - timeout: self.timeout, + body: release.notes, + raw_json: raw_json.unwrap(), + timeout: None, proxy: self.proxy.clone(), headers: self.headers.clone(), + installer_args: self.installer_args.clone(), + current_exe_args: self.current_exe_args.clone(), + configure_client: self.configure_client.clone(), }) } else { None @@ -378,9 +496,13 @@ impl Updater { } } -#[derive(Debug, Clone)] +#[derive(Clone)] pub struct Update { + #[allow(dead_code)] + run_on_main_thread: Arc, config: Config, + #[allow(unused)] + on_before_exit: Option, /// Update description pub body: Option, /// Version used to check for update @@ -391,21 +513,29 @@ pub struct Update { pub date: Option, /// Target pub target: String, - /// Extract path - #[allow(unused)] - extract_path: PathBuf, - #[allow(unused)] - installer_args: Vec, /// Download URL announced pub download_url: Url, /// Signature announced pub signature: String, + /// The raw version of server's JSON response. Useful if the response contains additional fields that the updater doesn't handle. + pub raw_json: serde_json::Value, /// Request timeout pub timeout: Option, /// Request proxy pub proxy: Option, /// Request headers pub headers: HeaderMap, + /// Extract path + #[allow(unused)] + extract_path: PathBuf, + /// App name, used for creating named tempfiles on Windows + #[allow(unused)] + app_name: String, + #[allow(unused)] + installer_args: Vec, + #[allow(unused)] + current_exe_args: Vec, + configure_client: Option, } impl Resource for Update {} @@ -421,16 +551,11 @@ impl Update { ) -> Result> { // set our headers let mut headers = self.headers.clone(); - headers.insert( - "Accept", - HeaderValue::from_str("application/octet-stream").unwrap(), - ); - headers.insert( - "User-Agent", - HeaderValue::from_str("tauri-updater").unwrap(), - ); + if !headers.contains_key(ACCEPT) { + headers.insert(ACCEPT, HeaderValue::from_static("application/octet-stream")); + } - let mut request = ClientBuilder::new(); + let mut request = ClientBuilder::new().user_agent(UPDATER_USER_AGENT); if let Some(timeout) = self.timeout { request = request.timeout(timeout); } @@ -438,6 +563,9 @@ impl Update { let proxy = reqwest::Proxy::all(proxy.as_str())?; request = request.proxy(proxy); } + if let Some(ref configure_client) = self.configure_client { + request = configure_client(request); + } let response = request .build()? .get(self.download_url.clone()) @@ -463,23 +591,19 @@ impl Update { let mut stream = response.bytes_stream(); while let Some(chunk) = stream.next().await { let chunk = chunk?; - let bytes = chunk.as_ref().to_vec(); - on_chunk(bytes.len(), content_length); - buffer.extend(bytes); + on_chunk(chunk.len(), content_length); + buffer.extend(chunk); } - on_download_finish(); - let mut update_buffer = Cursor::new(&buffer); - - verify_signature(&mut update_buffer, &self.signature, &self.config.pubkey)?; + verify_signature(&buffer, &self.signature, &self.config.pubkey)?; Ok(buffer) } /// Installs the updater package downloaded by [`Update::download`] - pub fn install(&self, bytes: Vec) -> Result<()> { - self.install_inner(bytes) + pub fn install(&self, bytes: impl AsRef<[u8]>) -> Result<()> { + self.install_inner(bytes.as_ref()) } /// Downloads and installs the updater package @@ -493,198 +617,248 @@ impl Update { } #[cfg(mobile)] - fn install_inner(&self, bytes: Vec) -> Result<()> { + fn install_inner(&self, _bytes: &[u8]) -> Result<()> { Ok(()) } +} - // Windows - // - // ### Expected structure: - // ├── [AppName]_[version]_x64.msi.zip # ZIP generated by tauri-bundler - // │ └──[AppName]_[version]_x64.msi # Application MSI - // ├── [AppName]_[version]_x64-setup.exe.zip # ZIP generated by tauri-bundler - // │ └──[AppName]_[version]_x64-setup.exe # NSIS installer - // └── ... - // - // ## MSI - // Update server can provide a MSI for Windows. (Generated with tauri-bundler from *Wix*) - // To replace current version of the application. In later version we'll offer - // incremental update to push specific binaries. - // - // ## EXE - // Update server can provide a custom EXE (installer) who can run any task. - #[cfg(windows)] - fn install_inner(&self, bytes: Vec) -> Result<()> { - use std::{fs, process::Command}; +#[cfg(windows)] +enum WindowsUpdaterType { + Nsis { + path: PathBuf, + #[allow(unused)] + temp: Option, + }, + Msi { + path: PathBuf, + #[allow(unused)] + temp: Option, + }, +} - // FIXME: We need to create a memory buffer with the MSI and then run it. - // (instead of extracting the MSI to a temp path) - // - // The tricky part is the MSI need to be exposed and spawned so the memory allocation - // shouldn't drop but we should be able to pass the reference so we can drop it once the installation - // is done, otherwise we have a huge memory leak. +#[cfg(windows)] +impl WindowsUpdaterType { + fn nsis(path: PathBuf, temp: Option) -> Self { + Self::Nsis { path, temp } + } - let archive = Cursor::new(bytes); + fn msi(path: PathBuf, temp: Option) -> Self { + Self::Msi { + path: path.wrap_in_quotes(), + temp, + } + } +} - let tmp_dir = tempfile::Builder::new().tempdir()?.into_path(); +#[cfg(windows)] +impl Config { + fn install_mode(&self) -> crate::config::WindowsUpdateInstallMode { + self.windows + .as_ref() + .map(|w| w.install_mode.clone()) + .unwrap_or_default() + } +} - // extract the buffer to the tmp_dir - // we extract our signed archive into our final directory without any temp file - let mut extractor = zip::ZipArchive::new(archive)?; +/// Windows +#[cfg(windows)] +impl Update { + /// ### Expected structure: + /// ├── [AppName]_[version]_x64.msi # Application MSI + /// ├── [AppName]_[version]_x64-setup.exe # NSIS installer + /// ├── [AppName]_[version]_x64.msi.zip # ZIP generated by tauri-bundler + /// │ └──[AppName]_[version]_x64.msi # Application MSI + /// ├── [AppName]_[version]_x64-setup.exe.zip # ZIP generated by tauri-bundler + /// │ └──[AppName]_[version]_x64-setup.exe # NSIS installer + /// └── ... + fn install_inner(&self, bytes: &[u8]) -> Result<()> { + use std::iter::once; + use windows_sys::{ + w, + Win32::UI::{Shell::ShellExecuteW, WindowsAndMessaging::SW_SHOW}, + }; - // extract the msi - extractor.extract(&tmp_dir)?; + let updater_type = self.extract(bytes)?; + + let install_mode = self.config.install_mode(); + let current_args = &self.current_exe_args()[1..]; + let msi_args; + + let installer_args: Vec<&OsStr> = match &updater_type { + WindowsUpdaterType::Nsis { .. } => install_mode + .nsis_args() + .iter() + .map(OsStr::new) + .chain(once(OsStr::new("/UPDATE"))) + .chain(once(OsStr::new("/ARGS"))) + .chain(current_args.to_vec()) + .chain(self.installer_args()) + .collect(), + WindowsUpdaterType::Msi { path, .. } => { + let escaped_args = current_args + .iter() + .map(escape_msi_property_arg) + .collect::>() + .join(" "); + msi_args = OsString::from(format!("LAUNCHAPPARGS=\"{escaped_args}\"")); + + [OsStr::new("/i"), path.as_os_str()] + .into_iter() + .chain(install_mode.msiexec_args().iter().map(OsStr::new)) + .chain(once(OsStr::new("/promptrestart"))) + .chain(self.installer_args()) + .chain(once(OsStr::new("AUTOLAUNCHAPP=True"))) + .chain(once(msi_args.as_os_str())) + .collect() + } + }; - let paths = fs::read_dir(&tmp_dir)?; + if let Some(on_before_exit) = self.on_before_exit.as_ref() { + log::debug!("running on_before_exit hook"); + on_before_exit(); + } - let system_root = std::env::var("SYSTEMROOT"); - let powershell_path = system_root.as_ref().map_or_else( - |_| "powershell.exe".to_string(), - |p| format!("{p}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"), - ); + let file = match &updater_type { + WindowsUpdaterType::Nsis { path, .. } => path.as_os_str().to_os_string(), + WindowsUpdaterType::Msi { .. } => std::env::var("SYSTEMROOT").as_ref().map_or_else( + |_| OsString::from("msiexec.exe"), + |p| OsString::from(format!("{p}\\System32\\msiexec.exe")), + ), + }; + let file = encode_wide(file); + + let parameters = installer_args.join(OsStr::new(" ")); + let parameters = encode_wide(parameters); + + unsafe { + ShellExecuteW( + std::ptr::null_mut(), + w!("open"), + file.as_ptr(), + parameters.as_ptr(), + std::ptr::null(), + SW_SHOW, + ) + }; - for path in paths { - let found_path = path?.path(); - // we support 2 type of files exe & msi for now - // If it's an `exe` we expect an installer not a runtime. - if found_path.extension() == Some(OsStr::new("exe")) { - // we need to wrap the installer path in quotes for Start-Process - let mut installer_path = std::ffi::OsString::new(); - installer_path.push("\""); - installer_path.push(&found_path); - installer_path.push("\""); - - let installer_args = [ - self.config - .windows - .as_ref() - .map(|w| { - w.install_mode - .nsis_args() - .iter() - .map(|a| OsStr::new(a)) - .collect::>() - }) - .unwrap_or_default(), - self.installer_args - .iter() - .map(|a| a.as_os_str()) - .collect::>(), - ] - .concat(); - - // Run the installer - let mut cmd = Command::new(powershell_path); - - cmd.args(["-NoProfile", "-WindowStyle", "Hidden"]) - .args(["Start-Process"]) - .arg(installer_path); - - if !installer_args.is_empty() { - cmd.arg("-ArgumentList") - .arg(installer_args.join(OsStr::new(", "))); - } - cmd.spawn().expect("installer failed to start"); - - std::process::exit(0); - } else if found_path.extension() == Some(OsStr::new("msi")) { - // we need to wrap the current exe path in quotes for Start-Process - let mut current_exe_arg = std::ffi::OsString::new(); - current_exe_arg.push("\""); - current_exe_arg.push(current_exe()?); - current_exe_arg.push("\""); - - let mut msi_path = std::ffi::OsString::new(); - msi_path.push("\"\"\""); - msi_path.push(&found_path); - msi_path.push("\"\"\""); - - let installer_args = [ - self.config - .windows - .as_ref() - .map(|w| { - w.install_mode - .msiexec_args() - .iter() - .map(|a| OsStr::new(a)) - .collect::>() - }) - .unwrap_or_default(), - self.installer_args - .iter() - .map(|a| a.as_os_str()) - .collect::>(), - ] - .concat(); - - // run the installer and relaunch the application - let powershell_install_res = Command::new(powershell_path) - .args(["-NoProfile", "-WindowStyle", "Hidden"]) - .args([ - "Start-Process", - "-Wait", - "-FilePath", - "$Env:SYSTEMROOT\\System32\\msiexec.exe", - "-ArgumentList", - ]) - .arg("/i,") - .arg(&msi_path) - .arg(format!( - ", {}, /promptrestart;", - installer_args.join(OsStr::new(", ")).to_string_lossy() - )) - .arg("Start-Process") - .arg(current_exe_arg) - .spawn(); - if powershell_install_res.is_err() { - // fallback to running msiexec directly - relaunch won't be available - // we use this here in case powershell fails in an older machine somehow - let msiexec_path = system_root.as_ref().map_or_else( - |_| "msiexec.exe".to_string(), - |p| format!("{p}\\System32\\msiexec.exe"), - ); - let _ = Command::new(msiexec_path) - .arg("/i") - .arg(msi_path) - .args(installer_args) - .arg("/promptrestart") - .spawn(); - } + std::process::exit(0); + } + + fn installer_args(&self) -> Vec<&OsStr> { + self.installer_args + .iter() + .map(OsStr::new) + .collect::>() + } + + fn current_exe_args(&self) -> Vec<&OsStr> { + self.current_exe_args + .iter() + .map(OsStr::new) + .collect::>() + } + + fn extract(&self, bytes: &[u8]) -> Result { + #[cfg(feature = "zip")] + if infer::archive::is_zip(bytes) { + return self.extract_zip(bytes); + } + + self.extract_exe(bytes) + } + + fn make_temp_dir(&self) -> Result { + Ok(tempfile::Builder::new() + .prefix(&format!("{}-{}-updater-", self.app_name, self.version)) + .tempdir()? + .into_path()) + } + + #[cfg(feature = "zip")] + fn extract_zip(&self, bytes: &[u8]) -> Result { + let temp_dir = self.make_temp_dir()?; - std::process::exit(0); + let archive = Cursor::new(bytes); + let mut extractor = zip::ZipArchive::new(archive)?; + extractor.extract(&temp_dir)?; + + let paths = std::fs::read_dir(&temp_dir)?; + for path in paths { + let path = path?.path(); + let ext = path.extension(); + if ext == Some(OsStr::new("exe")) { + return Ok(WindowsUpdaterType::nsis(path, None)); + } else if ext == Some(OsStr::new("msi")) { + return Ok(WindowsUpdaterType::msi(path, None)); } } - Ok(()) + Err(crate::Error::BinaryNotFoundInArchive) } - // Linux (AppImage) - // - // ### Expected structure: - // ├── [AppName]_[version]_amd64.AppImage.tar.gz # GZ generated by tauri-bundler - // │ └──[AppName]_[version]_amd64.AppImage # Application AppImage - // └── ... - // - // We should have an AppImage already installed to be able to copy and install - // the extract_path is the current AppImage path - // tmp_dir is where our new AppImage is found - #[cfg(any( - target_os = "linux", - target_os = "dragonfly", - target_os = "freebsd", - target_os = "netbsd", - target_os = "openbsd" - ))] - fn install_inner(&self, bytes: Vec) -> Result<()> { - use flate2::read::GzDecoder; + fn extract_exe(&self, bytes: &[u8]) -> Result { + if infer::app::is_exe(bytes) { + let (path, temp) = self.write_to_temp(bytes, ".exe")?; + Ok(WindowsUpdaterType::nsis(path, temp)) + } else if infer::archive::is_msi(bytes) { + let (path, temp) = self.write_to_temp(bytes, ".msi")?; + Ok(WindowsUpdaterType::msi(path, temp)) + } else { + Err(crate::Error::InvalidUpdaterFormat) + } + } + + fn write_to_temp( + &self, + bytes: &[u8], + ext: &str, + ) -> Result<(PathBuf, Option)> { + use std::io::Write; + + let temp_dir = self.make_temp_dir()?; + let mut temp_file = tempfile::Builder::new() + .prefix(&format!("{}-{}-installer", self.app_name, self.version)) + .suffix(ext) + .rand_bytes(0) + .tempfile_in(temp_dir)?; + temp_file.write_all(bytes)?; + + let temp = temp_file.into_temp_path(); + Ok((temp.to_path_buf(), Some(temp))) + } +} + +/// Linux (AppImage and Deb) +#[cfg(any( + target_os = "linux", + target_os = "dragonfly", + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd" +))] +impl Update { + /// ### Expected structure: + /// ├── [AppName]_[version]_amd64.AppImage.tar.gz # GZ generated by tauri-bundler + /// │ └──[AppName]_[version]_amd64.AppImage # Application AppImage + /// ├── [AppName]_[version]_amd64.deb # Debian package + /// └── ... + /// + fn install_inner(&self, bytes: &[u8]) -> Result<()> { + if self.is_deb_package() { + self.install_deb(bytes) + } else { + // Handle AppImage or other formats + self.install_appimage(bytes) + } + } + + fn install_appimage(&self, bytes: &[u8]) -> Result<()> { use std::os::unix::fs::{MetadataExt, PermissionsExt}; - let archive = Cursor::new(bytes); let extract_path_metadata = self.extract_path.metadata()?; let tmp_dir_locations = vec![ Box::new(|| Some(std::env::temp_dir())) as Box Option>, - Box::new(dirs_next::cache_dir), + Box::new(dirs::cache_dir), Box::new(|| Some(self.extract_path.parent().unwrap().to_path_buf())), ]; @@ -702,30 +876,48 @@ impl Update { let tmp_app_image = &tmp_dir.path().join("current_app.AppImage"); + let permissions = std::fs::metadata(&self.extract_path)?.permissions(); + // create a backup of our current app image std::fs::rename(&self.extract_path, tmp_app_image)?; - // extract the buffer to the tmp_dir - // we extract our signed archive into our final directory without any temp file - let decoder = GzDecoder::new(archive); - let mut archive = tar::Archive::new(decoder); - for mut entry in archive.entries()?.flatten() { - if let Ok(path) = entry.path() { - if path.extension() == Some(OsStr::new("AppImage")) { - // if something went wrong during the extraction, we should restore previous app - if let Err(err) = entry.unpack(&self.extract_path) { - std::fs::rename(tmp_app_image, &self.extract_path)?; - return Err(err.into()); + #[cfg(feature = "zip")] + if infer::archive::is_gz(bytes) { + log::debug!("extracting AppImage"); + // extract the buffer to the tmp_dir + // we extract our signed archive into our final directory without any temp file + let archive = Cursor::new(bytes); + let decoder = flate2::read::GzDecoder::new(archive); + let mut archive = tar::Archive::new(decoder); + for mut entry in archive.entries()?.flatten() { + if let Ok(path) = entry.path() { + if path.extension() == Some(OsStr::new("AppImage")) { + // if something went wrong during the extraction, we should restore previous app + if let Err(err) = entry.unpack(&self.extract_path) { + std::fs::rename(tmp_app_image, &self.extract_path)?; + return Err(err.into()); + } + // early finish we have everything we need here + return Ok(()); } - // early finish we have everything we need here - return Ok(()); } } + // if we have not returned early we should restore the backup + std::fs::rename(tmp_app_image, &self.extract_path)?; + return Err(Error::BinaryNotFoundInArchive); } - // if we have not returned early we should restore the backup - std::fs::rename(tmp_app_image, &self.extract_path)?; - return Err(Error::BinaryNotFoundInArchive); + log::debug!("rewriting AppImage"); + return match std::fs::write(&self.extract_path, bytes) + .and_then(|_| std::fs::set_permissions(&self.extract_path, permissions)) + { + Err(err) => { + // if something went wrong during the extraction, we should restore previous app + std::fs::rename(tmp_app_image, &self.extract_path)?; + Err(err.into()) + } + Ok(_) => Ok(()), + }; } } } @@ -733,57 +925,262 @@ impl Update { Err(Error::TempDirNotOnSameMountPoint) } - // MacOS - // - // ### Expected structure: - // ├── [AppName]_[version]_x64.app.tar.gz # GZ generated by tauri-bundler - // │ └──[AppName].app # Main application - // │ └── Contents # Application contents... - // │ └── ... - // └── ... - #[cfg(target_os = "macos")] - fn install_inner(&self, bytes: Vec) -> Result<()> { + fn is_deb_package(&self) -> bool { + // First check if we're in a typical Debian installation path + let in_system_path = self + .extract_path + .to_str() + .map(|p| p.starts_with("/usr")) + .unwrap_or(false); + + if !in_system_path { + return false; + } + + // Then verify it's actually a Debian-based system by checking for dpkg + let dpkg_exists = std::path::Path::new("/var/lib/dpkg").exists(); + let apt_exists = std::path::Path::new("/etc/apt").exists(); + + // Additional check for the package in dpkg database + let package_in_dpkg = if let Ok(output) = std::process::Command::new("dpkg") + .args(["-S", &self.extract_path.to_string_lossy()]) + .output() + { + output.status.success() + } else { + false + }; + + // Consider it a deb package only if: + // 1. We're in a system path AND + // 2. We have Debian package management tools AND + // 3. The binary is tracked by dpkg + dpkg_exists && apt_exists && package_in_dpkg + } + + fn install_deb(&self, bytes: &[u8]) -> Result<()> { + // First verify the bytes are actually a .deb package + if !infer::archive::is_deb(bytes) { + log::warn!("update is not a valid deb package"); + return Err(Error::InvalidUpdaterFormat); + } + + // Try different temp directories + let tmp_dir_locations = vec![ + Box::new(|| Some(std::env::temp_dir())) as Box Option>, + Box::new(dirs::cache_dir), + Box::new(|| Some(self.extract_path.parent().unwrap().to_path_buf())), + ]; + + // Try writing to multiple temp locations until one succeeds + for tmp_dir_location in tmp_dir_locations { + if let Some(path) = tmp_dir_location() { + if let Ok(tmp_dir) = tempfile::Builder::new() + .prefix("tauri_deb_update") + .tempdir_in(path) + { + let deb_path = tmp_dir.path().join("package.deb"); + + // Try writing the .deb file + if std::fs::write(&deb_path, bytes).is_ok() { + // If write succeeds, proceed with installation + return self.try_install_with_privileges(&deb_path); + } + // If write fails, continue to next temp location + } + } + } + + // If we get here, all temp locations failed + Err(Error::TempDirNotFound) + } + + fn try_install_with_privileges(&self, deb_path: &Path) -> Result<()> { + // 1. First try using pkexec (graphical sudo prompt) + if let Ok(status) = std::process::Command::new("pkexec") + .arg("dpkg") + .arg("-i") + .arg(deb_path) + .status() + { + if status.success() { + log::debug!("installed deb with pkexec"); + return Ok(()); + } + } + + // 2. Try zenity or kdialog for a graphical sudo experience + if let Ok(password) = self.get_password_graphically() { + if self.install_with_sudo(deb_path, &password)? { + log::debug!("installed deb with GUI sudo"); + return Ok(()); + } + } + + // 3. Final fallback: terminal sudo + let status = std::process::Command::new("sudo") + .arg("dpkg") + .arg("-i") + .arg(deb_path) + .status()?; + + if status.success() { + log::debug!("installed deb with sudo"); + Ok(()) + } else { + Err(Error::DebInstallFailed) + } + } + + fn get_password_graphically(&self) -> Result { + // Try zenity first + let zenity_result = std::process::Command::new("zenity") + .args([ + "--password", + "--title=Authentication Required", + "--text=Enter your password to install the update:", + ]) + .output(); + + if let Ok(output) = zenity_result { + if output.status.success() { + return Ok(String::from_utf8_lossy(&output.stdout).trim().to_string()); + } + } + + // Fall back to kdialog if zenity fails or isn't available + let kdialog_result = std::process::Command::new("kdialog") + .args(["--password", "Enter your password to install the update:"]) + .output(); + + if let Ok(output) = kdialog_result { + if output.status.success() { + return Ok(String::from_utf8_lossy(&output.stdout).trim().to_string()); + } + } + + Err(Error::AuthenticationFailed) + } + + fn install_with_sudo(&self, deb_path: &Path, password: &str) -> Result { + use std::io::Write; + use std::process::{Command, Stdio}; + + let mut child = Command::new("sudo") + .arg("-S") // read password from stdin + .arg("dpkg") + .arg("-i") + .arg(deb_path) + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn()?; + + if let Some(mut stdin) = child.stdin.take() { + // Write password to stdin + writeln!(stdin, "{}", password)?; + } + + let status = child.wait()?; + Ok(status.success()) + } +} + +/// MacOS +#[cfg(target_os = "macos")] +impl Update { + /// ### Expected structure: + /// ├── [AppName]_[version]_x64.app.tar.gz # GZ generated by tauri-bundler + /// │ └──[AppName].app # Main application + /// │ └── Contents # Application contents... + /// │ └── ... + /// └── ... + fn install_inner(&self, bytes: &[u8]) -> Result<()> { use flate2::read::GzDecoder; let cursor = Cursor::new(bytes); let mut extracted_files: Vec = Vec::new(); - // the first file in the tar.gz will always be - // /Contents - let tmp_dir = tempfile::Builder::new() + // Create temp directories for backup and extraction + let tmp_backup_dir = tempfile::Builder::new() .prefix("tauri_current_app") .tempdir()?; - // create backup of our current app - std::fs::rename(&self.extract_path, tmp_dir.path())?; + let tmp_extract_dir = tempfile::Builder::new() + .prefix("tauri_updated_app") + .tempdir()?; let decoder = GzDecoder::new(cursor); let mut archive = tar::Archive::new(decoder); - std::fs::create_dir(&self.extract_path)?; - + // Extract files to temporary directory for entry in archive.entries()? { let mut entry = entry?; - - // skip the first folder (should be the app name) let collected_path: PathBuf = entry.path()?.iter().skip(1).collect(); - let extraction_path = &self.extract_path.join(collected_path); - - // if something went wrong during the extraction, we should restore previous app - if let Err(err) = entry.unpack(extraction_path) { - for file in extracted_files.iter().rev() { - // delete all the files we extracted - if file.is_dir() { - std::fs::remove_dir(file)?; - } else { - std::fs::remove_file(file)?; - } - } - std::fs::rename(tmp_dir.path(), &self.extract_path)?; + let extraction_path = tmp_extract_dir.path().join(&collected_path); + + // Ensure parent directories exist + if let Some(parent) = extraction_path.parent() { + std::fs::create_dir_all(parent)?; + } + + if let Err(err) = entry.unpack(&extraction_path) { + // Cleanup on error + std::fs::remove_dir_all(tmp_extract_dir.path()).ok(); return Err(err.into()); } + extracted_files.push(extraction_path); + } - extracted_files.push(extraction_path.to_path_buf()); + // Try to move the current app to backup + let move_result = std::fs::rename( + &self.extract_path, + tmp_backup_dir.path().join("current_app"), + ); + let need_authorization = if let Err(err) = move_result { + if err.kind() == std::io::ErrorKind::PermissionDenied { + true + } else { + std::fs::remove_dir_all(tmp_extract_dir.path()).ok(); + return Err(err.into()); + } + } else { + false + }; + + if need_authorization { + log::debug!("app installation needs admin privileges"); + // Use AppleScript to perform moves with admin privileges + let apple_script = format!( + "do shell script \"rm -rf '{src}' && mv -f '{new}' '{src}'\" with administrator privileges", + src = self.extract_path.display(), + new = tmp_extract_dir.path().display() + ); + + let (tx, rx) = std::sync::mpsc::channel(); + let res = (self.run_on_main_thread)(Box::new(move || { + let mut script = + osakit::Script::new_from_source(osakit::Language::AppleScript, &apple_script); + script.compile().expect("invalid AppleScript"); + let r = script.execute(); + tx.send(r).unwrap(); + })); + let result = rx.recv().unwrap(); + + if res.is_err() || result.is_err() { + std::fs::remove_dir_all(tmp_extract_dir.path()).ok(); + return Err(Error::Io(std::io::Error::new( + std::io::ErrorKind::PermissionDenied, + "Failed to move the new app into place", + ))); + } + } else { + // Remove existing directory if it exists + if self.extract_path.exists() { + std::fs::remove_dir_all(&self.extract_path)?; + } + // Move the new app to the target path + std::fs::rename(tmp_extract_dir.path(), &self.extract_path)?; } let _ = std::process::Command::new("touch") @@ -825,6 +1222,8 @@ pub(crate) fn get_updater_arch() -> Option<&'static str> { Some("armv7") } else if cfg!(target_arch = "aarch64") { Some("aarch64") + } else if cfg!(target_arch = "riscv64") { + Some("riscv64") } else { None } @@ -918,30 +1317,15 @@ where } // Validate signature -// need to be public because its been used -// by our tests in the bundler -// -// NOTE: The buffer position is not reset. -pub fn verify_signature( - archive_reader: &mut R, - release_signature: &str, - pub_key: &str, -) -> Result -where - R: Read, -{ +fn verify_signature(data: &[u8], release_signature: &str, pub_key: &str) -> Result { // we need to convert the pub key let pub_key_decoded = base64_to_string(pub_key)?; let public_key = PublicKey::decode(&pub_key_decoded)?; let signature_base64_decoded = base64_to_string(release_signature)?; let signature = Signature::decode(&signature_base64_decoded)?; - // read all bytes until EOF in the buffer - let mut data = Vec::new(); - archive_reader.read_to_end(&mut data)?; - // Validate signature or bail out - public_key.verify(&data, &signature, true)?; + public_key.verify(data, &signature, true)?; Ok(true) } @@ -952,3 +1336,119 @@ fn base64_to_string(base64_string: &str) -> Result { .to_string(); Ok(result) } + +#[cfg(windows)] +fn encode_wide(string: impl AsRef) -> Vec { + use std::os::windows::ffi::OsStrExt; + + string + .as_ref() + .encode_wide() + .chain(std::iter::once(0)) + .collect() +} + +#[cfg(windows)] +trait PathExt { + fn wrap_in_quotes(&self) -> Self; +} + +#[cfg(windows)] +impl PathExt for PathBuf { + fn wrap_in_quotes(&self) -> Self { + let mut msi_path = OsString::from("\""); + msi_path.push(self.as_os_str()); + msi_path.push("\""); + PathBuf::from(msi_path) + } +} + +#[cfg(windows)] +fn escape_msi_property_arg(arg: impl AsRef) -> String { + let mut arg = arg.as_ref().to_string_lossy().to_string(); + + // Otherwise this argument will get lost in ShellExecute + if arg.is_empty() { + return "\"\"\"\"".to_string(); + } else if !arg.contains(' ') && !arg.contains('"') { + return arg; + } + + if arg.contains('"') { + arg = arg.replace('"', r#""""""#) + } + + if arg.starts_with('-') { + if let Some((a1, a2)) = arg.split_once('=') { + format!("{a1}=\"\"{a2}\"\"") + } else { + format!("\"\"{arg}\"\"") + } + } else { + format!("\"\"{arg}\"\"") + } +} + +#[cfg(test)] +mod tests { + + #[test] + #[cfg(windows)] + fn it_wraps_correctly() { + use super::PathExt; + use std::path::PathBuf; + + assert_eq!( + PathBuf::from("C:\\Users\\Some User\\AppData\\tauri-example.exe").wrap_in_quotes(), + PathBuf::from("\"C:\\Users\\Some User\\AppData\\tauri-example.exe\"") + ) + } + + #[test] + #[cfg(windows)] + fn it_escapes_correctly() { + use crate::updater::escape_msi_property_arg; + + // Explanation for quotes: + // The output of escape_msi_property_args() will be used in `LAUNCHAPPARGS=\"{HERE}\"`. This is the first quote level. + // To escape a quotation mark we use a second quotation mark, so "" is interpreted as " later. + // This means that the escaped strings can't ever have a single quotation mark! + // Now there are 3 major things to look out for to not break the msiexec call: + // 1) Wrap spaces in quotation marks, otherwise it will be interpreted as the end of the msiexec argument. + // 2) Escape escaping quotation marks, otherwise they will either end the msiexec argument or be ignored. + // 3) Escape emtpy args in quotation marks, otherwise the argument will get lost. + let cases = [ + "something", + "--flag", + "--empty=", + "--arg=value", + "some space", // This simulates `./my-app "some string"`. + "--arg value", // -> This simulates `./my-app "--arg value"`. Same as above but it triggers the startsWith(`-`) logic. + "--arg=unwrapped space", // `./my-app --arg="unwrapped space"` + "--arg=\"wrapped\"", // `./my-app --args=""wrapped""` + "--arg=\"wrapped space\"", // `./my-app --args=""wrapped space""` + "--arg=midword\"wrapped space\"", // `./my-app --args=midword""wrapped""` + "", // `./my-app '""'` + ]; + let cases_escaped = [ + "something", + "--flag", + "--empty=", + "--arg=value", + "\"\"some space\"\"", + "\"\"--arg value\"\"", + "--arg=\"\"unwrapped space\"\"", + r#"--arg=""""""wrapped"""""""#, + r#"--arg=""""""wrapped space"""""""#, + r#"--arg=""midword""""wrapped space"""""""#, + "\"\"\"\"", + ]; + + // Just to be sure we didn't mess that up + assert_eq!(cases.len(), cases_escaped.len()); + + for (orig, escaped) in cases.iter().zip(cases_escaped) { + assert_eq!(escape_msi_property_arg(orig), escaped); + } + } +} diff --git a/plugins/updater/tests/app-updater/Cargo.toml b/plugins/updater/tests/app-updater/Cargo.toml index c80ac920..71b9f900 100644 --- a/plugins/updater/tests/app-updater/Cargo.toml +++ b/plugins/updater/tests/app-updater/Cargo.toml @@ -7,12 +7,12 @@ edition = { workspace = true } tauri-build = { workspace = true } [dependencies] -tauri = { workspace = true } +tauri = { workspace = true, features = ["wry", "compression"] } serde = { workspace = true } serde_json = { workspace = true } tauri-plugin-updater = { path = "../.." } -tiny_http = "0.11" +tiny_http = "0.12" time = { version = "0.3", features = ["formatting"] } [features] -custom-protocol = ["tauri/custom-protocol"] +prod = ["tauri/custom-protocol"] diff --git a/plugins/updater/tests/app-updater/src/main.rs b/plugins/updater/tests/app-updater/src/main.rs index ad145c49..bbe398b5 100644 --- a/plugins/updater/tests/app-updater/src/main.rs +++ b/plugins/updater/tests/app-updater/src/main.rs @@ -42,7 +42,7 @@ fn main() { std::process::exit(0); } Ok(None) => { - std::process::exit(0); + std::process::exit(2); } Err(e) => { println!("{e}"); diff --git a/plugins/updater/tests/app-updater/tauri.conf.json b/plugins/updater/tests/app-updater/tauri.conf.json index 5eb96954..f2c6df21 100644 --- a/plugins/updater/tests/app-updater/tauri.conf.json +++ b/plugins/updater/tests/app-updater/tauri.conf.json @@ -3,15 +3,17 @@ "plugins": { "updater": { "endpoints": ["http://localhost:3007"], - "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEMwNjY1MEExMTFBMDU5RTUKUldUbFdhQVJvVkJtd09sZ1ROT25yVGFhU2o0ZnUyd1FlT0ZTQ2ZXamN3SXk4SjZLZmNwRnV5dTMK", + "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEUwNDRGMjkwRjg2MDhCRDAKUldUUWkyRDRrUEpFNEQ4SmdwcU5PaXl6R2ZRUUNvUnhIaVkwVUltV0NMaEx6VTkrWVhpT0ZqeEEK", "windows": { - "installMode": "quiet" + "installMode": "quiet", + "installerArgs": ["/NS"] } } }, "bundle": { "active": true, "targets": "all", + "createUpdaterArtifacts": true, "icon": [ "icons/32x32.png", "icons/128x128.png", @@ -20,8 +22,11 @@ "icons/icon.ico" ], "windows": { - "wix": { - "skipWebviewInstall": true + "webviewInstallMode": { + "type": "skip" + }, + "nsis": { + "compression": "none" } } } diff --git a/plugins/updater/tests/app-updater/tests/update.rs b/plugins/updater/tests/app-updater/tests/update.rs index 797be1f8..d308b317 100644 --- a/plugins/updater/tests/app-updater/tests/update.rs +++ b/plugins/updater/tests/app-updater/tests/update.rs @@ -9,15 +9,26 @@ use std::{ fs::File, path::{Path, PathBuf}, process::Command, + sync::Arc, }; use serde::Serialize; +use tauri::utils::config::{Updater, V1Compatible}; -const UPDATER_PRIVATE_KEY: &str = "dW50cnVzdGVkIGNvbW1lbnQ6IHJzaWduIGVuY3J5cHRlZCBzZWNyZXQga2V5ClJXUlRZMEl5Qm9uUXIyeEM2YkczeGMwZDFENmw1WHEzaFk5aDlOOXNyTWRxRnY4UUpzZ0FBQkFBQUFBQUFBQUFBQUlBQUFBQTVWbWdFYUZRWnNDZmdyUW9ibWExVEFTY0pVTWpVS2xlOHdhR1I3Q3hpd2FTNjg1MXZENEQyZWxnVE5PbnJUYWFTajRmdTJ3UWVPRlNDZldqY3dJeThKNktmY3BGdXl1M1BPdHgwOFhIQzJLSnpqS0Z2cVdmaEs2WWRmK3d4SHVCMlpHVGduaVAzclU9Cg=="; +const UPDATER_PRIVATE_KEY: &str = "dW50cnVzdGVkIGNvbW1lbnQ6IHJzaWduIGVuY3J5cHRlZCBzZWNyZXQga2V5ClJXUlRZMEl5TlFOMFpXYzJFOUdjeHJEVXY4WE1TMUxGNDJVUjNrMmk1WlR3UVJVUWwva0FBQkFBQUFBQUFBQUFBQUlBQUFBQUpVK3ZkM3R3eWhyN3hiUXhQb2hvWFVzUW9FbEs3NlNWYjVkK1F2VGFRU1FEaGxuRUtlell5U0gxYS9DbVRrS0YyZVJGblhjeXJibmpZeGJjS0ZKSUYwYndYc2FCNXpHalM3MHcrODMwN3kwUG9SOWpFNVhCSUd6L0E4TGRUT096TEtLR1JwT1JEVFU9Cg=="; +const UPDATED_EXIT_CODE: i32 = 0; +const UP_TO_DATE_EXIT_CODE: i32 = 2; #[derive(Serialize)] struct Config { version: &'static str, + bundle: BundleConfig, +} + +#[derive(Serialize)] +#[serde(rename_all = "camelCase")] +struct BundleConfig { + create_updater_artifacts: Updater, } #[derive(Serialize)] @@ -40,6 +51,8 @@ fn build_app(cwd: &Path, config: &Config, bundle_updater: bool, target: BundleTa .args(["tauri", "build", "--debug", "--verbose"]) .arg("--config") .arg(serde_json::to_string(config).unwrap()) + .env("TAURI_SIGNING_PRIVATE_KEY", UPDATER_PRIVATE_KEY) + .env("TAURI_SIGNING_PRIVATE_KEY_PASSWORD", "") .current_dir(cwd); #[cfg(target_os = "linux")] @@ -50,11 +63,6 @@ fn build_app(cwd: &Path, config: &Config, bundle_updater: bool, target: BundleTa if bundle_updater { #[cfg(windows)] command.args(["--bundles", "msi", "nsis"]); - - command - .env("TAURI_SIGNING_PRIVATE_KEY", UPDATER_PRIVATE_KEY) - .env("TAURI_SIGNING_PRIVATE_KEY_PASSWORD", "") - .args(["--bundles", "updater"]); } else { #[cfg(windows)] command.args(["--bundles", target.name()]); @@ -64,7 +72,7 @@ fn build_app(cwd: &Path, config: &Config, bundle_updater: bool, target: BundleTa .status() .expect("failed to run Tauri CLI to bundle app"); - if !status.code().map(|c| c == 0).unwrap_or(true) { + if !status.success() { panic!("failed to bundle app {:?}", status.code()); } } @@ -158,41 +166,83 @@ fn update_app() { let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); let root_dir = manifest_dir.join("../../../.."); - let mut config = Config { version: "1.0.0" }; - - // bundle app update - build_app(&manifest_dir, &config, true, Default::default()); - - let updater_zip_ext = if cfg!(windows) { "zip" } else { "tar.gz" }; - - for (bundle_target, out_bundle_path) in bundle_paths(&root_dir, "1.0.0") { - let bundle_updater_ext = out_bundle_path - .extension() - .unwrap() - .to_str() - .unwrap() - .replace("exe", "nsis"); - let signature_path = - out_bundle_path.with_extension(format!("{bundle_updater_ext}.{updater_zip_ext}.sig")); - let signature = std::fs::read_to_string(&signature_path).unwrap_or_else(|_| { - panic!("failed to read signature file {}", signature_path.display()) - }); - let out_updater_path = - out_bundle_path.with_extension(format!("{}.{}", bundle_updater_ext, updater_zip_ext)); - let updater_path = root_dir.join(format!( - "target/debug/{}", - out_updater_path.file_name().unwrap().to_str().unwrap() - )); - std::fs::rename(&out_updater_path, &updater_path).expect("failed to rename bundle"); - - let target = target.clone(); - std::thread::spawn(move || { + for mut config in [ + Config { + version: "1.0.0", + bundle: BundleConfig { + create_updater_artifacts: Updater::Bool(true), + }, + }, + Config { + version: "1.0.0", + bundle: BundleConfig { + create_updater_artifacts: Updater::String(V1Compatible::V1Compatible), + }, + }, + ] { + let v1_compatible = matches!( + config.bundle.create_updater_artifacts, + Updater::String(V1Compatible::V1Compatible) + ); + + // bundle app update + build_app(&manifest_dir, &config, true, Default::default()); + + let updater_zip_ext = if v1_compatible { + if cfg!(windows) { + Some("zip") + } else { + Some("tar.gz") + } + } else if cfg!(target_os = "macos") { + Some("tar.gz") + } else { + None + }; + + for (bundle_target, out_bundle_path) in bundle_paths(&root_dir, "1.0.0") { + let bundle_updater_ext = if v1_compatible { + out_bundle_path + .extension() + .unwrap() + .to_str() + .unwrap() + .replace("exe", "nsis") + } else { + out_bundle_path + .extension() + .unwrap() + .to_str() + .unwrap() + .to_string() + }; + let updater_extension = if let Some(updater_zip_ext) = updater_zip_ext { + format!("{bundle_updater_ext}.{updater_zip_ext}") + } else { + bundle_updater_ext + }; + let signature_extension = format!("{updater_extension}.sig"); + let signature_path = out_bundle_path.with_extension(signature_extension); + let signature = std::fs::read_to_string(&signature_path).unwrap_or_else(|_| { + panic!("failed to read signature file {}", signature_path.display()) + }); + let out_updater_path = out_bundle_path.with_extension(updater_extension); + let updater_path = root_dir.join(format!( + "target/debug/{}", + out_updater_path.file_name().unwrap().to_str().unwrap() + )); + std::fs::rename(&out_updater_path, &updater_path).expect("failed to rename bundle"); + + let target = target.clone(); + // start the updater server - let server = - tiny_http::Server::http("localhost:3007").expect("failed to start updater server"); + let server = Arc::new( + tiny_http::Server::http("localhost:3007").expect("failed to start updater server"), + ); - loop { - if let Ok(request) = server.recv() { + let server_ = server.clone(); + std::thread::spawn(move || { + for request in server_.incoming_requests() { match request.url() { "/" => { let mut platforms = HashMap::new(); @@ -232,45 +282,63 @@ fn update_app() { ) }), )); - // close server - return; } _ => (), } } + }); + + config.version = "0.1.0"; + + // bundle initial app version + build_app(&manifest_dir, &config, false, bundle_target); + + let status_checks = if matches!(bundle_target, BundleTarget::Msi) { + // for msi we can't really check if the app was updated, because we can't change the install path + vec![UPDATED_EXIT_CODE] + } else { + vec![UPDATED_EXIT_CODE, UP_TO_DATE_EXIT_CODE] + }; + + for expected_exit_code in status_checks { + let mut binary_cmd = if cfg!(windows) { + Command::new(root_dir.join("target/debug/app-updater.exe")) + } else if cfg!(target_os = "macos") { + Command::new( + bundle_paths(&root_dir, "0.1.0") + .first() + .unwrap() + .1 + .join("Contents/MacOS/app-updater"), + ) + } else if std::env::var("CI").map(|v| v == "true").unwrap_or_default() { + let mut c = Command::new("xvfb-run"); + c.arg("--auto-servernum") + .arg(&bundle_paths(&root_dir, "0.1.0").first().unwrap().1); + c + } else { + Command::new(&bundle_paths(&root_dir, "0.1.0").first().unwrap().1) + }; + + binary_cmd.env("TARGET", bundle_target.name()); + + let status = binary_cmd.status().expect("failed to run app"); + let code = status.code().unwrap_or(-1); + + if code != expected_exit_code { + panic!( + "failed to run app, expected exit code {expected_exit_code}, got {code}" + ); + } + #[cfg(windows)] + if code == UPDATED_EXIT_CODE { + // wait for the update to finish + std::thread::sleep(std::time::Duration::from_secs(5)); + } } - }); - - config.version = "0.1.0"; - - // bundle initial app version - build_app(&manifest_dir, &config, false, bundle_target); - - let mut binary_cmd = if cfg!(windows) { - Command::new(root_dir.join("target/debug/app-updater.exe")) - } else if cfg!(target_os = "macos") { - Command::new( - bundle_paths(&root_dir, "0.1.0") - .first() - .unwrap() - .1 - .join("Contents/MacOS/app-updater"), - ) - } else if std::env::var("CI").map(|v| v == "true").unwrap_or_default() { - let mut c = Command::new("xvfb-run"); - c.arg("--auto-servernum") - .arg(&bundle_paths(&root_dir, "0.1.0").first().unwrap().1); - c - } else { - Command::new(&bundle_paths(&root_dir, "0.1.0").first().unwrap().1) - }; - - binary_cmd.env("TARGET", bundle_target.name()); - - let status = binary_cmd.status().expect("failed to run app"); - if !status.success() { - panic!("failed to run app"); + // graceful shutdown + server.unblock(); } } } diff --git a/plugins/updater/tests/updater-migration/Cargo.toml b/plugins/updater/tests/updater-migration/Cargo.toml new file mode 100644 index 00000000..4edb07da --- /dev/null +++ b/plugins/updater/tests/updater-migration/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "updater-migration-test" +version = "0.1.0" +edition = { workspace = true } + +[build-dependencies] +tauri-build = { workspace = true } + +[dependencies] +tauri = { workspace = true, features = ["wry", "compression"] } +serde = { workspace = true } +serde_json = { workspace = true } +tauri-plugin-updater = { path = "../.." } +tiny_http = "0.12" +time = { version = "0.3", features = ["formatting"] } diff --git a/plugins/updater/tests/updater-migration/icons/128x128.png b/plugins/updater/tests/updater-migration/icons/128x128.png new file mode 100644 index 00000000..77e7d233 Binary files /dev/null and b/plugins/updater/tests/updater-migration/icons/128x128.png differ diff --git a/plugins/updater/tests/updater-migration/icons/128x128@2x.png b/plugins/updater/tests/updater-migration/icons/128x128@2x.png new file mode 100644 index 00000000..0f7976f1 Binary files /dev/null and b/plugins/updater/tests/updater-migration/icons/128x128@2x.png differ diff --git a/plugins/updater/tests/updater-migration/icons/32x32.png b/plugins/updater/tests/updater-migration/icons/32x32.png new file mode 100644 index 00000000..98fda06f Binary files /dev/null and b/plugins/updater/tests/updater-migration/icons/32x32.png differ diff --git a/plugins/updater/tests/updater-migration/icons/icon.icns b/plugins/updater/tests/updater-migration/icons/icon.icns new file mode 100644 index 00000000..5594104c Binary files /dev/null and b/plugins/updater/tests/updater-migration/icons/icon.icns differ diff --git a/plugins/updater/tests/updater-migration/icons/icon.ico b/plugins/updater/tests/updater-migration/icons/icon.ico new file mode 100644 index 00000000..06c23c82 Binary files /dev/null and b/plugins/updater/tests/updater-migration/icons/icon.ico differ diff --git a/plugins/updater/tests/updater-migration/icons/icon.png b/plugins/updater/tests/updater-migration/icons/icon.png new file mode 100644 index 00000000..d1756ce4 Binary files /dev/null and b/plugins/updater/tests/updater-migration/icons/icon.png differ diff --git a/plugins/updater/tests/updater-migration/tests/update.rs b/plugins/updater/tests/updater-migration/tests/update.rs new file mode 100644 index 00000000..813da3c6 --- /dev/null +++ b/plugins/updater/tests/updater-migration/tests/update.rs @@ -0,0 +1,469 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +#![allow(dead_code, unused_imports)] + +use std::{ + collections::HashMap, + fs::File, + path::{Path, PathBuf}, + process::Command, + sync::Arc, +}; + +use serde::Serialize; +use tauri::utils::config::{Updater, V1Compatible}; + +const UPDATER_PRIVATE_KEY: &str = "dW50cnVzdGVkIGNvbW1lbnQ6IHJzaWduIGVuY3J5cHRlZCBzZWNyZXQga2V5ClJXUlRZMEl5TlFOMFpXYzJFOUdjeHJEVXY4WE1TMUxGNDJVUjNrMmk1WlR3UVJVUWwva0FBQkFBQUFBQUFBQUFBQUlBQUFBQUpVK3ZkM3R3eWhyN3hiUXhQb2hvWFVzUW9FbEs3NlNWYjVkK1F2VGFRU1FEaGxuRUtlell5U0gxYS9DbVRrS0YyZVJGblhjeXJibmpZeGJjS0ZKSUYwYndYc2FCNXpHalM3MHcrODMwN3kwUG9SOWpFNVhCSUd6L0E4TGRUT096TEtLR1JwT1JEVFU9Cg=="; +const UPDATED_EXIT_CODE: i32 = 0; +const UP_TO_DATE_EXIT_CODE: i32 = 2; + +fn npm_command() -> Command { + #[cfg(target_os = "windows")] + let cmd = { + let mut cmd = Command::new("cmd"); + cmd.arg("/c").arg("npm"); + cmd + }; + #[cfg(not(target_os = "windows"))] + let cmd = Command::new("npm"); + cmd +} + +mod v1 { + use super::{npm_command, BundleTarget, UPDATER_PRIVATE_KEY}; + use serde::Serialize; + use std::{ + path::{Path, PathBuf}, + process::Command, + }; + + #[derive(Serialize)] + pub struct PackageConfig { + pub version: &'static str, + } + + #[derive(Serialize)] + pub struct Config { + pub package: PackageConfig, + } + + pub fn build_app(cwd: &Path, config: &Config, bundle_updater: bool, target: BundleTarget) { + let mut command = npm_command(); + command + .args(["run", "tauri", "--", "build", "--debug", "--verbose"]) + .arg("--config") + .arg(serde_json::to_string(config).unwrap()) + .env("TAURI_PRIVATE_KEY", UPDATER_PRIVATE_KEY) + .env("TAURI_KEY_PASSWORD", "") + .current_dir(cwd); + + #[cfg(target_os = "linux")] + command.args(["--bundles", target.name()]); + #[cfg(target_os = "macos")] + command.args(["--bundles", target.name()]); + + if bundle_updater { + #[cfg(windows)] + command.args(["--bundles", "msi", "nsis"]); + } else { + #[cfg(windows)] + command.args(["--bundles", target.name()]); + } + + let status = command + .status() + .expect("failed to run Tauri CLI to bundle v1 app"); + + if !status.success() { + panic!("failed to bundle v1 app {:?}", status.code()); + } + } + + #[cfg(target_os = "linux")] + pub fn bundle_paths(root_dir: &Path, version: &str) -> Vec<(BundleTarget, PathBuf)> { + vec![( + BundleTarget::AppImage, + root_dir.join(format!( + "target/debug/bundle/appimage/app-updater-v1_{version}_amd64.AppImage", + )), + )] + } + + #[cfg(target_os = "macos")] + pub fn bundle_paths(root_dir: &Path, _version: &str) -> Vec<(BundleTarget, PathBuf)> { + vec![( + BundleTarget::App, + root_dir.join("target/debug/bundle/macos/app-updater-v1.app"), + )] + } + + #[cfg(target_os = "ios")] + pub fn bundle_paths(root_dir: &Path, _version: &str) -> Vec<(BundleTarget, PathBuf)> { + vec![( + BundleTarget::App, + root_dir.join("target/debug/bundle/ios/app-updater-v1.ipa"), + )] + } + + #[cfg(target_os = "android")] + pub fn bundle_path(root_dir: &Path, _version: &str) -> PathBuf { + root_dir.join("target/debug/bundle/android/app-updater-v1.apk") + } + + #[cfg(windows)] + pub fn bundle_paths(root_dir: &Path, version: &str) -> Vec<(BundleTarget, PathBuf)> { + vec![ + ( + BundleTarget::Nsis, + root_dir.join(format!( + "target/debug/bundle/nsis/app-updater-v1_{version}_x64-setup.exe" + )), + ), + ( + BundleTarget::Msi, + root_dir.join(format!( + "target/debug/bundle/msi/app-updater-v1_{version}_x64_en-US.msi" + )), + ), + ] + } +} + +mod v2 { + + use super::{BundleTarget, UPDATER_PRIVATE_KEY}; + use serde::Serialize; + use std::{ + path::{Path, PathBuf}, + process::Command, + }; + use tauri::utils::config::Updater; + + #[derive(Serialize)] + pub struct Config { + pub version: &'static str, + pub bundle: BundleConfig, + } + + #[derive(Serialize)] + #[serde(rename_all = "camelCase")] + pub struct BundleConfig { + pub create_updater_artifacts: Updater, + } + + pub fn build_app(cwd: &Path, config: &Config, bundle_updater: bool, target: BundleTarget) { + let mut command = Command::new("cargo"); + command + .args(["tauri", "build", "--debug", "--verbose"]) + .arg("--config") + .arg(serde_json::to_string(config).unwrap()) + .env("TAURI_SIGNING_PRIVATE_KEY", UPDATER_PRIVATE_KEY) + .env("TAURI_SIGNING_PRIVATE_KEY_PASSWORD", "") + .current_dir(cwd); + + #[cfg(target_os = "linux")] + command.args(["--bundles", target.name()]); + #[cfg(target_os = "macos")] + command.args(["--bundles", target.name()]); + + if bundle_updater { + #[cfg(windows)] + command.args(["--bundles", "msi", "nsis"]); + } else { + #[cfg(windows)] + command.args(["--bundles", target.name()]); + } + + let status = command + .status() + .expect("failed to run Tauri CLI to bundle v2 app"); + + if !status.success() { + panic!("failed to bundle v2 app {:?}", status.code()); + } + } + + #[cfg(target_os = "linux")] + pub fn bundle_paths(root_dir: &Path, version: &str) -> Vec<(BundleTarget, PathBuf)> { + vec![( + BundleTarget::AppImage, + root_dir.join(format!( + "target/debug/bundle/appimage/app-updater-v2_{version}_amd64.AppImage", + )), + )] + } + + #[cfg(target_os = "macos")] + pub fn bundle_paths(root_dir: &Path, _version: &str) -> Vec<(BundleTarget, PathBuf)> { + vec![( + BundleTarget::App, + root_dir.join("target/debug/bundle/macos/app-updater-v2.app"), + )] + } + + #[cfg(target_os = "ios")] + pub fn bundle_paths(root_dir: &Path, _version: &str) -> Vec<(BundleTarget, PathBuf)> { + vec![( + BundleTarget::App, + root_dir.join("target/debug/bundle/ios/app-updater-v2.ipa"), + )] + } + + #[cfg(target_os = "android")] + pub fn bundle_path(root_dir: &Path, _version: &str) -> PathBuf { + root_dir.join("target/debug/bundle/android/app-updater-v2.apk") + } + + #[cfg(windows)] + pub fn bundle_paths(root_dir: &Path, version: &str) -> Vec<(BundleTarget, PathBuf)> { + vec![ + ( + BundleTarget::Nsis, + root_dir.join(format!( + "target/debug/bundle/nsis/app-updater-v2_{version}_x64-setup.exe" + )), + ), + ( + BundleTarget::Msi, + root_dir.join(format!( + "target/debug/bundle/msi/app-updater-v2_{version}_x64_en-US.msi" + )), + ), + ] + } +} + +#[derive(Serialize)] +struct PlatformUpdate { + signature: String, + url: &'static str, + with_elevated_task: bool, +} + +#[derive(Serialize)] +struct Update { + version: &'static str, + date: String, + platforms: HashMap, +} + +#[derive(Copy, Clone)] +enum BundleTarget { + AppImage, + + App, + + Msi, + Nsis, +} + +impl BundleTarget { + fn name(self) -> &'static str { + match self { + Self::AppImage => "appimage", + Self::App => "app", + Self::Msi => "msi", + Self::Nsis => "nsis", + } + } +} + +impl Default for BundleTarget { + fn default() -> Self { + #[cfg(any(target_os = "macos", target_os = "ios"))] + return Self::App; + #[cfg(target_os = "linux")] + return Self::AppImage; + #[cfg(windows)] + return Self::Nsis; + } +} + +#[test] +#[ignore] +fn update_app() { + let target = + tauri_plugin_updater::target().expect("running updater test in an unsupported platform"); + let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); + let root_dir = manifest_dir.join("../../../.."); + let v1_root_dir = manifest_dir.join("v1-app"); + let v2_root_dir = manifest_dir.join("v2-app"); + + let status = npm_command() + .arg("install") + .current_dir(&v1_root_dir) + .status() + .expect("failed to run npm install"); + if !status.success() { + panic!("failed to run npm install"); + } + + let v2_config = v2::Config { + version: "1.0.0", + bundle: v2::BundleConfig { + create_updater_artifacts: Updater::String(V1Compatible::V1Compatible), + }, + }; + + // bundle app update (v2) + v2::build_app(&v2_root_dir, &v2_config, true, Default::default()); + + let updater_zip_ext = if cfg!(windows) { "zip" } else { "tar.gz" }; + + for (bundle_target, out_bundle_path) in v2::bundle_paths(&root_dir, "1.0.0") { + let bundle_updater_ext = out_bundle_path + .extension() + .unwrap() + .to_str() + .unwrap() + .replace("exe", "nsis"); + let updater_extension = format!("{bundle_updater_ext}.{updater_zip_ext}"); + let signature_extension = format!("{updater_extension}.sig"); + let signature_path = out_bundle_path.with_extension(signature_extension); + let signature = std::fs::read_to_string(&signature_path).unwrap_or_else(|_| { + panic!("failed to read signature file {}", signature_path.display()) + }); + let out_updater_path = out_bundle_path.with_extension(updater_extension); + let updater_path = root_dir.join(format!( + "target/debug/{}", + out_updater_path.file_name().unwrap().to_str().unwrap() + )); + std::fs::rename(&out_updater_path, &updater_path).expect("failed to rename bundle"); + + let target = target.clone(); + + // start the updater server + let server = Arc::new( + tiny_http::Server::http("localhost:3007").expect("failed to start updater server"), + ); + + let server_ = server.clone(); + std::thread::spawn(move || { + for request in server_.incoming_requests() { + match request.url() { + "/" => { + let mut platforms = HashMap::new(); + + platforms.insert( + target.clone(), + PlatformUpdate { + signature: signature.clone(), + url: "http://localhost:3007/download", + with_elevated_task: false, + }, + ); + let body = serde_json::to_vec(&Update { + version: "1.0.0", + date: time::OffsetDateTime::now_utc() + .format(&time::format_description::well_known::Rfc3339) + .unwrap(), + platforms, + }) + .unwrap(); + let len = body.len(); + let response = tiny_http::Response::new( + tiny_http::StatusCode(200), + Vec::new(), + std::io::Cursor::new(body), + Some(len), + None, + ); + let _ = request.respond(response); + } + "/download" => { + let _ = request.respond(tiny_http::Response::from_file( + File::open(&updater_path).unwrap_or_else(|_| { + panic!("failed to open updater bundle {}", updater_path.display()) + }), + )); + } + _ => (), + } + } + }); + + let v1_config = v1::Config { + package: v1::PackageConfig { version: "0.1.0" }, + }; + + // bundle initial app version (tauri v1) + v1::build_app(&v1_root_dir, &v1_config, false, bundle_target); + + let status_checks = if matches!(bundle_target, BundleTarget::Msi) { + // for msi we can't really check if the app was updated, because we can't change the install path + vec![(UPDATED_EXIT_CODE, 1)] + } else { + vec![(UPDATED_EXIT_CODE, 1), (UP_TO_DATE_EXIT_CODE, 2)] + }; + + for (expected_exit_code, expected_tauri_version) in status_checks { + let (expected_app_version, bundle_paths_fn, app_name_suffix) = + match expected_tauri_version { + 1 => ( + v1_config.package.version, + Box::new(|| v1::bundle_paths(&v1_root_dir, v1_config.package.version)) + as Box Vec<(BundleTarget, PathBuf)>>, + "-v1", + ), + 2 => ( + v2_config.version, + Box::new(|| v2::bundle_paths(&root_dir, v2_config.version)) + as Box Vec<(BundleTarget, PathBuf)>>, + "-v2", + ), + _ => panic!("unknown tauri version"), + }; + let mut binary_cmd = if cfg!(windows) { + let app_root_dir = match expected_tauri_version { + 1 => &v1_root_dir, + 2 => &root_dir, + _ => panic!("unknown tauri version"), + }; + Command::new( + app_root_dir.join(format!("target/debug/app-updater{app_name_suffix}.exe")), + ) + } else if cfg!(target_os = "macos") { + Command::new( + bundle_paths_fn() + .first() + .unwrap() + .1 + .join(format!("Contents/MacOS/app-updater{app_name_suffix}")), + ) + } else if std::env::var("CI").map(|v| v == "true").unwrap_or_default() { + let mut c = Command::new("xvfb-run"); + c.arg("--auto-servernum") + .arg(&bundle_paths_fn().first().unwrap().1); + c + } else { + Command::new(&bundle_paths_fn().first().unwrap().1) + }; + + binary_cmd.env("TARGET", bundle_target.name()); + + let output = binary_cmd.output().expect("failed to run app"); + let stdout = String::from_utf8_lossy(&output.stdout); + + println!("{stdout}"); + eprintln!("{}", String::from_utf8_lossy(&output.stderr)); + + let code = output.status.code().unwrap_or(-1); + + if code != expected_exit_code { + panic!("failed to run app, expected exit code {expected_exit_code}, got {code}"); + } + if !stdout.contains(&format!("version={expected_app_version}")) { + panic!("app version does not match {expected_app_version}"); + } + #[cfg(windows)] + if code == UPDATED_EXIT_CODE { + // wait for the update to finish + std::thread::sleep(std::time::Duration::from_secs(5)); + } + } + + server.unblock(); + } +} diff --git a/plugins/updater/tests/updater-migration/v1-app/.gitignore b/plugins/updater/tests/updater-migration/v1-app/.gitignore new file mode 100644 index 00000000..c6bfc74f --- /dev/null +++ b/plugins/updater/tests/updater-migration/v1-app/.gitignore @@ -0,0 +1,3 @@ +target/ +package-lock.json +node_modules/ \ No newline at end of file diff --git a/plugins/updater/tests/updater-migration/v1-app/Cargo.lock b/plugins/updater/tests/updater-migration/v1-app/Cargo.lock new file mode 100644 index 00000000..034449e3 --- /dev/null +++ b/plugins/updater/tests/updater-migration/v1-app/Cargo.lock @@ -0,0 +1,4229 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "addr2line" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "alloc-no-stdlib" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" + +[[package]] +name = "alloc-stdlib" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" +dependencies = [ + "alloc-no-stdlib", +] + +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anyhow" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" + +[[package]] +name = "app-updater-v1" +version = "0.1.0" +dependencies = [ + "serde", + "serde_json", + "tauri", + "tauri-build", + "tiny_http", +] + +[[package]] +name = "ascii" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16" + +[[package]] +name = "atk" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c3d816ce6f0e2909a96830d6911c2aff044370b1ef92d7f267b43bae5addedd" +dependencies = [ + "atk-sys", + "bitflags 1.3.2", + "glib", + "libc", +] + +[[package]] +name = "atk-sys" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58aeb089fb698e06db8089971c7ee317ab9644bade33383f63631437b03aafb6" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps 6.2.2", +] + +[[package]] +name = "autocfg" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" + +[[package]] +name = "backtrace" +version = "0.3.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[package]] +name = "block" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "brotli" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d640d25bc63c50fb1f0b545ffd80207d2e10a4c965530809b40ba3386825c391" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", + "brotli-decompressor", +] + +[[package]] +name = "brotli-decompressor" +version = "2.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e2e4afe60d7dd600fdd3de8d0f08c2b7ec039712e3b6137ff98b7004e82de4f" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", +] + +[[package]] +name = "bstr" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "bumpalo" +version = "3.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" + +[[package]] +name = "bytemuck" +version = "1.16.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "102087e286b4677862ea56cf8fc58bb2cdfa8725c40ffb80fe3a008eb7f2fc83" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" +dependencies = [ + "serde", +] + +[[package]] +name = "cairo-rs" +version = "0.15.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c76ee391b03d35510d9fa917357c7f1855bd9a6659c95a1b392e33f49b3369bc" +dependencies = [ + "bitflags 1.3.2", + "cairo-sys-rs", + "glib", + "libc", + "thiserror", +] + +[[package]] +name = "cairo-sys-rs" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c55d429bef56ac9172d25fecb85dc8068307d17acd74b377866b7a1ef25d3c8" +dependencies = [ + "glib-sys", + "libc", + "system-deps 6.2.2", +] + +[[package]] +name = "cargo_toml" +version = "0.15.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "599aa35200ffff8f04c1925aa1acc92fa2e08874379ef42e210a80e527e60838" +dependencies = [ + "serde", + "toml 0.7.8", +] + +[[package]] +name = "cc" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "504bdec147f2cc13c8b57ed9401fd8a147cc66b67ad5cb241394244f2c947549" + +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + +[[package]] +name = "cfb" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d38f2da7a0a2c4ccf0065be06397cc26a81f4e528be095826eee9d4adbb8c60f" +dependencies = [ + "byteorder", + "fnv", + "uuid", +] + +[[package]] +name = "cfg-expr" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3431df59f28accaf4cb4eed4a9acc66bea3f3c3753aa6cdc2f024174ef232af7" +dependencies = [ + "smallvec", +] + +[[package]] +name = "cfg-expr" +version = "0.15.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d067ad48b8650848b989a59a86c6c36a995d02d2bf778d45c3c5d57bc2718f02" +dependencies = [ + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "num-traits", + "serde", + "windows-targets 0.52.6", +] + +[[package]] +name = "chunked_transfer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e4de3bc4ea267985becf712dc6d9eed8b04c953b3fcfb339ebc87acd9804901" + +[[package]] +name = "cocoa" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f425db7937052c684daec3bd6375c8abe2d146dca4b8b143d6db777c39138f3a" +dependencies = [ + "bitflags 1.3.2", + "block", + "cocoa-foundation", + "core-foundation", + "core-graphics", + "foreign-types", + "libc", + "objc", +] + +[[package]] +name = "cocoa-foundation" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c6234cbb2e4c785b456c0644748b1ac416dd045799740356f8363dfe00c93f7" +dependencies = [ + "bitflags 1.3.2", + "block", + "core-foundation", + "core-graphics-types", + "libc", + "objc", +] + +[[package]] +name = "color_quant" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" + +[[package]] +name = "combine" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" +dependencies = [ + "bytes", + "memchr", +] + +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" + +[[package]] +name = "core-graphics" +version = "0.22.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "core-graphics-types", + "foreign-types", + "libc", +] + +[[package]] +name = "core-graphics-types" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "libc", +] + +[[package]] +name = "cpufeatures" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "cssparser" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "754b69d351cdc2d8ee09ae203db831e005560fc6030da058f86ad60c92a9cb0a" +dependencies = [ + "cssparser-macros", + "dtoa-short", + "itoa 0.4.8", + "matches", + "phf 0.8.0", + "proc-macro2", + "quote", + "smallvec", + "syn 1.0.109", +] + +[[package]] +name = "cssparser-macros" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" +dependencies = [ + "quote", + "syn 2.0.72", +] + +[[package]] +name = "ctor" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edb49164822f3ee45b17acd4a208cfc1251410cf0cad9a833234c9890774dd9f" +dependencies = [ + "quote", + "syn 2.0.72", +] + +[[package]] +name = "darling" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.72", +] + +[[package]] +name = "darling_macro" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", + "serde", +] + +[[package]] +name = "derive_more" +version = "0.99.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.72", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "dirs-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" +dependencies = [ + "cfg-if", + "dirs-sys-next", +] + +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + +[[package]] +name = "dispatch" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" + +[[package]] +name = "dtoa" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" + +[[package]] +name = "dtoa-short" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd1511a7b6a56299bd043a9c167a6d2bfb37bf84a6dfceaba651168adfb43c87" +dependencies = [ + "dtoa", +] + +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + +[[package]] +name = "embed-resource" +version = "2.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4edcacde9351c33139a41e3c97eb2334351a81a2791bebb0b243df837128f602" +dependencies = [ + "cc", + "memchr", + "rustc_version", + "toml 0.8.19", + "vswhom", + "winreg 0.52.0", +] + +[[package]] +name = "embed_plist" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ef6b89e5b37196644d8796de5268852ff179b44e96276cf4290264843743bb7" + +[[package]] +name = "encoding_rs" +version = "0.8.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "fastrand" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" + +[[package]] +name = "fdeflate" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f9bfee30e4dedf0ab8b422f03af778d9612b63f502710fc500a334ebe2de645" +dependencies = [ + "simd-adler32", +] + +[[package]] +name = "field-offset" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f" +dependencies = [ + "memoffset", + "rustc_version", +] + +[[package]] +name = "filetime" +version = "0.2.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.4.1", + "windows-sys 0.52.0", +] + +[[package]] +name = "flate2" +version = "1.0.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f211bbe8e69bbd0cfdea405084f128ae8b4aaa6b0b522fc8f2b009084797920" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futf" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df420e2e84819663797d1ec6544b13c5be84629e7bb00dc960d6917db2987843" +dependencies = [ + "mac", + "new_debug_unreachable", +] + +[[package]] +name = "futures-channel" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" + +[[package]] +name = "futures-executor" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" + +[[package]] +name = "futures-macro" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "futures-sink" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" + +[[package]] +name = "futures-task" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" + +[[package]] +name = "futures-util" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +dependencies = [ + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "gdk" +version = "0.15.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6e05c1f572ab0e1f15be94217f0dc29088c248b14f792a5ff0af0d84bcda9e8" +dependencies = [ + "bitflags 1.3.2", + "cairo-rs", + "gdk-pixbuf", + "gdk-sys", + "gio", + "glib", + "libc", + "pango", +] + +[[package]] +name = "gdk-pixbuf" +version = "0.15.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad38dd9cc8b099cceecdf41375bb6d481b1b5a7cd5cd603e10a69a9383f8619a" +dependencies = [ + "bitflags 1.3.2", + "gdk-pixbuf-sys", + "gio", + "glib", + "libc", +] + +[[package]] +name = "gdk-pixbuf-sys" +version = "0.15.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "140b2f5378256527150350a8346dbdb08fadc13453a7a2d73aecd5fab3c402a7" +dependencies = [ + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "system-deps 6.2.2", +] + +[[package]] +name = "gdk-sys" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32e7a08c1e8f06f4177fb7e51a777b8c1689f743a7bc11ea91d44d2226073a88" +dependencies = [ + "cairo-sys-rs", + "gdk-pixbuf-sys", + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "pango-sys", + "pkg-config", + "system-deps 6.2.2", +] + +[[package]] +name = "gdkwayland-sys" +version = "0.15.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cca49a59ad8cfdf36ef7330fe7bdfbe1d34323220cc16a0de2679ee773aee2c2" +dependencies = [ + "gdk-sys", + "glib-sys", + "gobject-sys", + "libc", + "pkg-config", + "system-deps 6.2.2", +] + +[[package]] +name = "gdkx11-sys" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4b7f8c7a84b407aa9b143877e267e848ff34106578b64d1e0a24bf550716178" +dependencies = [ + "gdk-sys", + "glib-sys", + "libc", + "system-deps 6.2.2", + "x11", +] + +[[package]] +name = "generator" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cc16584ff22b460a382b7feec54b23d2908d858152e5739a120b949293bd74e" +dependencies = [ + "cc", + "libc", + "log", + "rustversion", + "windows 0.48.0", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "gimli" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" + +[[package]] +name = "gio" +version = "0.15.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68fdbc90312d462781a395f7a16d96a2b379bb6ef8cd6310a2df272771c4283b" +dependencies = [ + "bitflags 1.3.2", + "futures-channel", + "futures-core", + "futures-io", + "gio-sys", + "glib", + "libc", + "once_cell", + "thiserror", +] + +[[package]] +name = "gio-sys" +version = "0.15.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32157a475271e2c4a023382e9cab31c4584ee30a97da41d3c4e9fdd605abcf8d" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps 6.2.2", + "winapi", +] + +[[package]] +name = "glib" +version = "0.15.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edb0306fbad0ab5428b0ca674a23893db909a98582969c9b537be4ced78c505d" +dependencies = [ + "bitflags 1.3.2", + "futures-channel", + "futures-core", + "futures-executor", + "futures-task", + "glib-macros", + "glib-sys", + "gobject-sys", + "libc", + "once_cell", + "smallvec", + "thiserror", +] + +[[package]] +name = "glib-macros" +version = "0.15.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10c6ae9f6fa26f4fb2ac16b528d138d971ead56141de489f8111e259b9df3c4a" +dependencies = [ + "anyhow", + "heck 0.4.1", + "proc-macro-crate", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "glib-sys" +version = "0.15.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef4b192f8e65e9cf76cbf4ea71fa8e3be4a0e18ffe3d68b8da6836974cc5bad4" +dependencies = [ + "libc", + "system-deps 6.2.2", +] + +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + +[[package]] +name = "globset" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57da3b9b5b85bd66f31093f8c408b90a74431672542466497dcbdfdc02034be1" +dependencies = [ + "aho-corasick", + "bstr", + "log", + "regex-automata 0.4.7", + "regex-syntax 0.8.4", +] + +[[package]] +name = "gobject-sys" +version = "0.15.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d57ce44246becd17153bd035ab4d32cfee096a657fc01f2231c9278378d1e0a" +dependencies = [ + "glib-sys", + "libc", + "system-deps 6.2.2", +] + +[[package]] +name = "gtk" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92e3004a2d5d6d8b5057d2b57b3712c9529b62e82c77f25c1fecde1fd5c23bd0" +dependencies = [ + "atk", + "bitflags 1.3.2", + "cairo-rs", + "field-offset", + "futures-channel", + "gdk", + "gdk-pixbuf", + "gio", + "glib", + "gtk-sys", + "gtk3-macros", + "libc", + "once_cell", + "pango", + "pkg-config", +] + +[[package]] +name = "gtk-sys" +version = "0.15.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5bc2f0587cba247f60246a0ca11fe25fb733eabc3de12d1965fc07efab87c84" +dependencies = [ + "atk-sys", + "cairo-sys-rs", + "gdk-pixbuf-sys", + "gdk-sys", + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "pango-sys", + "system-deps 6.2.2", +] + +[[package]] +name = "gtk3-macros" +version = "0.15.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "684c0456c086e8e7e9af73ec5b84e35938df394712054550e81558d21c44ab0d" +dependencies = [ + "anyhow", + "proc-macro-crate", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "h2" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap 2.3.0", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + +[[package]] +name = "heck" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "html5ever" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bea68cab48b8459f17cf1c944c67ddc572d272d9f2b274140f223ecb1da4a3b7" +dependencies = [ + "log", + "mac", + "markup5ever", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "http" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +dependencies = [ + "bytes", + "fnv", + "itoa 1.0.11", +] + +[[package]] +name = "http-body" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "http-range" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21dec9db110f5f872ed9699c3ecf50cf16f423502706ba5c72462e28d3157573" + +[[package]] +name = "httparse" +version = "1.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "0.14.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa 1.0.11", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "ico" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3804960be0bb5e4edb1e1ad67afd321a9ecfd875c3e65c099468fd2717d7cae" +dependencies = [ + "byteorder", + "png", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "ignore" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b46810df39e66e925525d6e38ce1e7f6e1d208f72dc39757880fcb66e2c58af1" +dependencies = [ + "crossbeam-deque", + "globset", + "log", + "memchr", + "regex-automata 0.4.7", + "same-file", + "walkdir", + "winapi-util", +] + +[[package]] +name = "image" +version = "0.24.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5690139d2f55868e080017335e4b94cb7414274c74f1669c84fb5feba2c9f69d" +dependencies = [ + "bytemuck", + "byteorder", + "color_quant", + "num-traits", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3fc2e30ba82dd1b3911c8de1ffc143c74a914a14e99514d7637e3099df5ea0" +dependencies = [ + "equivalent", + "hashbrown 0.14.5", + "serde", +] + +[[package]] +name = "infer" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f551f8c3a39f68f986517db0d1759de85881894fdc7db798bd2a9df9cb04b7fc" +dependencies = [ + "cfb", +] + +[[package]] +name = "instant" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "ipnet" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" + +[[package]] +name = "itoa" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "javascriptcore-rs" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf053e7843f2812ff03ef5afe34bb9c06ffee120385caad4f6b9967fcd37d41c" +dependencies = [ + "bitflags 1.3.2", + "glib", + "javascriptcore-rs-sys", +] + +[[package]] +name = "javascriptcore-rs-sys" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "905fbb87419c5cde6e3269537e4ea7d46431f3008c5d057e915ef3f115e7793c" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps 5.0.0", +] + +[[package]] +name = "jni" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "039022cdf4d7b1cf548d31f60ae783138e5fd42013f6271049d7df7afadef96c" +dependencies = [ + "cesu8", + "combine", + "jni-sys", + "log", + "thiserror", + "walkdir", +] + +[[package]] +name = "jni-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" + +[[package]] +name = "js-sys" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "json-patch" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec9ad60d674508f3ca8f380a928cfe7b096bc729c4e2dbfe3852bc45da3ab30b" +dependencies = [ + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "kuchikiki" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29e4755b7b995046f510a7520c42b2fed58b77bd94d5a87a8eb43d2fd126da8" +dependencies = [ + "cssparser", + "html5ever", + "indexmap 1.9.3", + "matches", + "selectors", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "libc" +version = "0.2.155" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" + +[[package]] +name = "libredox" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +dependencies = [ + "bitflags 2.6.0", + "libc", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + +[[package]] +name = "lock_api" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "loom" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff50ecb28bb86013e935fb6683ab1f6d3a20016f123c76fd4c27470076ac30f5" +dependencies = [ + "cfg-if", + "generator", + "scoped-tls", + "serde", + "serde_json", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "mac" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" + +[[package]] +name = "malloc_buf" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +dependencies = [ + "libc", +] + +[[package]] +name = "markup5ever" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a2629bb1404f3d34c2e921f21fd34ba00b206124c81f65c50b43b6aaefeb016" +dependencies = [ + "log", + "phf 0.10.1", + "phf_codegen 0.10.0", + "string_cache", + "string_cache_codegen", + "tendril", +] + +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + +[[package]] +name = "matches" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "minisign-verify" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "933dca44d65cdd53b355d0b73d380a2ff5da71f87f036053188bf1eab6a19881" + +[[package]] +name = "miniz_oxide" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" +dependencies = [ + "adler", + "simd-adler32", +] + +[[package]] +name = "mio" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4569e456d394deccd22ce1c1913e6ea0e54519f577285001215d33557431afe4" +dependencies = [ + "hermit-abi", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys 0.52.0", +] + +[[package]] +name = "native-tls" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "ndk" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2032c77e030ddee34a6787a64166008da93f6a352b629261d0fee232b8742dd4" +dependencies = [ + "bitflags 1.3.2", + "jni-sys", + "ndk-sys", + "num_enum", + "thiserror", +] + +[[package]] +name = "ndk-context" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" + +[[package]] +name = "ndk-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e5a6ae77c8ee183dcbbba6150e2e6b9f3f4196a7666c02a715a95692ec1fa97" +dependencies = [ + "jni-sys", +] + +[[package]] +name = "new_debug_unreachable" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" + +[[package]] +name = "nodrop" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" + +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_enum" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" +dependencies = [ + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "objc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" +dependencies = [ + "malloc_buf", + "objc_exception", +] + +[[package]] +name = "objc-foundation" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9" +dependencies = [ + "block", + "objc", + "objc_id", +] + +[[package]] +name = "objc_exception" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad970fb455818ad6cba4c122ad012fae53ae8b4795f86378bce65e4f6bab2ca4" +dependencies = [ + "cc", +] + +[[package]] +name = "objc_id" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b" +dependencies = [ + "objc", +] + +[[package]] +name = "object" +version = "0.36.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "openssl" +version = "0.10.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fedfea7d58a1f73118430a55da6a286e7b044961736ce96a16a17068ea25e5da" +dependencies = [ + "bitflags 2.6.0", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8288979acd84749c744a9014b4382d42b8f7b2592847b5afb2ed29e5d16ede07" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + +[[package]] +name = "pango" +version = "0.15.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e4045548659aee5313bde6c582b0d83a627b7904dd20dc2d9ef0895d414e4f" +dependencies = [ + "bitflags 1.3.2", + "glib", + "libc", + "once_cell", + "pango-sys", +] + +[[package]] +name = "pango-sys" +version = "0.15.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2a00081cde4661982ed91d80ef437c20eacaf6aa1a5962c0279ae194662c3aa" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps 6.2.2", +] + +[[package]] +name = "parking_lot" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.5.3", + "smallvec", + "windows-targets 0.52.6", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "phf" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12" +dependencies = [ + "phf_macros 0.8.0", + "phf_shared 0.8.0", + "proc-macro-hack", +] + +[[package]] +name = "phf" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" +dependencies = [ + "phf_shared 0.10.0", +] + +[[package]] +name = "phf" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" +dependencies = [ + "phf_macros 0.11.2", + "phf_shared 0.11.2", +] + +[[package]] +name = "phf_codegen" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbffee61585b0411840d3ece935cce9cb6321f01c45477d30066498cd5e1a815" +dependencies = [ + "phf_generator 0.8.0", + "phf_shared 0.8.0", +] + +[[package]] +name = "phf_codegen" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd" +dependencies = [ + "phf_generator 0.10.0", + "phf_shared 0.10.0", +] + +[[package]] +name = "phf_generator" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17367f0cc86f2d25802b2c26ee58a7b23faeccf78a396094c13dced0d0182526" +dependencies = [ + "phf_shared 0.8.0", + "rand 0.7.3", +] + +[[package]] +name = "phf_generator" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" +dependencies = [ + "phf_shared 0.10.0", + "rand 0.8.5", +] + +[[package]] +name = "phf_generator" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" +dependencies = [ + "phf_shared 0.11.2", + "rand 0.8.5", +] + +[[package]] +name = "phf_macros" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f6fde18ff429ffc8fe78e2bf7f8b7a5a5a6e2a8b58bc5a9ac69198bbda9189c" +dependencies = [ + "phf_generator 0.8.0", + "phf_shared 0.8.0", + "proc-macro-hack", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "phf_macros" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" +dependencies = [ + "phf_generator 0.11.2", + "phf_shared 0.11.2", + "proc-macro2", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "phf_shared" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7" +dependencies = [ + "siphasher", +] + +[[package]] +name = "phf_shared" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" +dependencies = [ + "siphasher", +] + +[[package]] +name = "phf_shared" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" + +[[package]] +name = "plist" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42cf17e9a1800f5f396bc67d193dc9411b59012a5876445ef450d449881e1016" +dependencies = [ + "base64 0.22.1", + "indexmap 2.3.0", + "quick-xml", + "serde", + "time", +] + +[[package]] +name = "png" +version = "0.17.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06e4b0d3d1312775e782c86c91a111aa1f910cbb65e1337f9975b5f9a554b5e1" +dependencies = [ + "bitflags 1.3.2", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + +[[package]] +name = "proc-macro-crate" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +dependencies = [ + "once_cell", + "toml_edit 0.19.15", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro-hack" +version = "0.5.20+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quick-xml" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d3a6e5838b60e0e8fa7a43f22ade549a37d61f8bdbe636d0d7816191de969c2" +dependencies = [ + "memchr", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc", + "rand_pcg", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.15", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "rand_pcg" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "raw-window-handle" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" + +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_syscall" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" +dependencies = [ + "bitflags 2.6.0", +] + +[[package]] +name = "redox_users" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" +dependencies = [ + "getrandom 0.2.15", + "libredox", + "thiserror", +] + +[[package]] +name = "regex" +version = "1.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata 0.4.7", + "regex-syntax 0.8.4", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-automata" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.8.4", +] + +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + +[[package]] +name = "regex-syntax" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" + +[[package]] +name = "reqwest" +version = "0.11.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" +dependencies = [ + "base64 0.21.7", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-tls", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls-pemfile", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "system-configuration", + "tokio", + "tokio-native-tls", + "tokio-util", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-streams", + "web-sys", + "winreg 0.50.0", +] + +[[package]] +name = "rfd" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0149778bd99b6959285b0933288206090c50e2327f47a9c463bfdbf45c8823ea" +dependencies = [ + "block", + "dispatch", + "glib-sys", + "gobject-sys", + "gtk-sys", + "js-sys", + "lazy_static", + "log", + "objc", + "objc-foundation", + "objc_id", + "raw-window-handle", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "windows 0.37.0", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "0.38.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +dependencies = [ + "bitflags 2.6.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +dependencies = [ + "base64 0.21.7", +] + +[[package]] +name = "rustversion" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "schannel" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "security-framework" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +dependencies = [ + "bitflags 2.6.0", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "selectors" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df320f1889ac4ba6bc0cdc9c9af7af4bd64bb927bccdf32d81140dc1f9be12fe" +dependencies = [ + "bitflags 1.3.2", + "cssparser", + "derive_more", + "fxhash", + "log", + "matches", + "phf 0.8.0", + "phf_codegen 0.8.0", + "precomputed-hash", + "servo_arc", + "smallvec", + "thin-slice", +] + +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +dependencies = [ + "serde", +] + +[[package]] +name = "serde" +version = "1.0.205" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e33aedb1a7135da52b7c21791455563facbbcc43d0f0f66165b42c21b3dfb150" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.205" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "692d6f5ac90220161d6774db30c662202721e64aed9058d2c394f451261420c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "serde_json" +version = "1.0.122" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "784b6203951c57ff748476b126ccb5e8e2959a5c19e5c617ab1956be3dbc68da" +dependencies = [ + "indexmap 2.3.0", + "itoa 1.0.11", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "serde_repr" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "serde_spanned" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa 1.0.11", + "ryu", + "serde", +] + +[[package]] +name = "serde_with" +version = "3.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857" +dependencies = [ + "base64 0.22.1", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.3.0", + "serde", + "serde_derive", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "3.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "serialize-to-javascript" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9823f2d3b6a81d98228151fdeaf848206a7855a7a042bbf9bf870449a66cafb" +dependencies = [ + "serde", + "serde_json", + "serialize-to-javascript-impl", +] + +[[package]] +name = "serialize-to-javascript-impl" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74064874e9f6a15f04c1f3cb627902d0e6b410abbf36668afa873c61889f1763" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "servo_arc" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d98238b800e0d1576d8b6e3de32827c2d74bee68bb97748dcf5071fb53965432" +dependencies = [ + "nodrop", + "stable_deref_trait", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "simd-adler32" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" + +[[package]] +name = "siphasher" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + +[[package]] +name = "socket2" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "soup2" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2b4d76501d8ba387cf0fefbe055c3e0a59891d09f0f995ae4e4b16f6b60f3c0" +dependencies = [ + "bitflags 1.3.2", + "gio", + "glib", + "libc", + "once_cell", + "soup2-sys", +] + +[[package]] +name = "soup2-sys" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "009ef427103fcb17f802871647a7fa6c60cbb654b4c4e4c0ac60a31c5f6dc9cf" +dependencies = [ + "bitflags 1.3.2", + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "system-deps 5.0.0", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "state" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbe866e1e51e8260c9eed836a042a5e7f6726bb2b411dffeaa712e19c388f23b" +dependencies = [ + "loom", +] + +[[package]] +name = "string_cache" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" +dependencies = [ + "new_debug_unreachable", + "once_cell", + "parking_lot", + "phf_shared 0.10.0", + "precomputed-hash", + "serde", +] + +[[package]] +name = "string_cache_codegen" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988" +dependencies = [ + "phf_generator 0.10.0", + "phf_shared 0.10.0", + "proc-macro2", + "quote", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + +[[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", + "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", + "libc", +] + +[[package]] +name = "system-deps" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18db855554db7bd0e73e06cf7ba3df39f97812cb11d3f75e71c39bf45171797e" +dependencies = [ + "cfg-expr 0.9.1", + "heck 0.3.3", + "pkg-config", + "toml 0.5.11", + "version-compare 0.0.11", +] + +[[package]] +name = "system-deps" +version = "6.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349" +dependencies = [ + "cfg-expr 0.15.8", + "heck 0.5.0", + "pkg-config", + "toml 0.8.19", + "version-compare 0.2.0", +] + +[[package]] +name = "tao" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "575c856fc21e551074869dcfaad8f706412bd5b803dfa0fbf6881c4ff4bfafab" +dependencies = [ + "bitflags 1.3.2", + "cairo-rs", + "cc", + "cocoa", + "core-foundation", + "core-graphics", + "crossbeam-channel", + "dispatch", + "gdk", + "gdk-pixbuf", + "gdk-sys", + "gdkwayland-sys", + "gdkx11-sys", + "gio", + "glib", + "glib-sys", + "gtk", + "image", + "instant", + "jni", + "lazy_static", + "libc", + "log", + "ndk", + "ndk-context", + "ndk-sys", + "objc", + "once_cell", + "parking_lot", + "png", + "raw-window-handle", + "scopeguard", + "serde", + "tao-macros", + "unicode-segmentation", + "uuid", + "windows 0.39.0", + "windows-implement", + "x11-dl", +] + +[[package]] +name = "tao-macros" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec114582505d158b669b136e6851f85840c109819d77c42bb7c0709f727d18c2" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "tar" +version = "0.4.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb797dad5fb5b76fcf519e702f4a589483b5ef06567f160c392832c1f5e44909" +dependencies = [ + "filetime", + "libc", + "xattr", +] + +[[package]] +name = "target-lexicon" +version = "0.12.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" + +[[package]] +name = "tauri" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "336bc661a3f3250853fa83c6e5245449ed1c26dce5dcb28bdee7efedf6278806" +dependencies = [ + "anyhow", + "base64 0.21.7", + "bytes", + "cocoa", + "dirs-next", + "dunce", + "embed_plist", + "encoding_rs", + "flate2", + "futures-util", + "getrandom 0.2.15", + "glib", + "glob", + "gtk", + "heck 0.5.0", + "http", + "ignore", + "indexmap 1.9.3", + "minisign-verify", + "objc", + "once_cell", + "percent-encoding", + "rand 0.8.5", + "raw-window-handle", + "reqwest", + "rfd", + "semver", + "serde", + "serde_json", + "serde_repr", + "serialize-to-javascript", + "state", + "tar", + "tauri-macros", + "tauri-runtime", + "tauri-runtime-wry", + "tauri-utils", + "tempfile", + "thiserror", + "time", + "tokio", + "url", + "uuid", + "webkit2gtk", + "webview2-com", + "windows 0.39.0", + "zip", +] + +[[package]] +name = "tauri-build" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0c6ec7a5c3296330c7818478948b422967ce4649094696c985f61d50076d29c" +dependencies = [ + "anyhow", + "cargo_toml", + "dirs-next", + "heck 0.5.0", + "json-patch", + "semver", + "serde", + "serde_json", + "tauri-utils", + "tauri-winres", + "walkdir", +] + +[[package]] +name = "tauri-codegen" +version = "1.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1aed706708ff1200ec12de9cfbf2582b5d8ec05f6a7293911091effbd22036b" +dependencies = [ + "base64 0.21.7", + "brotli", + "ico", + "json-patch", + "plist", + "png", + "proc-macro2", + "quote", + "semver", + "serde", + "serde_json", + "sha2", + "tauri-utils", + "thiserror", + "time", + "uuid", + "walkdir", +] + +[[package]] +name = "tauri-macros" +version = "1.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b88f831d2973ae4f81a706a0004e67dac87f2e4439973bbe98efbd73825d8ede" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 1.0.109", + "tauri-codegen", + "tauri-utils", +] + +[[package]] +name = "tauri-runtime" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3068ed62b63dedc705558f4248c7ecbd5561f0f8050949859ea0db2326f26012" +dependencies = [ + "gtk", + "http", + "http-range", + "rand 0.8.5", + "raw-window-handle", + "serde", + "serde_json", + "tauri-utils", + "thiserror", + "url", + "uuid", + "webview2-com", + "windows 0.39.0", +] + +[[package]] +name = "tauri-runtime-wry" +version = "0.14.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4c3db170233096aa30330feadcd895bf9317be97e624458560a20e814db7955" +dependencies = [ + "cocoa", + "gtk", + "percent-encoding", + "rand 0.8.5", + "raw-window-handle", + "tauri-runtime", + "tauri-utils", + "uuid", + "webkit2gtk", + "webview2-com", + "windows 0.39.0", + "wry", +] + +[[package]] +name = "tauri-utils" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2826db448309d382dac14d520f0c0a40839b87b57b977e59cf5f296b3ace6a93" +dependencies = [ + "brotli", + "ctor", + "dunce", + "glob", + "heck 0.5.0", + "html5ever", + "infer", + "json-patch", + "kuchikiki", + "log", + "memchr", + "phf 0.11.2", + "proc-macro2", + "quote", + "semver", + "serde", + "serde_json", + "serde_with", + "thiserror", + "url", + "walkdir", + "windows-version", +] + +[[package]] +name = "tauri-winres" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5993dc129e544393574288923d1ec447c857f3f644187f4fbf7d9a875fbfc4fb" +dependencies = [ + "embed-resource", + "toml 0.7.8", +] + +[[package]] +name = "tempfile" +version = "3.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" +dependencies = [ + "cfg-if", + "fastrand", + "once_cell", + "rustix", + "windows-sys 0.59.0", +] + +[[package]] +name = "tendril" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d24a120c5fc464a3458240ee02c299ebcb9d67b5249c8848b09d639dca8d7bb0" +dependencies = [ + "futf", + "mac", + "utf-8", +] + +[[package]] +name = "thin-slice" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c" + +[[package]] +name = "thiserror" +version = "1.0.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "thread_local" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +dependencies = [ + "cfg-if", + "once_cell", +] + +[[package]] +name = "time" +version = "0.3.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +dependencies = [ + "deranged", + "itoa 1.0.11", + "num-conv", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tiny_http" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0d6ef4e10d23c1efb862eecad25c5054429a71958b4eeef85eb5e7170b477ca" +dependencies = [ + "ascii", + "chunked_transfer", + "log", + "time", + "url", +] + +[[package]] +name = "tinyvec" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.39.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daa4fb1bc778bd6f04cbfc4bb2d06a7396a8f299dc33ea1900cedaa316f467b1" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "pin-project-lite", + "socket2", + "windows-sys 0.52.0", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde", +] + +[[package]] +name = "toml" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit 0.19.15", +] + +[[package]] +name = "toml" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit 0.22.20", +] + +[[package]] +name = "toml_datetime" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.19.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +dependencies = [ + "indexmap 2.3.0", + "serde", + "serde_spanned", + "toml_datetime", + "winnow 0.5.40", +] + +[[package]] +name = "toml_edit" +version = "0.22.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" +dependencies = [ + "indexmap 2.3.0", + "serde", + "serde_spanned", + "toml_datetime", + "winnow 0.6.18", +] + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unicode-bidi" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-normalization" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-segmentation" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" + +[[package]] +name = "url" +version = "2.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + +[[package]] +name = "uuid" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" +dependencies = [ + "getrandom 0.2.15", +] + +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version-compare" +version = "0.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c18c859eead79d8b95d09e4678566e8d70105c4e7b251f707a03df32442661b" + +[[package]] +name = "version-compare" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "vswhom" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be979b7f07507105799e854203b470ff7c78a1639e330a58f183b5fea574608b" +dependencies = [ + "libc", + "vswhom-sys", +] + +[[package]] +name = "vswhom-sys" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3b17ae1f6c8a2b28506cd96d412eebf83b4a0ff2cbefeeb952f2f9dfa44ba18" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.72", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.72", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" + +[[package]] +name = "wasm-streams" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b65dc4c90b63b118468cf747d8bf3566c1913ef60be765b5730ead9e0a3ba129" +dependencies = [ + "futures-util", + "js-sys", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "web-sys" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webkit2gtk" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8f859735e4a452aeb28c6c56a852967a8a76c8eb1cc32dbf931ad28a13d6370" +dependencies = [ + "bitflags 1.3.2", + "cairo-rs", + "gdk", + "gdk-sys", + "gio", + "gio-sys", + "glib", + "glib-sys", + "gobject-sys", + "gtk", + "gtk-sys", + "javascriptcore-rs", + "libc", + "once_cell", + "soup2", + "webkit2gtk-sys", +] + +[[package]] +name = "webkit2gtk-sys" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d76ca6ecc47aeba01ec61e480139dda143796abcae6f83bcddf50d6b5b1dcf3" +dependencies = [ + "atk-sys", + "bitflags 1.3.2", + "cairo-sys-rs", + "gdk-pixbuf-sys", + "gdk-sys", + "gio-sys", + "glib-sys", + "gobject-sys", + "gtk-sys", + "javascriptcore-rs-sys", + "libc", + "pango-sys", + "pkg-config", + "soup2-sys", + "system-deps 6.2.2", +] + +[[package]] +name = "webview2-com" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4a769c9f1a64a8734bde70caafac2b96cada12cd4aefa49196b3a386b8b4178" +dependencies = [ + "webview2-com-macros", + "webview2-com-sys", + "windows 0.39.0", + "windows-implement", +] + +[[package]] +name = "webview2-com-macros" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaebe196c01691db62e9e4ca52c5ef1e4fd837dcae27dae3ada599b5a8fd05ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "webview2-com-sys" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aac48ef20ddf657755fdcda8dfed2a7b4fc7e4581acce6fe9b88c3d64f29dee7" +dependencies = [ + "regex", + "serde", + "serde_json", + "thiserror", + "windows 0.39.0", + "windows-bindgen", + "windows-metadata", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57b543186b344cc61c85b5aab0d2e3adf4e0f99bc076eff9aa5927bcc0b8a647" +dependencies = [ + "windows_aarch64_msvc 0.37.0", + "windows_i686_gnu 0.37.0", + "windows_i686_msvc 0.37.0", + "windows_x86_64_gnu 0.37.0", + "windows_x86_64_msvc 0.37.0", +] + +[[package]] +name = "windows" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1c4bd0a50ac6020f65184721f758dba47bb9fbc2133df715ec74a237b26794a" +dependencies = [ + "windows-implement", + "windows_aarch64_msvc 0.39.0", + "windows_i686_gnu 0.39.0", + "windows_i686_msvc 0.39.0", + "windows_x86_64_gnu 0.39.0", + "windows_x86_64_msvc 0.39.0", +] + +[[package]] +name = "windows" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-bindgen" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68003dbd0e38abc0fb85b939240f4bce37c43a5981d3df37ccbaaa981b47cb41" +dependencies = [ + "windows-metadata", + "windows-tokens", +] + +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-implement" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba01f98f509cb5dc05f4e5fc95e535f78260f15fea8fe1a8abdd08f774f1cee7" +dependencies = [ + "syn 1.0.109", + "windows-tokens", +] + +[[package]] +name = "windows-metadata" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ee5e275231f07c6e240d14f34e1b635bf1faa1c76c57cfd59a5cdb9848e4278" + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "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]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-tokens" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f838de2fe15fe6bac988e74b798f26499a8b21a9d97edec321e79b28d1d7f597" + +[[package]] +name = "windows-version" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6998aa457c9ba8ff2fb9f13e9d2a930dabcea28f1d0ab94d687d8b3654844515" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2623277cb2d1c216ba3b578c0f3cf9cdebeddb6e66b1b218bb33596ea7769c3a" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec7711666096bd4096ffa835238905bb33fb87267910e154b18b44eaabb340f2" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3925fd0b0b804730d44d4b6278c50f9699703ec49bcd628020f46f4ba07d9e1" + +[[package]] +name = "windows_i686_gnu" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "763fc57100a5f7042e3057e7e8d9bdd7860d330070251a73d003563a3bb49e1b" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce907ac74fe331b524c1298683efbf598bb031bc84d5e274db2083696d07c57c" + +[[package]] +name = "windows_i686_msvc" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7bc7cbfe58828921e10a9f446fcaaf649204dcfe6c1ddd712c5eebae6bda1106" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2babfba0828f2e6b32457d5341427dcbb577ceef556273229959ac23a10af33d" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6868c165637d653ae1e8dc4d82c25d4f97dd6605eaa8d784b5c6e0ab2a252b65" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4dd6dc7df2d84cf7b33822ed5b86318fb1781948e9663bacd047fc9dd52259d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e4d40883ae9cae962787ca76ba76390ffa29214667a111db9e0a1ad8377e809" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.5.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] + +[[package]] +name = "winnow" +version = "0.6.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" +dependencies = [ + "memchr", +] + +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + +[[package]] +name = "winreg" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + +[[package]] +name = "wry" +version = "0.24.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00711278ed357350d44c749c286786ecac644e044e4da410d466212152383b45" +dependencies = [ + "base64 0.13.1", + "block", + "cocoa", + "core-graphics", + "crossbeam-channel", + "dunce", + "gdk", + "gio", + "glib", + "gtk", + "html5ever", + "http", + "kuchikiki", + "libc", + "log", + "objc", + "objc_id", + "once_cell", + "serde", + "serde_json", + "sha2", + "soup2", + "tao", + "thiserror", + "url", + "webkit2gtk", + "webkit2gtk-sys", + "webview2-com", + "windows 0.39.0", + "windows-implement", +] + +[[package]] +name = "x11" +version = "2.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "502da5464ccd04011667b11c435cb992822c2c0dbde1770c988480d312a0db2e" +dependencies = [ + "libc", + "pkg-config", +] + +[[package]] +name = "x11-dl" +version = "2.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" +dependencies = [ + "libc", + "once_cell", + "pkg-config", +] + +[[package]] +name = "xattr" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8da84f1a25939b27f6820d92aed108f83ff920fdf11a7b19366c27c4cda81d4f" +dependencies = [ + "libc", + "linux-raw-sys", + "rustix", +] + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "byteorder", + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "zip" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" +dependencies = [ + "byteorder", + "crc32fast", + "crossbeam-utils", +] diff --git a/plugins/updater/tests/updater-migration/v1-app/Cargo.toml b/plugins/updater/tests/updater-migration/v1-app/Cargo.toml new file mode 100644 index 00000000..e99e4108 --- /dev/null +++ b/plugins/updater/tests/updater-migration/v1-app/Cargo.toml @@ -0,0 +1,18 @@ +workspace = {} + +[package] +name = "app-updater-v1" +version = "0.1.0" +edition = "2021" + +[build-dependencies] +tauri-build = { version = "1", features = [] } + +[dependencies] +serde = { version = "1", features = ["derive"] } +serde_json = "1" +tiny_http = "0.11" +tauri = { version = "1", features = ["updater"] } + +[features] +custom-protocol = ["tauri/custom-protocol"] diff --git a/plugins/updater/tests/updater-migration/v1-app/build.rs b/plugins/updater/tests/updater-migration/v1-app/build.rs new file mode 100644 index 00000000..5ebf8d2f --- /dev/null +++ b/plugins/updater/tests/updater-migration/v1-app/build.rs @@ -0,0 +1,7 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +fn main() { + tauri_build::build() +} diff --git a/plugins/updater/tests/updater-migration/v1-app/package.json b/plugins/updater/tests/updater-migration/v1-app/package.json new file mode 100644 index 00000000..2379b094 --- /dev/null +++ b/plugins/updater/tests/updater-migration/v1-app/package.json @@ -0,0 +1,10 @@ +{ + "name": "v1-app", + "version": "0.0.0", + "dependencies": { + "@tauri-apps/cli": "^1.0.0" + }, + "scripts": { + "tauri": "tauri" + } +} diff --git a/plugins/updater/tests/updater-migration/v1-app/src/main.rs b/plugins/updater/tests/updater-migration/v1-app/src/main.rs new file mode 100644 index 00000000..3c3138dd --- /dev/null +++ b/plugins/updater/tests/updater-migration/v1-app/src/main.rs @@ -0,0 +1,50 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] + +fn main() { + let mut context = tauri::generate_context!(); + if std::env::var("TARGET").unwrap_or_default() == "nsis" { + // /D sets the default installation directory ($INSTDIR), + // overriding InstallDir and InstallDirRegKey. + // It must be the last parameter used in the command line and must not contain any quotes, even if the path contains spaces. + // Only absolute paths are supported. + // NOTE: we only need this because this is an integration test and we don't want to install the app in the programs folder + context.config_mut().tauri.updater.windows.installer_args = vec![format!( + "/D={}", + tauri::utils::platform::current_exe() + .unwrap() + .parent() + .unwrap() + .display() + )]; + } + tauri::Builder::default() + .setup(|app| { + println!("version={}", app.package_info().version); + let handle = app.handle(); + tauri::async_runtime::spawn(async move { + match handle.updater().check().await { + Ok(update) => { + if update.is_update_available() { + if let Err(e) = update.download_and_install().await { + println!("{e}"); + std::process::exit(1); + } + std::process::exit(0); + } + std::process::exit(2); + } + Err(e) => { + println!("{e}"); + std::process::exit(1); + } + } + }); + Ok(()) + }) + .run(context) + .expect("error while running tauri application"); +} diff --git a/plugins/updater/tests/updater-migration/v1-app/tauri.conf.json b/plugins/updater/tests/updater-migration/v1-app/tauri.conf.json new file mode 100644 index 00000000..13e79887 --- /dev/null +++ b/plugins/updater/tests/updater-migration/v1-app/tauri.conf.json @@ -0,0 +1,39 @@ +{ + "$schema": "../../../core/tauri-config-schema/schema.json", + "build": { + "distDir": [], + "devPath": [] + }, + "tauri": { + "bundle": { + "active": true, + "targets": "all", + "identifier": "com.tauri.updater", + "icon": [ + "../icons/32x32.png", + "../icons/128x128.png", + "../icons/128x128@2x.png", + "../icons/icon.icns", + "../icons/icon.ico" + ], + "category": "DeveloperTool", + "windows": { + "wix": { + "skipWebviewInstall": true + } + } + }, + "allowlist": { + "all": false + }, + "updater": { + "active": true, + "dialog": false, + "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEUwNDRGMjkwRjg2MDhCRDAKUldUUWkyRDRrUEpFNEQ4SmdwcU5PaXl6R2ZRUUNvUnhIaVkwVUltV0NMaEx6VTkrWVhpT0ZqeEEK", + "endpoints": ["http://localhost:3007"], + "windows": { + "installMode": "quiet" + } + } + } +} diff --git a/plugins/updater/tests/updater-migration/v2-app/.gitignore b/plugins/updater/tests/updater-migration/v2-app/.gitignore new file mode 100644 index 00000000..6a4bb536 --- /dev/null +++ b/plugins/updater/tests/updater-migration/v2-app/.gitignore @@ -0,0 +1 @@ +/gen/schemas diff --git a/plugins/updater/tests/updater-migration/v2-app/Cargo.toml b/plugins/updater/tests/updater-migration/v2-app/Cargo.toml new file mode 100644 index 00000000..d74275b1 --- /dev/null +++ b/plugins/updater/tests/updater-migration/v2-app/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "app-updater-v2" +version = "0.1.0" +edition = { workspace = true } + +[build-dependencies] +tauri-build = { workspace = true } + +[dependencies] +tauri = { workspace = true, features = ["wry", "compression"] } +serde = { workspace = true } +serde_json = { workspace = true } +tauri-plugin-updater = { path = "../../.." } +tiny_http = "0.12" diff --git a/plugins/updater/tests/updater-migration/v2-app/build.rs b/plugins/updater/tests/updater-migration/v2-app/build.rs new file mode 100644 index 00000000..5ebf8d2f --- /dev/null +++ b/plugins/updater/tests/updater-migration/v2-app/build.rs @@ -0,0 +1,7 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +fn main() { + tauri_build::build() +} diff --git a/plugins/updater/tests/updater-migration/v2-app/src/main.rs b/plugins/updater/tests/updater-migration/v2-app/src/main.rs new file mode 100644 index 00000000..b2bbe04b --- /dev/null +++ b/plugins/updater/tests/updater-migration/v2-app/src/main.rs @@ -0,0 +1,58 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] + +use tauri_plugin_updater::UpdaterExt; + +fn main() { + #[allow(unused_mut)] + let mut context = tauri::generate_context!(); + + tauri::Builder::default() + .plugin(tauri_plugin_updater::Builder::new().build()) + .setup(|app| { + println!("version={}", app.package_info().version); + let handle = app.handle().clone(); + tauri::async_runtime::spawn(async move { + let mut builder = handle.updater_builder(); + if std::env::var("TARGET").unwrap_or_default() == "nsis" { + // /D sets the default installation directory ($INSTDIR), + // overriding InstallDir and InstallDirRegKey. + // It must be the last parameter used in the command line and must not contain any quotes, even if the path contains spaces. + // Only absolute paths are supported. + // NOTE: we only need this because this is an integration test and we don't want to install the app in the programs folder + builder = builder.installer_args(vec![format!( + "/D={}", + tauri::utils::platform::current_exe() + .unwrap() + .parent() + .unwrap() + .display() + )]); + } + let updater = builder.build().unwrap(); + + match updater.check().await { + Ok(Some(update)) => { + if let Err(e) = update.download_and_install(|_, _| {}, || {}).await { + println!("{e}"); + std::process::exit(1); + } + std::process::exit(0); + } + Ok(None) => { + std::process::exit(2); + } + Err(e) => { + println!("{e}"); + std::process::exit(1); + } + } + }); + Ok(()) + }) + .run(context) + .expect("error while running tauri application"); +} diff --git a/plugins/updater/tests/updater-migration/v2-app/tauri.conf.json b/plugins/updater/tests/updater-migration/v2-app/tauri.conf.json new file mode 100644 index 00000000..d6cff85f --- /dev/null +++ b/plugins/updater/tests/updater-migration/v2-app/tauri.conf.json @@ -0,0 +1,33 @@ +{ + "identifier": "com.tauri.updater", + "plugins": { + "updater": { + "endpoints": ["http://localhost:3007"], + "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEUwNDRGMjkwRjg2MDhCRDAKUldUUWkyRDRrUEpFNEQ4SmdwcU5PaXl6R2ZRUUNvUnhIaVkwVUltV0NMaEx6VTkrWVhpT0ZqeEEK", + "windows": { + "installMode": "quiet", + "installerArgs": ["/NS"] + } + } + }, + "bundle": { + "active": true, + "targets": "all", + "createUpdaterArtifacts": true, + "icon": [ + "../icons/32x32.png", + "../icons/128x128.png", + "../icons/128x128@2x.png", + "../icons/icon.icns", + "../icons/icon.ico" + ], + "windows": { + "webviewInstallMode": { + "type": "skip" + }, + "nsis": { + "compression": "none" + } + } + } +} diff --git a/plugins/upload/.gitignore b/plugins/upload/.gitignore deleted file mode 100644 index b512c09d..00000000 --- a/plugins/upload/.gitignore +++ /dev/null @@ -1 +0,0 @@ -node_modules \ No newline at end of file diff --git a/plugins/upload/CHANGELOG.md b/plugins/upload/CHANGELOG.md index fab00b13..927256bc 100644 --- a/plugins/upload/CHANGELOG.md +++ b/plugins/upload/CHANGELOG.md @@ -1,5 +1,80 @@ # Changelog +## \[2.2.1] + +- [`ca7395a5`](https://github.com/tauri-apps/plugins-workspace/commit/ca7395a5ce971cbac25fb54285056edf3dd84e1f) ([#2378](https://github.com/tauri-apps/plugins-workspace/pull/2378) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) the `rustls-tls` feature is now enabled by default + +## \[2.2.1] + +- [`05c62d73`](https://github.com/tauri-apps/plugins-workspace/commit/05c62d731fa48fd06b8cb3694a962d8cb0db8619) ([#1523](https://github.com/tauri-apps/plugins-workspace/pull/1523) by [@enri90](https://github.com/tauri-apps/plugins-workspace/../../enri90)) Added post request on download function + +## \[2.2.0] + +- [`5dadd205`](https://github.com/tauri-apps/plugins-workspace/commit/5dadd205f5596c9607457dd015a2f9d7fc48a2db) ([#2033](https://github.com/tauri-apps/plugins-workspace/pull/2033) by [@514sid](https://github.com/tauri-apps/plugins-workspace/../../514sid)) Added a new field `progressTotal` to track the total amount of data transferred during the upload/download process. + +## \[2.1.0] + +- [`87cc5852`](https://github.com/tauri-apps/plugins-workspace/commit/87cc58527d769960427a2f46bb10532f5dcf7ace) ([#1797](https://github.com/tauri-apps/plugins-workspace/pull/1797) by [@VirtualPirate](https://github.com/tauri-apps/plugins-workspace/../../VirtualPirate)) Added feature for calculating `transfer_speed` during file uploads and downloads + +## \[2.0.1] + +- [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7. + +## \[2.0.0] + +- [`e2c4dfb6`](https://github.com/tauri-apps/plugins-workspace/commit/e2c4dfb6af43e5dd8d9ceba232c315f5febd55c1) Update to tauri v2 stable release. + +## \[2.0.0-rc.2] + +### bug + +- [`1d9741b5`](https://github.com/tauri-apps/plugins-workspace/commit/1d9741b52bb242d32b2ffd46fb4343a501cbd54b) ([#1783](https://github.com/tauri-apps/plugins-workspace/pull/1783) by [@fxsalazar](https://github.com/tauri-apps/plugins-workspace/../../fxsalazar)) fix download content to file when unsuccessful response + +## \[2.0.0-rc.1] + +- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri 2.0.0-rc.8 + +## \[2.0.0-rc.0] + +- [`9887d1`](https://github.com/tauri-apps/plugins-workspace/commit/9887d14bd0e971c4c0f5c1188fc4005d3fc2e29e) Update to tauri RC. + +## \[2.0.0-beta.9] + +- [`99d6ac0f`](https://github.com/tauri-apps/plugins-workspace/commit/99d6ac0f9506a6a4a1aa59c728157190a7441af6) ([#1606](https://github.com/tauri-apps/plugins-workspace/pull/1606) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) The JS packages now specify the *minimum* `@tauri-apps/api` version instead of a single exact version. +- [`6de87966`](https://github.com/tauri-apps/plugins-workspace/commit/6de87966ecc00ad9d91c25be452f1f46bd2b7e1f) ([#1597](https://github.com/tauri-apps/plugins-workspace/pull/1597) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Update to tauri beta.25. + +## \[2.0.0-beta.8] + +- [`22a17980`](https://github.com/tauri-apps/plugins-workspace/commit/22a17980ff4f6f8c40adb1b8f4ffc6dae2fe7e30) ([#1537](https://github.com/tauri-apps/plugins-workspace/pull/1537) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri beta.24. + +## \[2.0.0-beta.7] + +- [`76daee7a`](https://github.com/tauri-apps/plugins-workspace/commit/76daee7aafece34de3092c86e531cf9eb1138989) ([#1512](https://github.com/tauri-apps/plugins-workspace/pull/1512) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Update to tauri beta.23. + +## \[2.0.0-beta.6] + +- [`9013854f`](https://github.com/tauri-apps/plugins-workspace/commit/9013854f42a49a230b9dbb9d02774765528a923f)([#1382](https://github.com/tauri-apps/plugins-workspace/pull/1382)) Update to tauri beta.22. + +## \[2.0.0-beta.5] + +- [`430bd6f4`](https://github.com/tauri-apps/plugins-workspace/commit/430bd6f4f379bee5d232ae6b098ae131db7f178a)([#1363](https://github.com/tauri-apps/plugins-workspace/pull/1363)) Update to tauri beta.20. + +## \[2.0.0-beta.4] + +- [`bd1ed590`](https://github.com/tauri-apps/plugins-workspace/commit/bd1ed5903ffcce5500310dac1e59e8c67674ef1e)([#1237](https://github.com/tauri-apps/plugins-workspace/pull/1237)) Update to tauri beta.17. + +## \[2.0.0-beta.3] + +- [`4a5ab18`](https://github.com/tauri-apps/plugins-workspace/commit/4a5ab18a229b902314f242d656b3a2290a8b9065)([#976](https://github.com/tauri-apps/plugins-workspace/pull/976)) Return the upload response as a string and error out if the status code is not within 200-299. + +## \[2.0.0-beta.3] + +- [`a04ea2f`](https://github.com/tauri-apps/plugins-workspace/commit/a04ea2f38294d5a3987578283badc8eec87a7752)([#1071](https://github.com/tauri-apps/plugins-workspace/pull/1071)) The global API script is now only added to the binary when the `withGlobalTauri` config is true. + +## \[2.0.0-beta.2] + +- [`99bea25`](https://github.com/tauri-apps/plugins-workspace/commit/99bea2559c2c0648c2519c50a18cd124dacef57b)([#1005](https://github.com/tauri-apps/plugins-workspace/pull/1005)) Update to tauri beta.8. + ## \[2.0.0-beta.1] - [`569defb`](https://github.com/tauri-apps/plugins-workspace/commit/569defbe9492e38938554bb7bdc1be9151456d21) Update to tauri beta.4. @@ -35,11 +110,3 @@ ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - te to alpha.11. - -## \[2.0.0-alpha.0] - -- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - 17ae67\`]\(https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - 67\`]\(https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! -717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/upload/Cargo.toml b/plugins/upload/Cargo.toml index 2db3ac15..c95658b5 100644 --- a/plugins/upload/Cargo.toml +++ b/plugins/upload/Cargo.toml @@ -1,19 +1,27 @@ [package] name = "tauri-plugin-upload" -version = "2.0.0-beta.1" +version = "2.2.1" description = "Upload files from disk to a remote server over HTTP." authors = { workspace = true } license = { workspace = true } edition = { workspace = true } rust-version = { workspace = true } +repository = { workspace = true } links = "tauri-plugin-upload" [package.metadata.docs.rs] -rustc-args = [ "--cfg", "docsrs" ] -rustdoc-args = [ "--cfg", "docsrs" ] +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs"] + +[package.metadata.platforms.support] +windows = { level = "full", notes = "" } +linux = { level = "full", notes = "" } +macos = { level = "full", notes = "" } +android = { level = "full", notes = "" } +ios = { level = "full", notes = "" } [build-dependencies] -tauri-plugin = { workspace = true, features = [ "build" ] } +tauri-plugin = { workspace = true, features = ["build"] } [dependencies] serde = { workspace = true } @@ -21,13 +29,22 @@ serde_json = { workspace = true } tauri = { workspace = true } log = { workspace = true } thiserror = { workspace = true } -tokio = { version = "1", features = [ "fs" ] } -tokio-util = { version = "0.7", features = [ "codec" ] } -reqwest = { version = "0.11", default-features = false, features = [ "json", "stream" ] } +tokio = { version = "1", features = ["fs"] } +tokio-util = { version = "0.7", features = ["codec"] } +reqwest = { version = "0.12", default-features = false, features = [ + "macos-system-configuration", + "json", + "stream", +] } futures-util = "0.3" read-progress-stream = "1.0.0" [features] -native-tls = [ "reqwest/native-tls" ] -native-tls-vendored = [ "reqwest/native-tls-vendored" ] -rustls-tls = [ "reqwest/rustls-tls" ] +default = ["rustls-tls"] +native-tls = ["reqwest/native-tls"] +native-tls-vendored = ["reqwest/native-tls-vendored"] +rustls-tls = ["reqwest/rustls-tls"] + +[dev-dependencies] +mockito = "1.6.1" +tokio = { version = "1", features = ["macros"] } diff --git a/plugins/upload/README.md b/plugins/upload/README.md index d0c43078..d6169097 100644 --- a/plugins/upload/README.md +++ b/plugins/upload/README.md @@ -3,9 +3,17 @@ Upload files from disk to a remote server over HTTP. Download files from a remote HTTP server to disk. +| Platform | Supported | +| -------- | --------- | +| Linux | ✓ | +| Windows | ✓ | +| macOS | ✓ | +| Android | ✓ | +| iOS | ✓ | + ## Install -_This plugin requires a Rust version of at least **1.75**_ +_This plugin requires a Rust version of at least **1.77.2**_ There are three general methods of installation that we can recommend. @@ -19,7 +27,7 @@ Install the Core plugin by adding the following to your `Cargo.toml` file: ```toml [dependencies] -tauri-plugin-upload = "2.0.0-beta" +tauri-plugin-upload = "2.0.0" # alternatively with Git: tauri-plugin-upload = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` @@ -47,7 +55,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-upload#v2 First you need to register the core plugin with Tauri: -`src-tauri/src/main.rs` +`src-tauri/src/lib.rs` ```rust fn main() { @@ -61,25 +69,25 @@ fn main() { Afterwards all the plugin's APIs are available through the JavaScript guest bindings: ```javascript -import { upload } from "@tauri-apps/plugin-upload"; +import { upload } from '@tauri-apps/plugin-upload' upload( - "https://example.com/file-upload", - "./path/to/my/file.txt", + 'https://example.com/file-upload', + './path/to/my/file.txt', (progress, total) => console.log(`Uploaded ${progress} of ${total} bytes`), // a callback that will be called with the upload progress - { "Content-Type": "text/plain" }, // optional headers to send with the request -); + { 'Content-Type': 'text/plain' } // optional headers to send with the request +) ``` ```javascript -import { download } from "tauri-plugin-upload-api"; +import { download } from '@tauri-apps/plugin-upload' download( - "https://example.com/file-download-link", - "./path/to/save/my/file.txt", + 'https://example.com/file-download-link', + './path/to/save/my/file.txt', (progress, total) => console.log(`Downloaded ${progress} of ${total} bytes`), // a callback that will be called with the download progress - { "Content-Type": "text/plain" }, // optional headers to send with the request -); + { 'Content-Type': 'text/plain' } // optional headers to send with the request +) ``` ## Contributing diff --git a/plugins/upload/SECURITY.md b/plugins/upload/SECURITY.md new file mode 100644 index 00000000..4f09bbac --- /dev/null +++ b/plugins/upload/SECURITY.md @@ -0,0 +1,23 @@ +# Security Policy + +**Do not report security vulnerabilities through public GitHub issues.** + +**Please use the [Private Vulnerability Disclosure](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability) feature of GitHub.** + +Include as much of the following information: + +- Type of issue (e.g. improper input parsing, privilege escalation, etc.) +- The location of the affected source code (tag/branch/commit or direct URL) +- Any special configuration required to reproduce the issue +- The distribution affected or used to help us with reproduction of the issue +- Step-by-step instructions to reproduce the issue +- Ideally a reproduction repository +- Impact of the issue, including how an attacker might exploit the issue + +We prefer to receive reports in English. + +## Contact + +Please disclose a vulnerability or security relevant issue here: [https://github.com/tauri-apps/plugins-workspace/security/advisories/new](https://github.com/tauri-apps/plugins-workspace/security/advisories/new). + +Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app). diff --git a/plugins/upload/api-iife.js b/plugins/upload/api-iife.js new file mode 100644 index 00000000..960e2b83 --- /dev/null +++ b/plugins/upload/api-iife.js @@ -0,0 +1 @@ +if("__TAURI__"in window){var __TAURI_PLUGIN_UPLOAD__=function(t){"use strict";function e(t,e,n,s){if("function"==typeof e||!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(t):s?s.value:e.get(t)}function n(t,e,n,s,i){if("function"==typeof e||!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}var s,i,o,a;"function"==typeof SuppressedError&&SuppressedError;const r="__TAURI_TO_IPC_KEY__";class c{constructor(t){s.set(this,void 0),i.set(this,0),o.set(this,[]),a.set(this,void 0),n(this,s,t||(()=>{})),this.id=function(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}((t=>{const r=t.index;if("end"in t)return void(r==e(this,i,"f")?this.cleanupCallback():n(this,a,r));const c=t.message;if(r==e(this,i,"f")){for(e(this,s,"f").call(this,c),n(this,i,e(this,i,"f")+1);e(this,i,"f")in e(this,o,"f");){const t=e(this,o,"f")[e(this,i,"f")];e(this,s,"f").call(this,t),delete e(this,o,"f")[e(this,i,"f")],n(this,i,e(this,i,"f")+1)}e(this,i,"f")===e(this,a,"f")&&this.cleanupCallback()}else e(this,o,"f")[r]=c}))}cleanupCallback(){Reflect.deleteProperty(window,`_${this.id}`)}set onmessage(t){n(this,s,t)}get onmessage(){return e(this,s,"f")}[(s=new WeakMap,i=new WeakMap,o=new WeakMap,a=new WeakMap,r)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[r]()}}async function d(t,e={},n){return window.__TAURI_INTERNALS__.invoke(t,e,n)}return t.download=async function(t,e,n,s,i){const o=new Uint32Array(1);window.crypto.getRandomValues(o);const a=o[0],r=new c;n&&(r.onmessage=n),await d("plugin:upload|download",{id:a,url:t,filePath:e,headers:s??{},onProgress:r,body:i})},t.upload=async function(t,e,n,s){const i=new Uint32Array(1);window.crypto.getRandomValues(i);const o=i[0],a=new c;return n&&(a.onmessage=n),await d("plugin:upload|upload",{id:o,url:t,filePath:e,headers:s??{},onProgress:a})},t}({});Object.defineProperty(window.__TAURI__,"upload",{value:__TAURI_PLUGIN_UPLOAD__})} diff --git a/plugins/upload/build.rs b/plugins/upload/build.rs index bfdf48b9..96b5a90a 100644 --- a/plugins/upload/build.rs +++ b/plugins/upload/build.rs @@ -5,5 +5,7 @@ const COMMANDS: &[&str] = &["download", "upload"]; fn main() { - tauri_plugin::Builder::new(COMMANDS).build(); + tauri_plugin::Builder::new(COMMANDS) + .global_api_script_path("./api-iife.js") + .build(); } diff --git a/plugins/upload/guest-js/index.ts b/plugins/upload/guest-js/index.ts index 02ec75fa..03129db4 100644 --- a/plugins/upload/guest-js/index.ts +++ b/plugins/upload/guest-js/index.ts @@ -2,37 +2,39 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { invoke, Channel } from "@tauri-apps/api/core"; +import { invoke, Channel } from '@tauri-apps/api/core' interface ProgressPayload { - progress: number; - total: number; + progress: number + progressTotal: number + total: number + transferSpeed: number } -type ProgressHandler = (progress: ProgressPayload) => void; +type ProgressHandler = (progress: ProgressPayload) => void async function upload( url: string, filePath: string, progressHandler?: ProgressHandler, - headers?: Map, -): Promise { - const ids = new Uint32Array(1); - window.crypto.getRandomValues(ids); - const id = ids[0]; + headers?: Map +): Promise { + const ids = new Uint32Array(1) + window.crypto.getRandomValues(ids) + const id = ids[0] - const onProgress = new Channel(); - if (progressHandler != null) { - onProgress.onmessage = progressHandler; + const onProgress = new Channel() + if (progressHandler) { + onProgress.onmessage = progressHandler } - await invoke("plugin:upload|upload", { + return await invoke('plugin:upload|upload', { id, url, filePath, headers: headers ?? {}, - onProgress, - }); + onProgress + }) } /// Download file from given url. @@ -44,23 +46,25 @@ async function download( filePath: string, progressHandler?: ProgressHandler, headers?: Map, + body?: string ): Promise { - const ids = new Uint32Array(1); - window.crypto.getRandomValues(ids); - const id = ids[0]; + const ids = new Uint32Array(1) + window.crypto.getRandomValues(ids) + const id = ids[0] - const onProgress = new Channel(); - if (progressHandler != null) { - onProgress.onmessage = progressHandler; + const onProgress = new Channel() + if (progressHandler) { + onProgress.onmessage = progressHandler } - await invoke("plugin:upload|download", { + await invoke('plugin:upload|download', { id, url, filePath, headers: headers ?? {}, onProgress, - }); + body + }) } -export { download, upload }; +export { download, upload } diff --git a/plugins/upload/package.json b/plugins/upload/package.json index 21756994..60fe24d0 100644 --- a/plugins/upload/package.json +++ b/plugins/upload/package.json @@ -1,11 +1,12 @@ { "name": "@tauri-apps/plugin-upload", - "version": "2.0.0-beta.1", + "version": "2.2.1", "description": "Upload files from disk to a remote server over HTTP.", - "license": "MIT or APACHE-2.0", + "license": "MIT OR Apache-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" ], + "repository": "https://github.com/tauri-apps/plugins-workspace", "type": "module", "types": "./dist-js/index.d.ts", "main": "./dist-js/index.cjs", @@ -24,6 +25,6 @@ "LICENSE" ], "dependencies": { - "@tauri-apps/api": "2.0.0-beta.2" + "@tauri-apps/api": "^2.0.0" } } diff --git a/plugins/upload/permissions/autogenerated/reference.md b/plugins/upload/permissions/autogenerated/reference.md index 2e8a4853..698399b8 100644 --- a/plugins/upload/permissions/autogenerated/reference.md +++ b/plugins/upload/permissions/autogenerated/reference.md @@ -1,18 +1,77 @@ -# Permissions +## Default Permission -## allow-download +This permission set configures what kind of +operations are available from the upload plugin. + +#### Granted Permissions + +All operations are enabled by default. + + + +#### This default permission set includes the following: + +- `allow-upload` +- `allow-download` + +## Permission Table + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IdentifierDescription
+ +`upload:allow-download` + + Enables the download command without any pre-configured scope. -## deny-download +
+ +`upload:deny-download` + + Denies the download command without any pre-configured scope. -## allow-upload +
+ +`upload:allow-upload` + + Enables the upload command without any pre-configured scope. -## deny-upload +
+ +`upload:deny-upload` + + Denies the upload command without any pre-configured scope. +
diff --git a/plugins/upload/permissions/default.toml b/plugins/upload/permissions/default.toml new file mode 100644 index 00000000..74a2eb9f --- /dev/null +++ b/plugins/upload/permissions/default.toml @@ -0,0 +1,13 @@ +"$schema" = "schemas/schema.json" + +[default] +description = """ +This permission set configures what kind of +operations are available from the upload plugin. + +#### Granted Permissions + +All operations are enabled by default. + +""" +permissions = ["allow-upload", "allow-download"] diff --git a/plugins/upload/permissions/schemas/schema.json b/plugins/upload/permissions/schemas/schema.json index bb0afc88..8b524649 100644 --- a/plugins/upload/permissions/schemas/schema.json +++ b/plugins/upload/permissions/schemas/schema.json @@ -17,7 +17,6 @@ }, "set": { "description": "A list of permissions sets defined", - "default": [], "type": "array", "items": { "$ref": "#/definitions/PermissionSet" @@ -50,7 +49,7 @@ "minimum": 1.0 }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -112,7 +111,7 @@ "type": "string" }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri internal convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -132,12 +131,21 @@ }, "scope": { "description": "Allowed or denied scoped when using this permission.", - "default": {}, "allOf": [ { "$ref": "#/definitions/Scopes" } ] + }, + "platforms": { + "description": "Target platforms this permission applies. By default all platforms are affected by this permission.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Target" + } } } }, @@ -164,7 +172,7 @@ } }, "Scopes": { - "description": "A restriction of the command/endpoint functionality.\n\nIt can be of any serde serializable type and is used for allowing or preventing certain actions inside a Tauri command.\n\nThe scope is passed to the command and handled/enforced by the command itself.", + "description": "An argument for fine grained behavior control of Tauri commands.\n\nIt can be of any serde serializable type and is used to allow or prevent certain actions inside a Tauri command. The configured scope is passed to the command and will be enforced by the command implementation.\n\n## Example\n\n```json { \"allow\": [{ \"path\": \"$HOME/**\" }], \"deny\": [{ \"path\": \"$HOME/secret.txt\" }] } ```", "type": "object", "properties": { "allow": { @@ -178,7 +186,7 @@ } }, "deny": { - "description": "Data that defines what is denied by the scope.", + "description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.", "type": [ "array", "null" @@ -243,36 +251,78 @@ } ] }, - "PermissionKind": { - "type": "string", + "Target": { + "description": "Platform target.", "oneOf": [ { - "description": "allow-download -> Enables the download command without any pre-configured scope.", + "description": "MacOS.", "type": "string", "enum": [ - "allow-download" + "macOS" ] }, { - "description": "deny-download -> Denies the download command without any pre-configured scope.", + "description": "Windows.", "type": "string", "enum": [ - "deny-download" + "windows" ] }, { - "description": "allow-upload -> Enables the upload command without any pre-configured scope.", + "description": "Linux.", "type": "string", "enum": [ - "allow-upload" + "linux" ] }, { - "description": "deny-upload -> Denies the upload command without any pre-configured scope.", + "description": "Android.", "type": "string", "enum": [ - "deny-upload" + "android" ] + }, + { + "description": "iOS.", + "type": "string", + "enum": [ + "iOS" + ] + } + ] + }, + "PermissionKind": { + "type": "string", + "oneOf": [ + { + "description": "Enables the download command without any pre-configured scope.", + "type": "string", + "const": "allow-download", + "markdownDescription": "Enables the download command without any pre-configured scope." + }, + { + "description": "Denies the download command without any pre-configured scope.", + "type": "string", + "const": "deny-download", + "markdownDescription": "Denies the download command without any pre-configured scope." + }, + { + "description": "Enables the upload command without any pre-configured scope.", + "type": "string", + "const": "allow-upload", + "markdownDescription": "Enables the upload command without any pre-configured scope." + }, + { + "description": "Denies the upload command without any pre-configured scope.", + "type": "string", + "const": "deny-upload", + "markdownDescription": "Denies the upload command without any pre-configured scope." + }, + { + "description": "This permission set configures what kind of\noperations are available from the upload plugin.\n\n#### Granted Permissions\n\nAll operations are enabled by default.\n\n\n#### This default permission set includes:\n\n- `allow-upload`\n- `allow-download`", + "type": "string", + "const": "default", + "markdownDescription": "This permission set configures what kind of\noperations are available from the upload plugin.\n\n#### Granted Permissions\n\nAll operations are enabled by default.\n\n\n#### This default permission set includes:\n\n- `allow-upload`\n- `allow-download`" } ] } diff --git a/plugins/upload/rollup.config.js b/plugins/upload/rollup.config.js index 977dfac8..1f349ec8 100644 --- a/plugins/upload/rollup.config.js +++ b/plugins/upload/rollup.config.js @@ -2,6 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { createConfig } from "../../shared/rollup.config.js"; +import { createConfig } from '../../shared/rollup.config.js' -export default createConfig(); +export default createConfig() diff --git a/plugins/upload/src/api-iife.js b/plugins/upload/src/api-iife.js deleted file mode 100644 index d81c4d17..00000000 --- a/plugins/upload/src/api-iife.js +++ /dev/null @@ -1 +0,0 @@ -if("__TAURI__"in window){var __TAURI_PLUGIN_UPLOAD__=function(e){"use strict";function t(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}var n;"function"==typeof SuppressedError&&SuppressedError;class r{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,n.set(this,(()=>{})),this.id=function(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}((e=>{t(this,n,"f").call(this,e)}))}set onmessage(e){!function(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===r?o.call(e,n):o?o.value=n:t.set(e,n)}(this,n,e,"f")}get onmessage(){return t(this,n,"f")}toJSON(){return`__CHANNEL__:${this.id}`}}async function o(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}return n=new WeakMap,e.download=async function(e,t,n,a){const i=new Uint32Array(1);window.crypto.getRandomValues(i);const s=i[0],_=new r;null!=n&&(_.onmessage=n),await o("plugin:upload|download",{id:s,url:e,filePath:t,headers:a??{},onProgress:_})},e.upload=async function(e,t,n,a){const i=new Uint32Array(1);window.crypto.getRandomValues(i);const s=i[0],_=new r;null!=n&&(_.onmessage=n),await o("plugin:upload|upload",{id:s,url:e,filePath:t,headers:a??{},onProgress:_})},e}({});Object.defineProperty(window.__TAURI__,"upload",{value:__TAURI_PLUGIN_UPLOAD__})} diff --git a/plugins/upload/src/lib.rs b/plugins/upload/src/lib.rs index 12106d80..23c33b11 100644 --- a/plugins/upload/src/lib.rs +++ b/plugins/upload/src/lib.rs @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -//! [![](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/upload/banner.png)](https://github.com/tauri-apps/plugins-workspace/tree/v2/plugins/upload) -//! //! Upload files from disk to a remote server over HTTP. //! //! Download files from a remote HTTP server to disk. @@ -13,6 +11,9 @@ html_favicon_url = "https://github.com/tauri-apps/tauri/raw/dev/app-icon.png" )] +mod transfer_stats; +use transfer_stats::TransferStats; + use futures_util::TryStreamExt; use serde::{ser::Serializer, Serialize}; use tauri::{ @@ -41,6 +42,8 @@ pub enum Error { Request(#[from] reqwest::Error), #[error("{0}")] ContentLength(String), + #[error("request failed with status code {0}: {1}")] + HttpErrorCode(u16, String), } impl Serialize for Error { @@ -53,9 +56,12 @@ impl Serialize for Error { } #[derive(Clone, Serialize)] +#[serde(rename_all = "camelCase")] struct ProgressPayload { progress: u64, + progress_total: u64, total: u64, + transfer_speed: u64, } #[command] @@ -63,11 +69,15 @@ async fn download( url: &str, file_path: &str, headers: HashMap, - on_progress: Channel, + body: Option, + on_progress: Channel, ) -> Result<()> { let client = reqwest::Client::new(); - - let mut request = client.get(url); + let mut request = if let Some(body) = body { + client.post(url).body(body) + } else { + client.get(url) + }; // Loop trought the headers keys and values // and add them to the request object. for (key, value) in headers { @@ -75,16 +85,26 @@ async fn download( } let response = request.send().await?; + if !response.status().is_success() { + return Err(Error::HttpErrorCode( + response.status().as_u16(), + response.text().await.unwrap_or_default(), + )); + } let total = response.content_length().unwrap_or(0); let mut file = BufWriter::new(File::create(file_path).await?); let mut stream = response.bytes_stream(); + let mut stats = TransferStats::default(); while let Some(chunk) = stream.try_next().await? { file.write_all(&chunk).await?; - let _ = on_progress.send(&ProgressPayload { + stats.record_chunk_transfer(chunk.len()); + let _ = on_progress.send(ProgressPayload { progress: chunk.len() as u64, + progress_total: stats.total_transferred, total, + transfer_speed: stats.transfer_speed, }); } file.flush().await?; @@ -97,40 +117,117 @@ async fn upload( url: &str, file_path: &str, headers: HashMap, - on_progress: Channel, -) -> Result { + on_progress: Channel, +) -> Result { // Read the file let file = File::open(file_path).await?; + let file_len = file.metadata().await.unwrap().len(); // Create the request and attach the file to the body let client = reqwest::Client::new(); - let mut request = client.post(url).body(file_to_body(on_progress, file)); + let mut request = client + .post(url) + .header(reqwest::header::CONTENT_LENGTH, file_len) + .body(file_to_body(on_progress, file)); - // Loop trought the headers keys and values + // Loop through the headers keys and values // and add them to the request object. for (key, value) in headers { request = request.header(&key, value); } let response = request.send().await?; - - response.json().await.map_err(Into::into) + if response.status().is_success() { + response.text().await.map_err(Into::into) + } else { + Err(Error::HttpErrorCode( + response.status().as_u16(), + response.text().await.unwrap_or_default(), + )) + } } -fn file_to_body(channel: Channel, file: File) -> reqwest::Body { +fn file_to_body(channel: Channel, file: File) -> reqwest::Body { let stream = FramedRead::new(file, BytesCodec::new()).map_ok(|r| r.freeze()); + let mut stats = TransferStats::default(); reqwest::Body::wrap_stream(ReadProgressStream::new( stream, Box::new(move |progress, total| { - let _ = channel.send(ProgressPayload { progress, total }); + stats.record_chunk_transfer(progress as usize); + let _ = channel.send(ProgressPayload { + progress, + progress_total: stats.total_transferred, + total, + transfer_speed: stats.transfer_speed, + }); }), )) } pub fn init() -> TauriPlugin { PluginBuilder::new("upload") - .js_init_script(include_str!("api-iife.js").to_string()) .invoke_handler(tauri::generate_handler![download, upload]) .build() } + +#[cfg(test)] +mod tests { + use super::*; + use mockito::{self, Mock, Server, ServerGuard}; + use tauri::ipc::InvokeResponseBody; + struct MockedServer { + _server: ServerGuard, + url: String, + mocked_endpoint: Mock, + } + + #[tokio::test] + async fn should_error_if_status_not_success() { + let mocked_server = spawn_server_mocked(400).await; + let result = download_file(&mocked_server.url).await; + mocked_server.mocked_endpoint.assert(); + assert!(result.is_err()); + } + + #[tokio::test] + async fn should_download_file_successfully() { + let mocked_server = spawn_server_mocked(200).await; + let result = download_file(&mocked_server.url).await; + mocked_server.mocked_endpoint.assert(); + assert!( + result.is_ok(), + "failed to download file: {}", + result.unwrap_err() + ); + } + + async fn download_file(url: &str) -> Result<()> { + let file_path = concat!(env!("CARGO_MANIFEST_DIR"), "/test/test.txt"); + let headers = HashMap::new(); + let sender: Channel = + Channel::new(|msg: InvokeResponseBody| -> tauri::Result<()> { + let _ = msg; + Ok(()) + }); + download(url, file_path, headers, None, sender).await + } + + async fn spawn_server_mocked(return_status: usize) -> MockedServer { + let mut _server = Server::new_async().await; + let path = "/mock_test"; + let mock = _server + .mock("GET", path) + .with_status(return_status) + .with_body("mocked response body") + .create_async() + .await; + + let url = _server.url() + path; + MockedServer { + _server, + url, + mocked_endpoint: mock, + } + } +} diff --git a/plugins/upload/src/transfer_stats.rs b/plugins/upload/src/transfer_stats.rs new file mode 100644 index 00000000..2f3a3946 --- /dev/null +++ b/plugins/upload/src/transfer_stats.rs @@ -0,0 +1,55 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use std::time::Instant; + +// The TransferStats struct tracks both transfer speed and cumulative transfer progress. +pub struct TransferStats { + accumulated_chunk_len: usize, // Total length of chunks transferred in the current period + accumulated_time: u128, // Total time taken for the transfers in the current period + pub transfer_speed: u64, // Calculated transfer speed in bytes per second + pub total_transferred: u64, // Cumulative total of all transferred data + start_time: Instant, // Time when the current period started + granularity: u32, // Time period (in milliseconds) over which the transfer speed is calculated +} + +impl TransferStats { + // Initializes a new TransferStats instance with the specified granularity. + pub fn start(granularity: u32) -> Self { + Self { + accumulated_chunk_len: 0, + accumulated_time: 0, + transfer_speed: 0, + total_transferred: 0, + start_time: Instant::now(), + granularity, + } + } + // Records the transfer of a data chunk and updates both transfer speed and total progress. + pub fn record_chunk_transfer(&mut self, chunk_len: usize) { + let now = Instant::now(); + let it_took = now.duration_since(self.start_time).as_millis(); + self.accumulated_chunk_len += chunk_len; + self.total_transferred += chunk_len as u64; + self.accumulated_time += it_took; + + // Calculate transfer speed if accumulated time exceeds granularity. + if self.accumulated_time >= self.granularity as u128 { + self.transfer_speed = + (self.accumulated_chunk_len as u128 / self.accumulated_time * 1024) as u64; + self.accumulated_chunk_len = 0; + self.accumulated_time = 0; + } + + // Reset the start time for the next period. + self.start_time = now; + } +} + +// Provides a default implementation for TransferStats with a granularity of 500 milliseconds. +impl Default for TransferStats { + fn default() -> Self { + Self::start(500) // Default granularity is 500 ms + } +} diff --git a/plugins/upload/test/test.txt b/plugins/upload/test/test.txt new file mode 100644 index 00000000..629b997b --- /dev/null +++ b/plugins/upload/test/test.txt @@ -0,0 +1 @@ +mocked response body \ No newline at end of file diff --git a/plugins/websocket/.gitignore b/plugins/websocket/.gitignore deleted file mode 100644 index 3c3629e6..00000000 --- a/plugins/websocket/.gitignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/plugins/websocket/CHANGELOG.md b/plugins/websocket/CHANGELOG.md index f8865a01..905fa644 100644 --- a/plugins/websocket/CHANGELOG.md +++ b/plugins/websocket/CHANGELOG.md @@ -1,5 +1,71 @@ # Changelog +## \[2.3.0] + +- [`78acfa45`](https://github.com/tauri-apps/plugins-workspace/commit/78acfa456f343c0af5fbf35660802d14ff7a5eca) ([#2027](https://github.com/tauri-apps/plugins-workspace/pull/2027) by [@twlite](https://github.com/tauri-apps/plugins-workspace/../../twlite)) `addListener` now returns a cleanup function instead of `void` to remove the listener. + +## \[2.2.1] + +- [`05cca602`](https://github.com/tauri-apps/plugins-workspace/commit/05cca602d927c30014d3892438ca28d99bc4e1d3) ([#2210](https://github.com/tauri-apps/plugins-workspace/pull/2210) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) **Breaking change:** Updated tokio_tungstenite to `0.26`. This may be a breaking change if you use the `tls_connector` Builder method in Rust. + **Breaking change:** Removed the accidental `ConnectionConfig` struct re-export (in rust). This should not affect anyone since the Config was not used in any public API. + +## \[2.2.0] + +- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other. + +## \[2.0.1] + +- [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7. + +## \[2.0.0] + +- [`e2c4dfb6`](https://github.com/tauri-apps/plugins-workspace/commit/e2c4dfb6af43e5dd8d9ceba232c315f5febd55c1) Update to tauri v2 stable release. + +## \[2.0.0-rc.1] + +- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri 2.0.0-rc.8 + +## \[2.0.0-rc.0] + +- [`9887d1`](https://github.com/tauri-apps/plugins-workspace/commit/9887d14bd0e971c4c0f5c1188fc4005d3fc2e29e) Update to tauri RC. + +## \[2.0.0-beta.8] + +- [`99d6ac0f`](https://github.com/tauri-apps/plugins-workspace/commit/99d6ac0f9506a6a4a1aa59c728157190a7441af6) ([#1606](https://github.com/tauri-apps/plugins-workspace/pull/1606) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) The JS packages now specify the *minimum* `@tauri-apps/api` version instead of a single exact version. +- [`6de87966`](https://github.com/tauri-apps/plugins-workspace/commit/6de87966ecc00ad9d91c25be452f1f46bd2b7e1f) ([#1597](https://github.com/tauri-apps/plugins-workspace/pull/1597) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Update to tauri beta.25. + +## \[2.0.0-beta.7] + +- [`22a17980`](https://github.com/tauri-apps/plugins-workspace/commit/22a17980ff4f6f8c40adb1b8f4ffc6dae2fe7e30) ([#1537](https://github.com/tauri-apps/plugins-workspace/pull/1537) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri beta.24. + +## \[2.0.0-beta.6] + +- [`76daee7a`](https://github.com/tauri-apps/plugins-workspace/commit/76daee7aafece34de3092c86e531cf9eb1138989) ([#1512](https://github.com/tauri-apps/plugins-workspace/pull/1512) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Update to tauri beta.23. + +## \[2.0.0-beta.5] + +- [`9013854f`](https://github.com/tauri-apps/plugins-workspace/commit/9013854f42a49a230b9dbb9d02774765528a923f)([#1382](https://github.com/tauri-apps/plugins-workspace/pull/1382)) Update to tauri beta.22. + +## \[2.0.0-beta.4] + +- [`430bd6f4`](https://github.com/tauri-apps/plugins-workspace/commit/430bd6f4f379bee5d232ae6b098ae131db7f178a)([#1363](https://github.com/tauri-apps/plugins-workspace/pull/1363)) Update to tauri beta.20. + +## \[2.0.0-beta.3] + +- [`bd1ed590`](https://github.com/tauri-apps/plugins-workspace/commit/bd1ed5903ffcce5500310dac1e59e8c67674ef1e)([#1237](https://github.com/tauri-apps/plugins-workspace/pull/1237)) Update to tauri beta.17. + +## \[2.0.0-beta.4] + +- [`ed46dca`](https://github.com/tauri-apps/plugins-workspace/commit/ed46dca74ff3947dbbcb26a7b571c129bf925698) **Breaking change:** Enable rustls by default and added a method to configure the TLS Connector for tungstenite. + +## \[2.0.0-beta.3] + +- [`a04ea2f`](https://github.com/tauri-apps/plugins-workspace/commit/a04ea2f38294d5a3987578283badc8eec87a7752)([#1071](https://github.com/tauri-apps/plugins-workspace/pull/1071)) The global API script is now only added to the binary when the `withGlobalTauri` config is true. + +## \[2.0.0-beta.2] + +- [`99bea25`](https://github.com/tauri-apps/plugins-workspace/commit/99bea2559c2c0648c2519c50a18cd124dacef57b)([#1005](https://github.com/tauri-apps/plugins-workspace/pull/1005)) Update to tauri beta.8. + ## \[2.0.0-beta.1] - [`569defb`](https://github.com/tauri-apps/plugins-workspace/commit/569defbe9492e38938554bb7bdc1be9151456d21) Update to tauri beta.4. @@ -36,15 +102,3 @@ ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - te to alpha.11. - -## \[2.0.0-alpha.0] - -- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - ha.11. - -## \[2.0.0-alpha.0] - -- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - ae67\`]\(https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! -717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! diff --git a/plugins/websocket/Cargo.toml b/plugins/websocket/Cargo.toml index ab3beff2..34130573 100644 --- a/plugins/websocket/Cargo.toml +++ b/plugins/websocket/Cargo.toml @@ -1,20 +1,28 @@ [package] name = "tauri-plugin-websocket" -version = "2.0.0-beta.1" +version = "2.3.0" description = "Expose a WebSocket server to your Tauri frontend." authors = { workspace = true } license = { workspace = true } edition = { workspace = true } rust-version = { workspace = true } +repository = { workspace = true } links = "tauri-plugin-websocket" -exclude = [ "/examples" ] +exclude = ["/examples"] [package.metadata.docs.rs] -rustc-args = [ "--cfg", "docsrs" ] -rustdoc-args = [ "--cfg", "docsrs" ] +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs"] + +[package.metadata.platforms.support] +windows = { level = "full", notes = "" } +linux = { level = "full", notes = "" } +macos = { level = "full", notes = "" } +android = { level = "full", notes = "" } +ios = { level = "full", notes = "" } [build-dependencies] -tauri-plugin = { workspace = true, features = [ "build" ] } +tauri-plugin = { workspace = true, features = ["build"] } [dependencies] serde = { workspace = true } @@ -25,10 +33,12 @@ thiserror = { workspace = true } http = "1" rand = "0.8" futures-util = "0.3" -tokio = { version = "1", features = [ "net", "sync" ] } -tokio-tungstenite = { version = "0.21" } +tokio = { version = "1", features = ["net", "sync"] } +tokio-tungstenite = { version = "0.26" } [features] -native-tls = [ "tokio-tungstenite/native-tls" ] -native-tls-vendored = [ "tokio-tungstenite/native-tls-vendored" ] -rustls-tls-webpki-roots = [ "tokio-tungstenite/rustls-tls-webpki-roots" ] +default = ["rustls-tls"] +native-tls = ["tokio-tungstenite/native-tls"] +native-tls-vendored = ["native-tls", "tokio-tungstenite/native-tls-vendored"] +rustls-tls = ["tokio-tungstenite/rustls-tls-webpki-roots"] +rustls-tls-native-roots = ["tokio-tungstenite/rustls-tls-native-roots"] diff --git a/plugins/websocket/README.md b/plugins/websocket/README.md index 650ffcf1..ec5fce9b 100644 --- a/plugins/websocket/README.md +++ b/plugins/websocket/README.md @@ -1,10 +1,18 @@ ![plugin-websocket](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/websocket/banner.png) -Expose a WebSocket server to your Tauri frontend. +Open a WebSocket connection using a Rust client in JS. + +| Platform | Supported | +| -------- | --------- | +| Linux | ✓ | +| Windows | ✓ | +| macOS | ✓ | +| Android | ✓ | +| iOS | ✓ | ## Install -_This plugin requires a Rust version of at least **1.75**_ +_This plugin requires a Rust version of at least **1.77.2**_ There are three general methods of installation that we can recommend. @@ -18,7 +26,7 @@ Install the Core plugin by adding the following to your `Cargo.toml` file: ```toml [dependencies] -tauri-plugin-websocket = "2.0.0-beta" +tauri-plugin-websocket = "2.0.0" # alternatively with Git: tauri-plugin-websocket = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` @@ -46,7 +54,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-websocket#v2 First you need to register the core plugin with Tauri: -`src-tauri/src/main.rs` +`src-tauri/src/lib.rs` ```rust fn main() { @@ -60,13 +68,13 @@ fn main() { Afterwards all the plugin's APIs are available through the JavaScript guest bindings: ```javascript -import WebSocket from "@tauri-apps/plugin-websocket"; +import WebSocket from '@tauri-apps/plugin-websocket' -const ws = await WebSocket.connect("wss://example.com"); +const ws = await WebSocket.connect('wss://example.com') -await ws.send("Hello World"); +await ws.send('Hello World') -await ws.disconnect(); +await ws.disconnect() ``` ## Contributing diff --git a/plugins/websocket/SECURITY.md b/plugins/websocket/SECURITY.md new file mode 100644 index 00000000..4f09bbac --- /dev/null +++ b/plugins/websocket/SECURITY.md @@ -0,0 +1,23 @@ +# Security Policy + +**Do not report security vulnerabilities through public GitHub issues.** + +**Please use the [Private Vulnerability Disclosure](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability) feature of GitHub.** + +Include as much of the following information: + +- Type of issue (e.g. improper input parsing, privilege escalation, etc.) +- The location of the affected source code (tag/branch/commit or direct URL) +- Any special configuration required to reproduce the issue +- The distribution affected or used to help us with reproduction of the issue +- Step-by-step instructions to reproduce the issue +- Ideally a reproduction repository +- Impact of the issue, including how an attacker might exploit the issue + +We prefer to receive reports in English. + +## Contact + +Please disclose a vulnerability or security relevant issue here: [https://github.com/tauri-apps/plugins-workspace/security/advisories/new](https://github.com/tauri-apps/plugins-workspace/security/advisories/new). + +Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app). diff --git a/plugins/websocket/api-iife.js b/plugins/websocket/api-iife.js new file mode 100644 index 00000000..bcb71df0 --- /dev/null +++ b/plugins/websocket/api-iife.js @@ -0,0 +1 @@ +if("__TAURI__"in window){var __TAURI_PLUGIN_WEBSOCKET__=function(){"use strict";function e(e,t,s,i){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?i:"a"===s?i.call(e):i?i.value:t.get(e)}function t(e,t,s,i,n){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,s),s}var s,i,n,r;"function"==typeof SuppressedError&&SuppressedError;const a="__TAURI_TO_IPC_KEY__";class o{constructor(a){s.set(this,void 0),i.set(this,0),n.set(this,[]),r.set(this,void 0),t(this,s,a||(()=>{})),this.id=function(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}((a=>{const o=a.index;if("end"in a)return void(o==e(this,i,"f")?this.cleanupCallback():t(this,r,o));const c=a.message;if(o==e(this,i,"f")){for(e(this,s,"f").call(this,c),t(this,i,e(this,i,"f")+1);e(this,i,"f")in e(this,n,"f");){const r=e(this,n,"f")[e(this,i,"f")];e(this,s,"f").call(this,r),delete e(this,n,"f")[e(this,i,"f")],t(this,i,e(this,i,"f")+1)}e(this,i,"f")===e(this,r,"f")&&this.cleanupCallback()}else e(this,n,"f")[o]=c}))}cleanupCallback(){Reflect.deleteProperty(window,`_${this.id}`)}set onmessage(e){t(this,s,e)}get onmessage(){return e(this,s,"f")}[(s=new WeakMap,i=new WeakMap,n=new WeakMap,r=new WeakMap,a)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[a]()}}async function c(e,t={},s){return window.__TAURI_INTERNALS__.invoke(e,t,s)}class h{constructor(e,t){this.id=e,this.listeners=t}static async connect(e,t){const s=new Set,i=new o;return i.onmessage=e=>{s.forEach((t=>{t(e)}))},t?.headers&&(t.headers=Array.from(new Headers(t.headers).entries())),await c("plugin:websocket|connect",{url:e,onMessage:i,config:t}).then((e=>new h(e,s)))}addListener(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}async send(e){let t;if("string"==typeof e)t={type:"Text",data:e};else if("object"==typeof e&&"type"in e)t=e;else{if(!Array.isArray(e))throw new Error("invalid `message` type, expected a `{ type: string, data: any }` object, a string or a numeric array");t={type:"Binary",data:e}}await c("plugin:websocket|send",{id:this.id,message:t})}async disconnect(){await this.send({type:"Close",data:{code:1e3,reason:"Disconnected by client"}})}}return h}();Object.defineProperty(window.__TAURI__,"websocket",{value:__TAURI_PLUGIN_WEBSOCKET__})} diff --git a/plugins/websocket/build.rs b/plugins/websocket/build.rs index b7bf848c..deadb78f 100644 --- a/plugins/websocket/build.rs +++ b/plugins/websocket/build.rs @@ -5,5 +5,7 @@ const COMMANDS: &[&str] = &["connect", "send"]; fn main() { - tauri_plugin::Builder::new(COMMANDS).build(); + tauri_plugin::Builder::new(COMMANDS) + .global_api_script_path("./api-iife.js") + .build(); } diff --git a/plugins/websocket/examples/tauri-app/package.json b/plugins/websocket/examples/tauri-app/package.json index dc916a38..afa67edf 100644 --- a/plugins/websocket/examples/tauri-app/package.json +++ b/plugins/websocket/examples/tauri-app/package.json @@ -9,9 +9,9 @@ "preview": "vite preview" }, "devDependencies": { - "@tauri-apps/cli": "2.0.0-beta.3", - "typescript": "^5.3.3", - "vite": "^5.0.12" + "@tauri-apps/cli": "2.5.0", + "typescript": "^5.7.3", + "vite": "^6.2.6" }, "dependencies": { "tauri-plugin-websocket-api": "link:..\\.." diff --git a/plugins/websocket/examples/tauri-app/src-tauri/Cargo.toml b/plugins/websocket/examples/tauri-app/src-tauri/Cargo.toml index fb3b862c..3b56008f 100644 --- a/plugins/websocket/examples/tauri-app/src-tauri/Cargo.toml +++ b/plugins/websocket/examples/tauri-app/src-tauri/Cargo.toml @@ -7,14 +7,14 @@ edition = "2021" [dependencies] serde = { workspace = true } serde_json = { workspace = true } -tauri = { workspace = true } +tauri = { workspace = true, features = ["wry", "compression"] } tokio = { version = "1", features = ["net"] } futures-util = "0.3" tauri-plugin-websocket = { path = "../../../" } -tokio-tungstenite = "0.21" +tokio-tungstenite = "0.26" [build-dependencies] tauri-build = { workspace = true } [features] -custom-protocol = [ "tauri/custom-protocol" ] +prod = ["tauri/custom-protocol"] diff --git a/plugins/websocket/examples/tauri-app/src-tauri/tauri.conf.json b/plugins/websocket/examples/tauri-app/src-tauri/tauri.conf.json index c4fe3f7f..6647b5e6 100644 --- a/plugins/websocket/examples/tauri-app/src-tauri/tauri.conf.json +++ b/plugins/websocket/examples/tauri-app/src-tauri/tauri.conf.json @@ -2,7 +2,7 @@ "identifier": "com.tauri.dev", "build": { "devUrl": "http://localhost:5173/", - "frontendDist": "../build", + "frontendDist": "../dist", "beforeDevCommand": "pnpm dev", "beforeBuildCommand": "pnpm build" }, diff --git a/plugins/websocket/examples/tauri-app/src/main.ts b/plugins/websocket/examples/tauri-app/src/main.ts index 731fd60d..05fecfe8 100644 --- a/plugins/websocket/examples/tauri-app/src/main.ts +++ b/plugins/websocket/examples/tauri-app/src/main.ts @@ -2,53 +2,57 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import WebSocket from "tauri-plugin-websocket-api"; -import "./style.css"; +import WebSocket from 'tauri-plugin-websocket-api' +import './style.css' -let ws: WebSocket; +let ws: WebSocket -document.addEventListener("DOMContentLoaded", async () => { - document.querySelector("#send")?.addEventListener("click", send); - document.querySelector("#disconnect")?.addEventListener("click", disconnect); - await connect(); -}); +document.addEventListener('DOMContentLoaded', async () => { + document.querySelector('#send')?.addEventListener('click', send) + document.querySelector('#disconnect')?.addEventListener('click', disconnect) + await connect() +}) function _updateResponse(returnValue: unknown) { - const msg = document.createElement("p"); + const msg = document.createElement('p') msg.textContent = - typeof returnValue === "string" ? returnValue : JSON.stringify(returnValue); - document.querySelector("#response-container")?.appendChild(msg); + typeof returnValue === 'string' ? returnValue : JSON.stringify(returnValue) + document.querySelector('#response-container')?.appendChild(msg) } async function connect() { try { - ws = await WebSocket.connect("ws://127.0.0.1:8080").then((r) => { - _updateResponse("Connected"); - return r; - }); + ws = await WebSocket.connect('ws://127.0.0.1:8080').then((r) => { + _updateResponse('Connected') + return r + }) } catch (e) { - _updateResponse(e); + _updateResponse(e) } - ws.addListener(_updateResponse); + ws.addListener(_updateResponse) } function send() { - ws.send(document.querySelector("#msg-input")?.textContent || "") - .then(() => _updateResponse("Message sent")) - .catch(_updateResponse); + ws.send(document.querySelector('#msg-input')?.textContent || '') + .then(() => { + _updateResponse('Message sent') + }) + .catch(_updateResponse) } function disconnect() { ws.disconnect() - .then(() => _updateResponse("Disconnected")) - .catch(_updateResponse); + .then(() => { + _updateResponse('Disconnected') + }) + .catch(_updateResponse) } -document.querySelector("#app")!.innerHTML = ` +document.querySelector('#app')!.innerHTML = `
-`; +` diff --git a/plugins/websocket/examples/tauri-app/src/style.css b/plugins/websocket/examples/tauri-app/src/style.css index 21d7637f..04e208d3 100644 --- a/plugins/websocket/examples/tauri-app/src/style.css +++ b/plugins/websocket/examples/tauri-app/src/style.css @@ -10,8 +10,9 @@ body { margin: 0; padding: 8px; box-sizing: border-box; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, - Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; + font-family: + -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, + Cantarell, 'Helvetica Neue', sans-serif; } a { diff --git a/plugins/websocket/guest-js/index.ts b/plugins/websocket/guest-js/index.ts index 5f5e2461..7ea7b326 100644 --- a/plugins/websocket/guest-js/index.ts +++ b/plugins/websocket/guest-js/index.ts @@ -2,95 +2,127 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { invoke, Channel } from "@tauri-apps/api/core"; +import { invoke, Channel } from '@tauri-apps/api/core' export interface ConnectionConfig { - writeBufferSize?: number; - maxWriteBufferSize?: number; - maxMessageSize?: number; - maxFrameSize?: number; - acceptUnmaskedFrames?: boolean; - headers?: HeadersInit; + /** + * Read buffer capacity. The default value is 128 KiB. + */ + readBufferSize?: number + /** The target minimum size of the write buffer to reach before writing the data to the underlying stream. The default value is 128 KiB. + * + * If set to 0 each message will be eagerly written to the underlying stream. It is often more optimal to allow them to buffer a little, hence the default value. + */ + writeBufferSize?: number + /** The max size of the write buffer in bytes. Setting this can provide backpressure in the case the write buffer is filling up due to write errors. The default value is unlimited. + * + * Note: The write buffer only builds up past write_buffer_size when writes to the underlying stream are failing. So the write buffer can not fill up if you are not observing write errors. + * + * Note: Should always be at least write_buffer_size + 1 message and probably a little more depending on error handling strategy. + */ + maxWriteBufferSize?: number + /** + * The maximum size of an incoming message. The string "none" means no size limit. The default value is 64 MiB which should be reasonably big for all normal use-cases but small enough to prevent memory eating by a malicious user. + */ + maxMessageSize?: number | 'none' + /** + * The maximum size of a single incoming message frame. The string "none" means no size limit. The limit is for frame payload NOT including the frame header. The default value is 16 MiB which should be reasonably big for all normal use-cases but small enough to prevent memory eating by a malicious user. + */ + maxFrameSize?: number | 'none' + /** + * When set to true, the server will accept and handle unmasked frames from the client. According to the RFC 6455, the server must close the connection to the client in such cases, however it seems like there are some popular libraries that are sending unmasked frames, ignoring the RFC. By default this option is set to false, i.e. according to RFC 6455. + */ + acceptUnmaskedFrames?: boolean + /** + * Additional connect request headers. + */ + headers?: HeadersInit } export interface MessageKind { - type: T; - data: D; + type: T + data: D } export interface CloseFrame { - code: number; - reason: string; + code: number + reason: string } export type Message = - | MessageKind<"Text", string> - | MessageKind<"Binary", number[]> - | MessageKind<"Ping", number[]> - | MessageKind<"Pong", number[]> - | MessageKind<"Close", CloseFrame | null>; + | MessageKind<'Text', string> + | MessageKind<'Binary', number[]> + | MessageKind<'Ping', number[]> + | MessageKind<'Pong', number[]> + | MessageKind<'Close', CloseFrame | null> export default class WebSocket { - id: number; - private readonly listeners: Array<(arg: Message) => void>; + id: number + private readonly listeners: Set<(arg: Message) => void> - constructor(id: number, listeners: Array<(arg: Message) => void>) { - this.id = id; - this.listeners = listeners; + constructor(id: number, listeners: Set<(arg: Message) => void>) { + this.id = id + this.listeners = listeners } static async connect( url: string, - config?: ConnectionConfig, + config?: ConnectionConfig ): Promise { - const listeners: Array<(arg: Message) => void> = []; + const listeners: Set<(arg: Message) => void> = new Set() - const onMessage = new Channel(); + const onMessage = new Channel() onMessage.onmessage = (message: Message): void => { - listeners.forEach((l) => l(message)); - }; + listeners.forEach((l) => { + l(message) + }) + } if (config?.headers) { - config.headers = Array.from(new Headers(config.headers).entries()); + config.headers = Array.from(new Headers(config.headers).entries()) } - return await invoke("plugin:websocket|connect", { + return await invoke('plugin:websocket|connect', { url, onMessage, - config, - }).then((id) => new WebSocket(id, listeners)); + config + }).then((id) => new WebSocket(id, listeners)) } - addListener(cb: (arg: Message) => void): void { - this.listeners.push(cb); + addListener(cb: (arg: Message) => void): () => void { + this.listeners.add(cb) + + return () => { + this.listeners.delete(cb) + } } async send(message: Message | string | number[]): Promise { - let m: Message; - if (typeof message === "string") { - m = { type: "Text", data: message }; - } else if (typeof message === "object" && "type" in message) { - m = message; + let m: Message + if (typeof message === 'string') { + m = { type: 'Text', data: message } + } else if (typeof message === 'object' && 'type' in message) { + m = message } else if (Array.isArray(message)) { - m = { type: "Binary", data: message }; + m = { type: 'Binary', data: message } } else { throw new Error( - "invalid `message` type, expected a `{ type: string, data: any }` object, a string or a numeric array", - ); + 'invalid `message` type, expected a `{ type: string, data: any }` object, a string or a numeric array' + ) } - return await invoke("plugin:websocket|send", { + await invoke('plugin:websocket|send', { id: this.id, - message: m, - }); + message: m + }) } async disconnect(): Promise { - return await this.send({ - type: "Close", + await this.send({ + type: 'Close', data: { code: 1000, - reason: "Disconnected by client", - }, - }); + reason: 'Disconnected by client' + } + }) } } diff --git a/plugins/websocket/package.json b/plugins/websocket/package.json index a2fddbdd..e6496faa 100644 --- a/plugins/websocket/package.json +++ b/plugins/websocket/package.json @@ -1,10 +1,11 @@ { "name": "@tauri-apps/plugin-websocket", - "version": "2.0.0-beta.1", - "license": "MIT or APACHE-2.0", + "version": "2.3.0", + "license": "MIT OR Apache-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" ], + "repository": "https://github.com/tauri-apps/plugins-workspace", "type": "module", "types": "./dist-js/index.d.ts", "main": "./dist-js/index.cjs", @@ -23,6 +24,6 @@ "LICENSE" ], "dependencies": { - "@tauri-apps/api": "2.0.0-beta.2" + "@tauri-apps/api": "^2.0.0" } } diff --git a/plugins/websocket/permissions/autogenerated/reference.md b/plugins/websocket/permissions/autogenerated/reference.md index 9f66b798..e86cedcb 100644 --- a/plugins/websocket/permissions/autogenerated/reference.md +++ b/plugins/websocket/permissions/autogenerated/reference.md @@ -1,22 +1,70 @@ -# Permissions +## Default Permission -## allow-connect +Allows connecting and sending data to a WebSocket server + +#### This default permission set includes the following: + +- `allow-connect` +- `allow-send` + +## Permission Table + + + + + + + + + + + + + + + + + + + + + + -Denies the send command without any pre-configured scope. + + + + +
IdentifierDescription
+ +`websocket:allow-connect` + + Enables the connect command without any pre-configured scope. -## deny-connect +
+ +`websocket:deny-connect` + + Denies the connect command without any pre-configured scope. -## allow-send +
+ +`websocket:allow-send` + + Enables the send command without any pre-configured scope. -## deny-send +
-## default +`websocket:deny-send` -Allows connecting and sending data to a WebSocket server + + +Denies the send command without any pre-configured scope. +
diff --git a/plugins/websocket/permissions/schemas/schema.json b/plugins/websocket/permissions/schemas/schema.json index 9557d918..e0c9a4af 100644 --- a/plugins/websocket/permissions/schemas/schema.json +++ b/plugins/websocket/permissions/schemas/schema.json @@ -17,7 +17,6 @@ }, "set": { "description": "A list of permissions sets defined", - "default": [], "type": "array", "items": { "$ref": "#/definitions/PermissionSet" @@ -50,7 +49,7 @@ "minimum": 1.0 }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -112,7 +111,7 @@ "type": "string" }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri internal convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -132,12 +131,21 @@ }, "scope": { "description": "Allowed or denied scoped when using this permission.", - "default": {}, "allOf": [ { "$ref": "#/definitions/Scopes" } ] + }, + "platforms": { + "description": "Target platforms this permission applies. By default all platforms are affected by this permission.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Target" + } } } }, @@ -164,7 +172,7 @@ } }, "Scopes": { - "description": "A restriction of the command/endpoint functionality.\n\nIt can be of any serde serializable type and is used for allowing or preventing certain actions inside a Tauri command.\n\nThe scope is passed to the command and handled/enforced by the command itself.", + "description": "An argument for fine grained behavior control of Tauri commands.\n\nIt can be of any serde serializable type and is used to allow or prevent certain actions inside a Tauri command. The configured scope is passed to the command and will be enforced by the command implementation.\n\n## Example\n\n```json { \"allow\": [{ \"path\": \"$HOME/**\" }], \"deny\": [{ \"path\": \"$HOME/secret.txt\" }] } ```", "type": "object", "properties": { "allow": { @@ -178,7 +186,7 @@ } }, "deny": { - "description": "Data that defines what is denied by the scope.", + "description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.", "type": [ "array", "null" @@ -243,45 +251,80 @@ } ] }, - "PermissionKind": { - "type": "string", + "Target": { + "description": "Platform target.", "oneOf": [ { - "description": "allow-connect -> Enables the connect command without any pre-configured scope.", + "description": "MacOS.", "type": "string", "enum": [ - "allow-connect" + "macOS" ] }, { - "description": "deny-connect -> Denies the connect command without any pre-configured scope.", + "description": "Windows.", "type": "string", "enum": [ - "deny-connect" + "windows" ] }, { - "description": "allow-send -> Enables the send command without any pre-configured scope.", + "description": "Linux.", "type": "string", "enum": [ - "allow-send" + "linux" ] }, { - "description": "deny-send -> Denies the send command without any pre-configured scope.", + "description": "Android.", "type": "string", "enum": [ - "deny-send" + "android" ] }, { - "description": "default -> Allows connecting and sending data to a WebSocket server", + "description": "iOS.", "type": "string", "enum": [ - "default" + "iOS" ] } ] + }, + "PermissionKind": { + "type": "string", + "oneOf": [ + { + "description": "Enables the connect command without any pre-configured scope.", + "type": "string", + "const": "allow-connect", + "markdownDescription": "Enables the connect command without any pre-configured scope." + }, + { + "description": "Denies the connect command without any pre-configured scope.", + "type": "string", + "const": "deny-connect", + "markdownDescription": "Denies the connect command without any pre-configured scope." + }, + { + "description": "Enables the send command without any pre-configured scope.", + "type": "string", + "const": "allow-send", + "markdownDescription": "Enables the send command without any pre-configured scope." + }, + { + "description": "Denies the send command without any pre-configured scope.", + "type": "string", + "const": "deny-send", + "markdownDescription": "Denies the send command without any pre-configured scope." + }, + { + "description": "Allows connecting and sending data to a WebSocket server\n#### This default permission set includes:\n\n- `allow-connect`\n- `allow-send`", + "type": "string", + "const": "default", + "markdownDescription": "Allows connecting and sending data to a WebSocket server\n#### This default permission set includes:\n\n- `allow-connect`\n- `allow-send`" + } + ] } } } \ No newline at end of file diff --git a/plugins/websocket/rollup.config.js b/plugins/websocket/rollup.config.js index 977dfac8..1f349ec8 100644 --- a/plugins/websocket/rollup.config.js +++ b/plugins/websocket/rollup.config.js @@ -2,6 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { createConfig } from "../../shared/rollup.config.js"; +import { createConfig } from '../../shared/rollup.config.js' -export default createConfig(); +export default createConfig() diff --git a/plugins/websocket/src/api-iife.js b/plugins/websocket/src/api-iife.js deleted file mode 100644 index 12fc8534..00000000 --- a/plugins/websocket/src/api-iife.js +++ /dev/null @@ -1 +0,0 @@ -if("__TAURI__"in window){var __TAURI_PLUGIN_WEBSOCKET__=function(){"use strict";function e(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}var t;"function"==typeof SuppressedError&&SuppressedError;class r{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,t.set(this,(()=>{})),this.id=function(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}((r=>{e(this,t,"f").call(this,r)}))}set onmessage(e){!function(e,t,r,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?s.call(e,r):s?s.value=r:t.set(e,r)}(this,t,e,"f")}get onmessage(){return e(this,t,"f")}toJSON(){return`__CHANNEL__:${this.id}`}}async function n(e,t={},r){return window.__TAURI_INTERNALS__.invoke(e,t,r)}t=new WeakMap;class s{constructor(e,t){this.id=e,this.listeners=t}static async connect(e,t){const a=[],i=new r;return i.onmessage=e=>{a.forEach((t=>t(e)))},t?.headers&&(t.headers=Array.from(new Headers(t.headers).entries())),await n("plugin:websocket|connect",{url:e,onMessage:i,config:t}).then((e=>new s(e,a)))}addListener(e){this.listeners.push(e)}async send(e){let t;if("string"==typeof e)t={type:"Text",data:e};else if("object"==typeof e&&"type"in e)t=e;else{if(!Array.isArray(e))throw new Error("invalid `message` type, expected a `{ type: string, data: any }` object, a string or a numeric array");t={type:"Binary",data:e}}return await n("plugin:websocket|send",{id:this.id,message:t})}async disconnect(){return await this.send({type:"Close",data:{code:1e3,reason:"Disconnected by client"}})}}return s}();Object.defineProperty(window.__TAURI__,"websocket",{value:__TAURI_PLUGIN_WEBSOCKET__})} diff --git a/plugins/websocket/src/lib.rs b/plugins/websocket/src/lib.rs index f4a95b8e..f75817b6 100644 --- a/plugins/websocket/src/lib.rs +++ b/plugins/websocket/src/lib.rs @@ -2,9 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -//! [![](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/websocket/banner.png)](https://github.com/tauri-apps/plugins-workspace/tree/v2/plugins/websocket) -//! -//! Expose a WebSocket server to your Tauri frontend. +//! Open a WebSocket connection using a Rust client in JS. #![doc( html_logo_url = "https://github.com/tauri-apps/tauri/raw/dev/app-icon.png", @@ -20,14 +18,17 @@ use tauri::{ Manager, Runtime, State, Window, }; use tokio::{net::TcpStream, sync::Mutex}; +#[cfg(any(feature = "rustls-tls", feature = "native-tls"))] +use tokio_tungstenite::connect_async_tls_with_config; +#[cfg(not(any(feature = "rustls-tls", feature = "native-tls")))] +use tokio_tungstenite::connect_async_with_config; use tokio_tungstenite::{ - connect_async_with_config, tungstenite::{ client::IntoClientRequest, protocol::{CloseFrame as ProtocolCloseFrame, WebSocketConfig}, Message, }, - MaybeTlsStream, WebSocketStream, + Connector, MaybeTlsStream, WebSocketStream, }; use std::collections::HashMap; @@ -62,13 +63,24 @@ impl Serialize for Error { #[derive(Default)] struct ConnectionManager(Mutex>); +#[cfg(any(feature = "rustls-tls", feature = "native-tls"))] +struct TlsConnector(Mutex>); + +#[derive(Deserialize)] +#[serde(untagged, rename_all = "camelCase")] +enum Max { + None, + Number(usize), +} + #[derive(Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ConnectionConfig { +pub(crate) struct ConnectionConfig { + pub read_buffer_size: Option, pub write_buffer_size: Option, pub max_write_buffer_size: Option, - pub max_message_size: Option, - pub max_frame_size: Option, + pub max_message_size: Option, + pub max_frame_size: Option, #[serde(default)] pub accept_unmasked_frames: bool, pub headers: Option>, @@ -76,18 +88,38 @@ pub struct ConnectionConfig { impl From for WebSocketConfig { fn from(config: ConnectionConfig) -> Self { - // Disabling the warning on max_send_queue which we don't use anymore since it was deprecated. - #[allow(deprecated)] - Self { - max_send_queue: None, - write_buffer_size: config.write_buffer_size.unwrap_or(128 * 1024), - max_write_buffer_size: config.max_write_buffer_size.unwrap_or(usize::MAX), - // This may be harmful since if it's not provided from js we're overwriting the default value with None, meaning no size limit. - max_message_size: config.max_message_size, - // This may be harmful since if it's not provided from js we're overwriting the default value with None, meaning no size limit. - max_frame_size: config.max_frame_size, - accept_unmasked_frames: config.accept_unmasked_frames, + let mut builder = + WebSocketConfig::default().accept_unmasked_frames(config.accept_unmasked_frames); + + if let Some(read_buffer_size) = config.read_buffer_size { + builder = builder.read_buffer_size(read_buffer_size) + } + + if let Some(write_buffer_size) = config.write_buffer_size { + builder = builder.write_buffer_size(write_buffer_size) } + + if let Some(max_write_buffer_size) = config.max_write_buffer_size { + builder = builder.max_write_buffer_size(max_write_buffer_size) + } + + if let Some(max_message_size) = config.max_message_size { + let max_size = match max_message_size { + Max::None => Option::None, + Max::Number(n) => Some(n), + }; + builder = builder.max_message_size(max_size); + } + + if let Some(max_frame_size) = config.max_frame_size { + let max_size = match max_frame_size { + Max::None => Option::None, + Max::Number(n) => Some(n), + }; + builder = builder.max_frame_size(max_size); + } + + builder } } @@ -111,7 +143,7 @@ enum WebSocketMessage { async fn connect( window: Window, url: String, - on_message: Channel, + on_message: Channel, config: Option, ) -> Result { let id = rand::random(); @@ -125,6 +157,17 @@ async fn connect( } } + #[cfg(any(feature = "rustls-tls", feature = "native-tls"))] + let tls_connector = match window.try_state::() { + Some(tls_connector) => tls_connector.0.lock().await.clone(), + None => None, + }; + + #[cfg(any(feature = "rustls-tls", feature = "native-tls"))] + let (ws_stream, _) = + connect_async_tls_with_config(request, config.map(Into::into), false, tls_connector) + .await?; + #[cfg(not(any(feature = "rustls-tls", feature = "native-tls")))] let (ws_stream, _) = connect_async_with_config(request, config.map(Into::into), false).await?; tauri::async_runtime::spawn(async move { @@ -142,21 +185,21 @@ async fn connect( let response = match message { Ok(Message::Text(t)) => { - serde_json::to_value(WebSocketMessage::Text(t)).unwrap() + serde_json::to_value(WebSocketMessage::Text(t.to_string())).unwrap() } Ok(Message::Binary(t)) => { - serde_json::to_value(WebSocketMessage::Binary(t)).unwrap() + serde_json::to_value(WebSocketMessage::Binary(t.to_vec())).unwrap() } Ok(Message::Ping(t)) => { - serde_json::to_value(WebSocketMessage::Ping(t)).unwrap() + serde_json::to_value(WebSocketMessage::Ping(t.to_vec())).unwrap() } Ok(Message::Pong(t)) => { - serde_json::to_value(WebSocketMessage::Pong(t)).unwrap() + serde_json::to_value(WebSocketMessage::Pong(t.to_vec())).unwrap() } Ok(Message::Close(t)) => { serde_json::to_value(WebSocketMessage::Close(t.map(|v| CloseFrame { code: v.code.into(), - reason: v.reason.into_owned(), + reason: v.reason.to_string(), }))) .unwrap() } @@ -182,13 +225,13 @@ async fn send( if let Some(write) = manager.0.lock().await.get_mut(&id) { write .send(match message { - WebSocketMessage::Text(t) => Message::Text(t), - WebSocketMessage::Binary(t) => Message::Binary(t), - WebSocketMessage::Ping(t) => Message::Ping(t), - WebSocketMessage::Pong(t) => Message::Pong(t), + WebSocketMessage::Text(t) => Message::Text(t.into()), + WebSocketMessage::Binary(t) => Message::Binary(t.into()), + WebSocketMessage::Ping(t) => Message::Ping(t.into()), + WebSocketMessage::Pong(t) => Message::Pong(t.into()), WebSocketMessage::Close(t) => Message::Close(t.map(|v| ProtocolCloseFrame { code: v.code.into(), - reason: std::borrow::Cow::Owned(v.reason), + reason: v.reason.into(), })), }) .await?; @@ -199,12 +242,35 @@ async fn send( } pub fn init() -> TauriPlugin { - PluginBuilder::new("websocket") - .js_init_script(include_str!("api-iife.js").to_string()) - .invoke_handler(tauri::generate_handler![connect, send]) - .setup(|app, _api| { - app.manage(ConnectionManager::default()); - Ok(()) - }) - .build() + Builder::default().build() +} + +#[derive(Default)] +pub struct Builder { + tls_connector: Option, +} + +impl Builder { + pub fn new() -> Self { + Self { + tls_connector: None, + } + } + + pub fn tls_connector(mut self, connector: Connector) -> Self { + self.tls_connector.replace(connector); + self + } + + pub fn build(self) -> TauriPlugin { + PluginBuilder::new("websocket") + .invoke_handler(tauri::generate_handler![connect, send]) + .setup(|app, _api| { + app.manage(ConnectionManager::default()); + #[cfg(any(feature = "rustls-tls", feature = "native-tls"))] + app.manage(TlsConnector(Mutex::new(self.tls_connector))); + Ok(()) + }) + .build() + } } diff --git a/plugins/window-state/.gitignore b/plugins/window-state/.gitignore deleted file mode 100644 index 3c3629e6..00000000 --- a/plugins/window-state/.gitignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/plugins/window-state/CHANGELOG.md b/plugins/window-state/CHANGELOG.md index 7a380c03..cfd02a55 100644 --- a/plugins/window-state/CHANGELOG.md +++ b/plugins/window-state/CHANGELOG.md @@ -1,5 +1,102 @@ # Changelog +## \[2.2.2] + +- [`a35fea50`](https://github.com/tauri-apps/plugins-workspace/commit/a35fea501560a3d126aad09b59600d9f1a731a9e) ([#2583](https://github.com/tauri-apps/plugins-workspace/pull/2583)) Fix window size gets bigger/smaller on secondary monitor with a different scaling than the primary one + +## \[2.2.1] + +- [`0ec895c3`](https://github.com/tauri-apps/plugins-workspace/commit/0ec895c378d4700cf8d7a002c6d9829f3c015b9f) ([#2330](https://github.com/tauri-apps/plugins-workspace/pull/2330) by [@thewh1teagle](https://github.com/tauri-apps/plugins-workspace/../../thewh1teagle)) Add `Builder::with_filter` callback to exclude specific windows from saving their state. This allows for more flexibility by enabling dynamic exclusion of windows based on custom logic. + +## \[2.2.0] + +- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other. + +## \[2.0.2] + +- [`cfb3ec0e`](https://github.com/tauri-apps/plugins-workspace/commit/cfb3ec0e21cab8010fbc1d7ef82aa65d86c3cfa9) ([#2007](https://github.com/tauri-apps/plugins-workspace/pull/2007) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) On macOS the plugin now (temporarily) ignores the maximized state for undecorated windows on resize events to fix app freezes. + +## \[2.0.1] + +- [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7. + +## \[2.0.0] + +- [`e2c4dfb6`](https://github.com/tauri-apps/plugins-workspace/commit/e2c4dfb6af43e5dd8d9ceba232c315f5febd55c1) Update to tauri v2 stable release. + +## \[2.0.0-rc.5] + +- [`7a37355e`](https://github.com/tauri-apps/plugins-workspace/commit/7a37355e177772cbddf24397d5a23280e00558af) ([#1787](https://github.com/tauri-apps/plugins-workspace/pull/1787) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Fix deadlock when trying to restore window states on initial load + +## \[2.0.0-rc.4] + +- [`204e5aac`](https://github.com/tauri-apps/plugins-workspace/commit/204e5aacad7e8f99a9a08f4a45cfed83643c1cc0) ([#1743](https://github.com/tauri-apps/plugins-workspace/pull/1743)) Fix can't restore a minimized window's size and position properly + +### breaking + +- [`204e5aac`](https://github.com/tauri-apps/plugins-workspace/commit/204e5aacad7e8f99a9a08f4a45cfed83643c1cc0) ([#1743](https://github.com/tauri-apps/plugins-workspace/pull/1743)) Window's size is now stored in physical size instead of logical size + +## \[2.0.0-rc.3] + +- [`17e8014b`](https://github.com/tauri-apps/plugins-workspace/commit/17e8014b6993602ddad21e8f5dcb625de1eea2c0) ([#1702](https://github.com/tauri-apps/plugins-workspace/pull/1702) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Fix saving a minimized window's state changes its position to -32000 + +## \[2.0.0-rc.1] + +- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri 2.0.0-rc.8 + +## \[2.0.0-rc.1] + +- [`2c00c029`](https://github.com/tauri-apps/plugins-workspace/commit/2c00c0292c9127b81567de46691e8c0f73557261) ([#1630](https://github.com/tauri-apps/plugins-workspace/pull/1630) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Fixed an issue that caused multi-word IIFE names to not be formatted correctly. For example the `barcode-scanner` was defined as `window.__TAURI_PLUGIN_CLIPBOARDMANAGER__` instead of `window.__TAURI_PLUGIN_CLIPBOARD_MANAGER__`. + +## \[2.0.0-rc.0] + +- [`9887d1`](https://github.com/tauri-apps/plugins-workspace/commit/9887d14bd0e971c4c0f5c1188fc4005d3fc2e29e) Update to tauri RC. + +## \[2.0.0-beta.9] + +- [`99d6ac0f`](https://github.com/tauri-apps/plugins-workspace/commit/99d6ac0f9506a6a4a1aa59c728157190a7441af6) ([#1606](https://github.com/tauri-apps/plugins-workspace/pull/1606) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) The JS packages now specify the *minimum* `@tauri-apps/api` version instead of a single exact version. +- [`6de87966`](https://github.com/tauri-apps/plugins-workspace/commit/6de87966ecc00ad9d91c25be452f1f46bd2b7e1f) ([#1597](https://github.com/tauri-apps/plugins-workspace/pull/1597) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Update to tauri beta.25. + +## \[2.0.0-beta.8] + +- [`22a17980`](https://github.com/tauri-apps/plugins-workspace/commit/22a17980ff4f6f8c40adb1b8f4ffc6dae2fe7e30) ([#1537](https://github.com/tauri-apps/plugins-workspace/pull/1537) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri beta.24. + +## \[2.0.0-beta.7] + +- [`76daee7a`](https://github.com/tauri-apps/plugins-workspace/commit/76daee7aafece34de3092c86e531cf9eb1138989) ([#1512](https://github.com/tauri-apps/plugins-workspace/pull/1512) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Update to tauri beta.23. + +## \[2.0.0-beta.6] + +- [`9013854f`](https://github.com/tauri-apps/plugins-workspace/commit/9013854f42a49a230b9dbb9d02774765528a923f)([#1382](https://github.com/tauri-apps/plugins-workspace/pull/1382)) Update to tauri beta.22. + +## \[2.0.0-beta.5] + +- [`430bd6f4`](https://github.com/tauri-apps/plugins-workspace/commit/430bd6f4f379bee5d232ae6b098ae131db7f178a)([#1363](https://github.com/tauri-apps/plugins-workspace/pull/1363)) Update to tauri beta.20. + +## \[2.0.0-beta.7] + +- [`d9de5b19`](https://github.com/tauri-apps/plugins-workspace/commit/d9de5b19d1e950c06f0915ae92a862acb266d108)([#1283](https://github.com/tauri-apps/plugins-workspace/pull/1283)) Implement `WindowExt` for `WebviewWindow`. + +## \[2.0.0-beta.4] + +- [`bd1ed590`](https://github.com/tauri-apps/plugins-workspace/commit/bd1ed5903ffcce5500310dac1e59e8c67674ef1e)([#1237](https://github.com/tauri-apps/plugins-workspace/pull/1237)) Update to tauri beta.17. + +## \[2.0.0-beta.3] + +- [`0e9541f`](https://github.com/tauri-apps/plugins-workspace/commit/0e9541fe8990395de7cc8887bc46b3f3665b44e1)([#1138](https://github.com/tauri-apps/plugins-workspace/pull/1138)) Add `Builder::with_filename` to support using a custom filename. Also add `AppHandleExt::file_name` and a similar function in JS, to retrieve it later. + +## \[2.0.0-beta.4] + +- [`c013fa5`](https://github.com/tauri-apps/plugins-workspace/commit/c013fa52cd66885cf457a64e75373cb2066bc849)([#1078](https://github.com/tauri-apps/plugins-workspace/pull/1078)) **Breaking change**: Changed the format of the state file from bincode to json. Also changed the filename to from `.window-state` to `.window-state.json`. + +## \[2.0.0-beta.3] + +- [`a04ea2f`](https://github.com/tauri-apps/plugins-workspace/commit/a04ea2f38294d5a3987578283badc8eec87a7752)([#1071](https://github.com/tauri-apps/plugins-workspace/pull/1071)) The global API script is now only added to the binary when the `withGlobalTauri` config is true. + +## \[2.0.0-beta.2] + +- [`99bea25`](https://github.com/tauri-apps/plugins-workspace/commit/99bea2559c2c0648c2519c50a18cd124dacef57b)([#1005](https://github.com/tauri-apps/plugins-workspace/pull/1005)) Update to tauri beta.8. + ## \[2.0.0-beta.1] - [`569defb`](https://github.com/tauri-apps/plugins-workspace/commit/569defbe9492e38938554bb7bdc1be9151456d21) Update to tauri beta.4. @@ -42,7 +139,11 @@ ## \[2.0.0-alpha.0] - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - lugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - /pull/371)) First v2 alpha release! - lugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! -717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! + +## \[0.1.1] + +- Address a couple of issues with restoring positions: + +- Fix restoring window positions correctly when the top-left corner of the window was outside of the monitor. + +- Fix restore maximization state only maximized on main monitor. diff --git a/plugins/window-state/Cargo.toml b/plugins/window-state/Cargo.toml index 60c03781..180808b8 100644 --- a/plugins/window-state/Cargo.toml +++ b/plugins/window-state/Cargo.toml @@ -1,19 +1,27 @@ [package] name = "tauri-plugin-window-state" -version = "2.0.0-beta.1" +version = "2.2.2" description = "Save window positions and sizes and restore them when the app is reopened." authors = { workspace = true } license = { workspace = true } edition = { workspace = true } rust-version = { workspace = true } +repository = { workspace = true } links = "tauri-plugin-window-state" [package.metadata.docs.rs] -rustc-args = [ "--cfg", "docsrs" ] -rustdoc-args = [ "--cfg", "docsrs" ] +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs"] + +[package.metadata.platforms.support] +windows = { level = "full", notes = "" } +linux = { level = "full", notes = "" } +macos = { level = "full", notes = "" } +android = { level = "none", notes = "" } +ios = { level = "none", notes = "" } [build-dependencies] -tauri-plugin = { workspace = true, features = [ "build" ] } +tauri-plugin = { workspace = true, features = ["build"] } [dependencies] serde = { workspace = true } @@ -21,5 +29,4 @@ serde_json = { workspace = true } tauri = { workspace = true } log = { workspace = true } thiserror = { workspace = true } -bincode = "1.3" bitflags = "2" diff --git a/plugins/window-state/README.md b/plugins/window-state/README.md index c71b4df3..4af93de2 100644 --- a/plugins/window-state/README.md +++ b/plugins/window-state/README.md @@ -2,9 +2,17 @@ Save window positions and sizes and restore them when the app is reopened. +| Platform | Supported | +| -------- | --------- | +| Linux | ✓ | +| Windows | ✓ | +| macOS | ✓ | +| Android | x | +| iOS | x | + ## Install -_This plugin requires a Rust version of at least **1.75**_ +_This plugin requires a Rust version of at least **1.77.2**_ There are three general methods of installation that we can recommend. @@ -18,7 +26,7 @@ Install the Core plugin by adding the following to your `Cargo.toml` file: ```toml [dependencies] -tauri-plugin-window-state = "2.0.0-beta" +tauri-plugin-window-state = "2.0.0" # alternatively with Git: tauri-plugin-window-state = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` @@ -46,7 +54,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-window-state#v2 First you need to register the core plugin with Tauri: -`src-tauri/src/main.rs` +`src-tauri/src/lib.rs` ```rust fn main() { @@ -71,9 +79,9 @@ app.save_window_state(StateFlags::all()); // will save the state of all open win or through Javascript ```javascript -import { saveWindowState, StateFlags } from "@tauri-apps/plugin-window-state"; +import { saveWindowState, StateFlags } from '@tauri-apps/plugin-window-state' -saveWindowState(StateFlags.ALL); +saveWindowState(StateFlags.ALL) ``` To manually restore a windows state from disk you can call the `restore_state()` method exposed by the `WindowExt` trait: @@ -90,10 +98,10 @@ or through Javascript ```javascript import { restoreStateCurrent, - StateFlags, -} from "@tauri-apps/plugin-window-state"; + StateFlags +} from '@tauri-apps/plugin-window-state' -restoreStateCurrent(StateFlags.ALL); +restoreStateCurrent(StateFlags.ALL) ``` ## Contributing diff --git a/plugins/window-state/SECURITY.md b/plugins/window-state/SECURITY.md new file mode 100644 index 00000000..4f09bbac --- /dev/null +++ b/plugins/window-state/SECURITY.md @@ -0,0 +1,23 @@ +# Security Policy + +**Do not report security vulnerabilities through public GitHub issues.** + +**Please use the [Private Vulnerability Disclosure](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability) feature of GitHub.** + +Include as much of the following information: + +- Type of issue (e.g. improper input parsing, privilege escalation, etc.) +- The location of the affected source code (tag/branch/commit or direct URL) +- Any special configuration required to reproduce the issue +- The distribution affected or used to help us with reproduction of the issue +- Step-by-step instructions to reproduce the issue +- Ideally a reproduction repository +- Impact of the issue, including how an attacker might exploit the issue + +We prefer to receive reports in English. + +## Contact + +Please disclose a vulnerability or security relevant issue here: [https://github.com/tauri-apps/plugins-workspace/security/advisories/new](https://github.com/tauri-apps/plugins-workspace/security/advisories/new). + +Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app). diff --git a/plugins/window-state/api-iife.js b/plugins/window-state/api-iife.js new file mode 100644 index 00000000..e0082b5c --- /dev/null +++ b/plugins/window-state/api-iife.js @@ -0,0 +1 @@ +if("__TAURI__"in window){var __TAURI_PLUGIN_WINDOW_STATE__=function(e){"use strict";var t;"function"==typeof SuppressedError&&SuppressedError;const i="__TAURI_TO_IPC_KEY__";function n(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}async function a(e,t={},i){return window.__TAURI_INTERNALS__.invoke(e,t,i)}class l{get rid(){return function(e,t,i,n){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(e):n?n.value:t.get(e)}(this,t,"f")}constructor(e){t.set(this,void 0),function(e,t,i){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");t.set(e,i)}(this,t,e)}async close(){return a("plugin:resources|close",{rid:this.rid})}}t=new WeakMap;class s{constructor(...e){this.type="Logical",1===e.length?"Logical"in e[0]?(this.width=e[0].Logical.width,this.height=e[0].Logical.height):(this.width=e[0].width,this.height=e[0].height):(this.width=e[0],this.height=e[1])}toPhysical(e){return new r(this.width*e,this.height*e)}[i](){return{width:this.width,height:this.height}}toJSON(){return this[i]()}}class r{constructor(...e){this.type="Physical",1===e.length?"Physical"in e[0]?(this.width=e[0].Physical.width,this.height=e[0].Physical.height):(this.width=e[0].width,this.height=e[0].height):(this.width=e[0],this.height=e[1])}toLogical(e){return new s(this.width/e,this.height/e)}[i](){return{width:this.width,height:this.height}}toJSON(){return this[i]()}}class o{constructor(e){this.size=e}toLogical(e){return this.size instanceof s?this.size:this.size.toLogical(e)}toPhysical(e){return this.size instanceof r?this.size:this.size.toPhysical(e)}[i](){return{[`${this.size.type}`]:{width:this.size.width,height:this.size.height}}}toJSON(){return this[i]()}}class u{constructor(...e){this.type="Logical",1===e.length?"Logical"in e[0]?(this.x=e[0].Logical.x,this.y=e[0].Logical.y):(this.x=e[0].x,this.y=e[0].y):(this.x=e[0],this.y=e[1])}toPhysical(e){return new c(this.x*e,this.y*e)}[i](){return{x:this.x,y:this.y}}toJSON(){return this[i]()}}class c{constructor(...e){this.type="Physical",1===e.length?"Physical"in e[0]?(this.x=e[0].Physical.x,this.y=e[0].Physical.y):(this.x=e[0].x,this.y=e[0].y):(this.x=e[0],this.y=e[1])}toLogical(e){return new u(this.x/e,this.y/e)}[i](){return{x:this.x,y:this.y}}toJSON(){return this[i]()}}class h{constructor(e){this.position=e}toLogical(e){return this.position instanceof u?this.position:this.position.toLogical(e)}toPhysical(e){return this.position instanceof c?this.position:this.position.toPhysical(e)}[i](){return{[`${this.position.type}`]:{x:this.position.x,y:this.position.y}}}toJSON(){return this[i]()}}var d,w,b;async function g(e,t){await a("plugin:event|unlisten",{event:e,eventId:t})}async function y(e,t,i){var l;const s="string"==typeof(null==i?void 0:i.target)?{kind:"AnyLabel",label:i.target}:null!==(l=null==i?void 0:i.target)&&void 0!==l?l:{kind:"Any"};return a("plugin:event|listen",{event:e,target:s,handler:n(t)}).then((t=>async()=>g(e,t)))}!function(e){e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_CREATED="tauri://window-created",e.WEBVIEW_CREATED="tauri://webview-created",e.DRAG_ENTER="tauri://drag-enter",e.DRAG_OVER="tauri://drag-over",e.DRAG_DROP="tauri://drag-drop",e.DRAG_LEAVE="tauri://drag-leave"}(d||(d={}));class p extends l{constructor(e){super(e)}static async new(e,t,i){return a("plugin:image|new",{rgba:_(e),width:t,height:i}).then((e=>new p(e)))}static async fromBytes(e){return a("plugin:image|from_bytes",{bytes:_(e)}).then((e=>new p(e)))}static async fromPath(e){return a("plugin:image|from_path",{path:e}).then((e=>new p(e)))}async rgba(){return a("plugin:image|rgba",{rid:this.rid}).then((e=>new Uint8Array(e)))}async size(){return a("plugin:image|size",{rid:this.rid})}}function _(e){return null==e?null:"string"==typeof e?e:e instanceof p?e.rid:e}!function(e){e[e.Critical=1]="Critical",e[e.Informational=2]="Informational"}(w||(w={}));class v{constructor(e){this._preventDefault=!1,this.event=e.event,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}}function f(){return new D(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}async function m(){return a("plugin:window|get_all_windows").then((e=>e.map((e=>new D(e,{skip:!0})))))}!function(e){e.None="none",e.Normal="normal",e.Indeterminate="indeterminate",e.Paused="paused",e.Error="error"}(b||(b={}));const E=["tauri://created","tauri://error"];class D{constructor(e,t={}){var i;this.label=e,this.listeners=Object.create(null),(null==t?void 0:t.skip)||a("plugin:window|create",{options:{...t,parent:"string"==typeof t.parent?t.parent:null===(i=t.parent)||void 0===i?void 0:i.label,label:e}}).then((async()=>this.emit("tauri://created"))).catch((async e=>this.emit("tauri://error",e)))}static async getByLabel(e){var t;return null!==(t=(await m()).find((t=>t.label===e)))&&void 0!==t?t:null}static getCurrent(){return f()}static async getAll(){return m()}static async getFocusedWindow(){for(const e of await m())if(await e.isFocused())return e;return null}async listen(e,t){return this._handleTauriEvent(e,t)?()=>{const i=this.listeners[e];i.splice(i.indexOf(t),1)}:y(e,t,{target:{kind:"Window",label:this.label}})}async once(e,t){return this._handleTauriEvent(e,t)?()=>{const i=this.listeners[e];i.splice(i.indexOf(t),1)}:async function(e,t,i){return y(e,(i=>{g(e,i.id),t(i)}),i)}(e,t,{target:{kind:"Window",label:this.label}})}async emit(e,t){if(!E.includes(e))return async function(e,t){await a("plugin:event|emit",{event:e,payload:t})}(e,t);for(const i of this.listeners[e]||[])i({event:e,id:-1,payload:t})}async emitTo(e,t,i){if(!E.includes(t))return async function(e,t,i){const n="string"==typeof e?{kind:"AnyLabel",label:e}:e;await a("plugin:event|emit_to",{target:n,event:t,payload:i})}(e,t,i);for(const e of this.listeners[t]||[])e({event:t,id:-1,payload:i})}_handleTauriEvent(e,t){return!!E.includes(e)&&(e in this.listeners?this.listeners[e].push(t):this.listeners[e]=[t],!0)}async scaleFactor(){return a("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return a("plugin:window|inner_position",{label:this.label}).then((e=>new c(e)))}async outerPosition(){return a("plugin:window|outer_position",{label:this.label}).then((e=>new c(e)))}async innerSize(){return a("plugin:window|inner_size",{label:this.label}).then((e=>new r(e)))}async outerSize(){return a("plugin:window|outer_size",{label:this.label}).then((e=>new r(e)))}async isFullscreen(){return a("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return a("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return a("plugin:window|is_maximized",{label:this.label})}async isFocused(){return a("plugin:window|is_focused",{label:this.label})}async isDecorated(){return a("plugin:window|is_decorated",{label:this.label})}async isResizable(){return a("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return a("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return a("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return a("plugin:window|is_closable",{label:this.label})}async isVisible(){return a("plugin:window|is_visible",{label:this.label})}async title(){return a("plugin:window|title",{label:this.label})}async theme(){return a("plugin:window|theme",{label:this.label})}async isAlwaysOnTop(){return a("plugin:window|is_always_on_top",{label:this.label})}async center(){return a("plugin:window|center",{label:this.label})}async requestUserAttention(e){let t=null;return e&&(t=e===w.Critical?{type:"Critical"}:{type:"Informational"}),a("plugin:window|request_user_attention",{label:this.label,value:t})}async setResizable(e){return a("plugin:window|set_resizable",{label:this.label,value:e})}async setEnabled(e){return a("plugin:window|set_enabled",{label:this.label,value:e})}async isEnabled(){return a("plugin:window|is_enabled",{label:this.label})}async setMaximizable(e){return a("plugin:window|set_maximizable",{label:this.label,value:e})}async setMinimizable(e){return a("plugin:window|set_minimizable",{label:this.label,value:e})}async setClosable(e){return a("plugin:window|set_closable",{label:this.label,value:e})}async setTitle(e){return a("plugin:window|set_title",{label:this.label,value:e})}async maximize(){return a("plugin:window|maximize",{label:this.label})}async unmaximize(){return a("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return a("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return a("plugin:window|minimize",{label:this.label})}async unminimize(){return a("plugin:window|unminimize",{label:this.label})}async show(){return a("plugin:window|show",{label:this.label})}async hide(){return a("plugin:window|hide",{label:this.label})}async close(){return a("plugin:window|close",{label:this.label})}async destroy(){return a("plugin:window|destroy",{label:this.label})}async setDecorations(e){return a("plugin:window|set_decorations",{label:this.label,value:e})}async setShadow(e){return a("plugin:window|set_shadow",{label:this.label,value:e})}async setEffects(e){return a("plugin:window|set_effects",{label:this.label,value:e})}async clearEffects(){return a("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(e){return a("plugin:window|set_always_on_top",{label:this.label,value:e})}async setAlwaysOnBottom(e){return a("plugin:window|set_always_on_bottom",{label:this.label,value:e})}async setContentProtected(e){return a("plugin:window|set_content_protected",{label:this.label,value:e})}async setSize(e){return a("plugin:window|set_size",{label:this.label,value:e instanceof o?e:new o(e)})}async setMinSize(e){return a("plugin:window|set_min_size",{label:this.label,value:e instanceof o?e:e?new o(e):null})}async setMaxSize(e){return a("plugin:window|set_max_size",{label:this.label,value:e instanceof o?e:e?new o(e):null})}async setSizeConstraints(e){function t(e){return e?{Logical:e}:null}return a("plugin:window|set_size_constraints",{label:this.label,value:{minWidth:t(null==e?void 0:e.minWidth),minHeight:t(null==e?void 0:e.minHeight),maxWidth:t(null==e?void 0:e.maxWidth),maxHeight:t(null==e?void 0:e.maxHeight)}})}async setPosition(e){return a("plugin:window|set_position",{label:this.label,value:e instanceof h?e:new h(e)})}async setFullscreen(e){return a("plugin:window|set_fullscreen",{label:this.label,value:e})}async setFocus(){return a("plugin:window|set_focus",{label:this.label})}async setIcon(e){return a("plugin:window|set_icon",{label:this.label,value:_(e)})}async setSkipTaskbar(e){return a("plugin:window|set_skip_taskbar",{label:this.label,value:e})}async setCursorGrab(e){return a("plugin:window|set_cursor_grab",{label:this.label,value:e})}async setCursorVisible(e){return a("plugin:window|set_cursor_visible",{label:this.label,value:e})}async setCursorIcon(e){return a("plugin:window|set_cursor_icon",{label:this.label,value:e})}async setBackgroundColor(e){return a("plugin:window|set_background_color",{color:e})}async setCursorPosition(e){return a("plugin:window|set_cursor_position",{label:this.label,value:e instanceof h?e:new h(e)})}async setIgnoreCursorEvents(e){return a("plugin:window|set_ignore_cursor_events",{label:this.label,value:e})}async startDragging(){return a("plugin:window|start_dragging",{label:this.label})}async startResizeDragging(e){return a("plugin:window|start_resize_dragging",{label:this.label,value:e})}async setBadgeCount(e){return a("plugin:window|set_badge_count",{label:this.label,value:e})}async setBadgeLabel(e){return a("plugin:window|set_badge_label",{label:this.label,value:e})}async setOverlayIcon(e){return a("plugin:window|set_overlay_icon",{label:this.label,value:e?_(e):void 0})}async setProgressBar(e){return a("plugin:window|set_progress_bar",{label:this.label,value:e})}async setVisibleOnAllWorkspaces(e){return a("plugin:window|set_visible_on_all_workspaces",{label:this.label,value:e})}async setTitleBarStyle(e){return a("plugin:window|set_title_bar_style",{label:this.label,value:e})}async setTheme(e){return a("plugin:window|set_theme",{label:this.label,value:e})}async onResized(e){return this.listen(d.WINDOW_RESIZED,(t=>{t.payload=new r(t.payload),e(t)}))}async onMoved(e){return this.listen(d.WINDOW_MOVED,(t=>{t.payload=new c(t.payload),e(t)}))}async onCloseRequested(e){return this.listen(d.WINDOW_CLOSE_REQUESTED,(async t=>{const i=new v(t);await e(i),i.isPreventDefault()||await this.destroy()}))}async onDragDropEvent(e){const t=await this.listen(d.DRAG_ENTER,(t=>{e({...t,payload:{type:"enter",paths:t.payload.paths,position:new c(t.payload.position)}})})),i=await this.listen(d.DRAG_OVER,(t=>{e({...t,payload:{type:"over",position:new c(t.payload.position)}})})),n=await this.listen(d.DRAG_DROP,(t=>{e({...t,payload:{type:"drop",paths:t.payload.paths,position:new c(t.payload.position)}})})),a=await this.listen(d.DRAG_LEAVE,(t=>{e({...t,payload:{type:"leave"}})}));return()=>{t(),n(),i(),a()}}async onFocusChanged(e){const t=await this.listen(d.WINDOW_FOCUS,(t=>{e({...t,payload:!0})})),i=await this.listen(d.WINDOW_BLUR,(t=>{e({...t,payload:!1})}));return()=>{t(),i()}}async onScaleChanged(e){return this.listen(d.WINDOW_SCALE_FACTOR_CHANGED,e)}async onThemeChanged(e){return this.listen(d.WINDOW_THEME_CHANGED,e)}}var I,S,W,O;async function z(e,t){await a("plugin:window-state|restore_state",{label:e,flags:t})}return function(e){e.Disabled="disabled",e.Throttle="throttle",e.Suspend="suspend"}(I||(I={})),function(e){e.AppearanceBased="appearanceBased",e.Light="light",e.Dark="dark",e.MediumLight="mediumLight",e.UltraDark="ultraDark",e.Titlebar="titlebar",e.Selection="selection",e.Menu="menu",e.Popover="popover",e.Sidebar="sidebar",e.HeaderView="headerView",e.Sheet="sheet",e.WindowBackground="windowBackground",e.HudWindow="hudWindow",e.FullScreenUI="fullScreenUI",e.Tooltip="tooltip",e.ContentBackground="contentBackground",e.UnderWindowBackground="underWindowBackground",e.UnderPageBackground="underPageBackground",e.Mica="mica",e.Blur="blur",e.Acrylic="acrylic",e.Tabbed="tabbed",e.TabbedDark="tabbedDark",e.TabbedLight="tabbedLight"}(S||(S={})),function(e){e.FollowsWindowActiveState="followsWindowActiveState",e.Active="active",e.Inactive="inactive"}(W||(W={})),e.StateFlags=void 0,(O=e.StateFlags||(e.StateFlags={}))[O.SIZE=1]="SIZE",O[O.POSITION=2]="POSITION",O[O.MAXIMIZED=4]="MAXIMIZED",O[O.VISIBLE=8]="VISIBLE",O[O.DECORATIONS=16]="DECORATIONS",O[O.FULLSCREEN=32]="FULLSCREEN",O[O.ALL=63]="ALL",e.filename=async function(){return await a("plugin:window-state|filename")},e.restoreState=z,e.restoreStateCurrent=async function(e){await z(f().label,e)},e.saveWindowState=async function(e){await a("plugin:window-state|save_window_state",{flags:e})},e}({});Object.defineProperty(window.__TAURI__,"windowState",{value:__TAURI_PLUGIN_WINDOW_STATE__})} diff --git a/plugins/window-state/build.rs b/plugins/window-state/build.rs index 9d9a160a..2a9354c9 100644 --- a/plugins/window-state/build.rs +++ b/plugins/window-state/build.rs @@ -2,8 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -const COMMANDS: &[&str] = &["save_window_state", "restore_window_state"]; +const COMMANDS: &[&str] = &["save_window_state", "restore_state", "filename"]; fn main() { - tauri_plugin::Builder::new(COMMANDS).build(); + tauri_plugin::Builder::new(COMMANDS) + .global_api_script_path("./api-iife.js") + .build(); } diff --git a/plugins/window-state/guest-js/index.ts b/plugins/window-state/guest-js/index.ts index 4800ecb9..f922f3f0 100644 --- a/plugins/window-state/guest-js/index.ts +++ b/plugins/window-state/guest-js/index.ts @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { invoke } from "@tauri-apps/api/core"; -import { WindowLabel, getCurrent } from "@tauri-apps/api/window"; +import { invoke } from '@tauri-apps/api/core' +import { type WindowLabel, getCurrentWindow } from '@tauri-apps/api/window' export enum StateFlags { SIZE = 1 << 0, @@ -12,14 +12,14 @@ export enum StateFlags { VISIBLE = 1 << 3, DECORATIONS = 1 << 4, FULLSCREEN = 1 << 5, - ALL = SIZE | POSITION | MAXIMIZED | VISIBLE | DECORATIONS | FULLSCREEN, + ALL = SIZE | POSITION | MAXIMIZED | VISIBLE | DECORATIONS | FULLSCREEN } /** * Save the state of all open windows to disk. */ async function saveWindowState(flags: StateFlags): Promise { - return invoke("plugin:window-state|save_window_state", { flags }); + await invoke('plugin:window-state|save_window_state', { flags }) } /** @@ -27,16 +27,22 @@ async function saveWindowState(flags: StateFlags): Promise { */ async function restoreState( label: WindowLabel, - flags: StateFlags, + flags: StateFlags ): Promise { - return invoke("plugin:window-state|restore_state", { label, flags }); + await invoke('plugin:window-state|restore_state', { label, flags }) } /** * Restore the state for the current window from disk. */ async function restoreStateCurrent(flags: StateFlags): Promise { - return restoreState(getCurrent().label, flags); + await restoreState(getCurrentWindow().label, flags) +} +/** + * Get the name of the file used to store window state. + */ +async function filename(): Promise { + return await invoke('plugin:window-state|filename') } -export { restoreState, restoreStateCurrent, saveWindowState }; +export { restoreState, restoreStateCurrent, saveWindowState, filename } diff --git a/plugins/window-state/package.json b/plugins/window-state/package.json index 2fe3d414..fd0eccd1 100644 --- a/plugins/window-state/package.json +++ b/plugins/window-state/package.json @@ -1,11 +1,12 @@ { "name": "@tauri-apps/plugin-window-state", - "version": "2.0.0-beta.1", + "version": "2.2.2", "description": "Save window positions and sizes and restore them when the app is reopened.", - "license": "MIT or APACHE-2.0", + "license": "MIT OR Apache-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" ], + "repository": "https://github.com/tauri-apps/plugins-workspace", "type": "module", "types": "./dist-js/index.d.ts", "main": "./dist-js/index.cjs", @@ -24,6 +25,6 @@ "LICENSE" ], "dependencies": { - "@tauri-apps/api": "2.0.0-beta.2" + "@tauri-apps/api": "^2.0.0" } } diff --git a/plugins/window-state/permissions/autogenerated/commands/filename.toml b/plugins/window-state/permissions/autogenerated/commands/filename.toml new file mode 100644 index 00000000..1cfcee45 --- /dev/null +++ b/plugins/window-state/permissions/autogenerated/commands/filename.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-filename" +description = "Enables the filename command without any pre-configured scope." +commands.allow = ["filename"] + +[[permission]] +identifier = "deny-filename" +description = "Denies the filename command without any pre-configured scope." +commands.deny = ["filename"] diff --git a/plugins/window-state/permissions/autogenerated/commands/restore_state.toml b/plugins/window-state/permissions/autogenerated/commands/restore_state.toml new file mode 100644 index 00000000..61df5cd4 --- /dev/null +++ b/plugins/window-state/permissions/autogenerated/commands/restore_state.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-restore-state" +description = "Enables the restore_state command without any pre-configured scope." +commands.allow = ["restore_state"] + +[[permission]] +identifier = "deny-restore-state" +description = "Denies the restore_state command without any pre-configured scope." +commands.deny = ["restore_state"] diff --git a/plugins/window-state/permissions/autogenerated/commands/restore_window_state.toml b/plugins/window-state/permissions/autogenerated/commands/restore_window_state.toml deleted file mode 100644 index 07fa8bb2..00000000 --- a/plugins/window-state/permissions/autogenerated/commands/restore_window_state.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-restore-window-state" -description = "Enables the restore_window_state command without any pre-configured scope." -commands.allow = ["restore_window_state"] - -[[permission]] -identifier = "deny-restore-window-state" -description = "Denies the restore_window_state command without any pre-configured scope." -commands.deny = ["restore_window_state"] diff --git a/plugins/window-state/permissions/autogenerated/reference.md b/plugins/window-state/permissions/autogenerated/reference.md index 767eea84..64cd7d88 100644 --- a/plugins/window-state/permissions/autogenerated/reference.md +++ b/plugins/window-state/permissions/autogenerated/reference.md @@ -1,18 +1,104 @@ -# Permissions +## Default Permission -## allow-restore-window-state +This permission set configures what kind of +operations are available from the window state plugin. -Enables the restore_window_state command without any pre-configured scope. +#### Granted Permissions -## deny-restore-window-state +All operations are enabled by default. -Denies the restore_window_state command without any pre-configured scope. -## allow-save-window-state + +#### This default permission set includes the following: + +- `allow-filename` +- `allow-restore-state` +- `allow-save-window-state` + +## Permission Table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IdentifierDescription
+ +`window-state:allow-filename` + + + +Enables the filename command without any pre-configured scope. + +
+ +`window-state:deny-filename` + + + +Denies the filename command without any pre-configured scope. + +
+ +`window-state:allow-restore-state` + + + +Enables the restore_state command without any pre-configured scope. + +
+ +`window-state:deny-restore-state` + + + +Denies the restore_state command without any pre-configured scope. + +
+ +`window-state:allow-save-window-state` + + Enables the save_window_state command without any pre-configured scope. -## deny-save-window-state +
+ +`window-state:deny-save-window-state` + + Denies the save_window_state command without any pre-configured scope. +
diff --git a/plugins/window-state/permissions/default.toml b/plugins/window-state/permissions/default.toml new file mode 100644 index 00000000..1823e198 --- /dev/null +++ b/plugins/window-state/permissions/default.toml @@ -0,0 +1,17 @@ +"$schema" = "schemas/schema.json" + +[default] +description = """ +This permission set configures what kind of +operations are available from the window state plugin. + +#### Granted Permissions + +All operations are enabled by default. + +""" +permissions = [ + "allow-filename", + "allow-restore-state", + "allow-save-window-state", +] diff --git a/plugins/window-state/permissions/schemas/schema.json b/plugins/window-state/permissions/schemas/schema.json index fa5eff81..d9cbe0f0 100644 --- a/plugins/window-state/permissions/schemas/schema.json +++ b/plugins/window-state/permissions/schemas/schema.json @@ -17,7 +17,6 @@ }, "set": { "description": "A list of permissions sets defined", - "default": [], "type": "array", "items": { "$ref": "#/definitions/PermissionSet" @@ -50,7 +49,7 @@ "minimum": 1.0 }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -112,7 +111,7 @@ "type": "string" }, "description": { - "description": "Human-readable description of what the permission does.", + "description": "Human-readable description of what the permission does. Tauri internal convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", "type": [ "string", "null" @@ -132,12 +131,21 @@ }, "scope": { "description": "Allowed or denied scoped when using this permission.", - "default": {}, "allOf": [ { "$ref": "#/definitions/Scopes" } ] + }, + "platforms": { + "description": "Target platforms this permission applies. By default all platforms are affected by this permission.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Target" + } } } }, @@ -164,7 +172,7 @@ } }, "Scopes": { - "description": "A restriction of the command/endpoint functionality.\n\nIt can be of any serde serializable type and is used for allowing or preventing certain actions inside a Tauri command.\n\nThe scope is passed to the command and handled/enforced by the command itself.", + "description": "An argument for fine grained behavior control of Tauri commands.\n\nIt can be of any serde serializable type and is used to allow or prevent certain actions inside a Tauri command. The configured scope is passed to the command and will be enforced by the command implementation.\n\n## Example\n\n```json { \"allow\": [{ \"path\": \"$HOME/**\" }], \"deny\": [{ \"path\": \"$HOME/secret.txt\" }] } ```", "type": "object", "properties": { "allow": { @@ -178,7 +186,7 @@ } }, "deny": { - "description": "Data that defines what is denied by the scope.", + "description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.", "type": [ "array", "null" @@ -243,38 +251,92 @@ } ] }, - "PermissionKind": { - "type": "string", + "Target": { + "description": "Platform target.", "oneOf": [ { - "description": "allow-restore-window-state -> Enables the restore_window_state command without any pre-configured scope.", + "description": "MacOS.", + "type": "string", + "enum": [ + "macOS" + ] + }, + { + "description": "Windows.", "type": "string", "enum": [ - "allow-restore-window-state" + "windows" ] }, { - "description": "deny-restore-window-state -> Denies the restore_window_state command without any pre-configured scope.", + "description": "Linux.", "type": "string", "enum": [ - "deny-restore-window-state" + "linux" ] }, { - "description": "allow-save-window-state -> Enables the save_window_state command without any pre-configured scope.", + "description": "Android.", "type": "string", "enum": [ - "allow-save-window-state" + "android" ] }, { - "description": "deny-save-window-state -> Denies the save_window_state command without any pre-configured scope.", + "description": "iOS.", "type": "string", "enum": [ - "deny-save-window-state" + "iOS" ] } ] + }, + "PermissionKind": { + "type": "string", + "oneOf": [ + { + "description": "Enables the filename command without any pre-configured scope.", + "type": "string", + "const": "allow-filename", + "markdownDescription": "Enables the filename command without any pre-configured scope." + }, + { + "description": "Denies the filename command without any pre-configured scope.", + "type": "string", + "const": "deny-filename", + "markdownDescription": "Denies the filename command without any pre-configured scope." + }, + { + "description": "Enables the restore_state command without any pre-configured scope.", + "type": "string", + "const": "allow-restore-state", + "markdownDescription": "Enables the restore_state command without any pre-configured scope." + }, + { + "description": "Denies the restore_state command without any pre-configured scope.", + "type": "string", + "const": "deny-restore-state", + "markdownDescription": "Denies the restore_state command without any pre-configured scope." + }, + { + "description": "Enables the save_window_state command without any pre-configured scope.", + "type": "string", + "const": "allow-save-window-state", + "markdownDescription": "Enables the save_window_state command without any pre-configured scope." + }, + { + "description": "Denies the save_window_state command without any pre-configured scope.", + "type": "string", + "const": "deny-save-window-state", + "markdownDescription": "Denies the save_window_state command without any pre-configured scope." + }, + { + "description": "This permission set configures what kind of\noperations are available from the window state plugin.\n\n#### Granted Permissions\n\nAll operations are enabled by default.\n\n\n#### This default permission set includes:\n\n- `allow-filename`\n- `allow-restore-state`\n- `allow-save-window-state`", + "type": "string", + "const": "default", + "markdownDescription": "This permission set configures what kind of\noperations are available from the window state plugin.\n\n#### Granted Permissions\n\nAll operations are enabled by default.\n\n\n#### This default permission set includes:\n\n- `allow-filename`\n- `allow-restore-state`\n- `allow-save-window-state`" + } + ] } } } \ No newline at end of file diff --git a/plugins/window-state/rollup.config.js b/plugins/window-state/rollup.config.js index 977dfac8..1f349ec8 100644 --- a/plugins/window-state/rollup.config.js +++ b/plugins/window-state/rollup.config.js @@ -2,6 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { createConfig } from "../../shared/rollup.config.js"; +import { createConfig } from '../../shared/rollup.config.js' -export default createConfig(); +export default createConfig() diff --git a/plugins/window-state/src/api-iife.js b/plugins/window-state/src/api-iife.js deleted file mode 100644 index 47212356..00000000 --- a/plugins/window-state/src/api-iife.js +++ /dev/null @@ -1 +0,0 @@ -if("__TAURI__"in window){var __TAURI_PLUGIN_WINDOWSTATE__=function(e){"use strict";function t(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}async function i(e,t={},i){return window.__TAURI_INTERNALS__.invoke(e,t,i)}"function"==typeof SuppressedError&&SuppressedError;class n{constructor(e,t){this.type="Logical",this.width=e,this.height=t}}class a{constructor(e,t){this.type="Physical",this.width=e,this.height=t}toLogical(e){return new n(this.width/e,this.height/e)}}class l{constructor(e,t){this.type="Logical",this.x=e,this.y=t}}class s{constructor(e,t){this.type="Physical",this.x=e,this.y=t}toLogical(e){return new l(this.x/e,this.y/e)}}var r,o,u;async function c(e,t){await i("plugin:event|unlisten",{event:e,eventId:t})}async function d(e,n,a){const l="string"==typeof a?.target?{kind:"AnyLabel",label:a.target}:a?.target??{kind:"Any"};return i("plugin:event|listen",{event:e,target:l,handler:t(n)}).then((t=>async()=>c(e,t)))}!function(e){e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WEBVIEW_CREATED="tauri://webview-created",e.FILE_DROP="tauri://file-drop",e.FILE_DROP_HOVER="tauri://file-drop-hover",e.FILE_DROP_CANCELLED="tauri://file-drop-cancelled"}(r||(r={})),function(e){e[e.Critical=1]="Critical",e[e.Informational=2]="Informational"}(o||(o={}));class h{constructor(e){this._preventDefault=!1,this.event=e.event,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}}function w(){return new y(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}function b(){return window.__TAURI_INTERNALS__.metadata.windows.map((e=>new y(e.label,{skip:!0})))}!function(e){e.None="none",e.Normal="normal",e.Indeterminate="indeterminate",e.Paused="paused",e.Error="error"}(u||(u={}));const p=["tauri://created","tauri://error"];class y{constructor(e,t={}){this.label=e,this.listeners=Object.create(null),t?.skip||i("plugin:window|create",{options:{...t,parent:"string"==typeof t.parent?t.parent:t.parent?.label,label:e}}).then((async()=>this.emit("tauri://created"))).catch((async e=>this.emit("tauri://error",e)))}static getByLabel(e){return b().find((t=>t.label===e))??null}static getCurrent(){return w()}static getAll(){return b()}static async getFocusedWindow(){for(const e of b())if(await e.isFocused())return e;return null}async listen(e,t){return this._handleTauriEvent(e,t)?Promise.resolve((()=>{const i=this.listeners[e];i.splice(i.indexOf(t),1)})):d(e,t,{target:{kind:"Window",label:this.label}})}async once(e,t){return this._handleTauriEvent(e,t)?Promise.resolve((()=>{const i=this.listeners[e];i.splice(i.indexOf(t),1)})):async function(e,t,i){return d(e,(i=>{t(i),c(e,i.id).catch((()=>{}))}),i)}(e,t,{target:{kind:"Window",label:this.label}})}async emit(e,t){if(p.includes(e)){for(const i of this.listeners[e]||[])i({event:e,id:-1,payload:t});return Promise.resolve()}return async function(e,t){await i("plugin:event|emit",{event:e,payload:t})}(e,t)}async emitTo(e,t,n){if(p.includes(t)){for(const e of this.listeners[t]||[])e({event:t,id:-1,payload:n});return Promise.resolve()}return async function(e,t,n){const a="string"==typeof e?{kind:"AnyLabel",label:e}:e;await i("plugin:event|emit_to",{target:a,event:t,payload:n})}(e,t,n)}_handleTauriEvent(e,t){return!!p.includes(e)&&(e in this.listeners?this.listeners[e].push(t):this.listeners[e]=[t],!0)}async scaleFactor(){return i("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return i("plugin:window|inner_position",{label:this.label}).then((({x:e,y:t})=>new s(e,t)))}async outerPosition(){return i("plugin:window|outer_position",{label:this.label}).then((({x:e,y:t})=>new s(e,t)))}async innerSize(){return i("plugin:window|inner_size",{label:this.label}).then((({width:e,height:t})=>new a(e,t)))}async outerSize(){return i("plugin:window|outer_size",{label:this.label}).then((({width:e,height:t})=>new a(e,t)))}async isFullscreen(){return i("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return i("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return i("plugin:window|is_maximized",{label:this.label})}async isFocused(){return i("plugin:window|is_focused",{label:this.label})}async isDecorated(){return i("plugin:window|is_decorated",{label:this.label})}async isResizable(){return i("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return i("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return i("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return i("plugin:window|is_closable",{label:this.label})}async isVisible(){return i("plugin:window|is_visible",{label:this.label})}async title(){return i("plugin:window|title",{label:this.label})}async theme(){return i("plugin:window|theme",{label:this.label})}async center(){return i("plugin:window|center",{label:this.label})}async requestUserAttention(e){let t=null;return e&&(t=e===o.Critical?{type:"Critical"}:{type:"Informational"}),i("plugin:window|request_user_attention",{label:this.label,value:t})}async setResizable(e){return i("plugin:window|set_resizable",{label:this.label,value:e})}async setMaximizable(e){return i("plugin:window|set_maximizable",{label:this.label,value:e})}async setMinimizable(e){return i("plugin:window|set_minimizable",{label:this.label,value:e})}async setClosable(e){return i("plugin:window|set_closable",{label:this.label,value:e})}async setTitle(e){return i("plugin:window|set_title",{label:this.label,value:e})}async maximize(){return i("plugin:window|maximize",{label:this.label})}async unmaximize(){return i("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return i("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return i("plugin:window|minimize",{label:this.label})}async unminimize(){return i("plugin:window|unminimize",{label:this.label})}async show(){return i("plugin:window|show",{label:this.label})}async hide(){return i("plugin:window|hide",{label:this.label})}async close(){return i("plugin:window|close",{label:this.label})}async destroy(){return i("plugin:window|destroy",{label:this.label})}async setDecorations(e){return i("plugin:window|set_decorations",{label:this.label,value:e})}async setShadow(e){return i("plugin:window|set_shadow",{label:this.label,value:e})}async setEffects(e){return i("plugin:window|set_effects",{label:this.label,value:e})}async clearEffects(){return i("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(e){return i("plugin:window|set_always_on_top",{label:this.label,value:e})}async setAlwaysOnBottom(e){return i("plugin:window|set_always_on_bottom",{label:this.label,value:e})}async setContentProtected(e){return i("plugin:window|set_content_protected",{label:this.label,value:e})}async setSize(e){if(!e||"Logical"!==e.type&&"Physical"!==e.type)throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return i("plugin:window|set_size",{label:this.label,value:{type:e.type,data:{width:e.width,height:e.height}}})}async setMinSize(e){if(e&&"Logical"!==e.type&&"Physical"!==e.type)throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return i("plugin:window|set_min_size",{label:this.label,value:e?{type:e.type,data:{width:e.width,height:e.height}}:null})}async setMaxSize(e){if(e&&"Logical"!==e.type&&"Physical"!==e.type)throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return i("plugin:window|set_max_size",{label:this.label,value:e?{type:e.type,data:{width:e.width,height:e.height}}:null})}async setPosition(e){if(!e||"Logical"!==e.type&&"Physical"!==e.type)throw new Error("the `position` argument must be either a LogicalPosition or a PhysicalPosition instance");return i("plugin:window|set_position",{label:this.label,value:{type:e.type,data:{x:e.x,y:e.y}}})}async setFullscreen(e){return i("plugin:window|set_fullscreen",{label:this.label,value:e})}async setFocus(){return i("plugin:window|set_focus",{label:this.label})}async setIcon(e){return i("plugin:window|set_icon",{label:this.label,value:"string"==typeof e?e:Array.from(e)})}async setSkipTaskbar(e){return i("plugin:window|set_skip_taskbar",{label:this.label,value:e})}async setCursorGrab(e){return i("plugin:window|set_cursor_grab",{label:this.label,value:e})}async setCursorVisible(e){return i("plugin:window|set_cursor_visible",{label:this.label,value:e})}async setCursorIcon(e){return i("plugin:window|set_cursor_icon",{label:this.label,value:e})}async setCursorPosition(e){if(!e||"Logical"!==e.type&&"Physical"!==e.type)throw new Error("the `position` argument must be either a LogicalPosition or a PhysicalPosition instance");return i("plugin:window|set_cursor_position",{label:this.label,value:{type:e.type,data:{x:e.x,y:e.y}}})}async setIgnoreCursorEvents(e){return i("plugin:window|set_ignore_cursor_events",{label:this.label,value:e})}async startDragging(){return i("plugin:window|start_dragging",{label:this.label})}async startResizeDragging(e){return i("plugin:window|start_resize_dragging",{label:this.label,value:e})}async setProgressBar(e){return i("plugin:window|set_progress_bar",{label:this.label,value:e})}async setVisibleOnAllWorkspaces(e){return i("plugin:window|set_visible_on_all_workspaces",{label:this.label,value:e})}async onResized(e){return this.listen(r.WINDOW_RESIZED,(t=>{var i;t.payload=(i=t.payload,new a(i.width,i.height)),e(t)}))}async onMoved(e){return this.listen(r.WINDOW_MOVED,(t=>{t.payload=v(t.payload),e(t)}))}async onCloseRequested(e){return this.listen(r.WINDOW_CLOSE_REQUESTED,(t=>{const i=new h(t);Promise.resolve(e(i)).then((()=>{if(!i.isPreventDefault())return this.destroy()}))}))}async onFileDropEvent(e){const t=await this.listen(r.FILE_DROP,(t=>{e({...t,payload:{type:"drop",paths:t.payload.paths,position:v(t.payload.position)}})})),i=await this.listen(r.FILE_DROP_HOVER,(t=>{e({...t,payload:{type:"hover",paths:t.payload.paths,position:v(t.payload.position)}})})),n=await this.listen(r.FILE_DROP_CANCELLED,(t=>{e({...t,payload:{type:"cancel"}})}));return()=>{t(),i(),n()}}async onFocusChanged(e){const t=await this.listen(r.WINDOW_FOCUS,(t=>{e({...t,payload:!0})})),i=await this.listen(r.WINDOW_BLUR,(t=>{e({...t,payload:!1})}));return()=>{t(),i()}}async onScaleChanged(e){return this.listen(r.WINDOW_SCALE_FACTOR_CHANGED,e)}async onThemeChanged(e){return this.listen(r.WINDOW_THEME_CHANGED,e)}}var g,_,m;function v(e){return new s(e.x,e.y)}async function f(e,t){return i("plugin:window-state|restore_state",{label:e,flags:t})}return function(e){e.AppearanceBased="appearanceBased",e.Light="light",e.Dark="dark",e.MediumLight="mediumLight",e.UltraDark="ultraDark",e.Titlebar="titlebar",e.Selection="selection",e.Menu="menu",e.Popover="popover",e.Sidebar="sidebar",e.HeaderView="headerView",e.Sheet="sheet",e.WindowBackground="windowBackground",e.HudWindow="hudWindow",e.FullScreenUI="fullScreenUI",e.Tooltip="tooltip",e.ContentBackground="contentBackground",e.UnderWindowBackground="underWindowBackground",e.UnderPageBackground="underPageBackground",e.Mica="mica",e.Blur="blur",e.Acrylic="acrylic",e.Tabbed="tabbed",e.TabbedDark="tabbedDark",e.TabbedLight="tabbedLight"}(g||(g={})),function(e){e.FollowsWindowActiveState="followsWindowActiveState",e.Active="active",e.Inactive="inactive"}(_||(_={})),e.StateFlags=void 0,(m=e.StateFlags||(e.StateFlags={}))[m.SIZE=1]="SIZE",m[m.POSITION=2]="POSITION",m[m.MAXIMIZED=4]="MAXIMIZED",m[m.VISIBLE=8]="VISIBLE",m[m.DECORATIONS=16]="DECORATIONS",m[m.FULLSCREEN=32]="FULLSCREEN",m[m.ALL=63]="ALL",e.restoreState=f,e.restoreStateCurrent=async function(e){return f(w().label,e)},e.saveWindowState=async function(e){return i("plugin:window-state|save_window_state",{flags:e})},e}({});Object.defineProperty(window.__TAURI__,"windowState",{value:__TAURI_PLUGIN_WINDOWSTATE__})} diff --git a/plugins/window-state/src/cmd.rs b/plugins/window-state/src/cmd.rs index 75a390b7..99d41a82 100644 --- a/plugins/window-state/src/cmd.rs +++ b/plugins/window-state/src/cmd.rs @@ -26,9 +26,12 @@ pub async fn restore_state( .ok_or_else(|| format!("Invalid state flags bits: {}", flags))?; app.get_webview_window(&label) .ok_or_else(|| format!("Couldn't find window with label: {}", label))? - .as_ref() - .window() .restore_state(flags) .map_err(|e| e.to_string())?; Ok(()) } + +#[command] +pub fn filename(app: AppHandle) -> String { + app.filename() +} diff --git a/plugins/window-state/src/lib.rs b/plugins/window-state/src/lib.rs index 16ad75e5..50345b64 100644 --- a/plugins/window-state/src/lib.rs +++ b/plugins/window-state/src/lib.rs @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -//! [![](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/window-state/banner.png)](https://github.com/tauri-apps/plugins-workspace/tree/v2/plugins/window-state) -//! //! Save window positions and sizes and restore them when the app is reopened. #![doc( @@ -16,20 +14,26 @@ use bitflags::bitflags; use serde::{Deserialize, Serialize}; use tauri::{ plugin::{Builder as PluginBuilder, TauriPlugin}, - LogicalSize, Manager, Monitor, PhysicalPosition, PhysicalSize, RunEvent, Runtime, Window, - WindowEvent, + AppHandle, Manager, Monitor, PhysicalPosition, PhysicalSize, RunEvent, Runtime, WebviewWindow, + Window, WindowEvent, }; use std::{ collections::{HashMap, HashSet}, - fs::{create_dir_all, File}, - io::Write, + fs::create_dir_all, + io::BufReader, sync::{Arc, Mutex}, }; mod cmd; -pub const STATE_FILENAME: &str = ".window-state"; +type LabelMapperFn = dyn Fn(&str) -> &str + Send + Sync; +type FilterCallbackFn = dyn Fn(&str) -> bool + Send + Sync; + +/// Default filename used to store window state. +/// +/// If using a custom filename, you should probably use [`AppHandleExt::filename`] instead. +pub const DEFAULT_FILENAME: &str = ".window-state.json"; #[derive(Debug, thiserror::Error)] pub enum Error { @@ -38,7 +42,7 @@ pub enum Error { #[error(transparent)] Tauri(#[from] tauri::Error), #[error(transparent)] - Bincode(#[from] Box), + SerdeJson(#[from] serde_json::Error), } pub type Result = std::result::Result; @@ -61,10 +65,15 @@ impl Default for StateFlags { } } +struct PluginState { + filename: String, + map_label: Option>, +} + #[derive(Debug, Deserialize, Serialize, PartialEq)] struct WindowState { - width: f64, - height: f64, + width: u32, + height: u32, x: i32, y: i32, // prev_x and prev_y are used to store position @@ -96,33 +105,47 @@ impl Default for WindowState { } struct WindowStateCache(Arc>>); +/// Used to prevent deadlocks from resize and position event listeners setting the cached state on restoring states +struct RestoringWindowState(Mutex<()>); + pub trait AppHandleExt { /// Saves all open windows state to disk fn save_window_state(&self, flags: StateFlags) -> Result<()>; + /// Get the name of the file used to store window state. + fn filename(&self) -> String; } impl AppHandleExt for tauri::AppHandle { fn save_window_state(&self, flags: StateFlags) -> Result<()> { - if let Ok(app_dir) = self.path().app_config_dir() { - let state_path = app_dir.join(STATE_FILENAME); - let cache = self.state::(); - let mut state = cache.0.lock().unwrap(); - for (label, s) in state.iter_mut() { - if let Some(window) = self.get_webview_window(label) { - window.as_ref().window().update_state(s, flags)?; - } + let app_dir = self.path().app_config_dir()?; + let plugin_state = self.state::(); + let state_path = app_dir.join(&plugin_state.filename); + let windows = self.webview_windows(); + let cache = self.state::(); + let mut state = cache.0.lock().unwrap(); + + for (label, s) in state.iter_mut() { + let window = if let Some(map) = &plugin_state.map_label { + windows + .iter() + .find_map(|(l, window)| (map(l) == label).then_some(window)) + } else { + windows.get(label) + }; + + if let Some(window) = window { + window.update_state(s, flags)?; } - - create_dir_all(&app_dir) - .map_err(Error::Io) - .and_then(|_| File::create(state_path).map_err(Into::into)) - .and_then(|mut f| { - f.write_all(&bincode::serialize(&*state).map_err(Error::Bincode)?) - .map_err(Into::into) - }) - } else { - Ok(()) } + + create_dir_all(app_dir)?; + std::fs::write(state_path, serde_json::to_vec_pretty(&*state)?)?; + + Ok(()) + } + + fn filename(&self) -> String { + self.state::().filename.clone() } } @@ -131,30 +154,36 @@ pub trait WindowExt { fn restore_state(&self, flags: StateFlags) -> tauri::Result<()>; } +impl WindowExt for WebviewWindow { + fn restore_state(&self, flags: StateFlags) -> tauri::Result<()> { + self.as_ref().window().restore_state(flags) + } +} + impl WindowExt for Window { fn restore_state(&self, flags: StateFlags) -> tauri::Result<()> { + let plugin_state = self.app_handle().state::(); + let label = plugin_state + .map_label + .as_ref() + .map(|map| map(self.label())) + .unwrap_or_else(|| self.label()); + + let restoring_window_state = self.state::(); + let _restoring_window_lock = restoring_window_state.0.lock().unwrap(); let cache = self.state::(); let mut c = cache.0.lock().unwrap(); let mut should_show = true; - if let Some(state) = c.get(self.label()) { - // avoid restoring the default zeroed state - if *state == WindowState::default() { - return Ok(()); - } - + if let Some(state) = c + .get(label) + .filter(|state| state != &&WindowState::default()) + { if flags.contains(StateFlags::DECORATIONS) { self.set_decorations(state.decorated)?; } - if flags.contains(StateFlags::SIZE) { - self.set_size(LogicalSize { - width: state.width, - height: state.height, - })?; - } - if flags.contains(StateFlags::POSITION) { let position = (state.x, state.y).into(); let size = (state.width, state.height).into(); @@ -178,6 +207,13 @@ impl WindowExt for Window { } } + if flags.contains(StateFlags::SIZE) { + self.set_size(PhysicalSize { + width: state.width, + height: state.height, + })?; + } + if flags.contains(StateFlags::MAXIMIZED) && state.maximized { self.maximize()?; } @@ -191,11 +227,7 @@ impl WindowExt for Window { let mut metadata = WindowState::default(); if flags.contains(StateFlags::SIZE) { - let scale_factor = self - .current_monitor()? - .map(|m| m.scale_factor()) - .unwrap_or(1.); - let size = self.inner_size()?.to_logical(scale_factor); + let size = self.inner_size()?; metadata.width = size.width; metadata.height = size.height; } @@ -222,7 +254,7 @@ impl WindowExt for Window { metadata.fullscreen = self.is_fullscreen()?; } - c.insert(self.label().into(), metadata); + c.insert(label.into(), metadata); } if flags.contains(StateFlags::VISIBLE) && should_show { @@ -238,12 +270,19 @@ trait WindowExtInternal { fn update_state(&self, state: &mut WindowState, flags: StateFlags) -> tauri::Result<()>; } +impl WindowExtInternal for WebviewWindow { + fn update_state(&self, state: &mut WindowState, flags: StateFlags) -> tauri::Result<()> { + self.as_ref().window().update_state(state, flags) + } +} + impl WindowExtInternal for Window { fn update_state(&self, state: &mut WindowState, flags: StateFlags) -> tauri::Result<()> { - let is_maximized = match flags.intersects(StateFlags::MAXIMIZED | StateFlags::SIZE) { - true => self.is_maximized()?, - false => false, - }; + let is_maximized = flags + .intersects(StateFlags::MAXIMIZED | StateFlags::POSITION | StateFlags::SIZE) + && self.is_maximized()?; + let is_minimized = + flags.intersects(StateFlags::POSITION | StateFlags::SIZE) && self.is_minimized()?; if flags.contains(StateFlags::MAXIMIZED) { state.maximized = is_maximized; @@ -261,21 +300,16 @@ impl WindowExtInternal for Window { state.visible = self.is_visible()?; } - if flags.contains(StateFlags::SIZE) { - let scale_factor = self - .current_monitor()? - .map(|m| m.scale_factor()) - .unwrap_or(1.); - let size = self.inner_size()?.to_logical(scale_factor); - + if flags.contains(StateFlags::SIZE) && !is_maximized && !is_minimized { + let size = self.inner_size()?; // It doesn't make sense to save a window with 0 height or width - if size.width > 0. && size.height > 0. && !is_maximized { + if size.width > 0 && size.height > 0 { state.width = size.width; state.height = size.height; } } - if flags.contains(StateFlags::POSITION) && !is_maximized { + if flags.contains(StateFlags::POSITION) && !is_maximized && !is_minimized { let position = self.outer_position()?; state.x = position.x; state.y = position.y; @@ -288,8 +322,11 @@ impl WindowExtInternal for Window { #[derive(Default)] pub struct Builder { denylist: HashSet, + filter_callback: Option>, skip_initial_state: HashSet, state_flags: StateFlags, + map_label: Option>, + filename: Option, } impl Builder { @@ -303,60 +340,95 @@ impl Builder { self } + /// Sets a custom filename to use when saving and restoring window states from disk. + pub fn with_filename(mut self, filename: impl Into) -> Self { + self.filename.replace(filename.into()); + self + } + /// Sets a list of windows that shouldn't be tracked and managed by this plugin - /// for example splash screen windows. + /// For example, splash screen windows. pub fn with_denylist(mut self, denylist: &[&str]) -> Self { self.denylist = denylist.iter().map(|l| l.to_string()).collect(); self } + /// Sets a filter callback to exclude specific windows from being tracked. + /// Return `true` to save the state, or `false` to skip and not save it. + pub fn with_filter(mut self, filter_callback: F) -> Self + where + F: Fn(&str) -> bool + Send + Sync + 'static, + { + self.filter_callback = Some(Box::new(filter_callback)); + self + } + /// Adds the given window label to a list of windows to skip initial state restore. pub fn skip_initial_state(mut self, label: &str) -> Self { self.skip_initial_state.insert(label.into()); self } + /// Transforms the window label when saving the window state. + /// + /// This can be used to group different windows to use the same state. + pub fn map_label(mut self, map_fn: F) -> Self + where + F: Fn(&str) -> &str + Sync + Send + 'static, + { + self.map_label = Some(Box::new(map_fn)); + self + } + pub fn build(self) -> TauriPlugin { let flags = self.state_flags; + let filename = self.filename.unwrap_or_else(|| DEFAULT_FILENAME.into()); + let map_label = self.map_label; + PluginBuilder::new("window-state") - .js_init_script(include_str!("api-iife.js").to_string()) .invoke_handler(tauri::generate_handler![ cmd::save_window_state, - cmd::restore_state + cmd::restore_state, + cmd::filename ]) .setup(|app, _api| { - let cache: Arc>> = if let Ok(app_dir) = - app.path().app_config_dir() - { - let state_path = app_dir.join(STATE_FILENAME); - if state_path.exists() { - Arc::new(Mutex::new( - std::fs::read(state_path) - .map_err(Error::from) - .and_then(|state| bincode::deserialize(&state).map_err(Into::into)) - .unwrap_or_default(), - )) - } else { - Default::default() - } - } else { - Default::default() - }; - app.manage(WindowStateCache(cache)); + let cache = load_saved_window_states(app, &filename).unwrap_or_default(); + app.manage(WindowStateCache(Arc::new(Mutex::new(cache)))); + app.manage(RestoringWindowState(Mutex::new(()))); + app.manage(PluginState { + filename, + map_label, + }); Ok(()) }) .on_window_ready(move |window| { - if self.denylist.contains(window.label()) { + let plugin_state = window.app_handle().state::(); + let label = plugin_state + .map_label + .as_ref() + .map(|map| map(window.label())) + .unwrap_or_else(|| window.label()); + + // Check deny list names + if self.denylist.contains(label) { return; } - if !self.skip_initial_state.contains(window.label()) { + // Check deny list callback + if let Some(filter_callback) = &self.filter_callback { + // Don't save the state if the callback returns false + if !filter_callback(label) { + return; + } + } + + if !self.skip_initial_state.contains(label) { let _ = window.restore_state(self.state_flags); } let cache = window.state::(); let cache = cache.0.clone(); - let label = window.label().to_string(); + let label = label.to_string(); let window_clone = window.clone(); let flags = self.state_flags; @@ -379,13 +451,47 @@ impl Builder { } WindowEvent::Moved(position) if flags.contains(StateFlags::POSITION) => { - let mut c = cache.lock().unwrap(); - if let Some(state) = c.get_mut(&label) { - state.prev_x = state.x; - state.prev_y = state.y; - - state.x = position.x; - state.y = position.y; + if window_clone + .state::() + .0 + .try_lock() + .is_ok() + && !window_clone.is_minimized().unwrap_or_default() + { + let mut c = cache.lock().unwrap(); + if let Some(state) = c.get_mut(&label) { + state.prev_x = state.x; + state.prev_y = state.y; + + state.x = position.x; + state.y = position.y; + } + } + } + WindowEvent::Resized(size) if flags.contains(StateFlags::SIZE) => { + if window_clone + .state::() + .0 + .try_lock() + .is_ok() + { + // TODO: Remove once https://github.com/tauri-apps/tauri/issues/5812 is resolved. + let is_maximized = if cfg!(target_os = "macos") + && (!window_clone.is_decorated().unwrap_or_default() + || !window_clone.is_resizable().unwrap_or_default()) + { + false + } else { + window_clone.is_maximized().unwrap_or_default() + }; + + if !window_clone.is_minimized().unwrap_or_default() && !is_maximized { + let mut c = cache.lock().unwrap(); + if let Some(state) = c.get_mut(&label) { + state.width = size.width; + state.height = size.height; + } + } } } _ => {} @@ -400,14 +506,24 @@ impl Builder { } } +fn load_saved_window_states( + app: &AppHandle, + filename: &String, +) -> Result> { + let app_dir = app.path().app_config_dir()?; + let state_path = app_dir.join(filename); + let file = std::fs::File::open(state_path)?; + let reader = BufReader::new(file); + let states = serde_json::from_reader(reader)?; + Ok(states) +} + trait MonitorExt { - fn intersects(&self, position: PhysicalPosition, size: LogicalSize) -> bool; + fn intersects(&self, position: PhysicalPosition, size: PhysicalSize) -> bool; } impl MonitorExt for Monitor { - fn intersects(&self, position: PhysicalPosition, size: LogicalSize) -> bool { - let size = size.to_physical::(self.scale_factor()); - + fn intersects(&self, position: PhysicalPosition, size: PhysicalSize) -> bool { let PhysicalPosition { x, y } = *self.position(); let PhysicalSize { width, height } = *self.size(); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6aae7334..3b752a14 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,324 +1,336 @@ -lockfileVersion: '6.0' +lockfileVersion: '9.0' settings: autoInstallPeers: true excludeLinksFromLockfile: false overrides: - semver: '>=7.5.2' - optionator: '>=0.9.3' + esbuild@<0.25.0: '>=0.25.0' importers: .: devDependencies: + '@eslint/js': + specifier: 9.25.1 + version: 9.25.1 '@rollup/plugin-node-resolve': - specifier: 15.2.3 - version: 15.2.3(rollup@4.9.6) + specifier: 16.0.1 + version: 16.0.1(rollup@4.40.1) '@rollup/plugin-terser': specifier: 0.4.4 - version: 0.4.4(rollup@4.9.6) + version: 0.4.4(rollup@4.40.1) '@rollup/plugin-typescript': - specifier: 11.1.6 - version: 11.1.6(rollup@4.9.6)(typescript@5.3.3) - '@typescript-eslint/eslint-plugin': - specifier: 6.20.0 - version: 6.20.0(@typescript-eslint/parser@6.20.0)(eslint@8.56.0)(typescript@5.3.3) - '@typescript-eslint/parser': - specifier: 6.20.0 - version: 6.20.0(eslint@8.56.0)(typescript@5.3.3) + specifier: 12.1.2 + version: 12.1.2(rollup@4.40.1)(tslib@2.8.1)(typescript@5.8.3) covector: - specifier: ^0.10.2 - version: 0.10.2(mocha@10.2.0) + specifier: ^0.12.4 + version: 0.12.4(mocha@10.8.2) eslint: - specifier: 8.56.0 - version: 8.56.0 + specifier: 9.25.1 + version: 9.25.1(jiti@2.4.2) eslint-config-prettier: - specifier: 9.1.0 - version: 9.1.0(eslint@8.56.0) - eslint-config-standard-with-typescript: - specifier: 43.0.1 - version: 43.0.1(@typescript-eslint/eslint-plugin@6.20.0)(eslint-plugin-import@2.29.1)(eslint-plugin-n@16.6.2)(eslint-plugin-promise@6.1.1)(eslint@8.56.0)(typescript@5.3.3) - eslint-plugin-import: - specifier: 2.29.1 - version: 2.29.1(@typescript-eslint/parser@6.20.0)(eslint@8.56.0) - eslint-plugin-n: - specifier: 16.6.2 - version: 16.6.2(eslint@8.56.0) - eslint-plugin-promise: - specifier: 6.1.1 - version: 6.1.1(eslint@8.56.0) + specifier: 10.1.2 + version: 10.1.2(eslint@9.25.1(jiti@2.4.2)) eslint-plugin-security: - specifier: 2.1.0 - version: 2.1.0 + specifier: 3.0.1 + version: 3.0.1 prettier: - specifier: 3.2.2 - version: 3.2.2 + specifier: 3.5.3 + version: 3.5.3 rollup: - specifier: 4.9.6 - version: 4.9.6 + specifier: 4.40.1 + version: 4.40.1 + tslib: + specifier: 2.8.1 + version: 2.8.1 typescript: - specifier: 5.3.3 - version: 5.3.3 + specifier: 5.8.3 + version: 5.8.3 + typescript-eslint: + specifier: 8.31.0 + version: 8.31.0(eslint@9.25.1(jiti@2.4.2))(typescript@5.8.3) examples/api: dependencies: '@tauri-apps/api': - specifier: 2.0.0-beta.2 - version: 2.0.0-beta.2 + specifier: 2.5.0 + version: 2.5.0 '@tauri-apps/plugin-barcode-scanner': - specifier: 2.0.0-beta.1 + specifier: ^2.2.0 version: link:../../plugins/barcode-scanner '@tauri-apps/plugin-biometric': - specifier: 2.0.0-beta.1 + specifier: ^2.2.1 version: link:../../plugins/biometric '@tauri-apps/plugin-cli': - specifier: 2.0.0-beta.1 + specifier: ^2.2.0 version: link:../../plugins/cli '@tauri-apps/plugin-clipboard-manager': - specifier: 2.0.0-beta.1 + specifier: ^2.2.2 version: link:../../plugins/clipboard-manager '@tauri-apps/plugin-dialog': - specifier: 2.0.0-beta.1 + specifier: ^2.2.1 version: link:../../plugins/dialog '@tauri-apps/plugin-fs': - specifier: 2.0.0-beta.1 + specifier: ^2.2.1 version: link:../../plugins/fs + '@tauri-apps/plugin-geolocation': + specifier: ^2.2.0 + version: link:../../plugins/geolocation '@tauri-apps/plugin-global-shortcut': - specifier: 2.0.0-beta.1 + specifier: ^2.2.0 version: link:../../plugins/global-shortcut + '@tauri-apps/plugin-haptics': + specifier: ^2.2.0 + version: link:../../plugins/haptics '@tauri-apps/plugin-http': - specifier: 2.0.0-beta.1 + specifier: ^2.4.3 version: link:../../plugins/http '@tauri-apps/plugin-nfc': - specifier: 2.0.0-beta.1 + specifier: ^2.2.0 version: link:../../plugins/nfc '@tauri-apps/plugin-notification': - specifier: 2.0.0-beta.1 + specifier: ^2.2.2 version: link:../../plugins/notification + '@tauri-apps/plugin-opener': + specifier: ^2.2.6 + version: link:../../plugins/opener '@tauri-apps/plugin-os': - specifier: 2.0.0-beta.1 + specifier: ^2.2.1 version: link:../../plugins/os '@tauri-apps/plugin-process': - specifier: 2.0.0-beta.1 + specifier: ^2.2.1 version: link:../../plugins/process '@tauri-apps/plugin-shell': - specifier: 2.0.0-beta.1 + specifier: ^2.2.1 version: link:../../plugins/shell + '@tauri-apps/plugin-store': + specifier: ^2.2.0 + version: link:../../plugins/store '@tauri-apps/plugin-updater': - specifier: 2.0.0-beta.1 + specifier: ^2.7.1 version: link:../../plugins/updater '@zerodevx/svelte-json-view': - specifier: 1.0.7 - version: 1.0.7(svelte@4.2.8) + specifier: 1.0.11 + version: 1.0.11(svelte@5.20.4) devDependencies: '@iconify-json/codicon': - specifier: ^1.1.37 - version: 1.1.37 + specifier: ^1.2.12 + version: 1.2.12 '@iconify-json/ph': - specifier: ^1.1.8 - version: 1.1.8 + specifier: ^1.2.2 + version: 1.2.2 '@sveltejs/vite-plugin-svelte': - specifier: ^3.0.1 - version: 3.0.1(svelte@4.2.8)(vite@5.0.12) + specifier: ^5.0.3 + version: 5.0.3(svelte@5.20.4)(vite@6.2.6(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.2)) '@tauri-apps/cli': - specifier: 2.0.0-beta.3 - version: 2.0.0-beta.3 + specifier: 2.5.0 + version: 2.5.0 '@unocss/extractor-svelte': - specifier: ^0.58.0 - version: 0.58.0 - internal-ip: - specifier: ^8.0.0 - version: 8.0.0 + specifier: ^66.0.0 + version: 66.0.0 svelte: - specifier: ^4.2.8 - version: 4.2.8 + specifier: ^5.20.4 + version: 5.20.4 unocss: - specifier: ^0.58.0 - version: 0.58.0(postcss@8.4.32)(vite@5.0.12) + specifier: ^66.0.0 + version: 66.0.0(postcss@8.5.3)(vite@6.2.6(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.2))(vue@3.5.13(typescript@5.8.3)) vite: - specifier: ^5.0.12 - version: 5.0.12 - - plugins/authenticator: - dependencies: - '@tauri-apps/api': - specifier: 2.0.0-beta.2 - version: 2.0.0-beta.2 + specifier: ^6.2.6 + version: 6.2.6(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.2) plugins/autostart: dependencies: '@tauri-apps/api': - specifier: 2.0.0-beta.2 - version: 2.0.0-beta.2 + specifier: ^2.0.0 + version: 2.5.0 plugins/barcode-scanner: dependencies: '@tauri-apps/api': - specifier: 2.0.0-beta.2 - version: 2.0.0-beta.2 + specifier: ^2.0.0 + version: 2.5.0 plugins/biometric: dependencies: '@tauri-apps/api': - specifier: 2.0.0-beta.2 - version: 2.0.0-beta.2 - devDependencies: - tslib: - specifier: 2.6.0 - version: 2.6.0 + specifier: ^2.0.0 + version: 2.5.0 plugins/cli: dependencies: '@tauri-apps/api': - specifier: 2.0.0-beta.2 - version: 2.0.0-beta.2 + specifier: ^2.0.0 + version: 2.5.0 plugins/clipboard-manager: dependencies: '@tauri-apps/api': - specifier: 2.0.0-beta.2 - version: 2.0.0-beta.2 + specifier: ^2.0.0 + version: 2.5.0 plugins/deep-link: dependencies: '@tauri-apps/api': - specifier: 2.0.0-beta.2 - version: 2.0.0-beta.2 + specifier: ^2.0.0 + version: 2.5.0 plugins/deep-link/examples/app: dependencies: '@tauri-apps/api': - specifier: 2.0.0-beta.2 - version: 2.0.0-beta.2 + specifier: 2.5.0 + version: 2.5.0 '@tauri-apps/plugin-deep-link': - specifier: 2.0.0-beta.1 + specifier: 2.2.1 version: link:../.. devDependencies: '@tauri-apps/cli': - specifier: 2.0.0-beta.3 - version: 2.0.0-beta.3 - internal-ip: - specifier: ^8.0.0 - version: 8.0.0 + specifier: 2.5.0 + version: 2.5.0 typescript: - specifier: ^5.2.2 - version: 5.3.2 + specifier: ^5.7.3 + version: 5.8.3 vite: - specifier: ^5.0.12 - version: 5.0.12 + specifier: ^6.2.6 + version: 6.2.6(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.2) plugins/dialog: dependencies: '@tauri-apps/api': - specifier: 2.0.0-beta.2 - version: 2.0.0-beta.2 + specifier: ^2.0.0 + version: 2.5.0 plugins/fs: dependencies: '@tauri-apps/api': - specifier: 2.0.0-beta.2 - version: 2.0.0-beta.2 + specifier: ^2.0.0 + version: 2.5.0 + + plugins/geolocation: + dependencies: + '@tauri-apps/api': + specifier: ^2.0.0 + version: 2.5.0 plugins/global-shortcut: dependencies: '@tauri-apps/api': - specifier: 2.0.0-beta.2 - version: 2.0.0-beta.2 + specifier: ^2.0.0 + version: 2.5.0 + + plugins/haptics: + dependencies: + '@tauri-apps/api': + specifier: ^2.0.0 + version: 2.5.0 plugins/http: dependencies: '@tauri-apps/api': - specifier: 2.0.0-beta.2 - version: 2.0.0-beta.2 + specifier: ^2.0.0 + version: 2.5.0 plugins/log: dependencies: '@tauri-apps/api': - specifier: 2.0.0-beta.2 - version: 2.0.0-beta.2 + specifier: ^2.0.0 + version: 2.5.0 plugins/nfc: dependencies: '@tauri-apps/api': - specifier: 2.0.0-beta.2 - version: 2.0.0-beta.2 - devDependencies: - tslib: - specifier: 2.6.0 - version: 2.6.0 + specifier: ^2.0.0 + version: 2.5.0 plugins/notification: dependencies: '@tauri-apps/api': - specifier: 2.0.0-beta.2 - version: 2.0.0-beta.2 + specifier: ^2.0.0 + version: 2.5.0 + + plugins/opener: + dependencies: + '@tauri-apps/api': + specifier: ^2.0.0 + version: 2.5.0 plugins/os: dependencies: '@tauri-apps/api': - specifier: 2.0.0-beta.2 - version: 2.0.0-beta.2 + specifier: ^2.0.0 + version: 2.5.0 plugins/positioner: dependencies: '@tauri-apps/api': - specifier: 2.0.0-beta.2 - version: 2.0.0-beta.2 + specifier: ^2.0.0 + version: 2.5.0 plugins/process: dependencies: '@tauri-apps/api': - specifier: 2.0.0-beta.2 - version: 2.0.0-beta.2 + specifier: ^2.0.0 + version: 2.5.0 plugins/shell: dependencies: '@tauri-apps/api': - specifier: 2.0.0-beta.2 - version: 2.0.0-beta.2 + specifier: ^2.0.0 + version: 2.5.0 plugins/single-instance/examples/vanilla: devDependencies: '@tauri-apps/cli': - specifier: 2.0.0-beta.3 - version: 2.0.0-beta.3 + specifier: 2.5.0 + version: 2.5.0 plugins/sql: dependencies: '@tauri-apps/api': - specifier: 2.0.0-beta.2 - version: 2.0.0-beta.2 + specifier: ^2.0.0 + version: 2.5.0 plugins/store: dependencies: '@tauri-apps/api': - specifier: 2.0.0-beta.2 - version: 2.0.0-beta.2 + specifier: ^2.0.0 + version: 2.5.0 + + plugins/store/examples/AppSettingsManager: + devDependencies: + '@tauri-apps/cli': + specifier: 2.5.0 + version: 2.5.0 + typescript: + specifier: ^5.7.3 + version: 5.8.3 + vite: + specifier: ^6.2.6 + version: 6.2.6(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.2) plugins/stronghold: dependencies: '@tauri-apps/api': - specifier: 2.0.0-beta.2 - version: 2.0.0-beta.2 + specifier: ^2.0.0 + version: 2.5.0 plugins/updater: dependencies: '@tauri-apps/api': - specifier: 2.0.0-beta.2 - version: 2.0.0-beta.2 + specifier: ^2.0.0 + version: 2.5.0 plugins/upload: dependencies: '@tauri-apps/api': - specifier: 2.0.0-beta.2 - version: 2.0.0-beta.2 + specifier: ^2.0.0 + version: 2.5.0 plugins/websocket: dependencies: '@tauri-apps/api': - specifier: 2.0.0-beta.2 - version: 2.0.0-beta.2 + specifier: ^2.0.0 + version: 2.5.0 plugins/websocket/examples/tauri-app: dependencies: @@ -327,871 +339,376 @@ importers: version: link:../.. devDependencies: '@tauri-apps/cli': - specifier: 2.0.0-beta.3 - version: 2.0.0-beta.3 + specifier: 2.5.0 + version: 2.5.0 typescript: - specifier: ^5.3.3 - version: 5.3.3 + specifier: ^5.7.3 + version: 5.8.3 vite: - specifier: ^5.0.12 - version: 5.0.12 + specifier: ^6.2.6 + version: 6.2.6(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.2) plugins/window-state: dependencies: '@tauri-apps/api': - specifier: 2.0.0-beta.2 - version: 2.0.0-beta.2 + specifier: ^2.0.0 + version: 2.5.0 packages: - /@aashutoshrathi/word-wrap@1.2.6: - resolution: {integrity: sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==} - engines: {node: '>=0.10.0'} - dev: true - - /@ampproject/remapping@2.2.1: - resolution: {integrity: sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==} + '@ampproject/remapping@2.3.0': + resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==} engines: {node: '>=6.0.0'} - dependencies: - '@jridgewell/gen-mapping': 0.3.3 - '@jridgewell/trace-mapping': 0.3.20 - - /@antfu/install-pkg@0.1.1: - resolution: {integrity: sha512-LyB/8+bSfa0DFGC06zpCEfs89/XoWZwws5ygEa5D+Xsm3OfI+aXQ86VgVG7Acyef+rSZ5HE7J8rrxzrQeM3PjQ==} - dependencies: - execa: 5.1.1 - find-up: 5.0.0 - dev: true - - /@antfu/utils@0.7.6: - resolution: {integrity: sha512-pvFiLP2BeOKA/ZOS6jxx4XhKzdVLHDhGlFEaZ2flWWYf2xOqVniqpk38I04DFRyz+L0ASggl7SkItTc+ZLju4w==} - dev: true - - /@babel/code-frame@7.23.5: - resolution: {integrity: sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/highlight': 7.23.4 - chalk: 2.4.2 - dev: true - - /@babel/compat-data@7.23.5: - resolution: {integrity: sha512-uU27kfDRlhfKl+w1U6vp16IuvSLtjAxdArVXPa9BvLkrr7CYIsxH5adpHObeAGY/41+syctUWOZ140a2Rvkgjw==} - engines: {node: '>=6.9.0'} - dev: true - - /@babel/core@7.23.5: - resolution: {integrity: sha512-Cwc2XjUrG4ilcfOw4wBAK+enbdgwAcAJCfGUItPBKR7Mjw4aEfAFYrLxeRp4jWgtNIKn3n2AlBOfwwafl+42/g==} - engines: {node: '>=6.9.0'} - dependencies: - '@ampproject/remapping': 2.2.1 - '@babel/code-frame': 7.23.5 - '@babel/generator': 7.23.5 - '@babel/helper-compilation-targets': 7.22.15 - '@babel/helper-module-transforms': 7.23.3(@babel/core@7.23.5) - '@babel/helpers': 7.23.5 - '@babel/parser': 7.23.5 - '@babel/template': 7.22.15 - '@babel/traverse': 7.23.5 - '@babel/types': 7.23.5 - convert-source-map: 2.0.0 - debug: 4.3.4 - gensync: 1.0.0-beta.2 - json5: 2.2.3 - semver: 7.5.4 - transitivePeerDependencies: - - supports-color - dev: true - - /@babel/generator@7.23.5: - resolution: {integrity: sha512-BPssCHrBD+0YrxviOa3QzpqwhNIXKEtOa2jQrm4FlmkC2apYgRnQcmPWiGZDlGxiNtltnUFolMe8497Esry+jA==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/types': 7.23.5 - '@jridgewell/gen-mapping': 0.3.3 - '@jridgewell/trace-mapping': 0.3.20 - jsesc: 2.5.2 - dev: true - - /@babel/helper-annotate-as-pure@7.22.5: - resolution: {integrity: sha512-LvBTxu8bQSQkcyKOU+a1btnNFQ1dMAd0R6PyW3arXes06F6QLWLIrd681bxRPIXlrMGR3XYnW9JyML7dP3qgxg==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/types': 7.23.5 - dev: true - - /@babel/helper-compilation-targets@7.22.15: - resolution: {integrity: sha512-y6EEzULok0Qvz8yyLkCvVX+02ic+By2UdOhylwUOvOn9dvYc9mKICJuuU1n1XBI02YWsNsnrY1kc6DVbjcXbtw==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/compat-data': 7.23.5 - '@babel/helper-validator-option': 7.23.5 - browserslist: 4.22.2 - lru-cache: 5.1.1 - semver: 7.5.4 - dev: true - - /@babel/helper-create-class-features-plugin@7.23.5(@babel/core@7.23.5): - resolution: {integrity: sha512-QELlRWxSpgdwdJzSJn4WAhKC+hvw/AtHbbrIoncKHkhKKR/luAlKkgBDcri1EzWAo8f8VvYVryEHN4tax/V67A==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0 - dependencies: - '@babel/core': 7.23.5 - '@babel/helper-annotate-as-pure': 7.22.5 - '@babel/helper-environment-visitor': 7.22.20 - '@babel/helper-function-name': 7.23.0 - '@babel/helper-member-expression-to-functions': 7.23.0 - '@babel/helper-optimise-call-expression': 7.22.5 - '@babel/helper-replace-supers': 7.22.20(@babel/core@7.23.5) - '@babel/helper-skip-transparent-expression-wrappers': 7.22.5 - '@babel/helper-split-export-declaration': 7.22.6 - semver: 7.5.4 - dev: true - - /@babel/helper-environment-visitor@7.22.20: - resolution: {integrity: sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==} - engines: {node: '>=6.9.0'} - dev: true - - /@babel/helper-function-name@7.23.0: - resolution: {integrity: sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/template': 7.22.15 - '@babel/types': 7.23.5 - dev: true - - /@babel/helper-hoist-variables@7.22.5: - resolution: {integrity: sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/types': 7.23.5 - dev: true - - /@babel/helper-member-expression-to-functions@7.23.0: - resolution: {integrity: sha512-6gfrPwh7OuT6gZyJZvd6WbTfrqAo7vm4xCzAXOusKqq/vWdKXphTpj5klHKNmRUU6/QRGlBsyU9mAIPaWHlqJA==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/types': 7.23.5 - dev: true - - /@babel/helper-module-imports@7.22.15: - resolution: {integrity: sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/types': 7.23.5 - dev: true - /@babel/helper-module-transforms@7.23.3(@babel/core@7.23.5): - resolution: {integrity: sha512-7bBs4ED9OmswdfDzpz4MpWgSrV7FXlc3zIagvLFjS5H+Mk7Snr21vQ6QwrsoCGMfNC4e4LQPdoULEt4ykz0SRQ==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0 - dependencies: - '@babel/core': 7.23.5 - '@babel/helper-environment-visitor': 7.22.20 - '@babel/helper-module-imports': 7.22.15 - '@babel/helper-simple-access': 7.22.5 - '@babel/helper-split-export-declaration': 7.22.6 - '@babel/helper-validator-identifier': 7.22.20 - dev: true - - /@babel/helper-optimise-call-expression@7.22.5: - resolution: {integrity: sha512-HBwaojN0xFRx4yIvpwGqxiV2tUfl7401jlok564NgB9EHS1y6QT17FmKWm4ztqjeVdXLuC4fSvHc5ePpQjoTbw==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/types': 7.23.5 - dev: true - - /@babel/helper-plugin-utils@7.22.5: - resolution: {integrity: sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==} - engines: {node: '>=6.9.0'} - dev: true - - /@babel/helper-replace-supers@7.22.20(@babel/core@7.23.5): - resolution: {integrity: sha512-qsW0In3dbwQUbK8kejJ4R7IHVGwHJlV6lpG6UA7a9hSa2YEiAib+N1T2kr6PEeUT+Fl7najmSOS6SmAwCHK6Tw==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0 - dependencies: - '@babel/core': 7.23.5 - '@babel/helper-environment-visitor': 7.22.20 - '@babel/helper-member-expression-to-functions': 7.23.0 - '@babel/helper-optimise-call-expression': 7.22.5 - dev: true - - /@babel/helper-simple-access@7.22.5: - resolution: {integrity: sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/types': 7.23.5 - dev: true - - /@babel/helper-skip-transparent-expression-wrappers@7.22.5: - resolution: {integrity: sha512-tK14r66JZKiC43p8Ki33yLBVJKlQDFoA8GYN67lWCDCqoL6EMMSuM9b+Iff2jHaM/RRFYl7K+iiru7hbRqNx8Q==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/types': 7.23.5 - dev: true + '@antfu/install-pkg@1.0.0': + resolution: {integrity: sha512-xvX6P/lo1B3ej0OsaErAjqgFYzYVcJpamjLAFLYh9vRJngBrMoUG7aVnrGTeqM7yxbyTD5p3F2+0/QUEh8Vzhw==} - /@babel/helper-split-export-declaration@7.22.6: - resolution: {integrity: sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/types': 7.23.5 - dev: true - - /@babel/helper-string-parser@7.23.4: - resolution: {integrity: sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ==} - engines: {node: '>=6.9.0'} - dev: true - - /@babel/helper-validator-identifier@7.22.20: - resolution: {integrity: sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==} - engines: {node: '>=6.9.0'} - dev: true - - /@babel/helper-validator-option@7.23.5: - resolution: {integrity: sha512-85ttAOMLsr53VgXkTbkx8oA6YTfT4q7/HzXSLEYmjcSTJPMPQtvq1BD79Byep5xMUYbGRzEpDsjUf3dyp54IKw==} - engines: {node: '>=6.9.0'} - dev: true + '@antfu/utils@8.1.1': + resolution: {integrity: sha512-Mex9nXf9vR6AhcXmMrlz/HVgYYZpVGJ6YlPgwl7UnaFpnshXs6EK/oa5Gpf3CzENMjkvEx2tQtntGnb7UtSTOQ==} - /@babel/helpers@7.23.5: - resolution: {integrity: sha512-oO7us8FzTEsG3U6ag9MfdF1iA/7Z6dz+MtFhifZk8C8o453rGJFFWUP1t+ULM9TUIAzC9uxXEiXjOiVMyd7QPg==} + '@babel/helper-string-parser@7.25.9': + resolution: {integrity: sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==} engines: {node: '>=6.9.0'} - dependencies: - '@babel/template': 7.22.15 - '@babel/traverse': 7.23.5 - '@babel/types': 7.23.5 - transitivePeerDependencies: - - supports-color - dev: true - /@babel/highlight@7.23.4: - resolution: {integrity: sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==} + '@babel/helper-validator-identifier@7.25.9': + resolution: {integrity: sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==} engines: {node: '>=6.9.0'} - dependencies: - '@babel/helper-validator-identifier': 7.22.20 - chalk: 2.4.2 - js-tokens: 4.0.0 - dev: true - /@babel/parser@7.23.5: - resolution: {integrity: sha512-hOOqoiNXrmGdFbhgCzu6GiURxUgM27Xwd/aPuu8RfHEZPBzL1Z54okAHAQjXfcQNwvrlkAmAp4SlRTZ45vlthQ==} + '@babel/parser@7.27.0': + resolution: {integrity: sha512-iaepho73/2Pz7w2eMS0Q5f83+0RKI7i4xmiYeBmDzfRVbQtTOG7Ts0S4HzJVsTMGI9keU8rNfuZr8DKfSt7Yyg==} engines: {node: '>=6.0.0'} hasBin: true - dependencies: - '@babel/types': 7.23.5 - dev: true - - /@babel/plugin-syntax-jsx@7.23.3(@babel/core@7.23.5): - resolution: {integrity: sha512-EB2MELswq55OHUoRZLGg/zC7QWUKfNLpE57m/S2yr1uEneIgsTgrSzXP3NXEsMkVn76OlaVVnzN+ugObuYGwhg==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - dependencies: - '@babel/core': 7.23.5 - '@babel/helper-plugin-utils': 7.22.5 - dev: true - - /@babel/plugin-syntax-typescript@7.23.3(@babel/core@7.23.5): - resolution: {integrity: sha512-9EiNjVJOMwCO+43TqoTrgQ8jMwcAd0sWyXi9RPfIsLTj4R2MADDDQXELhffaUx/uJv2AYcxBgPwH6j4TIA4ytQ==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - dependencies: - '@babel/core': 7.23.5 - '@babel/helper-plugin-utils': 7.22.5 - dev: true - - /@babel/plugin-transform-modules-commonjs@7.23.3(@babel/core@7.23.5): - resolution: {integrity: sha512-aVS0F65LKsdNOtcz6FRCpE4OgsP2OFnW46qNxNIX9h3wuzaNcSQsJysuMwqSibC98HPrf2vCgtxKNwS0DAlgcA==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - dependencies: - '@babel/core': 7.23.5 - '@babel/helper-module-transforms': 7.23.3(@babel/core@7.23.5) - '@babel/helper-plugin-utils': 7.22.5 - '@babel/helper-simple-access': 7.22.5 - dev: true - /@babel/plugin-transform-typescript@7.23.5(@babel/core@7.23.5): - resolution: {integrity: sha512-2fMkXEJkrmwgu2Bsv1Saxgj30IXZdJ+84lQcKKI7sm719oXs0BBw2ZENKdJdR1PjWndgLCEBNXJOri0fk7RYQA==} + '@babel/types@7.27.0': + resolution: {integrity: sha512-H45s8fVLYjbhFH62dIJ3WtmJ6RSPt/3DRO0ZcT2SUiYiQyz3BLVb9ADEnLl91m74aQPS3AzzeajZHYOalWe3bg==} engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - dependencies: - '@babel/core': 7.23.5 - '@babel/helper-annotate-as-pure': 7.22.5 - '@babel/helper-create-class-features-plugin': 7.23.5(@babel/core@7.23.5) - '@babel/helper-plugin-utils': 7.22.5 - '@babel/plugin-syntax-typescript': 7.23.3(@babel/core@7.23.5) - dev: true - /@babel/preset-typescript@7.23.3(@babel/core@7.23.5): - resolution: {integrity: sha512-17oIGVlqz6CchO9RFYn5U6ZpWRZIngayYCtrPRSgANSwC2V1Jb+iP74nVxzzXJte8b8BYxrL1yY96xfhTBrNNQ==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - dependencies: - '@babel/core': 7.23.5 - '@babel/helper-plugin-utils': 7.22.5 - '@babel/helper-validator-option': 7.23.5 - '@babel/plugin-syntax-jsx': 7.23.3(@babel/core@7.23.5) - '@babel/plugin-transform-modules-commonjs': 7.23.3(@babel/core@7.23.5) - '@babel/plugin-transform-typescript': 7.23.5(@babel/core@7.23.5) - dev: true - - /@babel/template@7.22.15: - resolution: {integrity: sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/code-frame': 7.23.5 - '@babel/parser': 7.23.5 - '@babel/types': 7.23.5 - dev: true + '@chainsafe/abort-controller@3.0.1': + resolution: {integrity: sha512-oyq0qgFJDIIgLpyPwTv4j/sHX/MITatFzY3/b42VSldyZfnUC1lYBx5RwFvzBv1Sq4APOj2VCZO23pDRwy5kew==} + engines: {node: '>=6.5'} - /@babel/traverse@7.23.5: - resolution: {integrity: sha512-czx7Xy5a6sapWWRx61m1Ke1Ra4vczu1mCTtJam5zRTBOonfdJ+S/B6HYmGYu3fJtr8GGET3si6IhgWVBhJ/m8w==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/code-frame': 7.23.5 - '@babel/generator': 7.23.5 - '@babel/helper-environment-visitor': 7.22.20 - '@babel/helper-function-name': 7.23.0 - '@babel/helper-hoist-variables': 7.22.5 - '@babel/helper-split-export-declaration': 7.22.6 - '@babel/parser': 7.23.5 - '@babel/types': 7.23.5 - debug: 4.3.4 - globals: 11.12.0 - transitivePeerDependencies: - - supports-color - dev: true + '@clack/core@0.3.5': + resolution: {integrity: sha512-5cfhQNH+1VQ2xLQlmzXMqUoiaH0lRBq9/CLW9lTyMbuKLC3+xEK01tHVvyut++mLOn5urSHmkm6I0Lg9MaJSTQ==} - /@babel/types@7.23.5: - resolution: {integrity: sha512-ON5kSOJwVO6xXVRTvOI0eOnWe7VdUcIpsovGo9U/Br4Ie4UVFQTboO2cYnDhAGU6Fp+UxSiT+pMft0SMHfuq6w==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/helper-string-parser': 7.23.4 - '@babel/helper-validator-identifier': 7.22.20 - to-fast-properties: 2.0.0 - dev: true + '@clack/prompts@0.7.0': + resolution: {integrity: sha512-0MhX9/B4iL6Re04jPrttDm+BsP8y6mS7byuv0BvXgdXhbV5PdlsHt55dvNsuBCPZ7xq1oTAOOuotR9NFbQyMSA==} + bundledDependencies: + - is-unicode-supported - /@chainsafe/abort-controller@3.0.1: - resolution: {integrity: sha512-oyq0qgFJDIIgLpyPwTv4j/sHX/MITatFzY3/b42VSldyZfnUC1lYBx5RwFvzBv1Sq4APOj2VCZO23pDRwy5kew==} - engines: {node: '>=6.5'} - dependencies: - event-target-shim: 5.0.1 - dev: true + '@covector/apply@0.10.0': + resolution: {integrity: sha512-/LB0kG0RGsqcQopjg6FX94fUDaVrPSpsU5CaKbdOWXGzRBwMa4MZxiGu1S8mji3xcLE6ALUBQNZpyOKsfxXaGQ==} - /@covector/apply@0.9.2(mocha@10.2.0): - resolution: {integrity: sha512-XrNujG6ERUq8bwPCQgOEzuwBCSLKV5nC4AuO+QBpuC0xA9Qz9w025YKYNMIsXxVf0SBscMXKzhBAo9iUDTzKFw==} - dependencies: - '@covector/files': 0.7.1 - effection: 2.0.8(mocha@10.2.0) - semver: 7.5.4 - transitivePeerDependencies: - - encoding - - mocha - dev: true + '@covector/assemble@0.12.0': + resolution: {integrity: sha512-lBXUzc3aIWKW6Xf5I2WhWNi4Eabteu+3GmrKwrxIs5ofBBZDi8ZDd1Sfuh7yraPV7+ytDm2CHc+cJFLzoJYWAQ==} - /@covector/assemble@0.10.3(mocha@10.2.0): - resolution: {integrity: sha512-LcltbmTDHeCouIGvDJ268UQ2T/JGOjt/vE4lT15BOq3F+RjTdE3B+1XmhhkFzP6Ebp6hnU5mZXFDmWqqrQKWFA==} - dependencies: - '@covector/command': 0.7.0(mocha@10.2.0) - '@covector/files': 0.7.1 - effection: 2.0.8(mocha@10.2.0) - js-yaml: 4.1.0 - lodash: 4.17.21 - remark-frontmatter: 3.0.0 - remark-parse: 9.0.0 - remark-stringify: 9.0.1 - unified: 9.2.2 - transitivePeerDependencies: - - encoding - - mocha - - supports-color - dev: true + '@covector/changelog@0.12.0': + resolution: {integrity: sha512-cWjCdhpRpyeYPh1sRmc+5nAKBNiu/3aYOWt2uEmviDemM2PPa3lMQwn3snmH717MNE+68vhWjKd/9/dhBM1W4Q==} - /@covector/changelog@0.10.1(mocha@10.2.0): - resolution: {integrity: sha512-p1kDf6abq8TAKIzLMcieMD+hoP4RamykoPpk3PYHUhZnz0xi1+8sVGEPByCQGb3SI9PCg8CZPuyIA91YtuiTsQ==} - dependencies: - '@covector/files': 0.7.1 - effection: 2.0.8(mocha@10.2.0) - lodash: 4.17.21 - remark-parse: 9.0.0 - remark-stringify: 9.0.1 - unified: 9.2.2 - transitivePeerDependencies: - - encoding - - mocha - - supports-color - dev: true + '@covector/command@0.8.0': + resolution: {integrity: sha512-6KDgmQXc8/lSrTJsSfw+zjl+qcW9jy71UXFf1sJ49jUDBKs3dh6RTW3fjjIxYQ9SG1mZ0eGOZbuG5pI1mYvn1Q==} - /@covector/command@0.7.0(mocha@10.2.0): - resolution: {integrity: sha512-9DGx4tOY9Fkd4AlYbOE0rnesYAYJm7Wr6BUBJlRxErtA0vDAejZ0+jVHZbemB1MbLOaYWXkDf/wD7SLnf06gfw==} - dependencies: - '@effection/process': 2.1.4(mocha@10.2.0) - effection: 2.0.8(mocha@10.2.0) - strip-ansi: 6.0.1 - transitivePeerDependencies: - - encoding - - mocha - dev: true + '@covector/files@0.8.0': + resolution: {integrity: sha512-cx0bexTWFYdBnta55U8+c4p7ekzS5AZ8A2R9OXWZDVFajvH7LzPEXgvwi0IfVO26zzWxMyMFhHyugwUF6i+wKg==} - /@covector/files@0.7.1: - resolution: {integrity: sha512-fGMNfTkjTvgXyj5ctfGxPhxW05SNlLK3V0eiSjP2nMVLEapPtp9ZMJNGqvvoHIs1R2IxURh0iUOjA8O2zQaCfQ==} - dependencies: - '@iarna/toml': 2.2.5 - '@tauri-apps/toml': 2.2.4 - globby: 11.1.0 - js-yaml: 4.1.0 - semver: 7.5.4 - zod: 3.22.4 - zod-validation-error: 1.5.0(zod@3.22.4) - dev: true + '@covector/toml@0.2.0': + resolution: {integrity: sha512-bIKZQLaUU1hoXiN1fvae7gNB3eT/8kLo/XlPtYmj/wY+UpukrvDkoWyMz+SRwWlUOjHU2ogrhkaoWCq1BpS43Q==} + engines: {node: '>=18'} - /@effection/channel@2.0.6: + '@effection/channel@2.0.6': resolution: {integrity: sha512-ugBR6GfhUo1Ltqz472h+48k+s72hkU8x8QI9Zd7FZRuS4z1xdv8I795QgQWD5hBTgl8o36zMVCzyICQpfwwkMw==} - dependencies: - '@effection/core': 2.2.3 - '@effection/events': 2.0.6 - '@effection/stream': 2.0.6 - dev: true - /@effection/core@2.2.3: + '@effection/core@2.2.3': resolution: {integrity: sha512-arg67zzGS+24CkSSn86cDOU80XwlBv9yM4lEJEd19DZhu9J9bkf8Lktm1AP1W5UXLM5mjGjEpIeYo1k/uYF5Fw==} - dependencies: - '@chainsafe/abort-controller': 3.0.1 - dev: true - /@effection/events@2.0.6: + '@effection/events@2.0.6': resolution: {integrity: sha512-G3gHqFIvfa9b2vozkUSvRttjcnqbU+nSGbbXcU4I3lxVcvMPEaMlt4MtuM2E6KNGvABuPYLZMWFxgBmW1BzUqA==} - dependencies: - '@effection/core': 2.2.3 - '@effection/stream': 2.0.6 - dev: true - /@effection/fetch@2.0.7(mocha@10.2.0): + '@effection/fetch@2.0.7': resolution: {integrity: sha512-1lZTmhhtaGjEOMPS6UNhmKjXoJXh8n5hmSAM2d1oZUOPGMnuJaYlyqjCusdlnJF8SgJbwuek9Hux3TEyLV3c1g==} - dependencies: - '@effection/core': 2.2.3 - '@effection/mocha': 2.0.8(mocha@10.2.0) - cross-fetch: 3.1.5 - transitivePeerDependencies: - - encoding - - mocha - dev: true - /@effection/main@2.1.2: + '@effection/main@2.1.2': resolution: {integrity: sha512-202JariBwP210C3Ka+ZHLGymcAuXs8Lg8TECbawpMFhA2w58AZhQB/oc0SOGvHWDarfRjVCMmB2dvQchCAGgnQ==} - dependencies: - '@effection/core': 2.2.3 - chalk: 4.1.2 - stacktrace-parser: 0.1.10 - dev: true - /@effection/mocha@2.0.8(mocha@10.2.0): + '@effection/mocha@2.0.8': resolution: {integrity: sha512-XXL3Vhhu6w8tQNv4EJI6H0+JZBzzi8FI6caCbQdiS7M3FOON9WI3EnorpIsOtZyZoKXaH+8d9543+ufRGzyP+Q==} peerDependencies: mocha: ^10.0.0 - dependencies: - effection: 2.0.8 - mocha: 10.2.0 - dev: true - /@effection/process@2.1.4(mocha@10.2.0): + '@effection/process@2.1.4': resolution: {integrity: sha512-MBvcCwUzxma2Luk+JSc8we3qDeFEf7rt6XYg6krpytICODHs6VMp1xl8YJhfLqGFza7/WR70FPAoK34BidiIIA==} - dependencies: - cross-spawn: 7.0.3 - ctrlc-windows: 2.1.0 - effection: 2.0.8(mocha@10.2.0) - shellwords: 0.1.1 - transitivePeerDependencies: - - encoding - - mocha - dev: true - /@effection/stream@2.0.6: + '@effection/stream@2.0.6': resolution: {integrity: sha512-cAg6p5S2NKbRF418J9Df3biMY+f0vEjgW46IOyShkMyg0AK/fYXMT6GIiMB5oNGiALkTuj/xsi3DDnEcO4Of+w==} - dependencies: - '@effection/core': 2.2.3 - '@effection/subscription': 2.0.6 - dev: true - /@effection/subscription@2.0.6: + '@effection/subscription@2.0.6': resolution: {integrity: sha512-znTi75JFyC1S0YjyTtFEWNRQbhk01UxOapWELlIkZOwjGIEjcx6+G8y6n9JpZ8OGKmJQ0GBlRMZozsR5gcQvBg==} - dependencies: - '@effection/core': 2.2.3 - dev: true - /@esbuild/android-arm64@0.19.8: - resolution: {integrity: sha512-B8JbS61bEunhfx8kasogFENgQfr/dIp+ggYXwTqdbMAgGDhRa3AaPpQMuQU0rNxDLECj6FhDzk1cF9WHMVwrtA==} - engines: {node: '>=12'} + '@esbuild/aix-ppc64@0.25.2': + resolution: {integrity: sha512-wCIboOL2yXZym2cgm6mlA742s9QeJ8DjGVaL39dLN4rRwrOgOyYSnOaFPhKZGLb2ngj4EyfAFjsNJwPXZvseag==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [aix] + + '@esbuild/android-arm64@0.25.2': + resolution: {integrity: sha512-5ZAX5xOmTligeBaeNEPnPaeEuah53Id2tX4c2CVP3JaROTH+j4fnfHCkr1PjXMd78hMst+TlkfKcW/DlTq0i4w==} + engines: {node: '>=18'} cpu: [arm64] os: [android] - requiresBuild: true - dev: true - optional: true - /@esbuild/android-arm@0.19.8: - resolution: {integrity: sha512-31E2lxlGM1KEfivQl8Yf5aYU/mflz9g06H6S15ITUFQueMFtFjESRMoDSkvMo8thYvLBax+VKTPlpnx+sPicOA==} - engines: {node: '>=12'} + '@esbuild/android-arm@0.25.2': + resolution: {integrity: sha512-NQhH7jFstVY5x8CKbcfa166GoV0EFkaPkCKBQkdPJFvo5u+nGXLEH/ooniLb3QI8Fk58YAx7nsPLozUWfCBOJA==} + engines: {node: '>=18'} cpu: [arm] os: [android] - requiresBuild: true - dev: true - optional: true - /@esbuild/android-x64@0.19.8: - resolution: {integrity: sha512-rdqqYfRIn4jWOp+lzQttYMa2Xar3OK9Yt2fhOhzFXqg0rVWEfSclJvZq5fZslnz6ypHvVf3CT7qyf0A5pM682A==} - engines: {node: '>=12'} + '@esbuild/android-x64@0.25.2': + resolution: {integrity: sha512-Ffcx+nnma8Sge4jzddPHCZVRvIfQ0kMsUsCMcJRHkGJ1cDmhe4SsrYIjLUKn1xpHZybmOqCWwB0zQvsjdEHtkg==} + engines: {node: '>=18'} cpu: [x64] os: [android] - requiresBuild: true - dev: true - optional: true - /@esbuild/darwin-arm64@0.19.8: - resolution: {integrity: sha512-RQw9DemMbIq35Bprbboyf8SmOr4UXsRVxJ97LgB55VKKeJOOdvsIPy0nFyF2l8U+h4PtBx/1kRf0BelOYCiQcw==} - engines: {node: '>=12'} + '@esbuild/darwin-arm64@0.25.2': + resolution: {integrity: sha512-MpM6LUVTXAzOvN4KbjzU/q5smzryuoNjlriAIx+06RpecwCkL9JpenNzpKd2YMzLJFOdPqBpuub6eVRP5IgiSA==} + engines: {node: '>=18'} cpu: [arm64] os: [darwin] - requiresBuild: true - dev: true - optional: true - /@esbuild/darwin-x64@0.19.8: - resolution: {integrity: sha512-3sur80OT9YdeZwIVgERAysAbwncom7b4bCI2XKLjMfPymTud7e/oY4y+ci1XVp5TfQp/bppn7xLw1n/oSQY3/Q==} - engines: {node: '>=12'} + '@esbuild/darwin-x64@0.25.2': + resolution: {integrity: sha512-5eRPrTX7wFyuWe8FqEFPG2cU0+butQQVNcT4sVipqjLYQjjh8a8+vUTfgBKM88ObB85ahsnTwF7PSIt6PG+QkA==} + engines: {node: '>=18'} cpu: [x64] os: [darwin] - requiresBuild: true - dev: true - optional: true - /@esbuild/freebsd-arm64@0.19.8: - resolution: {integrity: sha512-WAnPJSDattvS/XtPCTj1tPoTxERjcTpH6HsMr6ujTT+X6rylVe8ggxk8pVxzf5U1wh5sPODpawNicF5ta/9Tmw==} - engines: {node: '>=12'} + '@esbuild/freebsd-arm64@0.25.2': + resolution: {integrity: sha512-mLwm4vXKiQ2UTSX4+ImyiPdiHjiZhIaE9QvC7sw0tZ6HoNMjYAqQpGyui5VRIi5sGd+uWq940gdCbY3VLvsO1w==} + engines: {node: '>=18'} cpu: [arm64] os: [freebsd] - requiresBuild: true - dev: true - optional: true - /@esbuild/freebsd-x64@0.19.8: - resolution: {integrity: sha512-ICvZyOplIjmmhjd6mxi+zxSdpPTKFfyPPQMQTK/w+8eNK6WV01AjIztJALDtwNNfFhfZLux0tZLC+U9nSyA5Zg==} - engines: {node: '>=12'} + '@esbuild/freebsd-x64@0.25.2': + resolution: {integrity: sha512-6qyyn6TjayJSwGpm8J9QYYGQcRgc90nmfdUb0O7pp1s4lTY+9D0H9O02v5JqGApUyiHOtkz6+1hZNvNtEhbwRQ==} + engines: {node: '>=18'} cpu: [x64] os: [freebsd] - requiresBuild: true - dev: true - optional: true - /@esbuild/linux-arm64@0.19.8: - resolution: {integrity: sha512-z1zMZivxDLHWnyGOctT9JP70h0beY54xDDDJt4VpTX+iwA77IFsE1vCXWmprajJGa+ZYSqkSbRQ4eyLCpCmiCQ==} - engines: {node: '>=12'} + '@esbuild/linux-arm64@0.25.2': + resolution: {integrity: sha512-gq/sjLsOyMT19I8obBISvhoYiZIAaGF8JpeXu1u8yPv8BE5HlWYobmlsfijFIZ9hIVGYkbdFhEqC0NvM4kNO0g==} + engines: {node: '>=18'} cpu: [arm64] os: [linux] - requiresBuild: true - dev: true - optional: true - /@esbuild/linux-arm@0.19.8: - resolution: {integrity: sha512-H4vmI5PYqSvosPaTJuEppU9oz1dq2A7Mr2vyg5TF9Ga+3+MGgBdGzcyBP7qK9MrwFQZlvNyJrvz6GuCaj3OukQ==} - engines: {node: '>=12'} + '@esbuild/linux-arm@0.25.2': + resolution: {integrity: sha512-UHBRgJcmjJv5oeQF8EpTRZs/1knq6loLxTsjc3nxO9eXAPDLcWW55flrMVc97qFPbmZP31ta1AZVUKQzKTzb0g==} + engines: {node: '>=18'} cpu: [arm] os: [linux] - requiresBuild: true - dev: true - optional: true - /@esbuild/linux-ia32@0.19.8: - resolution: {integrity: sha512-1a8suQiFJmZz1khm/rDglOc8lavtzEMRo0v6WhPgxkrjcU0LkHj+TwBrALwoz/OtMExvsqbbMI0ChyelKabSvQ==} - engines: {node: '>=12'} + '@esbuild/linux-ia32@0.25.2': + resolution: {integrity: sha512-bBYCv9obgW2cBP+2ZWfjYTU+f5cxRoGGQ5SeDbYdFCAZpYWrfjjfYwvUpP8MlKbP0nwZ5gyOU/0aUzZ5HWPuvQ==} + engines: {node: '>=18'} cpu: [ia32] os: [linux] - requiresBuild: true - dev: true - optional: true - /@esbuild/linux-loong64@0.19.8: - resolution: {integrity: sha512-fHZWS2JJxnXt1uYJsDv9+b60WCc2RlvVAy1F76qOLtXRO+H4mjt3Tr6MJ5l7Q78X8KgCFudnTuiQRBhULUyBKQ==} - engines: {node: '>=12'} + '@esbuild/linux-loong64@0.25.2': + resolution: {integrity: sha512-SHNGiKtvnU2dBlM5D8CXRFdd+6etgZ9dXfaPCeJtz+37PIUlixvlIhI23L5khKXs3DIzAn9V8v+qb1TRKrgT5w==} + engines: {node: '>=18'} cpu: [loong64] os: [linux] - requiresBuild: true - dev: true - optional: true - /@esbuild/linux-mips64el@0.19.8: - resolution: {integrity: sha512-Wy/z0EL5qZYLX66dVnEg9riiwls5IYnziwuju2oUiuxVc+/edvqXa04qNtbrs0Ukatg5HEzqT94Zs7J207dN5Q==} - engines: {node: '>=12'} + '@esbuild/linux-mips64el@0.25.2': + resolution: {integrity: sha512-hDDRlzE6rPeoj+5fsADqdUZl1OzqDYow4TB4Y/3PlKBD0ph1e6uPHzIQcv2Z65u2K0kpeByIyAjCmjn1hJgG0Q==} + engines: {node: '>=18'} cpu: [mips64el] os: [linux] - requiresBuild: true - dev: true - optional: true - /@esbuild/linux-ppc64@0.19.8: - resolution: {integrity: sha512-ETaW6245wK23YIEufhMQ3HSeHO7NgsLx8gygBVldRHKhOlD1oNeNy/P67mIh1zPn2Hr2HLieQrt6tWrVwuqrxg==} - engines: {node: '>=12'} + '@esbuild/linux-ppc64@0.25.2': + resolution: {integrity: sha512-tsHu2RRSWzipmUi9UBDEzc0nLc4HtpZEI5Ba+Omms5456x5WaNuiG3u7xh5AO6sipnJ9r4cRWQB2tUjPyIkc6g==} + engines: {node: '>=18'} cpu: [ppc64] os: [linux] - requiresBuild: true - dev: true - optional: true - /@esbuild/linux-riscv64@0.19.8: - resolution: {integrity: sha512-T2DRQk55SgoleTP+DtPlMrxi/5r9AeFgkhkZ/B0ap99zmxtxdOixOMI570VjdRCs9pE4Wdkz7JYrsPvsl7eESg==} - engines: {node: '>=12'} + '@esbuild/linux-riscv64@0.25.2': + resolution: {integrity: sha512-k4LtpgV7NJQOml/10uPU0s4SAXGnowi5qBSjaLWMojNCUICNu7TshqHLAEbkBdAszL5TabfvQ48kK84hyFzjnw==} + engines: {node: '>=18'} cpu: [riscv64] os: [linux] - requiresBuild: true - dev: true - optional: true - /@esbuild/linux-s390x@0.19.8: - resolution: {integrity: sha512-NPxbdmmo3Bk7mbNeHmcCd7R7fptJaczPYBaELk6NcXxy7HLNyWwCyDJ/Xx+/YcNH7Im5dHdx9gZ5xIwyliQCbg==} - engines: {node: '>=12'} + '@esbuild/linux-s390x@0.25.2': + resolution: {integrity: sha512-GRa4IshOdvKY7M/rDpRR3gkiTNp34M0eLTaC1a08gNrh4u488aPhuZOCpkF6+2wl3zAN7L7XIpOFBhnaE3/Q8Q==} + engines: {node: '>=18'} cpu: [s390x] os: [linux] - requiresBuild: true - dev: true - optional: true - /@esbuild/linux-x64@0.19.8: - resolution: {integrity: sha512-lytMAVOM3b1gPypL2TRmZ5rnXl7+6IIk8uB3eLsV1JwcizuolblXRrc5ShPrO9ls/b+RTp+E6gbsuLWHWi2zGg==} - engines: {node: '>=12'} + '@esbuild/linux-x64@0.25.2': + resolution: {integrity: sha512-QInHERlqpTTZ4FRB0fROQWXcYRD64lAoiegezDunLpalZMjcUcld3YzZmVJ2H/Cp0wJRZ8Xtjtj0cEHhYc/uUg==} + engines: {node: '>=18'} cpu: [x64] os: [linux] - requiresBuild: true - dev: true - optional: true - /@esbuild/netbsd-x64@0.19.8: - resolution: {integrity: sha512-hvWVo2VsXz/8NVt1UhLzxwAfo5sioj92uo0bCfLibB0xlOmimU/DeAEsQILlBQvkhrGjamP0/el5HU76HAitGw==} - engines: {node: '>=12'} + '@esbuild/netbsd-arm64@0.25.2': + resolution: {integrity: sha512-talAIBoY5M8vHc6EeI2WW9d/CkiO9MQJ0IOWX8hrLhxGbro/vBXJvaQXefW2cP0z0nQVTdQ/eNyGFV1GSKrxfw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [netbsd] + + '@esbuild/netbsd-x64@0.25.2': + resolution: {integrity: sha512-voZT9Z+tpOxrvfKFyfDYPc4DO4rk06qamv1a/fkuzHpiVBMOhpjK+vBmWM8J1eiB3OLSMFYNaOaBNLXGChf5tg==} + engines: {node: '>=18'} cpu: [x64] os: [netbsd] - requiresBuild: true - dev: true - optional: true - /@esbuild/openbsd-x64@0.19.8: - resolution: {integrity: sha512-/7Y7u77rdvmGTxR83PgaSvSBJCC2L3Kb1M/+dmSIvRvQPXXCuC97QAwMugBNG0yGcbEGfFBH7ojPzAOxfGNkwQ==} - engines: {node: '>=12'} + '@esbuild/openbsd-arm64@0.25.2': + resolution: {integrity: sha512-dcXYOC6NXOqcykeDlwId9kB6OkPUxOEqU+rkrYVqJbK2hagWOMrsTGsMr8+rW02M+d5Op5NNlgMmjzecaRf7Tg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openbsd] + + '@esbuild/openbsd-x64@0.25.2': + resolution: {integrity: sha512-t/TkWwahkH0Tsgoq1Ju7QfgGhArkGLkF1uYz8nQS/PPFlXbP5YgRpqQR3ARRiC2iXoLTWFxc6DJMSK10dVXluw==} + engines: {node: '>=18'} cpu: [x64] os: [openbsd] - requiresBuild: true - dev: true - optional: true - /@esbuild/sunos-x64@0.19.8: - resolution: {integrity: sha512-9Lc4s7Oi98GqFA4HzA/W2JHIYfnXbUYgekUP/Sm4BG9sfLjyv6GKKHKKVs83SMicBF2JwAX6A1PuOLMqpD001w==} - engines: {node: '>=12'} + '@esbuild/sunos-x64@0.25.2': + resolution: {integrity: sha512-cfZH1co2+imVdWCjd+D1gf9NjkchVhhdpgb1q5y6Hcv9TP6Zi9ZG/beI3ig8TvwT9lH9dlxLq5MQBBgwuj4xvA==} + engines: {node: '>=18'} cpu: [x64] os: [sunos] - requiresBuild: true - dev: true - optional: true - /@esbuild/win32-arm64@0.19.8: - resolution: {integrity: sha512-rq6WzBGjSzihI9deW3fC2Gqiak68+b7qo5/3kmB6Gvbh/NYPA0sJhrnp7wgV4bNwjqM+R2AApXGxMO7ZoGhIJg==} - engines: {node: '>=12'} + '@esbuild/win32-arm64@0.25.2': + resolution: {integrity: sha512-7Loyjh+D/Nx/sOTzV8vfbB3GJuHdOQyrOryFdZvPHLf42Tk9ivBU5Aedi7iyX+x6rbn2Mh68T4qq1SDqJBQO5Q==} + engines: {node: '>=18'} cpu: [arm64] os: [win32] - requiresBuild: true - dev: true - optional: true - /@esbuild/win32-ia32@0.19.8: - resolution: {integrity: sha512-AIAbverbg5jMvJznYiGhrd3sumfwWs8572mIJL5NQjJa06P8KfCPWZQ0NwZbPQnbQi9OWSZhFVSUWjjIrn4hSw==} - engines: {node: '>=12'} + '@esbuild/win32-ia32@0.25.2': + resolution: {integrity: sha512-WRJgsz9un0nqZJ4MfhabxaD9Ft8KioqU3JMinOTvobbX6MOSUigSBlogP8QB3uxpJDsFS6yN+3FDBdqE5lg9kg==} + engines: {node: '>=18'} cpu: [ia32] os: [win32] - requiresBuild: true - dev: true - optional: true - /@esbuild/win32-x64@0.19.8: - resolution: {integrity: sha512-bfZ0cQ1uZs2PqpulNL5j/3w+GDhP36k1K5c38QdQg+Swy51jFZWWeIkteNsufkQxp986wnqRRsb/bHbY1WQ7TA==} - engines: {node: '>=12'} + '@esbuild/win32-x64@0.25.2': + resolution: {integrity: sha512-kM3HKb16VIXZyIeVrM1ygYmZBKybX8N4p754bw390wGO3Tf2j4L2/WYL+4suWujpgf6GBYs3jv7TyUivdd05JA==} + engines: {node: '>=18'} cpu: [x64] os: [win32] - requiresBuild: true - dev: true - optional: true - /@eslint-community/eslint-utils@4.4.0(eslint@8.56.0): - resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} + '@eslint-community/eslint-utils@4.4.1': + resolution: {integrity: sha512-s3O3waFUrMV8P/XaF/+ZTp1X9XBZW1a4B97ZnjQF2KYWaFD2A8KyFBsrsfSjEmjn3RGWAIuvlneuZm3CUK3jbA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 - dependencies: - eslint: 8.56.0 - eslint-visitor-keys: 3.4.3 - dev: true - /@eslint-community/regexpp@4.10.0: - resolution: {integrity: sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==} + '@eslint-community/regexpp@4.12.1': + resolution: {integrity: sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==} engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} - dev: true - /@eslint/eslintrc@2.1.4: - resolution: {integrity: sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - dependencies: - ajv: 6.12.6 - debug: 4.3.4 - espree: 9.6.1 - globals: 13.23.0 - ignore: 5.3.0 - import-fresh: 3.3.0 - js-yaml: 4.1.0 - minimatch: 3.1.2 - strip-json-comments: 3.1.1 - transitivePeerDependencies: - - supports-color - dev: true + '@eslint/config-array@0.20.0': + resolution: {integrity: sha512-fxlS1kkIjx8+vy2SjuCB94q3htSNrufYTXubwiBFeaQHbH6Ipi43gFJq2zCMt6PHhImH3Xmr0NksKDvchWlpQQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - /@eslint/js@8.56.0: - resolution: {integrity: sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - dev: true + '@eslint/config-helpers@0.2.1': + resolution: {integrity: sha512-RI17tsD2frtDu/3dmI7QRrD4bedNKPM08ziRYaC5AhkGrzIAJelm9kJU1TznK+apx6V+cqRz8tfpEeG3oIyjxw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - /@humanwhocodes/config-array@0.11.13: - resolution: {integrity: sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==} - engines: {node: '>=10.10.0'} - dependencies: - '@humanwhocodes/object-schema': 2.0.1 - debug: 4.3.4 - minimatch: 3.1.2 - transitivePeerDependencies: - - supports-color - dev: true + '@eslint/core@0.13.0': + resolution: {integrity: sha512-yfkgDw1KR66rkT5A8ci4irzDysN7FRpq3ttJolR88OqQikAWqwA8j5VZyas+vjyBNFIJ7MfybJ9plMILI2UrCw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - /@humanwhocodes/module-importer@1.0.1: - resolution: {integrity: sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==} - engines: {node: '>=12.22'} - dev: true + '@eslint/eslintrc@3.3.1': + resolution: {integrity: sha512-gtF186CXhIl1p4pJNGZw8Yc6RlshoePRvE0X91oPGb3vZ8pM3qOS9W9NGPat9LziaBV7XrJWGylNQXkGcnM3IQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - /@humanwhocodes/object-schema@2.0.1: - resolution: {integrity: sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==} - dev: true + '@eslint/js@9.25.1': + resolution: {integrity: sha512-dEIwmjntEx8u3Uvv+kr3PDeeArL8Hw07H9kyYxCjnM9pBjfEhk6uLXSchxxzgiwtRhhzVzqmUSDFBOi1TuZ7qg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - /@iarna/toml@2.2.5: - resolution: {integrity: sha512-trnsAYxU3xnS1gPHPyU961coFyLkh4gAD/0zQ5mymY4yOZ+CYvsPqUbOFSw0aDM4y0tV7tiFxL/1XfXPNC6IPg==} - dev: true + '@eslint/object-schema@2.1.6': + resolution: {integrity: sha512-RBMg5FRL0I0gs51M/guSAj5/e14VQ4tpZnQNWwuDT66P14I43ItmPfIZRhO9fUVIPOAQXU47atlywZ/czoqFPA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - /@iconify-json/codicon@1.1.37: - resolution: {integrity: sha512-S8nJQeP9VGdPO+XtuyM+HfGKCAkGXY4qteYW5PKzz1S9s73PdBTLuLTSW342HqqYhuUaiF8S+w8SAkkPZnOnpg==} - dependencies: - '@iconify/types': 2.0.0 - dev: true + '@eslint/plugin-kit@0.2.8': + resolution: {integrity: sha512-ZAoA40rNMPwSm+AeHpCq8STiNAwzWLJuP8Xv4CHIc9wv/PSuExjMrmjfYNj682vW0OOiZ1HKxzvjQr9XZIisQA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - /@iconify-json/ph@1.1.8: - resolution: {integrity: sha512-LtUWsiO/R2Gx4ZqHGJbJYG4XaAFkQ1+rHPQmmQ7NVTaqg7EZibB3ky1aXX12sJ2F+6z8QIpthsw3wRjReEnTig==} - dependencies: - '@iconify/types': 2.0.0 - dev: true + '@humanfs/core@0.19.1': + resolution: {integrity: sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==} + engines: {node: '>=18.18.0'} + + '@humanfs/node@0.16.6': + resolution: {integrity: sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==} + engines: {node: '>=18.18.0'} + + '@humanwhocodes/module-importer@1.0.1': + resolution: {integrity: sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==} + engines: {node: '>=12.22'} + + '@humanwhocodes/retry@0.3.1': + resolution: {integrity: sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==} + engines: {node: '>=18.18'} + + '@humanwhocodes/retry@0.4.2': + resolution: {integrity: sha512-xeO57FpIu4p1Ri3Jq/EXq4ClRm86dVF2z/+kvFnyqVYRavTZmaFaUBbWCOuuTh0o/g7DSsk6kc2vrS4Vl5oPOQ==} + engines: {node: '>=18.18'} + + '@iconify-json/codicon@1.2.12': + resolution: {integrity: sha512-PSqV6rx770+MAaIK+QGLbhvsKl33ParjREK++XhMyM1CGXcMEsJ6cXkeooyWhE8VSzxWKlk8ecGzJFTi13MwQA==} - /@iconify/types@2.0.0: + '@iconify-json/ph@1.2.2': + resolution: {integrity: sha512-PgkEZNtqa8hBGjHXQa4pMwZa93hmfu8FUSjs/nv4oUU6yLsgv+gh9nu28Kqi8Fz9CCVu4hj1MZs9/60J57IzFw==} + + '@iconify/types@2.0.0': resolution: {integrity: sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg==} - dev: true - /@iconify/utils@2.1.12: - resolution: {integrity: sha512-7vf3Uk6H7TKX4QMs2gbg5KR1X9J0NJzKSRNWhMZ+PWN92l0t6Q3tj2ZxLDG07rC3ppWBtTtA4FPmkQphuEmdsg==} - dependencies: - '@antfu/install-pkg': 0.1.1 - '@antfu/utils': 0.7.6 - '@iconify/types': 2.0.0 - debug: 4.3.4 - kolorist: 1.8.0 - local-pkg: 0.4.3 - transitivePeerDependencies: - - supports-color - dev: true + '@iconify/utils@2.3.0': + resolution: {integrity: sha512-GmQ78prtwYW6EtzXRU1rY+KwOKfz32PD7iJh6Iyqw68GiKuoZ2A6pRtzWONz5VQJbp50mEjXh/7NkumtrAgRKA==} - /@jridgewell/gen-mapping@0.3.3: - resolution: {integrity: sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==} + '@jridgewell/gen-mapping@0.3.8': + resolution: {integrity: sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==} engines: {node: '>=6.0.0'} - dependencies: - '@jridgewell/set-array': 1.1.2 - '@jridgewell/sourcemap-codec': 1.4.15 - '@jridgewell/trace-mapping': 0.3.20 - /@jridgewell/resolve-uri@3.1.1: - resolution: {integrity: sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==} + '@jridgewell/resolve-uri@3.1.2': + resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} engines: {node: '>=6.0.0'} - /@jridgewell/set-array@1.1.2: - resolution: {integrity: sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==} + '@jridgewell/set-array@1.2.1': + resolution: {integrity: sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==} engines: {node: '>=6.0.0'} - /@jridgewell/source-map@0.3.5: - resolution: {integrity: sha512-UTYAUj/wviwdsMfzoSJspJxbkH5o1snzwX0//0ENX1u/55kkZZkcTZP6u9bwKGkv+dkk9at4m1Cpt0uY80kcpQ==} - dependencies: - '@jridgewell/gen-mapping': 0.3.3 - '@jridgewell/trace-mapping': 0.3.20 - dev: true + '@jridgewell/source-map@0.3.6': + resolution: {integrity: sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==} - /@jridgewell/sourcemap-codec@1.4.15: - resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==} + '@jridgewell/sourcemap-codec@1.5.0': + resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==} - /@jridgewell/trace-mapping@0.3.20: - resolution: {integrity: sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==} - dependencies: - '@jridgewell/resolve-uri': 3.1.1 - '@jridgewell/sourcemap-codec': 1.4.15 + '@jridgewell/trace-mapping@0.3.25': + resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} - /@nodelib/fs.scandir@2.1.5: + '@nodelib/fs.scandir@2.1.5': resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} engines: {node: '>= 8'} - dependencies: - '@nodelib/fs.stat': 2.0.5 - run-parallel: 1.2.0 - dev: true - /@nodelib/fs.stat@2.0.5: + '@nodelib/fs.stat@2.0.5': resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==} engines: {node: '>= 8'} - dev: true - /@nodelib/fs.walk@1.2.8: + '@nodelib/fs.walk@1.2.8': resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} engines: {node: '>= 8'} - dependencies: - '@nodelib/fs.scandir': 2.1.5 - fastq: 1.15.0 - dev: true - /@polka/url@1.0.0-next.21: - resolution: {integrity: sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g==} - dev: true + '@polka/url@1.0.0-next.28': + resolution: {integrity: sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw==} - /@rollup/plugin-node-resolve@15.2.3(rollup@4.9.6): - resolution: {integrity: sha512-j/lym8nf5E21LwBT4Df1VD6hRO2L2iwUeUmP7litikRsVp1H6NWx20NEp0Y7su+7XGc476GnXXc4kFeZNGmaSQ==} + '@rollup/plugin-node-resolve@16.0.1': + resolution: {integrity: sha512-tk5YCxJWIG81umIvNkSod2qK5KyQW19qcBF/B78n1bjtOON6gzKoVeSzAE8yHCZEDmqkHKkxplExA8KzdJLJpA==} engines: {node: '>=14.0.0'} peerDependencies: rollup: ^2.78.0||^3.0.0||^4.0.0 peerDependenciesMeta: rollup: optional: true - dependencies: - '@rollup/pluginutils': 5.1.0(rollup@4.9.6) - '@types/resolve': 1.20.2 - deepmerge: 4.3.1 - is-builtin-module: 3.2.1 - is-module: 1.0.0 - resolve: 1.22.8 - rollup: 4.9.6 - dev: true - /@rollup/plugin-terser@0.4.4(rollup@4.9.6): + '@rollup/plugin-terser@0.4.4': resolution: {integrity: sha512-XHeJC5Bgvs8LfukDwWZp7yeqin6ns8RTl2B9avbejt6tZqsqvVoWI7ZTQrcNsfKEDWBTnTxM8nMDkO2IFFbd0A==} engines: {node: '>=14.0.0'} peerDependencies: @@ -1199,15 +716,9 @@ packages: peerDependenciesMeta: rollup: optional: true - dependencies: - rollup: 4.9.6 - serialize-javascript: 6.0.1 - smob: 1.4.1 - terser: 5.25.0 - dev: true - /@rollup/plugin-typescript@11.1.6(rollup@4.9.6)(typescript@5.3.3): - resolution: {integrity: sha512-R92yOmIACgYdJ7dJ97p4K69I8gg6IEHt8M7dUBxN3W6nrO8uUxX5ixl0yU/N3aZTi8WhPuICvOHXQvF6FaykAA==} + '@rollup/plugin-typescript@12.1.2': + resolution: {integrity: sha512-cdtSp154H5sv637uMr1a8OTWB0L1SWDSm1rDGiyfcGcvQ6cuTs4MDk2BVEBGysUWago4OJN4EQZqOTl/QY3Jgg==} engines: {node: '>=14.0.0'} peerDependencies: rollup: ^2.14.0||^3.0.0||^4.0.0 @@ -1218,2602 +729,2887 @@ packages: optional: true tslib: optional: true - dependencies: - '@rollup/pluginutils': 5.1.0(rollup@4.9.6) - resolve: 1.22.8 - rollup: 4.9.6 - typescript: 5.3.3 - dev: true - - /@rollup/pluginutils@5.1.0: - resolution: {integrity: sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==} - engines: {node: '>=14.0.0'} - peerDependencies: - rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 - peerDependenciesMeta: - rollup: - optional: true - dependencies: - '@types/estree': 1.0.5 - estree-walker: 2.0.2 - picomatch: 2.3.1 - dev: true - /@rollup/pluginutils@5.1.0(rollup@4.9.6): - resolution: {integrity: sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==} + '@rollup/pluginutils@5.1.4': + resolution: {integrity: sha512-USm05zrsFxYLPdWWq+K3STlWiT/3ELn3RcV5hJMghpeAIhxfsUIg6mt12CBJBInWMV4VneoV7SfGv8xIwo2qNQ==} engines: {node: '>=14.0.0'} peerDependencies: rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 peerDependenciesMeta: rollup: optional: true - dependencies: - '@types/estree': 1.0.5 - estree-walker: 2.0.2 - picomatch: 2.3.1 - rollup: 4.9.6 - dev: true - - /@rollup/rollup-android-arm-eabi@4.6.1: - resolution: {integrity: sha512-0WQ0ouLejaUCRsL93GD4uft3rOmB8qoQMU05Kb8CmMtMBe7XUDLAltxVZI1q6byNqEtU7N1ZX1Vw5lIpgulLQA==} - cpu: [arm] - os: [android] - requiresBuild: true - dev: true - optional: true - /@rollup/rollup-android-arm-eabi@4.9.6: - resolution: {integrity: sha512-MVNXSSYN6QXOulbHpLMKYi60ppyO13W9my1qogeiAqtjb2yR4LSmfU2+POvDkLzhjYLXz9Rf9+9a3zFHW1Lecg==} + '@rollup/rollup-android-arm-eabi@4.40.1': + resolution: {integrity: sha512-kxz0YeeCrRUHz3zyqvd7n+TVRlNyTifBsmnmNPtk3hQURUyG9eAB+usz6DAwagMusjx/zb3AjvDUvhFGDAexGw==} cpu: [arm] os: [android] - requiresBuild: true - dev: true - optional: true - - /@rollup/rollup-android-arm64@4.6.1: - resolution: {integrity: sha512-1TKm25Rn20vr5aTGGZqo6E4mzPicCUD79k17EgTLAsXc1zysyi4xXKACfUbwyANEPAEIxkzwue6JZ+stYzWUTA==} - cpu: [arm64] - os: [android] - requiresBuild: true - dev: true - optional: true - /@rollup/rollup-android-arm64@4.9.6: - resolution: {integrity: sha512-T14aNLpqJ5wzKNf5jEDpv5zgyIqcpn1MlwCrUXLrwoADr2RkWA0vOWP4XxbO9aiO3dvMCQICZdKeDrFl7UMClw==} + '@rollup/rollup-android-arm64@4.40.1': + resolution: {integrity: sha512-PPkxTOisoNC6TpnDKatjKkjRMsdaWIhyuMkA4UsBXT9WEZY4uHezBTjs6Vl4PbqQQeu6oION1w2voYZv9yquCw==} cpu: [arm64] os: [android] - requiresBuild: true - dev: true - optional: true - - /@rollup/rollup-darwin-arm64@4.6.1: - resolution: {integrity: sha512-cEXJQY/ZqMACb+nxzDeX9IPLAg7S94xouJJCNVE5BJM8JUEP4HeTF+ti3cmxWeSJo+5D+o8Tc0UAWUkfENdeyw==} - cpu: [arm64] - os: [darwin] - requiresBuild: true - dev: true - optional: true - /@rollup/rollup-darwin-arm64@4.9.6: - resolution: {integrity: sha512-CqNNAyhRkTbo8VVZ5R85X73H3R5NX9ONnKbXuHisGWC0qRbTTxnF1U4V9NafzJbgGM0sHZpdO83pLPzq8uOZFw==} + '@rollup/rollup-darwin-arm64@4.40.1': + resolution: {integrity: sha512-VWXGISWFY18v/0JyNUy4A46KCFCb9NVsH+1100XP31lud+TzlezBbz24CYzbnA4x6w4hx+NYCXDfnvDVO6lcAA==} cpu: [arm64] os: [darwin] - requiresBuild: true - dev: true - optional: true - /@rollup/rollup-darwin-x64@4.6.1: - resolution: {integrity: sha512-LoSU9Xu56isrkV2jLldcKspJ7sSXmZWkAxg7sW/RfF7GS4F5/v4EiqKSMCFbZtDu2Nc1gxxFdQdKwkKS4rwxNg==} + '@rollup/rollup-darwin-x64@4.40.1': + resolution: {integrity: sha512-nIwkXafAI1/QCS7pxSpv/ZtFW6TXcNUEHAIA9EIyw5OzxJZQ1YDrX+CL6JAIQgZ33CInl1R6mHet9Y/UZTg2Bw==} cpu: [x64] os: [darwin] - requiresBuild: true - dev: true - optional: true - /@rollup/rollup-darwin-x64@4.9.6: - resolution: {integrity: sha512-zRDtdJuRvA1dc9Mp6BWYqAsU5oeLixdfUvkTHuiYOHwqYuQ4YgSmi6+/lPvSsqc/I0Omw3DdICx4Tfacdzmhog==} + '@rollup/rollup-freebsd-arm64@4.40.1': + resolution: {integrity: sha512-BdrLJ2mHTrIYdaS2I99mriyJfGGenSaP+UwGi1kB9BLOCu9SR8ZpbkmmalKIALnRw24kM7qCN0IOm6L0S44iWw==} + cpu: [arm64] + os: [freebsd] + + '@rollup/rollup-freebsd-x64@4.40.1': + resolution: {integrity: sha512-VXeo/puqvCG8JBPNZXZf5Dqq7BzElNJzHRRw3vjBE27WujdzuOPecDPc/+1DcdcTptNBep3861jNq0mYkT8Z6Q==} cpu: [x64] - os: [darwin] - requiresBuild: true - dev: true - optional: true + os: [freebsd] - /@rollup/rollup-linux-arm-gnueabihf@4.6.1: - resolution: {integrity: sha512-EfI3hzYAy5vFNDqpXsNxXcgRDcFHUWSx5nnRSCKwXuQlI5J9dD84g2Usw81n3FLBNsGCegKGwwTVsSKK9cooSQ==} + '@rollup/rollup-linux-arm-gnueabihf@4.40.1': + resolution: {integrity: sha512-ehSKrewwsESPt1TgSE/na9nIhWCosfGSFqv7vwEtjyAqZcvbGIg4JAcV7ZEh2tfj/IlfBeZjgOXm35iOOjadcg==} cpu: [arm] os: [linux] - requiresBuild: true - dev: true - optional: true - /@rollup/rollup-linux-arm-gnueabihf@4.9.6: - resolution: {integrity: sha512-oNk8YXDDnNyG4qlNb6is1ojTOGL/tRhbbKeE/YuccItzerEZT68Z9gHrY3ROh7axDc974+zYAPxK5SH0j/G+QQ==} + '@rollup/rollup-linux-arm-musleabihf@4.40.1': + resolution: {integrity: sha512-m39iO/aaurh5FVIu/F4/Zsl8xppd76S4qoID8E+dSRQvTyZTOI2gVk3T4oqzfq1PtcvOfAVlwLMK3KRQMaR8lg==} cpu: [arm] os: [linux] - requiresBuild: true - dev: true - optional: true - /@rollup/rollup-linux-arm64-gnu@4.6.1: - resolution: {integrity: sha512-9lhc4UZstsegbNLhH0Zu6TqvDfmhGzuCWtcTFXY10VjLLUe4Mr0Ye2L3rrtHaDd/J5+tFMEuo5LTCSCMXWfUKw==} + '@rollup/rollup-linux-arm64-gnu@4.40.1': + resolution: {integrity: sha512-Y+GHnGaku4aVLSgrT0uWe2o2Rq8te9hi+MwqGF9r9ORgXhmHK5Q71N757u0F8yU1OIwUIFy6YiJtKjtyktk5hg==} cpu: [arm64] os: [linux] - requiresBuild: true - dev: true - optional: true - /@rollup/rollup-linux-arm64-gnu@4.9.6: - resolution: {integrity: sha512-Z3O60yxPtuCYobrtzjo0wlmvDdx2qZfeAWTyfOjEDqd08kthDKexLpV97KfAeUXPosENKd8uyJMRDfFMxcYkDQ==} + '@rollup/rollup-linux-arm64-musl@4.40.1': + resolution: {integrity: sha512-jEwjn3jCA+tQGswK3aEWcD09/7M5wGwc6+flhva7dsQNRZZTe30vkalgIzV4tjkopsTS9Jd7Y1Bsj6a4lzz8gQ==} cpu: [arm64] os: [linux] - requiresBuild: true - dev: true - optional: true - /@rollup/rollup-linux-arm64-musl@4.6.1: - resolution: {integrity: sha512-FfoOK1yP5ksX3wwZ4Zk1NgyGHZyuRhf99j64I5oEmirV8EFT7+OhUZEnP+x17lcP/QHJNWGsoJwrz4PJ9fBEXw==} - cpu: [arm64] + '@rollup/rollup-linux-loongarch64-gnu@4.40.1': + resolution: {integrity: sha512-ySyWikVhNzv+BV/IDCsrraOAZ3UaC8SZB67FZlqVwXwnFhPihOso9rPOxzZbjp81suB1O2Topw+6Ug3JNegejQ==} + cpu: [loong64] os: [linux] - requiresBuild: true - dev: true - optional: true - /@rollup/rollup-linux-arm64-musl@4.9.6: - resolution: {integrity: sha512-gpiG0qQJNdYEVad+1iAsGAbgAnZ8j07FapmnIAQgODKcOTjLEWM9sRb+MbQyVsYCnA0Im6M6QIq6ax7liws6eQ==} - cpu: [arm64] + '@rollup/rollup-linux-powerpc64le-gnu@4.40.1': + resolution: {integrity: sha512-BvvA64QxZlh7WZWqDPPdt0GH4bznuL6uOO1pmgPnnv86rpUpc8ZxgZwcEgXvo02GRIZX1hQ0j0pAnhwkhwPqWg==} + cpu: [ppc64] os: [linux] - requiresBuild: true - dev: true - optional: true - /@rollup/rollup-linux-riscv64-gnu@4.9.6: - resolution: {integrity: sha512-+uCOcvVmFUYvVDr27aiyun9WgZk0tXe7ThuzoUTAukZJOwS5MrGbmSlNOhx1j80GdpqbOty05XqSl5w4dQvcOA==} + '@rollup/rollup-linux-riscv64-gnu@4.40.1': + resolution: {integrity: sha512-EQSP+8+1VuSulm9RKSMKitTav89fKbHymTf25n5+Yr6gAPZxYWpj3DzAsQqoaHAk9YX2lwEyAf9S4W8F4l3VBQ==} cpu: [riscv64] os: [linux] - requiresBuild: true - dev: true - optional: true - /@rollup/rollup-linux-x64-gnu@4.6.1: - resolution: {integrity: sha512-DNGZvZDO5YF7jN5fX8ZqmGLjZEXIJRdJEdTFMhiyXqyXubBa0WVLDWSNlQ5JR2PNgDbEV1VQowhVRUh+74D+RA==} - cpu: [x64] + '@rollup/rollup-linux-riscv64-musl@4.40.1': + resolution: {integrity: sha512-n/vQ4xRZXKuIpqukkMXZt9RWdl+2zgGNx7Uda8NtmLJ06NL8jiHxUawbwC+hdSq1rrw/9CghCpEONor+l1e2gA==} + cpu: [riscv64] os: [linux] - requiresBuild: true - dev: true - optional: true - /@rollup/rollup-linux-x64-gnu@4.9.6: - resolution: {integrity: sha512-HUNqM32dGzfBKuaDUBqFB7tP6VMN74eLZ33Q9Y1TBqRDn+qDonkAUyKWwF9BR9unV7QUzffLnz9GrnKvMqC/fw==} - cpu: [x64] + '@rollup/rollup-linux-s390x-gnu@4.40.1': + resolution: {integrity: sha512-h8d28xzYb98fMQKUz0w2fMc1XuGzLLjdyxVIbhbil4ELfk5/orZlSTpF/xdI9C8K0I8lCkq+1En2RJsawZekkg==} + cpu: [s390x] os: [linux] - requiresBuild: true - dev: true - optional: true - /@rollup/rollup-linux-x64-musl@4.6.1: - resolution: {integrity: sha512-RkJVNVRM+piYy87HrKmhbexCHg3A6Z6MU0W9GHnJwBQNBeyhCJG9KDce4SAMdicQnpURggSvtbGo9xAWOfSvIQ==} + '@rollup/rollup-linux-x64-gnu@4.40.1': + resolution: {integrity: sha512-XiK5z70PEFEFqcNj3/zRSz/qX4bp4QIraTy9QjwJAb/Z8GM7kVUsD0Uk8maIPeTyPCP03ChdI+VVmJriKYbRHQ==} cpu: [x64] os: [linux] - requiresBuild: true - dev: true - optional: true - /@rollup/rollup-linux-x64-musl@4.9.6: - resolution: {integrity: sha512-ch7M+9Tr5R4FK40FHQk8VnML0Szi2KRujUgHXd/HjuH9ifH72GUmw6lStZBo3c3GB82vHa0ZoUfjfcM7JiiMrQ==} + '@rollup/rollup-linux-x64-musl@4.40.1': + resolution: {integrity: sha512-2BRORitq5rQ4Da9blVovzNCMaUlyKrzMSvkVR0D4qPuOy/+pMCrh1d7o01RATwVy+6Fa1WBw+da7QPeLWU/1mQ==} cpu: [x64] os: [linux] - requiresBuild: true - dev: true - optional: true - - /@rollup/rollup-win32-arm64-msvc@4.6.1: - resolution: {integrity: sha512-v2FVT6xfnnmTe3W9bJXl6r5KwJglMK/iRlkKiIFfO6ysKs0rDgz7Cwwf3tjldxQUrHL9INT/1r4VA0n9L/F1vQ==} - cpu: [arm64] - os: [win32] - requiresBuild: true - dev: true - optional: true - /@rollup/rollup-win32-arm64-msvc@4.9.6: - resolution: {integrity: sha512-VD6qnR99dhmTQ1mJhIzXsRcTBvTjbfbGGwKAHcu+52cVl15AC/kplkhxzW/uT0Xl62Y/meBKDZvoJSJN+vTeGA==} + '@rollup/rollup-win32-arm64-msvc@4.40.1': + resolution: {integrity: sha512-b2bcNm9Kbde03H+q+Jjw9tSfhYkzrDUf2d5MAd1bOJuVplXvFhWz7tRtWvD8/ORZi7qSCy0idW6tf2HgxSXQSg==} cpu: [arm64] os: [win32] - requiresBuild: true - dev: true - optional: true - - /@rollup/rollup-win32-ia32-msvc@4.6.1: - resolution: {integrity: sha512-YEeOjxRyEjqcWphH9dyLbzgkF8wZSKAKUkldRY6dgNR5oKs2LZazqGB41cWJ4Iqqcy9/zqYgmzBkRoVz3Q9MLw==} - cpu: [ia32] - os: [win32] - requiresBuild: true - dev: true - optional: true - /@rollup/rollup-win32-ia32-msvc@4.9.6: - resolution: {integrity: sha512-J9AFDq/xiRI58eR2NIDfyVmTYGyIZmRcvcAoJ48oDld/NTR8wyiPUu2X/v1navJ+N/FGg68LEbX3Ejd6l8B7MQ==} + '@rollup/rollup-win32-ia32-msvc@4.40.1': + resolution: {integrity: sha512-DfcogW8N7Zg7llVEfpqWMZcaErKfsj9VvmfSyRjCyo4BI3wPEfrzTtJkZG6gKP/Z92wFm6rz2aDO7/JfiR/whA==} cpu: [ia32] os: [win32] - requiresBuild: true - dev: true - optional: true - - /@rollup/rollup-win32-x64-msvc@4.6.1: - resolution: {integrity: sha512-0zfTlFAIhgz8V2G8STq8toAjsYYA6eci1hnXuyOTUFnymrtJwnS6uGKiv3v5UrPZkBlamLvrLV2iiaeqCKzb0A==} - cpu: [x64] - os: [win32] - requiresBuild: true - dev: true - optional: true - /@rollup/rollup-win32-x64-msvc@4.9.6: - resolution: {integrity: sha512-jqzNLhNDvIZOrt69Ce4UjGRpXJBzhUBzawMwnaDAwyHriki3XollsewxWzOzz+4yOFDkuJHtTsZFwMxhYJWmLQ==} + '@rollup/rollup-win32-x64-msvc@4.40.1': + resolution: {integrity: sha512-ECyOuDeH3C1I8jH2MK1RtBJW+YPMvSfT0a5NN0nHfQYnDSJ6tUiZH3gzwVP5/Kfh/+Tt7tpWVF9LXNTnhTJ3kA==} cpu: [x64] os: [win32] - requiresBuild: true - dev: true - optional: true - /@sveltejs/vite-plugin-svelte-inspector@2.0.0(@sveltejs/vite-plugin-svelte@3.0.1)(svelte@4.2.8)(vite@5.0.12): - resolution: {integrity: sha512-gjr9ZFg1BSlIpfZ4PRewigrvYmHWbDrq2uvvPB1AmTWKuM+dI1JXQSUu2pIrYLb/QncyiIGkFDFKTwJ0XqQZZg==} - engines: {node: ^18.0.0 || >=20} + '@sveltejs/vite-plugin-svelte-inspector@4.0.1': + resolution: {integrity: sha512-J/Nmb2Q2y7mck2hyCX4ckVHcR5tu2J+MtBEQqpDrrgELZ2uvraQcK/ioCV61AqkdXFgriksOKIceDcQmqnGhVw==} + engines: {node: ^18.0.0 || ^20.0.0 || >=22} peerDependencies: - '@sveltejs/vite-plugin-svelte': ^3.0.0 - svelte: ^4.0.0 || ^5.0.0-next.0 - vite: ^5.0.0 - dependencies: - '@sveltejs/vite-plugin-svelte': 3.0.1(svelte@4.2.8)(vite@5.0.12) - debug: 4.3.4 - svelte: 4.2.8 - vite: 5.0.12 - transitivePeerDependencies: - - supports-color - dev: true + '@sveltejs/vite-plugin-svelte': ^5.0.0 + svelte: ^5.0.0 + vite: ^6.0.0 - /@sveltejs/vite-plugin-svelte@3.0.1(svelte@4.2.8)(vite@5.0.12): - resolution: {integrity: sha512-CGURX6Ps+TkOovK6xV+Y2rn8JKa8ZPUHPZ/NKgCxAmgBrXReavzFl8aOSCj3kQ1xqT7yGJj53hjcV/gqwDAaWA==} - engines: {node: ^18.0.0 || >=20} + '@sveltejs/vite-plugin-svelte@5.0.3': + resolution: {integrity: sha512-MCFS6CrQDu1yGwspm4qtli0e63vaPCehf6V7pIMP15AsWgMKrqDGCPFF/0kn4SP0ii4aySu4Pa62+fIRGFMjgw==} + engines: {node: ^18.0.0 || ^20.0.0 || >=22} peerDependencies: - svelte: ^4.0.0 || ^5.0.0-next.0 - vite: ^5.0.0 - dependencies: - '@sveltejs/vite-plugin-svelte-inspector': 2.0.0(@sveltejs/vite-plugin-svelte@3.0.1)(svelte@4.2.8)(vite@5.0.12) - debug: 4.3.4 - deepmerge: 4.3.1 - kleur: 4.1.5 - magic-string: 0.30.5 - svelte: 4.2.8 - svelte-hmr: 0.15.3(svelte@4.2.8) - vite: 5.0.12 - vitefu: 0.2.5(vite@5.0.12) - transitivePeerDependencies: - - supports-color - dev: true + svelte: ^5.0.0 + vite: ^6.0.0 - /@tauri-apps/api@2.0.0-beta.2: - resolution: {integrity: sha512-4r1r6kgttzIWxJ3HxkZQH+b7EiUtKhdUCPbi0KSalD+2T3j6klw+v8VyxhKwEdjM/eo60NE+J33v1E/Urq8puw==} - engines: {node: '>= 18', npm: '>= 6.6.0', yarn: '>= 1.19.1'} - dev: false + '@tauri-apps/api@2.5.0': + resolution: {integrity: sha512-Ldux4ip+HGAcPUmuLT8EIkk6yafl5vK0P0c0byzAKzxJh7vxelVtdPONjfgTm96PbN24yjZNESY8CKo8qniluA==} - /@tauri-apps/cli-darwin-arm64@2.0.0-beta.3: - resolution: {integrity: sha512-gHcn3jI/4MDXDIlK/4Zz0ftTosgN3OimWlKxEz777QrA1hldrQweYIhdZXkqE9KgoE+u6w80vWIcr0InHAf7Iw==} + '@tauri-apps/cli-darwin-arm64@2.5.0': + resolution: {integrity: sha512-VuVAeTFq86dfpoBDNYAdtQVLbP0+2EKCHIIhkaxjeoPARR0sLpFHz2zs0PcFU76e+KAaxtEtAJAXGNUc8E1PzQ==} engines: {node: '>= 10'} cpu: [arm64] os: [darwin] - requiresBuild: true - dev: true - optional: true - /@tauri-apps/cli-darwin-x64@2.0.0-beta.3: - resolution: {integrity: sha512-kRCaukT2IAGMmNuAOUBhdZRlKujTy2lSsdNKmgGEMnzQLKJwWO9Gpq1NmPY7ZVqyXK/X8QnGHuasDEQsSO6B4w==} + '@tauri-apps/cli-darwin-x64@2.5.0': + resolution: {integrity: sha512-hUF01sC06cZVa8+I0/VtsHOk9BbO75rd+YdtHJ48xTdcYaQ5QIwL4yZz9OR1AKBTaUYhBam8UX9Pvd5V2/4Dpw==} engines: {node: '>= 10'} cpu: [x64] os: [darwin] - requiresBuild: true - dev: true - optional: true - /@tauri-apps/cli-linux-arm-gnueabihf@2.0.0-beta.3: - resolution: {integrity: sha512-cpNZOQDotNSdjoZT16s1JtZvnkM0wgLwU39AhKhRCco4KEH3/8G1ngKF9JKalWUN8zDTcuCigEAr37gEv4mLAA==} + '@tauri-apps/cli-linux-arm-gnueabihf@2.5.0': + resolution: {integrity: sha512-LQKqttsK252LlqYyX8R02MinUsfFcy3+NZiJwHFgi5Y3+ZUIAED9cSxJkyNtuY5KMnR4RlpgWyLv4P6akN1xhg==} engines: {node: '>= 10'} cpu: [arm] os: [linux] - requiresBuild: true - dev: true - optional: true - /@tauri-apps/cli-linux-arm64-gnu@2.0.0-beta.3: - resolution: {integrity: sha512-8q86V6P9bkeoFcnvSsnvOwmKY6ijIN4ueRVXCj5cVpsw392VF9vud1Nq7/l+QDgn9OWbZNNVDl30iyoSuaykBA==} + '@tauri-apps/cli-linux-arm64-gnu@2.5.0': + resolution: {integrity: sha512-mTQufsPcpdHg5RW0zypazMo4L55EfeE5snTzrPqbLX4yCK2qalN7+rnP8O8GT06xhp6ElSP/Ku1M2MR297SByQ==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - requiresBuild: true - dev: true - optional: true - /@tauri-apps/cli-linux-arm64-musl@2.0.0-beta.3: - resolution: {integrity: sha512-L7fokh4aqyV6yDPoeKwFN3Yt0pCAuZMWeP5tOeSBiom1pU7ppKH+4KHeTekNEIecZG+Ah250DkVCdmWS+aRFTA==} + '@tauri-apps/cli-linux-arm64-musl@2.5.0': + resolution: {integrity: sha512-rQO1HhRUQqyEaal5dUVOQruTRda/TD36s9kv1hTxZiFuSq3558lsTjAcUEnMAtBcBkps20sbyTJNMT0AwYIk8Q==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - requiresBuild: true - dev: true - optional: true - /@tauri-apps/cli-linux-x64-gnu@2.0.0-beta.3: - resolution: {integrity: sha512-/crp3K6PathqicVWPj8Kh1120NNVV7nagJ7oZW9OFch7nBS1tmDnSB5k5LgA4yYu+lDKNUREnATMWHL6i0gNeg==} + '@tauri-apps/cli-linux-riscv64-gnu@2.5.0': + resolution: {integrity: sha512-7oS18FN46yDxyw1zX/AxhLAd7T3GrLj3Ai6s8hZKd9qFVzrAn36ESL7d3G05s8wEtsJf26qjXnVF4qleS3dYsA==} + engines: {node: '>= 10'} + cpu: [riscv64] + os: [linux] + + '@tauri-apps/cli-linux-x64-gnu@2.5.0': + resolution: {integrity: sha512-SG5sFNL7VMmDBdIg3nO3EzNRT306HsiEQ0N90ILe3ZABYAVoPDO/ttpCO37ApLInTzrq/DLN+gOlC/mgZvLw1w==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - requiresBuild: true - dev: true - optional: true - /@tauri-apps/cli-linux-x64-musl@2.0.0-beta.3: - resolution: {integrity: sha512-jX1ZT0UQwdBGbpCwlpv2bsLDO7KFMeDJQ/ZZVMfWyjuYrGBG5zhJ2NXwTMkHVnxfvE6BVmnybWcykeSqTATeOw==} + '@tauri-apps/cli-linux-x64-musl@2.5.0': + resolution: {integrity: sha512-QXDM8zp/6v05PNWju5ELsVwF0VH1n6b5pk2E6W/jFbbiwz80Vs1lACl9pv5kEHkrxBj+aWU/03JzGuIj2g3SkQ==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - requiresBuild: true - dev: true - optional: true - /@tauri-apps/cli-win32-arm64-msvc@2.0.0-beta.3: - resolution: {integrity: sha512-UCEZNKocENLX3HYKid4FEbrCMjCX9e58klBIvJKxT8HTjvpgFYDoKccswDNfszLhmineKMlkUvm7j7U0sMh8MQ==} + '@tauri-apps/cli-win32-arm64-msvc@2.5.0': + resolution: {integrity: sha512-pFSHFK6b+o9y4Un8w0gGLwVyFTZaC3P0kQ7umRt/BLDkzD5RnQ4vBM7CF8BCU5nkwmEBUCZd7Wt3TWZxe41o6Q==} engines: {node: '>= 10'} cpu: [arm64] os: [win32] - requiresBuild: true - dev: true - optional: true - /@tauri-apps/cli-win32-ia32-msvc@2.0.0-beta.3: - resolution: {integrity: sha512-O8syGXDHyKN/cv1ktD76dTcbkQ1nNEPhnT1Z+r0GKxNsw4/MyIVglzEcou3aPq0/1MQ0PEGVyG1x0JMaPw7oHQ==} + '@tauri-apps/cli-win32-ia32-msvc@2.5.0': + resolution: {integrity: sha512-EArv1IaRlogdLAQyGlKmEqZqm5RfHCUMhJoedWu7GtdbOMUfSAz6FMX2boE1PtEmNO4An+g188flLeVErrxEKg==} engines: {node: '>= 10'} cpu: [ia32] os: [win32] - requiresBuild: true - dev: true - optional: true - /@tauri-apps/cli-win32-x64-msvc@2.0.0-beta.3: - resolution: {integrity: sha512-YDdF3XWaptjKtKz33sZhC+uNAZwp6QtAmZSRCQQlC1W7uJwLD00/3QF4vO/c6Qm+BGFsazVh1+YmBF1p0kV0rg==} + '@tauri-apps/cli-win32-x64-msvc@2.5.0': + resolution: {integrity: sha512-lj43EFYbnAta8pd9JnUq87o+xRUR0odz+4rixBtTUwUgdRdwQ2V9CzFtsMu6FQKpFQ6mujRK6P1IEwhL6ADRsQ==} engines: {node: '>= 10'} cpu: [x64] os: [win32] - requiresBuild: true - dev: true - optional: true - /@tauri-apps/cli@2.0.0-beta.3: - resolution: {integrity: sha512-xLAL2DNNUJWqHBKvanc3V9bG9kkwtFwc40X/DrfgEKnkajEm79wqnkaT8LUnmbe0WZ8bzBRO1fLIgKlOH6GiCA==} + '@tauri-apps/cli@2.5.0': + resolution: {integrity: sha512-rAtHqG0Gh/IWLjN2zTf3nZqYqbo81oMbqop56rGTjrlWk9pTTAjkqOjSL9XQLIMZ3RbeVjveCqqCA0s8RnLdMg==} engines: {node: '>= 10'} hasBin: true - optionalDependencies: - '@tauri-apps/cli-darwin-arm64': 2.0.0-beta.3 - '@tauri-apps/cli-darwin-x64': 2.0.0-beta.3 - '@tauri-apps/cli-linux-arm-gnueabihf': 2.0.0-beta.3 - '@tauri-apps/cli-linux-arm64-gnu': 2.0.0-beta.3 - '@tauri-apps/cli-linux-arm64-musl': 2.0.0-beta.3 - '@tauri-apps/cli-linux-x64-gnu': 2.0.0-beta.3 - '@tauri-apps/cli-linux-x64-musl': 2.0.0-beta.3 - '@tauri-apps/cli-win32-arm64-msvc': 2.0.0-beta.3 - '@tauri-apps/cli-win32-ia32-msvc': 2.0.0-beta.3 - '@tauri-apps/cli-win32-x64-msvc': 2.0.0-beta.3 - dev: true - - /@tauri-apps/toml@2.2.4: - resolution: {integrity: sha512-NJV/pdgJObDlDWi5+MTHZ2qyNvdL0dlHqQ72nzQYXWbW1LHMPXgCJYl0pLqL1XxxLtxtInYbtVCGVAcwhGxdkw==} - dev: true - - /@types/estree@1.0.5: - resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} - - /@types/json-schema@7.0.15: - resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} - dev: true - /@types/json5@0.0.29: - resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==} - dev: true + '@types/estree@1.0.7': + resolution: {integrity: sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==} - /@types/mdast@3.0.15: + '@types/json-schema@7.0.15': + resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} + + '@types/mdast@3.0.15': resolution: {integrity: sha512-LnwD+mUEfxWMa1QpDraczIn6k0Ee3SMicuYSSzS6ZYl2gKS09EClnJYGd8Du6rfc5r/GZEk5o1mRb8TaTj03sQ==} - dependencies: - '@types/unist': 2.0.10 - dev: true - /@types/resolve@1.20.2: + '@types/resolve@1.20.2': resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==} - dev: true - - /@types/semver@7.5.6: - resolution: {integrity: sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==} - dev: true - /@types/unist@2.0.10: - resolution: {integrity: sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==} - dev: true + '@types/unist@2.0.11': + resolution: {integrity: sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==} - /@typescript-eslint/eslint-plugin@6.20.0(@typescript-eslint/parser@6.20.0)(eslint@8.56.0)(typescript@5.3.3): - resolution: {integrity: sha512-fTwGQUnjhoYHeSF6m5pWNkzmDDdsKELYrOBxhjMrofPqCkoC2k3B2wvGHFxa1CTIqkEn88nlW1HVMztjo2K8Hg==} - engines: {node: ^16.0.0 || >=18.0.0} + '@typescript-eslint/eslint-plugin@8.31.0': + resolution: {integrity: sha512-evaQJZ/J/S4wisevDvC1KFZkPzRetH8kYZbkgcTRyql3mcKsf+ZFDV1BVWUGTCAW5pQHoqn5gK5b8kn7ou9aFQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: - '@typescript-eslint/parser': ^6.0.0 || ^6.0.0-alpha - eslint: ^7.0.0 || ^8.0.0 - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - '@eslint-community/regexpp': 4.10.0 - '@typescript-eslint/parser': 6.20.0(eslint@8.56.0)(typescript@5.3.3) - '@typescript-eslint/scope-manager': 6.20.0 - '@typescript-eslint/type-utils': 6.20.0(eslint@8.56.0)(typescript@5.3.3) - '@typescript-eslint/utils': 6.20.0(eslint@8.56.0)(typescript@5.3.3) - '@typescript-eslint/visitor-keys': 6.20.0 - debug: 4.3.4 - eslint: 8.56.0 - graphemer: 1.4.0 - ignore: 5.3.0 - natural-compare: 1.4.0 - semver: 7.5.4 - ts-api-utils: 1.0.3(typescript@5.3.3) - typescript: 5.3.3 - transitivePeerDependencies: - - supports-color - dev: true + '@typescript-eslint/parser': ^8.0.0 || ^8.0.0-alpha.0 + eslint: ^8.57.0 || ^9.0.0 + typescript: '>=4.8.4 <5.9.0' - /@typescript-eslint/parser@6.20.0(eslint@8.56.0)(typescript@5.3.3): - resolution: {integrity: sha512-bYerPDF/H5v6V76MdMYhjwmwgMA+jlPVqjSDq2cRqMi8bP5sR3Z+RLOiOMad3nsnmDVmn2gAFCyNgh/dIrfP/w==} - engines: {node: ^16.0.0 || >=18.0.0} + '@typescript-eslint/parser@8.31.0': + resolution: {integrity: sha512-67kYYShjBR0jNI5vsf/c3WG4u+zDnCTHTPqVMQguffaWWFs7artgwKmfwdifl+r6XyM5LYLas/dInj2T0SgJyw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: - eslint: ^7.0.0 || ^8.0.0 - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - '@typescript-eslint/scope-manager': 6.20.0 - '@typescript-eslint/types': 6.20.0 - '@typescript-eslint/typescript-estree': 6.20.0(typescript@5.3.3) - '@typescript-eslint/visitor-keys': 6.20.0 - debug: 4.3.4 - eslint: 8.56.0 - typescript: 5.3.3 - transitivePeerDependencies: - - supports-color - dev: true + eslint: ^8.57.0 || ^9.0.0 + typescript: '>=4.8.4 <5.9.0' - /@typescript-eslint/scope-manager@6.20.0: - resolution: {integrity: sha512-p4rvHQRDTI1tGGMDFQm+GtxP1ZHyAh64WANVoyEcNMpaTFn3ox/3CcgtIlELnRfKzSs/DwYlDccJEtr3O6qBvA==} - engines: {node: ^16.0.0 || >=18.0.0} - dependencies: - '@typescript-eslint/types': 6.20.0 - '@typescript-eslint/visitor-keys': 6.20.0 - dev: true + '@typescript-eslint/scope-manager@8.31.0': + resolution: {integrity: sha512-knO8UyF78Nt8O/B64i7TlGXod69ko7z6vJD9uhSlm0qkAbGeRUSudcm0+K/4CrRjrpiHfBCjMWlc08Vav1xwcw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - /@typescript-eslint/type-utils@6.20.0(eslint@8.56.0)(typescript@5.3.3): - resolution: {integrity: sha512-qnSobiJQb1F5JjN0YDRPHruQTrX7ICsmltXhkV536mp4idGAYrIyr47zF/JmkJtEcAVnIz4gUYJ7gOZa6SmN4g==} - engines: {node: ^16.0.0 || >=18.0.0} + '@typescript-eslint/type-utils@8.31.0': + resolution: {integrity: sha512-DJ1N1GdjI7IS7uRlzJuEDCgDQix3ZVYVtgeWEyhyn4iaoitpMBX6Ndd488mXSx0xah/cONAkEaYyylDyAeHMHg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: - eslint: ^7.0.0 || ^8.0.0 - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - '@typescript-eslint/typescript-estree': 6.20.0(typescript@5.3.3) - '@typescript-eslint/utils': 6.20.0(eslint@8.56.0)(typescript@5.3.3) - debug: 4.3.4 - eslint: 8.56.0 - ts-api-utils: 1.0.3(typescript@5.3.3) - typescript: 5.3.3 - transitivePeerDependencies: - - supports-color - dev: true + eslint: ^8.57.0 || ^9.0.0 + typescript: '>=4.8.4 <5.9.0' - /@typescript-eslint/types@6.20.0: - resolution: {integrity: sha512-MM9mfZMAhiN4cOEcUOEx+0HmuaW3WBfukBZPCfwSqFnQy0grXYtngKCqpQN339X3RrwtzspWJrpbrupKYUSBXQ==} - engines: {node: ^16.0.0 || >=18.0.0} - dev: true + '@typescript-eslint/types@8.31.0': + resolution: {integrity: sha512-Ch8oSjVyYyJxPQk8pMiP2FFGYatqXQfQIaMp+TpuuLlDachRWpUAeEu1u9B/v/8LToehUIWyiKcA/w5hUFRKuQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - /@typescript-eslint/typescript-estree@6.20.0(typescript@5.3.3): - resolution: {integrity: sha512-RnRya9q5m6YYSpBN7IzKu9FmLcYtErkDkc8/dKv81I9QiLLtVBHrjz+Ev/crAqgMNW2FCsoZF4g2QUylMnJz+g==} - engines: {node: ^16.0.0 || >=18.0.0} + '@typescript-eslint/typescript-estree@8.31.0': + resolution: {integrity: sha512-xLmgn4Yl46xi6aDSZ9KkyfhhtnYI15/CvHbpOy/eR5NWhK/BK8wc709KKwhAR0m4ZKRP7h07bm4BWUYOCuRpQQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - '@typescript-eslint/types': 6.20.0 - '@typescript-eslint/visitor-keys': 6.20.0 - debug: 4.3.4 - globby: 11.1.0 - is-glob: 4.0.3 - minimatch: 9.0.3 - semver: 7.5.4 - ts-api-utils: 1.0.3(typescript@5.3.3) - typescript: 5.3.3 - transitivePeerDependencies: - - supports-color - dev: true + typescript: '>=4.8.4 <5.9.0' - /@typescript-eslint/utils@6.20.0(eslint@8.56.0)(typescript@5.3.3): - resolution: {integrity: sha512-/EKuw+kRu2vAqCoDwDCBtDRU6CTKbUmwwI7SH7AashZ+W+7o8eiyy6V2cdOqN49KsTcASWsC5QeghYuRDTyOOg==} - engines: {node: ^16.0.0 || >=18.0.0} + '@typescript-eslint/utils@8.31.0': + resolution: {integrity: sha512-qi6uPLt9cjTFxAb1zGNgTob4x9ur7xC6mHQJ8GwEzGMGE9tYniublmJaowOJ9V2jUzxrltTPfdG2nKlWsq0+Ww==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: - eslint: ^7.0.0 || ^8.0.0 - dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.56.0) - '@types/json-schema': 7.0.15 - '@types/semver': 7.5.6 - '@typescript-eslint/scope-manager': 6.20.0 - '@typescript-eslint/types': 6.20.0 - '@typescript-eslint/typescript-estree': 6.20.0(typescript@5.3.3) - eslint: 8.56.0 - semver: 7.5.4 - transitivePeerDependencies: - - supports-color - - typescript - dev: true - - /@typescript-eslint/visitor-keys@6.20.0: - resolution: {integrity: sha512-E8Cp98kRe4gKHjJD4NExXKz/zOJ1A2hhZc+IMVD6i7w4yjIvh6VyuRI0gRtxAsXtoC35uGMaQ9rjI2zJaXDEAw==} - engines: {node: ^16.0.0 || >=18.0.0} - dependencies: - '@typescript-eslint/types': 6.20.0 - eslint-visitor-keys: 3.4.3 - dev: true + eslint: ^8.57.0 || ^9.0.0 + typescript: '>=4.8.4 <5.9.0' - /@ungap/structured-clone@1.2.0: - resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} - dev: true + '@typescript-eslint/visitor-keys@8.31.0': + resolution: {integrity: sha512-QcGHmlRHWOl93o64ZUMNewCdwKGU6WItOU52H0djgNmn1EOrhVudrDzXz4OycCRSCPwFCDrE2iIt5vmuUdHxuQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - /@unocss/astro@0.58.0(vite@5.0.12): - resolution: {integrity: sha512-df+tEFO5eKXjQOwSWQhS9IdjD0sfLHLtn8U09sEKR2Nmh5CvpwyBxmvLQgOCilPou7ehmyKfsyGRLZg7IMp+Ew==} + '@unocss/astro@66.0.0': + resolution: {integrity: sha512-GBhXT6JPqXjDXoJZTXhySk83NgOt0UigChqrUUdG4x7Z+DVYkDBION8vZUJjw0OdIaxNQ4euGWu4GDsMF6gQQg==} peerDependencies: - vite: ^2.9.0 || ^3.0.0-0 || ^4.0.0 || ^5.0.0-0 + vite: ^2.9.0 || ^3.0.0-0 || ^4.0.0 || ^5.0.0-0 || ^6.0.0-0 peerDependenciesMeta: vite: optional: true - dependencies: - '@unocss/core': 0.58.0 - '@unocss/reset': 0.58.0 - '@unocss/vite': 0.58.0(vite@5.0.12) - vite: 5.0.12 - transitivePeerDependencies: - - rollup - dev: true - /@unocss/cli@0.58.0: - resolution: {integrity: sha512-rhsrDBxAVueygMcAbMkbuvsHbBL2rG6N96LllYwHn16FLgOE3Sf4JW1/LlNjQje3BtwMMtbSCCAeu2SryFhzbw==} + '@unocss/cli@66.0.0': + resolution: {integrity: sha512-KVQiskoOjVkLVpNaG6WpLa4grPplrZROYZJVIUYSTqZyZRFNSvjttHcsCwpoWUEUdEombPtVZl8FrXePjY5IiQ==} engines: {node: '>=14'} hasBin: true - dependencies: - '@ampproject/remapping': 2.2.1 - '@rollup/pluginutils': 5.1.0 - '@unocss/config': 0.58.0 - '@unocss/core': 0.58.0 - '@unocss/preset-uno': 0.58.0 - cac: 6.7.14 - chokidar: 3.5.3 - colorette: 2.0.20 - consola: 3.2.3 - fast-glob: 3.3.2 - magic-string: 0.30.5 - pathe: 1.1.1 - perfect-debounce: 1.0.0 - transitivePeerDependencies: - - rollup - dev: true - /@unocss/config@0.58.0: - resolution: {integrity: sha512-WQD29gCZ7cajnMzezD1PRW0qQSxo/C6PX9ktygwhdinFx9nXuLZnKFOz65TiI8y48e53g1i7ivvgY3m4Sq5mIg==} + '@unocss/config@66.0.0': + resolution: {integrity: sha512-nFRGop/guBa4jLkrgXjaRDm5JPz4x3YpP10m5IQkHpHwlnHUVn1L9smyPl04ohYWhYn9ZcAHgR28Ih2jwta8hw==} engines: {node: '>=14'} - dependencies: - '@unocss/core': 0.58.0 - unconfig: 0.3.11 - dev: true - /@unocss/core@0.58.0: - resolution: {integrity: sha512-KhABQXGE2AgtO9vE28d+HnciuyGDcuygsnQdUwlzUuR4K05OSw2kRE9emRN4HaMycD+gA/zDbQrJxTXb6mQUiA==} - dev: true + '@unocss/core@66.0.0': + resolution: {integrity: sha512-PdVbSMHNDDkr++9nkqzsZRAkaU84gxMTEgYbqI7dt2p1DXp/5tomVtmMsr2/whXGYKRiUc0xZ3p4Pzraz8TcXA==} - /@unocss/extractor-arbitrary-variants@0.58.0: - resolution: {integrity: sha512-s9wK2UugJM0WK1HpgPz2kTbpeyQc46zais+nauN/ykVX6NMq8PtGzSWszzf+0aIbtWAQGiqAfiYNTpf09tJHfg==} - dependencies: - '@unocss/core': 0.58.0 - dev: true + '@unocss/extractor-arbitrary-variants@66.0.0': + resolution: {integrity: sha512-vlkOIOuwBfaFBJcN6o7+obXjigjOlzVFN/jT6pG1WXbQDTRZ021jeF3i9INdb9D/0cQHSeDvNgi1TJ5oUxfiow==} - /@unocss/extractor-svelte@0.58.0: - resolution: {integrity: sha512-2eyf73dakmwMpY0r0y8xA85eRvPzQIOiegbwwif8kC8yZcMQUB5e1Xmb9CcvQsN37PV/PmA+uD/tg9oXtU7LUg==} - dev: true + '@unocss/extractor-svelte@66.0.0': + resolution: {integrity: sha512-iUrdW6dVV08gOjs16+wjucvfy9VK7+KSWxiOVUmL4dB2jHsiaUG63AG+JgoEwEJu2UEatfEVblQvBXQFCl9/SA==} - /@unocss/inspector@0.58.0: - resolution: {integrity: sha512-ZC4QauFGdh3/VkzW/FqkO2R03JEbzGNuX0DK03pwas8/jFIGh8pPldesj8GEKm1YWr1emx9cw7JUnhR8XSUBlA==} - dependencies: - '@unocss/core': 0.58.0 - '@unocss/rule-utils': 0.58.0 - gzip-size: 6.0.0 - sirv: 2.0.3 - dev: true + '@unocss/inspector@66.0.0': + resolution: {integrity: sha512-mkIxieVm0kMOKw+E4ABpIerihYMdjgq9A92RD5h2+W/ebpxTEw5lTTK1xcMLiAlmOrVYMQKjpgPeu3vQmDyGZQ==} - /@unocss/postcss@0.58.0(postcss@8.4.32): - resolution: {integrity: sha512-2hAwLbfUFqysi8FN1cn3xkHy5GhLMlYy6W4NrAZ2ws7F2MKpsCT2xCj7dT5cI2tW8ulD2YoVbKH15dBhNsMNUA==} + '@unocss/postcss@66.0.0': + resolution: {integrity: sha512-6bi+ujzh8I1PJwtmHX71LH8z/H9+vPxeYD4XgFihyU1k4Y6MVhjr7giGjLX4yP27IP+NsVyotD22V7by/dBVEA==} engines: {node: '>=14'} peerDependencies: postcss: ^8.4.21 - dependencies: - '@unocss/config': 0.58.0 - '@unocss/core': 0.58.0 - '@unocss/rule-utils': 0.58.0 - css-tree: 2.3.1 - fast-glob: 3.3.2 - magic-string: 0.30.5 - postcss: 8.4.32 - dev: true - /@unocss/preset-attributify@0.58.0: - resolution: {integrity: sha512-Ew78noYes12K9gk4dF36MkjpiIqTi1XVqcniiAzxCkzuctxN4B57vW3LVTwjInGmWNNKWN3UNR4q1o0VxH4xJg==} - dependencies: - '@unocss/core': 0.58.0 - dev: true + '@unocss/preset-attributify@66.0.0': + resolution: {integrity: sha512-eYsOgmcDoiIgGAepIwRX+DKGYxc/wm0r4JnDuZdz29AB+A6oY/FGHS1BVt4rq9ny4B5PofP4p6Rty+vwD9rigw==} - /@unocss/preset-icons@0.58.0: - resolution: {integrity: sha512-niT32avw+8l+L40LGhrmX6qDV9Z8/gOn4xjjRhLZZouKni3CJOpz9taILyF4xp1nak5nxGT4wa0tuC/htvOF5A==} - dependencies: - '@iconify/utils': 2.1.12 - '@unocss/core': 0.58.0 - ofetch: 1.3.3 - transitivePeerDependencies: - - supports-color - dev: true + '@unocss/preset-icons@66.0.0': + resolution: {integrity: sha512-6ObwTvEGuPBbKWRoMMiDioHtwwQTFI5oojFLJ32Y8tW6TdXvBLkO88d7qpgQxEjgVt4nJrqF1WEfR4niRgBm0Q==} - /@unocss/preset-mini@0.58.0: - resolution: {integrity: sha512-oMliJZVTN3ecAvf52yN+MyJszaJOZoKwMMbUAFqVis62MaqRzZ8mSw12QFLFyX2pltulDFpMBTAKro+hP0wXEg==} - dependencies: - '@unocss/core': 0.58.0 - '@unocss/extractor-arbitrary-variants': 0.58.0 - '@unocss/rule-utils': 0.58.0 - dev: true + '@unocss/preset-mini@66.0.0': + resolution: {integrity: sha512-d62eACnuKtR0dwCFOQXgvw5VLh5YSyK56xCzpHkh0j0GstgfDLfKTys0T/XVAAvdSvAy/8A8vhSNJ4PlIc9V2A==} - /@unocss/preset-tagify@0.58.0: - resolution: {integrity: sha512-I+dzfs/bofiGb2AUxkhcTDhB+r2+/3SO81PFwf3Ae7afnzhA2SLsKAkEqO8YN3M3mwZL7IfXn6vpsWeEAlk/yw==} - dependencies: - '@unocss/core': 0.58.0 - dev: true + '@unocss/preset-tagify@66.0.0': + resolution: {integrity: sha512-GGYGyWxaevh0jN0NoATVO1Qe7DFXM3ykLxchlXmG6/zy963pZxItg/njrKnxE9la4seCdxpFH7wQBa68imwwdA==} - /@unocss/preset-typography@0.58.0: - resolution: {integrity: sha512-8qo+Z1CJtXFMDbAvtizUTRLuLxCIzytgYU0GmuRkfc2iwASSDNDsvh8nAYQfWpyAEOV7QEHtS9c9xL4b0c89FA==} - dependencies: - '@unocss/core': 0.58.0 - '@unocss/preset-mini': 0.58.0 - dev: true + '@unocss/preset-typography@66.0.0': + resolution: {integrity: sha512-apjckP5nPU5mtaHTCzz5u/dK9KJWwJ2kOFCVk0+a/KhUWmnqnzmjRYZlEuWxxr5QxTdCW+9cIoRDSA0lYZS5tg==} - /@unocss/preset-uno@0.58.0: - resolution: {integrity: sha512-DpgfjtvSgsWeyZH+jQHc1k5IReiZNb7oGpHVnfF6SlHETTnMHSeNetxkPQWYrqJLPI6llNLPTdTa5j47NtmOiA==} - dependencies: - '@unocss/core': 0.58.0 - '@unocss/preset-mini': 0.58.0 - '@unocss/preset-wind': 0.58.0 - '@unocss/rule-utils': 0.58.0 - dev: true + '@unocss/preset-uno@66.0.0': + resolution: {integrity: sha512-qgoZ/hzTI32bQvcyjcwvv1X/dbPlmQNehzgjUaL7QFT0q0/CN/SRpysfzoQ8DLl2se9T+YCOS9POx3KrpIiYSQ==} - /@unocss/preset-web-fonts@0.58.0: - resolution: {integrity: sha512-QarDDEUlexQ2IIn23pE1eHDskG2Tz+JjCe+FAN0DoNLLhvUUWSB4cQIMFWP6dSMJ047Blj9IpgAl9dERICW1qQ==} - dependencies: - '@unocss/core': 0.58.0 - ofetch: 1.3.3 - dev: true + '@unocss/preset-web-fonts@66.0.0': + resolution: {integrity: sha512-9MzfDc6AJILN4Kq7Z91FfFbizBOYgw3lJd2UwqIs3PDYWG5iH5Zv5zhx6jelZVqEW5uWcIARYEEg2m4stZO1ZA==} - /@unocss/preset-wind@0.58.0: - resolution: {integrity: sha512-2zgaIy9RAGie9CsUYCkYRDSERBi8kG6Q/mQLgNfP9HMz5IThlnDHFWF/hLAVD51xQUg9gH8qWBR9kN/1ioT5Tw==} - dependencies: - '@unocss/core': 0.58.0 - '@unocss/preset-mini': 0.58.0 - '@unocss/rule-utils': 0.58.0 - dev: true + '@unocss/preset-wind3@66.0.0': + resolution: {integrity: sha512-WAGRmpi1sb2skvYn9DBQUvhfqrJ+VmQmn5ZGsT2ewvsk7HFCvVLAMzZeKrrTQepeNBRhg6HzFDDi8yg6yB5c9g==} - /@unocss/reset@0.58.0: - resolution: {integrity: sha512-UVZ5kz37JGbwAA06k/gjKYcekcTwi6oIhev1EpTtCvHLL6XYcYqcwb/u4Wjzprd3L3lxDGYXvGdjREGm2u7vbQ==} - dev: true + '@unocss/preset-wind@66.0.0': + resolution: {integrity: sha512-FtvGpHnGC7FiyKJavPnn5y9lsaoWRhXlujCqlT5Bw63kKhMNr0ogKySBpenUhJOhWhVM0OQXn2nZ3GZRxW2qpw==} - /@unocss/rule-utils@0.58.0: - resolution: {integrity: sha512-LBJ9dJ/j5UIMzJF7pmIig55MtJAYtG+tn/zQRveZuPRVahzP+KqwlyB7u3uCUnQhdgo/MJODMcqyr0jl6+kTuA==} + '@unocss/reset@66.0.0': + resolution: {integrity: sha512-YLFz/5yT7mFJC8JSmIUA5+bS3CBCJbtztOw+8rWzjQr/BEVSGuihWUUpI2Df6VVxXIXxKanZR6mIl59yvf+GEA==} + + '@unocss/rule-utils@66.0.0': + resolution: {integrity: sha512-UJ51YHbwxYTGyj35ugsPlOT4gaa7tCbXdywZ3m5Nn0JgywwIqGmBFyiN9ZjHBHfJuDxmmPd6lxojoBscih/WMQ==} engines: {node: '>=14'} - dependencies: - '@unocss/core': 0.58.0 - magic-string: 0.30.5 - dev: true - /@unocss/scope@0.58.0: - resolution: {integrity: sha512-XgUXZJvbxWSRC/DNOWI5DYdR6Nd6IZxsE5ls3AFA5msgtk5OH4YNQELLMabQw7xbRbU/fftlRJa3vncSfOyl6w==} - dev: true + '@unocss/transformer-attributify-jsx@66.0.0': + resolution: {integrity: sha512-jS7szFXXC6RjTv9wo0NACskf618w981bkbyQ5izRO7Ha47sNpHhHDpaltnG7SR9qV4cCtGalOw4onVMHsRKwRg==} - /@unocss/transformer-attributify-jsx-babel@0.58.0: - resolution: {integrity: sha512-ckDq/q476x2yikjS8usmSUGuakqMQrg2pm8sdBINTPdJxGc7kJRvI5UDnzRw4W9hE5IH+E4gg0XfCtFad0O3eg==} - dependencies: - '@babel/core': 7.23.5 - '@babel/plugin-syntax-jsx': 7.23.3(@babel/core@7.23.5) - '@babel/preset-typescript': 7.23.3(@babel/core@7.23.5) - '@unocss/core': 0.58.0 - transitivePeerDependencies: - - supports-color - dev: true + '@unocss/transformer-compile-class@66.0.0': + resolution: {integrity: sha512-ytUIE0nAcHRMACuTXkHp8auZ483DXrOZw99jk3FJ+aFjpD/pVSFmX14AWJ7bqPFObxb4SLFs6KhQma30ESC22A==} - /@unocss/transformer-attributify-jsx@0.58.0: - resolution: {integrity: sha512-QDdBEFDE7ntfCH7+8zHRW72MIQ9NH3uYGUE7lYgr5Ap8qzBHCxMT1kUrY6gwuoo3U4dMu2wruglYRHD88hvGkw==} - dependencies: - '@unocss/core': 0.58.0 - dev: true + '@unocss/transformer-directives@66.0.0': + resolution: {integrity: sha512-utcg7m2Foi7uHrU5WHadNuJ0a3qWG8tZNkQMi+m0DQpX6KWfuDtDn0zDZ1X+z5lmiB3WGSJERRrsvZbj1q50Mw==} - /@unocss/transformer-compile-class@0.58.0: - resolution: {integrity: sha512-/BysfTg2q9sGPfiRHqWw/bT60/gjpBGBRVkIFsG4WVT2pgf3BfQUPu5FumSvZSRd0rA/pR57Lp6ZREAdj6+q+A==} - dependencies: - '@unocss/core': 0.58.0 - dev: true + '@unocss/transformer-variant-group@66.0.0': + resolution: {integrity: sha512-1BLjNWtAnR1JAcQGw0TS+nGrVoB9aznzvVZRoTx23dtRr3btvgKPHb8LrD48eD/p8Dtw9j3WfuxMDKXKegKDLg==} - /@unocss/transformer-directives@0.58.0: - resolution: {integrity: sha512-sU2U/aIykRkGGbA4Qo9Z5XE/KqWf7KhBwC1m8pUoqjawsZex4aVnQgXzDPfcjtmy6pElwK0z2U5DnO+OK9vCgQ==} - dependencies: - '@unocss/core': 0.58.0 - '@unocss/rule-utils': 0.58.0 - css-tree: 2.3.1 - dev: true + '@unocss/vite@66.0.0': + resolution: {integrity: sha512-IVcPX8xL+2edyXKt4tp9yu5A6gcbPVCsspfcL0XgziCr01kS+4qSoZ90F3IUs3hXc/AyO5eCpRtGFMPLpOjXQg==} + peerDependencies: + vite: ^2.9.0 || ^3.0.0-0 || ^4.0.0 || ^5.0.0-0 || ^6.0.0-0 - /@unocss/transformer-variant-group@0.58.0: - resolution: {integrity: sha512-O2n8uVIpNic57rrkaaQ8jnC1WJ9N6FkoqxatRDXZ368aJ1CJNya0ZcVUL6lGGND0bOLXen4WmEN62ZxEWTqdkA==} - dependencies: - '@unocss/core': 0.58.0 - dev: true + '@vue/compiler-core@3.5.13': + resolution: {integrity: sha512-oOdAkwqUfW1WqpwSYJce06wvt6HljgY3fGeM9NcVA1HaYOij3mZG9Rkysn0OHuyUAGMbEbARIpsG+LPVlBJ5/Q==} + + '@vue/compiler-dom@3.5.13': + resolution: {integrity: sha512-ZOJ46sMOKUjO3e94wPdCzQ6P1Lx/vhp2RSvfaab88Ajexs0AHeV0uasYhi99WPaogmBlRHNRuly8xV75cNTMDA==} + + '@vue/compiler-sfc@3.5.13': + resolution: {integrity: sha512-6VdaljMpD82w6c2749Zhf5T9u5uLBWKnVue6XWxprDobftnletJ8+oel7sexFfM3qIxNmVE7LSFGTpv6obNyaQ==} + + '@vue/compiler-ssr@3.5.13': + resolution: {integrity: sha512-wMH6vrYHxQl/IybKJagqbquvxpWCuVYpoUJfCqFZwa/JY1GdATAQ+TgVtgrwwMZ0D07QhA99rs/EAAWfvG6KpA==} + + '@vue/reactivity@3.5.13': + resolution: {integrity: sha512-NaCwtw8o48B9I6L1zl2p41OHo/2Z4wqYGGIK1Khu5T7yxrn+ATOixn/Udn2m+6kZKB/J7cuT9DbWWhRxqixACg==} - /@unocss/vite@0.58.0(vite@5.0.12): - resolution: {integrity: sha512-OCUOLMSOBEtXOEyBbAvMI3/xdR175BWRzmvV9Wc34ANZclEvCdVH8+WU725ibjY4VT0gVIuX68b13fhXdHV41A==} + '@vue/runtime-core@3.5.13': + resolution: {integrity: sha512-Fj4YRQ3Az0WTZw1sFe+QDb0aXCerigEpw418pw1HBUKFtnQHWzwojaukAs2X/c9DQz4MQ4bsXTGlcpGxU/RCIw==} + + '@vue/runtime-dom@3.5.13': + resolution: {integrity: sha512-dLaj94s93NYLqjLiyFzVs9X6dWhTdAlEAciC3Moq7gzAc13VJUdCnjjRurNM6uTLFATRHexHCTu/Xp3eW6yoog==} + + '@vue/server-renderer@3.5.13': + resolution: {integrity: sha512-wAi4IRJV/2SAW3htkTlB+dHeRmpTiVIK1OGLWV1yeStVSebSQQOwGwIq0D3ZIoBj2C2qpgz5+vX9iEBkTdk5YA==} peerDependencies: - vite: ^2.9.0 || ^3.0.0-0 || ^4.0.0 || ^5.0.0-0 - dependencies: - '@ampproject/remapping': 2.2.1 - '@rollup/pluginutils': 5.1.0 - '@unocss/config': 0.58.0 - '@unocss/core': 0.58.0 - '@unocss/inspector': 0.58.0 - '@unocss/scope': 0.58.0 - '@unocss/transformer-directives': 0.58.0 - chokidar: 3.5.3 - fast-glob: 3.3.2 - magic-string: 0.30.5 - vite: 5.0.12 - transitivePeerDependencies: - - rollup - dev: true + vue: 3.5.13 + + '@vue/shared@3.5.13': + resolution: {integrity: sha512-/hnE/qP5ZoGpol0a5mDi45bOd7t3tjYJBjsgCsivow7D48cJeV5l05RD82lPqi7gRiphZM37rnhW1l6ZoCNNnQ==} - /@zerodevx/svelte-json-view@1.0.7(svelte@4.2.8): - resolution: {integrity: sha512-yW0MV+9BCKOwzt3h86y3xDqYdI5st+Rxk+L5pa0Utq7nlPD+VvxyhL7R1gJoLxQvWwjyAvY/fyUCFTdwDyI14w==} + '@zerodevx/svelte-json-view@1.0.11': + resolution: {integrity: sha512-mIjj0H1al/P4FPlbeDoiey93lNEUqBEAe5LIdD5GttZfEYt3awexD2lHwKNfUeY4jHizOJkoWTPN/2iO0GBqpw==} peerDependencies: - svelte: ^3.57.0 || ^4.0.0 - dependencies: - svelte: 4.2.8 - dev: false + svelte: ^3.57.0 || ^4.0.0 || ^5.0.0 + + abort-controller@3.0.0: + resolution: {integrity: sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==} + engines: {node: '>=6.5'} - /acorn-jsx@5.3.2(acorn@8.11.2): + acorn-jsx@5.3.2: resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 - dependencies: - acorn: 8.11.2 - dev: true - /acorn@8.11.2: - resolution: {integrity: sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==} + acorn-typescript@1.4.13: + resolution: {integrity: sha512-xsc9Xv0xlVfwp2o7sQ+GCQ1PgbkdcpWdTzrwXxO3xDMTAywVS3oXVOcOHuRjAPkS4P9b+yc/qNF15460v+jp4Q==} + peerDependencies: + acorn: '>=8.9.0' + + acorn@8.14.0: + resolution: {integrity: sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==} engines: {node: '>=0.4.0'} hasBin: true - /ajv@6.12.6: + ajv@6.12.6: resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} - dependencies: - fast-deep-equal: 3.1.3 - fast-json-stable-stringify: 2.1.0 - json-schema-traverse: 0.4.1 - uri-js: 4.4.1 - dev: true - /ansi-colors@4.1.1: - resolution: {integrity: sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==} + ansi-colors@4.1.3: + resolution: {integrity: sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==} engines: {node: '>=6'} - dev: true - - /ansi-escapes@4.3.2: - resolution: {integrity: sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==} - engines: {node: '>=8'} - dependencies: - type-fest: 0.21.3 - dev: true - /ansi-regex@5.0.1: + ansi-regex@5.0.1: resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} engines: {node: '>=8'} - dev: true - - /ansi-styles@3.2.1: - resolution: {integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==} - engines: {node: '>=4'} - dependencies: - color-convert: 1.9.3 - dev: true - /ansi-styles@4.3.0: + ansi-styles@4.3.0: resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} engines: {node: '>=8'} - dependencies: - color-convert: 2.0.1 - dev: true - /anymatch@3.1.3: + anymatch@3.1.3: resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} engines: {node: '>= 8'} - dependencies: - normalize-path: 3.0.0 - picomatch: 2.3.1 - dev: true - /argparse@2.0.1: + argparse@2.0.1: resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} - dev: true - - /aria-query@5.3.0: - resolution: {integrity: sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==} - dependencies: - dequal: 2.0.3 - /array-buffer-byte-length@1.0.0: - resolution: {integrity: sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==} - dependencies: - call-bind: 1.0.5 - is-array-buffer: 3.0.2 - dev: true - - /array-includes@3.1.7: - resolution: {integrity: sha512-dlcsNBIiWhPkHdOEEKnehA+RNUWDc4UqFtnIXU4uuYDPtA4LDkr7qip2p0VvFAEXNDr0yWZ9PJyIRiGjRLQzwQ==} + aria-query@5.3.2: + resolution: {integrity: sha512-COROpnaoap1E2F000S62r6A60uHZnmlvomhfyT2DlTcrY1OrBKn2UhH7qn5wTC9zMvD0AY7csdPSNwKP+7WiQw==} engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - get-intrinsic: 1.2.2 - is-string: 1.0.7 - dev: true - /array-union@2.1.0: + array-union@2.1.0: resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==} engines: {node: '>=8'} - dev: true - - /array.prototype.findlastindex@1.2.3: - resolution: {integrity: sha512-LzLoiOMAxvy+Gd3BAq3B7VeIgPdo+Q8hthvKtXybMvRV0jrXfJM/t8mw7nNlpEcVlVUnCnM2KSX4XU5HmpodOA==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - es-shim-unscopables: 1.0.2 - get-intrinsic: 1.2.2 - dev: true - - /array.prototype.flat@1.3.2: - resolution: {integrity: sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - es-shim-unscopables: 1.0.2 - dev: true - /array.prototype.flatmap@1.3.2: - resolution: {integrity: sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - es-shim-unscopables: 1.0.2 - dev: true + atomic-sleep@1.0.0: + resolution: {integrity: sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==} + engines: {node: '>=8.0.0'} - /arraybuffer.prototype.slice@1.0.2: - resolution: {integrity: sha512-yMBKppFur/fbHu9/6USUe03bZ4knMYiwFBcyiaXB8Go0qNehwX6inYPzK9U0NeQvGxKthcmHcaR8P5MStSRBAw==} - engines: {node: '>= 0.4'} - dependencies: - array-buffer-byte-length: 1.0.0 - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - get-intrinsic: 1.2.2 - is-array-buffer: 3.0.2 - is-shared-array-buffer: 1.0.2 - dev: true - - /available-typed-arrays@1.0.5: - resolution: {integrity: sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==} + axobject-query@4.1.0: + resolution: {integrity: sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==} engines: {node: '>= 0.4'} - dev: true - - /axobject-query@3.2.1: - resolution: {integrity: sha512-jsyHu61e6N4Vbz/v18DHwWYKK0bSWLqn47eeDSKPB7m8tqMHF9YJ+mhIk2lVteyZrY8tnSj/jHOv4YiTCuCJgg==} - dependencies: - dequal: 2.0.3 - /bail@1.0.5: + bail@1.0.5: resolution: {integrity: sha512-xFbRxM1tahm08yHBP16MMjVUAvDaBMD38zsM9EMAUN61omwLmKlOpB/Zku5QkjZ8TZ4vn53pj+t518cH0S03RQ==} - dev: true - /balanced-match@1.0.2: + balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} - dev: true - /base64-js@1.5.1: + base64-js@1.5.1: resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} - dev: true - /binary-extensions@2.2.0: - resolution: {integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==} + binary-extensions@2.3.0: + resolution: {integrity: sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==} engines: {node: '>=8'} - dev: true - - /bl@4.1.0: - resolution: {integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==} - dependencies: - buffer: 5.7.1 - inherits: 2.0.4 - readable-stream: 3.6.2 - dev: true - /brace-expansion@1.1.11: + brace-expansion@1.1.11: resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} - dependencies: - balanced-match: 1.0.2 - concat-map: 0.0.1 - dev: true - /brace-expansion@2.0.1: + brace-expansion@2.0.1: resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==} - dependencies: - balanced-match: 1.0.2 - dev: true - /braces@3.0.2: - resolution: {integrity: sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==} + braces@3.0.3: + resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} engines: {node: '>=8'} - dependencies: - fill-range: 7.0.1 - dev: true - /browser-stdout@1.3.1: + browser-stdout@1.3.1: resolution: {integrity: sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==} - dev: true - /browserslist@4.22.2: - resolution: {integrity: sha512-0UgcrvQmBDvZHFGdYUehrCNIazki7/lUP3kkoi/r3YB2amZbFM9J43ZRkJTXBUZK4gmx56+Sqk9+Vs9mwZx9+A==} - engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} - hasBin: true - dependencies: - caniuse-lite: 1.0.30001566 - electron-to-chromium: 1.4.605 - node-releases: 2.0.14 - update-browserslist-db: 1.0.13(browserslist@4.22.2) - dev: true - - /buffer-from@1.1.2: + buffer-from@1.1.2: resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} - dev: true - /buffer@5.7.1: - resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==} - dependencies: - base64-js: 1.5.1 - ieee754: 1.2.1 - dev: true - - /builtin-modules@3.3.0: - resolution: {integrity: sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==} - engines: {node: '>=6'} - dev: true + buffer@6.0.3: + resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==} - /builtins@5.0.1: - resolution: {integrity: sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==} - dependencies: - semver: 7.5.4 - dev: true - - /cac@6.7.14: + cac@6.7.14: resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} engines: {node: '>=8'} - dev: true - - /call-bind@1.0.5: - resolution: {integrity: sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==} - dependencies: - function-bind: 1.1.2 - get-intrinsic: 1.2.2 - set-function-length: 1.1.1 - dev: true - /callsites@3.1.0: + callsites@3.1.0: resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} engines: {node: '>=6'} - dev: true - /camelcase@6.3.0: + camelcase@6.3.0: resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==} engines: {node: '>=10'} - dev: true - - /caniuse-lite@1.0.30001566: - resolution: {integrity: sha512-ggIhCsTxmITBAMmK8yZjEhCO5/47jKXPu6Dha/wuCS4JePVL+3uiDEBuhu2aIoT+bqTOR8L76Ip1ARL9xYsEJA==} - dev: true - - /chalk@2.4.2: - resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} - engines: {node: '>=4'} - dependencies: - ansi-styles: 3.2.1 - escape-string-regexp: 1.0.5 - supports-color: 5.5.0 - dev: true - /chalk@4.1.2: + chalk@4.1.2: resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} engines: {node: '>=10'} - dependencies: - ansi-styles: 4.3.0 - supports-color: 7.2.0 - dev: true - /character-entities-legacy@1.1.4: + character-entities-legacy@1.1.4: resolution: {integrity: sha512-3Xnr+7ZFS1uxeiUDvV02wQ+QDbc55o97tIV5zHScSPJpcLm/r0DFPcoY3tYRp+VZukxuMeKgXYmsXQHO05zQeA==} - dev: true - /character-entities@1.2.4: + character-entities@1.2.4: resolution: {integrity: sha512-iBMyeEHxfVnIakwOuDXpVkc54HijNgCyQB2w0VfGQThle6NXn50zU6V/u+LDhxHcDUPojn6Kpga3PTAD8W1bQw==} - dev: true - /character-reference-invalid@1.1.4: + character-reference-invalid@1.1.4: resolution: {integrity: sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg==} - dev: true - /chardet@0.7.0: - resolution: {integrity: sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==} - dev: true - - /chokidar@3.5.3: - resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} + chokidar@3.6.0: + resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==} engines: {node: '>= 8.10.0'} - dependencies: - anymatch: 3.1.3 - braces: 3.0.2 - glob-parent: 5.1.2 - is-binary-path: 2.1.0 - is-glob: 4.0.3 - normalize-path: 3.0.0 - readdirp: 3.6.0 - optionalDependencies: - fsevents: 2.3.3 - dev: true - - /cidr-regex@4.0.3: - resolution: {integrity: sha512-HOwDIy/rhKeMf6uOzxtv7FAbrz8zPjmVKfSpM+U7/bNBXC5rtOyr758jxcptiSx6ZZn5LOhPJT5WWxPAGDV8dw==} - engines: {node: '>=14'} - dependencies: - ip-regex: 5.0.0 - dev: true - - /cidr-tools@6.4.2: - resolution: {integrity: sha512-KZC8t2ipCqU2M+ISmTxRDGu9bku5MRU3V1cWyGEFJTZEzRhGvBJvVsbpZO5UAu12fExRFihtYGXAlgFFpmK9jw==} - engines: {node: '>=16'} - dependencies: - cidr-regex: 4.0.3 - ip-bigint: 7.3.0 - ip-regex: 5.0.0 - string-natural-compare: 3.0.1 - dev: true - /cli-cursor@3.1.0: - resolution: {integrity: sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==} - engines: {node: '>=8'} - dependencies: - restore-cursor: 3.1.0 - dev: true - - /cli-spinners@2.9.2: - resolution: {integrity: sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==} - engines: {node: '>=6'} - dev: true - - /cli-width@3.0.0: - resolution: {integrity: sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==} - engines: {node: '>= 10'} - dev: true - - /cliui@7.0.4: + cliui@7.0.4: resolution: {integrity: sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==} - dependencies: - string-width: 4.2.3 - strip-ansi: 6.0.1 - wrap-ansi: 7.0.0 - dev: true - /cliui@8.0.1: + cliui@8.0.1: resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==} engines: {node: '>=12'} - dependencies: - string-width: 4.2.3 - strip-ansi: 6.0.1 - wrap-ansi: 7.0.0 - dev: true - - /clone-regexp@3.0.0: - resolution: {integrity: sha512-ujdnoq2Kxb8s3ItNBtnYeXdm07FcU0u8ARAT1lQ2YdMwQC+cdiXX8KoqMVuglztILivceTtp4ivqGSmEmhBUJw==} - engines: {node: '>=12'} - dependencies: - is-regexp: 3.1.0 - dev: true - - /clone@1.0.4: - resolution: {integrity: sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==} - engines: {node: '>=0.8'} - dev: true - - /code-red@1.0.4: - resolution: {integrity: sha512-7qJWqItLA8/VPVlKJlFXU+NBlo/qyfs39aJcuMT/2ere32ZqvF5OSxgdM5xOfJJ7O429gg2HM47y8v9P+9wrNw==} - dependencies: - '@jridgewell/sourcemap-codec': 1.4.15 - '@types/estree': 1.0.5 - acorn: 8.11.2 - estree-walker: 3.0.3 - periscopic: 3.1.0 - /color-convert@1.9.3: - resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} - dependencies: - color-name: 1.1.3 - dev: true + clsx@2.1.1: + resolution: {integrity: sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==} + engines: {node: '>=6'} - /color-convert@2.0.1: + color-convert@2.0.1: resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} engines: {node: '>=7.0.0'} - dependencies: - color-name: 1.1.4 - dev: true - - /color-name@1.1.3: - resolution: {integrity: sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==} - dev: true - /color-name@1.1.4: + color-name@1.1.4: resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} - dev: true - /colorette@2.0.20: + colorette@2.0.20: resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==} - dev: true - /commander@2.20.3: + commander@2.20.3: resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} - dev: true - /concat-map@0.0.1: + concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} - dev: true - - /consola@3.2.3: - resolution: {integrity: sha512-I5qxpzLv+sJhTVEoLYNcTW+bThDCPsit0vLNKShZx6rLtpilNpmmeTPaeqJb9ZE9dV3DGaeby6Vuhrw38WjeyQ==} - engines: {node: ^14.18.0 || >=16.10.0} - dev: true - /convert-hrtime@5.0.0: - resolution: {integrity: sha512-lOETlkIeYSJWcbbcvjRKGxVMXJR+8+OQb/mTPbA4ObPMytYIsUbuOE0Jzy60hjARYszq1id0j8KgVhC+WGZVTg==} - engines: {node: '>=12'} - dev: true + confbox@0.1.8: + resolution: {integrity: sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==} - /convert-source-map@2.0.0: - resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==} - dev: true + consola@3.4.0: + resolution: {integrity: sha512-EiPU8G6dQG0GFHNR8ljnZFki/8a+cQwEQ+7wpxdChl02Q8HXlwEZWD5lqAF8vC2sEC3Tehr8hy7vErz88LHyUA==} + engines: {node: ^14.18.0 || >=16.10.0} - /covector@0.10.2(mocha@10.2.0): - resolution: {integrity: sha512-Nbz2x5cnS7F0fTT/raNKo0UYbI6rjaDoCrAJNoOpsSHdztnlFi7Bb6lU6kOBEeEH1zHVJk5F3ChBs0VNAuf5mg==} + covector@0.12.4: + resolution: {integrity: sha512-qRK0Qg1FaRkB7dFDzzKiTn9H3EAMb83N5Hl6KVol2zpenmkKz8A7aa+7C49Z7LHtSgKkIWkqxIut8qcN6pRnag==} + engines: {node: '>=18'} hasBin: true - dependencies: - '@covector/apply': 0.9.2(mocha@10.2.0) - '@covector/assemble': 0.10.3(mocha@10.2.0) - '@covector/changelog': 0.10.1(mocha@10.2.0) - '@covector/command': 0.7.0(mocha@10.2.0) - '@covector/files': 0.7.1 - effection: 2.0.8(mocha@10.2.0) - globby: 11.1.0 - inquirer: 8.2.6 - yargs: 17.7.2 - transitivePeerDependencies: - - encoding - - mocha - - supports-color - dev: true - /cross-fetch@3.1.5: + cross-fetch@3.1.5: resolution: {integrity: sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==} - dependencies: - node-fetch: 2.6.7 - transitivePeerDependencies: - - encoding - dev: true - /cross-spawn@7.0.3: - resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} + cross-spawn@7.0.6: + resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} engines: {node: '>= 8'} - dependencies: - path-key: 3.1.1 - shebang-command: 2.0.0 - which: 2.0.2 - dev: true - /css-tree@2.3.1: - resolution: {integrity: sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==} + css-tree@3.1.0: + resolution: {integrity: sha512-0eW44TGN5SQXU1mWSkKwFstI/22X2bG1nYzZTYMAWjylYURhse752YgbE4Cx46AC+bAvI+/dYTPRk1LqSUnu6w==} engines: {node: ^10 || ^12.20.0 || ^14.13.0 || >=15.0.0} - dependencies: - mdn-data: 2.0.30 - source-map-js: 1.0.2 - /ctrlc-windows@2.1.0: - resolution: {integrity: sha512-OrX5KI+K+2NMN91QIhYZdW7VDO2YsSdTZW494pA7Nvw/wBdU2hz+MGP006bR978zOTrG6Q8EIeJvLJmLqc6MsQ==} - dev: true - - /debug@3.2.7: - resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==} - peerDependencies: - supports-color: '*' - peerDependenciesMeta: - supports-color: - optional: true - dependencies: - ms: 2.1.3 - dev: true + csstype@3.1.3: + resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==} - /debug@4.3.4: - resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} - engines: {node: '>=6.0'} - peerDependencies: - supports-color: '*' - peerDependenciesMeta: - supports-color: - optional: true - dependencies: - ms: 2.1.2 - dev: true + ctrlc-windows@2.2.0: + resolution: {integrity: sha512-t9y568r+T8FUuBaqKK60YGFJdj3b3ktdJW9WXIT3CuBdQhAOYdSZu75jFUN0Ay4Yz5HHicVQqAYCwcnqhOn23g==} - /debug@4.3.4(supports-color@8.1.1): - resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} + debug@4.4.0: + resolution: {integrity: sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==} engines: {node: '>=6.0'} peerDependencies: supports-color: '*' peerDependenciesMeta: supports-color: optional: true - dependencies: - ms: 2.1.2 - supports-color: 8.1.1 - dev: true - /decamelize@4.0.0: + decamelize@4.0.0: resolution: {integrity: sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==} engines: {node: '>=10'} - dev: true - /deep-is@0.1.4: + deep-is@0.1.4: resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} - dev: true - /deepmerge@4.3.1: + deepmerge@4.3.1: resolution: {integrity: sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==} engines: {node: '>=0.10.0'} - dev: true - - /default-gateway@7.2.2: - resolution: {integrity: sha512-AD7TrdNNPXRZIGw63dw+lnGmT4v7ggZC5NHNJgAYWm5njrwoze1q5JSAW9YuLy2tjnoLUG/r8FEB93MCh9QJPg==} - engines: {node: '>= 16'} - dependencies: - execa: 7.2.0 - dev: true - - /defaults@1.0.4: - resolution: {integrity: sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==} - dependencies: - clone: 1.0.4 - dev: true - - /define-data-property@1.1.1: - resolution: {integrity: sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==} - engines: {node: '>= 0.4'} - dependencies: - get-intrinsic: 1.2.2 - gopd: 1.0.1 - has-property-descriptors: 1.0.1 - dev: true - - /define-properties@1.2.1: - resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==} - engines: {node: '>= 0.4'} - dependencies: - define-data-property: 1.1.1 - has-property-descriptors: 1.0.1 - object-keys: 1.1.1 - dev: true - - /defu@6.1.2: - resolution: {integrity: sha512-+uO4+qr7msjNNWKYPHqN/3+Dx3NFkmIzayk2L1MyZQlvgZb/J1A0fo410dpKrN2SnqFjt8n4JL8fDJE0wIgjFQ==} - dev: true - /dequal@2.0.3: - resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==} - engines: {node: '>=6'} + defu@6.1.4: + resolution: {integrity: sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==} - /destr@2.0.1: - resolution: {integrity: sha512-M1Ob1zPSIvlARiJUkKqvAZ3VAqQY6Jcuth/pBKQ2b1dX/Qx0OnJ8Vux6J2H5PTMQeRzWrrbTu70VxBfv/OPDJA==} - dev: true + destr@2.0.3: + resolution: {integrity: sha512-2N3BOUU4gYMpTP24s5rF5iP7BDr7uNTCs4ozw3kf/eKfvWSIu93GEBi5m427YoyJoeOzQ5smuu4nNAPGb8idSQ==} - /diff@5.0.0: - resolution: {integrity: sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==} + diff@5.2.0: + resolution: {integrity: sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==} engines: {node: '>=0.3.1'} - dev: true - /dir-glob@3.0.1: + dir-glob@3.0.1: resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} engines: {node: '>=8'} - dependencies: - path-type: 4.0.0 - dev: true - - /doctrine@2.1.0: - resolution: {integrity: sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==} - engines: {node: '>=0.10.0'} - dependencies: - esutils: 2.0.3 - dev: true - - /doctrine@3.0.0: - resolution: {integrity: sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==} - engines: {node: '>=6.0.0'} - dependencies: - esutils: 2.0.3 - dev: true - /duplexer@0.1.2: + duplexer@0.1.2: resolution: {integrity: sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==} - dev: true - - /effection@2.0.8: - resolution: {integrity: sha512-/v7cbPIXGGylInQgHHjJutzqUn6VIfcP13hh2X0hXf04wwAlSI+lVjUBKpr5TX3+v9dXV/JLHO/pqQ9Cp1QAnQ==} - dependencies: - '@effection/channel': 2.0.6 - '@effection/core': 2.2.3 - '@effection/events': 2.0.6 - '@effection/fetch': 2.0.7(mocha@10.2.0) - '@effection/main': 2.1.2 - '@effection/stream': 2.0.6 - '@effection/subscription': 2.0.6 - dev: true - /effection@2.0.8(mocha@10.2.0): + effection@2.0.8: resolution: {integrity: sha512-/v7cbPIXGGylInQgHHjJutzqUn6VIfcP13hh2X0hXf04wwAlSI+lVjUBKpr5TX3+v9dXV/JLHO/pqQ9Cp1QAnQ==} - dependencies: - '@effection/channel': 2.0.6 - '@effection/core': 2.2.3 - '@effection/events': 2.0.6 - '@effection/fetch': 2.0.7(mocha@10.2.0) - '@effection/main': 2.1.2 - '@effection/stream': 2.0.6 - '@effection/subscription': 2.0.6 - transitivePeerDependencies: - - encoding - - mocha - dev: true - /electron-to-chromium@1.4.605: - resolution: {integrity: sha512-V52j+P5z6cdRqTjPR/bYNxx7ETCHIkm5VIGuyCy3CMrfSnbEpIlLnk5oHmZo7gYvDfh2TfHeanB6rawyQ23ktg==} - dev: true - - /emoji-regex@8.0.0: + emoji-regex@8.0.0: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} - dev: true - - /es-abstract@1.22.3: - resolution: {integrity: sha512-eiiY8HQeYfYH2Con2berK+To6GrK2RxbPawDkGq4UiCQQfZHb6wX9qQqkbpPqaxQFcl8d9QzZqo0tGE0VcrdwA==} - engines: {node: '>= 0.4'} - dependencies: - array-buffer-byte-length: 1.0.0 - arraybuffer.prototype.slice: 1.0.2 - available-typed-arrays: 1.0.5 - call-bind: 1.0.5 - es-set-tostringtag: 2.0.2 - es-to-primitive: 1.2.1 - function.prototype.name: 1.1.6 - get-intrinsic: 1.2.2 - get-symbol-description: 1.0.0 - globalthis: 1.0.3 - gopd: 1.0.1 - has-property-descriptors: 1.0.1 - has-proto: 1.0.1 - has-symbols: 1.0.3 - hasown: 2.0.0 - internal-slot: 1.0.6 - is-array-buffer: 3.0.2 - is-callable: 1.2.7 - is-negative-zero: 2.0.2 - is-regex: 1.1.4 - is-shared-array-buffer: 1.0.2 - is-string: 1.0.7 - is-typed-array: 1.1.12 - is-weakref: 1.0.2 - object-inspect: 1.13.1 - object-keys: 1.1.1 - object.assign: 4.1.5 - regexp.prototype.flags: 1.5.1 - safe-array-concat: 1.0.1 - safe-regex-test: 1.0.0 - string.prototype.trim: 1.2.8 - string.prototype.trimend: 1.0.7 - string.prototype.trimstart: 1.0.7 - typed-array-buffer: 1.0.0 - typed-array-byte-length: 1.0.0 - typed-array-byte-offset: 1.0.0 - typed-array-length: 1.0.4 - unbox-primitive: 1.0.2 - which-typed-array: 1.1.13 - dev: true - - /es-set-tostringtag@2.0.2: - resolution: {integrity: sha512-BuDyupZt65P9D2D2vA/zqcI3G5xRsklm5N3xCwuiy+/vKy8i0ifdsQP1sLgO4tZDSCaQUSnmC48khknGMV3D2Q==} - engines: {node: '>= 0.4'} - dependencies: - get-intrinsic: 1.2.2 - has-tostringtag: 1.0.0 - hasown: 2.0.0 - dev: true - - /es-shim-unscopables@1.0.2: - resolution: {integrity: sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw==} - dependencies: - hasown: 2.0.0 - dev: true - /es-to-primitive@1.2.1: - resolution: {integrity: sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==} - engines: {node: '>= 0.4'} - dependencies: - is-callable: 1.2.7 - is-date-object: 1.0.5 - is-symbol: 1.0.4 - dev: true + entities@4.5.0: + resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} + engines: {node: '>=0.12'} - /esbuild@0.19.8: - resolution: {integrity: sha512-l7iffQpT2OrZfH2rXIp7/FkmaeZM0vxbxN9KfiCwGYuZqzMg/JdvX26R31Zxn/Pxvsrg3Y9N6XTcnknqDyyv4w==} - engines: {node: '>=12'} + esbuild@0.25.2: + resolution: {integrity: sha512-16854zccKPnC+toMywC+uKNeYSv+/eXkevRAfwRD/G9Cleq66m8XFIrigkbvauLLlCfDL45Q2cWegSg53gGBnQ==} + engines: {node: '>=18'} hasBin: true - requiresBuild: true - optionalDependencies: - '@esbuild/android-arm': 0.19.8 - '@esbuild/android-arm64': 0.19.8 - '@esbuild/android-x64': 0.19.8 - '@esbuild/darwin-arm64': 0.19.8 - '@esbuild/darwin-x64': 0.19.8 - '@esbuild/freebsd-arm64': 0.19.8 - '@esbuild/freebsd-x64': 0.19.8 - '@esbuild/linux-arm': 0.19.8 - '@esbuild/linux-arm64': 0.19.8 - '@esbuild/linux-ia32': 0.19.8 - '@esbuild/linux-loong64': 0.19.8 - '@esbuild/linux-mips64el': 0.19.8 - '@esbuild/linux-ppc64': 0.19.8 - '@esbuild/linux-riscv64': 0.19.8 - '@esbuild/linux-s390x': 0.19.8 - '@esbuild/linux-x64': 0.19.8 - '@esbuild/netbsd-x64': 0.19.8 - '@esbuild/openbsd-x64': 0.19.8 - '@esbuild/sunos-x64': 0.19.8 - '@esbuild/win32-arm64': 0.19.8 - '@esbuild/win32-ia32': 0.19.8 - '@esbuild/win32-x64': 0.19.8 - dev: true - - /escalade@3.1.1: - resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} - engines: {node: '>=6'} - dev: true - /escape-string-regexp@1.0.5: - resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==} - engines: {node: '>=0.8.0'} - dev: true + escalade@3.2.0: + resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==} + engines: {node: '>=6'} - /escape-string-regexp@4.0.0: + escape-string-regexp@4.0.0: resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} engines: {node: '>=10'} - dev: true - - /eslint-compat-utils@0.1.2(eslint@8.56.0): - resolution: {integrity: sha512-Jia4JDldWnFNIru1Ehx1H5s9/yxiRHY/TimCuUc0jNexew3cF1gI6CYZil1ociakfWO3rRqFjl1mskBblB3RYg==} - engines: {node: '>=12'} - peerDependencies: - eslint: '>=6.0.0' - dependencies: - eslint: 8.56.0 - dev: true - /eslint-config-prettier@9.1.0(eslint@8.56.0): - resolution: {integrity: sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==} + eslint-config-prettier@10.1.2: + resolution: {integrity: sha512-Epgp/EofAUeEpIdZkW60MHKvPyru1ruQJxPL+WIycnaPApuseK0Zpkrh/FwL9oIpQvIhJwV7ptOy0DWUjTlCiA==} hasBin: true peerDependencies: eslint: '>=7.0.0' - dependencies: - eslint: 8.56.0 - dev: true - /eslint-config-standard-with-typescript@43.0.1(@typescript-eslint/eslint-plugin@6.20.0)(eslint-plugin-import@2.29.1)(eslint-plugin-n@16.6.2)(eslint-plugin-promise@6.1.1)(eslint@8.56.0)(typescript@5.3.3): - resolution: {integrity: sha512-WfZ986+qzIzX6dcr4yGUyVb/l9N3Z8wPXCc5z/70fljs3UbWhhV+WxrfgsqMToRzuuyX9MqZ974pq2UPhDTOcA==} - peerDependencies: - '@typescript-eslint/eslint-plugin': ^6.4.0 - eslint: ^8.0.1 - eslint-plugin-import: ^2.25.2 - eslint-plugin-n: '^15.0.0 || ^16.0.0 ' - eslint-plugin-promise: ^6.0.0 - typescript: '*' - dependencies: - '@typescript-eslint/eslint-plugin': 6.20.0(@typescript-eslint/parser@6.20.0)(eslint@8.56.0)(typescript@5.3.3) - '@typescript-eslint/parser': 6.20.0(eslint@8.56.0)(typescript@5.3.3) - eslint: 8.56.0 - eslint-config-standard: 17.1.0(eslint-plugin-import@2.29.1)(eslint-plugin-n@16.6.2)(eslint-plugin-promise@6.1.1)(eslint@8.56.0) - eslint-plugin-import: 2.29.1(@typescript-eslint/parser@6.20.0)(eslint@8.56.0) - eslint-plugin-n: 16.6.2(eslint@8.56.0) - eslint-plugin-promise: 6.1.1(eslint@8.56.0) - typescript: 5.3.3 - transitivePeerDependencies: - - supports-color - dev: true + eslint-plugin-security@3.0.1: + resolution: {integrity: sha512-XjVGBhtDZJfyuhIxnQ/WMm385RbX3DBu7H1J7HNNhmB2tnGxMeqVSnYv79oAj992ayvIBZghsymwkYFS6cGH4Q==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - /eslint-config-standard@17.1.0(eslint-plugin-import@2.29.1)(eslint-plugin-n@16.6.2)(eslint-plugin-promise@6.1.1)(eslint@8.56.0): - resolution: {integrity: sha512-IwHwmaBNtDK4zDHQukFDW5u/aTb8+meQWZvNFWkiGmbWjD6bqyuSSBxxXKkCftCUzc1zwCH2m/baCNDLGmuO5Q==} - engines: {node: '>=12.0.0'} - peerDependencies: - eslint: ^8.0.1 - eslint-plugin-import: ^2.25.2 - eslint-plugin-n: '^15.0.0 || ^16.0.0 ' - eslint-plugin-promise: ^6.0.0 - dependencies: - eslint: 8.56.0 - eslint-plugin-import: 2.29.1(@typescript-eslint/parser@6.20.0)(eslint@8.56.0) - eslint-plugin-n: 16.6.2(eslint@8.56.0) - eslint-plugin-promise: 6.1.1(eslint@8.56.0) - dev: true - - /eslint-import-resolver-node@0.3.9: - resolution: {integrity: sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==} - dependencies: - debug: 3.2.7 - is-core-module: 2.13.1 - resolve: 1.22.8 - transitivePeerDependencies: - - supports-color - dev: true + eslint-scope@8.3.0: + resolution: {integrity: sha512-pUNxi75F8MJ/GdeKtVLSbYg4ZI34J6C0C7sbL4YOp2exGwen7ZsuBqKzUhXd0qMQ362yET3z+uPwKeg/0C2XCQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - /eslint-module-utils@2.8.0(@typescript-eslint/parser@6.20.0)(eslint-import-resolver-node@0.3.9)(eslint@8.56.0): - resolution: {integrity: sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==} - engines: {node: '>=4'} - peerDependencies: - '@typescript-eslint/parser': '*' - eslint: '*' - eslint-import-resolver-node: '*' - eslint-import-resolver-typescript: '*' - eslint-import-resolver-webpack: '*' - peerDependenciesMeta: - '@typescript-eslint/parser': - optional: true - eslint: - optional: true - eslint-import-resolver-node: - optional: true - eslint-import-resolver-typescript: - optional: true - eslint-import-resolver-webpack: - optional: true - dependencies: - '@typescript-eslint/parser': 6.20.0(eslint@8.56.0)(typescript@5.3.3) - debug: 3.2.7 - eslint: 8.56.0 - eslint-import-resolver-node: 0.3.9 - transitivePeerDependencies: - - supports-color - dev: true + eslint-visitor-keys@3.4.3: + resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - /eslint-plugin-es-x@7.5.0(eslint@8.56.0): - resolution: {integrity: sha512-ODswlDSO0HJDzXU0XvgZ3lF3lS3XAZEossh15Q2UHjwrJggWeBoKqqEsLTZLXl+dh5eOAozG0zRcYtuE35oTuQ==} - engines: {node: ^14.18.0 || >=16.0.0} - peerDependencies: - eslint: '>=8' - dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.56.0) - '@eslint-community/regexpp': 4.10.0 - eslint: 8.56.0 - eslint-compat-utils: 0.1.2(eslint@8.56.0) - dev: true + eslint-visitor-keys@4.2.0: + resolution: {integrity: sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - /eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.20.0)(eslint@8.56.0): - resolution: {integrity: sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==} - engines: {node: '>=4'} + eslint@9.25.1: + resolution: {integrity: sha512-E6Mtz9oGQWDCpV12319d59n4tx9zOTXSTmc8BLVxBx+G/0RdM5MvEEJLU9c0+aleoePYYgVTOsRblx433qmhWQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + hasBin: true peerDependencies: - '@typescript-eslint/parser': '*' - eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 + jiti: '*' peerDependenciesMeta: - '@typescript-eslint/parser': + jiti: optional: true - dependencies: - '@typescript-eslint/parser': 6.20.0(eslint@8.56.0)(typescript@5.3.3) - array-includes: 3.1.7 - array.prototype.findlastindex: 1.2.3 - array.prototype.flat: 1.3.2 - array.prototype.flatmap: 1.3.2 - debug: 3.2.7 - doctrine: 2.1.0 - eslint: 8.56.0 - eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.20.0)(eslint-import-resolver-node@0.3.9)(eslint@8.56.0) - hasown: 2.0.0 - is-core-module: 2.13.1 - is-glob: 4.0.3 - minimatch: 3.1.2 - object.fromentries: 2.0.7 - object.groupby: 1.0.1 - object.values: 1.1.7 - semver: 7.5.4 - tsconfig-paths: 3.15.0 - transitivePeerDependencies: - - eslint-import-resolver-typescript - - eslint-import-resolver-webpack - - supports-color - dev: true - - /eslint-plugin-n@16.6.2(eslint@8.56.0): - resolution: {integrity: sha512-6TyDmZ1HXoFQXnhCTUjVFULReoBPOAjpuiKELMkeP40yffI/1ZRO+d9ug/VC6fqISo2WkuIBk3cvuRPALaWlOQ==} - engines: {node: '>=16.0.0'} - peerDependencies: - eslint: '>=7.0.0' - dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.56.0) - builtins: 5.0.1 - eslint: 8.56.0 - eslint-plugin-es-x: 7.5.0(eslint@8.56.0) - get-tsconfig: 4.7.2 - globals: 13.24.0 - ignore: 5.3.0 - is-builtin-module: 3.2.1 - is-core-module: 2.13.1 - minimatch: 3.1.2 - resolve: 1.22.8 - semver: 7.5.4 - dev: true - - /eslint-plugin-promise@6.1.1(eslint@8.56.0): - resolution: {integrity: sha512-tjqWDwVZQo7UIPMeDReOpUgHCmCiH+ePnVT+5zVapL0uuHnegBUs2smM13CzOs2Xb5+MHMRFTs9v24yjba4Oig==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - peerDependencies: - eslint: ^7.0.0 || ^8.0.0 - dependencies: - eslint: 8.56.0 - dev: true - - /eslint-plugin-security@2.1.0: - resolution: {integrity: sha512-ywxclP954bf8d3gr6KOQ/AFc+PRvWuhOxtPOEtiHmVYiZr/mcgQtmSJq6+hTEXC5ylTjHnPPG+PEnzlDiWMXbQ==} - dependencies: - safe-regex: 2.1.1 - dev: true - - /eslint-scope@7.2.2: - resolution: {integrity: sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - dependencies: - esrecurse: 4.3.0 - estraverse: 5.3.0 - dev: true - - /eslint-visitor-keys@3.4.3: - resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - dev: true - /eslint@8.56.0: - resolution: {integrity: sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - hasBin: true - dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.56.0) - '@eslint-community/regexpp': 4.10.0 - '@eslint/eslintrc': 2.1.4 - '@eslint/js': 8.56.0 - '@humanwhocodes/config-array': 0.11.13 - '@humanwhocodes/module-importer': 1.0.1 - '@nodelib/fs.walk': 1.2.8 - '@ungap/structured-clone': 1.2.0 - ajv: 6.12.6 - chalk: 4.1.2 - cross-spawn: 7.0.3 - debug: 4.3.4 - doctrine: 3.0.0 - escape-string-regexp: 4.0.0 - eslint-scope: 7.2.2 - eslint-visitor-keys: 3.4.3 - espree: 9.6.1 - esquery: 1.5.0 - esutils: 2.0.3 - fast-deep-equal: 3.1.3 - file-entry-cache: 6.0.1 - find-up: 5.0.0 - glob-parent: 6.0.2 - globals: 13.23.0 - graphemer: 1.4.0 - ignore: 5.3.0 - imurmurhash: 0.1.4 - is-glob: 4.0.3 - is-path-inside: 3.0.3 - js-yaml: 4.1.0 - json-stable-stringify-without-jsonify: 1.0.1 - levn: 0.4.1 - lodash.merge: 4.6.2 - minimatch: 3.1.2 - natural-compare: 1.4.0 - optionator: 0.9.3 - strip-ansi: 6.0.1 - text-table: 0.2.0 - transitivePeerDependencies: - - supports-color - dev: true + esm-env@1.2.2: + resolution: {integrity: sha512-Epxrv+Nr/CaL4ZcFGPJIYLWFom+YeV1DqMLHJoEd9SYRxNbaFruBwfEX/kkHUJf55j2+TUbmDcmuilbP1TmXHA==} - /espree@9.6.1: - resolution: {integrity: sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - dependencies: - acorn: 8.11.2 - acorn-jsx: 5.3.2(acorn@8.11.2) - eslint-visitor-keys: 3.4.3 - dev: true + espree@10.3.0: + resolution: {integrity: sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - /esquery@1.5.0: - resolution: {integrity: sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==} + esquery@1.6.0: + resolution: {integrity: sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==} engines: {node: '>=0.10'} - dependencies: - estraverse: 5.3.0 - dev: true - /esrecurse@4.3.0: + esrap@1.4.5: + resolution: {integrity: sha512-CjNMjkBWWZeHn+VX+gS8YvFwJ5+NDhg8aWZBSFJPR8qQduDNjbJodA2WcwCm7uQa5Rjqj+nZvVmceg1RbHFB9g==} + + esrecurse@4.3.0: resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==} engines: {node: '>=4.0'} - dependencies: - estraverse: 5.3.0 - dev: true - /estraverse@5.3.0: + estraverse@5.3.0: resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==} engines: {node: '>=4.0'} - dev: true - /estree-walker@2.0.2: + estree-walker@2.0.2: resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==} - dev: true - - /estree-walker@3.0.3: - resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} - dependencies: - '@types/estree': 1.0.5 - /esutils@2.0.3: + esutils@2.0.3: resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} engines: {node: '>=0.10.0'} - dev: true - /event-target-shim@5.0.1: + event-target-shim@5.0.1: resolution: {integrity: sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==} engines: {node: '>=6'} - dev: true - /execa@5.1.1: - resolution: {integrity: sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==} - engines: {node: '>=10'} - dependencies: - cross-spawn: 7.0.3 - get-stream: 6.0.1 - human-signals: 2.1.0 - is-stream: 2.0.1 - merge-stream: 2.0.0 - npm-run-path: 4.0.1 - onetime: 5.1.2 - signal-exit: 3.0.7 - strip-final-newline: 2.0.0 - dev: true - - /execa@7.2.0: - resolution: {integrity: sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA==} - engines: {node: ^14.18.0 || ^16.14.0 || >=18.0.0} - dependencies: - cross-spawn: 7.0.3 - get-stream: 6.0.1 - human-signals: 4.3.1 - is-stream: 3.0.0 - merge-stream: 2.0.0 - npm-run-path: 5.1.0 - onetime: 6.0.0 - signal-exit: 3.0.7 - strip-final-newline: 3.0.0 - dev: true - - /extend@3.0.2: - resolution: {integrity: sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==} - dev: true + events@3.3.0: + resolution: {integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==} + engines: {node: '>=0.8.x'} - /external-editor@3.1.0: - resolution: {integrity: sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==} - engines: {node: '>=4'} - dependencies: - chardet: 0.7.0 - iconv-lite: 0.4.24 - tmp: 0.0.33 - dev: true + extend@3.0.2: + resolution: {integrity: sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==} - /fast-deep-equal@3.1.3: + fast-deep-equal@3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} - dev: true - /fast-glob@3.3.2: - resolution: {integrity: sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==} + fast-glob@3.3.3: + resolution: {integrity: sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==} engines: {node: '>=8.6.0'} - dependencies: - '@nodelib/fs.stat': 2.0.5 - '@nodelib/fs.walk': 1.2.8 - glob-parent: 5.1.2 - merge2: 1.4.1 - micromatch: 4.0.5 - dev: true - /fast-json-stable-stringify@2.1.0: + fast-json-stable-stringify@2.1.0: resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} - dev: true - /fast-levenshtein@2.0.6: + fast-levenshtein@2.0.6: resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==} - dev: true - /fastq@1.15.0: - resolution: {integrity: sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==} - dependencies: - reusify: 1.0.4 - dev: true + fast-redact@3.5.0: + resolution: {integrity: sha512-dwsoQlS7h9hMeYUq1W++23NDcBLV4KqONnITDV9DjfS3q1SgDGVrBdvvTLUotWtPSD7asWDV9/CmsZPy8Hf70A==} + engines: {node: '>=6'} - /fault@1.0.4: + fastq@1.19.1: + resolution: {integrity: sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==} + + fault@1.0.4: resolution: {integrity: sha512-CJ0HCB5tL5fYTEA7ToAq5+kTwd++Borf1/bifxd9iT70QcXr4MRrO3Llf8Ifs70q+SJcGHFtnIE/Nw6giCtECA==} + + fdir@6.4.3: + resolution: {integrity: sha512-PMXmW2y1hDDfTSRc9gaXIuCCRpuoz3Kaz8cUelp3smouvfT632ozg2vrT6lJsHKKOF59YLbOGfAWGUcKEfRMQw==} + peerDependencies: + picomatch: ^3 || ^4 + peerDependenciesMeta: + picomatch: + optional: true + + file-entry-cache@8.0.0: + resolution: {integrity: sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==} + engines: {node: '>=16.0.0'} + + fill-range@7.1.1: + resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} + engines: {node: '>=8'} + + find-up@5.0.0: + resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==} + engines: {node: '>=10'} + + flat-cache@4.0.1: + resolution: {integrity: sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==} + engines: {node: '>=16'} + + flat@5.0.2: + resolution: {integrity: sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==} + hasBin: true + + flatted@3.3.3: + resolution: {integrity: sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==} + + format@0.2.2: + resolution: {integrity: sha512-wzsgA6WOq+09wrU1tsJ09udeR/YZRaeArL9e1wPbFg3GG2yDnC2ldKpxs4xunpFF9DgqCqOIra3bc1HWrJ37Ww==} + engines: {node: '>=0.4.x'} + + fs.realpath@1.0.0: + resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} + + fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + + function-bind@1.1.2: + resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} + + get-caller-file@2.0.5: + resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} + engines: {node: 6.* || 8.* || >= 10.*} + + get-tsconfig@4.10.0: + resolution: {integrity: sha512-kGzZ3LWWQcGIAmg6iWvXn0ei6WDtV26wzHRMwDSzmAbcXrTEXxHy6IehI6/4eT6VRKyMP1eF1VqwrVUmE/LR7A==} + + glob-parent@5.1.2: + resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} + engines: {node: '>= 6'} + + glob-parent@6.0.2: + resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} + engines: {node: '>=10.13.0'} + + glob@8.1.0: + resolution: {integrity: sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==} + engines: {node: '>=12'} + deprecated: Glob versions prior to v9 are no longer supported + + globals@14.0.0: + resolution: {integrity: sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==} + engines: {node: '>=18'} + + globals@15.15.0: + resolution: {integrity: sha512-7ACyT3wmyp3I61S4fG682L0VA2RGD9otkqGJIwNUMF1SWUombIIk+af1unuDYgMm082aHYwD+mzJvv9Iu8dsgg==} + engines: {node: '>=18'} + + globby@11.1.0: + resolution: {integrity: sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==} + engines: {node: '>=10'} + + graphemer@1.4.0: + resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} + + gzip-size@6.0.0: + resolution: {integrity: sha512-ax7ZYomf6jqPTQ4+XCpUGyXKHk5WweS+e05MBO4/y3WJ5RkmPXNKvX+bx1behVILVwr6JSQvZAku021CHPXG3Q==} + engines: {node: '>=10'} + + has-flag@4.0.0: + resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} + engines: {node: '>=8'} + + hasown@2.0.2: + resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==} + engines: {node: '>= 0.4'} + + he@1.2.0: + resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==} + hasBin: true + + ieee754@1.2.1: + resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} + + ignore@5.3.2: + resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==} + engines: {node: '>= 4'} + + import-fresh@3.3.1: + resolution: {integrity: sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==} + engines: {node: '>=6'} + + imurmurhash@0.1.4: + resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} + engines: {node: '>=0.8.19'} + + inflight@1.0.6: + resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} + deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. + + inherits@2.0.4: + resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + + is-alphabetical@1.0.4: + resolution: {integrity: sha512-DwzsA04LQ10FHTZuL0/grVDk4rFoVH1pjAToYwBrHSxcrBIGQuXrQMtD5U1b0U2XVgKZCTLLP8u2Qxqhy3l2Vg==} + + is-alphanumerical@1.0.4: + resolution: {integrity: sha512-UzoZUr+XfVz3t3v4KyGEniVL9BDRoQtY7tOyrRybkVNjDFWyo1yhXNGrrBTQxp3ib9BLAWs7k2YKBQsFRkZG9A==} + + is-binary-path@2.1.0: + resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} + engines: {node: '>=8'} + + is-buffer@2.0.5: + resolution: {integrity: sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==} + engines: {node: '>=4'} + + is-core-module@2.16.1: + resolution: {integrity: sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==} + engines: {node: '>= 0.4'} + + is-decimal@1.0.4: + resolution: {integrity: sha512-RGdriMmQQvZ2aqaQq3awNA6dCGtKpiDFcOzrTWrDAT2MiWrKQVPmxLGHl7Y2nNu6led0kEyoX0enY0qXYsv9zw==} + + is-extglob@2.1.1: + resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} + engines: {node: '>=0.10.0'} + + is-fullwidth-code-point@3.0.0: + resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} + engines: {node: '>=8'} + + is-glob@4.0.3: + resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} + engines: {node: '>=0.10.0'} + + is-hexadecimal@1.0.4: + resolution: {integrity: sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw==} + + is-module@1.0.0: + resolution: {integrity: sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==} + + is-number@7.0.0: + resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} + engines: {node: '>=0.12.0'} + + is-plain-obj@2.1.0: + resolution: {integrity: sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==} + engines: {node: '>=8'} + + is-reference@3.0.3: + resolution: {integrity: sha512-ixkJoqQvAP88E6wLydLGGqCJsrFUnqoH6HnaczB8XmDH1oaWU+xxdptvikTgaEhtZ53Ky6YXiBuUI2WXLMCwjw==} + + is-unicode-supported@0.1.0: + resolution: {integrity: sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==} + engines: {node: '>=10'} + + isexe@2.0.0: + resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + + jiti@2.4.2: + resolution: {integrity: sha512-rg9zJN+G4n2nfJl5MW3BMygZX56zKPNVEYYqq7adpmMh4Jn2QNEwhvQlFy6jPVdcod7txZtKHWnyZiA3a0zP7A==} + hasBin: true + + js-yaml@4.1.0: + resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} + hasBin: true + + json-buffer@3.0.1: + resolution: {integrity: sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==} + + json-schema-traverse@0.4.1: + resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} + + json-stable-stringify-without-jsonify@1.0.1: + resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==} + + keyv@4.5.4: + resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==} + + kleur@4.1.5: + resolution: {integrity: sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==} + engines: {node: '>=6'} + + kolorist@1.8.0: + resolution: {integrity: sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ==} + + levn@0.4.1: + resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==} + engines: {node: '>= 0.8.0'} + + local-pkg@1.0.0: + resolution: {integrity: sha512-bbgPw/wmroJsil/GgL4qjDzs5YLTBMQ99weRsok1XCDccQeehbHA/I1oRvk2NPtr7KGZgT/Y5tPRnAtMqeG2Kg==} + engines: {node: '>=14'} + + locate-character@3.0.0: + resolution: {integrity: sha512-SW13ws7BjaeJ6p7Q6CO2nchbYEc3X3J6WrmTTDto7yMPqVSZTUyY5Tjbid+Ab8gLnATtygYtiDIJGQRRn2ZOiA==} + + locate-path@6.0.0: + resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==} + engines: {node: '>=10'} + + lodash.merge@4.6.2: + resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} + + lodash@4.17.21: + resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} + + log-symbols@4.1.0: + resolution: {integrity: sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==} + engines: {node: '>=10'} + + longest-streak@2.0.4: + resolution: {integrity: sha512-vM6rUVCVUJJt33bnmHiZEvr7wPT78ztX7rojL+LW51bHtLh6HTjx84LA5W4+oa6aKEJA7jJu5LR6vQRBpA5DVg==} + + magic-string@0.30.17: + resolution: {integrity: sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==} + + mdast-util-from-markdown@0.8.5: + resolution: {integrity: sha512-2hkTXtYYnr+NubD/g6KGBS/0mFmBcifAsI0yIWRiRo0PjVs6SSOSOdtzbp6kSGnShDN6G5aWZpKQ2lWRy27mWQ==} + + mdast-util-frontmatter@0.2.0: + resolution: {integrity: sha512-FHKL4w4S5fdt1KjJCwB0178WJ0evnyyQr5kXTM3wrOVpytD0hrkvd+AOOjU9Td8onOejCkmZ+HQRT3CZ3coHHQ==} + + mdast-util-to-markdown@0.6.5: + resolution: {integrity: sha512-XeV9sDE7ZlOQvs45C9UKMtfTcctcaj/pGwH8YLbMHoMOXNNCn2LsqVQOqrF1+/NU8lKDAqozme9SCXWyo9oAcQ==} + + mdast-util-to-string@2.0.0: + resolution: {integrity: sha512-AW4DRS3QbBayY/jJmD8437V1Gombjf8RSOUCMFBuo5iHi58AGEgVCKQ+ezHkZZDpAQS75hcBMpLqjpJTjtUL7w==} + + mdn-data@2.12.2: + resolution: {integrity: sha512-IEn+pegP1aManZuckezWCO+XZQDplx1366JoVhTpMpBB1sPey/SbveZQUosKiKiGYjg1wH4pMlNgXbCiYgihQA==} + + merge2@1.4.1: + resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} + engines: {node: '>= 8'} + + micromark-extension-frontmatter@0.2.2: + resolution: {integrity: sha512-q6nPLFCMTLtfsctAuS0Xh4vaolxSFUWUWR6PZSrXXiRy+SANGllpcqdXFv2z07l0Xz/6Hl40hK0ffNCJPH2n1A==} + + micromark@2.11.4: + resolution: {integrity: sha512-+WoovN/ppKolQOFIAajxi7Lu9kInbPxFuTBVEavFcL8eAfVstoc5MocPmqBeAdBOJV00uaVjegzH4+MA0DN/uA==} + + micromatch@4.0.8: + resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==} + engines: {node: '>=8.6'} + + minimatch@3.1.2: + resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} + + minimatch@5.1.6: + resolution: {integrity: sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==} + engines: {node: '>=10'} + + minimatch@9.0.5: + resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==} + engines: {node: '>=16 || 14 >=14.17'} + + mlly@1.7.4: + resolution: {integrity: sha512-qmdSIPC4bDJXgZTCR7XosJiNKySV7O215tsPtDN9iEO/7q/76b/ijtgRu/+epFXSJhijtTCCGp3DWS549P3xKw==} + + mocha@10.8.2: + resolution: {integrity: sha512-VZlYo/WE8t1tstuRmqgeyBgCbJc/lEdopaa+axcKzTBJ+UIdlAB9XnmvTCAH4pwR4ElNInaedhEBmZD8iCSVEg==} + engines: {node: '>= 14.0.0'} + hasBin: true + + mrmime@2.0.1: + resolution: {integrity: sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ==} + engines: {node: '>=10'} + + ms@2.1.3: + resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + + nanoid@3.3.11: + resolution: {integrity: sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + + natural-compare@1.4.0: + resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} + + node-fetch-native@1.6.6: + resolution: {integrity: sha512-8Mc2HhqPdlIfedsuZoc3yioPuzp6b+L5jRCRY1QzuWZh2EGJVQrGppC6V6cF0bLdbW0+O2YpqCA25aF/1lvipQ==} + + node-fetch@2.6.7: + resolution: {integrity: sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==} + engines: {node: 4.x || >=6.0.0} + peerDependencies: + encoding: ^0.1.0 + peerDependenciesMeta: + encoding: + optional: true + + normalize-path@3.0.0: + resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} + engines: {node: '>=0.10.0'} + + ofetch@1.4.1: + resolution: {integrity: sha512-QZj2DfGplQAr2oj9KzceK9Hwz6Whxazmn85yYeVuS3u9XTMOGMRx0kO95MQ+vLsj/S/NwBDMMLU5hpxvI6Tklw==} + + on-exit-leak-free@2.1.2: + resolution: {integrity: sha512-0eJJY6hXLGf1udHwfNftBqH+g73EU4B504nZeKpz1sYRKafAghwxEJunB2O7rDZkL4PGfsMVnTXZ2EjibbqcsA==} + engines: {node: '>=14.0.0'} + + once@1.4.0: + resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} + + optionator@0.9.4: + resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==} + engines: {node: '>= 0.8.0'} + + p-limit@3.1.0: + resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} + engines: {node: '>=10'} + + p-locate@5.0.0: + resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==} + engines: {node: '>=10'} + + package-manager-detector@0.2.9: + resolution: {integrity: sha512-+vYvA/Y31l8Zk8dwxHhL3JfTuHPm6tlxM2A3GeQyl7ovYnSp1+mzAxClxaOr0qO1TtPxbQxetI7v5XqKLJZk7Q==} + + parent-module@1.0.1: + resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} + engines: {node: '>=6'} + + parse-entities@2.0.0: + resolution: {integrity: sha512-kkywGpCcRYhqQIchaWqZ875wzpS/bMKhz5HnN3p7wveJTkTtyAB/AlnS0f8DFSqYW1T82t6yEAkEcB+A1I3MbQ==} + + path-exists@4.0.0: + resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} + engines: {node: '>=8'} + + path-key@3.1.1: + resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} + engines: {node: '>=8'} + + path-parse@1.0.7: + resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} + + path-type@4.0.0: + resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} + engines: {node: '>=8'} + + pathe@2.0.3: + resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==} + + perfect-debounce@1.0.0: + resolution: {integrity: sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==} + + picocolors@1.1.1: + resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} + + picomatch@2.3.1: + resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} + engines: {node: '>=8.6'} + + picomatch@4.0.2: + resolution: {integrity: sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==} + engines: {node: '>=12'} + + pino-abstract-transport@1.2.0: + resolution: {integrity: sha512-Guhh8EZfPCfH+PMXAb6rKOjGQEoy0xlAIn+irODG5kgfYV+BQ0rGYYWTIel3P5mmyXqkYkPmdIkywsn6QKUR1Q==} + + pino-abstract-transport@2.0.0: + resolution: {integrity: sha512-F63x5tizV6WCh4R6RHyi2Ml+M70DNRXt/+HANowMflpgGFMAym/VKm6G7ZOQRjqN7XbGxK1Lg9t6ZrtzOaivMw==} + + pino-std-serializers@7.0.0: + resolution: {integrity: sha512-e906FRY0+tV27iq4juKzSYPbUj2do2X2JX4EzSca1631EB2QJQUqGbDuERal7LCtOpxl6x3+nvo9NPZcmjkiFA==} + + pino@9.6.0: + resolution: {integrity: sha512-i85pKRCt4qMjZ1+L7sy2Ag4t1atFcdbEt76+7iRJn1g2BvsnRMGu9p8pivl9fs63M2kF/A0OacFZhTub+m/qMg==} + hasBin: true + + pkg-types@1.3.1: + resolution: {integrity: sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==} + + postcss@8.5.3: + resolution: {integrity: sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A==} + engines: {node: ^10 || ^12 || >=14} + + prelude-ls@1.2.1: + resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} + engines: {node: '>= 0.8.0'} + + prettier@3.5.3: + resolution: {integrity: sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw==} + engines: {node: '>=14'} + hasBin: true + + process-warning@4.0.1: + resolution: {integrity: sha512-3c2LzQ3rY9d0hc1emcsHhfT9Jwz0cChib/QN89oME2R451w5fy3f0afAhERFZAwrbDU43wk12d0ORBpDVME50Q==} + + process@0.11.10: + resolution: {integrity: sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==} + engines: {node: '>= 0.6.0'} + + punycode@2.3.1: + resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} + engines: {node: '>=6'} + + queue-microtask@1.2.3: + resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} + + quick-format-unescaped@4.0.4: + resolution: {integrity: sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==} + + randombytes@2.1.0: + resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==} + + readable-stream@4.7.0: + resolution: {integrity: sha512-oIGGmcpTLwPga8Bn6/Z75SVaH1z5dUut2ibSyAMVhmUggWpmDn2dapB0n7f8nwaSiRtepAsfJyfXIO5DCVAODg==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + + readdirp@3.6.0: + resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} + engines: {node: '>=8.10.0'} + + real-require@0.2.0: + resolution: {integrity: sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg==} + engines: {node: '>= 12.13.0'} + + regexp-tree@0.1.27: + resolution: {integrity: sha512-iETxpjK6YoRWJG5o6hXLwvjYAoW+FEZn9os0PD/b6AP6xQwsa/Y7lCVgIixBbUPMfhu+i2LtdeAqVTgGlQarfA==} + hasBin: true + + remark-frontmatter@3.0.0: + resolution: {integrity: sha512-mSuDd3svCHs+2PyO29h7iijIZx4plX0fheacJcAoYAASfgzgVIcXGYSq9GFyYocFLftQs8IOmmkgtOovs6d4oA==} + + remark-parse@9.0.0: + resolution: {integrity: sha512-geKatMwSzEXKHuzBNU1z676sGcDcFoChMK38TgdHJNAYfFtsfHDQG7MoJAjs6sgYMqyLduCYWDIWZIxiPeafEw==} + + remark-stringify@9.0.1: + resolution: {integrity: sha512-mWmNg3ZtESvZS8fv5PTvaPckdL4iNlCHTt8/e/8oN08nArHRHjNZMKzA/YW3+p7/lYqIw4nx1XsjCBo/AxNChg==} + + repeat-string@1.6.1: + resolution: {integrity: sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w==} + engines: {node: '>=0.10'} + + require-directory@2.1.1: + resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} + engines: {node: '>=0.10.0'} + + resolve-from@4.0.0: + resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} + engines: {node: '>=4'} + + resolve-pkg-maps@1.0.0: + resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==} + + resolve@1.22.10: + resolution: {integrity: sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==} + engines: {node: '>= 0.4'} + hasBin: true + + reusify@1.1.0: + resolution: {integrity: sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==} + engines: {iojs: '>=1.0.0', node: '>=0.10.0'} + + rollup@4.40.1: + resolution: {integrity: sha512-C5VvvgCCyfyotVITIAv+4efVytl5F7wt+/I2i9q9GZcEXW9BP52YYOXC58igUi+LFZVHukErIIqQSWwv/M3WRw==} + engines: {node: '>=18.0.0', npm: '>=8.0.0'} + hasBin: true + + run-parallel@1.2.0: + resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} + + safe-buffer@5.2.1: + resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} + + safe-regex@2.1.1: + resolution: {integrity: sha512-rx+x8AMzKb5Q5lQ95Zoi6ZbJqwCLkqi3XuJXp5P3rT8OEc6sZCJG5AE5dU3lsgRr/F4Bs31jSlVN+j5KrsGu9A==} + + safe-stable-stringify@2.5.0: + resolution: {integrity: sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==} + engines: {node: '>=10'} + + semver@7.7.1: + resolution: {integrity: sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==} + engines: {node: '>=10'} + hasBin: true + + serialize-javascript@6.0.2: + resolution: {integrity: sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==} + + shebang-command@2.0.0: + resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} + engines: {node: '>=8'} + + shebang-regex@3.0.0: + resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} + engines: {node: '>=8'} + + shellwords@0.1.1: + resolution: {integrity: sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==} + + sirv@3.0.1: + resolution: {integrity: sha512-FoqMu0NCGBLCcAkS1qA+XJIQTR6/JHfQXl+uGteNCQ76T91DMUjPa9xfmeqMY3z80nLSg9yQmNjK0Px6RWsH/A==} + engines: {node: '>=18'} + + sisteransi@1.0.5: + resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} + + slash@3.0.0: + resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} + engines: {node: '>=8'} + + smob@1.5.0: + resolution: {integrity: sha512-g6T+p7QO8npa+/hNx9ohv1E5pVCmWrVCUzUXJyLdMmftX6ER0oiWY/w9knEonLpnOp6b6FenKnMfR8gqwWdwig==} + + sonic-boom@4.2.0: + resolution: {integrity: sha512-INb7TM37/mAcsGmc9hyyI6+QR3rR1zVRu36B0NeGXKnOOLiZOfER5SA+N7X7k3yUYRzLWafduTDvJAfDswwEww==} + + source-map-js@1.2.1: + resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} + engines: {node: '>=0.10.0'} + + source-map-support@0.5.21: + resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==} + + source-map@0.6.1: + resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} + engines: {node: '>=0.10.0'} + + split2@4.2.0: + resolution: {integrity: sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==} + engines: {node: '>= 10.x'} + + stacktrace-parser@0.1.11: + resolution: {integrity: sha512-WjlahMgHmCJpqzU8bIBy4qtsZdU9lRlcZE3Lvyej6t4tuOuv1vk57OW3MBrj6hXBFx/nNoC9MPMTcr5YA7NQbg==} + engines: {node: '>=6'} + + string-width@4.2.3: + resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} + engines: {node: '>=8'} + + string_decoder@1.3.0: + resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} + + strip-ansi@6.0.1: + resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} + engines: {node: '>=8'} + + strip-json-comments@3.1.1: + resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} + engines: {node: '>=8'} + + supports-color@7.2.0: + resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} + engines: {node: '>=8'} + + supports-color@8.1.1: + resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==} + engines: {node: '>=10'} + + supports-preserve-symlinks-flag@1.0.0: + resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} + engines: {node: '>= 0.4'} + + svelte@5.20.4: + resolution: {integrity: sha512-2Mo/AfObaw9zuD0u1JJ7sOVzRCGcpETEyDkLbtkcctWpCMCIyT0iz83xD8JT29SR7O4SgswuPRIDYReYF/607A==} + engines: {node: '>=18'} + + terser@5.39.0: + resolution: {integrity: sha512-LBAhFyLho16harJoWMg/nZsQYgTrg5jXOn2nCYjRUcZZEdE3qa2zb8QEDRUGVZBW4rlazf2fxkg8tztybTaqWw==} + engines: {node: '>=10'} + hasBin: true + + thread-stream@3.1.0: + resolution: {integrity: sha512-OqyPZ9u96VohAyMfJykzmivOrY2wfMSf3C5TtFJVgN+Hm6aj+voFhlK+kZEIv2FBh1X6Xp3DlnCOfEQ3B2J86A==} + + tinyexec@0.3.2: + resolution: {integrity: sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==} + + tinyglobby@0.2.12: + resolution: {integrity: sha512-qkf4trmKSIiMTs/E63cxH+ojC2unam7rJ0WrauAzpT3ECNTxGRMlaXxVbfxMUC/w0LaYk6jQ4y/nGR9uBO3tww==} + engines: {node: '>=12.0.0'} + + to-regex-range@5.0.1: + resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} + engines: {node: '>=8.0'} + + totalist@3.0.1: + resolution: {integrity: sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==} + engines: {node: '>=6'} + + tr46@0.0.3: + resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} + + trough@1.0.5: + resolution: {integrity: sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA==} + + ts-api-utils@2.0.1: + resolution: {integrity: sha512-dnlgjFSVetynI8nzgJ+qF62efpglpWRk8isUEWZGWlJYySCTD6aKvbUDu+zbPeDakk3bg5H4XpitHukgfL1m9w==} + engines: {node: '>=18.12'} + peerDependencies: + typescript: '>=4.8.4' + + tslib@2.8.1: + resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} + + tsx@4.19.2: + resolution: {integrity: sha512-pOUl6Vo2LUq/bSa8S5q7b91cgNSjctn9ugq/+Mvow99qW6x/UZYwzxy/3NmqoT66eHYfCVvFvACC58UBPFf28g==} + engines: {node: '>=18.0.0'} + hasBin: true + + type-check@0.4.0: + resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} + engines: {node: '>= 0.8.0'} + + type-fest@0.7.1: + resolution: {integrity: sha512-Ne2YiiGN8bmrmJJEuTWTLJR32nh/JdL1+PSicowtNb0WFpn59GK8/lfD61bVtzguz7b3PBt74nxpv/Pw5po5Rg==} + engines: {node: '>=8'} + + typescript-eslint@8.31.0: + resolution: {integrity: sha512-u+93F0sB0An8WEAPtwxVhFby573E8ckdjwUUQUj9QA4v8JAvgtoDdIyYR3XFwFHq2W1KJ1AurwJCO+w+Y1ixyQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: ^8.57.0 || ^9.0.0 + typescript: '>=4.8.4 <5.9.0' + + typescript@5.8.3: + resolution: {integrity: sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==} + engines: {node: '>=14.17'} + hasBin: true + + ufo@1.5.4: + resolution: {integrity: sha512-UsUk3byDzKd04EyoZ7U4DOlxQaD14JUKQl6/P7wiX4FNvUfm3XL246n9W5AmqwW5RSFJ27NAuM0iLscAOYUiGQ==} + + unconfig@7.0.0: + resolution: {integrity: sha512-G5CJSoG6ZTxgzCJblEfgpdRK2tos9+UdD2WtecDUVfImzQ0hFjwpH5RVvGMhP4pRpC9ML7NrC4qBsBl0Ttj35A==} + + unified@9.2.2: + resolution: {integrity: sha512-Sg7j110mtefBD+qunSLO1lqOEKdrwBFBrR6Qd8f4uwkhWNlbkaqwHse6e7QvD3AP/MNoJdEDLaf8OxYyoWgorQ==} + + unist-util-stringify-position@2.0.3: + resolution: {integrity: sha512-3faScn5I+hy9VleOq/qNbAd6pAx7iH5jYBMS9I1HgQVijz/4mv5Bvw5iw1sC/90CODiKo81G/ps8AJrISn687g==} + + unocss@66.0.0: + resolution: {integrity: sha512-SHstiv1s7zGPSjzOsADzlwRhQM+6817+OqQE3Fv+N/nn2QLNx1bi3WXybFfz5tWkzBtyTZlwdPmeecsIs1yOCA==} + engines: {node: '>=14'} + peerDependencies: + '@unocss/webpack': 66.0.0 + vite: ^2.9.0 || ^3.0.0-0 || ^4.0.0 || ^5.0.0-0 || ^6.0.0-0 + peerDependenciesMeta: + '@unocss/webpack': + optional: true + vite: + optional: true + + unplugin-utils@0.2.4: + resolution: {integrity: sha512-8U/MtpkPkkk3Atewj1+RcKIjb5WBimZ/WSLhhR3w6SsIj8XJuKTacSP8g+2JhfSGw0Cb125Y+2zA/IzJZDVbhA==} + engines: {node: '>=18.12.0'} + + uri-js@4.4.1: + resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} + + vfile-message@2.0.4: + resolution: {integrity: sha512-DjssxRGkMvifUOJre00juHoP9DPWuzjxKuMDrhNbk2TdaYYBNMStsNhEOt3idrtI12VQYM/1+iM0KOzXi4pxwQ==} + + vfile@4.2.1: + resolution: {integrity: sha512-O6AE4OskCG5S1emQ/4gl8zK586RqA3srz3nfK/Viy0UPToBc5Trp9BVFb1u0CjsKrAWwnpr4ifM/KBXPWwJbCA==} + + vite@6.2.6: + resolution: {integrity: sha512-9xpjNl3kR4rVDZgPNdTL0/c6ao4km69a/2ihNQbcANz8RuCOK3hQBmLSJf3bRKVQjVMda+YvizNE8AwvogcPbw==} + engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} + hasBin: true + peerDependencies: + '@types/node': ^18.0.0 || ^20.0.0 || >=22.0.0 + jiti: '>=1.21.0' + less: '*' + lightningcss: ^1.21.0 + sass: '*' + sass-embedded: '*' + stylus: '*' + sugarss: '*' + terser: ^5.16.0 + tsx: ^4.8.1 + yaml: ^2.4.2 + peerDependenciesMeta: + '@types/node': + optional: true + jiti: + optional: true + less: + optional: true + lightningcss: + optional: true + sass: + optional: true + sass-embedded: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + tsx: + optional: true + yaml: + optional: true + + vitefu@1.0.6: + resolution: {integrity: sha512-+Rex1GlappUyNN6UfwbVZne/9cYC4+R2XDk9xkNXBKMw6HQagdX9PgZ8V2v1WUSK1wfBLp7qbI1+XSNIlB1xmA==} + peerDependencies: + vite: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 + peerDependenciesMeta: + vite: + optional: true + + vue-flow-layout@0.1.1: + resolution: {integrity: sha512-JdgRRUVrN0Y2GosA0M68DEbKlXMqJ7FQgsK8CjQD2vxvNSqAU6PZEpi4cfcTVtfM2GVOMjHo7GKKLbXxOBqDqA==} + peerDependencies: + vue: ^3.4.37 + + vue@3.5.13: + resolution: {integrity: sha512-wmeiSMxkZCSc+PM2w2VRsOYAZC8GdipNFRTsLSfodVqI9mbejKeXEGr8SckuLnrQPGe3oJN5c3K0vpoU9q/wCQ==} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + + webidl-conversions@3.0.1: + resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} + + whatwg-url@5.0.0: + resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} + + which@2.0.2: + resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} + engines: {node: '>= 8'} + hasBin: true + + word-wrap@1.2.5: + resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==} + engines: {node: '>=0.10.0'} + + workerpool@6.5.1: + resolution: {integrity: sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==} + + wrap-ansi@7.0.0: + resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} + engines: {node: '>=10'} + + wrappy@1.0.2: + resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} + + y18n@5.0.8: + resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} + engines: {node: '>=10'} + + yargs-parser@20.2.9: + resolution: {integrity: sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==} + engines: {node: '>=10'} + + yargs-parser@21.1.1: + resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} + engines: {node: '>=12'} + + yargs-unparser@2.0.0: + resolution: {integrity: sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==} + engines: {node: '>=10'} + + yargs@16.2.0: + resolution: {integrity: sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==} + engines: {node: '>=10'} + + yargs@17.7.2: + resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==} + engines: {node: '>=12'} + + yocto-queue@0.1.0: + resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} + engines: {node: '>=10'} + + zimmerframe@1.1.2: + resolution: {integrity: sha512-rAbqEGa8ovJy4pyBxZM70hg4pE6gDgaQ0Sl9M3enG3I0d6H4XSAM3GeNGLKnsBpuijUow064sf7ww1nutC5/3w==} + + zod-validation-error@1.5.0: + resolution: {integrity: sha512-/7eFkAI4qV0tcxMBB/3+d2c1P6jzzZYdYSlBuAklzMuCrJu5bzJfHS0yVAS87dRHVlhftd6RFJDIvv03JgkSbw==} + engines: {node: '>=16.0.0'} + peerDependencies: + zod: ^3.18.0 + + zod@3.24.2: + resolution: {integrity: sha512-lY7CDW43ECgW9u1TcT3IoXHflywfVqDYze4waEz812jR/bZ8FHDsl7pFQoSZTz5N+2NqRXs8GBwnAwo3ZNxqhQ==} + + zwitch@1.0.5: + resolution: {integrity: sha512-V50KMwwzqJV0NpZIZFwfOD5/lyny3WlSzRiXgA0G7VUnRlqttta1L6UQIHzd6EuBY/cHGfwTIck7w1yH6Q5zUw==} + +snapshots: + + '@ampproject/remapping@2.3.0': + dependencies: + '@jridgewell/gen-mapping': 0.3.8 + '@jridgewell/trace-mapping': 0.3.25 + + '@antfu/install-pkg@1.0.0': + dependencies: + package-manager-detector: 0.2.9 + tinyexec: 0.3.2 + + '@antfu/utils@8.1.1': {} + + '@babel/helper-string-parser@7.25.9': {} + + '@babel/helper-validator-identifier@7.25.9': {} + + '@babel/parser@7.27.0': + dependencies: + '@babel/types': 7.27.0 + + '@babel/types@7.27.0': + dependencies: + '@babel/helper-string-parser': 7.25.9 + '@babel/helper-validator-identifier': 7.25.9 + + '@chainsafe/abort-controller@3.0.1': + dependencies: + event-target-shim: 5.0.1 + + '@clack/core@0.3.5': + dependencies: + picocolors: 1.1.1 + sisteransi: 1.0.5 + + '@clack/prompts@0.7.0': + dependencies: + '@clack/core': 0.3.5 + picocolors: 1.1.1 + sisteransi: 1.0.5 + + '@covector/apply@0.10.0(mocha@10.8.2)': + dependencies: + '@covector/files': 0.8.0 + effection: 2.0.8(mocha@10.8.2) + semver: 7.7.1 + transitivePeerDependencies: + - encoding + - mocha + + '@covector/assemble@0.12.0': + dependencies: + '@covector/command': 0.8.0 + '@covector/files': 0.8.0 + effection: 2.0.8(mocha@10.8.2) + js-yaml: 4.1.0 + lodash: 4.17.21 + remark-frontmatter: 3.0.0 + remark-parse: 9.0.0 + remark-stringify: 9.0.1 + unified: 9.2.2 + transitivePeerDependencies: + - encoding + - supports-color + + '@covector/changelog@0.12.0': + dependencies: + '@covector/files': 0.8.0 + effection: 2.0.8(mocha@10.8.2) + lodash: 4.17.21 + remark-parse: 9.0.0 + remark-stringify: 9.0.1 + unified: 9.2.2 + transitivePeerDependencies: + - encoding + - supports-color + + '@covector/command@0.8.0': + dependencies: + '@effection/process': 2.1.4 + effection: 2.0.8(mocha@10.8.2) + transitivePeerDependencies: + - encoding + + '@covector/files@0.8.0': + dependencies: + '@covector/toml': 0.2.0 + globby: 11.1.0 + js-yaml: 4.1.0 + semver: 7.7.1 + zod: 3.24.2 + zod-validation-error: 1.5.0(zod@3.24.2) + + '@covector/toml@0.2.0': {} + + '@effection/channel@2.0.6': + dependencies: + '@effection/core': 2.2.3 + '@effection/events': 2.0.6 + '@effection/stream': 2.0.6 + + '@effection/core@2.2.3': + dependencies: + '@chainsafe/abort-controller': 3.0.1 + + '@effection/events@2.0.6': + dependencies: + '@effection/core': 2.2.3 + '@effection/stream': 2.0.6 + + '@effection/fetch@2.0.7(mocha@10.8.2)': + dependencies: + '@effection/core': 2.2.3 + '@effection/mocha': 2.0.8(mocha@10.8.2) + cross-fetch: 3.1.5 + transitivePeerDependencies: + - encoding + - mocha + + '@effection/main@2.1.2': + dependencies: + '@effection/core': 2.2.3 + chalk: 4.1.2 + stacktrace-parser: 0.1.11 + + '@effection/mocha@2.0.8(mocha@10.8.2)': + dependencies: + effection: 2.0.8(mocha@10.8.2) + mocha: 10.8.2 + transitivePeerDependencies: + - encoding + + '@effection/process@2.1.4': + dependencies: + cross-spawn: 7.0.6 + ctrlc-windows: 2.2.0 + effection: 2.0.8(mocha@10.8.2) + shellwords: 0.1.1 + transitivePeerDependencies: + - encoding + + '@effection/stream@2.0.6': + dependencies: + '@effection/core': 2.2.3 + '@effection/subscription': 2.0.6 + + '@effection/subscription@2.0.6': + dependencies: + '@effection/core': 2.2.3 + + '@esbuild/aix-ppc64@0.25.2': + optional: true + + '@esbuild/android-arm64@0.25.2': + optional: true + + '@esbuild/android-arm@0.25.2': + optional: true + + '@esbuild/android-x64@0.25.2': + optional: true + + '@esbuild/darwin-arm64@0.25.2': + optional: true + + '@esbuild/darwin-x64@0.25.2': + optional: true + + '@esbuild/freebsd-arm64@0.25.2': + optional: true + + '@esbuild/freebsd-x64@0.25.2': + optional: true + + '@esbuild/linux-arm64@0.25.2': + optional: true + + '@esbuild/linux-arm@0.25.2': + optional: true + + '@esbuild/linux-ia32@0.25.2': + optional: true + + '@esbuild/linux-loong64@0.25.2': + optional: true + + '@esbuild/linux-mips64el@0.25.2': + optional: true + + '@esbuild/linux-ppc64@0.25.2': + optional: true + + '@esbuild/linux-riscv64@0.25.2': + optional: true + + '@esbuild/linux-s390x@0.25.2': + optional: true + + '@esbuild/linux-x64@0.25.2': + optional: true + + '@esbuild/netbsd-arm64@0.25.2': + optional: true + + '@esbuild/netbsd-x64@0.25.2': + optional: true + + '@esbuild/openbsd-arm64@0.25.2': + optional: true + + '@esbuild/openbsd-x64@0.25.2': + optional: true + + '@esbuild/sunos-x64@0.25.2': + optional: true + + '@esbuild/win32-arm64@0.25.2': + optional: true + + '@esbuild/win32-ia32@0.25.2': + optional: true + + '@esbuild/win32-x64@0.25.2': + optional: true + + '@eslint-community/eslint-utils@4.4.1(eslint@9.25.1(jiti@2.4.2))': + dependencies: + eslint: 9.25.1(jiti@2.4.2) + eslint-visitor-keys: 3.4.3 + + '@eslint-community/regexpp@4.12.1': {} + + '@eslint/config-array@0.20.0': + dependencies: + '@eslint/object-schema': 2.1.6 + debug: 4.4.0(supports-color@8.1.1) + minimatch: 3.1.2 + transitivePeerDependencies: + - supports-color + + '@eslint/config-helpers@0.2.1': {} + + '@eslint/core@0.13.0': + dependencies: + '@types/json-schema': 7.0.15 + + '@eslint/eslintrc@3.3.1': + dependencies: + ajv: 6.12.6 + debug: 4.4.0(supports-color@8.1.1) + espree: 10.3.0 + globals: 14.0.0 + ignore: 5.3.2 + import-fresh: 3.3.1 + js-yaml: 4.1.0 + minimatch: 3.1.2 + strip-json-comments: 3.1.1 + transitivePeerDependencies: + - supports-color + + '@eslint/js@9.25.1': {} + + '@eslint/object-schema@2.1.6': {} + + '@eslint/plugin-kit@0.2.8': + dependencies: + '@eslint/core': 0.13.0 + levn: 0.4.1 + + '@humanfs/core@0.19.1': {} + + '@humanfs/node@0.16.6': + dependencies: + '@humanfs/core': 0.19.1 + '@humanwhocodes/retry': 0.3.1 + + '@humanwhocodes/module-importer@1.0.1': {} + + '@humanwhocodes/retry@0.3.1': {} + + '@humanwhocodes/retry@0.4.2': {} + + '@iconify-json/codicon@1.2.12': + dependencies: + '@iconify/types': 2.0.0 + + '@iconify-json/ph@1.2.2': + dependencies: + '@iconify/types': 2.0.0 + + '@iconify/types@2.0.0': {} + + '@iconify/utils@2.3.0': + dependencies: + '@antfu/install-pkg': 1.0.0 + '@antfu/utils': 8.1.1 + '@iconify/types': 2.0.0 + debug: 4.4.0(supports-color@8.1.1) + globals: 15.15.0 + kolorist: 1.8.0 + local-pkg: 1.0.0 + mlly: 1.7.4 + transitivePeerDependencies: + - supports-color + + '@jridgewell/gen-mapping@0.3.8': + dependencies: + '@jridgewell/set-array': 1.2.1 + '@jridgewell/sourcemap-codec': 1.5.0 + '@jridgewell/trace-mapping': 0.3.25 + + '@jridgewell/resolve-uri@3.1.2': {} + + '@jridgewell/set-array@1.2.1': {} + + '@jridgewell/source-map@0.3.6': + dependencies: + '@jridgewell/gen-mapping': 0.3.8 + '@jridgewell/trace-mapping': 0.3.25 + + '@jridgewell/sourcemap-codec@1.5.0': {} + + '@jridgewell/trace-mapping@0.3.25': + dependencies: + '@jridgewell/resolve-uri': 3.1.2 + '@jridgewell/sourcemap-codec': 1.5.0 + + '@nodelib/fs.scandir@2.1.5': + dependencies: + '@nodelib/fs.stat': 2.0.5 + run-parallel: 1.2.0 + + '@nodelib/fs.stat@2.0.5': {} + + '@nodelib/fs.walk@1.2.8': + dependencies: + '@nodelib/fs.scandir': 2.1.5 + fastq: 1.19.1 + + '@polka/url@1.0.0-next.28': {} + + '@rollup/plugin-node-resolve@16.0.1(rollup@4.40.1)': + dependencies: + '@rollup/pluginutils': 5.1.4(rollup@4.40.1) + '@types/resolve': 1.20.2 + deepmerge: 4.3.1 + is-module: 1.0.0 + resolve: 1.22.10 + optionalDependencies: + rollup: 4.40.1 + + '@rollup/plugin-terser@0.4.4(rollup@4.40.1)': + dependencies: + serialize-javascript: 6.0.2 + smob: 1.5.0 + terser: 5.39.0 + optionalDependencies: + rollup: 4.40.1 + + '@rollup/plugin-typescript@12.1.2(rollup@4.40.1)(tslib@2.8.1)(typescript@5.8.3)': + dependencies: + '@rollup/pluginutils': 5.1.4(rollup@4.40.1) + resolve: 1.22.10 + typescript: 5.8.3 + optionalDependencies: + rollup: 4.40.1 + tslib: 2.8.1 + + '@rollup/pluginutils@5.1.4(rollup@4.40.1)': + dependencies: + '@types/estree': 1.0.7 + estree-walker: 2.0.2 + picomatch: 4.0.2 + optionalDependencies: + rollup: 4.40.1 + + '@rollup/rollup-android-arm-eabi@4.40.1': + optional: true + + '@rollup/rollup-android-arm64@4.40.1': + optional: true + + '@rollup/rollup-darwin-arm64@4.40.1': + optional: true + + '@rollup/rollup-darwin-x64@4.40.1': + optional: true + + '@rollup/rollup-freebsd-arm64@4.40.1': + optional: true + + '@rollup/rollup-freebsd-x64@4.40.1': + optional: true + + '@rollup/rollup-linux-arm-gnueabihf@4.40.1': + optional: true + + '@rollup/rollup-linux-arm-musleabihf@4.40.1': + optional: true + + '@rollup/rollup-linux-arm64-gnu@4.40.1': + optional: true + + '@rollup/rollup-linux-arm64-musl@4.40.1': + optional: true + + '@rollup/rollup-linux-loongarch64-gnu@4.40.1': + optional: true + + '@rollup/rollup-linux-powerpc64le-gnu@4.40.1': + optional: true + + '@rollup/rollup-linux-riscv64-gnu@4.40.1': + optional: true + + '@rollup/rollup-linux-riscv64-musl@4.40.1': + optional: true + + '@rollup/rollup-linux-s390x-gnu@4.40.1': + optional: true + + '@rollup/rollup-linux-x64-gnu@4.40.1': + optional: true + + '@rollup/rollup-linux-x64-musl@4.40.1': + optional: true + + '@rollup/rollup-win32-arm64-msvc@4.40.1': + optional: true + + '@rollup/rollup-win32-ia32-msvc@4.40.1': + optional: true + + '@rollup/rollup-win32-x64-msvc@4.40.1': + optional: true + + '@sveltejs/vite-plugin-svelte-inspector@4.0.1(@sveltejs/vite-plugin-svelte@5.0.3(svelte@5.20.4)(vite@6.2.6(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.2)))(svelte@5.20.4)(vite@6.2.6(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.2))': + dependencies: + '@sveltejs/vite-plugin-svelte': 5.0.3(svelte@5.20.4)(vite@6.2.6(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.2)) + debug: 4.4.0(supports-color@8.1.1) + svelte: 5.20.4 + vite: 6.2.6(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.2) + transitivePeerDependencies: + - supports-color + + '@sveltejs/vite-plugin-svelte@5.0.3(svelte@5.20.4)(vite@6.2.6(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.2))': + dependencies: + '@sveltejs/vite-plugin-svelte-inspector': 4.0.1(@sveltejs/vite-plugin-svelte@5.0.3(svelte@5.20.4)(vite@6.2.6(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.2)))(svelte@5.20.4)(vite@6.2.6(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.2)) + debug: 4.4.0(supports-color@8.1.1) + deepmerge: 4.3.1 + kleur: 4.1.5 + magic-string: 0.30.17 + svelte: 5.20.4 + vite: 6.2.6(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.2) + vitefu: 1.0.6(vite@6.2.6(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.2)) + transitivePeerDependencies: + - supports-color + + '@tauri-apps/api@2.5.0': {} + + '@tauri-apps/cli-darwin-arm64@2.5.0': + optional: true + + '@tauri-apps/cli-darwin-x64@2.5.0': + optional: true + + '@tauri-apps/cli-linux-arm-gnueabihf@2.5.0': + optional: true + + '@tauri-apps/cli-linux-arm64-gnu@2.5.0': + optional: true + + '@tauri-apps/cli-linux-arm64-musl@2.5.0': + optional: true + + '@tauri-apps/cli-linux-riscv64-gnu@2.5.0': + optional: true + + '@tauri-apps/cli-linux-x64-gnu@2.5.0': + optional: true + + '@tauri-apps/cli-linux-x64-musl@2.5.0': + optional: true + + '@tauri-apps/cli-win32-arm64-msvc@2.5.0': + optional: true + + '@tauri-apps/cli-win32-ia32-msvc@2.5.0': + optional: true + + '@tauri-apps/cli-win32-x64-msvc@2.5.0': + optional: true + + '@tauri-apps/cli@2.5.0': + optionalDependencies: + '@tauri-apps/cli-darwin-arm64': 2.5.0 + '@tauri-apps/cli-darwin-x64': 2.5.0 + '@tauri-apps/cli-linux-arm-gnueabihf': 2.5.0 + '@tauri-apps/cli-linux-arm64-gnu': 2.5.0 + '@tauri-apps/cli-linux-arm64-musl': 2.5.0 + '@tauri-apps/cli-linux-riscv64-gnu': 2.5.0 + '@tauri-apps/cli-linux-x64-gnu': 2.5.0 + '@tauri-apps/cli-linux-x64-musl': 2.5.0 + '@tauri-apps/cli-win32-arm64-msvc': 2.5.0 + '@tauri-apps/cli-win32-ia32-msvc': 2.5.0 + '@tauri-apps/cli-win32-x64-msvc': 2.5.0 + + '@types/estree@1.0.7': {} + + '@types/json-schema@7.0.15': {} + + '@types/mdast@3.0.15': + dependencies: + '@types/unist': 2.0.11 + + '@types/resolve@1.20.2': {} + + '@types/unist@2.0.11': {} + + '@typescript-eslint/eslint-plugin@8.31.0(@typescript-eslint/parser@8.31.0(eslint@9.25.1(jiti@2.4.2))(typescript@5.8.3))(eslint@9.25.1(jiti@2.4.2))(typescript@5.8.3)': + dependencies: + '@eslint-community/regexpp': 4.12.1 + '@typescript-eslint/parser': 8.31.0(eslint@9.25.1(jiti@2.4.2))(typescript@5.8.3) + '@typescript-eslint/scope-manager': 8.31.0 + '@typescript-eslint/type-utils': 8.31.0(eslint@9.25.1(jiti@2.4.2))(typescript@5.8.3) + '@typescript-eslint/utils': 8.31.0(eslint@9.25.1(jiti@2.4.2))(typescript@5.8.3) + '@typescript-eslint/visitor-keys': 8.31.0 + eslint: 9.25.1(jiti@2.4.2) + graphemer: 1.4.0 + ignore: 5.3.2 + natural-compare: 1.4.0 + ts-api-utils: 2.0.1(typescript@5.8.3) + typescript: 5.8.3 + transitivePeerDependencies: + - supports-color + + '@typescript-eslint/parser@8.31.0(eslint@9.25.1(jiti@2.4.2))(typescript@5.8.3)': + dependencies: + '@typescript-eslint/scope-manager': 8.31.0 + '@typescript-eslint/types': 8.31.0 + '@typescript-eslint/typescript-estree': 8.31.0(typescript@5.8.3) + '@typescript-eslint/visitor-keys': 8.31.0 + debug: 4.4.0(supports-color@8.1.1) + eslint: 9.25.1(jiti@2.4.2) + typescript: 5.8.3 + transitivePeerDependencies: + - supports-color + + '@typescript-eslint/scope-manager@8.31.0': + dependencies: + '@typescript-eslint/types': 8.31.0 + '@typescript-eslint/visitor-keys': 8.31.0 + + '@typescript-eslint/type-utils@8.31.0(eslint@9.25.1(jiti@2.4.2))(typescript@5.8.3)': + dependencies: + '@typescript-eslint/typescript-estree': 8.31.0(typescript@5.8.3) + '@typescript-eslint/utils': 8.31.0(eslint@9.25.1(jiti@2.4.2))(typescript@5.8.3) + debug: 4.4.0(supports-color@8.1.1) + eslint: 9.25.1(jiti@2.4.2) + ts-api-utils: 2.0.1(typescript@5.8.3) + typescript: 5.8.3 + transitivePeerDependencies: + - supports-color + + '@typescript-eslint/types@8.31.0': {} + + '@typescript-eslint/typescript-estree@8.31.0(typescript@5.8.3)': + dependencies: + '@typescript-eslint/types': 8.31.0 + '@typescript-eslint/visitor-keys': 8.31.0 + debug: 4.4.0(supports-color@8.1.1) + fast-glob: 3.3.3 + is-glob: 4.0.3 + minimatch: 9.0.5 + semver: 7.7.1 + ts-api-utils: 2.0.1(typescript@5.8.3) + typescript: 5.8.3 + transitivePeerDependencies: + - supports-color + + '@typescript-eslint/utils@8.31.0(eslint@9.25.1(jiti@2.4.2))(typescript@5.8.3)': dependencies: - format: 0.2.2 - dev: true + '@eslint-community/eslint-utils': 4.4.1(eslint@9.25.1(jiti@2.4.2)) + '@typescript-eslint/scope-manager': 8.31.0 + '@typescript-eslint/types': 8.31.0 + '@typescript-eslint/typescript-estree': 8.31.0(typescript@5.8.3) + eslint: 9.25.1(jiti@2.4.2) + typescript: 5.8.3 + transitivePeerDependencies: + - supports-color - /figures@3.2.0: - resolution: {integrity: sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==} - engines: {node: '>=8'} + '@typescript-eslint/visitor-keys@8.31.0': dependencies: - escape-string-regexp: 1.0.5 - dev: true + '@typescript-eslint/types': 8.31.0 + eslint-visitor-keys: 4.2.0 - /file-entry-cache@6.0.1: - resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==} - engines: {node: ^10.12.0 || >=12.0.0} + '@unocss/astro@66.0.0(vite@6.2.6(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.2))(vue@3.5.13(typescript@5.8.3))': dependencies: - flat-cache: 3.2.0 - dev: true + '@unocss/core': 66.0.0 + '@unocss/reset': 66.0.0 + '@unocss/vite': 66.0.0(vite@6.2.6(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.2))(vue@3.5.13(typescript@5.8.3)) + optionalDependencies: + vite: 6.2.6(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.2) + transitivePeerDependencies: + - vue - /fill-range@7.0.1: - resolution: {integrity: sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==} - engines: {node: '>=8'} + '@unocss/cli@66.0.0': dependencies: - to-regex-range: 5.0.1 - dev: true + '@ampproject/remapping': 2.3.0 + '@unocss/config': 66.0.0 + '@unocss/core': 66.0.0 + '@unocss/preset-uno': 66.0.0 + cac: 6.7.14 + chokidar: 3.6.0 + colorette: 2.0.20 + consola: 3.4.0 + magic-string: 0.30.17 + pathe: 2.0.3 + perfect-debounce: 1.0.0 + tinyglobby: 0.2.12 + unplugin-utils: 0.2.4 - /find-up@5.0.0: - resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==} - engines: {node: '>=10'} + '@unocss/config@66.0.0': dependencies: - locate-path: 6.0.0 - path-exists: 4.0.0 - dev: true + '@unocss/core': 66.0.0 + unconfig: 7.0.0 - /flat-cache@3.2.0: - resolution: {integrity: sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==} - engines: {node: ^10.12.0 || >=12.0.0} + '@unocss/core@66.0.0': {} + + '@unocss/extractor-arbitrary-variants@66.0.0': dependencies: - flatted: 3.2.9 - keyv: 4.5.4 - rimraf: 3.0.2 - dev: true + '@unocss/core': 66.0.0 - /flat@5.0.2: - resolution: {integrity: sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==} - hasBin: true - dev: true + '@unocss/extractor-svelte@66.0.0': {} - /flatted@3.2.9: - resolution: {integrity: sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==} - dev: true + '@unocss/inspector@66.0.0(vue@3.5.13(typescript@5.8.3))': + dependencies: + '@unocss/core': 66.0.0 + '@unocss/rule-utils': 66.0.0 + colorette: 2.0.20 + gzip-size: 6.0.0 + sirv: 3.0.1 + vue-flow-layout: 0.1.1(vue@3.5.13(typescript@5.8.3)) + transitivePeerDependencies: + - vue - /for-each@0.3.3: - resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} + '@unocss/postcss@66.0.0(postcss@8.5.3)': dependencies: - is-callable: 1.2.7 - dev: true + '@unocss/config': 66.0.0 + '@unocss/core': 66.0.0 + '@unocss/rule-utils': 66.0.0 + css-tree: 3.1.0 + postcss: 8.5.3 + tinyglobby: 0.2.12 - /format@0.2.2: - resolution: {integrity: sha512-wzsgA6WOq+09wrU1tsJ09udeR/YZRaeArL9e1wPbFg3GG2yDnC2ldKpxs4xunpFF9DgqCqOIra3bc1HWrJ37Ww==} - engines: {node: '>=0.4.x'} - dev: true + '@unocss/preset-attributify@66.0.0': + dependencies: + '@unocss/core': 66.0.0 - /fs.realpath@1.0.0: - resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} - dev: true + '@unocss/preset-icons@66.0.0': + dependencies: + '@iconify/utils': 2.3.0 + '@unocss/core': 66.0.0 + ofetch: 1.4.1 + transitivePeerDependencies: + - supports-color - /fsevents@2.3.3: - resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} - engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} - os: [darwin] - requiresBuild: true - dev: true - optional: true + '@unocss/preset-mini@66.0.0': + dependencies: + '@unocss/core': 66.0.0 + '@unocss/extractor-arbitrary-variants': 66.0.0 + '@unocss/rule-utils': 66.0.0 - /function-bind@1.1.2: - resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} - dev: true + '@unocss/preset-tagify@66.0.0': + dependencies: + '@unocss/core': 66.0.0 - /function-timeout@0.1.1: - resolution: {integrity: sha512-0NVVC0TaP7dSTvn1yMiy6d6Q8gifzbvQafO46RtLG/kHJUBNd+pVRGOBoK44wNBvtSPUJRfdVvkFdD3p0xvyZg==} - engines: {node: '>=14.16'} - dev: true + '@unocss/preset-typography@66.0.0': + dependencies: + '@unocss/core': 66.0.0 + '@unocss/preset-mini': 66.0.0 + '@unocss/rule-utils': 66.0.0 - /function.prototype.name@1.1.6: - resolution: {integrity: sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==} - engines: {node: '>= 0.4'} + '@unocss/preset-uno@66.0.0': dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - functions-have-names: 1.2.3 - dev: true + '@unocss/core': 66.0.0 + '@unocss/preset-wind3': 66.0.0 - /functions-have-names@1.2.3: - resolution: {integrity: sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==} - dev: true + '@unocss/preset-web-fonts@66.0.0': + dependencies: + '@unocss/core': 66.0.0 + ofetch: 1.4.1 - /gensync@1.0.0-beta.2: - resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==} - engines: {node: '>=6.9.0'} - dev: true + '@unocss/preset-wind3@66.0.0': + dependencies: + '@unocss/core': 66.0.0 + '@unocss/preset-mini': 66.0.0 + '@unocss/rule-utils': 66.0.0 - /get-caller-file@2.0.5: - resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} - engines: {node: 6.* || 8.* || >= 10.*} - dev: true + '@unocss/preset-wind@66.0.0': + dependencies: + '@unocss/core': 66.0.0 + '@unocss/preset-wind3': 66.0.0 - /get-intrinsic@1.2.2: - resolution: {integrity: sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==} + '@unocss/reset@66.0.0': {} + + '@unocss/rule-utils@66.0.0': dependencies: - function-bind: 1.1.2 - has-proto: 1.0.1 - has-symbols: 1.0.3 - hasown: 2.0.0 - dev: true + '@unocss/core': 66.0.0 + magic-string: 0.30.17 - /get-stream@6.0.1: - resolution: {integrity: sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==} - engines: {node: '>=10'} - dev: true + '@unocss/transformer-attributify-jsx@66.0.0': + dependencies: + '@unocss/core': 66.0.0 - /get-symbol-description@1.0.0: - resolution: {integrity: sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==} - engines: {node: '>= 0.4'} + '@unocss/transformer-compile-class@66.0.0': dependencies: - call-bind: 1.0.5 - get-intrinsic: 1.2.2 - dev: true + '@unocss/core': 66.0.0 - /get-tsconfig@4.7.2: - resolution: {integrity: sha512-wuMsz4leaj5hbGgg4IvDU0bqJagpftG5l5cXIAvo8uZrqn0NJqwtfupTN00VnkQJPcIRrxYrm1Ue24btpCha2A==} + '@unocss/transformer-directives@66.0.0': dependencies: - resolve-pkg-maps: 1.0.0 - dev: true + '@unocss/core': 66.0.0 + '@unocss/rule-utils': 66.0.0 + css-tree: 3.1.0 - /glob-parent@5.1.2: - resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} - engines: {node: '>= 6'} + '@unocss/transformer-variant-group@66.0.0': dependencies: - is-glob: 4.0.3 - dev: true + '@unocss/core': 66.0.0 - /glob-parent@6.0.2: - resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} - engines: {node: '>=10.13.0'} + '@unocss/vite@66.0.0(vite@6.2.6(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.2))(vue@3.5.13(typescript@5.8.3))': + dependencies: + '@ampproject/remapping': 2.3.0 + '@unocss/config': 66.0.0 + '@unocss/core': 66.0.0 + '@unocss/inspector': 66.0.0(vue@3.5.13(typescript@5.8.3)) + chokidar: 3.6.0 + magic-string: 0.30.17 + tinyglobby: 0.2.12 + unplugin-utils: 0.2.4 + vite: 6.2.6(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.2) + transitivePeerDependencies: + - vue + + '@vue/compiler-core@3.5.13': + dependencies: + '@babel/parser': 7.27.0 + '@vue/shared': 3.5.13 + entities: 4.5.0 + estree-walker: 2.0.2 + source-map-js: 1.2.1 + + '@vue/compiler-dom@3.5.13': + dependencies: + '@vue/compiler-core': 3.5.13 + '@vue/shared': 3.5.13 + + '@vue/compiler-sfc@3.5.13': + dependencies: + '@babel/parser': 7.27.0 + '@vue/compiler-core': 3.5.13 + '@vue/compiler-dom': 3.5.13 + '@vue/compiler-ssr': 3.5.13 + '@vue/shared': 3.5.13 + estree-walker: 2.0.2 + magic-string: 0.30.17 + postcss: 8.5.3 + source-map-js: 1.2.1 + + '@vue/compiler-ssr@3.5.13': + dependencies: + '@vue/compiler-dom': 3.5.13 + '@vue/shared': 3.5.13 + + '@vue/reactivity@3.5.13': + dependencies: + '@vue/shared': 3.5.13 + + '@vue/runtime-core@3.5.13': + dependencies: + '@vue/reactivity': 3.5.13 + '@vue/shared': 3.5.13 + + '@vue/runtime-dom@3.5.13': + dependencies: + '@vue/reactivity': 3.5.13 + '@vue/runtime-core': 3.5.13 + '@vue/shared': 3.5.13 + csstype: 3.1.3 + + '@vue/server-renderer@3.5.13(vue@3.5.13(typescript@5.8.3))': + dependencies: + '@vue/compiler-ssr': 3.5.13 + '@vue/shared': 3.5.13 + vue: 3.5.13(typescript@5.8.3) + + '@vue/shared@3.5.13': {} + + '@zerodevx/svelte-json-view@1.0.11(svelte@5.20.4)': + dependencies: + svelte: 5.20.4 + + abort-controller@3.0.0: + dependencies: + event-target-shim: 5.0.1 + + acorn-jsx@5.3.2(acorn@8.14.0): + dependencies: + acorn: 8.14.0 + + acorn-typescript@1.4.13(acorn@8.14.0): + dependencies: + acorn: 8.14.0 + + acorn@8.14.0: {} + + ajv@6.12.6: + dependencies: + fast-deep-equal: 3.1.3 + fast-json-stable-stringify: 2.1.0 + json-schema-traverse: 0.4.1 + uri-js: 4.4.1 + + ansi-colors@4.1.3: {} + + ansi-regex@5.0.1: {} + + ansi-styles@4.3.0: + dependencies: + color-convert: 2.0.1 + + anymatch@3.1.3: + dependencies: + normalize-path: 3.0.0 + picomatch: 2.3.1 + + argparse@2.0.1: {} + + aria-query@5.3.2: {} + + array-union@2.1.0: {} + + atomic-sleep@1.0.0: {} + + axobject-query@4.1.0: {} + + bail@1.0.5: {} + + balanced-match@1.0.2: {} + + base64-js@1.5.1: {} + + binary-extensions@2.3.0: {} + + brace-expansion@1.1.11: + dependencies: + balanced-match: 1.0.2 + concat-map: 0.0.1 + + brace-expansion@2.0.1: + dependencies: + balanced-match: 1.0.2 + + braces@3.0.3: + dependencies: + fill-range: 7.1.1 + + browser-stdout@1.3.1: {} + + buffer-from@1.1.2: {} + + buffer@6.0.3: + dependencies: + base64-js: 1.5.1 + ieee754: 1.2.1 + + cac@6.7.14: {} + + callsites@3.1.0: {} + + camelcase@6.3.0: {} + + chalk@4.1.2: + dependencies: + ansi-styles: 4.3.0 + supports-color: 7.2.0 + + character-entities-legacy@1.1.4: {} + + character-entities@1.2.4: {} + + character-reference-invalid@1.1.4: {} + + chokidar@3.6.0: dependencies: + anymatch: 3.1.3 + braces: 3.0.3 + glob-parent: 5.1.2 + is-binary-path: 2.1.0 is-glob: 4.0.3 - dev: true + normalize-path: 3.0.0 + readdirp: 3.6.0 + optionalDependencies: + fsevents: 2.3.3 - /glob@7.2.0: - resolution: {integrity: sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==} + cliui@7.0.4: dependencies: - fs.realpath: 1.0.0 - inflight: 1.0.6 - inherits: 2.0.4 - minimatch: 3.1.2 - once: 1.4.0 - path-is-absolute: 1.0.1 - dev: true + string-width: 4.2.3 + strip-ansi: 6.0.1 + wrap-ansi: 7.0.0 - /glob@7.2.3: - resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} + cliui@8.0.1: dependencies: - fs.realpath: 1.0.0 - inflight: 1.0.6 - inherits: 2.0.4 - minimatch: 3.1.2 - once: 1.4.0 - path-is-absolute: 1.0.1 - dev: true + string-width: 4.2.3 + strip-ansi: 6.0.1 + wrap-ansi: 7.0.0 - /globals@11.12.0: - resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==} - engines: {node: '>=4'} - dev: true + clsx@2.1.1: {} - /globals@13.23.0: - resolution: {integrity: sha512-XAmF0RjlrjY23MA51q3HltdlGxUpXPvg0GioKiD9X6HD28iMjo2dKC8Vqwm7lne4GNr78+RHTfliktR6ZH09wA==} - engines: {node: '>=8'} + color-convert@2.0.1: dependencies: - type-fest: 0.20.2 - dev: true + color-name: 1.1.4 - /globals@13.24.0: - resolution: {integrity: sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==} - engines: {node: '>=8'} + color-name@1.1.4: {} + + colorette@2.0.20: {} + + commander@2.20.3: {} + + concat-map@0.0.1: {} + + confbox@0.1.8: {} + + consola@3.4.0: {} + + covector@0.12.4(mocha@10.8.2): dependencies: - type-fest: 0.20.2 - dev: true + '@clack/prompts': 0.7.0 + '@covector/apply': 0.10.0(mocha@10.8.2) + '@covector/assemble': 0.12.0 + '@covector/changelog': 0.12.0 + '@covector/command': 0.8.0 + '@covector/files': 0.8.0 + effection: 2.0.8(mocha@10.8.2) + globby: 11.1.0 + js-yaml: 4.1.0 + lodash: 4.17.21 + pino: 9.6.0 + pino-abstract-transport: 1.2.0 + strip-ansi: 6.0.1 + yargs: 17.7.2 + transitivePeerDependencies: + - encoding + - mocha + - supports-color - /globalthis@1.0.3: - resolution: {integrity: sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==} - engines: {node: '>= 0.4'} + cross-fetch@3.1.5: dependencies: - define-properties: 1.2.1 - dev: true + node-fetch: 2.6.7 + transitivePeerDependencies: + - encoding - /globby@11.1.0: - resolution: {integrity: sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==} - engines: {node: '>=10'} + cross-spawn@7.0.6: dependencies: - array-union: 2.1.0 - dir-glob: 3.0.1 - fast-glob: 3.3.2 - ignore: 5.3.0 - merge2: 1.4.1 - slash: 3.0.0 - dev: true + path-key: 3.1.1 + shebang-command: 2.0.0 + which: 2.0.2 - /gopd@1.0.1: - resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==} + css-tree@3.1.0: dependencies: - get-intrinsic: 1.2.2 - dev: true + mdn-data: 2.12.2 + source-map-js: 1.2.1 - /graphemer@1.4.0: - resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} - dev: true + csstype@3.1.3: {} - /gzip-size@6.0.0: - resolution: {integrity: sha512-ax7ZYomf6jqPTQ4+XCpUGyXKHk5WweS+e05MBO4/y3WJ5RkmPXNKvX+bx1behVILVwr6JSQvZAku021CHPXG3Q==} - engines: {node: '>=10'} + ctrlc-windows@2.2.0: {} + + debug@4.4.0(supports-color@8.1.1): dependencies: - duplexer: 0.1.2 - dev: true + ms: 2.1.3 + optionalDependencies: + supports-color: 8.1.1 - /has-bigints@1.0.2: - resolution: {integrity: sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==} - dev: true + decamelize@4.0.0: {} - /has-flag@3.0.0: - resolution: {integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==} - engines: {node: '>=4'} - dev: true + deep-is@0.1.4: {} - /has-flag@4.0.0: - resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} - engines: {node: '>=8'} - dev: true + deepmerge@4.3.1: {} + + defu@6.1.4: {} + + destr@2.0.3: {} - /has-property-descriptors@1.0.1: - resolution: {integrity: sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==} + diff@5.2.0: {} + + dir-glob@3.0.1: dependencies: - get-intrinsic: 1.2.2 - dev: true + path-type: 4.0.0 - /has-proto@1.0.1: - resolution: {integrity: sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==} - engines: {node: '>= 0.4'} - dev: true + duplexer@0.1.2: {} - /has-symbols@1.0.3: - resolution: {integrity: sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==} - engines: {node: '>= 0.4'} - dev: true + effection@2.0.8(mocha@10.8.2): + dependencies: + '@effection/channel': 2.0.6 + '@effection/core': 2.2.3 + '@effection/events': 2.0.6 + '@effection/fetch': 2.0.7(mocha@10.8.2) + '@effection/main': 2.1.2 + '@effection/stream': 2.0.6 + '@effection/subscription': 2.0.6 + transitivePeerDependencies: + - encoding + - mocha - /has-tostringtag@1.0.0: - resolution: {integrity: sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==} - engines: {node: '>= 0.4'} + emoji-regex@8.0.0: {} + + entities@4.5.0: {} + + esbuild@0.25.2: + optionalDependencies: + '@esbuild/aix-ppc64': 0.25.2 + '@esbuild/android-arm': 0.25.2 + '@esbuild/android-arm64': 0.25.2 + '@esbuild/android-x64': 0.25.2 + '@esbuild/darwin-arm64': 0.25.2 + '@esbuild/darwin-x64': 0.25.2 + '@esbuild/freebsd-arm64': 0.25.2 + '@esbuild/freebsd-x64': 0.25.2 + '@esbuild/linux-arm': 0.25.2 + '@esbuild/linux-arm64': 0.25.2 + '@esbuild/linux-ia32': 0.25.2 + '@esbuild/linux-loong64': 0.25.2 + '@esbuild/linux-mips64el': 0.25.2 + '@esbuild/linux-ppc64': 0.25.2 + '@esbuild/linux-riscv64': 0.25.2 + '@esbuild/linux-s390x': 0.25.2 + '@esbuild/linux-x64': 0.25.2 + '@esbuild/netbsd-arm64': 0.25.2 + '@esbuild/netbsd-x64': 0.25.2 + '@esbuild/openbsd-arm64': 0.25.2 + '@esbuild/openbsd-x64': 0.25.2 + '@esbuild/sunos-x64': 0.25.2 + '@esbuild/win32-arm64': 0.25.2 + '@esbuild/win32-ia32': 0.25.2 + '@esbuild/win32-x64': 0.25.2 + + escalade@3.2.0: {} + + escape-string-regexp@4.0.0: {} + + eslint-config-prettier@10.1.2(eslint@9.25.1(jiti@2.4.2)): + dependencies: + eslint: 9.25.1(jiti@2.4.2) + + eslint-plugin-security@3.0.1: dependencies: - has-symbols: 1.0.3 - dev: true + safe-regex: 2.1.1 - /hasown@2.0.0: - resolution: {integrity: sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==} - engines: {node: '>= 0.4'} + eslint-scope@8.3.0: dependencies: - function-bind: 1.1.2 - dev: true + esrecurse: 4.3.0 + estraverse: 5.3.0 - /he@1.2.0: - resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==} - hasBin: true - dev: true + eslint-visitor-keys@3.4.3: {} + + eslint-visitor-keys@4.2.0: {} + + eslint@9.25.1(jiti@2.4.2): + dependencies: + '@eslint-community/eslint-utils': 4.4.1(eslint@9.25.1(jiti@2.4.2)) + '@eslint-community/regexpp': 4.12.1 + '@eslint/config-array': 0.20.0 + '@eslint/config-helpers': 0.2.1 + '@eslint/core': 0.13.0 + '@eslint/eslintrc': 3.3.1 + '@eslint/js': 9.25.1 + '@eslint/plugin-kit': 0.2.8 + '@humanfs/node': 0.16.6 + '@humanwhocodes/module-importer': 1.0.1 + '@humanwhocodes/retry': 0.4.2 + '@types/estree': 1.0.7 + '@types/json-schema': 7.0.15 + ajv: 6.12.6 + chalk: 4.1.2 + cross-spawn: 7.0.6 + debug: 4.4.0(supports-color@8.1.1) + escape-string-regexp: 4.0.0 + eslint-scope: 8.3.0 + eslint-visitor-keys: 4.2.0 + espree: 10.3.0 + esquery: 1.6.0 + esutils: 2.0.3 + fast-deep-equal: 3.1.3 + file-entry-cache: 8.0.0 + find-up: 5.0.0 + glob-parent: 6.0.2 + ignore: 5.3.2 + imurmurhash: 0.1.4 + is-glob: 4.0.3 + json-stable-stringify-without-jsonify: 1.0.1 + lodash.merge: 4.6.2 + minimatch: 3.1.2 + natural-compare: 1.4.0 + optionator: 0.9.4 + optionalDependencies: + jiti: 2.4.2 + transitivePeerDependencies: + - supports-color - /human-signals@2.1.0: - resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==} - engines: {node: '>=10.17.0'} - dev: true + esm-env@1.2.2: {} + + espree@10.3.0: + dependencies: + acorn: 8.14.0 + acorn-jsx: 5.3.2(acorn@8.14.0) + eslint-visitor-keys: 4.2.0 - /human-signals@4.3.1: - resolution: {integrity: sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==} - engines: {node: '>=14.18.0'} - dev: true + esquery@1.6.0: + dependencies: + estraverse: 5.3.0 - /iconv-lite@0.4.24: - resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} - engines: {node: '>=0.10.0'} + esrap@1.4.5: dependencies: - safer-buffer: 2.1.2 - dev: true + '@jridgewell/sourcemap-codec': 1.5.0 - /ieee754@1.2.1: - resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} - dev: true + esrecurse@4.3.0: + dependencies: + estraverse: 5.3.0 - /ignore@5.3.0: - resolution: {integrity: sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg==} - engines: {node: '>= 4'} - dev: true + estraverse@5.3.0: {} - /import-fresh@3.3.0: - resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==} - engines: {node: '>=6'} - dependencies: - parent-module: 1.0.1 - resolve-from: 4.0.0 - dev: true + estree-walker@2.0.2: {} - /imurmurhash@0.1.4: - resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} - engines: {node: '>=0.8.19'} - dev: true + esutils@2.0.3: {} - /inflight@1.0.6: - resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} - dependencies: - once: 1.4.0 - wrappy: 1.0.2 - dev: true + event-target-shim@5.0.1: {} - /inherits@2.0.4: - resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} - dev: true + events@3.3.0: {} - /inquirer@8.2.6: - resolution: {integrity: sha512-M1WuAmb7pn9zdFRtQYk26ZBoY043Sse0wVDdk4Bppr+JOXyQYybdtvK+l9wUibhtjdjvtoiNy8tk+EgsYIUqKg==} - engines: {node: '>=12.0.0'} - dependencies: - ansi-escapes: 4.3.2 - chalk: 4.1.2 - cli-cursor: 3.1.0 - cli-width: 3.0.0 - external-editor: 3.1.0 - figures: 3.2.0 - lodash: 4.17.21 - mute-stream: 0.0.8 - ora: 5.4.1 - run-async: 2.4.1 - rxjs: 7.8.1 - string-width: 4.2.3 - strip-ansi: 6.0.1 - through: 2.3.8 - wrap-ansi: 6.2.0 - dev: true + extend@3.0.2: {} - /internal-ip@8.0.0: - resolution: {integrity: sha512-e6c3zxr9COnnc29PIz9LffmALOt0XhIJdR7f83DyHcQksL3B40KGmU3Sr1lrHja3i7Zyqo+AbwKZ+nZiMvg/OA==} - engines: {node: '>=16'} - dependencies: - cidr-tools: 6.4.2 - default-gateway: 7.2.2 - is-ip: 5.0.0 - p-event: 5.0.1 - dev: true + fast-deep-equal@3.1.3: {} - /internal-slot@1.0.6: - resolution: {integrity: sha512-Xj6dv+PsbtwyPpEflsejS+oIZxmMlV44zAhG479uYu89MsjcYOhCFnNyKrkJrihbsiasQyY0afoCl/9BLR65bg==} - engines: {node: '>= 0.4'} + fast-glob@3.3.3: dependencies: - get-intrinsic: 1.2.2 - hasown: 2.0.0 - side-channel: 1.0.4 - dev: true + '@nodelib/fs.stat': 2.0.5 + '@nodelib/fs.walk': 1.2.8 + glob-parent: 5.1.2 + merge2: 1.4.1 + micromatch: 4.0.8 - /ip-bigint@7.3.0: - resolution: {integrity: sha512-2qVAe0Q9+Y+5nGvmogwK9y4kefD5Ks5l/IG0Jo1lhU9gIF34jifhqrwXwzkIl+LC594Q6SyAlngs4p890xsXVw==} - engines: {node: '>=16'} - dev: true + fast-json-stable-stringify@2.1.0: {} - /ip-regex@5.0.0: - resolution: {integrity: sha512-fOCG6lhoKKakwv+C6KdsOnGvgXnmgfmp0myi3bcNwj3qfwPAxRKWEuFhvEFF7ceYIz6+1jRZ+yguLFAmUNPEfw==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dev: true + fast-levenshtein@2.0.6: {} - /is-alphabetical@1.0.4: - resolution: {integrity: sha512-DwzsA04LQ10FHTZuL0/grVDk4rFoVH1pjAToYwBrHSxcrBIGQuXrQMtD5U1b0U2XVgKZCTLLP8u2Qxqhy3l2Vg==} - dev: true + fast-redact@3.5.0: {} - /is-alphanumerical@1.0.4: - resolution: {integrity: sha512-UzoZUr+XfVz3t3v4KyGEniVL9BDRoQtY7tOyrRybkVNjDFWyo1yhXNGrrBTQxp3ib9BLAWs7k2YKBQsFRkZG9A==} + fastq@1.19.1: dependencies: - is-alphabetical: 1.0.4 - is-decimal: 1.0.4 - dev: true + reusify: 1.1.0 - /is-array-buffer@3.0.2: - resolution: {integrity: sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==} + fault@1.0.4: dependencies: - call-bind: 1.0.5 - get-intrinsic: 1.2.2 - is-typed-array: 1.1.12 - dev: true + format: 0.2.2 - /is-bigint@1.0.4: - resolution: {integrity: sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==} - dependencies: - has-bigints: 1.0.2 - dev: true + fdir@6.4.3(picomatch@4.0.2): + optionalDependencies: + picomatch: 4.0.2 - /is-binary-path@2.1.0: - resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} - engines: {node: '>=8'} + file-entry-cache@8.0.0: dependencies: - binary-extensions: 2.2.0 - dev: true + flat-cache: 4.0.1 - /is-boolean-object@1.1.2: - resolution: {integrity: sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==} - engines: {node: '>= 0.4'} + fill-range@7.1.1: dependencies: - call-bind: 1.0.5 - has-tostringtag: 1.0.0 - dev: true + to-regex-range: 5.0.1 - /is-buffer@2.0.5: - resolution: {integrity: sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==} - engines: {node: '>=4'} - dev: true + find-up@5.0.0: + dependencies: + locate-path: 6.0.0 + path-exists: 4.0.0 - /is-builtin-module@3.2.1: - resolution: {integrity: sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A==} - engines: {node: '>=6'} + flat-cache@4.0.1: dependencies: - builtin-modules: 3.3.0 - dev: true + flatted: 3.3.3 + keyv: 4.5.4 - /is-callable@1.2.7: - resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==} - engines: {node: '>= 0.4'} - dev: true + flat@5.0.2: {} - /is-core-module@2.13.1: - resolution: {integrity: sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==} - dependencies: - hasown: 2.0.0 - dev: true + flatted@3.3.3: {} - /is-date-object@1.0.5: - resolution: {integrity: sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==} - engines: {node: '>= 0.4'} - dependencies: - has-tostringtag: 1.0.0 - dev: true + format@0.2.2: {} - /is-decimal@1.0.4: - resolution: {integrity: sha512-RGdriMmQQvZ2aqaQq3awNA6dCGtKpiDFcOzrTWrDAT2MiWrKQVPmxLGHl7Y2nNu6led0kEyoX0enY0qXYsv9zw==} - dev: true + fs.realpath@1.0.0: {} - /is-extglob@2.1.1: - resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} - engines: {node: '>=0.10.0'} - dev: true + fsevents@2.3.3: + optional: true - /is-fullwidth-code-point@3.0.0: - resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} - engines: {node: '>=8'} - dev: true + function-bind@1.1.2: {} - /is-glob@4.0.3: - resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} - engines: {node: '>=0.10.0'} + get-caller-file@2.0.5: {} + + get-tsconfig@4.10.0: dependencies: - is-extglob: 2.1.1 - dev: true + resolve-pkg-maps: 1.0.0 + optional: true - /is-hexadecimal@1.0.4: - resolution: {integrity: sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw==} - dev: true + glob-parent@5.1.2: + dependencies: + is-glob: 4.0.3 - /is-interactive@1.0.0: - resolution: {integrity: sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==} - engines: {node: '>=8'} - dev: true + glob-parent@6.0.2: + dependencies: + is-glob: 4.0.3 - /is-ip@5.0.0: - resolution: {integrity: sha512-uhmKwcdWJ1nTmBdoBxdHilfJs4qdLBIvVHKRels2+UCZmfcfefuQWziadaYLpN7t/bUrJOjJHv+R1di1q7Q1HQ==} - engines: {node: '>=14.16'} + glob@8.1.0: dependencies: - ip-regex: 5.0.0 - super-regex: 0.2.0 - dev: true + fs.realpath: 1.0.0 + inflight: 1.0.6 + inherits: 2.0.4 + minimatch: 5.1.6 + once: 1.4.0 - /is-module@1.0.0: - resolution: {integrity: sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==} - dev: true + globals@14.0.0: {} - /is-negative-zero@2.0.2: - resolution: {integrity: sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==} - engines: {node: '>= 0.4'} - dev: true + globals@15.15.0: {} - /is-number-object@1.0.7: - resolution: {integrity: sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==} - engines: {node: '>= 0.4'} + globby@11.1.0: dependencies: - has-tostringtag: 1.0.0 - dev: true + array-union: 2.1.0 + dir-glob: 3.0.1 + fast-glob: 3.3.3 + ignore: 5.3.2 + merge2: 1.4.1 + slash: 3.0.0 - /is-number@7.0.0: - resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} - engines: {node: '>=0.12.0'} - dev: true + graphemer@1.4.0: {} - /is-path-inside@3.0.3: - resolution: {integrity: sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==} - engines: {node: '>=8'} - dev: true + gzip-size@6.0.0: + dependencies: + duplexer: 0.1.2 - /is-plain-obj@2.1.0: - resolution: {integrity: sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==} - engines: {node: '>=8'} - dev: true + has-flag@4.0.0: {} - /is-reference@3.0.2: - resolution: {integrity: sha512-v3rht/LgVcsdZa3O2Nqs+NMowLOxeOm7Ay9+/ARQ2F+qEoANRcqrjAZKGN0v8ymUetZGgkp26LTnGT7H0Qo9Pg==} + hasown@2.0.2: dependencies: - '@types/estree': 1.0.5 + function-bind: 1.1.2 - /is-regex@1.1.4: - resolution: {integrity: sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==} - engines: {node: '>= 0.4'} + he@1.2.0: {} + + ieee754@1.2.1: {} + + ignore@5.3.2: {} + + import-fresh@3.3.1: dependencies: - call-bind: 1.0.5 - has-tostringtag: 1.0.0 - dev: true + parent-module: 1.0.1 + resolve-from: 4.0.0 - /is-regexp@3.1.0: - resolution: {integrity: sha512-rbku49cWloU5bSMI+zaRaXdQHXnthP6DZ/vLnfdSKyL4zUzuWnomtOEiZZOd+ioQ+avFo/qau3KPTc7Fjy1uPA==} - engines: {node: '>=12'} - dev: true + imurmurhash@0.1.4: {} - /is-shared-array-buffer@1.0.2: - resolution: {integrity: sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==} + inflight@1.0.6: dependencies: - call-bind: 1.0.5 - dev: true + once: 1.4.0 + wrappy: 1.0.2 - /is-stream@2.0.1: - resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==} - engines: {node: '>=8'} - dev: true + inherits@2.0.4: {} - /is-stream@3.0.0: - resolution: {integrity: sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dev: true + is-alphabetical@1.0.4: {} - /is-string@1.0.7: - resolution: {integrity: sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==} - engines: {node: '>= 0.4'} + is-alphanumerical@1.0.4: dependencies: - has-tostringtag: 1.0.0 - dev: true + is-alphabetical: 1.0.4 + is-decimal: 1.0.4 - /is-symbol@1.0.4: - resolution: {integrity: sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==} - engines: {node: '>= 0.4'} + is-binary-path@2.1.0: dependencies: - has-symbols: 1.0.3 - dev: true + binary-extensions: 2.3.0 - /is-typed-array@1.1.12: - resolution: {integrity: sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==} - engines: {node: '>= 0.4'} + is-buffer@2.0.5: {} + + is-core-module@2.16.1: dependencies: - which-typed-array: 1.1.13 - dev: true + hasown: 2.0.2 - /is-unicode-supported@0.1.0: - resolution: {integrity: sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==} - engines: {node: '>=10'} - dev: true + is-decimal@1.0.4: {} + + is-extglob@2.1.1: {} - /is-weakref@1.0.2: - resolution: {integrity: sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==} + is-fullwidth-code-point@3.0.0: {} + + is-glob@4.0.3: dependencies: - call-bind: 1.0.5 - dev: true + is-extglob: 2.1.1 - /isarray@2.0.5: - resolution: {integrity: sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==} - dev: true + is-hexadecimal@1.0.4: {} - /isexe@2.0.0: - resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} - dev: true + is-module@1.0.0: {} - /jiti@1.20.0: - resolution: {integrity: sha512-3TV69ZbrvV6U5DfQimop50jE9Dl6J8O1ja1dvBbMba/sZ3YBEQqJ2VZRoQPVnhlzjNtU1vaXRZVrVjU4qtm8yA==} - hasBin: true - dev: true + is-number@7.0.0: {} - /js-tokens@4.0.0: - resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} - dev: true + is-plain-obj@2.1.0: {} - /js-yaml@4.1.0: - resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} - hasBin: true + is-reference@3.0.3: dependencies: - argparse: 2.0.1 - dev: true - - /jsesc@2.5.2: - resolution: {integrity: sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==} - engines: {node: '>=4'} - hasBin: true - dev: true + '@types/estree': 1.0.7 - /json-buffer@3.0.1: - resolution: {integrity: sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==} - dev: true + is-unicode-supported@0.1.0: {} - /json-schema-traverse@0.4.1: - resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} - dev: true + isexe@2.0.0: {} - /json-stable-stringify-without-jsonify@1.0.1: - resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==} - dev: true + jiti@2.4.2: {} - /json5@1.0.2: - resolution: {integrity: sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==} - hasBin: true + js-yaml@4.1.0: dependencies: - minimist: 1.2.8 - dev: true + argparse: 2.0.1 - /json5@2.2.3: - resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==} - engines: {node: '>=6'} - hasBin: true - dev: true + json-buffer@3.0.1: {} - /jsonc-parser@3.2.0: - resolution: {integrity: sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==} - dev: true + json-schema-traverse@0.4.1: {} - /keyv@4.5.4: - resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==} + json-stable-stringify-without-jsonify@1.0.1: {} + + keyv@4.5.4: dependencies: json-buffer: 3.0.1 - dev: true - /kleur@4.1.5: - resolution: {integrity: sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==} - engines: {node: '>=6'} - dev: true + kleur@4.1.5: {} - /kolorist@1.8.0: - resolution: {integrity: sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ==} - dev: true + kolorist@1.8.0: {} - /levn@0.4.1: - resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==} - engines: {node: '>= 0.8.0'} + levn@0.4.1: dependencies: prelude-ls: 1.2.1 type-check: 0.4.0 - dev: true - /local-pkg@0.4.3: - resolution: {integrity: sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g==} - engines: {node: '>=14'} - dev: true + local-pkg@1.0.0: + dependencies: + mlly: 1.7.4 + pkg-types: 1.3.1 - /locate-character@3.0.0: - resolution: {integrity: sha512-SW13ws7BjaeJ6p7Q6CO2nchbYEc3X3J6WrmTTDto7yMPqVSZTUyY5Tjbid+Ab8gLnATtygYtiDIJGQRRn2ZOiA==} + locate-character@3.0.0: {} - /locate-path@6.0.0: - resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==} - engines: {node: '>=10'} + locate-path@6.0.0: dependencies: p-locate: 5.0.0 - dev: true - /lodash.merge@4.6.2: - resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} - dev: true + lodash.merge@4.6.2: {} - /lodash@4.17.21: - resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} - dev: true + lodash@4.17.21: {} - /log-symbols@4.1.0: - resolution: {integrity: sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==} - engines: {node: '>=10'} + log-symbols@4.1.0: dependencies: chalk: 4.1.2 is-unicode-supported: 0.1.0 - dev: true - - /longest-streak@2.0.4: - resolution: {integrity: sha512-vM6rUVCVUJJt33bnmHiZEvr7wPT78ztX7rojL+LW51bHtLh6HTjx84LA5W4+oa6aKEJA7jJu5LR6vQRBpA5DVg==} - dev: true - - /lru-cache@5.1.1: - resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==} - dependencies: - yallist: 3.1.1 - dev: true - /lru-cache@6.0.0: - resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==} - engines: {node: '>=10'} - dependencies: - yallist: 4.0.0 - dev: true + longest-streak@2.0.4: {} - /magic-string@0.30.5: - resolution: {integrity: sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA==} - engines: {node: '>=12'} + magic-string@0.30.17: dependencies: - '@jridgewell/sourcemap-codec': 1.4.15 + '@jridgewell/sourcemap-codec': 1.5.0 - /mdast-util-from-markdown@0.8.5: - resolution: {integrity: sha512-2hkTXtYYnr+NubD/g6KGBS/0mFmBcifAsI0yIWRiRo0PjVs6SSOSOdtzbp6kSGnShDN6G5aWZpKQ2lWRy27mWQ==} + mdast-util-from-markdown@0.8.5: dependencies: '@types/mdast': 3.0.15 mdast-util-to-string: 2.0.0 @@ -3822,348 +3618,136 @@ packages: unist-util-stringify-position: 2.0.3 transitivePeerDependencies: - supports-color - dev: true - /mdast-util-frontmatter@0.2.0: - resolution: {integrity: sha512-FHKL4w4S5fdt1KjJCwB0178WJ0evnyyQr5kXTM3wrOVpytD0hrkvd+AOOjU9Td8onOejCkmZ+HQRT3CZ3coHHQ==} + mdast-util-frontmatter@0.2.0: dependencies: micromark-extension-frontmatter: 0.2.2 - dev: true - /mdast-util-to-markdown@0.6.5: - resolution: {integrity: sha512-XeV9sDE7ZlOQvs45C9UKMtfTcctcaj/pGwH8YLbMHoMOXNNCn2LsqVQOqrF1+/NU8lKDAqozme9SCXWyo9oAcQ==} + mdast-util-to-markdown@0.6.5: dependencies: - '@types/unist': 2.0.10 + '@types/unist': 2.0.11 longest-streak: 2.0.4 mdast-util-to-string: 2.0.0 parse-entities: 2.0.0 repeat-string: 1.6.1 zwitch: 1.0.5 - dev: true - - /mdast-util-to-string@2.0.0: - resolution: {integrity: sha512-AW4DRS3QbBayY/jJmD8437V1Gombjf8RSOUCMFBuo5iHi58AGEgVCKQ+ezHkZZDpAQS75hcBMpLqjpJTjtUL7w==} - dev: true - /mdn-data@2.0.30: - resolution: {integrity: sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==} + mdast-util-to-string@2.0.0: {} - /merge-stream@2.0.0: - resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} - dev: true + mdn-data@2.12.2: {} - /merge2@1.4.1: - resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} - engines: {node: '>= 8'} - dev: true + merge2@1.4.1: {} - /micromark-extension-frontmatter@0.2.2: - resolution: {integrity: sha512-q6nPLFCMTLtfsctAuS0Xh4vaolxSFUWUWR6PZSrXXiRy+SANGllpcqdXFv2z07l0Xz/6Hl40hK0ffNCJPH2n1A==} + micromark-extension-frontmatter@0.2.2: dependencies: fault: 1.0.4 - dev: true - /micromark@2.11.4: - resolution: {integrity: sha512-+WoovN/ppKolQOFIAajxi7Lu9kInbPxFuTBVEavFcL8eAfVstoc5MocPmqBeAdBOJV00uaVjegzH4+MA0DN/uA==} + micromark@2.11.4: dependencies: - debug: 4.3.4 + debug: 4.4.0(supports-color@8.1.1) parse-entities: 2.0.0 transitivePeerDependencies: - supports-color - dev: true - /micromatch@4.0.5: - resolution: {integrity: sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==} - engines: {node: '>=8.6'} + micromatch@4.0.8: dependencies: - braces: 3.0.2 + braces: 3.0.3 picomatch: 2.3.1 - dev: true - /mimic-fn@2.1.0: - resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} - engines: {node: '>=6'} - dev: true - - /mimic-fn@4.0.0: - resolution: {integrity: sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==} - engines: {node: '>=12'} - dev: true - - /minimatch@3.1.2: - resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} + minimatch@3.1.2: dependencies: brace-expansion: 1.1.11 - dev: true - /minimatch@5.0.1: - resolution: {integrity: sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==} - engines: {node: '>=10'} + minimatch@5.1.6: dependencies: brace-expansion: 2.0.1 - dev: true - /minimatch@9.0.3: - resolution: {integrity: sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==} - engines: {node: '>=16 || 14 >=14.17'} + minimatch@9.0.5: dependencies: brace-expansion: 2.0.1 - dev: true - - /minimist@1.2.8: - resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} - dev: true - /mlly@1.4.2: - resolution: {integrity: sha512-i/Ykufi2t1EZ6NaPLdfnZk2AX8cs0d+mTzVKuPfqPKPatxLApaBoxJQ9x1/uckXtrS/U5oisPMDkNs0yQTaBRg==} + mlly@1.7.4: dependencies: - acorn: 8.11.2 - pathe: 1.1.1 - pkg-types: 1.0.3 - ufo: 1.3.1 - dev: true + acorn: 8.14.0 + pathe: 2.0.3 + pkg-types: 1.3.1 + ufo: 1.5.4 - /mocha@10.2.0: - resolution: {integrity: sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==} - engines: {node: '>= 14.0.0'} - hasBin: true + mocha@10.8.2: dependencies: - ansi-colors: 4.1.1 + ansi-colors: 4.1.3 browser-stdout: 1.3.1 - chokidar: 3.5.3 - debug: 4.3.4(supports-color@8.1.1) - diff: 5.0.0 + chokidar: 3.6.0 + debug: 4.4.0(supports-color@8.1.1) + diff: 5.2.0 escape-string-regexp: 4.0.0 find-up: 5.0.0 - glob: 7.2.0 + glob: 8.1.0 he: 1.2.0 js-yaml: 4.1.0 log-symbols: 4.1.0 - minimatch: 5.0.1 + minimatch: 5.1.6 ms: 2.1.3 - nanoid: 3.3.3 - serialize-javascript: 6.0.0 + serialize-javascript: 6.0.2 strip-json-comments: 3.1.1 supports-color: 8.1.1 - workerpool: 6.2.1 + workerpool: 6.5.1 yargs: 16.2.0 - yargs-parser: 20.2.4 + yargs-parser: 20.2.9 yargs-unparser: 2.0.0 - dev: true - - /mrmime@1.0.1: - resolution: {integrity: sha512-hzzEagAgDyoU1Q6yg5uI+AorQgdvMCur3FcKf7NhMKWsaYg+RnbTyHRa/9IlLF9rf455MOCtcqqrQQ83pPP7Uw==} - engines: {node: '>=10'} - dev: true - /ms@2.1.2: - resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} - dev: true + mrmime@2.0.1: {} - /ms@2.1.3: - resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} - dev: true - - /mute-stream@0.0.8: - resolution: {integrity: sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==} - dev: true - - /nanoid@3.3.3: - resolution: {integrity: sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==} - engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} - hasBin: true - dev: true + ms@2.1.3: {} - /nanoid@3.3.7: - resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==} - engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} - hasBin: true - dev: true + nanoid@3.3.11: {} - /natural-compare@1.4.0: - resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} - dev: true + natural-compare@1.4.0: {} - /node-fetch-native@1.4.0: - resolution: {integrity: sha512-F5kfEj95kX8tkDhUCYdV8dg3/8Olx/94zB8+ZNthFs6Bz31UpUi8Xh40TN3thLwXgrwXry1pEg9lJ++tLWTcqA==} - dev: true + node-fetch-native@1.6.6: {} - /node-fetch@2.6.7: - resolution: {integrity: sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==} - engines: {node: 4.x || >=6.0.0} - peerDependencies: - encoding: ^0.1.0 - peerDependenciesMeta: - encoding: - optional: true + node-fetch@2.6.7: dependencies: whatwg-url: 5.0.0 - dev: true - - /node-releases@2.0.14: - resolution: {integrity: sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==} - dev: true - - /normalize-path@3.0.0: - resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} - engines: {node: '>=0.10.0'} - dev: true - - /npm-run-path@4.0.1: - resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==} - engines: {node: '>=8'} - dependencies: - path-key: 3.1.1 - dev: true - - /npm-run-path@5.1.0: - resolution: {integrity: sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - path-key: 4.0.0 - dev: true - - /object-inspect@1.13.1: - resolution: {integrity: sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==} - dev: true - - /object-keys@1.1.1: - resolution: {integrity: sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==} - engines: {node: '>= 0.4'} - dev: true - /object.assign@4.1.5: - resolution: {integrity: sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - has-symbols: 1.0.3 - object-keys: 1.1.1 - dev: true - - /object.fromentries@2.0.7: - resolution: {integrity: sha512-UPbPHML6sL8PI/mOqPwsH4G6iyXcCGzLin8KvEPenOZN5lpCNBZZQ+V62vdjB1mQHrmqGQt5/OJzemUA+KJmEA==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - dev: true - - /object.groupby@1.0.1: - resolution: {integrity: sha512-HqaQtqLnp/8Bn4GL16cj+CUYbnpe1bh0TtEaWvybszDG4tgxCJuRpV8VGuvNaI1fAnI4lUJzDG55MXcOH4JZcQ==} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - get-intrinsic: 1.2.2 - dev: true + normalize-path@3.0.0: {} - /object.values@1.1.7: - resolution: {integrity: sha512-aU6xnDFYT3x17e/f0IiiwlGPTy2jzMySGfUB4fq6z7CV8l85CWHDk5ErhyhpfDHhrOMwGFhSQkhMGHaIotA6Ng==} - engines: {node: '>= 0.4'} + ofetch@1.4.1: dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - dev: true + destr: 2.0.3 + node-fetch-native: 1.6.6 + ufo: 1.5.4 - /ofetch@1.3.3: - resolution: {integrity: sha512-s1ZCMmQWXy4b5K/TW9i/DtiN8Ku+xCiHcjQ6/J/nDdssirrQNOoB165Zu8EqLMA2lln1JUth9a0aW9Ap2ctrUg==} - dependencies: - destr: 2.0.1 - node-fetch-native: 1.4.0 - ufo: 1.3.1 - dev: true + on-exit-leak-free@2.1.2: {} - /once@1.4.0: - resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} + once@1.4.0: dependencies: wrappy: 1.0.2 - dev: true - - /onetime@5.1.2: - resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==} - engines: {node: '>=6'} - dependencies: - mimic-fn: 2.1.0 - dev: true - - /onetime@6.0.0: - resolution: {integrity: sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==} - engines: {node: '>=12'} - dependencies: - mimic-fn: 4.0.0 - dev: true - /optionator@0.9.3: - resolution: {integrity: sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==} - engines: {node: '>= 0.8.0'} + optionator@0.9.4: dependencies: - '@aashutoshrathi/word-wrap': 1.2.6 deep-is: 0.1.4 fast-levenshtein: 2.0.6 levn: 0.4.1 prelude-ls: 1.2.1 type-check: 0.4.0 - dev: true - - /ora@5.4.1: - resolution: {integrity: sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==} - engines: {node: '>=10'} - dependencies: - bl: 4.1.0 - chalk: 4.1.2 - cli-cursor: 3.1.0 - cli-spinners: 2.9.2 - is-interactive: 1.0.0 - is-unicode-supported: 0.1.0 - log-symbols: 4.1.0 - strip-ansi: 6.0.1 - wcwidth: 1.0.1 - dev: true + word-wrap: 1.2.5 - /os-tmpdir@1.0.2: - resolution: {integrity: sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==} - engines: {node: '>=0.10.0'} - dev: true - - /p-event@5.0.1: - resolution: {integrity: sha512-dd589iCQ7m1L0bmC5NLlVYfy3TbBEsMUfWx9PyAgPeIcFZ/E2yaTZ4Rz4MiBmmJShviiftHVXOqfnfzJ6kyMrQ==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - p-timeout: 5.1.0 - dev: true - - /p-limit@3.1.0: - resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} - engines: {node: '>=10'} + p-limit@3.1.0: dependencies: yocto-queue: 0.1.0 - dev: true - /p-locate@5.0.0: - resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==} - engines: {node: '>=10'} + p-locate@5.0.0: dependencies: p-limit: 3.1.0 - dev: true - /p-timeout@5.1.0: - resolution: {integrity: sha512-auFDyzzzGZZZdHz3BtET9VEz0SE/uMEAx7uWfGPucfzEwwe/xH0iVeZibQmANYE/hp9T2+UUZT5m+BKyrDp3Ew==} - engines: {node: '>=12'} - dev: true + package-manager-detector@0.2.9: {} - /parent-module@1.0.1: - resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} - engines: {node: '>=6'} + parent-module@1.0.1: dependencies: callsites: 3.1.0 - dev: true - /parse-entities@2.0.0: - resolution: {integrity: sha512-kkywGpCcRYhqQIchaWqZ875wzpS/bMKhz5HnN3p7wveJTkTtyAB/AlnS0f8DFSqYW1T82t6yEAkEcB+A1I3MbQ==} + parse-entities@2.0.0: dependencies: character-entities: 1.2.4 character-entities-legacy: 1.1.4 @@ -4171,999 +3755,477 @@ packages: is-alphanumerical: 1.0.4 is-decimal: 1.0.4 is-hexadecimal: 1.0.4 - dev: true - /path-exists@4.0.0: - resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} - engines: {node: '>=8'} - dev: true + path-exists@4.0.0: {} - /path-is-absolute@1.0.1: - resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} - engines: {node: '>=0.10.0'} - dev: true + path-key@3.1.1: {} - /path-key@3.1.1: - resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} - engines: {node: '>=8'} - dev: true + path-parse@1.0.7: {} - /path-key@4.0.0: - resolution: {integrity: sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==} - engines: {node: '>=12'} - dev: true + path-type@4.0.0: {} - /path-parse@1.0.7: - resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} - dev: true + pathe@2.0.3: {} - /path-type@4.0.0: - resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} - engines: {node: '>=8'} - dev: true + perfect-debounce@1.0.0: {} - /pathe@1.1.1: - resolution: {integrity: sha512-d+RQGp0MAYTIaDBIMmOfMwz3E+LOZnxx1HZd5R18mmCZY0QBlK0LDZfPc8FW8Ed2DlvsuE6PRjroDY+wg4+j/Q==} - dev: true + picocolors@1.1.1: {} - /perfect-debounce@1.0.0: - resolution: {integrity: sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==} - dev: true + picomatch@2.3.1: {} + + picomatch@4.0.2: {} + + pino-abstract-transport@1.2.0: + dependencies: + readable-stream: 4.7.0 + split2: 4.2.0 - /periscopic@3.1.0: - resolution: {integrity: sha512-vKiQ8RRtkl9P+r/+oefh25C3fhybptkHKCZSPlcXiJux2tJF55GnEj3BVn4A5gKfq9NWWXXrxkHBwVPUfH0opw==} + pino-abstract-transport@2.0.0: dependencies: - '@types/estree': 1.0.5 - estree-walker: 3.0.3 - is-reference: 3.0.2 + split2: 4.2.0 - /picocolors@1.0.0: - resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==} - dev: true + pino-std-serializers@7.0.0: {} - /picomatch@2.3.1: - resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} - engines: {node: '>=8.6'} - dev: true + pino@9.6.0: + dependencies: + atomic-sleep: 1.0.0 + fast-redact: 3.5.0 + on-exit-leak-free: 2.1.2 + pino-abstract-transport: 2.0.0 + pino-std-serializers: 7.0.0 + process-warning: 4.0.1 + quick-format-unescaped: 4.0.4 + real-require: 0.2.0 + safe-stable-stringify: 2.5.0 + sonic-boom: 4.2.0 + thread-stream: 3.1.0 - /pkg-types@1.0.3: - resolution: {integrity: sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==} + pkg-types@1.3.1: dependencies: - jsonc-parser: 3.2.0 - mlly: 1.4.2 - pathe: 1.1.1 - dev: true + confbox: 0.1.8 + mlly: 1.7.4 + pathe: 2.0.3 + + postcss@8.5.3: + dependencies: + nanoid: 3.3.11 + picocolors: 1.1.1 + source-map-js: 1.2.1 + + prelude-ls@1.2.1: {} + + prettier@3.5.3: {} - /postcss@8.4.32: - resolution: {integrity: sha512-D/kj5JNu6oo2EIy+XL/26JEDTlIbB8hw85G8StOE6L74RQAVVP5rej6wxCNqyMbR4RkPfqvezVbPw81Ngd6Kcw==} - engines: {node: ^10 || ^12 || >=14} - dependencies: - nanoid: 3.3.7 - picocolors: 1.0.0 - source-map-js: 1.0.2 - dev: true + process-warning@4.0.1: {} - /prelude-ls@1.2.1: - resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} - engines: {node: '>= 0.8.0'} - dev: true + process@0.11.10: {} - /prettier@3.2.2: - resolution: {integrity: sha512-HTByuKZzw7utPiDO523Tt2pLtEyK7OibUD9suEJQrPUCYQqrHr74GGX6VidMrovbf/I50mPqr8j/II6oBAuc5A==} - engines: {node: '>=14'} - hasBin: true - dev: true + punycode@2.3.1: {} - /punycode@2.3.1: - resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} - engines: {node: '>=6'} - dev: true + queue-microtask@1.2.3: {} - /queue-microtask@1.2.3: - resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} - dev: true + quick-format-unescaped@4.0.4: {} - /randombytes@2.1.0: - resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==} + randombytes@2.1.0: dependencies: safe-buffer: 5.2.1 - dev: true - /readable-stream@3.6.2: - resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==} - engines: {node: '>= 6'} + readable-stream@4.7.0: dependencies: - inherits: 2.0.4 + abort-controller: 3.0.0 + buffer: 6.0.3 + events: 3.3.0 + process: 0.11.10 string_decoder: 1.3.0 - util-deprecate: 1.0.2 - dev: true - /readdirp@3.6.0: - resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} - engines: {node: '>=8.10.0'} + readdirp@3.6.0: dependencies: picomatch: 2.3.1 - dev: true - /regexp-tree@0.1.27: - resolution: {integrity: sha512-iETxpjK6YoRWJG5o6hXLwvjYAoW+FEZn9os0PD/b6AP6xQwsa/Y7lCVgIixBbUPMfhu+i2LtdeAqVTgGlQarfA==} - hasBin: true - dev: true + real-require@0.2.0: {} - /regexp.prototype.flags@1.5.1: - resolution: {integrity: sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - set-function-name: 2.0.1 - dev: true + regexp-tree@0.1.27: {} - /remark-frontmatter@3.0.0: - resolution: {integrity: sha512-mSuDd3svCHs+2PyO29h7iijIZx4plX0fheacJcAoYAASfgzgVIcXGYSq9GFyYocFLftQs8IOmmkgtOovs6d4oA==} + remark-frontmatter@3.0.0: dependencies: mdast-util-frontmatter: 0.2.0 micromark-extension-frontmatter: 0.2.2 - dev: true - /remark-parse@9.0.0: - resolution: {integrity: sha512-geKatMwSzEXKHuzBNU1z676sGcDcFoChMK38TgdHJNAYfFtsfHDQG7MoJAjs6sgYMqyLduCYWDIWZIxiPeafEw==} + remark-parse@9.0.0: dependencies: mdast-util-from-markdown: 0.8.5 transitivePeerDependencies: - supports-color - dev: true - /remark-stringify@9.0.1: - resolution: {integrity: sha512-mWmNg3ZtESvZS8fv5PTvaPckdL4iNlCHTt8/e/8oN08nArHRHjNZMKzA/YW3+p7/lYqIw4nx1XsjCBo/AxNChg==} + remark-stringify@9.0.1: dependencies: mdast-util-to-markdown: 0.6.5 - dev: true - /repeat-string@1.6.1: - resolution: {integrity: sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w==} - engines: {node: '>=0.10'} - dev: true + repeat-string@1.6.1: {} - /require-directory@2.1.1: - resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} - engines: {node: '>=0.10.0'} - dev: true + require-directory@2.1.1: {} - /resolve-from@4.0.0: - resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} - engines: {node: '>=4'} - dev: true + resolve-from@4.0.0: {} - /resolve-pkg-maps@1.0.0: - resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==} - dev: true + resolve-pkg-maps@1.0.0: + optional: true - /resolve@1.22.8: - resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==} - hasBin: true + resolve@1.22.10: dependencies: - is-core-module: 2.13.1 + is-core-module: 2.16.1 path-parse: 1.0.7 supports-preserve-symlinks-flag: 1.0.0 - dev: true - - /restore-cursor@3.1.0: - resolution: {integrity: sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==} - engines: {node: '>=8'} - dependencies: - onetime: 5.1.2 - signal-exit: 3.0.7 - dev: true - - /reusify@1.0.4: - resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} - engines: {iojs: '>=1.0.0', node: '>=0.10.0'} - dev: true - - /rimraf@3.0.2: - resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==} - hasBin: true - dependencies: - glob: 7.2.3 - dev: true - /rollup@4.6.1: - resolution: {integrity: sha512-jZHaZotEHQaHLgKr8JnQiDT1rmatjgKlMekyksz+yk9jt/8z9quNjnKNRoaM0wd9DC2QKXjmWWuDYtM3jfF8pQ==} - engines: {node: '>=18.0.0', npm: '>=8.0.0'} - hasBin: true - optionalDependencies: - '@rollup/rollup-android-arm-eabi': 4.6.1 - '@rollup/rollup-android-arm64': 4.6.1 - '@rollup/rollup-darwin-arm64': 4.6.1 - '@rollup/rollup-darwin-x64': 4.6.1 - '@rollup/rollup-linux-arm-gnueabihf': 4.6.1 - '@rollup/rollup-linux-arm64-gnu': 4.6.1 - '@rollup/rollup-linux-arm64-musl': 4.6.1 - '@rollup/rollup-linux-x64-gnu': 4.6.1 - '@rollup/rollup-linux-x64-musl': 4.6.1 - '@rollup/rollup-win32-arm64-msvc': 4.6.1 - '@rollup/rollup-win32-ia32-msvc': 4.6.1 - '@rollup/rollup-win32-x64-msvc': 4.6.1 - fsevents: 2.3.3 - dev: true + reusify@1.1.0: {} - /rollup@4.9.6: - resolution: {integrity: sha512-05lzkCS2uASX0CiLFybYfVkwNbKZG5NFQ6Go0VWyogFTXXbR039UVsegViTntkk4OglHBdF54ccApXRRuXRbsg==} - engines: {node: '>=18.0.0', npm: '>=8.0.0'} - hasBin: true + rollup@4.40.1: dependencies: - '@types/estree': 1.0.5 + '@types/estree': 1.0.7 optionalDependencies: - '@rollup/rollup-android-arm-eabi': 4.9.6 - '@rollup/rollup-android-arm64': 4.9.6 - '@rollup/rollup-darwin-arm64': 4.9.6 - '@rollup/rollup-darwin-x64': 4.9.6 - '@rollup/rollup-linux-arm-gnueabihf': 4.9.6 - '@rollup/rollup-linux-arm64-gnu': 4.9.6 - '@rollup/rollup-linux-arm64-musl': 4.9.6 - '@rollup/rollup-linux-riscv64-gnu': 4.9.6 - '@rollup/rollup-linux-x64-gnu': 4.9.6 - '@rollup/rollup-linux-x64-musl': 4.9.6 - '@rollup/rollup-win32-arm64-msvc': 4.9.6 - '@rollup/rollup-win32-ia32-msvc': 4.9.6 - '@rollup/rollup-win32-x64-msvc': 4.9.6 + '@rollup/rollup-android-arm-eabi': 4.40.1 + '@rollup/rollup-android-arm64': 4.40.1 + '@rollup/rollup-darwin-arm64': 4.40.1 + '@rollup/rollup-darwin-x64': 4.40.1 + '@rollup/rollup-freebsd-arm64': 4.40.1 + '@rollup/rollup-freebsd-x64': 4.40.1 + '@rollup/rollup-linux-arm-gnueabihf': 4.40.1 + '@rollup/rollup-linux-arm-musleabihf': 4.40.1 + '@rollup/rollup-linux-arm64-gnu': 4.40.1 + '@rollup/rollup-linux-arm64-musl': 4.40.1 + '@rollup/rollup-linux-loongarch64-gnu': 4.40.1 + '@rollup/rollup-linux-powerpc64le-gnu': 4.40.1 + '@rollup/rollup-linux-riscv64-gnu': 4.40.1 + '@rollup/rollup-linux-riscv64-musl': 4.40.1 + '@rollup/rollup-linux-s390x-gnu': 4.40.1 + '@rollup/rollup-linux-x64-gnu': 4.40.1 + '@rollup/rollup-linux-x64-musl': 4.40.1 + '@rollup/rollup-win32-arm64-msvc': 4.40.1 + '@rollup/rollup-win32-ia32-msvc': 4.40.1 + '@rollup/rollup-win32-x64-msvc': 4.40.1 fsevents: 2.3.3 - dev: true - /run-async@2.4.1: - resolution: {integrity: sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==} - engines: {node: '>=0.12.0'} - dev: true - - /run-parallel@1.2.0: - resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} + run-parallel@1.2.0: dependencies: queue-microtask: 1.2.3 - dev: true - - /rxjs@7.8.1: - resolution: {integrity: sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==} - dependencies: - tslib: 2.6.0 - dev: true - - /safe-array-concat@1.0.1: - resolution: {integrity: sha512-6XbUAseYE2KtOuGueyeobCySj9L4+66Tn6KQMOPQJrAJEowYKW/YR/MGJZl7FdydUdaFu4LYyDZjxf4/Nmo23Q==} - engines: {node: '>=0.4'} - dependencies: - call-bind: 1.0.5 - get-intrinsic: 1.2.2 - has-symbols: 1.0.3 - isarray: 2.0.5 - dev: true - - /safe-buffer@5.2.1: - resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} - dev: true - /safe-regex-test@1.0.0: - resolution: {integrity: sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==} - dependencies: - call-bind: 1.0.5 - get-intrinsic: 1.2.2 - is-regex: 1.1.4 - dev: true + safe-buffer@5.2.1: {} - /safe-regex@2.1.1: - resolution: {integrity: sha512-rx+x8AMzKb5Q5lQ95Zoi6ZbJqwCLkqi3XuJXp5P3rT8OEc6sZCJG5AE5dU3lsgRr/F4Bs31jSlVN+j5KrsGu9A==} + safe-regex@2.1.1: dependencies: regexp-tree: 0.1.27 - dev: true - - /safer-buffer@2.1.2: - resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} - dev: true - /semver@7.5.4: - resolution: {integrity: sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==} - engines: {node: '>=10'} - hasBin: true - dependencies: - lru-cache: 6.0.0 - dev: true + safe-stable-stringify@2.5.0: {} - /serialize-javascript@6.0.0: - resolution: {integrity: sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==} - dependencies: - randombytes: 2.1.0 - dev: true + semver@7.7.1: {} - /serialize-javascript@6.0.1: - resolution: {integrity: sha512-owoXEFjWRllis8/M1Q+Cw5k8ZH40e3zhp/ovX+Xr/vi1qj6QesbyXXViFbpNvWvPNAD62SutwEXavefrLJWj7w==} + serialize-javascript@6.0.2: dependencies: randombytes: 2.1.0 - dev: true - - /set-function-length@1.1.1: - resolution: {integrity: sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==} - engines: {node: '>= 0.4'} - dependencies: - define-data-property: 1.1.1 - get-intrinsic: 1.2.2 - gopd: 1.0.1 - has-property-descriptors: 1.0.1 - dev: true - /set-function-name@2.0.1: - resolution: {integrity: sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA==} - engines: {node: '>= 0.4'} - dependencies: - define-data-property: 1.1.1 - functions-have-names: 1.2.3 - has-property-descriptors: 1.0.1 - dev: true - - /shebang-command@2.0.0: - resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} - engines: {node: '>=8'} + shebang-command@2.0.0: dependencies: shebang-regex: 3.0.0 - dev: true - /shebang-regex@3.0.0: - resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} - engines: {node: '>=8'} - dev: true + shebang-regex@3.0.0: {} - /shellwords@0.1.1: - resolution: {integrity: sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==} - dev: true + shellwords@0.1.1: {} - /side-channel@1.0.4: - resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==} + sirv@3.0.1: dependencies: - call-bind: 1.0.5 - get-intrinsic: 1.2.2 - object-inspect: 1.13.1 - dev: true + '@polka/url': 1.0.0-next.28 + mrmime: 2.0.1 + totalist: 3.0.1 - /signal-exit@3.0.7: - resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} - dev: true + sisteransi@1.0.5: {} - /sirv@2.0.3: - resolution: {integrity: sha512-O9jm9BsID1P+0HOi81VpXPoDxYP374pkOLzACAoyUQ/3OUVndNpsz6wMnY2z+yOxzbllCKZrM+9QrWsv4THnyA==} - engines: {node: '>= 10'} - dependencies: - '@polka/url': 1.0.0-next.21 - mrmime: 1.0.1 - totalist: 3.0.1 - dev: true + slash@3.0.0: {} - /slash@3.0.0: - resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} - engines: {node: '>=8'} - dev: true + smob@1.5.0: {} - /smob@1.4.1: - resolution: {integrity: sha512-9LK+E7Hv5R9u4g4C3p+jjLstaLe11MDsL21UpYaCNmapvMkYhqCV4A/f/3gyH8QjMyh6l68q9xC85vihY9ahMQ==} - dev: true + sonic-boom@4.2.0: + dependencies: + atomic-sleep: 1.0.0 - /source-map-js@1.0.2: - resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==} - engines: {node: '>=0.10.0'} + source-map-js@1.2.1: {} - /source-map-support@0.5.21: - resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==} + source-map-support@0.5.21: dependencies: buffer-from: 1.1.2 source-map: 0.6.1 - dev: true - /source-map@0.6.1: - resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} - engines: {node: '>=0.10.0'} - dev: true + source-map@0.6.1: {} - /stacktrace-parser@0.1.10: - resolution: {integrity: sha512-KJP1OCML99+8fhOHxwwzyWrlUuVX5GQ0ZpJTd1DFXhdkrvg1szxfHhawXUZ3g9TkXORQd4/WG68jMlQZ2p8wlg==} - engines: {node: '>=6'} + split2@4.2.0: {} + + stacktrace-parser@0.1.11: dependencies: type-fest: 0.7.1 - dev: true - - /string-natural-compare@3.0.1: - resolution: {integrity: sha512-n3sPwynL1nwKi3WJ6AIsClwBMa0zTi54fn2oLU6ndfTSIO05xaznjSf15PcBZU6FNWbmN5Q6cxT4V5hGvB4taw==} - dev: true - /string-width@4.2.3: - resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} - engines: {node: '>=8'} + string-width@4.2.3: dependencies: emoji-regex: 8.0.0 is-fullwidth-code-point: 3.0.0 strip-ansi: 6.0.1 - dev: true - /string.prototype.trim@1.2.8: - resolution: {integrity: sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - dev: true - - /string.prototype.trimend@1.0.7: - resolution: {integrity: sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA==} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - dev: true - - /string.prototype.trimstart@1.0.7: - resolution: {integrity: sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg==} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - dev: true - - /string_decoder@1.3.0: - resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} + string_decoder@1.3.0: dependencies: safe-buffer: 5.2.1 - dev: true - /strip-ansi@6.0.1: - resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} - engines: {node: '>=8'} + strip-ansi@6.0.1: dependencies: ansi-regex: 5.0.1 - dev: true - - /strip-bom@3.0.0: - resolution: {integrity: sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==} - engines: {node: '>=4'} - dev: true - - /strip-final-newline@2.0.0: - resolution: {integrity: sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==} - engines: {node: '>=6'} - dev: true - - /strip-final-newline@3.0.0: - resolution: {integrity: sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==} - engines: {node: '>=12'} - dev: true - /strip-json-comments@3.1.1: - resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} - engines: {node: '>=8'} - dev: true - - /super-regex@0.2.0: - resolution: {integrity: sha512-WZzIx3rC1CvbMDloLsVw0lkZVKJWbrkJ0k1ghKFmcnPrW1+jWbgTkTEWVtD9lMdmI4jZEz40+naBxl1dCUhXXw==} - engines: {node: '>=14.16'} - dependencies: - clone-regexp: 3.0.0 - function-timeout: 0.1.1 - time-span: 5.1.0 - dev: true + strip-json-comments@3.1.1: {} - /supports-color@5.5.0: - resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} - engines: {node: '>=4'} - dependencies: - has-flag: 3.0.0 - dev: true - - /supports-color@7.2.0: - resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} - engines: {node: '>=8'} + supports-color@7.2.0: dependencies: has-flag: 4.0.0 - dev: true - /supports-color@8.1.1: - resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==} - engines: {node: '>=10'} + supports-color@8.1.1: dependencies: has-flag: 4.0.0 - dev: true - - /supports-preserve-symlinks-flag@1.0.0: - resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} - engines: {node: '>= 0.4'} - dev: true - - /svelte-hmr@0.15.3(svelte@4.2.8): - resolution: {integrity: sha512-41snaPswvSf8TJUhlkoJBekRrABDXDMdpNpT2tfHIv4JuhgvHqLMhEPGtaQn0BmbNSTkuz2Ed20DF2eHw0SmBQ==} - engines: {node: ^12.20 || ^14.13.1 || >= 16} - peerDependencies: - svelte: ^3.19.0 || ^4.0.0 - dependencies: - svelte: 4.2.8 - dev: true - /svelte@4.2.8: - resolution: {integrity: sha512-hU6dh1MPl8gh6klQZwK/n73GiAHiR95IkFsesLPbMeEZi36ydaXL/ZAb4g9sayT0MXzpxyZjR28yderJHxcmYA==} - engines: {node: '>=16'} - dependencies: - '@ampproject/remapping': 2.2.1 - '@jridgewell/sourcemap-codec': 1.4.15 - '@jridgewell/trace-mapping': 0.3.20 - acorn: 8.11.2 - aria-query: 5.3.0 - axobject-query: 3.2.1 - code-red: 1.0.4 - css-tree: 2.3.1 - estree-walker: 3.0.3 - is-reference: 3.0.2 + supports-preserve-symlinks-flag@1.0.0: {} + + svelte@5.20.4: + dependencies: + '@ampproject/remapping': 2.3.0 + '@jridgewell/sourcemap-codec': 1.5.0 + '@types/estree': 1.0.7 + acorn: 8.14.0 + acorn-typescript: 1.4.13(acorn@8.14.0) + aria-query: 5.3.2 + axobject-query: 4.1.0 + clsx: 2.1.1 + esm-env: 1.2.2 + esrap: 1.4.5 + is-reference: 3.0.3 locate-character: 3.0.0 - magic-string: 0.30.5 - periscopic: 3.1.0 + magic-string: 0.30.17 + zimmerframe: 1.1.2 - /terser@5.25.0: - resolution: {integrity: sha512-we0I9SIsfvNUMP77zC9HG+MylwYYsGFSBG8qm+13oud2Yh+O104y614FRbyjpxys16jZwot72Fpi827YvGzuqg==} - engines: {node: '>=10'} - hasBin: true + terser@5.39.0: dependencies: - '@jridgewell/source-map': 0.3.5 - acorn: 8.11.2 + '@jridgewell/source-map': 0.3.6 + acorn: 8.14.0 commander: 2.20.3 source-map-support: 0.5.21 - dev: true - - /text-table@0.2.0: - resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} - dev: true - /through@2.3.8: - resolution: {integrity: sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==} - dev: true - - /time-span@5.1.0: - resolution: {integrity: sha512-75voc/9G4rDIJleOo4jPvN4/YC4GRZrY8yy1uU4lwrB3XEQbWve8zXoO5No4eFrGcTAMYyoY67p8jRQdtA1HbA==} - engines: {node: '>=12'} + thread-stream@3.1.0: dependencies: - convert-hrtime: 5.0.0 - dev: true + real-require: 0.2.0 - /tmp@0.0.33: - resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==} - engines: {node: '>=0.6.0'} - dependencies: - os-tmpdir: 1.0.2 - dev: true + tinyexec@0.3.2: {} - /to-fast-properties@2.0.0: - resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==} - engines: {node: '>=4'} - dev: true + tinyglobby@0.2.12: + dependencies: + fdir: 6.4.3(picomatch@4.0.2) + picomatch: 4.0.2 - /to-regex-range@5.0.1: - resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} - engines: {node: '>=8.0'} + to-regex-range@5.0.1: dependencies: is-number: 7.0.0 - dev: true - - /totalist@3.0.1: - resolution: {integrity: sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==} - engines: {node: '>=6'} - dev: true - /tr46@0.0.3: - resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} - dev: true - - /trough@1.0.5: - resolution: {integrity: sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA==} - dev: true - - /ts-api-utils@1.0.3(typescript@5.3.3): - resolution: {integrity: sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==} - engines: {node: '>=16.13.0'} - peerDependencies: - typescript: '>=4.2.0' - dependencies: - typescript: 5.3.3 - dev: true + totalist@3.0.1: {} - /tsconfig-paths@3.15.0: - resolution: {integrity: sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==} - dependencies: - '@types/json5': 0.0.29 - json5: 1.0.2 - minimist: 1.2.8 - strip-bom: 3.0.0 - dev: true + tr46@0.0.3: {} - /tslib@2.6.0: - resolution: {integrity: sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA==} - dev: true + trough@1.0.5: {} - /type-check@0.4.0: - resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} - engines: {node: '>= 0.8.0'} + ts-api-utils@2.0.1(typescript@5.8.3): dependencies: - prelude-ls: 1.2.1 - dev: true - - /type-fest@0.20.2: - resolution: {integrity: sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==} - engines: {node: '>=10'} - dev: true + typescript: 5.8.3 - /type-fest@0.21.3: - resolution: {integrity: sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==} - engines: {node: '>=10'} - dev: true - - /type-fest@0.7.1: - resolution: {integrity: sha512-Ne2YiiGN8bmrmJJEuTWTLJR32nh/JdL1+PSicowtNb0WFpn59GK8/lfD61bVtzguz7b3PBt74nxpv/Pw5po5Rg==} - engines: {node: '>=8'} - dev: true + tslib@2.8.1: {} - /typed-array-buffer@1.0.0: - resolution: {integrity: sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw==} - engines: {node: '>= 0.4'} + tsx@4.19.2: dependencies: - call-bind: 1.0.5 - get-intrinsic: 1.2.2 - is-typed-array: 1.1.12 - dev: true + esbuild: 0.25.2 + get-tsconfig: 4.10.0 + optionalDependencies: + fsevents: 2.3.3 + optional: true - /typed-array-byte-length@1.0.0: - resolution: {integrity: sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA==} - engines: {node: '>= 0.4'} + type-check@0.4.0: dependencies: - call-bind: 1.0.5 - for-each: 0.3.3 - has-proto: 1.0.1 - is-typed-array: 1.1.12 - dev: true + prelude-ls: 1.2.1 - /typed-array-byte-offset@1.0.0: - resolution: {integrity: sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg==} - engines: {node: '>= 0.4'} - dependencies: - available-typed-arrays: 1.0.5 - call-bind: 1.0.5 - for-each: 0.3.3 - has-proto: 1.0.1 - is-typed-array: 1.1.12 - dev: true + type-fest@0.7.1: {} - /typed-array-length@1.0.4: - resolution: {integrity: sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==} + typescript-eslint@8.31.0(eslint@9.25.1(jiti@2.4.2))(typescript@5.8.3): dependencies: - call-bind: 1.0.5 - for-each: 0.3.3 - is-typed-array: 1.1.12 - dev: true - - /typescript@5.3.2: - resolution: {integrity: sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ==} - engines: {node: '>=14.17'} - hasBin: true - dev: true - - /typescript@5.3.3: - resolution: {integrity: sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==} - engines: {node: '>=14.17'} - hasBin: true - dev: true + '@typescript-eslint/eslint-plugin': 8.31.0(@typescript-eslint/parser@8.31.0(eslint@9.25.1(jiti@2.4.2))(typescript@5.8.3))(eslint@9.25.1(jiti@2.4.2))(typescript@5.8.3) + '@typescript-eslint/parser': 8.31.0(eslint@9.25.1(jiti@2.4.2))(typescript@5.8.3) + '@typescript-eslint/utils': 8.31.0(eslint@9.25.1(jiti@2.4.2))(typescript@5.8.3) + eslint: 9.25.1(jiti@2.4.2) + typescript: 5.8.3 + transitivePeerDependencies: + - supports-color - /ufo@1.3.1: - resolution: {integrity: sha512-uY/99gMLIOlJPwATcMVYfqDSxUR9//AUcgZMzwfSTJPDKzA1S8mX4VLqa+fiAtveraQUBCz4FFcwVZBGbwBXIw==} - dev: true + typescript@5.8.3: {} - /unbox-primitive@1.0.2: - resolution: {integrity: sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==} - dependencies: - call-bind: 1.0.5 - has-bigints: 1.0.2 - has-symbols: 1.0.3 - which-boxed-primitive: 1.0.2 - dev: true + ufo@1.5.4: {} - /unconfig@0.3.11: - resolution: {integrity: sha512-bV/nqePAKv71v3HdVUn6UefbsDKQWRX+bJIkiSm0+twIds6WiD2bJLWWT3i214+J/B4edufZpG2w7Y63Vbwxow==} + unconfig@7.0.0: dependencies: - '@antfu/utils': 0.7.6 - defu: 6.1.2 - jiti: 1.20.0 - mlly: 1.4.2 - dev: true + '@antfu/utils': 8.1.1 + defu: 6.1.4 + jiti: 2.4.2 - /unified@9.2.2: - resolution: {integrity: sha512-Sg7j110mtefBD+qunSLO1lqOEKdrwBFBrR6Qd8f4uwkhWNlbkaqwHse6e7QvD3AP/MNoJdEDLaf8OxYyoWgorQ==} + unified@9.2.2: dependencies: - '@types/unist': 2.0.10 + '@types/unist': 2.0.11 bail: 1.0.5 extend: 3.0.2 is-buffer: 2.0.5 is-plain-obj: 2.1.0 trough: 1.0.5 vfile: 4.2.1 - dev: true - - /unist-util-stringify-position@2.0.3: - resolution: {integrity: sha512-3faScn5I+hy9VleOq/qNbAd6pAx7iH5jYBMS9I1HgQVijz/4mv5Bvw5iw1sC/90CODiKo81G/ps8AJrISn687g==} - dependencies: - '@types/unist': 2.0.10 - dev: true - /unocss@0.58.0(postcss@8.4.32)(vite@5.0.12): - resolution: {integrity: sha512-MSPRHxBqWN+1AHGV+J5uUy4//e6ZBK6O+ISzD0qrXcCD/GNtxk1+lYjOK2ltkUiKX539+/KF91vNxzhhwEf+xA==} - engines: {node: '>=14'} - peerDependencies: - '@unocss/webpack': 0.58.0 - vite: ^2.9.0 || ^3.0.0-0 || ^4.0.0 || ^5.0.0-0 - peerDependenciesMeta: - '@unocss/webpack': - optional: true - vite: - optional: true - dependencies: - '@unocss/astro': 0.58.0(vite@5.0.12) - '@unocss/cli': 0.58.0 - '@unocss/core': 0.58.0 - '@unocss/extractor-arbitrary-variants': 0.58.0 - '@unocss/postcss': 0.58.0(postcss@8.4.32) - '@unocss/preset-attributify': 0.58.0 - '@unocss/preset-icons': 0.58.0 - '@unocss/preset-mini': 0.58.0 - '@unocss/preset-tagify': 0.58.0 - '@unocss/preset-typography': 0.58.0 - '@unocss/preset-uno': 0.58.0 - '@unocss/preset-web-fonts': 0.58.0 - '@unocss/preset-wind': 0.58.0 - '@unocss/reset': 0.58.0 - '@unocss/transformer-attributify-jsx': 0.58.0 - '@unocss/transformer-attributify-jsx-babel': 0.58.0 - '@unocss/transformer-compile-class': 0.58.0 - '@unocss/transformer-directives': 0.58.0 - '@unocss/transformer-variant-group': 0.58.0 - '@unocss/vite': 0.58.0(vite@5.0.12) - vite: 5.0.12 + unist-util-stringify-position@2.0.3: + dependencies: + '@types/unist': 2.0.11 + + unocss@66.0.0(postcss@8.5.3)(vite@6.2.6(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.2))(vue@3.5.13(typescript@5.8.3)): + dependencies: + '@unocss/astro': 66.0.0(vite@6.2.6(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.2))(vue@3.5.13(typescript@5.8.3)) + '@unocss/cli': 66.0.0 + '@unocss/core': 66.0.0 + '@unocss/postcss': 66.0.0(postcss@8.5.3) + '@unocss/preset-attributify': 66.0.0 + '@unocss/preset-icons': 66.0.0 + '@unocss/preset-mini': 66.0.0 + '@unocss/preset-tagify': 66.0.0 + '@unocss/preset-typography': 66.0.0 + '@unocss/preset-uno': 66.0.0 + '@unocss/preset-web-fonts': 66.0.0 + '@unocss/preset-wind': 66.0.0 + '@unocss/preset-wind3': 66.0.0 + '@unocss/transformer-attributify-jsx': 66.0.0 + '@unocss/transformer-compile-class': 66.0.0 + '@unocss/transformer-directives': 66.0.0 + '@unocss/transformer-variant-group': 66.0.0 + '@unocss/vite': 66.0.0(vite@6.2.6(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.2))(vue@3.5.13(typescript@5.8.3)) + optionalDependencies: + vite: 6.2.6(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.2) transitivePeerDependencies: - postcss - - rollup - supports-color - dev: true + - vue - /update-browserslist-db@1.0.13(browserslist@4.22.2): - resolution: {integrity: sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==} - hasBin: true - peerDependencies: - browserslist: '>= 4.21.0' + unplugin-utils@0.2.4: dependencies: - browserslist: 4.22.2 - escalade: 3.1.1 - picocolors: 1.0.0 - dev: true + pathe: 2.0.3 + picomatch: 4.0.2 - /uri-js@4.4.1: - resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} + uri-js@4.4.1: dependencies: punycode: 2.3.1 - dev: true - - /util-deprecate@1.0.2: - resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} - dev: true - /vfile-message@2.0.4: - resolution: {integrity: sha512-DjssxRGkMvifUOJre00juHoP9DPWuzjxKuMDrhNbk2TdaYYBNMStsNhEOt3idrtI12VQYM/1+iM0KOzXi4pxwQ==} + vfile-message@2.0.4: dependencies: - '@types/unist': 2.0.10 + '@types/unist': 2.0.11 unist-util-stringify-position: 2.0.3 - dev: true - /vfile@4.2.1: - resolution: {integrity: sha512-O6AE4OskCG5S1emQ/4gl8zK586RqA3srz3nfK/Viy0UPToBc5Trp9BVFb1u0CjsKrAWwnpr4ifM/KBXPWwJbCA==} + vfile@4.2.1: dependencies: - '@types/unist': 2.0.10 + '@types/unist': 2.0.11 is-buffer: 2.0.5 unist-util-stringify-position: 2.0.3 vfile-message: 2.0.4 - dev: true - /vite@5.0.12: - resolution: {integrity: sha512-4hsnEkG3q0N4Tzf1+t6NdN9dg/L3BM+q8SWgbSPnJvrgH2kgdyzfVJwbR1ic69/4uMJJ/3dqDZZE5/WwqW8U1w==} - engines: {node: ^18.0.0 || >=20.0.0} - hasBin: true - peerDependencies: - '@types/node': ^18.0.0 || >=20.0.0 - less: '*' - lightningcss: ^1.21.0 - sass: '*' - stylus: '*' - sugarss: '*' - terser: ^5.4.0 - peerDependenciesMeta: - '@types/node': - optional: true - less: - optional: true - lightningcss: - optional: true - sass: - optional: true - stylus: - optional: true - sugarss: - optional: true - terser: - optional: true + vite@6.2.6(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.2): dependencies: - esbuild: 0.19.8 - postcss: 8.4.32 - rollup: 4.6.1 + esbuild: 0.25.2 + postcss: 8.5.3 + rollup: 4.40.1 optionalDependencies: fsevents: 2.3.3 - dev: true + jiti: 2.4.2 + terser: 5.39.0 + tsx: 4.19.2 - /vitefu@0.2.5(vite@5.0.12): - resolution: {integrity: sha512-SgHtMLoqaeeGnd2evZ849ZbACbnwQCIwRH57t18FxcXoZop0uQu0uzlIhJBlF/eWVzuce0sHeqPcDo+evVcg8Q==} - peerDependencies: - vite: ^3.0.0 || ^4.0.0 || ^5.0.0 - peerDependenciesMeta: - vite: - optional: true + vitefu@1.0.6(vite@6.2.6(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.2)): + optionalDependencies: + vite: 6.2.6(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.2) + + vue-flow-layout@0.1.1(vue@3.5.13(typescript@5.8.3)): dependencies: - vite: 5.0.12 - dev: true + vue: 3.5.13(typescript@5.8.3) - /wcwidth@1.0.1: - resolution: {integrity: sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==} + vue@3.5.13(typescript@5.8.3): dependencies: - defaults: 1.0.4 - dev: true + '@vue/compiler-dom': 3.5.13 + '@vue/compiler-sfc': 3.5.13 + '@vue/runtime-dom': 3.5.13 + '@vue/server-renderer': 3.5.13(vue@3.5.13(typescript@5.8.3)) + '@vue/shared': 3.5.13 + optionalDependencies: + typescript: 5.8.3 - /webidl-conversions@3.0.1: - resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} - dev: true + webidl-conversions@3.0.1: {} - /whatwg-url@5.0.0: - resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} + whatwg-url@5.0.0: dependencies: tr46: 0.0.3 webidl-conversions: 3.0.1 - dev: true - - /which-boxed-primitive@1.0.2: - resolution: {integrity: sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==} - dependencies: - is-bigint: 1.0.4 - is-boolean-object: 1.1.2 - is-number-object: 1.0.7 - is-string: 1.0.7 - is-symbol: 1.0.4 - dev: true - - /which-typed-array@1.1.13: - resolution: {integrity: sha512-P5Nra0qjSncduVPEAr7xhoF5guty49ArDTwzJ/yNuPIbZppyRxFQsRCWrocxIY+CnMVG+qfbU2FmDKyvSGClow==} - engines: {node: '>= 0.4'} - dependencies: - available-typed-arrays: 1.0.5 - call-bind: 1.0.5 - for-each: 0.3.3 - gopd: 1.0.1 - has-tostringtag: 1.0.0 - dev: true - /which@2.0.2: - resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} - engines: {node: '>= 8'} - hasBin: true + which@2.0.2: dependencies: isexe: 2.0.0 - dev: true - /workerpool@6.2.1: - resolution: {integrity: sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==} - dev: true + word-wrap@1.2.5: {} - /wrap-ansi@6.2.0: - resolution: {integrity: sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==} - engines: {node: '>=8'} - dependencies: - ansi-styles: 4.3.0 - string-width: 4.2.3 - strip-ansi: 6.0.1 - dev: true + workerpool@6.5.1: {} - /wrap-ansi@7.0.0: - resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} - engines: {node: '>=10'} + wrap-ansi@7.0.0: dependencies: ansi-styles: 4.3.0 string-width: 4.2.3 strip-ansi: 6.0.1 - dev: true - - /wrappy@1.0.2: - resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} - dev: true - /y18n@5.0.8: - resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} - engines: {node: '>=10'} - dev: true + wrappy@1.0.2: {} - /yallist@3.1.1: - resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} - dev: true + y18n@5.0.8: {} - /yallist@4.0.0: - resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} - dev: true - - /yargs-parser@20.2.4: - resolution: {integrity: sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==} - engines: {node: '>=10'} - dev: true + yargs-parser@20.2.9: {} - /yargs-parser@21.1.1: - resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} - engines: {node: '>=12'} - dev: true + yargs-parser@21.1.1: {} - /yargs-unparser@2.0.0: - resolution: {integrity: sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==} - engines: {node: '>=10'} + yargs-unparser@2.0.0: dependencies: camelcase: 6.3.0 decamelize: 4.0.0 flat: 5.0.2 is-plain-obj: 2.1.0 - dev: true - /yargs@16.2.0: - resolution: {integrity: sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==} - engines: {node: '>=10'} + yargs@16.2.0: dependencies: cliui: 7.0.4 - escalade: 3.1.1 + escalade: 3.2.0 get-caller-file: 2.0.5 require-directory: 2.1.1 string-width: 4.2.3 y18n: 5.0.8 - yargs-parser: 20.2.4 - dev: true + yargs-parser: 20.2.9 - /yargs@17.7.2: - resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==} - engines: {node: '>=12'} + yargs@17.7.2: dependencies: cliui: 8.0.1 - escalade: 3.1.1 + escalade: 3.2.0 get-caller-file: 2.0.5 require-directory: 2.1.1 string-width: 4.2.3 y18n: 5.0.8 yargs-parser: 21.1.1 - dev: true - /yocto-queue@0.1.0: - resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} - engines: {node: '>=10'} - dev: true + yocto-queue@0.1.0: {} - /zod-validation-error@1.5.0(zod@3.22.4): - resolution: {integrity: sha512-/7eFkAI4qV0tcxMBB/3+d2c1P6jzzZYdYSlBuAklzMuCrJu5bzJfHS0yVAS87dRHVlhftd6RFJDIvv03JgkSbw==} - engines: {node: '>=16.0.0'} - peerDependencies: - zod: ^3.18.0 + zimmerframe@1.1.2: {} + + zod-validation-error@1.5.0(zod@3.24.2): dependencies: - zod: 3.22.4 - dev: true + zod: 3.24.2 - /zod@3.22.4: - resolution: {integrity: sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg==} - dev: true + zod@3.24.2: {} - /zwitch@1.0.5: - resolution: {integrity: sha512-V50KMwwzqJV0NpZIZFwfOD5/lyny3WlSzRiXgA0G7VUnRlqttta1L6UQIHzd6EuBY/cHGfwTIck7w1yH6Q5zUw==} - dev: true + zwitch@1.0.5: {} diff --git a/renovate.json b/renovate.json index 43f4e81a..f0c3d6ea 100644 --- a/renovate.json +++ b/renovate.json @@ -1,7 +1,8 @@ { - "extends": ["config:base"], + "extends": ["config:recommended"], + "baseBranches": ["v2", "v1"], "enabledManagers": ["cargo", "npm"], - "semanticCommitType": "chore", + "labels": ["dependencies"], "ignorePaths": [ "**/node_modules/**", "**/bower_components/**", @@ -9,9 +10,15 @@ "**/__tests__/**", "**/test/**", "**/tests/**", - "**/__fixtures__/**" + "**/__fixtures__/**", + "shared/**" ], + "rangeStrategy": "replace", "packageRules": [ + { + "semanticCommitType": "chore", + "matchPackageNames": ["*"] + }, { "description": "Disable node/pnpm version updates", "matchPackageNames": ["node", "pnpm"], diff --git a/shared/rollup.config.js b/shared/rollup.config.js index c44e7fd1..3afb1b89 100644 --- a/shared/rollup.config.js +++ b/shared/rollup.config.js @@ -2,12 +2,12 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { readFileSync } from "fs"; -import { join } from "path"; -import { cwd } from "process"; -import { nodeResolve } from "@rollup/plugin-node-resolve"; -import typescript from "@rollup/plugin-typescript"; -import terser from "@rollup/plugin-terser"; +import { readFileSync } from 'node:fs' +import { dirname, join } from 'node:path' +import { cwd } from 'node:process' +import { nodeResolve } from '@rollup/plugin-node-resolve' +import typescript from '@rollup/plugin-typescript' +import terser from '@rollup/plugin-terser' /** * Create a base rollup config @@ -21,18 +21,21 @@ import terser from "@rollup/plugin-terser"; */ export function createConfig(options = {}) { const { - input = "guest-js/index.ts", + input = 'guest-js/index.ts', external = [/^@tauri-apps\/api/], - additionalConfigs = [], - } = options; + additionalConfigs = [] + } = options // eslint-disable-next-line security/detect-non-literal-fs-filename - const pkg = JSON.parse(readFileSync(join(cwd(), "package.json"), "utf8")); + const pkg = JSON.parse(readFileSync(join(cwd(), 'package.json'), 'utf8')) const pluginJsName = pkg.name - .replace("@tauri-apps/plugin-", "") - .replace(/-./g, (x) => x[1].toUpperCase()); - const iifeVarName = `__TAURI_PLUGIN_${pluginJsName.toUpperCase()}__`; + .replace('@tauri-apps/plugin-', '') + .replace(/-./g, (x) => x[1].toUpperCase()) + const iifeVarName = `__TAURI_PLUGIN_${pkg.name + .replace('@tauri-apps/plugin-', '') + .replace('-', (x) => '_') + .toUpperCase()}__` return [ { @@ -40,50 +43,50 @@ export function createConfig(options = {}) { output: [ { file: pkg.exports.import, - format: "esm", + format: 'esm' }, { file: pkg.exports.require, - format: "cjs", - }, + format: 'cjs' + } ], plugins: [ typescript({ declaration: true, - declarationDir: `./${pkg.exports.import.split("/")[0]}`, - }), + declarationDir: dirname(pkg.exports.import) + }) ], external: [ ...external, ...Object.keys(pkg.dependencies || {}), - ...Object.keys(pkg.peerDependencies || {}), + ...Object.keys(pkg.peerDependencies || {}) ], onwarn: (warning) => { - throw Object.assign(new Error(), warning); - }, + throw Object.assign(new Error(), warning) + } }, { input, output: { - format: "iife", + format: 'iife', name: iifeVarName, // IIFE is in the format `var ${iifeVarName} = (() => {})()` // we check if __TAURI__ exists and inject the API object banner: "if ('__TAURI__' in window) {", // the last `}` closes the if in the banner footer: `Object.defineProperty(window.__TAURI__, '${pluginJsName}', { value: ${iifeVarName} }) }`, - file: "src/api-iife.js", + file: 'api-iife.js' }, // and var is not guaranteed to assign to the global `window` object so we make sure to assign it plugins: [typescript(), terser(), nodeResolve()], onwarn: (warning) => { - throw Object.assign(new Error(), warning); - }, + throw Object.assign(new Error(), warning) + } }, ...(Array.isArray(additionalConfigs) ? additionalConfigs - : [additionalConfigs]), - ]; + : [additionalConfigs]) + ] } diff --git a/shared/template/.gitignore b/shared/template/.gitignore deleted file mode 100644 index 1b0b469d..00000000 --- a/shared/template/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/.tauri diff --git a/shared/template/Cargo.toml b/shared/template/Cargo.toml index be8472bc..a672132d 100644 --- a/shared/template/Cargo.toml +++ b/shared/template/Cargo.toml @@ -1,17 +1,29 @@ [package] -name = "tauri-plugin-{{name}}" +name = "tauri-plugin-PLUGIN_NAME" version = "1.0.0" edition = { workspace = true } authors = { workspace = true } license = { workspace = true } -links = "tauri-plugin-{{name}}" +repository = { workspace = true } +links = "tauri-plugin-PLUGIN_NAME" [package.metadata.docs.rs] -rustc-args = [ "--cfg", "docsrs" ] -rustdoc-args = [ "--cfg", "docsrs" ] +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs"] + +# Platforms supported by the plugin +# Support levels are "full", "partial", "none", "unknown" +# Details of the support level are left to plugin maintainer +[package.metadata.platforms] +windows = { level = "unknown", notes = "" } +linux = { level = "unknown", notes = "" } +macos = { level = "unknown", notes = "" } +android = { level = "unknown", notes = "" } +ios = { level = "unknown", notes = "" } + [build-dependencies] -tauri-plugin = { workspace = true, features = [ "build" ] } +tauri-plugin = { workspace = true, features = ["build"] } # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/shared/template/README.md b/shared/template/README.md index 920f5f8c..5d153499 100644 --- a/shared/template/README.md +++ b/shared/template/README.md @@ -1,10 +1,18 @@ -![{{plugin-name}}](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/{{plugin-name}}/banner.png) +![PLUGIN_NAME](https://github.com/tauri-apps/plugins-workspace/raw/v2/plugins/PLUGIN_NAME/banner.png) +| Platform | Supported | +| -------- | --------- | +| Linux | ✓ | +| Windows | ✓ | +| macOS | ✓ | +| Android | ✓ | +| iOS | ✓ | + ## Install -_This plugin requires a Rust version of at least **1.75**_ +_This plugin requires a Rust version of at least **1.77.2**_ There are three general methods of installation that we can recommend. @@ -18,9 +26,9 @@ Install the Core plugin by adding the following to your `Cargo.toml` file: ```toml [dependencies] -tauri-plugin-{{plugin-name}} = "2.0.0-beta" +tauri-plugin-PLUGIN_NAME = "2.0.0" # alternatively with Git: -tauri-plugin-{{plugin-name}} = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } +tauri-plugin-PLUGIN_NAME = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } ``` You can install the JavaScript Guest bindings using your preferred JavaScript package manager: @@ -30,30 +38,30 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa ```sh -pnpm add @tauri-apps/plugin-{{plugin-name}} +pnpm add @tauri-apps/plugin-PLUGIN_NAME # or -npm add @tauri-apps/plugin-{{plugin-name}} +npm add @tauri-apps/plugin-PLUGIN_NAME # or -yarn add @tauri-apps/plugin-{{plugin-name}} +yarn add @tauri-apps/plugin-PLUGIN_NAME # alternatively with Git: -pnpm add https://github.com/tauri-apps/tauri-plugin-{{plugin-name}}#v2 +pnpm add https://github.com/tauri-apps/tauri-plugin-PLUGIN_NAME#v2 # or -npm add https://github.com/tauri-apps/tauri-plugin-{{plugin-name}}#v2 +npm add https://github.com/tauri-apps/tauri-plugin-PLUGIN_NAME#v2 # or -yarn add https://github.com/tauri-apps/tauri-plugin-{{plugin-name}}#v2 +yarn add https://github.com/tauri-apps/tauri-plugin-PLUGIN_NAME#v2 ``` ## Usage First you need to register the core plugin with Tauri: -`src-tauri/src/main.rs` +`src-tauri/src/lib.rs` ```rust fn main() { tauri::Builder::default() - .plugin(tauri_plugin_{{plugin-name}}::init()) + .plugin(tauri_plugin_PLUGIN_NAME::init()) .run(tauri::generate_context!()) .expect("error while running tauri application"); } diff --git a/shared/template/SECURITY.md b/shared/template/SECURITY.md new file mode 100644 index 00000000..4f09bbac --- /dev/null +++ b/shared/template/SECURITY.md @@ -0,0 +1,23 @@ +# Security Policy + +**Do not report security vulnerabilities through public GitHub issues.** + +**Please use the [Private Vulnerability Disclosure](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability) feature of GitHub.** + +Include as much of the following information: + +- Type of issue (e.g. improper input parsing, privilege escalation, etc.) +- The location of the affected source code (tag/branch/commit or direct URL) +- Any special configuration required to reproduce the issue +- The distribution affected or used to help us with reproduction of the issue +- Step-by-step instructions to reproduce the issue +- Ideally a reproduction repository +- Impact of the issue, including how an attacker might exploit the issue + +We prefer to receive reports in English. + +## Contact + +Please disclose a vulnerability or security relevant issue here: [https://github.com/tauri-apps/plugins-workspace/security/advisories/new](https://github.com/tauri-apps/plugins-workspace/security/advisories/new). + +Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app). diff --git a/shared/template/android/build.gradle.kts b/shared/template/android/build.gradle.kts index 804384c3..1d0e9d8e 100644 --- a/shared/template/android/build.gradle.kts +++ b/shared/template/android/build.gradle.kts @@ -5,11 +5,10 @@ plugins { android { namespace = "{{android_package_id}}" - compileSdk = 32 + compileSdk = 34 defaultConfig { - minSdk = 24 - targetSdk = 32 + minSdk = 24 testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles("consumer-rules.pro") diff --git a/shared/template/build.rs b/shared/template/build.rs index 121f3b74..16a1438a 100644 --- a/shared/template/build.rs +++ b/shared/template/build.rs @@ -5,15 +5,14 @@ const COMMANDS: &[&str] = &["execute"]; fn main() { - if let Err(error) = tauri_plugin::Builder::new(COMMANDS) + let result = tauri_plugin::Builder::new(COMMANDS) + .global_api_script_path("./api-iife.js") .android_path("android") .ios_path("ios") - .run() - { - println!("{error:#}"); - // when building documentation for Android the plugin build result is irrelevant to the crate itself - if !(cfg!(docsrs) && std::env::var("TARGET").unwrap().contains("android")) { - std::process::exit(1); - } + .try_build(); + + // when building documentation for Android the plugin build result is always Err() and is irrelevant to the crate documentation build + if !(cfg!(docsrs) && std::env::var("TARGET").unwrap().contains("android")) { + result.unwrap(); } } diff --git a/shared/template/ios/Package.swift b/shared/template/ios/Package.swift index e4f53f0b..e4ebd067 100644 --- a/shared/template/ios/Package.swift +++ b/shared/template/ios/Package.swift @@ -6,28 +6,29 @@ import PackageDescription let package = Package( - name: "tauri-plugin-{{ plugin_name }}", - platforms: [ - .iOS(.v13), - ], - products: [ - // Products define the executables and libraries a package produces, and make them visible to other packages. - .library( - name: "tauri-plugin-{{ plugin_name }}", - type: .static, - targets: ["tauri-plugin-{{ plugin_name }}"]), - ], - dependencies: [ - .package(name: "Tauri", path: "../.tauri/tauri-api") - ], - targets: [ - // Targets are the basic building blocks of a package. A target can define a module or a test suite. - // Targets can depend on other targets in this package, and on products in packages this package depends on. - .target( - name: "tauri-plugin-{{ plugin_name }}", - dependencies: [ - .byName(name: "Tauri") - ], - path: "Sources") - ] + name: "tauri-plugin-{{ plugin_name }}", + platforms: [ + .macOS(.v10_13), + .iOS(.v13), + ], + products: [ + // Products define the executables and libraries a package produces, and make them visible to other packages. + .library( + name: "tauri-plugin-{{ plugin_name }}", + type: .static, + targets: ["tauri-plugin-{{ plugin_name }}"]) + ], + dependencies: [ + .package(name: "Tauri", path: "../.tauri/tauri-api") + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages this package depends on. + .target( + name: "tauri-plugin-{{ plugin_name }}", + dependencies: [ + .byName(name: "Tauri") + ], + path: "Sources") + ] ) diff --git a/shared/template/ios/Sources/ExamplePlugin.swift b/shared/template/ios/Sources/ExamplePlugin.swift index 36c3a8f7..2a1055de 100644 --- a/shared/template/ios/Sources/ExamplePlugin.swift +++ b/shared/template/ios/Sources/ExamplePlugin.swift @@ -8,7 +8,7 @@ import UIKit import WebKit class PingArgs: Decodable { - let value: String? + var value: String? } class ExamplePlugin: Plugin { diff --git a/shared/template/package.json b/shared/template/package.json index 60cf5e26..75ce480a 100644 --- a/shared/template/package.json +++ b/shared/template/package.json @@ -1,10 +1,11 @@ { - "name": "@tauri-apps/plugin-{{name}}", + "name": "@tauri-apps/plugin-PLUGIN_NAME", "version": "1.0.0", - "license": "MIT or APACHE-2.0", + "license": "MIT OR Apache-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" ], + "repository": "https://github.com/tauri-apps/plugins-workspace", "type": "module", "types": "./dist-js/index.d.ts", "main": "./dist-js/index.cjs", @@ -23,6 +24,6 @@ "LICENSE" ], "dependencies": { - "@tauri-apps/api": "2.0.0-beta.2" + "@tauri-apps/api": "^2.0.0" } } diff --git a/shared/template/rollup.config.js b/shared/template/rollup.config.js index 977dfac8..1f349ec8 100644 --- a/shared/template/rollup.config.js +++ b/shared/template/rollup.config.js @@ -2,6 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import { createConfig } from "../../shared/rollup.config.js"; +import { createConfig } from '../../shared/rollup.config.js' -export default createConfig(); +export default createConfig() diff --git a/shared/template/src/lib.rs b/shared/template/src/lib.rs index 3e0f7618..5eb337bd 100644 --- a/shared/template/src/lib.rs +++ b/shared/template/src/lib.rs @@ -21,11 +21,11 @@ mod models; pub use error::{Error, Result}; #[cfg(desktop)] -use desktop::{{ plugin_name_pascal_case }}; +pub use desktop::{{ plugin_name_pascal_case }}; #[cfg(mobile)] -use mobile::{{ plugin_name_pascal_case }}; +pub use mobile::{{ plugin_name_pascal_case }}; -/// Extensions to [`tauri::App`], [`tauri::AppHandle`] and [`tauri::Window`] to access the {{ plugin_name }} APIs. +/// Extensions to [`tauri::App`], [`tauri::AppHandle`], [`tauri::WebviewWindow`], [`tauri::Webview`] and [`tauri::Window`] to access the {{ plugin_name }} APIs. pub trait {{ plugin_name_pascal_case }}Ext { fn {{ plugin_name_snake_case }}(&self) -> &{{ plugin_name_pascal_case }}; } @@ -39,7 +39,6 @@ impl> crate::{{ plugin_name_pascal_case }}Ext for T /// Initializes the plugin. pub fn init() -> TauriPlugin { Builder::new("{{ plugin_name }}") - .js_init_script(include_str!("api-iife.js").to_string()) .invoke_handler(tauri::generate_handler![commands::execute]) .setup(|app, api| { #[cfg(mobile)] diff --git a/taplo.toml b/taplo.toml new file mode 100644 index 00000000..e628d268 --- /dev/null +++ b/taplo.toml @@ -0,0 +1 @@ +exclude = ["plugins/*/permissions/autogenerated/**.toml"]

+

Welcome to Tauri!

+ +
+ +

Click on the Tauri logo to learn more about the framework

+ + + +

+