Compare commits

..

13 Commits

Author SHA1 Message Date
Lucas Nogueira
53a34a83bc chore: trigger release 2023-05-03 12:23:56 -03:00
Lucas Nogueira
961cec9c47 chore: remove println 2023-05-02 10:03:48 -03:00
Lucas Nogueira
2227abb34b fix(core): IPC remote domain check bypassed by isolation iframe usage (#6691) 2023-05-02 10:01:57 -03:00
Lucas Nogueira
9c0593c33a feat(core): block remote URLs from accessing the IPC
This was cherry picked from ee71c31fd0, keeping only the logic to block remote URLs from using the IPC.
PR: #5918
2023-04-12 11:56:29 -03:00
Lucas Nogueira
ca45fdb013 update publish-cli-js.yml 2023-01-18 22:39:06 -03:00
Lucas Nogueira
309aad7bbf fix(ci): dispatcher for cli.js/cli.rs publish workflow 2023-01-18 22:05:46 -03:00
Lucas Nogueira
318802e700 chore(ci): remove package filter 2023-01-18 21:45:06 -03:00
Lucas Nogueira
19019e4eb6 fix(cli/node): add json5 resolution, fix audit ci (#5991) 2023-01-18 21:33:34 -03:00
Lucas Nogueira
a6910c84b6 chore: run covector version 2023-01-18 21:29:40 -03:00
Lucas Nogueira
adcb082b16 chore(deps): pin ignore to =0.4.18 2023-01-18 21:29:00 -03:00
Lucas Nogueira
f9710402a8 run covector version 2022-12-22 10:57:18 -03:00
Amr Bashir
f1b0ad6e8b Merge pull request from GHSA-6mv3-wm7j-h4w5
* fix(core): use `require_literal_separator` when matching paths

* document the need for `require_literal_separator`

* use `require_literal_leading_dot`
2022-12-22 10:56:35 -03:00
Lucas Nogueira
3cb7666a6a prepare CI for hotfix publishes 2022-12-22 10:56:21 -03:00
482 changed files with 6188 additions and 14887 deletions

View File

@@ -1,2 +0,0 @@
[env]
__TAURI_WORKSPACE__ = "true"

View File

@@ -56,7 +56,6 @@
}
],
"postpublish": [
"git tag ${ pkg.pkg }-v${ pkgFile.versionMajor } -f",
"git tag ${ pkg.pkg }-v${ pkgFile.versionMajor }.${ pkgFile.versionMinor } -f",
"git push --tags -f"
],
@@ -116,7 +115,6 @@
}
],
"postpublish": [
"git tag ${ pkg.pkg }-v${ pkgFile.versionMajor } -f",
"git tag ${ pkg.pkg }-v${ pkgFile.versionMajor }.${ pkgFile.versionMinor } -f",
"git push --tags -f"
]
@@ -211,7 +209,7 @@
"dependencies": ["tauri-codegen", "tauri-utils"],
"postversion": [
"node ../../.scripts/covector/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }",
"cargo build --manifest-path ../tauri-config-schema/Cargo.toml"
"cargo build --manifest-path ../config-schema/Cargo.toml"
],
"assets": [
{
@@ -238,7 +236,7 @@
"dependencies": ["cli.rs"],
"postversion": [
"node ../../../.scripts/covector/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }",
"cargo build --manifest-path ../../../core/tauri-config-schema/Cargo.toml"
"cargo build --manifest-path ../../../core/config-schema/Cargo.toml"
],
"prepublish": [],
"publish": [],
@@ -250,7 +248,7 @@
"dependencies": ["tauri-bundler", "tauri-utils"],
"postversion": [
"cargo check",
"cargo build --manifest-path ../../core/tauri-config-schema/Cargo.toml"
"cargo build --manifest-path ../../core/config-schema/Cargo.toml"
],
"assets": [
{

6
.github/FUNDING.yml vendored
View File

@@ -1,10 +1,6 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
# These are supported funding model platforms
github: tauri-apps
github: nothingismagick
patreon: #
open_collective: tauri
ko_fi: # Replace with a single Ko-fi username

View File

@@ -1,7 +1,3 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: 🐞 Bug Report
title: '[bug] '
description: Report a bug
@@ -47,7 +43,6 @@ body:
attributes:
label: Platform and versions
description: "Output of `npm run tauri info` or `cargo tauri info`"
render: text
validations:
required: true
@@ -55,8 +50,8 @@ body:
id: logs
attributes:
label: Stack trace
render: text
render: shell
- type: textarea
id: context
attributes:

View File

@@ -1,7 +1,3 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
contact_links:
- name: 💬 Discord Chat
url: https://discord.com/invite/tauri

View File

@@ -1,7 +1,3 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: 💡 Feature Request
title: '[feat] '
description: Suggest an idea

3
.github/config.yml vendored
View File

@@ -1,3 +0,0 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

View File

@@ -1,4 +1,4 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

View File

@@ -1,4 +1,4 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

View File

@@ -1,7 +1,3 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: benches
on:
@@ -14,7 +10,6 @@ on:
env:
RUST_BACKTRACE: 1
CARGO_PROFILE_DEV_DEBUG: 0 # This would add unnecessary bloat to the target folder, decreasing cache efficiency.
LC_ALL: en_US.UTF-8 # This prevents strace from changing it's number format to use commas.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@@ -27,7 +22,7 @@ jobs:
matrix:
rust: [nightly]
platform:
- { target: x86_64-unknown-linux-gnu, os: ubuntu-20.04 }
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest }
runs-on: ${{ matrix.platform.os }}

View File

@@ -1,4 +1,4 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

View File

@@ -1,28 +1,18 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: Check generated files
on:
pull_request:
paths:
- '.github/workflows/check-generated-files.yml'
- 'tooling/api/src/**'
- 'core/tauri/scripts/bundle.global.js'
- 'core/tauri-utils/src/config.rs'
- 'tooling/cli/schema.json'
- 'core/tauri-config-schema/schema.json'
push:
branches:
- dev
paths:
- '.github/workflows/check-generated-files.yml'
- 'tooling/api/src/**'
- 'core/tauri/scripts/bundle.global.js'
- 'core/tauri-utils/src/config.rs'
- 'tooling/cli/schema.json'
- 'core/tauri-config-schema/schema.json'
- 'core/config-schema/schema.json'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@@ -32,44 +22,41 @@ jobs:
changes:
runs-on: ubuntu-latest
outputs:
api: ${{ steps.filter.outputs.api }}
bundle: ${{ steps.filter.outputs.bundle }}
schema: ${{ steps.filter.outputs.schema }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
api:
bundle:
- 'tooling/api/src/**'
- 'tooling/api/docs/js-api.json'
- 'core/tauri/scripts/bundle.global.js'
schema:
- 'core/tauri-utils/src/config.rs'
- 'tooling/cli/schema.json'
- 'core/tauri-config-schema/schema.json'
- 'core/config-schema/schema.json'
check-api:
check-bundle:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.api == 'true'
if: needs.changes.outputs.bundle == 'true'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- name: build api
- name: generate bundle
working-directory: tooling/api
run: yarn && yarn build
- name: check api
run: |
git restore tooling/api/docs/js-api.json
./.scripts/ci/has-diff.sh
- name: check bundle
run: ./.scripts/ci/has-diff.sh
check-schema:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.schema == 'true'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- name: install stable
uses: actions-rs/toolchain@v1
@@ -90,7 +77,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: build
args: --manifest-path ./core/tauri-config-schema/Cargo.toml
args: --manifest-path ./core/config-schema/Cargo.toml
- name: check schema
run: ./.scripts/ci/has-diff.sh

View File

@@ -1,28 +0,0 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: Check generated files
on:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
id: filter
with:
list-files: shell
filters: |
added:
- added: '**'
- name: check header license on new files
if: ${{ steps.filter.outputs.added == 'true' }}
run: node check-license-header.js ${{ steps.filter.outputs.added_files }}

View File

@@ -1,4 +1,4 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
@@ -124,7 +124,7 @@ jobs:
token: ${{ secrets.ORG_TAURI_BOT_PAT }}
repository: tauri-apps/tauri
event-type: publish-clijs
client-payload: '{"releaseId": "${{ steps.covector.outputs.cli.js-releaseId }}" }'
inputs: '{"releaseId": "${{ steps.covector.outputs.cli.js-releaseId }}" }'
- name: Trigger cli.rs publishing workflow
if: |

View File

@@ -1,7 +1,3 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: docker
on:

View File

@@ -1,4 +1,4 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

View File

@@ -1,4 +1,4 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

View File

@@ -1,4 +1,4 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

View File

@@ -1,7 +1,3 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: publish cli.js
env:
DEBUG: napi:*

View File

@@ -1,7 +1,3 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: publish cli.rs
env:
MACOSX_DEPLOYMENT_TARGET: '10.13'
@@ -12,45 +8,40 @@ on:
jobs:
build:
runs-on: ${{ matrix.config.os }}
runs-on: ${{ matrix.target.platform }}
strategy:
fail-fast: false
matrix:
config:
- os: ubuntu-18.04
rust_target: x86_64-unknown-linux-gnu
ext: ''
- os: macos-latest
rust_target: x86_64-apple-darwin
ext: ''
- os: macos-latest
rust_target: aarch64-apple-darwin
ext: ''
- os: windows-latest
rust_target: x86_64-pc-windows-msvc
ext: '.exe'
target:
- {
name: 'x86_64-unknown-linux-gnu',
platform: 'ubuntu-18.04',
ext: ''
}
- { name: 'x86_64-apple-darwin', platform: 'macos-latest', ext: '' }
- {
name: 'x86_64-pc-windows-msvc',
platform: 'windows-latest',
ext: '.exe'
}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: 'Setup Rust'
uses: dtolnay/rust-toolchain@stable
- name: install stable
uses: actions-rs/toolchain@v1
with:
targets: ${{ matrix.config.rust_target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.config.rust_target }}
toolchain: stable
- name: install Linux dependencies
if: matrix.config.os == 'ubuntu-latest'
if: matrix.target.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev
- name: Build CLI
- name: build CLI
uses: actions-rs/cargo@v1
with:
command: build
@@ -59,8 +50,8 @@ jobs:
- name: Upload CLI
uses: actions/upload-artifact@v3
with:
name: cargo-tauri-${{ matrix.config.rust_target }}${{ matrix.config.ext }}
path: tooling/cli/target/release/cargo-tauri${{ matrix.config.ext }}
name: cargo-tauri-${{ matrix.target.name }}${{ matrix.target.ext }}
path: tooling/cli/target/release/cargo-tauri${{ matrix.target.ext }}
if-no-files-found: error
upload:

69
.github/workflows/publish-hotfix.yml vendored Normal file
View File

@@ -0,0 +1,69 @@
# Copyright 2019-2021 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: version or publish
on:
push:
branches:
- '1.*'
jobs:
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@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v2
with:
node-version: 14
registry-url: 'https://registry.npmjs.org'
cache: yarn
cache-dependency-path: tooling/*/yarn.lock
- 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.NPM_TOKEN }}
CARGO_AUDIT_OPTIONS: ${{ secrets.CARGO_AUDIT_OPTIONS }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
command: 'version-or-publish'
createRelease: true
- name: Trigger cli.js publishing workflow
if: |
steps.covector.outputs.successfulPublish == 'true' &&
contains(steps.covector.outputs.packagesPublished, 'cli.rs')
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.ORG_TAURI_BOT_PAT }}
repository: tauri-apps/tauri
event-type: publish-clijs
inputs: '{"releaseId": "${{ steps.covector.outputs.cli.js-releaseId }}" }'
- name: Trigger cli.rs publishing workflow
if: |
steps.covector.outputs.successfulPublish == 'true' &&
contains(steps.covector.outputs.packagesPublished, 'cli.rs')
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.ORG_TAURI_BOT_PAT }}
repository: tauri-apps/tauri
event-type: publish-clirs

View File

@@ -1,4 +1,4 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

View File

@@ -1,4 +1,4 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

View File

@@ -1,4 +1,4 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

View File

@@ -1,4 +1,4 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
@@ -39,12 +39,12 @@ jobs:
- {
target: x86_64-unknown-linux-gnu,
os: ubuntu-latest,
toolchain: '1.60.0'
toolchain: '1.59.0'
}
- {
target: x86_64-apple-darwin,
os: macos-latest,
toolchain: '1.60.0'
toolchain: '1.59.0'
}
features:
- {

View File

@@ -1,4 +1,4 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

View File

@@ -1,6 +1,6 @@
#!/bin/sh
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

View File

@@ -9,5 +9,4 @@ dist
/tooling/cli/templates
/tooling/cli/node
/tooling/cli/schema.json
/tooling/api/docs/js-api.json
/core/tauri-config-schema/schema.json
/core/config-schema/schema.json

View File

@@ -1,7 +1,3 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
module.exports = {
singleQuote: true,
semi: false,

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env pwsh
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env sh
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env node
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
@@ -19,10 +19,10 @@ let url = null
switch (kind) {
case 'cargo':
url = `https://crates.io/api/v1/crates/${packageName}`
break
break;
case 'npm':
url = `https://registry.npmjs.org/${packageName}`
break
break;
default:
throw new Error('unexpected kind ' + kind)
}
@@ -30,7 +30,7 @@ switch (kind) {
const options = {
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
'Accept': 'application/json',
'User-Agent': 'tauri (https://github.com/tauri-apps/tauri)'
}
}
@@ -44,12 +44,10 @@ https.get(url, options, (response) => {
response.on('end', function () {
const data = JSON.parse(chunks.join(''))
if (kind === 'cargo') {
const versions = data.versions.filter((v) => v.num.startsWith(target))
const versions = data.versions.filter(v => v.num.startsWith(target))
console.log(versions.length ? versions[0].num : '0.0.0')
} else if (kind === 'npm') {
const versions = Object.keys(data.versions).filter((v) =>
v.startsWith(target)
)
const versions = Object.keys(data.versions).filter(v => v.startsWith(target))
console.log(versions[versions.length - 1] || '0.0.0')
}
})

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env node
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env pwsh
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

View File

@@ -1,9 +1,9 @@
#!/usr/bin/env sh
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
declare -a examples=("api" "sidecar" "updater" "resources" "tauri-dynamic-lib" "workspace")
declare -a examples=("api" "sidecar" "updater" "resources" "tauri-dynamic-lib")
declare -a tooling=("bench" "cli" "webdriver")
for example in "${examples[@]}"

View File

@@ -1,6 +1,6 @@
@ECHO OFF
REM Copyright 2019-2023 Tauri Programme within The Commons Conservancy
REM Copyright 2019-2022 Tauri Programme within The Commons Conservancy
REM SPDX-License-Identifier: Apache-2.0
REM SPDX-License-Identifier: MIT

View File

@@ -8,11 +8,11 @@ members = [
"core/tauri-utils",
"core/tauri-build",
"core/tauri-codegen",
"core/tauri-config-schema",
"core/config-schema",
# integration tests
"core/tests/restart",
"core/tests/app-updater",
"core/tests/app-updater"
]
exclude = [
@@ -21,8 +21,7 @@ exclude = [
"examples/updater/src-tauri",
"examples/resources/src-tauri",
"examples/sidecar/src-tauri",
"examples/web/core",
"examples/workspace",
"examples/web/core"
]
# default to small, optimized workspace release binaries

View File

@@ -13,16 +13,7 @@ If you have found a potential security threat, vulnerability or exploit in Tauri
or one of its upstream dependencies, please DONT create a pull-request, DONT
file an issue on GitHub, DONT mention it on Discord and DONT create a forum thread.
Please submit your report via the GitHub Private Vulnerability Disclosure functionality.
Find out more about the reporting process [here](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability).
Our team will triage your report and keep you informed about the progress.
We may ask questions or request further guidance on reproduction of the vulnerability in the comments of the advisory, which will be publicized.
Additionally, we may ask you to independently verify our patch, which will be available in the private advisory branch. Please do not publish your vulnerability during the process or before coordinated public disclosure from our side. We try to adhere to common standards of publication within 90-Days of disclosure.
Depending on your decision to accept or deny credit for the vulnerability, you will be publicly attributed to the vulnerability and may be mentioned in our announcements.
We will be adding contact information to this page very soon.
At the current time we do not have the financial ability to reward bounties,
but in extreme cases will at our discretion consider a reward.

View File

@@ -1,102 +0,0 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
const fs = require('fs')
const path = require('path')
const readline = require('readline')
const header = `Copyright 2019-2023 Tauri Programme within The Commons Conservancy
SPDX-License-Identifier: Apache-2.0
SPDX-License-Identifier: MIT`
const bundlerLicense = '// Copyright 2016-2019 Cargo-Bundle developers <https://github.com/burtonageo/cargo-bundle>'
const extensions = ['.rs', '.js', '.ts', '.yml']
const ignore = ['target', 'templates', 'node_modules', 'gen', 'dist', 'bundle.js', 'bundle.global.js']
async function checkFile(file) {
if (extensions.some(e => file.endsWith(e))) {
const fileStream = fs.createReadStream(file)
const rl = readline.createInterface({
input: fileStream,
crlfDelay: Infinity
})
let contents = ``
let i = 0
for await (let line of rl) {
// ignore empty lines, allow shebang and bundler license
if (line.length === 0 || line.startsWith("#!") || line === bundlerLicense) {
continue
}
// strip comment marker
if (line.startsWith('// ')) {
line = line.substring(3)
} else if (line.startsWith('# ')) {
line = line.substring(2)
}
contents += line
if (++i === 3) {
break
}
contents += '\n'
}
if (contents !== header) {
return true
}
}
return false
}
async function check(src) {
const missingHeader = []
for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
const p = path.join(src, entry.name)
if (entry.isSymbolicLink() || ignore.includes(entry.name)) {
continue
}
if (entry.isDirectory()) {
const missing = await check(p)
missingHeader.push(...missing)
} else {
const isMissing = await checkFile(p)
if (isMissing) {
missingHeader.push(p)
}
}
}
return missingHeader
}
const [_bin, _script, ...files] = process.argv
if (files.length > 0) {
async function run() {
const missing = []
for (const f of files) {
const isMissing = await checkFile(f)
if (isMissing) {
missing.push(f)
}
}
if (missing.length > 0) {
console.log(missing.join('\n'))
process.exit(1)
}
}
run()
} else {
check('.').then(missing => {
if (missing.length > 0) {
console.log(missing.join('\n'))
process.exit(1)
}
})
}

View File

@@ -0,0 +1,13 @@
[package]
name = "config-schema"
version = "0.0.0"
edition = "2021"
publish = false
[build-dependencies]
tauri-utils = { version = "1.0.0", features = [ "schema" ], path = "../tauri-utils" }
schemars = { version = "0.8", features = [ "url", "preserve_order" ] }
serde = { version = "1.0", features = [ "derive" ] }
serde_json = "1.0"
serde_with = "1.12"
url = { version = "2.3", features = [ "serde" ] }

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
@@ -17,8 +17,8 @@ pub fn main() -> Result<(), Box<dyn Error>> {
crate_dir.join("schema.json"),
crate_dir.join("../../tooling/cli/schema.json"),
] {
let mut schema_file = BufWriter::new(File::create(file)?);
write!(schema_file, "{schema_str}")?;
let mut schema_file = BufWriter::new(File::create(&file)?);
write!(schema_file, "{}", schema_str)?;
}
Ok(())

View File

@@ -105,7 +105,6 @@
"print": false,
"requestUserAttention": false,
"setAlwaysOnTop": false,
"setContentProtected": false,
"setCursorGrab": false,
"setCursorIcon": false,
"setCursorPosition": false,
@@ -146,7 +145,6 @@
"allowDowngrades": true,
"certificateThumbprint": null,
"digestAlgorithm": null,
"nsis": null,
"timestampUrl": null,
"tsp": false,
"webviewFixedRuntimePath": null,
@@ -163,7 +161,6 @@
},
"security": {
"dangerousDisableAssetCspModification": false,
"dangerousRemoteDomainIpcAccess": [],
"freezePrototype": false
},
"updater": {
@@ -171,8 +168,7 @@
"dialog": true,
"pubkey": "",
"windows": {
"installMode": "passive",
"installerArgs": []
"installMode": "passive"
}
},
"windows": []
@@ -209,7 +205,7 @@
"additionalProperties": false,
"definitions": {
"PackageConfig": {
"description": "The package configuration.\n\nSee more: https://tauri.app/v1/api/config#packageconfig",
"description": "The package configuration.",
"type": "object",
"properties": {
"productName": {
@@ -232,7 +228,7 @@
"additionalProperties": false
},
"TauriConfig": {
"description": "The Tauri configuration object.\n\nSee more: https://tauri.app/v1/api/config#tauriconfig",
"description": "The Tauri configuration object.",
"type": "object",
"properties": {
"pattern": {
@@ -285,7 +281,6 @@
"allowDowngrades": true,
"certificateThumbprint": null,
"digestAlgorithm": null,
"nsis": null,
"timestampUrl": null,
"tsp": false,
"webviewFixedRuntimePath": null,
@@ -383,7 +378,6 @@
"print": false,
"requestUserAttention": false,
"setAlwaysOnTop": false,
"setContentProtected": false,
"setCursorGrab": false,
"setCursorIcon": false,
"setCursorPosition": false,
@@ -416,7 +410,6 @@
"description": "Security configuration.",
"default": {
"dangerousDisableAssetCspModification": false,
"dangerousRemoteDomainIpcAccess": [],
"freezePrototype": false
},
"allOf": [
@@ -432,8 +425,7 @@
"dialog": true,
"pubkey": "",
"windows": {
"installMode": "passive",
"installerArgs": []
"installMode": "passive"
}
},
"allOf": [
@@ -510,7 +502,7 @@
]
},
"WindowConfig": {
"description": "The window configuration object.\n\nSee more: https://tauri.app/v1/api/config#windowconfig",
"description": "The window configuration object.",
"type": "object",
"properties": {
"label": {
@@ -649,11 +641,6 @@
"default": false,
"type": "boolean"
},
"contentProtected": {
"description": "Prevents the window contents from being captured by other apps.",
"default": false,
"type": "boolean"
},
"skipTaskbar": {
"description": "If `true`, hides the window icon from the taskbar on Windows and Linux.",
"default": false,
@@ -695,13 +682,6 @@
"string",
"null"
]
},
"additionalBrowserArgs": {
"description": "Defines additional browser arguments on Windows. By default wry passes `--disable-features=msWebOOUI,msPdfOOUI,msSmartScreenProtection` so if you use this method, you also need to disable these components by yourself if you want.",
"type": [
"string",
"null"
]
}
},
"additionalProperties": false
@@ -766,7 +746,7 @@
]
},
"CliConfig": {
"description": "describes a CLI configuration\n\nSee more: https://tauri.app/v1/api/config#cliconfig",
"description": "describes a CLI configuration",
"type": "object",
"properties": {
"description": {
@@ -1012,7 +992,7 @@
"additionalProperties": false
},
"BundleConfig": {
"description": "Configuration for tauri-bundler.\n\nSee more: https://tauri.app/v1/api/config#bundleconfig",
"description": "Configuration for tauri-bundler.",
"type": "object",
"required": [
"identifier"
@@ -1024,7 +1004,7 @@
"type": "boolean"
},
"targets": {
"description": "The bundle targets, currently supports [\"deb\", \"appimage\", \"nsis\", \"msi\", \"app\", \"dmg\", \"updater\"] or \"all\".",
"description": "The bundle targets, currently supports [\"deb\", \"appimage\", \"msi\", \"app\", \"dmg\", \"updater\"] or \"all\".",
"default": "all",
"allOf": [
{
@@ -1138,7 +1118,6 @@
"allowDowngrades": true,
"certificateThumbprint": null,
"digestAlgorithm": null,
"nsis": null,
"timestampUrl": null,
"tsp": false,
"webviewFixedRuntimePath": null,
@@ -1207,13 +1186,6 @@
"msi"
]
},
{
"description": "The NSIS bundle (.exe).",
"type": "string",
"enum": [
"nsis"
]
},
{
"description": "The macOS application bundle (.app).",
"type": "string",
@@ -1238,7 +1210,7 @@
]
},
"AppImageConfig": {
"description": "Configuration for AppImage bundles.\n\nSee more: https://tauri.app/v1/api/config#appimageconfig",
"description": "Configuration for AppImage bundles.",
"type": "object",
"properties": {
"bundleMediaFramework": {
@@ -1250,7 +1222,7 @@
"additionalProperties": false
},
"DebConfig": {
"description": "Configuration for Debian (.deb) bundles.\n\nSee more: https://tauri.app/v1/api/config#debconfig",
"description": "Configuration for Debian (.deb) bundles.",
"type": "object",
"properties": {
"depends": {
@@ -1275,7 +1247,7 @@
"additionalProperties": false
},
"MacConfig": {
"description": "Configuration for the macOS bundles.\n\nSee more: https://tauri.app/v1/api/config#macconfig",
"description": "Configuration for the macOS bundles.",
"type": "object",
"properties": {
"frameworks": {
@@ -1335,7 +1307,7 @@
"additionalProperties": false
},
"WindowsConfig": {
"description": "Windows bundler configuration.\n\nSee more: https://tauri.app/v1/api/config#windowsconfig",
"description": "Windows bundler configuration.",
"type": "object",
"properties": {
"digestAlgorithm": {
@@ -1398,17 +1370,6 @@
"type": "null"
}
]
},
"nsis": {
"description": "Configuration for the installer generated with NSIS.",
"anyOf": [
{
"$ref": "#/definitions/NsisConfig"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false
@@ -1433,7 +1394,7 @@
"additionalProperties": false
},
{
"description": "Download the bootstrapper and run it. Requires an internet connection. Results in a smaller installer size, but is not recommended on Windows 7.",
"description": "Download the bootstrapper and run it. Requires internet connection. Results in a smaller installer size, but is not recommended on Windows 7.",
"type": "object",
"required": [
"type"
@@ -1454,7 +1415,7 @@
"additionalProperties": false
},
{
"description": "Embed the bootstrapper and run it. Requires an internet connection. Increases the installer size by around 1.8MB, but offers better support on Windows 7.",
"description": "Embed the bootstrapper and run it. Requires internet connection. Increases the installer size by around 1.8MB, but offers better support on Windows 7.",
"type": "object",
"required": [
"type"
@@ -1475,7 +1436,7 @@
"additionalProperties": false
},
{
"description": "Embed the offline installer and run it. Does not require an internet connection. Increases the installer size by around 127MB.",
"description": "Embed the offline installer and run it. Does not require internet connection. Increases the installer size by around 127MB.",
"type": "object",
"required": [
"type"
@@ -1519,7 +1480,7 @@
]
},
"WixConfig": {
"description": "Configuration for the MSI bundle using WiX.\n\nSee more: https://tauri.app/v1/api/config#wixconfig",
"description": "Configuration for the MSI bundle using WiX.",
"type": "object",
"properties": {
"language": {
@@ -1644,7 +1605,7 @@
]
},
"WixLanguageConfig": {
"description": "Configuration for a target language for the WiX build.\n\nSee more: https://tauri.app/v1/api/config#wixlanguageconfig",
"description": "Configuration for a target language for the WiX build.",
"type": "object",
"properties": {
"localePath": {
@@ -1657,93 +1618,8 @@
},
"additionalProperties": false
},
"NsisConfig": {
"description": "Configuration for the Installer bundle using NSIS.",
"type": "object",
"properties": {
"license": {
"description": "The path to the license file to render on the installer.",
"type": [
"string",
"null"
]
},
"headerImage": {
"description": "The path to a bitmap file to display on the header of installers pages.\n\nThe recommended dimensions are 150px x 57px.",
"type": [
"string",
"null"
]
},
"sidebarImage": {
"description": "The path to a bitmap file for the Welcome page and the Finish page.\n\nThe recommended dimensions are 164px x 314px.",
"type": [
"string",
"null"
]
},
"installerIcon": {
"description": "The path to an icon file used as the installer icon.",
"type": [
"string",
"null"
]
},
"installMode": {
"description": "Whether the installation will be for all users or just the current user.",
"default": "currentUser",
"allOf": [
{
"$ref": "#/definitions/NSISInstallerMode"
}
]
},
"languages": {
"description": "A list of installer languages. By default the OS language is used. If the OS language is not in the list of languages, the first language will be used. To allow the user to select the language, set `display_language_selector` to `true`.\n\nSee <https://github.com/kichik/nsis/tree/9465c08046f00ccb6eda985abbdbf52c275c6c4d/Contrib/Language%20files> for the complete list of languages.",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"displayLanguageSelector": {
"description": "Whether to display a language selector dialog before the installer and uninstaller windows are rendered or not. By default the OS language is selected, with a fallback to the first language in the `languages` array.",
"default": false,
"type": "boolean"
}
},
"additionalProperties": false
},
"NSISInstallerMode": {
"description": "Install Modes for the NSIS installer.",
"oneOf": [
{
"description": "Default mode for the installer.\n\nInstall the app by default in a directory that doesn't require Administrator access.\n\nInstaller metadata will be saved under the `HKCU` registry path.",
"type": "string",
"enum": [
"currentUser"
]
},
{
"description": "Install the app by default in the `Program Files` folder directory requires Administrator access for the installation.\n\nInstaller metadata will be saved under the `HKLM` registry path.",
"type": "string",
"enum": [
"perMachine"
]
},
{
"description": "Combines both modes and allows the user to choose at install time whether to install for the current user or per machine. Note that this mode will require Administrator access even if the user wants to install it for the current user only.\n\nInstaller metadata will be saved under the `HKLM` or `HKCU` registry path based on the user's choice.",
"type": "string",
"enum": [
"both"
]
}
]
},
"AllowlistConfig": {
"description": "Allowlist configuration. The allowlist is a translation of the [Cargo allowlist features](https://docs.rs/tauri/latest/tauri/#cargo-allowlist-features).\n\n# Notes\n\n- Endpoints that don't have their own allowlist option are enabled by default. - There is only \"opt-in\", no \"opt-out\". Setting an option to `false` has no effect.\n\n# Examples\n\n- * [`\"app-all\": true`](https://tauri.app/v1/api/config/#appallowlistconfig.all) will make the [hide](https://tauri.app/v1/api/js/app#hide) endpoint be available regardless of whether `hide` is set to `false` or `true` in the allowlist.",
"description": "Allowlist configuration.",
"type": "object",
"properties": {
"all": {
@@ -1785,7 +1661,6 @@
"print": false,
"requestUserAttention": false,
"setAlwaysOnTop": false,
"setContentProtected": false,
"setCursorGrab": false,
"setCursorIcon": false,
"setCursorPosition": false,
@@ -1958,7 +1833,7 @@
"additionalProperties": false
},
"FsAllowlistConfig": {
"description": "Allowlist for the file system APIs.\n\nSee more: https://tauri.app/v1/api/config#fsallowlistconfig",
"description": "Allowlist for the file system APIs.",
"type": "object",
"properties": {
"scope": {
@@ -2058,7 +1933,7 @@
]
},
"WindowAllowlistConfig": {
"description": "Allowlist for the window APIs.\n\nSee more: https://tauri.app/v1/api/config#windowallowlistconfig",
"description": "Allowlist for the window APIs.",
"type": "object",
"properties": {
"all": {
@@ -2136,11 +2011,6 @@
"default": false,
"type": "boolean"
},
"setContentProtected": {
"description": "Allows preventing the window contents from being captured by other apps.",
"default": false,
"type": "boolean"
},
"setSize": {
"description": "Allows setting the window size.",
"default": false,
@@ -2220,7 +2090,7 @@
"additionalProperties": false
},
"ShellAllowlistConfig": {
"description": "Allowlist for the shell APIs.\n\nSee more: https://tauri.app/v1/api/config#shellallowlistconfig",
"description": "Allowlist for the shell APIs.",
"type": "object",
"properties": {
"scope": {
@@ -2341,7 +2211,7 @@
"description": "Defines the `shell > open` api scope.",
"anyOf": [
{
"description": "If the shell open API should be enabled.\n\nIf enabled, the default validation regex (`^((mailto:\\w+)|(tel:\\w+)|(https?://\\w+)).+`) is used.",
"description": "If the shell open API should be enabled.\n\nIf enabled, the default validation regex (`^https?://`) is used.",
"type": "boolean"
},
{
@@ -2351,7 +2221,7 @@
]
},
"DialogAllowlistConfig": {
"description": "Allowlist for the dialog APIs.\n\nSee more: https://tauri.app/v1/api/config#dialogallowlistconfig",
"description": "Allowlist for the dialog APIs.",
"type": "object",
"properties": {
"all": {
@@ -2388,7 +2258,7 @@
"additionalProperties": false
},
"HttpAllowlistConfig": {
"description": "Allowlist for the HTTP APIs.\n\nSee more: https://tauri.app/v1/api/config#httpallowlistconfig",
"description": "Allowlist for the HTTP APIs.",
"type": "object",
"properties": {
"scope": {
@@ -2422,7 +2292,7 @@
}
},
"NotificationAllowlistConfig": {
"description": "Allowlist for the notification APIs.\n\nSee more: https://tauri.app/v1/api/config#notificationallowlistconfig",
"description": "Allowlist for the notification APIs.",
"type": "object",
"properties": {
"all": {
@@ -2434,7 +2304,7 @@
"additionalProperties": false
},
"GlobalShortcutAllowlistConfig": {
"description": "Allowlist for the global shortcut APIs.\n\nSee more: https://tauri.app/v1/api/config#globalshortcutallowlistconfig",
"description": "Allowlist for the global shortcut APIs.",
"type": "object",
"properties": {
"all": {
@@ -2446,7 +2316,7 @@
"additionalProperties": false
},
"OsAllowlistConfig": {
"description": "Allowlist for the OS APIs.\n\nSee more: https://tauri.app/v1/api/config#osallowlistconfig",
"description": "Allowlist for the OS APIs.",
"type": "object",
"properties": {
"all": {
@@ -2458,7 +2328,7 @@
"additionalProperties": false
},
"PathAllowlistConfig": {
"description": "Allowlist for the path APIs.\n\nSee more: https://tauri.app/v1/api/config#pathallowlistconfig",
"description": "Allowlist for the path APIs.",
"type": "object",
"properties": {
"all": {
@@ -2470,7 +2340,7 @@
"additionalProperties": false
},
"ProtocolAllowlistConfig": {
"description": "Allowlist for the custom protocols.\n\nSee more: https://tauri.app/v1/api/config#protocolallowlistconfig",
"description": "Allowlist for the custom protocols.",
"type": "object",
"properties": {
"assetScope": {
@@ -2496,7 +2366,7 @@
"additionalProperties": false
},
"ProcessAllowlistConfig": {
"description": "Allowlist for the process APIs.\n\nSee more: https://tauri.app/v1/api/config#processallowlistconfig",
"description": "Allowlist for the process APIs.",
"type": "object",
"properties": {
"all": {
@@ -2523,7 +2393,7 @@
"additionalProperties": false
},
"ClipboardAllowlistConfig": {
"description": "Allowlist for the clipboard APIs.\n\nSee more: https://tauri.app/v1/api/config#clipboardallowlistconfig",
"description": "Allowlist for the clipboard APIs.",
"type": "object",
"properties": {
"all": {
@@ -2545,7 +2415,7 @@
"additionalProperties": false
},
"AppAllowlistConfig": {
"description": "Allowlist for the app APIs.\n\nSee more: https://tauri.app/v1/api/config#appallowlistconfig",
"description": "Allowlist for the app APIs.",
"type": "object",
"properties": {
"all": {
@@ -2567,7 +2437,7 @@
"additionalProperties": false
},
"SecurityConfig": {
"description": "Security configuration.\n\nSee more: https://tauri.app/v1/api/config#securityconfig",
"description": "Security configuration.",
"type": "object",
"properties": {
"csp": {
@@ -2605,14 +2475,6 @@
"$ref": "#/definitions/DisabledCspModificationKind"
}
]
},
"dangerousRemoteDomainIpcAccess": {
"description": "Allow external domains to send command to Tauri.\n\nBy default, external domains do not have access to `window.__TAURI__`, which means they cannot communicate with the commands defined in Rust. This prevents attacks where an externally loaded malicious or compromised sites could start executing commands on the user's device.\n\nThis configuration allows a set of external domains to have access to the Tauri commands. When you configure a domain to be allowed to access the IPC, all subpaths are allowed. Subdomains are not allowed.\n\n**WARNING:** Only use this option if you either have internal checks against malicious external sites or you can trust the allowed external sites. You application might be vulnerable to dangerous Tauri command related attacks otherwise.",
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/RemoteDomainAccessScope"
}
}
},
"additionalProperties": false
@@ -2665,50 +2527,8 @@
}
]
},
"RemoteDomainAccessScope": {
"description": "External command access definition.",
"type": "object",
"required": [
"domain",
"windows"
],
"properties": {
"scheme": {
"description": "The URL scheme to allow. By default, all schemas are allowed.",
"type": [
"string",
"null"
]
},
"domain": {
"description": "The domain to allow.",
"type": "string"
},
"windows": {
"description": "The list of window labels this scope applies to.",
"type": "array",
"items": {
"type": "string"
}
},
"plugins": {
"description": "The list of plugins that are allowed in this scope.",
"default": [],
"type": "array",
"items": {
"type": "string"
}
},
"enableTauriAPI": {
"description": "Enables access to the Tauri API.",
"default": false,
"type": "boolean"
}
},
"additionalProperties": false
},
"UpdaterConfig": {
"description": "The Updater configuration object.\n\nSee more: https://tauri.app/v1/api/config#updaterconfig",
"description": "The Updater configuration object.",
"type": "object",
"properties": {
"active": {
@@ -2739,8 +2559,7 @@
"windows": {
"description": "The Windows configuration for the updater.",
"default": {
"installMode": "passive",
"installerArgs": []
"installMode": "passive"
},
"allOf": [
{
@@ -2757,17 +2576,9 @@
"format": "uri"
},
"UpdaterWindowsConfig": {
"description": "The updater configuration for Windows.\n\nSee more: https://tauri.app/v1/api/config#updaterwindowsconfig",
"description": "The updater configuration for Windows.",
"type": "object",
"properties": {
"installerArgs": {
"description": "Additional arguments given to the NSIS or WiX installer.",
"default": [],
"type": "array",
"items": {
"type": "string"
}
},
"installMode": {
"description": "The installation mode for the update on Windows. Defaults to `passive`.",
"default": "passive",
@@ -2791,7 +2602,7 @@
]
},
{
"description": "The quiet mode means there's no user interaction required. Requires admin privileges if the installer does (WiX).",
"description": "The quiet mode means there's no user interaction required. Requires admin privileges if the installer does.",
"type": "string",
"enum": [
"quiet"
@@ -2807,7 +2618,7 @@
]
},
"SystemTrayConfig": {
"description": "Configuration for application system tray icon.\n\nSee more: https://tauri.app/v1/api/config#systemtrayconfig",
"description": "Configuration for application system tray icon.",
"type": "object",
"required": [
"iconPath"
@@ -2838,7 +2649,7 @@
"additionalProperties": false
},
"BuildConfig": {
"description": "The Build configuration object.\n\nSee more: https://tauri.app/v1/api/config#buildconfig",
"description": "The Build configuration object.",
"type": "object",
"properties": {
"runner": {
@@ -3001,7 +2812,7 @@
]
},
"PluginConfig": {
"description": "The plugin configs holds a HashMap mapping a plugin name to its configuration object.\n\nSee more: https://tauri.app/v1/api/config#pluginconfig",
"description": "The plugin configs holds a HashMap mapping a plugin name to its configuration object.",
"type": "object",
"additionalProperties": true
}

View File

@@ -0,0 +1 @@
fn main() {}

View File

@@ -1,18 +1,5 @@
# Changelog
## \[1.3.0]
- Bump minimum supported Rust version to 1.60.
- [5fdc616d](https://www.github.com/tauri-apps/tauri/commit/5fdc616df9bea633810dcb814ac615911d77222c) feat: Use the zbus-backed of notify-rust ([#6332](https://www.github.com/tauri-apps/tauri/pull/6332)) on 2023-03-31
- Add initial support for building `nsis` bundles on non-Windows platforms.
- [60e6f6c3](https://www.github.com/tauri-apps/tauri/commit/60e6f6c3f1605f3064b5bb177992530ff788ccf0) feat(bundler): Add support for creating NSIS bundles on unix hosts ([#5788](https://www.github.com/tauri-apps/tauri/pull/5788)) on 2023-01-19
- Add `WindowsAttributes::app_manifest` to specify the application manifest on Windows.
- [bca09f7f](https://www.github.com/tauri-apps/tauri/commit/bca09f7f5ff1c9c5a4b51da043bdd5da668a179b) feat(tauri-build): add option to specify Windows manifest, closes [#5584](https://www.github.com/tauri-apps/tauri/pull/5584) ([#5730](https://www.github.com/tauri-apps/tauri/pull/5730)) on 2022-12-14
- Added support for Cargo's workspace inheritance for package information. The cli now also detects inherited `tauri` and `tauri-build` dependencies and disables manifest rewrites accordingly.
- [cd8c074a](https://www.github.com/tauri-apps/tauri/commit/cd8c074ae6592303d3f6844a4fb6d262eae913b2) feat(cli): add support for Cargo's workspace inheritance for the package version, closes [#5070](https://www.github.com/tauri-apps/tauri/pull/5070) ([#5775](https://www.github.com/tauri-apps/tauri/pull/5775)) on 2022-12-14
- [d20a7288](https://www.github.com/tauri-apps/tauri/commit/d20a728892eee1858ab525ab6216cd721f473ab5) feat: Further improve workspace inheritance, closes [#6122](https://www.github.com/tauri-apps/tauri/pull/6122), [#5070](https://www.github.com/tauri-apps/tauri/pull/5070) ([#6144](https://www.github.com/tauri-apps/tauri/pull/6144)) on 2023-01-26
- Pin `winnow` crate to 0.4.1 to keep the 1.60 MSRV.
## \[1.2.1]
- Fix `allowlist > app > show/hide` always disabled when `allowlist > app > all: false`.

View File

@@ -1,6 +1,6 @@
[package]
name = "tauri-build"
version = "1.3.0"
version = "1.2.1"
authors = [ "Tauri Programme within The Commons Conservancy" ]
categories = [ "gui", "web-programming" ]
license = "Apache-2.0 OR MIT"
@@ -8,7 +8,7 @@ homepage = "https://tauri.app"
repository = "https://github.com/tauri-apps/tauri/tree/dev/core/tauri-build"
description = "build time code to pair with https://crates.io/crates/tauri"
edition = "2021"
rust-version = "1.60"
rust-version = "1.59"
exclude = [ "CHANGELOG.md", "/target" ]
readme = "README.md"
@@ -19,15 +19,15 @@ rustdoc-args = [ "--cfg", "doc_cfg" ]
[dependencies]
anyhow = "1"
quote = { version = "1", optional = true }
tauri-codegen = { version = "1.3.0", path = "../tauri-codegen", optional = true }
tauri-utils = { version = "1.3.0", path = "../tauri-utils", features = [ "build", "resources" ] }
cargo_toml = "0.15"
winnow = "=0.4.1"
serde = "1"
tauri-codegen = { version = "1.2.1", path = "../tauri-codegen", optional = true }
tauri-utils = { version = "1.2.1", path = "../tauri-utils", features = [ "build", "resources" ] }
cargo_toml = "0.13"
serde_json = "1"
heck = "0.4"
json-patch = "1.0"
tauri-winres = "0.1"
json-patch = "0.2"
[target."cfg(windows)".dependencies]
winres = "0.1"
semver = "1"
[features]

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
@@ -86,7 +86,7 @@ impl CodegenContext {
pub fn build(self) -> PathBuf {
match self.try_build() {
Ok(out) => out,
Err(error) => panic!("Error found during Codegen::build: {error}"),
Err(error) => panic!("Error found during Codegen::build: {}", error),
}
}
@@ -161,7 +161,7 @@ impl CodegenContext {
)
})?;
writeln!(file, "{code}").with_context(|| {
writeln!(file, "{}", code).with_context(|| {
format!(
"Unable to write tokenstream to out file during tauri-build {}",
out.display()

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@@ -1,22 +1,19 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
#![cfg_attr(doc_cfg, feature(doc_cfg))]
pub use anyhow::Result;
use cargo_toml::{Dependency, Manifest};
use heck::AsShoutySnakeCase;
use tauri_utils::{
config::Config,
resources::{external_binaries, resource_relpath, ResourcePaths},
};
use tauri_utils::resources::{external_binaries, resource_relpath, ResourcePaths};
use std::path::{Path, PathBuf};
#[cfg(feature = "codegen")]
mod codegen;
#[cfg(windows)]
mod static_vcruntime;
#[cfg(feature = "codegen")]
@@ -38,8 +35,8 @@ fn copy_file(from: impl AsRef<Path>, to: impl AsRef<Path>) -> Result<()> {
Ok(())
}
fn copy_binaries(
binaries: ResourcePaths,
fn copy_binaries<'a>(
binaries: ResourcePaths<'a>,
target_triple: &str,
path: &Path,
package_name: Option<&String>,
@@ -51,7 +48,7 @@ fn copy_binaries(
.file_name()
.expect("failed to extract external binary filename")
.to_string_lossy()
.replace(&format!("-{target_triple}"), "");
.replace(&format!("-{}", target_triple), "");
if package_name.map_or(false, |n| n == &file_name) {
return Err(anyhow::anyhow!(
@@ -75,7 +72,7 @@ fn copy_resources(resources: ResourcePaths<'_>, path: &Path) -> Result<()> {
let src = src?;
println!("cargo:rerun-if-changed={}", src.display());
let dest = path.join(resource_relpath(&src));
copy_file(&src, dest)?;
copy_file(&src, &dest)?;
}
Ok(())
}
@@ -93,7 +90,7 @@ fn has_feature(feature: &str) -> bool {
// `alias` must be a snake case string.
fn cfg_alias(alias: &str, has_feature: bool) {
if has_feature {
println!("cargo:rustc-cfg={alias}");
println!("cargo:rustc-cfg={}", alias);
}
}
@@ -113,15 +110,6 @@ pub struct WindowsAttributes {
///
/// If it is left unset, it will look up a path in the registry, i.e. HKLM\SOFTWARE\Microsoft\Windows Kits\Installed Roots
sdk_dir: Option<PathBuf>,
/// A string containing an [application manifest] to be included with the application on Windows.
///
/// Defaults to:
/// ```ignore
#[doc = include_str!("window-app-manifest.xml")]
/// ```
///
/// [application manifest]: https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests
app_manifest: Option<String>,
}
impl WindowsAttributes {
@@ -147,45 +135,6 @@ impl WindowsAttributes {
self.sdk_dir = Some(sdk_dir.as_ref().into());
self
}
/// Sets the Windows app [manifest].
///
/// # Example
///
/// The following manifest will brand the exe as requesting administrator privileges.
/// Thus, everytime it is executed, a Windows UAC dialog will appear.
///
/// Note that you can move the manifest contents to a separate file and use `include_str!("manifest.xml")`
/// instead of the inline string.
///
/// ```rust,no_run
/// let mut windows = tauri_build::WindowsAttributes::new();
/// windows = windows.app_manifest(r#"
/// <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
/// <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
/// <security>
/// <requestedPrivileges>
/// <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
/// </requestedPrivileges>
/// </security>
/// </trustInfo>
/// </assembly>
/// "#);
/// tauri_build::try_build(
/// tauri_build::Attributes::new().windows_attributes(windows)
/// ).expect("failed to run build script");
/// ```
///
/// Defaults to:
/// ```ignore
#[doc = include_str!("window-app-manifest.xml")]
/// [manifest]: https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests
/// ```
#[must_use]
pub fn app_manifest<S: AsRef<str>>(mut self, manifest: S) -> Self {
self.app_manifest = Some(manifest.as_ref().to_string());
self
}
}
/// The attributes used on the build.
@@ -230,8 +179,8 @@ impl Attributes {
/// This is typically desirable when running inside a build script; see [`try_build`] for no panics.
pub fn build() {
if let Err(error) = try_build(Attributes::default()) {
let error = format!("{error:#}");
println!("{error}");
let error = format!("{:#}", error);
println!("{}", error);
if error.starts_with("unknown field") {
print!("found an unknown configuration field. This usually means that you are using a CLI version that is newer than `tauri-build` and is incompatible. ");
println!(
@@ -246,6 +195,8 @@ pub fn build() {
#[allow(unused_variables)]
pub fn try_build(attributes: Attributes) -> Result<()> {
use anyhow::anyhow;
use cargo_toml::{Dependency, Manifest};
use tauri_utils::config::{Config, TauriConfig};
println!("cargo:rerun-if-env-changed=TAURI_CONFIG");
println!("cargo:rerun-if-changed=tauri.conf.json");
@@ -270,33 +221,50 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
cfg_alias("dev", !has_feature("custom-protocol"));
let ws_path = get_workspace_dir()?;
let mut manifest =
Manifest::<cargo_toml::Value>::from_slice_with_metadata(&std::fs::read("Cargo.toml")?)?;
if let Ok(ws_manifest) = Manifest::from_path(ws_path.join("Cargo.toml")) {
Manifest::complete_from_path_and_workspace(
&mut manifest,
Path::new("Cargo.toml"),
Some((&ws_manifest, ws_path.as_path())),
)?;
} else {
Manifest::complete_from_path(&mut manifest, Path::new("Cargo.toml"))?;
}
if let Some(tauri_build) = manifest.build_dependencies.remove("tauri-build") {
let error_message = check_features(&config, tauri_build, true);
if !error_message.is_empty() {
return Err(anyhow!("
The `tauri-build` dependency features on the `Cargo.toml` file does not match the allowlist defined under `tauri.conf.json`.
Please run `tauri dev` or `tauri build` or {}.
", error_message));
}
}
let mut manifest = Manifest::from_path("Cargo.toml")?;
if let Some(tauri) = manifest.dependencies.remove("tauri") {
let error_message = check_features(&config, tauri, false);
let features = match tauri {
Dependency::Simple(_) => Vec::new(),
Dependency::Detailed(dep) => dep.features,
Dependency::Inherited(dep) => dep.features,
};
let all_cli_managed_features = TauriConfig::all_features();
let diff = features_diff(
&features
.into_iter()
.filter(|f| all_cli_managed_features.contains(&f.as_str()))
.collect::<Vec<String>>(),
&config
.tauri
.features()
.into_iter()
.map(|f| f.to_string())
.collect::<Vec<String>>(),
);
let mut error_message = String::new();
if !diff.remove.is_empty() {
error_message.push_str("remove the `");
error_message.push_str(&diff.remove.join(", "));
error_message.push_str(if diff.remove.len() == 1 {
"` feature"
} else {
"` features"
});
if !diff.add.is_empty() {
error_message.push_str(" and ");
}
}
if !diff.add.is_empty() {
error_message.push_str("add the `");
error_message.push_str(&diff.add.join(", "));
error_message.push_str(if diff.add.len() == 1 {
"` feature"
} else {
"` features"
});
}
if !error_message.is_empty() {
return Err(anyhow!("
@@ -328,25 +296,25 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
#[allow(unused_mut, clippy::redundant_clone)]
let mut resources = config.tauri.bundle.resources.clone().unwrap_or_default();
if target_triple.contains("windows") {
if let Some(fixed_webview2_runtime_path) =
&config.tauri.bundle.windows.webview_fixed_runtime_path
{
resources.push(fixed_webview2_runtime_path.display().to_string());
}
#[cfg(windows)]
if let Some(fixed_webview2_runtime_path) = &config.tauri.bundle.windows.webview_fixed_runtime_path
{
resources.push(fixed_webview2_runtime_path.display().to_string());
}
copy_resources(ResourcePaths::new(resources.as_slice(), true), target_dir)?;
if target_triple.contains("darwin") {
if let Some(version) = &config.tauri.bundle.macos.minimum_system_version {
println!("cargo:rustc-env=MACOSX_DEPLOYMENT_TARGET={version}");
#[cfg(target_os = "macos")]
{
if let Some(version) = config.tauri.bundle.macos.minimum_system_version {
println!("cargo:rustc-env=MACOSX_DEPLOYMENT_TARGET={}", version);
}
}
if target_triple.contains("windows") {
#[cfg(windows)]
{
use anyhow::Context;
use semver::Version;
use tauri_winres::{VersionInfo, WindowsResource};
use winres::{VersionInfo, WindowsResource};
fn find_icon<F: Fn(&&String) -> bool>(config: &Config, predicate: F, default: &str) -> PathBuf {
let icon_path = config
@@ -368,11 +336,24 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
if window_icon_path.exists() {
let mut res = WindowsResource::new();
if let Some(manifest) = attributes.windows_attributes.app_manifest {
res.set_manifest(&manifest);
} else {
res.set_manifest(include_str!("window-app-manifest.xml"));
}
res.set_manifest(
r#"
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
"#,
);
if let Some(sdk_dir) = &attributes.windows_attributes.sdk_dir {
if let Some(sdk_dir_str) = sdk_dir.to_str() {
@@ -470,89 +451,6 @@ fn features_diff(current: &[String], expected: &[String]) -> Diff {
Diff { remove, add }
}
fn check_features(config: &Config, dependency: Dependency, is_tauri_build: bool) -> String {
use tauri_utils::config::{PatternKind, TauriConfig};
let features = match dependency {
Dependency::Simple(_) => Vec::new(),
Dependency::Detailed(dep) => dep.features,
Dependency::Inherited(dep) => dep.features,
};
let all_cli_managed_features = if is_tauri_build {
vec!["isolation"]
} else {
TauriConfig::all_features()
};
let expected = if is_tauri_build {
match config.tauri.pattern {
PatternKind::Isolation { .. } => vec!["isolation".to_string()],
_ => vec![],
}
} else {
config
.tauri
.features()
.into_iter()
.map(|f| f.to_string())
.collect::<Vec<String>>()
};
let diff = features_diff(
&features
.into_iter()
.filter(|f| all_cli_managed_features.contains(&f.as_str()))
.collect::<Vec<String>>(),
&expected,
);
let mut error_message = String::new();
if !diff.remove.is_empty() {
error_message.push_str("remove the `");
error_message.push_str(&diff.remove.join(", "));
error_message.push_str(if diff.remove.len() == 1 {
"` feature"
} else {
"` features"
});
if !diff.add.is_empty() {
error_message.push_str(" and ");
}
}
if !diff.add.is_empty() {
error_message.push_str("add the `");
error_message.push_str(&diff.add.join(", "));
error_message.push_str(if diff.add.len() == 1 {
"` feature"
} else {
"` features"
});
}
error_message
}
#[derive(serde::Deserialize)]
struct CargoMetadata {
workspace_root: PathBuf,
}
fn get_workspace_dir() -> Result<PathBuf> {
let output = std::process::Command::new("cargo")
.args(["metadata", "--no-deps", "--format-version", "1"])
.output()?;
if !output.status.success() {
return Err(anyhow::anyhow!(
"cargo metadata command exited with a non zero exit code: {}",
String::from_utf8(output.stderr)?
));
}
Ok(serde_json::from_slice::<CargoMetadata>(&output.stdout)?.workspace_root)
}
#[cfg(test)]
mod tests {
use super::Diff;

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
@@ -48,7 +48,7 @@ fn override_msvcrt_lib() {
let f = fs::OpenOptions::new()
.write(true)
.create_new(true)
.open(path);
.open(&path);
if let Ok(mut f) = f {
f.write_all(machine).unwrap();
f.write_all(bytes).unwrap();

View File

@@ -1,14 +0,0 @@
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>

View File

@@ -1,12 +1,5 @@
# Changelog
## \[1.3.0]
- Bump minimum supported Rust version to 1.60.
- [5fdc616d](https://www.github.com/tauri-apps/tauri/commit/5fdc616df9bea633810dcb814ac615911d77222c) feat: Use the zbus-backed of notify-rust ([#6332](https://www.github.com/tauri-apps/tauri/pull/6332)) on 2023-03-31
- Pin `time` to `0.3.15`.
- [3d16461b](https://www.github.com/tauri-apps/tauri/commit/3d16461b68583ba7db037fbc217786e79b46ddf2) fix(core): pin time to 0.3.15 ([#6312](https://www.github.com/tauri-apps/tauri/pull/6312)) on 2023-02-19
## \[1.2.1]
- Fix `allowlist > app > show/hide` always disabled when `allowlist > app > all: false`.

View File

@@ -1,6 +1,6 @@
[package]
name = "tauri-codegen"
version = "1.3.0"
version = "1.2.1"
authors = [ "Tauri Programme within The Commons Conservancy" ]
categories = [ "gui", "web-programming" ]
license = "Apache-2.0 OR MIT"
@@ -8,31 +8,31 @@ homepage = "https://tauri.app"
repository = "https://github.com/tauri-apps/tauri/tree/dev/core/tauri-codegen"
description = "code generation meant to be consumed inside of `tauri` through `tauri-build` or `tauri-macros`"
edition = "2021"
rust-version = "1.60"
rust-version = "1.59"
exclude = [ "CHANGELOG.md", "/target" ]
readme = "README.md"
[dependencies]
sha2 = "0.10"
base64 = "0.21"
base64 = "0.13"
proc-macro2 = "1"
quote = "1"
serde = { version = "1", features = [ "derive" ] }
serde_json = "1"
tauri-utils = { version = "1.3.0", path = "../tauri-utils", features = [ "build" ] }
tauri-utils = { version = "1.2.1", path = "../tauri-utils", features = [ "build" ] }
thiserror = "1"
walkdir = "2"
brotli = { version = "3", optional = true, default-features = false, features = [ "std" ] }
regex = { version = "1.7.1", optional = true }
regex = { version = "1.7.0", optional = true }
uuid = { version = "1", features = [ "v4" ] }
semver = "1"
ico = "0.3"
ico = "0.2"
png = "0.17"
json-patch = "1.0"
json-patch = "0.2"
[target."cfg(target_os = \"macos\")".dependencies]
plist = "1"
time = { version = "=0.3.15", features = [ "parsing", "formatting" ] }
time = { version = "0.3", features = [ "parsing", "formatting" ] }
[features]
default = [ "compression" ]

View File

@@ -1,11 +1,10 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use std::path::{Path, PathBuf};
use std::{ffi::OsStr, str::FromStr};
use base64::Engine;
use proc_macro2::TokenStream;
use quote::quote;
use sha2::{Digest, Sha256};
@@ -58,10 +57,7 @@ fn map_core_assets(
let mut hasher = Sha256::new();
hasher.update(&script);
let hash = hasher.finalize();
scripts.push(format!(
"'sha256-{}'",
base64::engine::general_purpose::STANDARD.encode(hash)
));
scripts.push(format!("'sha256-{}'", base64::encode(hash)));
}
csp_hashes
.inline_scripts
@@ -78,10 +74,9 @@ fn map_core_assets(
let mut hasher = Sha256::new();
hasher.update(tauri_utils::pattern::isolation::IFRAME_STYLE);
let hash = hasher.finalize();
csp_hashes.styles.push(format!(
"'sha256-{}'",
base64::engine::general_purpose::STANDARD.encode(hash)
));
csp_hashes
.styles
.push(format!("'sha256-{}'", base64::encode(hash)));
}
}
@@ -146,7 +141,7 @@ pub fn context_codegen(data: ContextData) -> Result<TokenStream, EmbeddedAssetsE
} else if target.contains("apple-ios") {
Target::Ios
} else {
panic!("unknown codegen target {target}");
panic!("unknown codegen target {}", target);
}
} else if cfg!(target_os = "linux") {
Target::Linux
@@ -375,7 +370,10 @@ pub fn context_codegen(data: ContextData) -> Result<TokenStream, EmbeddedAssetsE
PatternKind::Isolation { dir } => {
let dir = config_parent.join(dir);
if !dir.exists() {
panic!("The isolation application path is set to `{dir:?}` but it does not exist")
panic!(
"The isolation application path is set to `{:?}` but it does not exist",
dir
)
}
let mut sets_isolation_hook = false;
@@ -416,7 +414,7 @@ pub fn context_codegen(data: ContextData) -> Result<TokenStream, EmbeddedAssetsE
let shell_scope_open = match &config.tauri.allowlist.shell.open {
ShellAllowlistOpen::Flag(false) => quote!(::std::option::Option::None),
ShellAllowlistOpen::Flag(true) => {
quote!(::std::option::Option::Some(#root::regex::Regex::new(r#"^((mailto:\w+)|(tel:\w+)|(https?://\w+)).+"#).unwrap()))
quote!(::std::option::Option::Some(#root::regex::Regex::new("^https?://").unwrap()))
}
ShellAllowlistOpen::Validate(regex) => match Regex::new(regex) {
Ok(_) => quote!(::std::option::Option::Some(#root::regex::Regex::new(#regex).unwrap())),

View File

@@ -1,8 +1,7 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use base64::Engine;
use proc_macro2::TokenStream;
use quote::{quote, ToTokens, TokenStreamExt};
use sha2::{Digest, Sha256};
@@ -182,10 +181,9 @@ impl CspHashes {
})?,
);
let hash = hasher.finalize();
self.scripts.push(format!(
"'sha256-{}'",
base64::engine::general_purpose::STANDARD.encode(hash)
));
self
.scripts
.push(format!("'sha256-{}'", base64::encode(hash)));
}
}
@@ -345,14 +343,14 @@ impl EmbeddedAssets {
let mut hex = String::with_capacity(2 * bytes.len());
for b in bytes {
write!(hex, "{b:02x}").map_err(EmbeddedAssetsError::Hex)?;
write!(hex, "{:02x}", b).map_err(EmbeddedAssetsError::Hex)?;
}
hex
};
// use the content hash to determine filename, keep extensions that exist
let out_path = if let Some(ext) = path.extension().and_then(|e| e.to_str()) {
out_dir.join(format!("{hash}.{ext}"))
out_dir.join(format!("{}.{}", hash, ext))
} else {
out_dir.join(hash)
};
@@ -433,7 +431,6 @@ impl ToTokens for EmbeddedAssets {
// we expect phf related items to be in path when generating the path code
tokens.append_all(quote! {{
#[allow(unused)]
use ::tauri::utils::assets::{CspHash, EmbeddedAssets, phf, phf::phf_map};
EmbeddedAssets::new(phf_map! { #assets }, &[#global_hashes], phf_map! { #html_hashes })
}});

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@@ -1,15 +0,0 @@
[package]
name = "tauri-tauri-config-schema"
version = "0.0.0"
edition = "2021"
publish = false
[build-dependencies]
tauri-utils = { version = "1.0.0", features = [
"schema",
], path = "../tauri-utils" }
schemars = { version = "0.8", features = ["url", "preserve_order"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_with = "1.12"
url = { version = "2.3", features = ["serde"] }

View File

@@ -1,5 +0,0 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
fn main() {}

View File

@@ -1,10 +1,5 @@
# Changelog
## \[1.3.0]
- Bump minimum supported Rust version to 1.60.
- [5fdc616d](https://www.github.com/tauri-apps/tauri/commit/5fdc616df9bea633810dcb814ac615911d77222c) feat: Use the zbus-backed of notify-rust ([#6332](https://www.github.com/tauri-apps/tauri/pull/6332)) on 2023-03-31
## \[1.2.1]
- Fix `allowlist > app > show/hide` always disabled when `allowlist > app > all: false`.

View File

@@ -1,6 +1,6 @@
[package]
name = "tauri-macros"
version = "1.3.0"
version = "1.2.1"
authors = [ "Tauri Programme within The Commons Conservancy" ]
categories = [ "gui", "os", "filesystem", "web-programming" ]
license = "Apache-2.0 OR MIT"
@@ -8,7 +8,7 @@ homepage = "https://tauri.app"
repository = "https://github.com/tauri-apps/tauri"
description = "Macros for the tauri crate."
edition = "2021"
rust-version = "1.60"
rust-version = "1.59"
exclude = [ "CHANGELOG.md", "/target" ]
readme = "README.md"
@@ -20,8 +20,8 @@ proc-macro2 = "1"
quote = "1"
syn = { version = "1", features = [ "full" ] }
heck = "0.4"
tauri-codegen = { version = "1.3.0", default-features = false, path = "../tauri-codegen" }
tauri-utils = { version = "1.3.0", path = "../tauri-utils" }
tauri-codegen = { version = "1.2.1", default-features = false, path = "../tauri-codegen" }
tauri-utils = { version = "1.2.1", path = "../tauri-utils" }
[features]
custom-protocol = [ ]

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@@ -1,35 +1,9 @@
# Changelog
## \[0.13.0]
## \[0.12.3]
- Added the `additional_browser_args` option when creating a window.
- [3dc38b15](https://www.github.com/tauri-apps/tauri/commit/3dc38b150ea8c59c8ba67fd586f921016928f47c) feat(core): expose additional_browser_args to window config (fix: [#5757](https://www.github.com/tauri-apps/tauri/pull/5757)) ([#5799](https://www.github.com/tauri-apps/tauri/pull/5799)) on 2022-12-14
- Added the `content_protected` option when creating a window and `Window::set_content_protected` to change it at runtime.
- [4ab5545b](https://www.github.com/tauri-apps/tauri/commit/4ab5545b7a831c549f3c65e74de487ede3ab7ce5) feat: add content protection api, closes [#5132](https://www.github.com/tauri-apps/tauri/pull/5132) ([#5513](https://www.github.com/tauri-apps/tauri/pull/5513)) on 2022-12-13
- Added `Builder::device_event_filter` and `App::set_device_event_filter` methods.
- [73fd60ee](https://www.github.com/tauri-apps/tauri/commit/73fd60eef2b60f5dc84525ef9c315f4d80c4414f) expose set_device_event_filter in tauri ([#5562](https://www.github.com/tauri-apps/tauri/pull/5562)) on 2022-12-13
- Fixes tray events not being delivered.
- [138cb8d7](https://www.github.com/tauri-apps/tauri/commit/138cb8d739b15bccdb388e555c20f17ffe16318c) fix(tauri-runtime-wry): tray event listener not registered ([#6270](https://www.github.com/tauri-apps/tauri/pull/6270)) on 2023-02-14
- Add `is_minimized()` window method.
- [62144ef3](https://www.github.com/tauri-apps/tauri/commit/62144ef3be63b237869e511826edfb938e2c7174) feat: add is_minimized (fix [#3878](https://www.github.com/tauri-apps/tauri/pull/3878)) ([#5618](https://www.github.com/tauri-apps/tauri/pull/5618)) on 2022-12-13
- Disable cursor mouse events on Linux.
- [8c842a54](https://www.github.com/tauri-apps/tauri/commit/8c842a54a6f3dc5327b4d737df7123dcddaa5769) feature: disable mouse event when building windows on Linux, closes [#5913](https://www.github.com/tauri-apps/tauri/pull/5913) ([#6025](https://www.github.com/tauri-apps/tauri/pull/6025)) on 2023-01-16
- Bump minimum supported Rust version to 1.60.
- [5fdc616d](https://www.github.com/tauri-apps/tauri/commit/5fdc616df9bea633810dcb814ac615911d77222c) feat: Use the zbus-backed of notify-rust ([#6332](https://www.github.com/tauri-apps/tauri/pull/6332)) on 2023-03-31
- Pin raw-window-handle to 0.5.0 to keep MSRV.
- [c46c09f3](https://www.github.com/tauri-apps/tauri/commit/c46c09f31d9f5169ca8a7e62406a9ea170e3a5c5) fix(deps): pin raw-window-handle to 0.5.0 ([#6480](https://www.github.com/tauri-apps/tauri/pull/6480)) on 2023-03-17
- Add `title` getter on window.
- [233e43b0](https://www.github.com/tauri-apps/tauri/commit/233e43b0c34fada1ca025378533a0b76931a6540) feat: add `title` getter on window, closes [#5023](https://www.github.com/tauri-apps/tauri/pull/5023) ([#5515](https://www.github.com/tauri-apps/tauri/pull/5515)) on 2022-12-13
- Added `TrayHandle::set_tooltip` and `SystemTray::with_tooltip`.
- [2265e097](https://www.github.com/tauri-apps/tauri/commit/2265e09718f6ebfeb1d200f11e1e1e069075af6e) feat(windows): implement `with_tooltip` ([#5938](https://www.github.com/tauri-apps/tauri/pull/5938)) on 2023-01-01
- Added window's `url()` getter.
- [d17027e1](https://www.github.com/tauri-apps/tauri/commit/d17027e1a0db3e8c5ae81fc4f472c5918fbce611) feat: expose url method ([#5914](https://www.github.com/tauri-apps/tauri/pull/5914)) on 2022-12-26
- On Windows, change webview theme based on Window theme for more accurate `prefers-color-scheme` support.
- [7a8d570d](https://www.github.com/tauri-apps/tauri/commit/7a8d570db72667367eb24b75ddc5dd07a968f7c0) fix: sync webview theme with window theme on Windows, closes [#5802](https://www.github.com/tauri-apps/tauri/pull/5802) ([#5874](https://www.github.com/tauri-apps/tauri/pull/5874)) on 2022-12-27
- On Windows, Fix missing `WindowEvent::Focused` in `App::run` callback.
- [ff4ea1ea](https://www.github.com/tauri-apps/tauri/commit/ff4ea1eabbf2874b113c6b4698002929bbac737a) fix: dispatch focus event to app.run on Windows, closes [#6460](https://www.github.com/tauri-apps/tauri/pull/6460) ([#6504](https://www.github.com/tauri-apps/tauri/pull/6504)) on 2023-03-31
- Implement the webview navigation handler.
- [3f35b452](https://www.github.com/tauri-apps/tauri/commit/3f35b452637ef1c794a423f1eda62a15d2ddaf42) Expose wry navigation_handler via WindowBuilder closes [#4080](https://www.github.com/tauri-apps/tauri/pull/4080) ([#5686](https://www.github.com/tauri-apps/tauri/pull/5686)) on 2022-12-27
- Block remote URLs from accessing the IPC.
- [9c0593c33](https://www.github.com/tauri-apps/tauri/commit/9c0593c33af52cd9e00ec784d15f63efebdf039c) feat(core): block remote URLs from accessing the IPC on 2023-04-12
## \[0.12.2]

View File

@@ -1,6 +1,6 @@
[package]
name = "tauri-runtime-wry"
version = "0.13.0"
version = "0.12.3"
authors = [ "Tauri Programme within The Commons Conservancy" ]
categories = [ "gui", "web-programming" ]
license = "Apache-2.0 OR MIT"
@@ -8,17 +8,18 @@ homepage = "https://tauri.app"
repository = "https://github.com/tauri-apps/tauri"
description = "Wry bindings to the Tauri runtime"
edition = "2021"
rust-version = "1.60"
rust-version = "1.59"
exclude = [ "CHANGELOG.md", "/target" ]
readme = "README.md"
[dependencies]
wry = { version = "0.24.1", default-features = false, features = [ "file-drop", "protocol" ] }
tauri-runtime = { version = "0.13.0", path = "../tauri-runtime" }
tauri-utils = { version = "1.3.0", path = "../tauri-utils" }
wry = { version = "0.23", default-features = false, features = [ "file-drop", "protocol" ] }
tauri-runtime = { version = "0.12.2", path = "../tauri-runtime" }
tauri-utils = { version = "1.2.1", path = "../tauri-utils" }
uuid = { version = "1", features = [ "v4" ] }
rand = "0.8"
raw-window-handle = "=0.5.0"
raw-window-handle = "0.5"
url = "2"
[target."cfg(windows)".dependencies]
webview2-com = "0.19.1"

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
@@ -6,7 +6,7 @@
// `alias` must be a snake case string.
fn alias(alias: &str, has_feature: bool) {
if has_feature {
println!("cargo:rustc-cfg={alias}");
println!("cargo:rustc-cfg={}", alias);
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
@@ -14,8 +14,8 @@ use tauri_runtime::{
dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize, Position, Size},
CursorIcon, DetachedWindow, FileDropEvent, JsEventListenerKey, PendingWindow, WindowEvent,
},
DeviceEventFilter, Dispatch, Error, EventLoopProxy, ExitRequestedEventAction, Icon, Result,
RunEvent, RunIteration, Runtime, RuntimeHandle, UserAttentionType, UserEvent,
Dispatch, Error, EventLoopProxy, ExitRequestedEventAction, Icon, Result, RunEvent, RunIteration,
Runtime, RuntimeHandle, UserAttentionType, UserEvent,
};
use tauri_runtime::window::MenuEvent;
@@ -33,12 +33,11 @@ use wry::application::platform::macos::WindowBuilderExtMacOS;
use wry::application::platform::unix::{WindowBuilderExtUnix, WindowExtUnix};
#[cfg(windows)]
use wry::application::platform::windows::{WindowBuilderExtWindows, WindowExtWindows};
#[cfg(windows)]
use wry::webview::WebViewBuilderExtWindows;
#[cfg(target_os = "macos")]
use tauri_utils::TitleBarStyle;
use tauri_utils::{config::WindowConfig, debug_eprintln, Theme};
use url::Url;
use uuid::Uuid;
use wry::{
application::{
@@ -49,8 +48,7 @@ use wry::{
},
event::{Event, StartCause, WindowEvent as WryWindowEvent},
event_loop::{
ControlFlow, DeviceEventFilter as WryDeviceEventFilter, EventLoop,
EventLoopProxy as WryEventLoopProxy, EventLoopWindowTarget,
ControlFlow, EventLoop, EventLoopProxy as WryEventLoopProxy, EventLoopWindowTarget,
},
menu::{
AboutMetadata as WryAboutMetadata, CustomMenuItem as WryCustomMenuItem, MenuBar,
@@ -64,9 +62,10 @@ use wry::{
},
},
http::{Request as WryRequest, Response as WryResponse},
webview::{FileDropEvent as WryFileDropEvent, Url, WebContext, WebView, WebViewBuilder},
webview::{FileDropEvent as WryFileDropEvent, WebContext, WebView, WebViewBuilder},
};
pub use wry;
pub use wry::application::window::{Window, WindowBuilder as WryWindowBuilder, WindowId};
#[cfg(windows)]
@@ -81,7 +80,6 @@ pub use wry::application::platform::macos::{
};
use std::{
borrow::Cow,
cell::RefCell,
collections::{
hash_map::Entry::{Occupied, Vacant},
@@ -289,7 +287,7 @@ impl From<&WryRequest<Vec<u8>>> for HttpRequestWrapper {
}
// response
struct HttpResponseWrapper(WryResponse<Cow<'static, [u8]>>);
struct HttpResponseWrapper(WryResponse<Vec<u8>>);
impl From<HttpResponse> for HttpResponseWrapper {
fn from(response: HttpResponse) -> Self {
let (parts, body) = response.into_parts();
@@ -303,7 +301,7 @@ impl From<HttpResponse> for HttpResponseWrapper {
res_builder = res_builder.header(name, val);
}
let res = res_builder.body(Cow::Owned(body)).unwrap();
let res = res_builder.body(body).unwrap();
Self(res)
}
}
@@ -369,18 +367,6 @@ impl From<MenuItem> for MenuItemWrapper {
}
}
pub struct DeviceEventFilterWrapper(pub WryDeviceEventFilter);
impl From<DeviceEventFilter> for DeviceEventFilterWrapper {
fn from(item: DeviceEventFilter) -> Self {
match item {
DeviceEventFilter::Always => Self(WryDeviceEventFilter::Always),
DeviceEventFilter::Never => Self(WryDeviceEventFilter::Never),
DeviceEventFilter::Unfocused => Self(WryDeviceEventFilter::Unfocused),
}
}
}
#[cfg(target_os = "macos")]
pub struct NativeImageWrapper(pub WryNativeImage);
@@ -722,7 +708,6 @@ impl WindowBuilder for WindowBuilderWrapper {
.decorations(config.decorations)
.maximized(config.maximized)
.always_on_top(config.always_on_top)
.content_protected(config.content_protected)
.skip_taskbar(config.skip_taskbar)
.theme(config.theme);
@@ -752,12 +737,6 @@ impl WindowBuilder for WindowBuilderWrapper {
");
}
#[cfg(target_os = "linux")]
{
// Mouse event is disabled on Linux since sudden event bursts could block event loop.
window.inner = window.inner.with_cursor_moved_event(false);
}
if let (Some(min_width), Some(min_height)) = (config.min_width, config.min_height) {
window = window.min_inner_size(min_width, min_height);
}
@@ -863,11 +842,6 @@ impl WindowBuilder for WindowBuilderWrapper {
self
}
fn content_protected(mut self, protected: bool) -> Self {
self.inner = self.inner.with_content_protection(protected);
self
}
#[cfg(windows)]
fn parent_window(mut self, parent: HWND) -> Self {
self.inner = self.inner.with_parent_window(parent);
@@ -1046,19 +1020,16 @@ pub enum WindowMessage {
#[cfg(any(debug_assertions, feature = "devtools"))]
IsDevToolsOpen(Sender<bool>),
// Getters
Url(Sender<Url>),
ScaleFactor(Sender<f64>),
InnerPosition(Sender<Result<PhysicalPosition<i32>>>),
OuterPosition(Sender<Result<PhysicalPosition<i32>>>),
InnerSize(Sender<PhysicalSize<u32>>),
OuterSize(Sender<PhysicalSize<u32>>),
IsFullscreen(Sender<bool>),
IsMinimized(Sender<bool>),
IsMaximized(Sender<bool>),
IsDecorated(Sender<bool>),
IsResizable(Sender<bool>),
IsVisible(Sender<bool>),
Title(Sender<String>),
IsMenuVisible(Sender<bool>),
CurrentMonitor(Sender<Option<MonitorHandle>>),
PrimaryMonitor(Sender<Option<MonitorHandle>>),
@@ -1089,7 +1060,6 @@ pub enum WindowMessage {
Close,
SetDecorations(bool),
SetAlwaysOnTop(bool),
SetContentProtected(bool),
SetSize(Size),
SetMinSize(Option<Size>),
SetMaxSize(Option<Size>),
@@ -1132,7 +1102,6 @@ pub enum TrayMessage {
UpdateIconAsTemplate(bool),
#[cfg(target_os = "macos")]
UpdateTitle(String),
UpdateTooltip(String),
Create(SystemTray, Sender<Result<()>>),
Destroy(Sender<Result<()>>),
}
@@ -1249,10 +1218,6 @@ impl<T: UserEvent> Dispatch<T> for WryDispatcher<T> {
// Getters
fn url(&self) -> Result<Url> {
window_getter!(self, WindowMessage::Url)
}
fn scale_factor(&self) -> Result<f64> {
window_getter!(self, WindowMessage::ScaleFactor)
}
@@ -1277,10 +1242,6 @@ impl<T: UserEvent> Dispatch<T> for WryDispatcher<T> {
window_getter!(self, WindowMessage::IsFullscreen)
}
fn is_minimized(&self) -> Result<bool> {
window_getter!(self, WindowMessage::IsMinimized)
}
fn is_maximized(&self) -> Result<bool> {
window_getter!(self, WindowMessage::IsMaximized)
}
@@ -1299,10 +1260,6 @@ impl<T: UserEvent> Dispatch<T> for WryDispatcher<T> {
window_getter!(self, WindowMessage::IsVisible)
}
fn title(&self) -> Result<String> {
window_getter!(self, WindowMessage::Title)
}
fn is_menu_visible(&self) -> Result<bool> {
window_getter!(self, WindowMessage::IsMenuVisible)
}
@@ -1472,16 +1429,6 @@ impl<T: UserEvent> Dispatch<T> for WryDispatcher<T> {
)
}
fn set_content_protected(&self, protected: bool) -> Result<()> {
send_user_message(
&self.context,
Message::Window(
self.window_id,
WindowMessage::SetContentProtected(protected),
),
)
}
fn set_size(&self, size: Size) -> Result<()> {
send_user_message(
&self.context,
@@ -2086,12 +2033,6 @@ impl<T: UserEvent> Runtime<T> for Wry<T> {
self.event_loop.hide_application();
}
fn set_device_event_filter(&mut self, filter: DeviceEventFilter) {
self
.event_loop
.set_device_event_filter(DeviceEventFilterWrapper::from(filter).0);
}
#[cfg(desktop)]
fn run_iteration<F: FnMut(RunEvent<T>) + 'static>(&mut self, mut callback: F) -> RunIteration {
use wry::application::platform::run_return::EventLoopExtRunReturn;
@@ -2379,11 +2320,6 @@ fn handle_user_message<T: UserEvent>(
}
}
// Getters
WindowMessage::Url(tx) => {
if let WindowHandle::Webview { inner: w, .. } = &window {
tx.send(w.url()).unwrap();
}
}
WindowMessage::ScaleFactor(tx) => tx.send(window.scale_factor()).unwrap(),
WindowMessage::InnerPosition(tx) => tx
.send(
@@ -2408,12 +2344,10 @@ fn handle_user_message<T: UserEvent>(
.send(PhysicalSizeWrapper(window.outer_size()).into())
.unwrap(),
WindowMessage::IsFullscreen(tx) => tx.send(window.fullscreen().is_some()).unwrap(),
WindowMessage::IsMinimized(tx) => tx.send(window.is_minimized()).unwrap(),
WindowMessage::IsMaximized(tx) => tx.send(window.is_maximized()).unwrap(),
WindowMessage::IsDecorated(tx) => tx.send(window.is_decorated()).unwrap(),
WindowMessage::IsResizable(tx) => tx.send(window.is_resizable()).unwrap(),
WindowMessage::IsVisible(tx) => tx.send(window.is_visible()).unwrap(),
WindowMessage::Title(tx) => tx.send(window.title()).unwrap(),
WindowMessage::IsMenuVisible(tx) => tx.send(window.is_menu_visible()).unwrap(),
WindowMessage::CurrentMonitor(tx) => tx.send(window.current_monitor()).unwrap(),
WindowMessage::PrimaryMonitor(tx) => tx.send(window.primary_monitor()).unwrap(),
@@ -2458,9 +2392,6 @@ fn handle_user_message<T: UserEvent>(
}
WindowMessage::SetDecorations(decorations) => window.set_decorations(decorations),
WindowMessage::SetAlwaysOnTop(always_on_top) => window.set_always_on_top(always_on_top),
WindowMessage::SetContentProtected(protected) => {
window.set_content_protection(protected)
}
WindowMessage::SetSize(size) => {
window.set_inner_size(SizeWrapper::from(size).0);
}
@@ -2536,7 +2467,21 @@ fn handle_user_message<T: UserEvent>(
let _ = webview.print();
}
}
WebviewMessage::WebviewEvent(_event) => { /* already handled */ }
WebviewMessage::WebviewEvent(event) => {
let window_event_listeners = windows
.borrow()
.get(&id)
.map(|w| w.window_event_listeners.clone());
if let Some(window_event_listeners) = window_event_listeners {
if let Some(event) = WindowEventWrapper::from(&event).0 {
let listeners = window_event_listeners.lock().unwrap();
let handlers = listeners.values();
for handler in handlers {
handler(&event);
}
}
}
}
},
Message::CreateWebview(window_id, handler) => match handler(event_loop, web_context) {
Ok(webview) => {
@@ -2573,18 +2518,14 @@ fn handle_user_message<T: UserEvent>(
Message::Tray(tray_id, tray_message) => {
let mut trays = system_tray_manager.trays.lock().unwrap();
if let TrayMessage::Create(mut tray, tx) = tray_message {
let mut listeners = Vec::new();
if let Some(l) = tray.on_event.take() {
listeners.push(Arc::new(l));
}
if let TrayMessage::Create(tray, tx) = tray_message {
match create_tray(WryTrayId(tray_id), tray, event_loop) {
Ok((tray, items)) => {
trays.insert(
tray_id,
TrayContext {
tray: Arc::new(Mutex::new(Some(tray))),
listeners: Arc::new(Mutex::new(listeners)),
listeners: Default::default(),
items: Arc::new(Mutex::new(items)),
},
);
@@ -2637,11 +2578,6 @@ fn handle_user_message<T: UserEvent>(
tray.set_title(&title);
}
}
TrayMessage::UpdateTooltip(tooltip) => {
if let Some(tray) = &mut *tray_context.tray.lock().unwrap() {
tray.set_tooltip(&tooltip);
}
}
TrayMessage::Create(_tray, _tx) => {
// already handled
}
@@ -2830,24 +2766,6 @@ fn handle_event_loop<T: UserEvent>(
global_listener(id.0, &event);
}
}
Event::UserEvent(Message::Webview(id, WebviewMessage::WebviewEvent(event))) => {
if let Some(event) = WindowEventWrapper::from(&event).0 {
let windows = windows.borrow();
let window = windows.get(&id);
if let Some(window) = window {
callback(RunEvent::WindowEvent {
label: window.label.clone(),
event: event.clone(),
});
let listeners = window.window_event_listeners.lock().unwrap();
let handlers = listeners.values();
for handler in handlers {
handler(&event);
}
}
}
}
Event::WindowEvent {
event, window_id, ..
} => {
@@ -2875,19 +2793,6 @@ fn handle_event_loop<T: UserEvent>(
}
match event {
#[cfg(windows)]
WryWindowEvent::ThemeChanged(theme) => {
if let Some(window) = windows.borrow().get(&window_id) {
if let Some(WindowHandle::Webview { inner, .. }) = &window.inner {
let theme = match theme {
WryTheme::Dark => wry::webview::Theme::Dark,
WryTheme::Light => wry::webview::Theme::Light,
_ => wry::webview::Theme::Light,
};
inner.set_theme(theme);
}
}
}
WryWindowEvent::CloseRequested => {
on_close_requested(callback, window_id, windows.clone());
}
@@ -3062,9 +2967,6 @@ fn create_webview<T: UserEvent>(
.with_drag_and_drop(webview_attributes.file_drop_handler_enabled);
}
#[cfg(windows)]
let window_theme = window_builder.inner.window.preferred_theme;
#[cfg(target_os = "macos")]
{
if window_builder.tabbing_identifier.is_none()
@@ -3101,29 +3003,14 @@ fn create_webview<T: UserEvent>(
webview_builder = webview_builder
.with_file_drop_handler(create_file_drop_handler(window_event_listeners.clone()));
}
if let Some(user_agent) = webview_attributes.user_agent {
webview_builder = webview_builder.with_user_agent(&user_agent);
}
if let Some(navigation_handler) = pending.navigation_handler {
webview_builder = webview_builder.with_navigation_handler(move |url| {
Url::parse(&url).map(&navigation_handler).unwrap_or(true)
});
}
if let Some(user_agent) = webview_attributes.user_agent {
webview_builder = webview_builder.with_user_agent(&user_agent);
}
#[cfg(windows)]
if let Some(additional_browser_args) = webview_attributes.additional_browser_args {
webview_builder = webview_builder.with_additional_browser_args(&additional_browser_args);
}
#[cfg(windows)]
if let Some(theme) = window_theme {
webview_builder = webview_builder.with_theme(match theme {
WryTheme::Dark => wry::webview::Theme::Dark,
WryTheme::Light => wry::webview::Theme::Light,
_ => wry::webview::Theme::Light,
});
}
if let Some(handler) = ipc_handler {
webview_builder = webview_builder.with_ipc_handler(create_ipc_handler(
context,

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
@@ -114,10 +114,6 @@ pub fn create_tray<T>(
}
}
if let Some(tooltip) = system_tray.tooltip {
builder = builder.with_tooltip(&tooltip);
}
let tray = builder
.build(event_loop)
.map_err(|e| Error::SystemTray(Box::new(e)))?;
@@ -176,16 +172,6 @@ impl<T: UserEvent> TrayHandle for SystemTrayHandle<T> {
.map_err(|_| Error::FailedToSendMessage)
}
fn set_tooltip(&self, tooltip: &str) -> Result<()> {
self
.proxy
.send_event(Message::Tray(
self.id,
TrayMessage::UpdateTooltip(tooltip.to_owned()),
))
.map_err(|_| Error::FailedToSendMessage)
}
fn destroy(&self) -> Result<()> {
let (tx, rx) = std::sync::mpsc::channel();
send_user_message(

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@@ -1,29 +1,9 @@
# Changelog
## \[0.13.0]
## \[0.12.2]
- Added the `additional_browser_args` option when creating a window.
- [3dc38b15](https://www.github.com/tauri-apps/tauri/commit/3dc38b150ea8c59c8ba67fd586f921016928f47c) feat(core): expose additional_browser_args to window config (fix: [#5757](https://www.github.com/tauri-apps/tauri/pull/5757)) ([#5799](https://www.github.com/tauri-apps/tauri/pull/5799)) on 2022-12-14
- Added the `content_protected` option when creating a window and `Window::set_content_protected` to change it at runtime.
- [4ab5545b](https://www.github.com/tauri-apps/tauri/commit/4ab5545b7a831c549f3c65e74de487ede3ab7ce5) feat: add content protection api, closes [#5132](https://www.github.com/tauri-apps/tauri/pull/5132) ([#5513](https://www.github.com/tauri-apps/tauri/pull/5513)) on 2022-12-13
- Added `Builder::device_event_filter` and `App::set_device_event_filter` methods.
- [73fd60ee](https://www.github.com/tauri-apps/tauri/commit/73fd60eef2b60f5dc84525ef9c315f4d80c4414f) expose set_device_event_filter in tauri ([#5562](https://www.github.com/tauri-apps/tauri/pull/5562)) on 2022-12-13
- Add `is_minimized()` window method.
- [62144ef3](https://www.github.com/tauri-apps/tauri/commit/62144ef3be63b237869e511826edfb938e2c7174) feat: add is_minimized (fix [#3878](https://www.github.com/tauri-apps/tauri/pull/3878)) ([#5618](https://www.github.com/tauri-apps/tauri/pull/5618)) on 2022-12-13
- Bump minimum supported Rust version to 1.60.
- [5fdc616d](https://www.github.com/tauri-apps/tauri/commit/5fdc616df9bea633810dcb814ac615911d77222c) feat: Use the zbus-backed of notify-rust ([#6332](https://www.github.com/tauri-apps/tauri/pull/6332)) on 2023-03-31
- Pin raw-window-handle to 0.5.0 to keep MSRV.
- [c46c09f3](https://www.github.com/tauri-apps/tauri/commit/c46c09f31d9f5169ca8a7e62406a9ea170e3a5c5) fix(deps): pin raw-window-handle to 0.5.0 ([#6480](https://www.github.com/tauri-apps/tauri/pull/6480)) on 2023-03-17
- Added `navigation_handler` field on `PendingWindow`.
- [3f35b452](https://www.github.com/tauri-apps/tauri/commit/3f35b452637ef1c794a423f1eda62a15d2ddaf42) Expose wry navigation_handler via WindowBuilder closes [#4080](https://www.github.com/tauri-apps/tauri/pull/4080) ([#5686](https://www.github.com/tauri-apps/tauri/pull/5686)) on 2022-12-27
- Add `title` getter on window.
- [233e43b0](https://www.github.com/tauri-apps/tauri/commit/233e43b0c34fada1ca025378533a0b76931a6540) feat: add `title` getter on window, closes [#5023](https://www.github.com/tauri-apps/tauri/pull/5023) ([#5515](https://www.github.com/tauri-apps/tauri/pull/5515)) on 2022-12-13
- Added `TrayHandle::set_tooltip` and `SystemTray::with_tooltip`.
- [2265e097](https://www.github.com/tauri-apps/tauri/commit/2265e09718f6ebfeb1d200f11e1e1e069075af6e) feat(windows): implement `with_tooltip` ([#5938](https://www.github.com/tauri-apps/tauri/pull/5938)) on 2023-01-01
- Added window's `url()` getter.
- [d17027e1](https://www.github.com/tauri-apps/tauri/commit/d17027e1a0db3e8c5ae81fc4f472c5918fbce611) feat: expose url method ([#5914](https://www.github.com/tauri-apps/tauri/pull/5914)) on 2022-12-26
- On Windows, change webview theme based on Window theme for more accurate `prefers-color-scheme` support.
- [7a8d570d](https://www.github.com/tauri-apps/tauri/commit/7a8d570db72667367eb24b75ddc5dd07a968f7c0) fix: sync webview theme with window theme on Windows, closes [#5802](https://www.github.com/tauri-apps/tauri/pull/5802) ([#5874](https://www.github.com/tauri-apps/tauri/pull/5874)) on 2022-12-27
- Block remote URLs from accessing the IPC.
- [9c0593c33](https://www.github.com/tauri-apps/tauri/commit/9c0593c33af52cd9e00ec784d15f63efebdf039c) feat(core): block remote URLs from accessing the IPC on 2023-04-12
## \[0.12.1]

View File

@@ -1,6 +1,6 @@
[package]
name = "tauri-runtime"
version = "0.13.0"
version = "0.12.2"
authors = [ "Tauri Programme within The Commons Conservancy" ]
categories = [ "gui", "web-programming" ]
license = "Apache-2.0 OR MIT"
@@ -8,7 +8,7 @@ homepage = "https://tauri.app"
repository = "https://github.com/tauri-apps/tauri"
description = "Runtime for Tauri applications"
edition = "2021"
rust-version = "1.60"
rust-version = "1.59"
exclude = [ "CHANGELOG.md", "/target" ]
readme = "README.md"
@@ -26,13 +26,13 @@ targets = [
serde = { version = "1.0", features = [ "derive" ] }
serde_json = "1.0"
thiserror = "1.0"
tauri-utils = { version = "1.3.0", path = "../tauri-utils" }
tauri-utils = { version = "1.2.1", path = "../tauri-utils" }
uuid = { version = "1", features = [ "v4" ] }
http = "0.2.4"
http-range = "0.1.4"
raw-window-handle = "=0.5.0"
raw-window-handle = "0.5"
rand = "0.8"
url = { version = "2" }
url = "2"
[target."cfg(windows)".dependencies]
webview2-com = "0.19.1"

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
@@ -6,7 +6,7 @@
// `alias` must be a snake case string.
fn alias(alias: &str, has_feature: bool) {
if has_feature {
println!("cargo:rustc-cfg={alias}");
println!("cargo:rustc-cfg={}", alias);
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
@@ -10,7 +10,6 @@ use raw_window_handle::RawDisplayHandle;
use serde::Deserialize;
use std::{fmt::Debug, sync::mpsc::Sender};
use tauri_utils::Theme;
use url::Url;
use uuid::Uuid;
pub mod http;
@@ -54,7 +53,6 @@ pub struct SystemTray {
#[cfg(target_os = "macos")]
pub title: Option<String>,
pub on_event: Option<Box<TrayEventHandler>>,
pub tooltip: Option<String>,
}
#[cfg(all(desktop, feature = "system-tray"))]
@@ -88,7 +86,6 @@ impl Clone for SystemTray {
menu_on_left_click: self.menu_on_left_click,
#[cfg(target_os = "macos")]
title: self.title.clone(),
tooltip: self.tooltip.clone(),
}
}
}
@@ -107,7 +104,6 @@ impl Default for SystemTray {
#[cfg(target_os = "macos")]
title: None,
on_event: None,
tooltip: None,
}
}
}
@@ -160,17 +156,6 @@ impl SystemTray {
self
}
/// Sets the tray icon tooltip.
///
/// ## Platform-specific:
///
/// - **Linux:** Unsupported
#[must_use]
pub fn with_tooltip(mut self, tooltip: &str) -> Self {
self.tooltip = Some(tooltip.to_owned());
self
}
/// Sets the menu to show when the system tray is right clicked.
#[must_use]
pub fn with_menu(mut self, menu: menu::SystemTrayMenu) -> Self {
@@ -199,23 +184,6 @@ pub enum UserAttentionType {
Informational,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize)]
#[serde(tag = "type")]
pub enum DeviceEventFilter {
/// Always filter out device events.
Always,
/// Filter out device events while the window is not focused.
Unfocused,
/// Report all device events regardless of window focus.
Never,
}
impl Default for DeviceEventFilter {
fn default() -> Self {
Self::Unfocused
}
}
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
@@ -493,19 +461,6 @@ pub trait Runtime<T: UserEvent>: Debug + Sized + 'static {
#[cfg_attr(doc_cfg, doc(cfg(target_os = "macos")))]
fn hide(&self);
/// Change the device event filter mode.
///
/// Since the DeviceEvent capture can lead to high CPU usage for unfocused windows, [`tao`]
/// will ignore them by default for unfocused windows on Windows. This method allows changing
/// the filter to explicitly capture them again.
///
/// ## Platform-specific
///
/// - ** Linux / macOS / iOS / Android**: Unsupported.
///
/// [`tao`]: https://crates.io/crates/tao
fn set_device_event_filter(&mut self, filter: DeviceEventFilter);
/// Runs the one step of the webview runtime event loop and returns control flow to the caller.
#[cfg(desktop)]
fn run_iteration<F: Fn(RunEvent<T>) + 'static>(&mut self, callback: F) -> RunIteration;
@@ -545,9 +500,6 @@ pub trait Dispatch<T: UserEvent>: Debug + Clone + Send + Sync + Sized + 'static
// GETTERS
/// Returns the webview's current URL.
fn url(&self) -> Result<Url>;
/// Returns the scale factor that can be used to map logical pixels to physical pixels, and vice versa.
fn scale_factor(&self) -> Result<f64>;
@@ -570,9 +522,6 @@ pub trait Dispatch<T: UserEvent>: Debug + Clone + Send + Sync + Sized + 'static
/// Gets the window's current fullscreen state.
fn is_fullscreen(&self) -> Result<bool>;
/// Gets the window's current minimized state.
fn is_minimized(&self) -> Result<bool>;
/// Gets the window's current maximized state.
fn is_maximized(&self) -> Result<bool>;
@@ -584,8 +533,6 @@ pub trait Dispatch<T: UserEvent>: Debug + Clone + Send + Sync + Sized + 'static
/// Gets the window's current visibility state.
fn is_visible(&self) -> Result<bool>;
/// Gets the window's current title.
fn title(&self) -> Result<String>;
/// Gets the window menu current visibility state.
fn is_menu_visible(&self) -> Result<bool>;
@@ -676,9 +623,6 @@ pub trait Dispatch<T: UserEvent>: Debug + Clone + Send + Sync + Sized + 'static
/// Updates the window alwaysOnTop flag.
fn set_always_on_top(&self, always_on_top: bool) -> Result<()>;
/// Prevents the window contents from being captured by other apps.
fn set_content_protected(&self, protected: bool) -> Result<()>;
/// Resizes the window.
fn set_size(&self, size: Size) -> Result<()>;

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
@@ -154,7 +154,6 @@ pub trait TrayHandle: fmt::Debug + Clone + Send + Sync {
fn set_icon_as_template(&self, is_template: bool) -> crate::Result<()>;
#[cfg(target_os = "macos")]
fn set_title(&self, title: &str) -> crate::Result<()>;
fn set_tooltip(&self, tooltip: &str) -> crate::Result<()>;
fn destroy(&self) -> crate::Result<()>;
}

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
@@ -28,7 +28,6 @@ pub struct WebviewAttributes {
pub file_drop_handler_enabled: bool,
pub clipboard: bool,
pub accept_first_mouse: bool,
pub additional_browser_args: Option<String>,
}
impl WebviewAttributes {
@@ -42,7 +41,6 @@ impl WebviewAttributes {
file_drop_handler_enabled: true,
clipboard: false,
accept_first_mouse: false,
additional_browser_args: None,
}
}
@@ -90,13 +88,6 @@ impl WebviewAttributes {
self.accept_first_mouse = accept;
self
}
/// Sets additional browser arguments. **Windows Only**
#[must_use]
pub fn additional_browser_args(mut self, additional_args: &str) -> Self {
self.additional_browser_args = Some(additional_args.to_string());
self
}
}
/// Do **NOT** implement this trait except for use in a custom [`Runtime`](crate::Runtime).
@@ -181,10 +172,6 @@ pub trait WindowBuilder: WindowBuilderBase {
#[must_use]
fn always_on_top(self, always_on_top: bool) -> Self;
/// Prevents the window contents from being captured by other apps.
#[must_use]
fn content_protected(self, protected: bool) -> Self;
/// Sets the window icon.
fn icon(self, icon: Icon) -> crate::Result<Self>;

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@@ -1,22 +1,5 @@
# Changelog
## \[1.3.0]
- Added the `additional_browser_args` option to the window configuration.
- [3dc38b15](https://www.github.com/tauri-apps/tauri/commit/3dc38b150ea8c59c8ba67fd586f921016928f47c) feat(core): expose additional_browser_args to window config (fix: [#5757](https://www.github.com/tauri-apps/tauri/pull/5757)) ([#5799](https://www.github.com/tauri-apps/tauri/pull/5799)) on 2022-12-14
- Added the `content_protected` option to the window configuration.
- [4ab5545b](https://www.github.com/tauri-apps/tauri/commit/4ab5545b7a831c549f3c65e74de487ede3ab7ce5) feat: add content protection api, closes [#5132](https://www.github.com/tauri-apps/tauri/pull/5132) ([#5513](https://www.github.com/tauri-apps/tauri/pull/5513)) on 2022-12-13
- Correctly determine mime type of `.less`, `.sass` and `.styl` files.
- [5fdf8dcb](https://www.github.com/tauri-apps/tauri/commit/5fdf8dcb8ed171d06121dceb32078a7e4f86cc64) fix(core): mime type of .less, .sass and .styl files ([#6316](https://www.github.com/tauri-apps/tauri/pull/6316)) on 2023-02-19
- Bump minimum supported Rust version to 1.60.
- [5fdc616d](https://www.github.com/tauri-apps/tauri/commit/5fdc616df9bea633810dcb814ac615911d77222c) feat: Use the zbus-backed of notify-rust ([#6332](https://www.github.com/tauri-apps/tauri/pull/6332)) on 2023-03-31
- Add initial support for building `nsis` bundles on non-Windows platforms.
- [60e6f6c3](https://www.github.com/tauri-apps/tauri/commit/60e6f6c3f1605f3064b5bb177992530ff788ccf0) feat(bundler): Add support for creating NSIS bundles on unix hosts ([#5788](https://www.github.com/tauri-apps/tauri/pull/5788)) on 2023-01-19
- Add `nsis` bundle target
- [c94e1326](https://www.github.com/tauri-apps/tauri/commit/c94e1326a7c0767a13128a8b1d327a00156ece12) feat(bundler): add `nsis`, closes [#4450](https://www.github.com/tauri-apps/tauri/pull/4450), closes [#2319](https://www.github.com/tauri-apps/tauri/pull/2319) ([#4674](https://www.github.com/tauri-apps/tauri/pull/4674)) on 2023-01-03
- Added configuration to specify remote URLs allowed to access the IPC.
- [ee71c31f](https://www.github.com/tauri-apps/tauri/commit/ee71c31fd09cc5427da6d29d37c003a914547696) feat(core): allow configuring remote domains with IPC access, closes [#5088](https://www.github.com/tauri-apps/tauri/pull/5088) ([#5918](https://www.github.com/tauri-apps/tauri/pull/5918)) on 2023-04-11
## \[1.2.1]
- Fix `allowlist > app > show/hide` always disabled when `allowlist > app > all: false`.

View File

@@ -1,41 +1,41 @@
[package]
name = "tauri-utils"
version = "1.3.0"
version = "1.2.1"
authors = [ "Tauri Programme within The Commons Conservancy" ]
license = "Apache-2.0 OR MIT"
homepage = "https://tauri.app"
repository = "https://github.com/tauri-apps/tauri"
description = "Utilities for Tauri"
edition = "2021"
rust-version = "1.60"
rust-version = "1.59"
exclude = [ "CHANGELOG.md", "/target" ]
readme = "README.md"
[dependencies]
serde = { version = "1", features = [ "derive" ] }
serde_json = "1"
thiserror = "1"
serde = { version = "1.0", features = [ "derive" ] }
serde_json = "1.0"
thiserror = "1.0.30"
phf = { version = "0.10", features = [ "macros" ] }
brotli = { version = "3", optional = true, default-features = false, features = [ "std" ] }
url = { version = "2", features = [ "serde" ] }
url = { version = "2.2", features = [ "serde" ] }
kuchiki = "0.8"
html5ever = "0.25"
proc-macro2 = { version = "1", optional = true }
quote = { version = "1", optional = true }
proc-macro2 = { version = "1.0", optional = true }
quote = { version = "1.0", optional = true }
schemars = { version = "0.8", features = [ "url" ], optional = true }
serde_with = "2"
aes-gcm = { version = "0.10", optional = true }
serde_with = "1.12"
aes-gcm = { version = "0.9", optional = true }
getrandom = { version = "0.2", optional = true, features = [ "std" ] }
serialize-to-javascript = { version = "=0.1.1", optional = true }
ctor = "0.1"
json5 = { version = "0.4", optional = true }
toml = { version = "0.5", optional = true }
json-patch = "1.0"
glob = { version = "0.3", optional = true }
json-patch = "0.2"
glob = { version = "0.3.0", optional = true }
walkdir = { version = "2", optional = true }
memchr = "2"
memchr = "2.4"
semver = "1"
infer = "0.12"
infer = "0.7"
[target."cfg(target_os = \"linux\")".dependencies]
heck = "0.4"

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
@@ -174,7 +174,8 @@ impl Assets for EmbeddedAssets {
.get(html_path.as_ref())
.copied()
.into_iter()
.flatten(),
.flatten()
.into_iter(),
)
.copied(),
)

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
@@ -55,7 +55,7 @@ pub enum WindowUrl {
impl fmt::Display for WindowUrl {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::External(url) => write!(f, "{url}"),
Self::External(url) => write!(f, "{}", url),
Self::App(path) => write!(f, "{}", path.display()),
}
}
@@ -78,8 +78,6 @@ pub enum BundleType {
AppImage,
/// The Microsoft Installer bundle (.msi).
Msi,
/// The NSIS bundle (.exe).
Nsis,
/// The macOS application bundle (.app).
App,
/// The Apple Disk Image bundle (.dmg).
@@ -97,7 +95,6 @@ impl Display for BundleType {
Self::Deb => "deb",
Self::AppImage => "appimage",
Self::Msi => "msi",
Self::Nsis => "nsis",
Self::App => "app",
Self::Dmg => "dmg",
Self::Updater => "updater",
@@ -125,11 +122,10 @@ impl<'de> Deserialize<'de> for BundleType {
"deb" => Ok(Self::Deb),
"appimage" => Ok(Self::AppImage),
"msi" => Ok(Self::Msi),
"nsis" => Ok(Self::Nsis),
"app" => Ok(Self::App),
"dmg" => Ok(Self::Dmg),
"updater" => Ok(Self::Updater),
_ => Err(DeError::custom(format!("unknown bundle target '{s}'"))),
_ => Err(DeError::custom(format!("unknown bundle target '{}'", s))),
}
}
}
@@ -227,7 +223,7 @@ impl<'de> Deserialize<'de> for BundleTarget {
match BundleTargetInner::deserialize(deserializer)? {
BundleTargetInner::All(s) if s.to_lowercase() == "all" => Ok(Self::All),
BundleTargetInner::All(t) => Err(DeError::custom(format!("invalid bundle type {t}"))),
BundleTargetInner::All(t) => Err(DeError::custom(format!("invalid bundle type {}", t))),
BundleTargetInner::List(l) => Ok(Self::List(l)),
BundleTargetInner::One(t) => Ok(Self::One(t)),
}
@@ -247,8 +243,6 @@ impl BundleTarget {
}
/// Configuration for AppImage bundles.
///
/// See more: https://tauri.app/v1/api/config#appimageconfig
#[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
@@ -260,8 +254,6 @@ pub struct AppImageConfig {
}
/// Configuration for Debian (.deb) bundles.
///
/// See more: https://tauri.app/v1/api/config#debconfig
#[skip_serializing_none]
#[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
@@ -286,8 +278,6 @@ where
}
/// Configuration for the macOS bundles.
///
/// See more: https://tauri.app/v1/api/config#macconfig
#[skip_serializing_none]
#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
@@ -344,8 +334,6 @@ fn minimum_system_version() -> Option<String> {
}
/// Configuration for a target language for the WiX build.
///
/// See more: https://tauri.app/v1/api/config#wixlanguageconfig
#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
@@ -375,8 +363,6 @@ impl Default for WixLanguage {
}
/// Configuration for the MSI bundle using WiX.
///
/// See more: https://tauri.app/v1/api/config#wixconfig
#[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
@@ -430,71 +416,6 @@ pub struct WixConfig {
pub dialog_image_path: Option<PathBuf>,
}
/// Configuration for the Installer bundle using NSIS.
#[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct NsisConfig {
/// The path to the license file to render on the installer.
pub license: Option<PathBuf>,
/// The path to a bitmap file to display on the header of installers pages.
///
/// The recommended dimensions are 150px x 57px.
#[serde(alias = "header-image")]
pub header_image: Option<PathBuf>,
/// The path to a bitmap file for the Welcome page and the Finish page.
///
/// The recommended dimensions are 164px x 314px.
#[serde(alias = "sidebar-image")]
pub sidebar_image: Option<PathBuf>,
/// The path to an icon file used as the installer icon.
#[serde(alias = "install-icon")]
pub installer_icon: Option<PathBuf>,
/// Whether the installation will be for all users or just the current user.
#[serde(default, alias = "install-mode")]
pub install_mode: NSISInstallerMode,
/// A list of installer languages.
/// By default the OS language is used. If the OS language is not in the list of languages, the first language will be used.
/// To allow the user to select the language, set `display_language_selector` to `true`.
///
/// See <https://github.com/kichik/nsis/tree/9465c08046f00ccb6eda985abbdbf52c275c6c4d/Contrib/Language%20files> for the complete list of languages.
pub languages: Option<Vec<String>>,
/// Whether to display a language selector dialog before the installer and uninstaller windows are rendered or not.
/// By default the OS language is selected, with a fallback to the first language in the `languages` array.
#[serde(default, alias = "display-language-selector")]
pub display_language_selector: bool,
}
/// Install Modes for the NSIS installer.
#[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize, Deserialize)]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
pub enum NSISInstallerMode {
/// Default mode for the installer.
///
/// Install the app by default in a directory that doesn't require Administrator access.
///
/// Installer metadata will be saved under the `HKCU` registry path.
CurrentUser,
/// Install the app by default in the `Program Files` folder directory requires Administrator
/// access for the installation.
///
/// Installer metadata will be saved under the `HKLM` registry path.
PerMachine,
/// Combines both modes and allows the user to choose at install time
/// whether to install for the current user or per machine. Note that this mode
/// will require Administrator access even if the user wants to install it for the current user only.
///
/// Installer metadata will be saved under the `HKLM` or `HKCU` registry path based on the user's choice.
Both,
}
impl Default for NSISInstallerMode {
fn default() -> Self {
Self::CurrentUser
}
}
/// Install modes for the Webview2 runtime.
/// Note that for the updater bundle [`Self::DownloadBootstrapper`] is used.
///
@@ -506,7 +427,7 @@ pub enum WebviewInstallMode {
/// Do not install the Webview2 as part of the Windows Installer.
Skip,
/// Download the bootstrapper and run it.
/// Requires an internet connection.
/// Requires internet connection.
/// Results in a smaller installer size, but is not recommended on Windows 7.
DownloadBootstrapper {
/// Instructs the installer to run the bootstrapper in silent mode. Defaults to `true`.
@@ -514,7 +435,7 @@ pub enum WebviewInstallMode {
silent: bool,
},
/// Embed the bootstrapper and run it.
/// Requires an internet connection.
/// Requires internet connection.
/// Increases the installer size by around 1.8MB, but offers better support on Windows 7.
EmbedBootstrapper {
/// Instructs the installer to run the bootstrapper in silent mode. Defaults to `true`.
@@ -522,7 +443,7 @@ pub enum WebviewInstallMode {
silent: bool,
},
/// Embed the offline installer and run it.
/// Does not require an internet connection.
/// Does not require internet connection.
/// Increases the installer size by around 127MB.
OfflineInstaller {
/// Instructs the installer to run the installer in silent mode. Defaults to `true`.
@@ -553,8 +474,6 @@ impl Default for WebviewInstallMode {
}
/// Windows bundler configuration.
///
/// See more: https://tauri.app/v1/api/config#windowsconfig
#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
@@ -593,8 +512,6 @@ pub struct WindowsConfig {
pub allow_downgrades: bool,
/// Configuration for the MSI generated with WiX.
pub wix: Option<WixConfig>,
/// Configuration for the installer generated with NSIS.
pub nsis: Option<NsisConfig>,
}
impl Default for WindowsConfig {
@@ -608,7 +525,6 @@ impl Default for WindowsConfig {
webview_fixed_runtime_path: None,
allow_downgrades: default_allow_downgrades(),
wix: None,
nsis: None,
}
}
}
@@ -618,8 +534,6 @@ fn default_allow_downgrades() -> bool {
}
/// Configuration for tauri-bundler.
///
/// See more: https://tauri.app/v1/api/config#bundleconfig
#[skip_serializing_none]
#[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
@@ -628,7 +542,7 @@ pub struct BundleConfig {
/// Whether Tauri should bundle your application or just output the executable.
#[serde(default)]
pub active: bool,
/// The bundle targets, currently supports ["deb", "appimage", "nsis", "msi", "app", "dmg", "updater"] or "all".
/// The bundle targets, currently supports ["deb", "appimage", "msi", "app", "dmg", "updater"] or "all".
#[serde(default)]
pub targets: BundleTarget,
/// The application identifier in reverse domain name notation (e.g. `com.tauri.example`).
@@ -808,8 +722,6 @@ pub struct CliArg {
}
/// describes a CLI configuration
///
/// See more: https://tauri.app/v1/api/config#cliconfig
#[skip_serializing_none]
#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
@@ -873,8 +785,6 @@ impl CliConfig {
}
/// The window configuration object.
///
/// See more: https://tauri.app/v1/api/config#windowconfig
#[skip_serializing_none]
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
@@ -949,9 +859,6 @@ pub struct WindowConfig {
/// Whether the window should always be on top of other windows.
#[serde(default, alias = "always-on-top")]
pub always_on_top: bool,
/// Prevents the window contents from being captured by other apps.
#[serde(default, alias = "content-protected")]
pub content_protected: bool,
/// If `true`, hides the window icon from the taskbar on Windows and Linux.
#[serde(default, alias = "skip-taskbar")]
pub skip_taskbar: bool,
@@ -974,10 +881,6 @@ pub struct WindowConfig {
/// [tabbing identifier]: <https://developer.apple.com/documentation/appkit/nswindow/1644704-tabbingidentifier>
#[serde(default, alias = "tabbing-identifier")]
pub tabbing_identifier: Option<String>,
/// Defines additional browser arguments on Windows. By default wry passes `--disable-features=msWebOOUI,msPdfOOUI,msSmartScreenProtection`
/// so if you use this method, you also need to disable these components by yourself if you want.
#[serde(default, alias = "additional-browser-args")]
pub additional_browser_args: Option<String>,
}
impl Default for WindowConfig {
@@ -1005,14 +908,12 @@ impl Default for WindowConfig {
visible: default_visible(),
decorations: default_decorations(),
always_on_top: false,
content_protected: false,
skip_taskbar: false,
theme: None,
title_bar_style: Default::default(),
hidden_title: false,
accept_first_mouse: false,
tabbing_identifier: None,
additional_browser_args: None,
}
}
}
@@ -1084,7 +985,7 @@ impl CspDirectiveSources {
/// Whether the given source is configured on this directive or not.
pub fn contains(&self, source: &str) -> bool {
match self {
Self::Inline(s) => s.contains(&format!("{source} ")) || s.contains(&format!(" {source}")),
Self::Inline(s) => s.contains(&format!("{} ", source)) || s.contains(&format!(" {}", source)),
Self::List(l) => l.contains(&source.into()),
}
}
@@ -1150,7 +1051,7 @@ impl From<Csp> for HashMap<String, CspDirectiveSources> {
impl Display for Csp {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Policy(s) => write!(f, "{s}"),
Self::Policy(s) => write!(f, "{}", s),
Self::DirectiveMap(m) => {
let len = m.len();
let mut i = 0;
@@ -1196,28 +1097,7 @@ impl Default for DisabledCspModificationKind {
}
}
/// External command access definition.
#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct RemoteDomainAccessScope {
/// The URL scheme to allow. By default, all schemas are allowed.
pub scheme: Option<String>,
/// The domain to allow.
pub domain: String,
/// The list of window labels this scope applies to.
pub windows: Vec<String>,
/// The list of plugins that are allowed in this scope.
#[serde(default)]
pub plugins: Vec<String>,
/// Enables access to the Tauri API.
#[serde(default, rename = "enableTauriAPI", alias = "enable-tauri-api")]
pub enable_tauri_api: bool,
}
/// Security configuration.
///
/// See more: https://tauri.app/v1/api/config#securityconfig
#[skip_serializing_none]
#[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
@@ -1252,20 +1132,6 @@ pub struct SecurityConfig {
/// Your application might be vulnerable to XSS attacks without this Tauri protection.
#[serde(default, alias = "dangerous-disable-asset-csp-modification")]
pub dangerous_disable_asset_csp_modification: DisabledCspModificationKind,
/// Allow external domains to send command to Tauri.
///
/// By default, external domains do not have access to `window.__TAURI__`, which means they cannot
/// communicate with the commands defined in Rust. This prevents attacks where an externally
/// loaded malicious or compromised sites could start executing commands on the user's device.
///
/// This configuration allows a set of external domains to have access to the Tauri commands.
/// When you configure a domain to be allowed to access the IPC, all subpaths are allowed. Subdomains are not allowed.
///
/// **WARNING:** Only use this option if you either have internal checks against malicious
/// external sites or you can trust the allowed external sites. You application might be
/// vulnerable to dangerous Tauri command related attacks otherwise.
#[serde(default, alias = "dangerous-remote-domain-ipc-access")]
pub dangerous_remote_domain_ipc_access: Vec<RemoteDomainAccessScope>,
}
/// Defines an allowlist type.
@@ -1335,8 +1201,6 @@ impl FsAllowlistScope {
}
/// Allowlist for the file system APIs.
///
/// See more: https://tauri.app/v1/api/config#fsallowlistconfig
#[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
@@ -1416,8 +1280,6 @@ impl Allowlist for FsAllowlistConfig {
}
/// Allowlist for the window APIs.
///
/// See more: https://tauri.app/v1/api/config#windowallowlistconfig
#[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
@@ -1467,9 +1329,6 @@ pub struct WindowAllowlistConfig {
/// Allows setting the always_on_top flag of the window.
#[serde(default, alias = "set-always-on-top")]
pub set_always_on_top: bool,
/// Allows preventing the window contents from being captured by other apps.
#[serde(default, alias = "set-content-protected")]
pub set_content_protected: bool,
/// Allows setting the window size.
#[serde(default, alias = "set-size")]
pub set_size: bool,
@@ -1535,7 +1394,6 @@ impl Allowlist for WindowAllowlistConfig {
close: true,
set_decorations: true,
set_always_on_top: true,
set_content_protected: false,
set_size: true,
set_min_size: true,
set_max_size: true,
@@ -1586,12 +1444,6 @@ impl Allowlist for WindowAllowlistConfig {
set_always_on_top,
"window-set-always-on-top"
);
check_feature!(
self,
features,
set_content_protected,
"window-set-content-protected"
);
check_feature!(self, features, set_size, "window-set-size");
check_feature!(self, features, set_min_size, "window-set-min-size");
check_feature!(self, features, set_max_size, "window-set-max-size");
@@ -1747,7 +1599,7 @@ pub struct ShellAllowlistScope(pub Vec<ShellAllowedCommand>);
pub enum ShellAllowlistOpen {
/// If the shell open API should be enabled.
///
/// If enabled, the default validation regex (`^((mailto:\w+)|(tel:\w+)|(https?://\w+)).+`) is used.
/// If enabled, the default validation regex (`^https?://`) is used.
Flag(bool),
/// Enable the shell open API, with a custom regex that the opened path must match against.
@@ -1764,8 +1616,6 @@ impl Default for ShellAllowlistOpen {
}
/// Allowlist for the shell APIs.
///
/// See more: https://tauri.app/v1/api/config#shellallowlistconfig
#[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
@@ -1822,8 +1672,6 @@ impl Allowlist for ShellAllowlistConfig {
}
/// Allowlist for the dialog APIs.
///
/// See more: https://tauri.app/v1/api/config#dialogallowlistconfig
#[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
@@ -1892,8 +1740,6 @@ impl Allowlist for DialogAllowlistConfig {
pub struct HttpAllowlistScope(pub Vec<Url>);
/// Allowlist for the HTTP APIs.
///
/// See more: https://tauri.app/v1/api/config#httpallowlistconfig
#[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
@@ -1933,8 +1779,6 @@ impl Allowlist for HttpAllowlistConfig {
}
/// Allowlist for the notification APIs.
///
/// See more: https://tauri.app/v1/api/config#notificationallowlistconfig
#[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
@@ -1962,8 +1806,6 @@ impl Allowlist for NotificationAllowlistConfig {
}
/// Allowlist for the global shortcut APIs.
///
/// See more: https://tauri.app/v1/api/config#globalshortcutallowlistconfig
#[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
@@ -1991,8 +1833,6 @@ impl Allowlist for GlobalShortcutAllowlistConfig {
}
/// Allowlist for the OS APIs.
///
/// See more: https://tauri.app/v1/api/config#osallowlistconfig
#[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
@@ -2020,8 +1860,6 @@ impl Allowlist for OsAllowlistConfig {
}
/// Allowlist for the path APIs.
///
/// See more: https://tauri.app/v1/api/config#pathallowlistconfig
#[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
@@ -2049,8 +1887,6 @@ impl Allowlist for PathAllowlistConfig {
}
/// Allowlist for the custom protocols.
///
/// See more: https://tauri.app/v1/api/config#protocolallowlistconfig
#[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
@@ -2090,8 +1926,6 @@ impl Allowlist for ProtocolAllowlistConfig {
}
/// Allowlist for the process APIs.
///
/// See more: https://tauri.app/v1/api/config#processallowlistconfig
#[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
@@ -2149,8 +1983,6 @@ impl Allowlist for ProcessAllowlistConfig {
}
/// Allowlist for the clipboard APIs.
///
/// See more: https://tauri.app/v1/api/config#clipboardallowlistconfig
#[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
@@ -2191,8 +2023,6 @@ impl Allowlist for ClipboardAllowlistConfig {
}
/// Allowlist for the app APIs.
///
/// See more: https://tauri.app/v1/api/config#appallowlistconfig
#[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
@@ -2232,16 +2062,7 @@ impl Allowlist for AppAllowlistConfig {
}
}
/// Allowlist configuration. The allowlist is a translation of the [Cargo allowlist features](https://docs.rs/tauri/latest/tauri/#cargo-allowlist-features).
///
/// # Notes
///
/// - Endpoints that don't have their own allowlist option are enabled by default.
/// - There is only "opt-in", no "opt-out". Setting an option to `false` has no effect.
///
/// # Examples
///
/// - * [`"app-all": true`](https://tauri.app/v1/api/config/#appallowlistconfig.all) will make the [hide](https://tauri.app/v1/api/js/app#hide) endpoint be available regardless of whether `hide` is set to `false` or `true` in the allowlist.
/// Allowlist configuration.
#[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
@@ -2354,8 +2175,6 @@ impl Default for PatternKind {
}
/// The Tauri configuration object.
///
/// See more: https://tauri.app/v1/api/config#tauriconfig
#[skip_serializing_none]
#[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
@@ -2468,7 +2287,7 @@ pub enum WindowsUpdateInstallMode {
/// Specifies there's a basic UI during the installation process, including a final dialog box at the end.
BasicUi,
/// The quiet mode means there's no user interaction required.
/// Requires admin privileges if the installer does (WiX).
/// Requires admin privileges if the installer does.
Quiet,
/// Specifies unattended mode, which means the installation only shows a progress bar.
Passive,
@@ -2527,31 +2346,25 @@ impl<'de> Deserialize<'de> for WindowsUpdateInstallMode {
"quiet" => Ok(Self::Quiet),
"passive" => Ok(Self::Passive),
_ => Err(DeError::custom(format!(
"unknown update install mode '{s}'"
"unknown update install mode '{}'",
s
))),
}
}
}
/// The updater configuration for Windows.
///
/// See more: https://tauri.app/v1/api/config#updaterwindowsconfig
#[skip_serializing_none]
#[derive(Debug, Default, PartialEq, Eq, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct UpdaterWindowsConfig {
/// Additional arguments given to the NSIS or WiX installer.
#[serde(default, alias = "installer-args")]
pub installer_args: Vec<String>,
/// The installation mode for the update on Windows. Defaults to `passive`.
#[serde(default, alias = "install-mode")]
pub install_mode: WindowsUpdateInstallMode,
}
/// The Updater configuration object.
///
/// See more: https://tauri.app/v1/api/config#updaterconfig
#[skip_serializing_none]
#[derive(Debug, PartialEq, Eq, Clone, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
@@ -2631,8 +2444,6 @@ impl Default for UpdaterConfig {
}
/// Configuration for application system tray icon.
///
/// See more: https://tauri.app/v1/api/config#systemtrayconfig
#[skip_serializing_none]
#[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
@@ -2680,7 +2491,7 @@ pub enum AppUrl {
impl std::fmt::Display for AppUrl {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Url(url) => write!(f, "{url}"),
Self::Url(url) => write!(f, "{}", url),
Self::Files(files) => write!(f, "{}", serde_json::to_string(files).unwrap()),
}
}
@@ -2722,8 +2533,6 @@ pub enum HookCommand {
}
/// The Build configuration object.
///
/// See more: https://tauri.app/v1/api/config#buildconfig
#[skip_serializing_none]
#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
@@ -2821,9 +2630,9 @@ impl<'d> serde::Deserialize<'d> for PackageVersion {
let path = PathBuf::from(value);
if path.exists() {
let json_str = read_to_string(&path)
.map_err(|e| DeError::custom(format!("failed to read version JSON file: {e}")))?;
.map_err(|e| DeError::custom(format!("failed to read version JSON file: {}", e)))?;
let package_json: serde_json::Value = serde_json::from_str(&json_str)
.map_err(|e| DeError::custom(format!("failed to read version JSON file: {e}")))?;
.map_err(|e| DeError::custom(format!("failed to read version JSON file: {}", e)))?;
if let Some(obj) = package_json.as_object() {
let version = obj
.get("version")
@@ -2857,8 +2666,6 @@ impl<'d> serde::Deserialize<'d> for PackageVersion {
}
/// The package configuration.
///
/// See more: https://tauri.app/v1/api/config#packageconfig
#[derive(Debug, Clone, Default, PartialEq, Eq, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
@@ -2988,8 +2795,6 @@ pub struct Config {
}
/// The plugin configs holds a HashMap mapping a plugin name to its configuration object.
///
/// See more: https://tauri.app/v1/api/config#pluginconfig
#[derive(Debug, Clone, Default, PartialEq, Eq, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
pub struct PluginConfig(pub HashMap<String, JsonValue>);
@@ -3235,14 +3040,12 @@ mod build {
let visible = self.visible;
let decorations = self.decorations;
let always_on_top = self.always_on_top;
let content_protected = self.content_protected;
let skip_taskbar = self.skip_taskbar;
let theme = opt_lit(self.theme.as_ref());
let title_bar_style = &self.title_bar_style;
let hidden_title = self.hidden_title;
let accept_first_mouse = self.accept_first_mouse;
let tabbing_identifier = opt_str_lit(self.tabbing_identifier.as_ref());
let additional_browser_args = opt_str_lit(self.additional_browser_args.as_ref());
literal_struct!(
tokens,
@@ -3269,14 +3072,12 @@ mod build {
visible,
decorations,
always_on_top,
content_protected,
skip_taskbar,
theme,
title_bar_style,
hidden_title,
accept_first_mouse,
tabbing_identifier,
additional_browser_args
tabbing_identifier
);
}
}
@@ -3532,8 +3333,7 @@ mod build {
impl ToTokens for UpdaterWindowsConfig {
fn to_tokens(&self, tokens: &mut TokenStream) {
let install_mode = &self.install_mode;
let installer_args = vec_lit(&self.installer_args, str_lit);
literal_struct!(tokens, UpdaterWindowsConfig, install_mode, installer_args);
literal_struct!(tokens, UpdaterWindowsConfig, install_mode);
}
}
@@ -3623,34 +3423,12 @@ mod build {
}
}
impl ToTokens for RemoteDomainAccessScope {
fn to_tokens(&self, tokens: &mut TokenStream) {
let scheme = opt_str_lit(self.scheme.as_ref());
let domain = str_lit(&self.domain);
let windows = vec_lit(&self.windows, str_lit);
let plugins = vec_lit(&self.plugins, str_lit);
let enable_tauri_api = self.enable_tauri_api;
literal_struct!(
tokens,
RemoteDomainAccessScope,
scheme,
domain,
windows,
plugins,
enable_tauri_api
);
}
}
impl ToTokens for SecurityConfig {
fn to_tokens(&self, tokens: &mut TokenStream) {
let csp = opt_lit(self.csp.as_ref());
let dev_csp = opt_lit(self.dev_csp.as_ref());
let freeze_prototype = self.freeze_prototype;
let dangerous_disable_asset_csp_modification = &self.dangerous_disable_asset_csp_modification;
let dangerous_remote_domain_ipc_access =
vec_lit(&self.dangerous_remote_domain_ipc_access, identity);
literal_struct!(
tokens,
@@ -3658,8 +3436,7 @@ mod build {
csp,
dev_csp,
freeze_prototype,
dangerous_disable_asset_csp_modification,
dangerous_remote_domain_ipc_access
dangerous_disable_asset_csp_modification
);
}
}
@@ -3924,7 +3701,6 @@ mod test {
dev_csp: None,
freeze_prototype: false,
dangerous_disable_asset_csp_modification: DisabledCspModificationKind::Flag(false),
dangerous_remote_domain_ipc_access: Vec::new(),
},
allowlist: AllowlistConfig::default(),
system_tray: None,

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
@@ -37,7 +37,7 @@ fn serialize_node_ref_internal<S: Serializer>(
traversal_scope: TraversalScope,
) -> crate::Result<()> {
match (traversal_scope, node.data()) {
(ref scope, NodeData::Element(element)) => {
(ref scope, &NodeData::Element(ref element)) => {
if *scope == TraversalScope::IncludeNode {
let attrs = element.attributes.borrow();
@@ -82,16 +82,16 @@ fn serialize_node_ref_internal<S: Serializer>(
(TraversalScope::ChildrenOnly(_), _) => Ok(()),
(TraversalScope::IncludeNode, NodeData::Doctype(doctype)) => {
(TraversalScope::IncludeNode, &NodeData::Doctype(ref doctype)) => {
serializer.write_doctype(&doctype.name).map_err(Into::into)
}
(TraversalScope::IncludeNode, NodeData::Text(text)) => {
(TraversalScope::IncludeNode, &NodeData::Text(ref text)) => {
serializer.write_text(&text.borrow()).map_err(Into::into)
}
(TraversalScope::IncludeNode, NodeData::Comment(text)) => {
(TraversalScope::IncludeNode, &NodeData::Comment(ref text)) => {
serializer.write_comment(&text.borrow()).map_err(Into::into)
}
(TraversalScope::IncludeNode, NodeData::ProcessingInstruction(contents)) => {
(TraversalScope::IncludeNode, &NodeData::ProcessingInstruction(ref contents)) => {
let contents = contents.borrow();
serializer
.write_processing_instruction(&contents.0, &contents.1)

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@@ -1,14 +1,11 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
//! Tauri utility helpers
#![warn(missing_docs, rust_2018_idioms)]
use std::{
fmt::Display,
path::{Path, PathBuf},
};
use std::fmt::Display;
use semver::Version;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
@@ -297,12 +294,3 @@ macro_rules! debug_eprintln {
$crate::consume_unused_variable!($($arg)*);
};
}
/// Reconstructs a path from its components using the platform separator then converts it to String
pub fn display_path<P: AsRef<Path>>(p: P) -> String {
p.as_ref()
.components()
.collect::<PathBuf>()
.display()
.to_string()
}

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
@@ -39,7 +39,7 @@ impl std::fmt::Display for MimeType {
MimeType::Svg => "image/svg+xml",
MimeType::Mp4 => "video/mp4",
};
write!(f, "{mime}")
write!(f, "{}", mime)
}
}
@@ -49,7 +49,7 @@ impl MimeType {
let suffix = uri.split('.').last();
match suffix {
Some("bin") => Self::OctetStream,
Some("css" | "less" | "sass" | "styl") => Self::Css,
Some("css") => Self::Css,
Some("csv") => Self::Csv,
Some("html") => Self::Html,
Some("ico") => Self::Ico,

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
@@ -43,7 +43,7 @@
algorithm.iv = window.crypto.getRandomValues(new Uint8Array(12))
let encoder = new TextEncoder()
let payloadRaw = encoder.encode(__RAW_stringify_ipc_message_fn__(data))
let payloadRaw = encoder.encode(JSON.stringify(data))
return window.crypto.subtle
.encrypt(algorithm, aesGcmKey, payloadRaw)

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
@@ -8,7 +8,7 @@ use std::fmt::{Debug, Formatter};
use std::string::FromUtf8Error;
use aes_gcm::aead::Aead;
use aes_gcm::{Aes256Gcm, KeyInit, Nonce};
use aes_gcm::{aead::NewAead, Aes256Gcm, Nonce};
use getrandom::{getrandom, Error as CsprngError};
use serialize_to_javascript::{default_template, Template};
@@ -57,7 +57,7 @@ impl AesGcmPair {
fn new() -> Result<Self, Error> {
let mut raw = [0u8; 32];
getrandom(&mut raw)?;
let key = aes_gcm::Key::<Aes256Gcm>::from_slice(&raw);
let key = aes_gcm::Key::from_slice(&raw);
Ok(Self {
raw,
key: Aes256Gcm::new(key),
@@ -141,9 +141,6 @@ pub struct IsolationJavascriptCodegen {
pub struct IsolationJavascriptRuntime<'a> {
/// The key used on the Rust backend and the Isolation Javascript
pub runtime_aes_gcm_key: &'a [u8; 32],
/// The function that stringifies a IPC message.
#[raw]
pub stringify_ipc_message_fn: &'a str,
}
#[cfg(test)]

Some files were not shown because too many files have changed in this diff Show More