Compare commits

...

368 Commits

Author SHA1 Message Date
Lucas Nogueira
cf331cdc3e fix(core): lint 2024-07-01 23:54:56 -03:00
Lucas Nogueira
574076541a fix(ci): downgrade crates for MSRV check 2024-07-01 23:52:09 -03:00
github-actions[bot]
89f3048f52 apply version updates (#9871)
Co-authored-by: lucasfernog <lucasfernog@users.noreply.github.com>
2024-07-01 23:13:05 -03:00
Amr Bashir
08f57efefd fix(cli): parse --profile=<profile> syntax (#10136)
* fix(cli): parse `--profile=<profile>` syntax

ref: https://github.com/tauri-apps/tauri/issues/6255#issuecomment-2192466839

* Update tooling/cli/src/interface/rust.rs

* derive default

* safe check next arg

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
2024-06-27 06:53:29 -03:00
Fabian-Lars
63da834ce4 ci: Fix msrv check (#10118)
* ci: Fix os_pipe precise version

* reading is hard

* downgrade syn

* more specific

* WHO DO YOU CALL UNSTABLE

* i just want to go to bed
2024-06-25 02:58:20 +03:00
chip
c2d3afa4fb prevent uncomment collision in 1.x invoke_key templating (fix #10084) (#10087)
* don't use invoke key template name in comment (fix #10084)

* undo whitespace change
2024-06-18 19:42:19 +03:00
Harry Mallon
924387092e feat: add dmg settings, cherry picked from #7964 (#8334)
* feat(bundler): add dmg settings, closes #4669 (#7964)

* fix(bundler): lint and cleanup for #7964 (#8275)

* fmt

---------

Co-authored-by: Andrew <andrey255@live.com>
Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.app>
Co-authored-by: FabianLars <fabianlars@fabianlars.de>
2024-06-17 13:25:12 +02:00
Pylogmon
d2786bf699 chore(template): template format error (#10018)
* chore(template): template format error

* fix
2024-06-12 04:30:24 +03:00
Pylogmon
674accad75 fix: missing depends for rpm package (#10015)
* fix: missing depends for rpm package

* chore: add changes
2024-06-12 04:24:03 +03:00
Fabian-Lars
09152d83e1 ci(msrv-list): Downgrade os_pipe (#10014) 2024-06-11 21:12:44 +03:00
Fabian-Lars
3752eb1e6b ci(msrv-list): downgrade hyper earlier (#10002) 2024-06-06 17:42:42 +03:00
Fabian-Lars
d104abb656 fix(bench): Update time, backport of #9993 (#10000)
* fix(bench): Update time, backport of #9993

* x
2024-06-06 16:07:32 +03:00
anatawa12
940aa183c7 fix(nsis): run app as normal user (#9944) (#9995)
(cherry picked from commit 6f469534b0)

Co-authored-by: Tony <68118705+Legend-Master@users.noreply.github.com>
2024-06-06 15:00:23 +02:00
anatawa12
a423c52c1c fix(cli): not working with license.workspace = true (#9998) 2024-06-06 13:17:33 +02:00
anatawa12
c12ed92da5 fix(cli): Cargo.lock is not synchronized with Cargo.toml (#9996) 2024-06-06 13:05:13 +02:00
Pylogmon
8b66174f0d fix(bundler): fix error when renaming the downloaded zip of NSIS (#9956) 2024-06-05 04:47:03 +03:00
Lucas Fernandes Nogueira
07b02c9f96 fix(core): test invoke key, closes #9960 (#9972) 2024-06-04 17:02:18 -03:00
Jerry
8ee8f09390 fix(core): fix check temp path permission on mac os, fix #6256 (#9588)
* fix: check temp path permission on mac os

* chore: format code
2024-06-04 10:02:54 -03:00
Pylogmon
78fc841370 feat(bundler): add provides, conflicts and replaces for deb and rpm (#9942)
Backport of #9331
2024-06-04 04:47:17 +03:00
AnthonyNGarcia
a301be52d2 fix(windows): Fix Windows System User build failures by using the current directory for bundling tools (fix: 9895) (#9914)
Co-authored-by: amrbashir <amr.bashir2015@gmail.com>
2024-06-03 21:45:44 +03:00
muwoo
5909662766 feat(bundler): support custom sign command on Windows (#9902) 2024-06-03 21:34:49 +03:00
Harry Mallon
253595a22d feat(bundler): Add RPM packaging, closes #4402 (#5202) (#9809)
* feat(bundler): Add RPM packaging

* feat(bundler): Update 'rpm' to 0.13.1

* Fix fmt

Co-authored-by: Olivier Lemasle <olivier.lemasle@apalia.net>
Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.app>
2024-05-28 22:31:29 -03:00
Fabian-Lars
a020828d0e feat(bundler/windows): Update wix to fix vulnerabilities and add arm support (#9861)
* feat(bundler/windows): Update wix to fix vulnerbilities and add arm support

* is this what it's complaining about?

* delete change file

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2024-05-28 22:31:16 -03:00
Amr Bashir
e48157da2f fix(core/shell/command): retry sending events when it fails, closes #7684 (#9698)
* fix(core/shell/command): retry sending events when it fails, closes #7684

* try normally first

* sleep first
2024-05-28 11:48:57 -03:00
Amr Bashir
44e3335da8 fix(core/shell): speedup Command.execute & fix extra new lines (#9796)
* fix(core/shell): speedup `Command.execute` & fix extra new lines (#9706)

* fix(core/shell): speedup `Command.execute` & fix extra new lines

The speed gains comes from running the Command in Rust fully and returning the result in one go instead of using events.

The extra new lines was a regression from https://github.com/tauri-apps/tauri/pull/6519

ref: https://github.com/tauri-apps/tauri/issues/7684#issuecomment-2100897383

* fix unix build

* clippy

* cleanup

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>

* lock file

* minor

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
2024-05-24 13:40:05 -03:00
github-actions[bot]
bf708a21a8 apply version updates (#9857)
Co-authored-by: lucasfernog <lucasfernog@users.noreply.github.com>
2024-05-22 23:10:41 -03:00
chip
f6d81dfe08 Merge pull request from GHSA-57fm-592m-34r7
* add __TAURI_INVOKE_KEY__ to ipc calls to detect initialized frames

* move ipc key check to start of on_message

* cargo +nightly fmt

* undo Cargo.toml formatting changes

* undo Cargo.toml formatting changes

* undo Cargo.toml formatting changes

* remove merged changefiles

* undo formatting changes to js files

* undo formatting changes to js files

* Update to patched wry  release

* fix: optional chaining is not supported on older webviews (#9529)

* Revert "undo formatting changes to js files"

This reverts commit a7ef0d91ea1b183e091ea65a2b201d65522cc1d5.

* Revert "undo formatting changes to js files"

This reverts commit 0fcfd4664b915af51b71e7ea68929fd5b6cb5fc3.

* revert core.js

* inject __TAURI_INVOKE_KEY__ to __TAURI_IPC__ instead

* remove unrelated changes file

* remove left over dbg! call

* change file

---------

Co-authored-by: Tillmann <28728469+tweidinger@users.noreply.github.com>
Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.app>
2024-05-22 17:49:08 -03:00
木偶
50aabad1f6 refactor(updater/nsis): migrate run updater using powershell to ShellExecute (#9818) 2024-05-22 21:26:17 +03:00
github-actions[bot]
d78fa20d86 Apply Version Updates From Current Changes (v1) (#9793)
Co-authored-by: amrbashir <amrbashir@users.noreply.github.com>
2024-05-15 20:09:07 +03:00
Amr Bashir
3b69c1384b Revert "fix(core/shell): speedup Command.execute & fix extra new lines (#9706)" (#9792)
* Revert "fix(core/shell): speedup `Command.execute` & fix extra new lines (#9706)"

This reverts commit 7f885bd5ed.

* change file
2024-05-15 19:28:15 +03:00
Amr Bashir
704260bb3c fix(macos/dialog): avoid setting empty default_path (#9784)
closes #7566

ref: https://github.com/tauri-apps/tauri/issues/4065
ref: https://github.com/tauri-apps/tauri/pull/4028
ref: https://github.com/tauri-apps/tauri/issues/9762
2024-05-15 18:45:11 +03:00
Amr Bashir
36b082a9c8 ci: pull .crate file from workspace target directory (#9732) 2024-05-10 02:32:15 +03:00
github-actions[bot]
f45d35cf06 Apply Version Updates From Current Changes (v1) (#9730)
Co-authored-by: amrbashir <amrbashir@users.noreply.github.com>
2024-05-10 00:13:21 +03:00
Amr Bashir
ef35a793c5 fix(core): fix compilation when shell-execute or shell-sidecar (#9729)
* fix(core): fix compilation when `shell-execute` or `shell-sidecar`

regression from: https://github.com/tauri-apps/tauri/pull/9706

* change file
2024-05-09 23:56:52 +03:00
github-actions[bot]
15c62b5d99 Apply Version Updates From Current Changes (v1) (#9721)
* apply version updates

* fmt

---------

Co-authored-by: lucasfernog <lucasfernog@users.noreply.github.com>
Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2024-05-09 15:22:45 -03:00
Lucas Fernandes Nogueira
9b90b67ed2 Revert "Apply Version Updates From Current Changes (v1)" (#9724)
This reverts commit 6bb721cd3d.
2024-05-09 14:02:31 -03:00
Angel S. Moreno
f1b0b00159 docs: added example of tauri.allowlist.protocol (#9726) 2024-05-09 19:52:55 +03:00
github-actions[bot]
6bb721cd3d Apply Version Updates From Current Changes (v1) (#9709)
Co-authored-by: lucasfernog <lucasfernog@users.noreply.github.com>
2024-05-09 12:28:21 -03:00
Amr Bashir
7f885bd5ed fix(core/shell): speedup Command.execute & fix extra new lines (#9706)
* fix(core/shell): speedup `Command.execute` & fix extra new lines

The speed gains comes from running the Command in Rust fully and returning the result in one go instead of using events.

The extra new lines was a regression from https://github.com/tauri-apps/tauri/pull/6519

ref: https://github.com/tauri-apps/tauri/issues/7684#issuecomment-2100897383

* fix unix build

* clippy

* cleanup

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2024-05-09 18:14:53 +03:00
Lucas Fernandes Nogueira
2eb21378a6 fix(tauri-runtime-wry): window draw span not closing (#9718)
* fix(tauri-runtime-wry): window draw span not closing

* use .retain
2024-05-09 10:09:48 -03:00
Enkhjil Enkhbaatar
ab9ec42c10 fix(windows): nsis failed to resolve resources with $ in their name, closes #9657 (#9659) 2024-05-08 20:32:09 +03:00
github-actions[bot]
07b6f9fa83 apply version updates (#9683)
Co-authored-by: FabianLars <FabianLars@users.noreply.github.com>
2024-05-06 22:33:33 +02:00
Fabian-Lars
db9ec4e79c ci: fix msrv check (#9682)
* ci: fix msrv check
2024-05-06 21:59:34 +02:00
Fabian-Lars
2a9a28044b ci: fix msrv check (#9681) 2024-05-06 21:48:13 +02:00
Fabian-Lars
5ee5ed4dc6 fix: schemars 0.8.18 compatibility (#9680)
* fix: schemars 0.8.18 compatibility

backport of #9676

Co-authored-by: Hankung <73242257+Hankung7183@users.noreply.github.com>

* fix clippy lol

---------

Co-authored-by: Hankung <73242257+Hankung7183@users.noreply.github.com>
2024-05-06 21:35:01 +02:00
Amr Bashir
b8fd8e1bac refactor(nsis): use nsis's built-in com plugin instead of ApplicationID plugin (#9606)
* Use WinShell instead of ApplicationID

* Uninst shortcut before removing start menu one

* Use nsis's buit-in com plugin instead of WinShell

* Remove download ApplicationID code

* Add change file

* Clippy and format

* Allow dead code on extract_zip

* Qualify extract_zip path to make clippy happy

* Move macro up

Co-authored-by: Tony <68118705+Legend-Master@users.noreply.github.com>
2024-04-30 15:11:00 +03:00
Amr Bashir
0749a84ae0 chore(cli/deps): update nsis-tauri-utils to 0.3 (#9605) 2024-04-30 13:05:08 +02:00
Amr Bashir
80db9dff28 ci: use node 16 (#9600)
* ci: use lts node version in CI

* lts/*

* 16

* more 16
2024-04-29 17:33:28 +03:00
Fabian-Lars
532279b724 ci(1.x): Fix publishing of cli-macos-x64 (#9575)
* ci: Fix publishing of cli-macos-x64

* temp: only publish darwin-x64

* temp: wrong version

* temp: disable everything but darwin-x64

* temp: wrong test arch...

* temp: last one

* temp: last one for realsies

* remove temp stuff

* revert more
2024-04-29 16:23:18 +03:00
Lucas Fernandes Nogueira
3e98145ac3 fix(core): run plugin init script in a separate context (#9570)
* fix(core): run plugin init script in a separate context

* fix ci
2024-04-28 11:15:26 -03:00
Fabian-Lars
fd2f8ab774 ci(1.x): Remove nodejs14 test in cli.js publishing workflow (#9569) 2024-04-25 12:45:06 +02:00
github-actions[bot]
caddd5bdd8 Apply Version Updates From Current Changes (v1) (#9544)
* apply version updates

* downgrade tokio deps

---------

Co-authored-by: lucasfernog <lucasfernog@users.noreply.github.com>
Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2024-04-22 12:34:26 -03:00
Lucas Fernandes Nogueira
72c2636527 chore(ci): fix MSRV downgrade (#9543) 2024-04-22 11:17:33 -03:00
Lucas Fernandes Nogueira
83e024c670 chore(ci): downgrade home crate (#9542)
* chore(ci): downgrade home crate

* chore: update deps
2024-04-22 10:57:59 -03:00
Lucas Fernandes Nogueira
07c9e352df fix(ci): downgrade cc crate for MSRV compatibility (#9541) 2024-04-22 10:15:52 -03:00
Fabian-Lars
d00178d60c ci: Fix package downgrades in covector workflow (#9538)
* ci: Fix package downgrades in covector workflow

* some more packages
2024-04-22 09:16:16 -03:00
Lucas Fernandes Nogueira
705da977a9 fix: optional chaining is not supported on older webviews (#9529) 2024-04-21 20:53:51 -03:00
Fabian-Lars
1675e41f05 fix(bundler): don't convert product name to snake case when cross compiling (#9481)
* fix(bundler): Don't convert product name to snake case when cross compiling

fixes #9221

* Update bundler-cross-uppercase-productname.md

* Update .changes/bundler-cross-uppercase-productname.md
2024-04-18 17:04:17 +02:00
Fabian-Lars
f9638b6315 fix(cli): append extension to app binary manually on rename (#9491)
fixes #9488
fixes #8848
2024-04-18 05:31:07 +02:00
Amr Bashir
aeddc40b9e fix(cli/info): fix crash when checking node version (#9411)
closes #9396
2024-04-15 11:39:17 +02:00
Amr Bashir
fe6f81fa88 chore: fix clippy false positive (#9329) 2024-04-01 13:11:09 -03:00
Jet Li
9dd67abd93 fix(cli): upgrade heck to better support Chinese/Japanese prodcut name on Linux (#9298) 2024-04-01 17:23:15 +02:00
Fabian-Lars
dbe81b8410 fix(bundler/nsis): Don't use /R flag on installation dir (#9282) 2024-03-27 00:55:57 +02:00
Fabian-Lars
017861e4d5 fix(bundler): Fix nsis resource paths on non-windows build systems. (#9281)
* fix(bundler): Fix nsis resource paths on non-windows build systems.

* remove leftover from alternative
2024-03-27 00:40:29 +02:00
Fabian-Lars
77cc49ac3c fix(cli): Clone Options struct after mutating it. (#9188) 2024-03-19 10:37:12 -03:00
Amr Bashir
e3b6d38d26 fix(core/path): remove suffix in basename only once (#9166)
* fix(core/path): remove suffix in basename only once

ref: #9064

* Update tooling/api/src/path.ts

---------

Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.app>
2024-03-18 08:40:18 -03:00
github-actions[bot]
b705f89a10 Apply Version Updates From Current Changes (v1) (#9074)
Co-authored-by: lucasfernog <lucasfernog@users.noreply.github.com>
2024-03-07 15:18:27 -03:00
Amr Bashir
97a05145fb fix(cli): migrate to stable features of log crate (#9119)
* fix(cli): migrate to stable features of `log` crate

* to_cow_str
2024-03-07 13:39:32 -03:00
anatawa12
b15948b11c fix(cli): use matched_path_or_any_parents when checking if a file is ignored (#8903)
* fix: taurignore ignoreing folders not working for watch

* docs: add to changes

* fix: panic: path is expected to be under the root

* Update taurignore-ignoring-folders-not-working-for-watch.md

* Update taurignore-ignoring-folders-not-working-for-watch.md
2024-03-06 21:12:41 +02:00
bifs
5163861588 fix(bundler): escape potentially problematic strings in an XML (#9040)
* fix(bundler): escape potentially problematic strings in an XML (#9030)

- replace characters invalid in XML with their escaped form to properly bundle resources with such characters in their pathnames.

* change file
2024-03-04 21:08:12 +02:00
github-actions[bot]
80a215a6f3 Apply Version Updates From Current Changes (v1) (#9013)
Co-authored-by: lucasfernog <lucasfernog@users.noreply.github.com>
2024-02-28 00:11:02 -03:00
Amr Bashir
01ae1218dc ci: downgrade thread_local to 1.1.7 in msrv list (#9012) 2024-02-27 23:03:28 -03:00
Amr Bashir
d42668ce17 fix(runtime-wry): avoid panic during clipboard initialization on wayland (#9003)
closes #8964
2024-02-27 14:35:22 -03:00
Amr Bashir
1ab0db6352 chore: port PR template from dev branch (#9004) 2024-02-27 18:48:00 +02:00
Lucas Nogueira
e816a46b95 chore: update lock files 2024-02-18 23:46:17 -03:00
Lucas Nogueira
a4b82d9dba chore: bump tauri-utils 2024-02-18 22:31:35 -03:00
github-actions[bot]
b735b6799f Apply Version Updates From Current Changes (v1) (#8475)
* chore: change bump to patch

* apply version updates

---------

Co-authored-by: amrbashir <amr.bashir2015@gmail.com>
Co-authored-by: amrbashir <amrbashir@users.noreply.github.com>
2024-02-18 19:31:52 -03:00
amrbashir
7b5e8712e7 ci: update msrv test and cargo.lock 2024-02-14 04:01:01 +02:00
Lucas Fernandes Nogueira
2421073576 fix(macos): use BTreeMap for windows map to prevent crash on idle (#8117)
* fix(macos): use BTreeMap for windows map to prevent crash on idle

* use arc [skip ci]

* add change file
2024-02-14 01:15:21 +02:00
Fabian-Lars
510b62261c chore(core): Add missing changefile for #8546 (#8822) 2024-02-08 16:27:19 +02:00
Amr Bashir
b0f27814b9 fix(cli): map --profile dev to debug folder when finding executable (#8776) 2024-02-05 16:12:08 +02:00
John Smith
cc3d8e7731 fix(core): Command::output suspend while wait for response (#8539)
* fix: Command::output suspend while wait for response

* add change file

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.app>
2024-02-01 08:06:05 -03:00
Amr Bashir
8ce51cec3b feat: retain cli args when relaunching after update, closes #7402 (#7718)
* feat: retain cli args when relaunching after update, closes #7402

* 1.61 compatible OsString join

* fix msi impl as well

* fix tests

* Update .changes/tauri-bundler-nsis-args.md

Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.studio>

* Update .changes/tauri-updater-retain-args.md

Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.studio>

* more typos

* fix update args

* pull args from Env

* check if not empty

* pin memchr

* Update core.rs

* Update core.rs

* move /args

* fix build

* lint

* more lints

---------

Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.studio>
2024-01-31 16:02:48 -03:00
Fabian-Lars
0bff8c325d fix(cli): Ignore query parameter in dev server (#8697)
* fix(cli): Ignore query parameter in dev server

fixes #8148
additional ref: https://discord.com/channels/616186924390023171/1201199918379974766

* Update .changes/cli-devserver-queryparam.md

---------

Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com>
2024-01-29 14:58:23 +02:00
Fabian-Lars
a9b2c0625c chore: Commit Cargo.lock (#8586)
* chore: Commit Cargo.lock

* memchr for non-windows

* cfg-expr for non-windows

* add msrv check to covector

* update script

* downgrade arboard

* downgrade petgraph

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2024-01-17 16:21:45 -03:00
Naman Garg
7aa30dec85 feat: Add Section, Priority and Changelog options (#8620)
* Init section, priority and changelog

* Add section. priority and changelog support

* fix variable name

* Add .changes file

* Fix Formatting

* Apply suggestions from code review
2024-01-17 04:21:46 +02:00
Naman Garg
4926648751 deps: Libflate to flate2 (#8618)
* Replace libflate with flate2

* Add .changes file

* Cargo fmt
2024-01-16 15:52:19 +02:00
Amr Bashir
06890c70c6 feat: enable socks-proxy for bundler download (#8596) (#8611)
* feat: enable socks-proxy for bundler download

* change file

Co-authored-by: Lai Zn <laizenan@gmail.com>
2024-01-16 15:42:53 +02:00
阿良仔
1ca69bcf2f fix(clipboard): build issues on wayland (fix #8515) (#8546)
* fix(clipboard): fail to build on wayland

* specify exact version

* bump MSRV to 1.63

* revert msrv changes

---------

Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com>
2024-01-15 19:52:49 +02:00
Naman Garg
6bdba1f330 fix(bundler/deb): use lintian-compliant permissions , closes #7992 (#8585) 2024-01-15 18:08:07 +02:00
Fabian-Lars
b546b42db7 fix(core): Retain order of map keys in ipc, fixes #7922 (#8577)
* fix(core): Retain order of map keys in ipc, fixes #7922

* enable dep on http-api feature instead of http-request

* Create fix-formbody-order.md

* Update fix-formbody-order.md
2024-01-10 21:03:25 +02:00
Fabian-Lars
67d7877f27 fix(cli): Watch workspace members if tauri dir is workspace root (#8520)
* fix(cli): Watch workspace members if tauri dir is ws root

See title. This PR also includes a fix/workaround for paths with funny characters that may not make the glob expansion panic.

Fixes #8509

* extract into function

* cleanup
2024-01-04 01:37:05 +02:00
Jason Tsai
89911296e4 feat(bundler): codesign nested code on macos (#8259)
* feat(bundler): codesign nested code on macos

* chore: update changelog tag

* typo

* also sign stuff in the Libraries folder

tested this for spacedrive, which has a bunch of dylib inside the libraries folder

* Update .changes/mac-bundler-nested-code-sign.md [skip ci]

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2023-12-28 13:58:24 -03:00
Amr Bashir
8f8729d918 fix(core): allow canceling data-tauri-drag-region maximization on macOS, closes #8306 (#8312)
* fix(core): allow canceling `data-tauri-drag-region` maximization on macOS, closes #8306

* Update .changes/tauri-data-drag-region-macos-maximize.md

* fix typo

* cancel if mouse moves

* Update tauri-data-drag-region-macos-maximize.md

[skip ci]

* Update core/tauri/scripts/core.js [skip ci]

---------

Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.app>
2023-12-28 09:13:48 -03:00
Amr Bashir
446fc99bbe ci: use default options for repository-dispatch (#8456) 2023-12-27 13:00:37 -03:00
Amr Bashir
6e48837860 feat: re-export Url (#8474)
* feat: re-exoprt `Url`

`Url` is used/returned from public API, we should re-export it

* Update .changes/export-url.md
2023-12-27 12:59:26 -03:00
renovate[bot]
883e52153e chore(deps) Update Tauri API Definitions (1.x) (#8449)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-20 14:16:58 -03:00
github-actions[bot]
5966812735 Apply Version Updates From Current Changes (v1) (#8396)
Co-authored-by: lucasfernog <lucasfernog@users.noreply.github.com>
2023-12-20 13:50:17 -03:00
Amr Bashir
b44e9c0fcb feat(bundler): redownload outdated/mis-hashed files (#8431)
* feat(bundler): redownload outdata/mis-hashed files

* change import location

* Update util.rs

* Update util.rs

* Update bundler-mishashed-files.md

* Update bundler-mishashed-files.md

* rename fn

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
2023-12-20 12:46:19 -03:00
Fabian-Lars
b2f83f03a8 fix(core): Replace Rc with Arc to prevent crashes when sending events (#8402)
* fix(core): Prevent crash when sending events.

* add change file

* use dedicated type for windows refcell map

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
2023-12-20 12:13:00 -03:00
Fabian-Lars
0a2175eabb fix(cli): expand globs in workspace member paths (#8439)
* fix(cli): Expand globs in workspace member paths

fixes #8403

* unusued import

* into_iter

* return error instead of of empty vec

* Update dev-watcher-glob.md
2023-12-20 15:57:10 +02:00
Amr Bashir
645e1dcc6e fix(core/updater): check if installer args are not empty before passing -ArgumentList closes #8296 (#8404) 2023-12-20 01:08:38 +02:00
Amr Bashir
50a3d170f2 fix(core/dialog): reconstruct path using appropriate separator, closes #8074 (#8408)
* fix(core/dialog): reconstruct path using appropraite separator, closes #8074

* Update dialog-window-forward-slash.md

* Update dialog.rs

* Update core/tauri/src/endpoints/dialog.rs

---------

Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.app>
2023-12-18 21:08:18 -03:00
Amr Bashir
9b230de7bc fix(utils/config): fix parsing f64 values, closes #8252 (#8407) 2023-12-18 18:18:44 -03:00
Amr Bashir
50e9caad64 ci: access cli release id directly (#8398) 2023-12-18 18:17:39 -03:00
Amr Bashir
e5cc72eb40 ci: fix msrv tests (#8409)
* ci: remove `is-terminal` from crate pinning step

* pin cross-beam

* crossbeam-utils

* image

* linux-raw-sys

* fix version

* comon

* ha?

* tar

* now?

* rustix

* kill me, kill me now

* tar first???

* is-terminal

* I am dying

* remove rustix

* image
2023-12-18 18:15:28 -03:00
Lucas Fernandes Nogueira
0d0501cb7b refactor(clipboard): use arboard instead of tao closes #8177 (#8394)
* refactor(clipboard): use arboard instead of tao closes #8177

* update api lock

* add change file
2023-12-14 13:41:20 -03:00
Amr Bashir
1c582a942e refactor(api): generate types next to modules (#8392)
* refactor(api): generate types next to modules"

this fixes an issue with `moduleResolution: node`

* change file

* Update api-module-resolution-node.md
2023-12-14 13:27:48 -03:00
Alexandre Dang
3c371aa8ee feat(core): add test::test::get_ipc_response, closes #8199 (#8228)
* feat(core): Add additional functions to the

* Add documentation and cleanup the code

* Improve and add tests to helper functions

* Clean unecessary code and correct tests

* Make `Ipc` and `IpcKey` public

* Open `Ipc` with public functions

* Update core/tauri/src/test/mod.rs

Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.app>

* cleanup, change file

---------

Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.app>
Co-authored-by: Lucas Nogueira <lucas@crabnebula.dev>
2023-12-14 11:52:45 -03:00
Amr Bashir
c1bc4d2948 chore(cli/help): mention the need for a second -- in tauri dev (#8388)
* chore(cli/help): mention the need for a second `--` in `tauri dev`

ref: https://github.com/tauri-apps/tauri/issues/8382#issuecomment-1854016310

* add example to clarify [skip ci]

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
2023-12-14 09:20:52 -03:00
github-actions[bot]
f9c97b7e5b Apply Version Updates From Current Changes (v1) (#8377)
Co-authored-by: amrbashir <amrbashir@users.noreply.github.com>
2023-12-13 14:43:54 -03:00
Amr Bashir
5ff9d4592a fix(bundler/nsis): only kill processes of current user (#8390)
* fix(bundler/nsis): only kill processes of current user

Co-authored-by: FabianLars-crabnebula <fabianlars@crabnebula.dev>

* change file

---------

Co-authored-by: FabianLars-crabnebula <fabianlars@crabnebula.dev>
Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com>
2023-12-13 18:57:32 +02:00
Amr Bashir
30adc8d45d ci: fix publish @tauri-apps/api to latest instead of next (#8371)
* ci: fix publish `@tauri-apps/api` to `latest` instead of `next`

closes #8335

* just remove tag
2023-12-12 12:17:11 +02:00
Amr Bashir
777ddf434a fix(bundler): unset NSISDIR and NSISCONFDIR when running makensis (#8376)
closes #8359
2023-12-12 12:17:03 +02:00
Lucas Fernandes Nogueira
327c7aec30 fix(ci): skip installing unnecessary deps (#8277) 2023-12-01 17:06:59 +02:00
amrbashir
14e29f320d chore: update tauri-cli lock file 2023-12-01 04:27:26 +02:00
amrbashir
cf7d584033 chore: manually bump tauri-utils 2023-12-01 03:46:30 +02:00
github-actions[bot]
61cc7d9c5a Apply Version Updates From Current Changes (v1) (#8203)
* apply version updates

* fmt

---------

Co-authored-by: amrbashir <amrbashir@users.noreply.github.com>
Co-authored-by: amrbashir <amr.bashir2015@gmail.com>
2023-12-01 03:05:05 +02:00
Robin van Boven
c4b5df12bb perf: skip large Window and AppHandle fields on traces (#8318)
* perf: Skip large Window and AppHandle fields on traces

These contain large fields like image buffers, causing spans/events to be very large when serialized.

Especially the `window::emit::eval` one which is in a hot code path.

* fix: MSRV issues
2023-11-30 16:56:24 +02:00
i-c-b
977a39f4f7 fix(bundler): migrate WebView2 offline installer to shorturl (#8292) 2023-11-29 03:51:42 +02:00
Chase Knowlden
c34710de67 fix: Fix archived links, Closes #8302 (#8315) 2023-11-29 03:41:41 +02:00
Lucas Nogueira
5e05236b49 feat(core): add tracing for vital functionality closes #5204 (#8289)
* feat(core): add tracing for vital functionality

* Update core/tauri-runtime-wry/src/lib.rs [skip ci]

* Update Cargo.toml [skip ci]

* tracing feature

* wry 0.24.6

* add change tag

* add tracing to CI test

* enhance spans for update check

* remove app from debug impl
2023-11-27 16:56:46 +02:00
Lucas Nogueira
b3e53e7243 feat(core): add AssetManager::iter (#8288)
This new function allows users to iterate on all embedded assets, important if you want to AssetManager::get an asset you are not sure exists.
2023-11-23 16:12:38 +02:00
Amr Bashir
5046270273 fix(api): add top-level main, module and types fields (#8267) 2023-11-20 18:12:52 -03:00
Amr Bashir
b8756bc34e perf: remove extranous call in StateManager::get (#8272) 2023-11-20 17:55:18 -03:00
Fabian-Lars
f26d9f0884 fix(bundler/nsis): remove empty resources folders on uninstall (#8263)
* fix(bundler/nsis): remove empty resources folders on uninstall

* make clippy happy for once
2023-11-20 14:43:47 +02:00
renovate[bot]
8accd6940e chore(deps) Update Rust crate handlebars to 4.5 (1.x) (#8231)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-11-19 08:58:27 -03:00
Amr Bashir
26ccfef999 ci: fix parsing covector ouput (#8240) 2023-11-19 08:54:05 -03:00
Amr Bashir
d8f1b6c59b feat: migrate manual implementation to the light windows-version crate (#8242) 2023-11-19 08:51:17 -03:00
Amr Bashir
4b6a602a89 fix(updater): Use escaped installer path when starting the updater msi (#8234)
* fix(updater): Use escaped installer path when starting the updater msi

Continuation of https://github.com/tauri-apps/tauri/pull/7956

* fix build
2023-11-16 01:26:03 +02:00
Fabian-Lars
92bc7d0e16 fix(bundler/nsis): calculate estimated size on build system (#8233)
* fix(bundler): Fix nsis installer taking longer than expected to install resources

* create dir structure for resources before extracting files

* calculate size in rust on the build system

* i'm sorry clippy, i programmed in unholy languages where += wasn't a thing so i forgot it exists in rust...

* i'm a better clippy than clippy🌚
2023-11-15 20:53:15 +02:00
renovate[bot]
9e3aff0a3a chore(deps) Update Tauri Build (1.x) (#8102)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2023-11-14 10:18:35 -03:00
renovate[bot]
e221aae531 chore(deps) Update Tauri Utils (1.x) (#8105)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Lucas Nogueira <lucas@tauri.app>
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
2023-11-14 09:52:58 -03:00
renovate[bot]
626121e7bf chore(deps) Update Tauri CLI (1.x) (#8193)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2023-11-13 23:58:27 -03:00
Lucas Fernandes Nogueira
2ba8856343 fix(core): docs.rs build failing for macOS (#8095) 2023-11-13 22:34:22 -03:00
renovate[bot]
f964cbdb93 chore(deps) Update dependency eslint to v8.53.0 (1.x) (#8189)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-11-13 21:45:24 -03:00
renovate[bot]
0f7b2c4298 chore(deps) Update Rust crate tempfile to 3.8.1 (1.x) (#8188)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-11-13 21:43:45 -03:00
Merlin Gough
14544e4b87 fix(api): avoid crashing in clearMocks, closes #8179 (#8219)
* fix(api): do nothing in clearMocks if __TAURI_INTERNALS__ is not defined (fix: #8179)

Prevents tests that didn't define any mocks from failing in `afterEach` test hook.

* Update fix-clearmocks.md

* check for indvidiual properties instead
2023-11-13 17:48:54 +02:00
Olivier Lemasle
1d5aa38ae4 fix(cli): Fixes errors on command output, closes #8110 (#8162)
Fixes #8110
2023-11-09 15:34:16 -03:00
i-c-b
416370a627 enhance(docs): Document Windows-specific icon behaviour (#8153) 2023-11-06 20:12:26 -03:00
Lucas Fernandes Nogueira
2c7d683ae3 chore(renovate): ignore cargo_toml and minisign (#8118) 2023-10-26 15:38:09 -03:00
renovate[bot]
b6ef1fab0e chore(deps) Update Tauri API Definitions (1.x) (#8100)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-26 13:42:15 -03:00
renovate[bot]
bf859859d6 chore(deps) Update Rust crate libflate to v2 (1.x) (#8106)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-26 13:33:01 -03:00
Lucas Fernandes Nogueira
a635ec2345 feat(cli): add unit test for empty updater private key password (#8096) 2023-10-25 19:13:48 -03:00
github-actions[bot]
ae75004cee Apply Version Updates From Current Changes (v1) (#8065)
Co-authored-by: lucasfernog <lucasfernog@users.noreply.github.com>
2023-10-23 21:20:02 -03:00
Lucas Fernandes Nogueira
13ce9ac836 fix: e2e test using invalid updater private keys (#8086) 2023-10-23 19:43:01 -03:00
Fabian-Lars
5264e41db3 fix(deps): Downgrade minisign to 0.7.3 again (#8082) 2023-10-23 15:12:00 -03:00
renovate[bot]
5f75ebbbbb chore(deps) Update Tauri CLI (1.x) (#8051)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2023-10-20 02:26:11 +00:00
renovate[bot]
10da70307a chore(deps) Update Tauri Codegen (1.x) (#7576)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2023-10-19 23:44:04 +00:00
Johannes Velde
cfe6fa6c91 feat(lang) added german language (#8061) 2023-10-19 22:47:34 +00:00
github-actions[bot]
ae13be2d17 Apply Version Updates From Current Changes (v1) (#8062)
Co-authored-by: lucasfernog <lucasfernog@users.noreply.github.com>
2023-10-19 16:48:27 +00:00
Lucas Fernandes Nogueira
3880b42d18 feat(bundler): enhance notarization error message (#7974) 2023-10-19 15:56:20 +00:00
Lucas Fernandes Nogueira
9bead42dbc feat(cli): allow rotating updater private key (#8059) 2023-10-19 15:43:48 +00:00
Olivier Lemasle
2da043f04d fix: improve French translations for nsis installer (cherry-pick #7523 on 1.x) (#8058)
Co-authored-by: Stanislas Michalak <stanislas-m@users.noreply.github.com>
2023-10-19 10:48:16 -03:00
renovate[bot]
de985bad18 chore(deps) Update Tauri Bundler (1.x) (#7639)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-18 13:26:24 -03:00
Lucas Fernandes Nogueira
be8e5aa307 fix(cli): duplicated newlines on child process output (#8042) 2023-10-18 15:29:12 +00:00
renovate[bot]
94bef1c705 chore(deps) Update Tauri CLI (1.x) (#7641)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
2023-10-18 09:48:30 -03:00
Amr Bashir
99865d9e9a refactor(cli): cleanup info command (#7204)
Co-authored-by: martin frances <martinfrances107@hotmail.com>
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
2023-10-17 13:09:59 -03:00
github-actions[bot]
550173aaf5 Apply Version Updates From Current Changes (v1) (#8022)
Co-authored-by: lucasfernog <lucasfernog@users.noreply.github.com>
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
2023-10-17 12:29:33 -03:00
Amr Bashir
f259db3596 chore: downgrade bump to patch (#8033) 2023-10-17 10:00:03 -03:00
Amr Bashir
2b0212af49 feat(api): add mock for convertFileSrc, closes #7935 (#7961)
* feat(api): add mock for `convertFileSrc`, closes #7935

* fix lint

* Update tooling/api/src/mocks.ts

* fmt
2023-10-17 15:33:44 +03:00
Amr Bashir
dfe0badf19 docs: document macOS restrictions on Menu::add_item (#7983) 2023-10-16 09:15:15 -03:00
Amr Bashir
d6e10e216e chore: rename webview2 offline installer guid consts for more clarity (#8001) 2023-10-16 09:13:32 -03:00
Amr Bashir
9d40840299 chore: update tauri-cli lock file (#8015) 2023-10-16 08:50:11 -03:00
Olivier Lemasle
113bcd7b68 fix(bundler): In .deb packages, set uid=0 for all files (#7980) 2023-10-16 08:33:06 -03:00
Caijinglong
d0ae67503c fix(bundler): read proxy when downloading resources. (#8012)
* fix(bundler): read http_proxy env when downloading resources.

Signed-off-by: CaiJingLong <cjl_spy@163.com>

* Update .changes/add-proxy-for-nsis-download.md

* Update add-proxy-for-nsis-download.md

* Update tooling/bundler/src/bundle/windows/util.rs

---------

Signed-off-by: CaiJingLong <cjl_spy@163.com>
2023-10-13 15:06:34 +03:00
github-actions[bot]
441eb4f4a5 Apply Version Updates From Current Changes (v1) (#7988)
Co-authored-by: lucasfernog <lucasfernog@users.noreply.github.com>
2023-10-11 17:27:37 +00:00
Lucas Fernandes Nogueira
bab05ff607 fix(ci): properly detect @tauri-apps/cli release id from covector output (#8004) 2023-10-11 15:53:01 +00:00
i-c-b
f552c1796a fix(bundler): WebView2 offline installer GUID changes (#7998) 2023-10-11 10:50:21 +00:00
Ziyang Hu
21cdbb41a3 fix: truncate file when not appending in writeFile, closes #7973 (#7982)
* Fix https://github.com/tauri-apps/tauri/issues/7973

* Fix https://github.com/tauri-apps/tauri/issues/7973

* Fix https://github.com/tauri-apps/tauri/issues/7973
2023-10-09 16:22:54 +03:00
github-actions[bot]
1241014a46 Apply Version Updates From Current Changes (v1) (#7960)
Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.app>
Co-authored-by: lucasfernog <lucasfernog@users.noreply.github.com>
fix(bundler): team ID is now required for notarytool via app password (#7972)
fix(bundler): team ID is now required for notarytool via app password (#7972)"
2023-10-08 11:12:42 +00:00
Lucas Fernandes Nogueira
40d340021c fix(bundler): team ID is now required for notarytool via app password (#7972) 2023-10-06 14:33:49 -03:00
Fabian-Lars
cdd5516f33 fix(bundler): Use escaped installer path when starting the updater setup, fixes #7931 (#7956)
* fix(bundler): Use escaped installer path when starting the updater setup, fixes #7931

* fun ci stuff

* who needs lockfiles anyway

* stahp

* please let it be the last one. i want to leave
2023-10-05 00:45:43 +03:00
github-actions[bot]
19249d78fb Apply Version Updates From Current Changes (v1) (#7938)
Co-authored-by: lucasfernog <lucasfernog@users.noreply.github.com>
2023-10-02 13:16:57 -03:00
Jason Tsai
d6eb46cf11 fix(macos): fix notraytool's apple-id option name, close #7917 (#7934)
Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.app>
2023-10-02 11:30:39 -03:00
Lucas Fernandes Nogueira
3671edbcff fix(core): toggle devtools via global shortcut (#7937)
* fix(core): toggle devtools via global shortcut

* Update .changes/fix-toggle-devtools.md
2023-10-02 17:19:01 +03:00
github-actions[bot]
a3277a245c Apply Version Updates From Current Changes (v1) (#7924)
Co-authored-by: amrbashir <amrbashir@users.noreply.github.com>
2023-09-30 04:41:23 +03:00
Lucas Fernandes Nogueira
d1e09da084 hotfix(build): bump tauri-build to 1.5 (#7918) 2023-09-30 02:20:27 +03:00
Lucas Fernandes Nogueira
c001a91d15 fix(ci): update tauri-driver's Cargo.lock file on version bump (#7915) 2023-09-28 15:29:53 -03:00
github-actions[bot]
0af553da72 Apply Version Updates From Current Changes (v1) (#7261)
Co-authored-by: lucasfernog <lucasfernog@users.noreply.github.com>
2023-09-28 14:01:19 -03:00
Lucas Fernandes Nogueira
e9e68abb33 fix(ci): downgrade async-executor to 1.5.2 (#7911) 2023-09-28 10:48:52 -03:00
Lucas Fernandes Nogueira
c68fbfcb2d fix: Returns a warning instead of panicking if an AppImage is not mounted, closes #7736 (#7912)
Co-authored-by: Benjamin Demetz <50681275+Benji377@users.noreply.github.com>
2023-09-28 10:46:17 -03:00
Fabian-Lars
d1858de7a0 fix(cli): help output mixed up for private-key and private-key-path (#7901) 2023-09-26 14:41:32 -03:00
Fabian-Lars
9aa34ada57 feat(core): Allow http origin on Windows, fixes: #3007 (#7645)
Co-authored-by: Lucas Nogueira <118899497+lucasfernog-crabnebula@users.noreply.github.com>
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
2023-09-26 14:40:38 -03:00
Fabian-Lars
e8ff6b153e docs: change icon help output to ask for 1024px source icons, closes #7886 (#7896) 2023-09-25 14:44:27 +03:00
Trey Smith
5ecb46b341 fix: rpath missing from app, closes #7710 (#7773)
Co-authored-by: Lucas Nogueira <lucas@tauri.app>
Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.studio>
fix: codesign doesn't sign frameworks or sidecar, closes #7690 (#7774)
2023-09-24 19:11:20 -03:00
Trey Smith
dcdbe3eb6c fix: codesign doesn't sign frameworks or sidecar, closes #7690 (#7774)
Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2023-09-15 12:09:10 -03:00
Trey Smith
2f8881c010 feat: add team_id option for apple notarization (#7775)
Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2023-09-15 08:30:27 -03:00
Lucas Fernandes Nogueira
995ffc629b fix(ci): recreate symlink so the integration tests works (#7833) 2023-09-13 21:55:47 -03:00
Lucas Fernandes Nogueira
b3ebe4de3c chore(config-schema): remove unused deps (#7824) 2023-09-12 23:55:27 +03:00
Amr Bashir
4bf1e85e6b fix(windows): respect focused: false for webview, closes #7519 (#7722)
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
fix(windows): respect `focused: false` for webview, closes #7519
2023-09-11 17:00:06 -03:00
Davis Silverman
0b0bc81710 Extend context.rs to dynamically find the OUT_DIR for certain assets (#7534)
Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.studio>
2023-09-11 16:59:30 -03:00
Lucas Fernandes Nogueira
1945dec81f fix(ci): adjust downgrade crates step (#7812) 2023-09-11 15:30:37 -03:00
Jason Tsai
e3bfb01411 feat(nsis): support choosing compression algorithms, closes #7685 (#7776) 2023-09-07 18:45:15 +03:00
Lucas Fernandes Nogueira
dfbbca423b feat(bundler): try to find API key file for notarization, ref #7616 (#7771) 2023-09-07 10:01:12 -03:00
Jason Tsai
0797a002ca fix: use button property for data-tauri-drag-region mouse button detection, closes #7694 (#7746) 2023-09-07 09:55:47 -03:00
Amr Bashir
53ab2042fd refactor: remove unnecessary mutex (#7728) 2023-09-07 09:09:59 -03:00
martin frances
50878901ba chore: resolves a warning seen while running cargo update (#7753)
* chore: resolves a warning seen while running cargo update

warning: some crates are on edition 2021 which defaults to `resolver = "2"`, but virtual workspaces default to `resolver = "1"`
note: to keep the current resolver, specify `workspace.resolver = "1"` in the workspace root's manifest
note: to use the edition 2021 resolver, specify `workspace.resolver = "2"` in the workspace root's manifest

* Now using resolver 2.
2023-09-05 14:28:33 +03:00
Amr Bashir
49beb67dab ci: fix clippy lints (#7721)
* ci: fix clippy lints

* more lints
2023-08-31 13:53:15 +03:00
Colin McDonnell
e152662687 feat: support Bun package manager (#7723)
* Support bun

* clippy
2023-08-31 02:48:36 +03:00
i-c-b
13279917d4 enhance(cli): Add Cargo Tauri CLI version to tauri info output (#7713)
* enhance(cli): Add Cargo Tauri CLI version to `tauri info` output

* Create enhance-cli-cargo-tauri-cli-version-info.md
2023-08-31 01:53:37 +03:00
Fabian-Lars
85112e7f8f ci: downgrade h2 and reqwest (#7717)
* ci: downgrade h2 to 0.3.20

* reqwest

* Update test-core.yml

---------

Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com>
2023-08-30 20:43:01 +03:00
Amr Bashir
09f7f57eea chore(deps): update nsis_tuari_utils to 0.2.1 (#7711)
* chore(deps): update nsis_tuari_utils to 0.2.1

* Update .changes/nsis-kill-own-process.md
2023-08-30 15:49:47 +03:00
Fabian-Lars
f19c7fc5c3 ci: Update serde_with downgrade to match 3.3.0 (#7654) 2023-08-30 03:44:05 +03:00
Fabian-Lars
8c5fcf41e3 ci: Downgrade tokio to 1.29 and flate2 to 1.0.26 (#7646)
* ci: Downgrade tokio to 1.29

* downgrade flate2 too
2023-08-18 03:14:38 +03:00
Fabian-Lars
58d6b899e2 feat(api): Add append option to writeFile apis (#7636)
* feat(api): Add `append` option to writeFile apis.

* wording

* fmt

* Update .changes/fs-append-file.md


* clippeeeyyyy
2023-08-16 19:09:05 +03:00
Lucas Fernandes Nogueira
964d81ff01 refactor(bundler): switch to notarytool, closes #4300 (#7616) 2023-08-16 11:10:02 +09:00
Amr Bashir
a7777ff485 feat(bundler/NSIS): Add Bulgarian to supported NSIS languages. (#7624) (#7626)
* Create Bulgarian.nsh

* Update nsis.rs

* Create nsis-bulgarian.md

Co-authored-by: Angelo II <62988428+AngeloCore@users.noreply.github.com>
2023-08-16 11:09:45 +09:00
Amr Bashir
72a3d75e8f chore(deps): update nsis_tuari_utils to 0.2 (#7625) 2023-08-15 23:23:26 +03:00
Jet Li
ca977f4b87 fix(bundler/nsis): revert shell context change before deleting appdata, closes #7588 (#7591)
* fix(bundler/nsis): delete app data of current user when uninstall, closes #7588

* fix(bundler/nsis): delete app data of current user when uninstall, closes #7588

* Update .changes/fix-nsis-uninstall-delete-app-data.md

---------
2023-08-15 18:59:44 +03:00
Fabian-Lars
9308dee0a1 docs: Be more specific about plugin names in ipc scope (#7605) 2023-08-15 10:56:05 -03:00
Graeme McHale
10e362d098 feat: allow more flexible http requests in updater closes #7422 (#7432)
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
2023-08-10 07:23:52 -03:00
renovate[bot]
b420962377 chore(deps) Update Tauri API Definitions (1.x) (#7577)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-10 07:22:45 -03:00
Lucas Fernandes Nogueira
cca5301b88 added missing futures-util (#7260) (#7565)
Co-authored-by: Simon Hyll <hyllsimon@gmail.com>
2023-08-09 17:39:27 -03:00
Isaac Cambron
eeb6be5422 feat(core): Manager::emit_filter and optimize serialization (#7512)
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
2023-08-08 16:57:30 -03:00
Amr Bashir
a6b52e44f2 fix(tauri-utils): include \n in io::read_line, closes #6388 (#6519)
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
fix(tauri-utils): include `\n` in `io::read_line`, closes #6388
2023-08-08 16:43:19 -03:00
Alejandro González
9edebbba4e fix(driver): bump locked dependencies to fix build issue on Windows (#7475) 2023-08-08 15:46:32 -03:00
Fabian-Lars
cb1d4164e7 fix(bundler): sign the exe before the bundler step (#7487) 2023-08-08 15:16:00 -03:00
Amr Bashir
6c408b736c feat: add notification sound (#7269)
Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.studio>
Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2023-08-08 15:09:04 -03:00
Lorenzo Lewis
c272e4afbf chore: remove typedoc integration (#7515)
Signed-off-by: Lorenzo Lewis <lorenzo_lewis@icloud.com>
2023-07-28 15:37:27 +03:00
Fabian-Lars
e374bc130d ci: lock tempfile and serde_with versions in CI (#7495)
* ci: lock tempfile and serde_with versions in CI

* Update test-core.yml
2023-07-25 18:25:14 +03:00
Jet Li
57f73f1b6a fix(bundler/nsis): use temp dir for webview2 installer, closes #7409 (#7486)
* fix(bundler/nsis): use temp dir for webview2 installer, closes #7409

* Update .changes/fix-nsis-webview2-installer-use-tempdir.md

---------

Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com>
2023-07-25 17:29:59 +03:00
Alejandro González
2d35f937de fix(bundler): do not skip updater bundle target if only a macOS DMG is generated (#7481) 2023-07-24 09:27:11 -03:00
Lucas Fernandes Nogueira
4dd4893d7d feat: allow specifying a resource map, closes #5844 (#5950)
Co-authored-by: amrbashir <amr.bashir2015@gmail.com>
closes #5844
2023-07-13 18:28:52 -03:00
Dave Ceddia
ef962c43af fix(cli): handle symlinks in updater bundler, closes #3933 (#3934)
Co-authored-by: chip <chip@chip.sh>
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.app>
2023-07-13 14:35:22 -03:00
Fabian-Lars
290e366ae9 fix(build): Copy wv2 runtime in dev, fixes #7373 (#7419) 2023-07-13 14:34:31 -03:00
Lucas Fernandes Nogueira
c98273387c feat(core): enhance readDir error message, closes #7379 (#7416) 2023-07-13 08:00:51 -07:00
Amr Bashir
2eab150563 feat(api/http): properly handle Files in Body.form, closes #7390 (#7394)
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
closes #7390
2023-07-13 08:58:21 -03:00
Amr Bashir
fdaee9a5ce feat(core/plugin): add register_uri_scheme_protocol, closes #7330 (#7350)
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
closes #7330
2023-07-12 16:49:32 -03:00
Amr Bashir
71a0240166 chore: remove hotkey.js script and replace var with const (#7343)
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
2023-07-12 08:44:26 -03:00
Amr Bashir
a2be88a21d refactor: remove bitness crate from bundler (#7405)
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
2023-07-12 07:38:25 -03:00
清茶
907425df55 feat(cli): check cwd for config file before traversing (#7395) 2023-07-11 18:29:15 +03:00
Amr Bashir
764968ab38 feat(bundler/nsis): sign uninstaller, closes #7348 (#7398)
* feat(bundler/nsis): sign uninstaller, closes #7348

* Update bundler-nsis-sign-uninstaller.md

* clippy
2023-07-11 15:54:59 +03:00
Amr Bashir
757e959eb2 feat: respect base tag's target attribute, closes #7285 (#7344)
* feat: respect `base` tag's `target` attribute, closes #7285

* Update core.js

* fix condition
2023-07-11 15:11:23 +03:00
Amr Bashir
fa7f9b77ab fix(core/updater): set max_redirections of 5, closes #7329 (#7341)
* fix(core/updater): set `max_redirections` of 5, closes #7329

* Update .changes/updater-redirect.md
2023-07-11 15:08:53 +03:00
Lucas Fernandes Nogueira
eeff1784e1 chore(deps): update unmaintained dependency from kuchiki to kuchikiki (#7359) (#7367)
Co-authored-by: Davide Baldo <davide@baldo.me>
Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com>
2023-07-11 19:19:13 +09:00
Amr Bashir
e05cd940d6 ci: fix audit workflow and add resolutions for vuln packages (#7392)
* ci: fix audit workflow and add resolutions for vuln packages

* revert rust audit changes
2023-07-11 00:25:18 +03:00
Amr Bashir
f6a13f6f23 ci: downgrade more crates is-terminal, colored and toml:0.7.6 (#7391)
* ci: downgrade more crates `is-terminal`, `colored` and `toml:0.7.6`

* downgrade all versions of toml and cargo_toml

* revert
2023-07-10 16:45:50 +03:00
luofei
eba8e1315e fix(bundler/nsis): fix installer incorrect copyright info (#7386)
Signed-off-by: luofei <luoffei@outlook.com>
2023-07-10 14:56:13 +03:00
Amr Bashir
6e36ebbf84 fix(nsis): set correct ShellVarContext for uninstaller, closes #7315 (#7342) 2023-07-10 14:46:15 +03:00
luofei
32218a6f8c fix(bundler/nsis): use uninstallstring to find wix installation (#7326)
* add change file

Signed-off-by: luofei <luoffei@outlook.com>

* fix(bundler/nsis): Check if the previous installation was done using WiX

Signed-off-by: luofei <luoffei@outlook.com>

* Update .changes/fix-nsis-previous-installation-method.md

---------

Signed-off-by: luofei <luoffei@outlook.com>
2023-07-08 04:26:40 +03:00
luofei
0ae53f4139 fix(bundler/nsis): fix error message appears even after successful uninstall, closes #7317 (#7361)
* fix(bundler/nsis): Uninstall the previous installation package

* Update .changes/fix-nsis-uninstall-previous-version.md

---------

Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com>
2023-07-08 03:43:35 +03:00
Amr Bashir
46df2c9b91 fix(bundler): sort package types before bundling, closes #7349 (#7360)
fix(bundler): sort package types before bundling, closes #7349
2023-07-05 17:17:31 -03:00
Lucas Fernandes Nogueira
f4aedce96c fix(ci): adjust crate downgrades for test-core MSRV (#7346) 2023-07-03 15:42:34 -07:00
Lucas Fernandes Nogueira
539247aacf fix(ci): adjust downgrade crates version step on test-core workflow (#7309) 2023-06-30 09:04:09 -07:00
Fabian-Lars
dad4f54eec fix(cli): Disable version check, fixes #7273 (#7277) 2023-06-21 19:19:31 +08:00
Lucas Fernandes Nogueira
df6712cfb3 docs(core): fix panic section on manage documentation (#7251) 2023-06-21 07:50:41 -03:00
Raphii
1a3dcdb830 fix(core): fix nsis updater unable to launch installers requiring elevation, closes #7184 (#7185)
* Launch NSIS updaters requiring elevation from non-elevated process

* Add changes file

* remove detached process, use powershell

* Update updater-admin-launch-fix.md

---------

Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com>
2023-06-19 18:11:16 +03:00
Amr Bashir
8c0166f459 ci: use toJSON (#7248) 2023-06-18 06:58:34 -03:00
Lucas Fernandes Nogueira
fdf68405a4 chore(ci): use a separate covector workflor for 1.x (#7243) 2023-06-18 06:57:37 -03:00
Lucas Fernandes Nogueira
be6f4319ff fix(ci): correctly set tag for tauri-cli release (#7246) 2023-06-17 19:14:12 -03:00
Lucas Fernandes Nogueira
2acc474ccb fix(ci): only check change tags on added or modified files (#7236) 2023-06-17 16:57:25 +03:00
github-actions[bot]
4b3d66c793 Apply Version Updates From Current Changes (v1) (#7234)
Co-authored-by: lucasfernog <lucasfernog@users.noreply.github.com>
2023-06-17 10:45:52 -03:00
Lucas Fernandes Nogueira
49dbbbbcdf feat(ci): prepare CI for 1.x branch (#7231) 2023-06-17 09:41:22 -03:00
Amr Bashir
6afd34727f fix(core): revert #6680, remove default notification sound on Windows (#7229)
fix(core): revert #6680, remove default notification sound on Windows
2023-06-17 09:18:16 -03:00
Amr Bashir
066c09a6ea fix(core): fix require_literal_leading_dot flipped behavior (#7227) 2023-06-17 09:17:36 -03:00
Amr Bashir
28921cb8e8 ci: fix getting release id (#7207) 2023-06-15 08:36:05 -03:00
Lucas Fernandes Nogueira
2071265fea add to additionals (#7206) 2023-06-14 16:10:52 -07:00
Fabian-Lars
3fb3f11fc8 docs(api.js): fix since version for locale() (#7205) 2023-06-14 20:30:57 +03:00
github-actions[bot]
b7ae725c5e Apply Version Updates From Current Changes (#6901)
Co-authored-by: lucasfernog <lucasfernog@users.noreply.github.com>
2023-06-14 12:59:28 -03:00
Lucas Fernandes Nogueira
bd96edd2b9 fix: bump macros, codegen and build crates with minor (#7203) 2023-06-14 12:09:11 -03:00
Lucas Fernandes Nogueira
aa94f049c1 fix(tests): adjust default bundle target for updater integration test (#7201) 2023-06-14 11:17:02 -03:00
Lucas Fernandes Nogueira
c1d36e4953 chore: remove duplicated crate in change file (#7198) 2023-06-14 15:05:44 +03:00
Fabian-Lars
4cfb686d2b fix(cli): Pin minisign to 0.7.3 to prevent issues with empty key passwords (#7197) 2023-06-14 08:00:28 -03:00
renovate[bot]
d5769b3bfb chore(deps) Update Rust crate log to 0.4.19 (#7193)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-14 07:37:06 -03:00
renovate[bot]
066417d3f0 chore(deps) Update Rust crate log to 0.4.19 (#7194)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-14 07:36:46 -03:00
renovate[bot]
29a287ee82 chore(deps) Update Tauri API Definitions to v5.59.11 (#7195)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-14 07:36:26 -03:00
Amr Bashir
d75c1b829b fix(cli): warn about bundling updater target without appropriate targets, closes #7181 (#7189)
* fix(cli): warn about bundling updater target without appropriate targets, closes #7181

* change tags

* cleanup

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
2023-06-14 02:14:35 +03:00
Lucas Fernandes Nogueira
696d77c3ce fix(core): global events now reaches window listeners, closes #4493 (#7163)
Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com>
2023-06-13 08:05:58 -03:00
Fabian-Lars
5d85d0990c fix(core): Send updater status events when default dialog is enabled, closes #7128 (#7157) 2023-06-13 08:05:42 -03:00
Amr Bashir
076e1a81a5 fix(core): use u32 for js listeners ids, closes #7119 (#7159) 2023-06-07 17:54:04 -03:00
Amr Bashir
fc2e4083b0 ci: check for change tag (#7149)
* ci: check for change tag

* fix workflow

* Update .scripts/ci/check-change-tags.js

* feat: also check if tag is known

seems like covector does not check that so we can do it here for now

* remove push run

* only check changed files

* add missing tag

---------

Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.studio>
2023-06-07 16:32:36 +03:00
Lucas Fernandes Nogueira
1d99f8a3c2 feat(core): expose test utils (#4752) 2023-06-07 10:22:14 -03:00
renovate[bot]
d33672cffe chore(deps) Update Tauri Bundler (#7152)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-07 09:39:31 -03:00
renovate[bot]
ba6e5813e6 chore(deps) Update Tauri API Definitions (#7151)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-07 09:38:27 -03:00
dependabot[bot]
a6da7ef8af chore(deps-dev): bump vite from 2.9.13 to 2.9.16 in /examples/api (#7138)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-06 14:06:29 -03:00
Fabian-Lars
db7c5fbf2e refactor(core): Remove attohttpc in favor of reqwest (#7143)
Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.studio>
2023-06-06 13:29:52 -03:00
Lucas Fernandes Nogueira
52474e479d feat(cli): enhance Cargo features injection, add tests (#7141) 2023-06-06 13:29:28 -03:00
Amr Bashir
b41b57ebb2 fix(core): avoid panics in global shortcut, closes #7105 (#7136) 2023-06-05 16:43:44 -03:00
Lucas Fernandes Nogueira
647800c563 refactor(cli): use rewrite manifest logic on table entry (#7134) 2023-06-05 14:38:26 -03:00
renovate[bot]
3a8bb4c153 chore(deps) Update Tauri JS CLI (#7093)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-05 10:06:45 -03:00
renovate[bot]
c2acf96306 chore(deps) Update Tauri API Definitions to v5.59.8 (#7091)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-05 09:52:05 -03:00
renovate[bot]
f8bdc7be62 chore(deps) Update Rust crate log to 0.4.18 (#7090)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-05 09:51:40 -03:00
Amr Bashir
0503eb69ce fix(core): account for data: uri when calculating origin, closes #7078 (#7133)
Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2023-06-05 09:47:21 -03:00
Reupen Shah
85e77fb797 fix: correct MIME type of .txt files (ref: #6762) (#7111)
Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2023-06-05 09:16:05 -03:00
fcfangcc
3327dd641d fix(bundler/macos): clean up .app bundle if only .dmg is enabled #7081 (#7116)
Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2023-06-05 08:49:37 -03:00
icedrocket
c596aaefcf fix(examples): make video fits within window (#7129) 2023-06-05 08:11:32 -03:00
Raphii
4d4b72ba38 Fix missing quote in Japanese NSIS language file. (#7086)
* Update Japanese.nsh

* Create nsis-japanese-fix.md

* Update .changes/nsis-japanese-fix.md

Co-authored-by: Fabian-Lars <fabianlars@fabianlars.de>

---------

Co-authored-by: Fabian-Lars <fabianlars@fabianlars.de>
2023-06-03 13:08:10 +02:00
Fabian-Lars
d7a0a2cd1a ci: Use correct native-tls feature flags for win32-arm64 cli, ref #7098 (#7107) 2023-06-02 19:04:48 +08:00
Fabian-Lars
0ddbb3a1dc feat(cli): Build the CLI for Windows ARM64, closes #7015 (#7098)
* feat(cli): Build the CLI for Windows ARM64

* lockfile
2023-06-01 11:04:14 +08:00
Lucas Fernandes Nogueira
3303041c92 chore(api): document new options from #6665 (#7072) 2023-05-27 04:39:37 -07:00
Lucas Fernandes Nogueira
27c5f364a8 fix(macros): use full path to Result to avoid issues with type aliases (#7071) 2023-05-27 04:37:19 -07:00
Amr Bashir
000104bc3b feat: add is_focused APIs, closes #6472 (#6530)
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
2023-05-26 13:37:28 -03:00
Kevin Yue
8fd9cfa1f2 fix(doc): correct the doc of content_protected() (#7065) 2023-05-26 09:23:57 -03:00
Bo
17d5a4f51f feat(core): early panic if the PNG icon is not RGBA, closes #6706 (#6712) 2023-05-26 15:26:21 +08:00
Pascal Sommer
d68a25e32e Improve compile errors for async commands without Result return type (#6124)
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
2023-05-26 01:04:30 -03:00
Lucas Fernandes Nogueira
154ccbe503 fix(tests): only download update when it is available (#7061) 2023-05-25 21:22:55 -03:00
Jonas Kruckenberg
6c5ade08d9 feat(cli.rs) Shell completions (#4537)
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
Co-authored-by: Simon Hyll <hyllsimon@gmail.com>
Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2023-05-25 11:34:37 -03:00
Amr Bashir
1b8001b8b8 fix(bundler/nsis): calculate accurate app size, closes #7056 (#7057) 2023-05-25 11:34:05 -03:00
Tomáš Diblík
c4d6fb4b1e feat(core): Ability to disable minimize/maximize/close native window's buttons, closes #2353 (#6665)
Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com>
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2023-05-24 17:23:32 -03:00
Lej77
65fd674f50 fix: sound for notifications on windows (fix #6652) (#6680) 2023-05-24 17:20:13 -03:00
Francis The Basilisk
35cd751adc feat(bundler): custom desktop file template, closes #5176 (#5180)
Co-authored-by: Fabian-Lars <fabianlars@fabianlars.de>
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
2023-05-24 16:04:54 -03:00
Amr Bashir
ff5e4dbbb0 fix(core): populate webview_attrs from config, closes #6794 (#6797)
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
2023-05-24 15:39:51 -03:00
Amr Bashir
df89ccc191 feat(nsis): implement passive mode, closes #6955 (#6998)
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
2023-05-24 14:16:12 -03:00
Amr Bashir
60334f9e02 feat(bundler/NSIS): uninstall previous wix if exist, closes #6859 (#6933) 2023-05-24 13:33:30 -03:00
renovate[bot]
0f707d2b53 chore(deps) Update Rust crate serde_with to v3 (#7048)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-05-24 13:17:21 -03:00
Amr Bashir
2317913b71 fix(core): use safe_block_on (#7047)
fixes regression introduced in 45330e3819

ref: https://github.com/tauri-apps/tauri/issues/6375#issuecomment-1560063696
2023-05-24 05:07:31 +03:00
Amr Bashir
359058cecc feat(api): add locale function, closes #5939 (#5960) 2023-05-23 16:02:33 -03:00
Amr Bashir
45330e3819 fix(core): rewrite asset protocol streaming, closes #6375 (#6390)
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
2023-05-23 15:30:31 -03:00
Amr Bashir
17da87d3cd fix(bundler/nsis): write installer templates UTF16LE encoded, closes #7036 (#7040)
* fix(bundler/nsis): write installer templates UTF16LE encoded, closes #7036

* cleanup

* lint

* return err instead of panic

* Update .changes/nsis-encoding.md [skip ci]

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
2023-05-23 19:00:21 +03:00
Amr Bashir
8b9f6cf868 chore: add change tags for existing change files (#7041) 2023-05-23 18:56:47 +03:00
Amirhossein Akhlaghpour
4c39e46a3b feat: current_version feature (#7026)
* feat: reexport webview_verion

* chore: clippy problems

* fix: add .changes md file

* Update .changes/add-webview-version.md
2023-05-23 18:35:49 +03:00
Usman Rajab
43858a3197 feat(bundler/NSIS): Add Swedish to supported NSIS languages (#7038) 2023-05-23 17:41:40 +03:00
Amr Bashir
3cb7a3e642 fix(cli/devserver): inject autoreload into HTML only, closes #6997 (#7032) 2023-05-23 17:39:11 +03:00
Amr Bashir
baa581b814 ci: fix version-or-publish workflow (#7031)
* ci: fix version-or-publish workflow

* test syntax

* how about this?

* just use jq

* Delete test.js
2023-05-23 17:38:31 +03:00
Nathanael Rea
fb7ef8dacd fix(cli.js): detect node-20 binary (#6667)
* fix nodejs binary regex

* Update clijs-node-version-20.md
2023-05-23 01:09:49 +03:00
dependabot[bot]
1161b6788e chore(deps): bump h2 from 0.3.15 to 0.3.19 in /examples/api/src-tauri (#7030)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-22 16:35:19 -03:00
renovate[bot]
76714dc628 chore(deps) Update Tauri API Definitions (#6798)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-05-22 16:34:55 -03:00
Amr Bashir
af93729031 fix: add missing file properties on Windows, closes #6676 (#6693)
Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.studio>
2023-05-22 16:34:33 -03:00
Amr Bashir
262776d8d8 docs(tauri-build): clarify common-controls-v6 dependency, closes #6732 (#6736) 2023-05-22 15:07:08 -03:00
renovate[bot]
86d3c0cc0f chore(deps) Update Tauri CLI (major) (#6688)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
2023-05-22 14:22:46 -03:00
Lucas Fernandes Nogueira
a541820aa8 fix(cli): revert metadata.json field rename from #6795 (#7029) 2023-05-22 14:07:53 -03:00
renovate[bot]
0974ecccd6 chore(deps) Update Tauri Bundler (#6683)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-05-22 14:06:16 -03:00
Amr Bashir
5ec6353a60 refactor: change package names to match published packages (#6795)
Co-authored-by: Fabian-Lars <fabianlars@fabianlars.de>
2023-05-22 12:52:44 -03:00
renovate[bot]
9e67ec68ac chore(deps) Update dependency prettier to v2.8.8 (#6799)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-05-22 11:41:03 -03:00
dependabot[bot]
ffd4db5ae4 chore(deps): bump enumflags2 from 0.7.5 to 0.7.7 in /examples/api/src-tauri (#6786)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-22 11:40:40 -03:00
Gökçe Merdun
ac183948d6 feat(bundler/NSIS): Add Turkish to supported NSIS languages (#7018) 2023-05-21 19:15:17 +03:00
Risto Stevcev
0032daf2a3 Docs: Added void linux to readme (#6711) 2023-05-21 11:29:09 -03:00
Amr Bashir
5eba069b1d docs: curate and document tauri's env vars (#6983)
* docs: curate and document tauri's env vars

* fill apple env vars

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2023-05-21 13:23:47 +03:00
yutotnh
2b487c9467 Fix typo (#7012)
Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.app>
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
2023-05-20 08:24:07 -03:00
Amr Bashir
b9eac96cdc ci: pin toml to 0.7.3 (#7011)
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
2023-05-20 07:52:21 -03:00
Lucas Fernandes Nogueira
1253bbf7ae fix(cli): correctly remove Cargo features (#7013) 2023-05-20 00:12:11 -03:00
Soumt
61e3ad89e9 feat(bundler/NSIS): Add Korean to supported NSIS languages (#7010)
* Feat: Add Korean language

* fmt
2023-05-20 01:49:20 +03:00
Simon Hyll
fc7f9ebada feat: adding copyright text to BrandingText (#7001) 2023-05-19 19:42:24 +08:00
Risto Stevcev
0302138f2f fix: updated appimage script to follow symlinks for /usr/lib* (fix: #6992) (#6996)
* Updated appimage script to follow symlinks for /usr/lib*

* Added appimage-follow-symlinks change file
2023-05-19 13:22:22 +08:00
Fabian-Lars
c7056d1b20 fix(cli): improve vs build tools detection (#6982)
* fix(cli): improve vs build tools detection

* clean up

* typos

* changefile

* patch instead of minor

* update vswhere

* use vswhere instead of custom logic. update wording

* sort and dedup manually
2023-05-18 22:47:28 +03:00
Amr Bashir
acc36fe117 feat(core): add option for require_literal_leading_dot, closes #6158 (#6969)
* feat(core): add option for `require_literal_leading_dot`, closes #6158

* change to `Option<bool>`

* fix to tokens impl

* Apply suggestions from code review

Co-authored-by: Simon Hyll <hyllsimon@gmail.com>

---------

Co-authored-by: Simon Hyll <hyllsimon@gmail.com>
2023-05-18 16:11:50 +03:00
Amr Bashir
cd3846c8ce feat(nsis): restart app after updating, closes #6955 (#6987)
* feat(nsis): restart app after updating, closes #6955

* Apply suggestions from code review
2023-05-18 16:11:31 +03:00
Amr Bashir
fd3b5a16b1 fix(cli): find correct binary when --profile is used, closes #6954 (#6979)
* fix(cli): find correct binary when `--profile` is used, closes #6954

* clippy
2023-05-17 16:17:47 +03:00
Amr Bashir
82169e69fc fix(core): remove trailing slash in http scope url, closes #5208 (#6974)
* fix(core): remove trailing slash in http scope url, closes #5208

* fix tests

* one more tests fix

* clippy
2023-05-17 14:33:10 +03:00
Amr Bashir
aecf146909 fix(core/ipc): access url through webview native object, closes #6889 (#6976) 2023-05-17 14:32:45 +03:00
Fabian-Lars
2b26b2e611 fix(bundler): Add new lang_file option in persian variant. (#6972) 2023-05-16 15:33:08 +03:00
Fabian-Lars
d2710e9d2e fix(core): unpin all dependencies, closes #6944 (#6966) 2023-05-16 19:27:15 +08:00
Amr Bashir
3700793a2f fix(updater): emit UPTODATE when server responds with 204, closes #6934 (#6970) 2023-05-16 13:00:00 +08:00
Amirhossein Akhlaghpour
21d5eb84ab feat: add Persian language to NSIS installer (#6965) 2023-05-16 12:58:30 +08:00
Amr Bashir
46a58afd9e chore: remove duplicate tauri in tauri-config-schema name (#6967) 2023-05-15 15:12:51 -03:00
Amr Bashir
3cc295e997 fix(nsis): prefill $INSTDIR with previous install path and respect /D flag, closes #6928 (#6935)
* fix(bundler/nsis): prefill $INSTDIR with previous install path

* fix(nsis): prefill $INSTDIR with previous install path and respect `/D` flag, closes #6928
2023-05-15 18:14:15 +03:00
Amr Bashir
2948820579 feat(bundler/NSIS): allow specifying custom lang files (#6867)
* feat(bundler/NSIS): allow specifying custom lang files

* add dunc as dep on all platforms

* clippy

* Update tooling/bundler/src/bundle/windows/nsis.rs

Co-authored-by: Fabian-Lars <fabianlars@fabianlars.de>

* Update core/tauri-utils/src/config.rs

Co-authored-by: Fabian-Lars <fabianlars@fabianlars.de>

* schema files

---------

Co-authored-by: Fabian-Lars <fabianlars@fabianlars.de>
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
2023-05-15 18:11:10 +03:00
Amr Bashir
e0c30a7e8b refactor: use const instead of a function (#6958) 2023-05-14 17:03:40 -03:00
Jack Wills
441f964654 feat(core/tauri): add try_get_item for SystemTray and WindowMenu, closes #5491 (#6408)
* feat: try_get_item() for window menu

Add a method in the MenuHandle struct, that will return an Optional MenuItemHandle

feat: try_get_item() for systemtray

Add a method in the SystemTrayHandle struct, that will return an Optional SystemTrayMenuItemHandle

docs: features documented in ./changes/minor.md

fix: suggested changes

fix CI

* Update .changes/tray_get_item.md

---------
2023-05-12 16:15:36 +03:00
Pierre Cashon
2c1fd570f8 fix(bundler): ensure that there are no duplicate extension arguments when bundling on Windows, fixes #6103 (#6917)
* fix(bundler): ensure that there are no duplicate extension arguments during bundling on Windows (fix #6103)

* fix(bundler): ensure that there are no duplicate extension arguments during bundling on Windows (fix #6103)
2023-05-12 15:52:26 +03:00
Guilherme Oenning
7c23720920 feat: add tauri::version, similar to getTauriVersion available on JS API (#6546)
Signed-off-by: goenning <me@goenning.net>

Apply suggestions from code review
2023-05-12 15:36:31 +03:00
KurikoMoe
fb485d25a0 fix(cli): fix cli connection timeout to dev server (fix #6045) (#6046)
Fix tauri-cli connection to dev server stucks and waits for TCP timeout.
2023-05-12 15:01:24 +03:00
Akshay
a08d1b248f chore: fix broken symlinks in license files (#6336)
symlink to repo root
2023-05-12 14:56:32 +03:00
Amr Bashir
dc682155de fix(core): Fix WindowBuilder::on_navigation handler never registerd, closes #6865 (#6921)
* fix(core): Fix `WindowBuilder::on_navigation` handler never registerd, closes #6865

* clippy
2023-05-12 14:03:42 +03:00
Amr Bashir
e092f79946 feat(bundler/nsis): allow specifying custom template, closes #6887 (#6922) 2023-05-12 14:02:07 +03:00
Fabian-Lars
c2b0dab7ef docs: Fix api.js docs pipeline with updated typedoc dependencies (#6945) 2023-05-12 07:54:15 -03:00
nathan-fall
b257bebf9e feat(bundler): Add Japanese to supported NSIS languages, ref #6906 (#6940) 2023-05-11 09:50:35 +02:00
hanaTsuk1
bf49a7679a update bundler nsis template(SimpChinese, TradChinese) (#6939) 2023-05-11 14:30:13 +08:00
Simon Hyll
469d9f8a4a docs(tauri-utils): described behavior of version field when omitted (#6938) 2023-05-11 14:18:45 +08:00
Simon Hyll
41e10b22fa chore: fixed grammar and typos (#6937) 2023-05-11 02:21:15 +03:00
Ronie Martinez
96d346222f docs: Update Github workflow status shields (#6910)
* docs: Update Github workflow status shields

* Update with name, icon and fix
2023-05-10 04:04:12 +03:00
Amr Bashir
2b47426be8 chore: explain covector tags (#6923) 2023-05-09 21:59:01 +03:00
Amr Bashir
aa2a30e96b chore: setup covector change tags/sections/groups (#6920)
![image](https://github.com/tauri-apps/tauri/assets/48618675/ac4f22dd-630d-4bfc-8966-48d19492593f)
2023-05-09 17:45:50 +03:00
Raphii
540ddd4e6a feat(bundler): Add Dutch to supported NSIS languages, ref #6906 (#6907)
* Add Dutch to supported NSIS languages

* Added change file

* Reference Dutch language in nsis bundler

* Fix formatting
2023-05-09 15:37:05 +02:00
Lucas Fernandes Nogueira
2659ca1ab4 feat(cli): add rustls as default Cargo feature (#6900) 2023-05-08 09:29:17 -03:00
chip
24490bca19 use handlebars::no_escape instead of closures (#6899) 2023-05-08 08:39:54 -03:00
github-actions[bot]
73a0ad41c7 apply version updates (#6858)
Co-authored-by: wusyong <wusyong@users.noreply.github.com>
2023-05-08 18:51:23 +08:00
296 changed files with 24787 additions and 8895 deletions

View File

@@ -1,6 +1,16 @@
{
"gitSiteUrl": "https://www.github.com/tauri-apps/tauri/",
"timeout": 3600000,
"changeTags": {
"feat": "New Features",
"enhance": "Enhancements",
"bug": "Bug Fixes",
"pref": "Performance Improvements",
"changes": "What's Changed",
"sec": "Security fixes",
"deps": "Dependencies",
"breaking": "Breaking Changes"
},
"defaultChangeTag": "changes",
"pkgManagers": {
"rust": {
"errorOnVersionRange": "^2.0.0-0",
@@ -62,7 +72,7 @@
],
"assets": [
{
"path": "${ pkg.path }/target/package/${ pkg.pkg }-${ pkgFile.version }.crate",
"path": "./target/package/${ pkg.pkg }-${ pkgFile.version }.crate",
"name": "${ pkg.pkg }-${ pkgFile.version }.crate"
}
]
@@ -123,13 +133,13 @@
}
},
"packages": {
"api": {
"@tauri-apps/api": {
"path": "./tooling/api",
"manager": "javascript",
"assets": [
{
"path": "./tooling/api/dist/tauri-apps-api-${ pkgFile.version }.tgz",
"name": "api-${ pkgFile.version }.tgz"
"name": "tauri-apps-api-${ pkgFile.version }.tgz"
}
],
"prepublish": [
@@ -231,11 +241,11 @@
],
"postversion": "node ../../.scripts/covector/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }"
},
"cli.js": {
"@tauri-apps/cli": {
"path": "./tooling/cli/node",
"manager": "javascript",
"getPublishedVersion": "node ../../../.scripts/covector/package-latest-version.js npm ${ pkgFile.pkg.name } ${ pkgFile.pkg.version }",
"dependencies": ["cli.rs"],
"dependencies": ["tauri-cli"],
"postversion": [
"node ../../../.scripts/covector/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }",
"cargo build --manifest-path ../../../core/tauri-config-schema/Cargo.toml"
@@ -244,7 +254,7 @@
"publish": [],
"postpublish": []
},
"cli.rs": {
"tauri-cli": {
"path": "./tooling/cli",
"manager": "rust",
"dependencies": ["tauri-bundler", "tauri-utils"],
@@ -261,7 +271,8 @@
},
"tauri-driver": {
"path": "./tooling/webdriver",
"manager": "rust"
"manager": "rust",
"postversion": "cargo check"
}
}
}

View File

@@ -1,5 +0,0 @@
---
'tauri-bundler': 'patch'
---
Correctly escape XML for resource files in WiX bundler.

View File

@@ -1,8 +0,0 @@
---
'tauri-bundler': 'patch'
---
Added the following languages to the NSIS bundler:
- `Spanish`
- `SpanishInternational`

View File

@@ -1,5 +0,0 @@
---
'tauri-bundler': 'patch'
---
Correctly escape arguments in NSIS script to fix bundling apps that use non-default WebView2 install modes.

View File

@@ -1,31 +1,44 @@
# Changes
##### via https://github.com/jbolda/covector
As you create PRs and make changes that require a version bump, please add a new markdown file in this folder. You do not note the version _number_, but rather the type of bump that you expect: major, minor, or patch. The filename is not important, as long as it is a `.md`, but we recommend that it represents the overall change for organizational purposes.
When you select the version bump required, you do _not_ need to consider dependencies. Only note the package with the actual change, and any packages that depend on that package will be bumped automatically in the process.
Use the following format:
```md
---
"package-a": patch
"package-b": patch
---
Change summary goes here
```
Summaries do not have a specific character limit, but are text only. These summaries are used within the (future implementation of) changelogs. They will give context to the change and also point back to the original PR if more details and context are needed.
Changes will be designated as a `major`, `minor` or `patch` as further described in [semver](https://semver.org/).
Given a version number MAJOR.MINOR.PATCH, increment the:
- MAJOR version when you make incompatible API changes,
- MINOR version when you add functionality in a backwards compatible manner, and
- PATCH version when you make backwards compatible bug fixes.
Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format, but will be discussed prior to usage (as extra steps will be necessary in consideration of merging and publishing).
# Changes
##### via https://github.com/jbolda/covector
As you create PRs and make changes that require a version bump, please add a new markdown file in this folder. You do not note the version _number_, but rather the type of bump that you expect: major, minor, or patch. The filename is not important, as long as it is a `.md`, but we recommend that it represents the overall change for organizational purposes.
When you select the version bump required, you do _not_ need to consider dependencies. Only note the package with the actual change, and any packages that depend on that package will be bumped automatically in the process.
Use the following format:
```md
---
'package-a': patch
'package-b': patch
---
Change summary goes here
```
Summaries do not have a specific character limit, but are text only. These summaries are used within the (future implementation of) changelogs. They will give context to the change and also point back to the original PR if more details and context are needed.
Changes will be designated as a `major`, `minor` or `patch` as further described in [semver](https://semver.org/).
Given a version number MAJOR.MINOR.PATCH, increment the:
- MAJOR version when you make incompatible API changes,
- MINOR version when you add functionality in a backwards compatible manner, and
- PATCH version when you make backwards compatible bug fixes.
Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format, but will be discussed prior to usage (as extra steps will be necessary in consideration of merging and publishing).
Additionally you could specify a tag for the change file to group it with other changes by prefixing the bump with `:<tag>`, for example:
```md
---
'package-a': patch:bug
---
Change summary goes here
```
which will group this change file with other changes that specify the `bug` tag.
For list of available tags, see the `changeTags` key in [./config.json](./config.json)

View File

@@ -54,20 +54,20 @@ Some Tauri packages will be automatically built when running one of the examples
### Packages Overview
- The JS API (`/tooling/api`) contains JS bindings to the builtin Rust functions in the Rust API.
- cli.rs (`/tooling/cli`) is the primary CLI for creating and developing Tauri apps.
- cli.js (`/tooling/cli/node`) is a Node.js CLI wrapper for `cli.rs`.
- Tauri Bundler (`/tooling/bundler`) is used by the Rust CLI to package executables into installers.
- Tauri Core (`/core/tauri`) is the heart of Tauri. It contains the code that starts the app, configures communication between Rust and the Webview, and ties all the other packages together.
- The Macros (`/core/tauri-macros`) are used by Tauri Core for various functions.
### Developing The Node.js CLI (cli.js)
`cli.js` is a wrapper to `cli.rs` so most changes should be written on the Rust CLI. The `[Tauri repo root]/tooling/cli/node` folder contains only packaging scripts to properly publish the Rust CLI binaries to NPM.
- Tauri Bundler (`/tooling/bundler`) is used by the Rust CLI to package executables into installers.
- The Rust CLI aka `tauri-cli` (`/tooling/cli`) is the primary CLI for creating and developing Tauri apps.
- The JS CLI aka `@tauri-apps/cli` (`/tooling/cli/node`) is a Node.js CLI wrapper for `tauri-cli`.
- The JS API aka `@tauri-apps/api` (`/tooling/api`) contains JS bindings to the builtin Rust functions in the Rust API.
### Developing Tauri Bundler and Rust CLI
The code for the bundler is located in `[Tauri repo root]/tooling/bundler`, and the code for the Rust CLI is located in `[Tauri repo root]/tooling/cli`. If you are using your local copy of cli.js (see above), any changes you make to the bundler and CLI will be automatically built and applied when running the build or dev command. Otherwise, running `cargo install --path .` in the Rust CLI directory will allow you to run `cargo tauri build` and `cargo tauri dev` anywhere, using the updated copy of the bundler and cli. You will have to run this command each time you make a change in either package.
The code for the bundler is located in `[Tauri repo root]/tooling/bundler`, and the code for the Rust CLI is located in `[Tauri repo root]/tooling/cli`. If you are using your local copy of `@tauri-apps/cli` (see above), any changes you make to the bundler and CLI will be automatically built and applied when running the build or dev command. Otherwise, running `cargo install --path .` in the Rust CLI directory will allow you to run `cargo tauri build` and `cargo tauri dev` anywhere, using the updated copy of the bundler and cli. You will have to run this command each time you make a change in either package.
### Developing The Node.js CLI (`@tauri-apps/cli`)
`@tauri-apps/cli` is a wrapper to `tauri-cli` so most changes should be written on the Rust CLI. The `[Tauri repo root]/tooling/cli/node` folder contains only packaging scripts to properly publish the Rust CLI binaries to NPM.
### Developing Tauri Core and Related Components (Rust API, Macros, Codegen, and Utils)

View File

@@ -1,30 +1,21 @@
<!--
Update "[ ]" to "[x]" to check a box
Before submitting a PR, please read https://github.com/tauri-apps/tauri/blob/dev/.github/CONTRIBUTING.md#pull-request-guidelines
Please make sure to read the Pull Request Guidelines: https://github.com/tauri-apps/tauri/blob/dev/.github/CONTRIBUTING.md#pull-request-guidelines
1. Give the PR a descriptive title.
Examples of good title:
- fix(windows): fix race condition in event loop
- docs: update docstrings
- feat: add `Window::set_fullscreen`
Examples of bad title:
- fix #7123
- update docs
- fix bugs
2. If there is a related issue, reference it in the PR text, e.g. closes #123.
3. If this change requires a new version, then add a change file in `.changes` directory with the appropriate bump, see https://github.com/tauri-apps/tauri/blob/dev/.changes/readme.md
4. Ensure that all your commits are signed https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits
5. Ensure `cargo test` and `cargo clippy` passes.
6. Propose your changes as a draft PR if your work is still in progress.
-->
### What kind of change does this PR introduce?
<!-- Check at least one. If you are introducing a new binding, you must reference an issue where this binding has been proposed, discussed and approved by the maintainers. -->
- [ ] Bugfix
- [ ] Feature
- [ ] Docs
- [ ] New Binding issue #___
- [ ] Code style update
- [ ] Refactor
- [ ] Build-related changes
- [ ] Other, please describe:
### Does this PR introduce a breaking change?
<!-- If yes, please describe the impact and migration path for existing applications in an attached issue. -->
- [ ] Yes, and the changes were approved in issue #___
- [ ] No
### Checklist
- [ ] When resolving issues, they are referenced in the PR's title (e.g `fix: remove a typo, closes #___, #___`)
- [ ] A change file is added if any packages will require a version bump due to this PR per [the instructions in the readme](https://github.com/tauri-apps/tauri/blob/dev/.changes/readme.md).
- [ ] I have added a convincing reason for adding this feature, if necessary
### Other information

View File

@@ -10,6 +10,7 @@ on:
- cron: '0 0 * * *'
push:
paths:
- '.github/workflows/audit.yml'
- '**/Cargo.lock'
- '**/Cargo.toml'
- '**/package.json'
@@ -33,6 +34,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: yarn audit
- name: audit workspace
run: yarn audit
- name: audit @tauri-apps/api
working-directory: tooling/api
run: yarn audit
- name: audit @tauri-apps/cli
working-directory: tooling/cli/node
run: yarn audit

View File

@@ -2,13 +2,13 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: benches
name: bench
on:
push:
branches:
- dev
- next
- 1.x
workflow_dispatch:
env:

32
.github/workflows/check-change-tags.yml vendored Normal file
View File

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

View File

@@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: Check generated files
name: check generated files
on:
pull_request:
@@ -13,16 +13,6 @@ on:
- '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'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@@ -42,14 +32,13 @@ jobs:
filters: |
api:
- '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'
check-api:
api:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.api == 'true'
@@ -60,11 +49,9 @@ jobs:
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
run: ./.scripts/ci/has-diff.sh
check-schema:
schema:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.schema == 'true'

View File

@@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: Check generated files
name: check license headers
on:
pull_request:
@@ -25,4 +25,4 @@ jobs:
- 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 }}
run: node ./.scripts/ci/check-license-header.js ${{ steps.filter.outputs.added_files }}

View File

@@ -0,0 +1,242 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: covector version or publish
on:
push:
branches:
- 1.x
- v1/msrv-check
jobs:
msrv-list:
runs-on: ${{ matrix.platform.os }}
strategy:
fail-fast: false
matrix:
platform:
- {
target: x86_64-pc-windows-msvc,
os: windows-latest,
toolchain: '1.61.0'
}
- {
target: x86_64-unknown-linux-gnu,
os: ubuntu-latest,
toolchain: '1.60.0'
}
- {
target: x86_64-apple-darwin,
os: macos-13,
toolchain: '1.60.0'
}
steps:
- uses: actions/checkout@v4
- name: install rust ${{ matrix.platform.toolchain }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.platform.toolchain }}
target: ${{ matrix.platform.target }}
override: true
default: true
- name: install Linux dependencies
if: contains(matrix.platform.target, 'unknown-linux')
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
- uses: Swatinem/rust-cache@v2
- name: delete lockfile
run: rm Cargo.lock
- name: Downgrade crates with MSRV conflict
# The --precise flag can only be used once per invocation.
run: |
cargo update -p system-deps:6.2.2 --precise 6.1.1
cargo update -p toml:0.7.8 --precise 0.7.3
cargo update -p toml_edit:0.19.15 --precise 0.19.8
cargo update -p embed-resource --precise 2.3.0
cargo update -p notify-rust --precise 4.10.0
cargo update -p toml_datetime --precise 0.6.1
cargo update -p serde_spanned --precise 0.6.1
cargo update -p winnow --precise 0.4.1
cargo update -p plist --precise 1.5.1
cargo update -p serde_with:3.8.2 --precise 3.0.0
cargo update -p time --precise 0.3.15
cargo update -p ignore --precise 0.4.18
cargo update -p raw-window-handle --precise 0.5.0
cargo update -p cargo_toml:0.15.3 --precise 0.15.2
cargo update -p zbus --precise 3.13.0
cargo update -p zbus_names --precise 2.5.0
cargo update -p colored --precise 2.0.2
cargo update -p arboard --precise 3.2.1
cargo update -p tempfile --precise 3.6.0
cargo update -p tokio --precise 1.29.0
cargo update -p flate2 --precise 1.0.26
cargo update -p hyper --precise 0.14.28
cargo update -p h2 --precise 0.3.20
cargo update -p reqwest --precise 0.11.18
cargo update -p bstr --precise 1.6.2
cargo update -p cfg-expr:0.15.8 --precise 0.15.4
cargo update -p memchr --precise 2.6.2
cargo update -p async-executor --precise 1.5.1
cargo update -p proptest --precise 1.2.0
cargo update -p regex --precise 1.9.6
cargo update -p bstr --precise 1.6.2
cargo update -p backtrace --precise 0.3.68
cargo update -p blocking --precise 1.4.1
cargo update -p ignore --precise 0.4.18
cargo update -p globset --precise 0.4.13
cargo update -p crossbeam-channel --precise 0.5.8
cargo update -p crossbeam-utils --precise 0.8.16
cargo update -p image --precise 0.24.4
cargo update -p async-process --precise 1.7.0
cargo update -p is-terminal --precise 0.4.7
cargo update -p tar --precise 0.4.39
cargo update -p serde_json --precise 1.0.97
cargo update -p petgraph --precise 0.6.3
cargo update -p os_str_bytes --precise 6.5.1
cargo update -p thread_local --precise 1.1.7
cargo update -p cc --precise 1.0.94
cargo update -p home --precise 0.5.5
cargo update -p tree_magic_mini --precise 3.0.3
cargo update -p tokio-test --precise 0.4.3
cargo update -p tokio-stream --precise 0.1.14
cargo update -p tokio-util --precise 0.7.10
cargo update -p os_pipe --precise 1.1.5
cargo update -p syn:2.0.68 --precise 2.0.67
cargo update -p derive_more --precise 0.99.17
cargo update -p native-tls --precise 0.2.11
- name: test build
run: cargo check --target ${{ matrix.platform.target }} --features tracing,compression,wry,linux-protocol-headers,isolation,custom-protocol,api-all,cli,updater,system-tray,windows7-compat,http-multipart,test
run-integration-tests:
runs-on: ${{ matrix.platform }}
needs: msrv-list
if: github.ref == 'refs/heads/1.x'
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-13, windows-latest]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: install stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: install Linux dependencies
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev libfuse2
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
core -> ../target
tooling/cli
- name: build CLI
uses: actions-rs/cargo@v1
with:
command: build
args: --manifest-path ./tooling/cli/Cargo.toml
- name: run integration tests
run: cargo test --test '*' -- --ignored
- name: run CLI tests
timeout-minutes: 30
run: |
cd ./tooling/cli/node
yarn
yarn build
yarn test
version-or-publish:
runs-on: ubuntu-latest
timeout-minutes: 65
outputs:
change: ${{ steps.covector.outputs.change }}
commandRan: ${{ steps.covector.outputs.commandRan }}
successfulPublish: ${{ steps.covector.outputs.successfulPublish }}
needs:
- run-integration-tests
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v2
with:
node-version: 16
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.ORG_NPM_TOKEN }}
CARGO_AUDIT_OPTIONS: ${{ secrets.CARGO_AUDIT_OPTIONS }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
command: 'version-or-publish'
createRelease: true
- name: Create Pull Request With Versions Bumped
if: steps.covector.outputs.commandRan == 'version'
uses: tauri-apps/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: release/version-updates-v1
title: Apply Version Updates From Current Changes (v1)
commit-message: 'apply version updates'
labels: 'version updates'
body: ${{ steps.covector.outputs.change }}
- name: Trigger doc update
if: |
steps.covector.outputs.successfulPublish == 'true' &&
steps.covector.outputs.packagesPublished != ''
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.ORG_TAURI_BOT_PAT }}
repository: tauri-apps/tauri-docs
event-type: update-docs
- name: Trigger `@tauri-apps/cli` publishing workflow
if: |
steps.covector.outputs.successfulPublish == 'true' &&
contains(steps.covector.outputs.packagesPublished, '@tauri-apps/cli')
uses: peter-evans/repository-dispatch@v1
with:
event-type: publish-js-cli
client-payload: >-
{"releaseId": "${{ steps.covector.outputs['-tauri-apps-cli-releaseId'] }}" }
- name: Trigger `tauri-cli` publishing workflow
if: |
steps.covector.outputs.successfulPublish == 'true' &&
contains(steps.covector.outputs.packagesPublished, 'tauri-cli')
uses: peter-evans/repository-dispatch@v1
with:
event-type: publish-clirs

View File

@@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: version or publish
name: covector version or publish
on:
push:
@@ -71,7 +71,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-node@v2
with:
node-version: 14
node-version: 16
registry-url: 'https://registry.npmjs.org'
cache: yarn
cache-dependency-path: tooling/*/yarn.lock
@@ -115,23 +115,20 @@ jobs:
repository: tauri-apps/tauri-docs
event-type: update-docs
- name: Trigger cli.js publishing workflow
- name: Trigger `@tauri-apps/cli` publishing workflow
if: |
steps.covector.outputs.successfulPublish == 'true' &&
contains(steps.covector.outputs.packagesPublished, 'cli.rs')
contains(steps.covector.outputs.packagesPublished, '@tauri-apps/cli')
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.ORG_TAURI_BOT_PAT }}
repository: tauri-apps/tauri
event-type: publish-clijs
client-payload: '{"releaseId": "${{ steps.covector.outputs.cli.js-releaseId }}" }'
event-type: publish-js-cli
client-payload: >-
{"releaseId": "${{ steps.covector.outputs['-tauri-apps-cli-releaseId'] }}" }
- name: Trigger cli.rs publishing workflow
- name: Trigger `tauri-cli` publishing workflow
if: |
steps.covector.outputs.successfulPublish == 'true' &&
contains(steps.covector.outputs.packagesPublished, 'cli.rs')
contains(steps.covector.outputs.packagesPublished, 'tauri-cli')
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.ORG_TAURI_BOT_PAT }}
repository: tauri-apps/tauri
event-type: publish-clirs

View File

@@ -2,16 +2,16 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: cli clippy and fmt check
name: lint cli
on:
push:
branches:
- dev
- next
- 1.x
pull_request:
paths:
- '.github/workflows/lint-fmt-cli.yml'
- '.github/workflows/lint-cli.yml'
- 'tooling/cli/**'
env:
@@ -23,7 +23,7 @@ concurrency:
cancel-in-progress: true
jobs:
fmt_check:
fmt:
runs-on: ubuntu-latest
steps:
@@ -41,7 +41,7 @@ jobs:
command: fmt
args: --manifest-path ./tooling/cli/Cargo.toml --all -- --check
cli_clippy_check:
clippy:
runs-on: ubuntu-latest
steps:

View File

@@ -2,16 +2,16 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: core clippy and fmt check
name: lint core
on:
push:
branches:
- dev
- next
- 1.x
pull_request:
paths:
- '.github/workflows/lint-fmt-core.yml'
- '.github/workflows/lint-core.yml'
- 'core/**'
- '!core/tauri/scripts/**'
- 'examples/**'
@@ -25,7 +25,7 @@ concurrency:
cancel-in-progress: true
jobs:
fmt_check:
fmt:
runs-on: ubuntu-latest
steps:
@@ -43,14 +43,14 @@ jobs:
command: fmt
args: --all -- --check
core_clippy_check:
clippy:
runs-on: ubuntu-latest
strategy:
matrix:
clippy:
- { args: '', key: 'empty' }
- {
args: '--features compression,wry,linux-protocol-headers,isolation,custom-protocol,api-all,cli,updater,system-tray,windows7-compat,http-multipart',
args: '--features compression,wry,linux-protocol-headers,isolation,custom-protocol,api-all,cli,updater,system-tray,windows7-compat,http-multipart,test',
key: 'all'
}
- { args: '--features custom-protocol', key: 'custom-protocol' }

View File

@@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: api and cli.js lint check
name: lint js
on:
pull_request:
@@ -16,32 +16,45 @@ concurrency:
cancel-in-progress: true
jobs:
eslint-check:
eslint-cli:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
node-version: 16
cache: yarn
cache-dependency-path: tooling/*/yarn.lock
- name: install cli.js deps via yarn
cache-dependency-path: tooling/cli/node/yarn.lock
- name: install deps via yarn
working-directory: ./tooling/cli/node/
run: yarn
# nothing to lint
#- name: run cli.js lint
#- name: run lint
# working-directory: ./tooling/cli/node/
# run: yarn lint
- name: run cli.js format
- name: run format
working-directory: ./tooling/cli/node/
run: yarn format:check
- name: install api deps via yarn
eslint-api:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
cache: yarn
cache-dependency-path: tooling/api/yarn.lock
- name: install deps via yarn
working-directory: ./tooling/api/
run: yarn
- name: run api lint
- name: run ts:check
working-directory: ./tooling/api/
run: yarn ts:check
- name: run lint
working-directory: ./tooling/api/
run: yarn lint
- name: run api format
- name: run format
working-directory: ./tooling/api/
run: yarn format:check

View File

@@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: publish cli.js
name: publish `@tauri-apps/cli`
env:
DEBUG: napi:*
APP_NAME: cli
@@ -11,10 +11,10 @@ on:
workflow_dispatch:
inputs:
releaseId:
description: 'ID of the cli.js release'
description: 'ID of the `@tauri-apps/cli` release'
required: true
repository_dispatch:
types: [publish-clijs]
types: [publish-js-cli]
defaults:
run:
@@ -30,41 +30,45 @@ jobs:
target: x86_64-apple-darwin
architecture: x64
build: |
yarn build:release --features rustls
yarn build:release --target=x86_64-apple-darwin
strip -x *.node
- host: windows-latest
build: yarn build:release --features rustls
build: yarn build:release
target: x86_64-pc-windows-msvc
architecture: x64
- host: windows-latest
build: yarn build:release --features rustls --target i686-pc-windows-msvc
build: yarn build:release --target i686-pc-windows-msvc
target: i686-pc-windows-msvc
architecture: x64
- host: windows-latest
architecture: x64
target: aarch64-pc-windows-msvc
build: yarn build:release --target aarch64-pc-windows-msvc --features native-tls,native-tls-vendored --cargo-flags="--no-default-features"
- host: ubuntu-20.04
target: x86_64-unknown-linux-gnu
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
build: |
cd tooling/cli/node
yarn build:release --features rustls --target x86_64-unknown-linux-gnu
yarn build:release --target x86_64-unknown-linux-gnu
strip *.node
- host: ubuntu-20.04
target: x86_64-unknown-linux-musl
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: |
cd tooling/cli/node
yarn build:release --features rustls
yarn build:release
strip *.node
- host: macos-latest
target: aarch64-apple-darwin
build: |
yarn build:release --features rustls --target=aarch64-apple-darwin
yarn build:release --target=aarch64-apple-darwin
strip -x *.node
- host: ubuntu-20.04
target: aarch64-unknown-linux-gnu
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
build: |
cd tooling/cli/node
yarn build:release --features rustls --target aarch64-unknown-linux-gnu
yarn build:release --target aarch64-unknown-linux-gnu
aarch64-unknown-linux-gnu-strip *.node
- host: ubuntu-20.04
architecture: x64
@@ -73,7 +77,7 @@ jobs:
sudo apt-get update
sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf -y
build: |
yarn build:release --features rustls --target=armv7-unknown-linux-gnueabihf
yarn build:release --target=armv7-unknown-linux-gnueabihf
arm-linux-gnueabihf-strip *.node
- host: ubuntu-20.04
architecture: x64
@@ -82,12 +86,8 @@ jobs:
build: |
cd tooling/cli/node
rustup target add aarch64-unknown-linux-musl
yarn build:release --features rustls --target aarch64-unknown-linux-musl
yarn build:release --target aarch64-unknown-linux-musl
/aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip *.node
#- host: windows-latest
# architecture: x64
# target: aarch64-pc-windows-msvc
# build: yarn build:release --features rustls --target aarch64-pc-windows-msvc
name: stable - ${{ matrix.settings.target }} - node@16
runs-on: ${{ matrix.settings.host }}
steps:
@@ -158,7 +158,7 @@ jobs:
# usesh: true
# mem: 3000
# prepare: |
# pkg install -y curl node14 python2
# pkg install -y curl node16 python2
# curl -qL https://www.npmjs.com/install.sh | sh
# npm install -g yarn
# curl https://sh.rustup.rs -sSf --output rustup.sh
@@ -179,7 +179,7 @@ jobs:
# freebsd-version
# cd ./tooling/cli/node/
# yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
# yarn build:release --features rustls
# yarn build:release
# strip -x *.node
# rm -rf node_modules
# rm -rf ../target
@@ -198,13 +198,13 @@ jobs:
matrix:
settings:
- host: macos-latest
target: 'x86_64-apple-darwin'
target: 'aarch64-apple-darwin'
- host: windows-latest
target: x86_64-pc-windows-msvc
node:
- '14'
- '16'
- '18'
- '20'
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v3
@@ -235,9 +235,9 @@ jobs:
fail-fast: false
matrix:
node:
- '14'
- '16'
- '18'
- '20'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
@@ -272,9 +272,9 @@ jobs:
fail-fast: false
matrix:
node:
- '14'
- '16'
- '18'
- '20'
runs-on: ubuntu-latest
container:
image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
@@ -297,14 +297,10 @@ jobs:
- name: List packages
run: ls -R .
shell: bash
- name: Install system dependencies
run: |
apk add openssl-dev musl-dev glib-dev cairo-dev pkgconfig gdk-pixbuf-dev webkit2gtk-dev curl gtk+3.0-dev
- name: Setup and run tests
run: |
yarn tauri --help
ls -la
# TODO: fix this test: https://github.com/tauri-apps/tauri/runs/5145729140?check_suite_focus=true#step:9:704
#- name: Setup and run tests
# run: |
# rustup install stable
@@ -319,9 +315,9 @@ jobs:
fail-fast: false
matrix:
node:
- '14'
- '16'
- '18'
- '20'
image:
- ghcr.io/napi-rs/napi-rs/nodejs:aarch64-16
- ghcr.io/napi-rs/napi-rs/nodejs:armhf-16
@@ -379,7 +375,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
check-latest: true
cache: yarn
cache-dependency-path: 'tooling/cli/node/yarn.lock'

View File

@@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: publish cli.rs
name: publish `tauri-cli`
env:
MACOSX_DEPLOYMENT_TARGET: '10.13'
on:
@@ -21,15 +21,23 @@ jobs:
- os: ubuntu-20.04
rust_target: x86_64-unknown-linux-gnu
ext: ''
args: ''
- os: macos-latest
rust_target: x86_64-apple-darwin
ext: ''
args: ''
- os: macos-latest
rust_target: aarch64-apple-darwin
ext: ''
args: ''
- os: windows-latest
rust_target: x86_64-pc-windows-msvc
ext: '.exe'
args: ''
- os: windows-latest
rust_target: aarch64-pc-windows-msvc
ext: '.exe'
args: '--no-default-features --features native-tls,native-tls-vendored'
steps:
- name: Checkout
@@ -54,7 +62,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: build
args: --manifest-path ./tooling/cli/Cargo.toml --release
args: --manifest-path ./tooling/cli/Cargo.toml --release ${{ matrix.config.args }}
- name: Upload CLI
uses: actions/upload-artifact@v3
@@ -85,7 +93,7 @@ jobs:
- name: Publish release
uses: softprops/action-gh-release@50195ba7f6f93d1ac97ba8332a178e008ad176aa
with:
tag_name: cli.rs-v${{ env.CLI_VERSION }}
tag_name: tauri-cli-v${{ env.CLI_VERSION }}
files: |
outputs/cargo-tauri-*.zip
outputs/cargo-tauri-*.tgz

View File

@@ -2,17 +2,17 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: test cli.js
name: test `@tauri-apps/cli`
on:
push:
branches:
- dev
- next
- 1.x
pull_request:
paths:
- '.github/workflows/test-cli-js.yml'
# currently cli.js only tests the template
# currently` @tauri-apps/cli` only tests the template
- 'tooling/cli/templates/app/**'
env:
@@ -24,7 +24,7 @@ concurrency:
cancel-in-progress: true
jobs:
test-tauri-js-cli:
test:
runs-on: ${{ matrix.platform }}
strategy:
@@ -43,7 +43,7 @@ jobs:
- name: setup node
uses: actions/setup-node@v2
with:
node-version: 14
node-version: 16
cache: yarn
cache-dependency-path: tooling/cli/node/yarn.lock

View File

@@ -2,13 +2,13 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: test cli.rs
name: test `tauri-cli`
on:
push:
branches:
- dev
- next
- 1.x
pull_request:
paths:
- '.github/workflows/test-cli-rs.yml'
@@ -23,7 +23,7 @@ concurrency:
cancel-in-progress: true
jobs:
test-tauri-cli:
test:
runs-on: ${{ matrix.platform }}
strategy:
@@ -50,8 +50,8 @@ jobs:
with:
workspaces: tooling/cli
- name: build CLI
- name: test CLI
uses: actions-rs/cargo@v1
with:
command: build
command: test
args: --manifest-path ./tooling/cli/Cargo.toml

View File

@@ -8,7 +8,7 @@ on:
push:
branches:
- dev
- next
- 1.x
pull_request:
paths:
- '.github/workflows/test-core.yml'
@@ -24,7 +24,7 @@ concurrency:
cancel-in-progress: true
jobs:
test-tauri-core:
test:
runs-on: ${{ matrix.platform.os }}
strategy:
@@ -43,7 +43,7 @@ jobs:
}
- {
target: x86_64-apple-darwin,
os: macos-latest,
os: macos-13,
toolchain: '1.60.0'
}
features:
@@ -56,7 +56,7 @@ jobs:
key: api-all
}
- {
args: --features compression,wry,linux-protocol-headers,isolation,custom-protocol,api-all,cli,updater,system-tray,windows7-compat,http-multipart,
args: --features tracing,compression,wry,linux-protocol-headers,isolation,custom-protocol,api-all,cli,updater,system-tray,windows7-compat,http-multipart,test,
key: all
}

View File

@@ -2,13 +2,13 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: test bundler
name: test and lint bundler
on:
push:
branches:
- dev
- next
- 1.x
pull_request:
paths:
- '.github/workflows/test-bundler.yml'
@@ -23,7 +23,7 @@ concurrency:
cancel-in-progress: true
jobs:
build-tauri-bundler:
test:
runs-on: ${{ matrix.platform }}
strategy:
@@ -48,7 +48,7 @@ jobs:
cd ./tooling/bundler
cargo test
fmt_check:
fmt:
runs-on: ubuntu-latest
steps:
@@ -66,7 +66,7 @@ jobs:
command: fmt
args: --manifest-path ./tooling/bundler/Cargo.toml --all -- --check
clippy-check:
clippy:
runs-on: ubuntu-latest
steps:

View File

@@ -2,13 +2,13 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: updater test artifacts
name: test updater artifacts
on:
schedule:
- cron: '0 0 * * *'
pull_request:
paths:
- '.github/workflows/artifacts-updater.yml'
- '.github/workflows/test-updater-artifacts.yml'
- 'examples/updater/**'
workflow_dispatch:
@@ -21,7 +21,7 @@ concurrency:
cancel-in-progress: true
jobs:
build-artifacts:
test:
runs-on: ${{ matrix.platform }}
strategy:
@@ -48,7 +48,7 @@ jobs:
core -> ../target
tooling/cli
- name: build and install cli.rs
- name: build and install `tauri-cli`
run: cargo install --path tooling/cli --force
- name: Check whether code signing should be enabled
id: enablecodesigning

View File

@@ -8,7 +8,7 @@ on:
push:
branches:
- dev
- next
- 1.x
env:
RUST_BACKTRACE: 1

2
.gitignore vendored
View File

@@ -73,7 +73,7 @@ TODO.md
target
# lock for libs
/Cargo.lock
#/Cargo.lock Committed to prevent msrv checks from failing
/tooling/bench/tests/Cargo.lock
/yarn.lock

View File

@@ -11,12 +11,12 @@ if [ -z "$(git diff --name-only tooling/api)" ]; then
else
cd tooling/api
yarn format
yarn lint-fix
yarn lint:fix
cd ../..
fi
if [ -z "$(git diff --name-only tooling/cli/node)" ]; then
echo "skipping cli.js - no changes detected"
echo "skipping \`@tauri-apps/cli\` - no changes detected"
else
cd tooling/cli/node
yarn format

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

5
.prettierrc Normal file
View File

@@ -0,0 +1,5 @@
{
"singleQuote": true,
"semi": false,
"trailingComma": "none"
}

View File

@@ -1,9 +0,0 @@
// 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,
trailingComma: 'none'
}

View File

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

View File

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

View File

@@ -0,0 +1,79 @@
#!/usr/bin/env node
// 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 ignorePackages = [
'tauri-macros',
'tauri-codegen',
'tauri-runtime',
'tauri-runtime-wry',
'tauri-driver'
]
const covectorConfig = JSON.parse(
fs.readFileSync('.changes/config.json', 'utf8')
)
const tags = Object.keys(covectorConfig.changeTags)
const missingTagsFiles = {}
const unknownTagsFiles = {}
function checkChangeFiles(changeFiles) {
for (const file of changeFiles) {
const content = fs.readFileSync(file, 'utf8')
const [frontMatter] = /^---[\s\S.]*---\n/i.exec(content)
const packages = frontMatter
.split('\n')
.filter((l) => !(l === '---' || !l))
.map((l) => l.replace(/('|")/g, '').split(':'))
for (const [package, _, tag] of packages) {
if (!tag) {
if (ignorePackages.includes(package)) continue
if (!missingTagsFiles[file]) missingTagsFiles[file] = []
missingTagsFiles[file].push(package)
} else if (!tags.includes(tag)) {
if (!unknownTagsFiles[file]) unknownTagsFiles[file] = []
unknownTagsFiles[file].push({ package, tag })
}
}
}
const missingTagsEntries = Object.entries(missingTagsFiles)
const unknownTagsEntries = Object.entries(unknownTagsFiles)
if (missingTagsEntries.length > 0 || unknownTagsEntries.length > 0) {
for (const [file, packages] of missingTagsEntries) {
for (const package of packages) {
console.error(
`Package \`${package}\` is missing a change tag in ${file} `
)
}
}
for (const [file, packages] of unknownTagsEntries) {
for (const { package, tag } of packages) {
console.error(
`Package \`${package}\` has an uknown change tag ${tag} in ${file} `
)
}
}
process.exit(1)
}
}
const [_bin, _script, ...files] = process.argv
if (files.length > 0) {
checkChangeFiles(files.filter((f) => f.toLowerCase() !== 'readme.md'))
} else {
const changeFiles = fs
.readdirSync('.changes')
.filter((f) => f.endsWith('.md') && f.toLowerCase() !== 'readme.md')
.map((p) => path.join('.changes', p))
checkChangeFiles(changeFiles)
}

View File

@@ -1,3 +1,5 @@
#!/usr/bin/env node
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
@@ -9,13 +11,22 @@ 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 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']
const ignore = [
'target',
'templates',
'node_modules',
'gen',
'dist',
'bundle.js',
'bundle.global.js'
]
async function checkFile(file) {
if (extensions.some(e => file.endsWith(e))) {
if (extensions.some((e) => file.endsWith(e))) {
const fileStream = fs.createReadStream(file)
const rl = readline.createInterface({
input: fileStream,
@@ -26,7 +37,11 @@ async function checkFile(file) {
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) {
if (
line.length === 0 ||
line.startsWith('#!') ||
line === bundlerLicense
) {
continue
}
@@ -93,7 +108,7 @@ if (files.length > 0) {
run()
} else {
check('.').then(missing => {
check('.').then((missing) => {
if (missing.length > 0) {
console.log(missing.join('\n'))
process.exit(1)

View File

@@ -1,5 +1,9 @@
#!/bin/bash
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
if git diff --quiet --ignore-submodules HEAD
then
echo "working directory is clean"

View File

@@ -1,4 +1,9 @@
#!/bin/bash
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
set -euxo pipefail
for o in outputs/*; do

View File

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

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env node
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
@@ -6,7 +7,7 @@
/*
This script is solely intended to be run as part of the `covector version` step to
keep the `../tooling/cli/metadata.json` up to date with other version bumps. Long term
we should look to find a more "rusty way" to import / "pin" a version value in our cli.rs
we should look to find a more "rusty way" to import / "pin" a version value in our tauri-cli
rust binaries.
*/
@@ -14,7 +15,7 @@ const { readFileSync, writeFileSync } = require('fs')
const packageNickname = process.argv[2]
const filePath =
packageNickname === 'cli.js'
packageNickname === '@tauri-apps/cli'
? `../../../tooling/cli/metadata.json`
: `../../tooling/cli/metadata.json`
const bump = process.argv[3]
@@ -51,9 +52,9 @@ const metadata = JSON.parse(readFileSync(filePath, 'utf-8'))
// set field version
let version
if (packageNickname === 'cli.js') {
version = inc(metadata[packageNickname].version)
metadata[packageNickname].version = version
if (packageNickname === '@tauri-apps/cli') {
version = inc(metadata['cli.js'].version)
metadata['cli.js'].version = version
} else {
version = inc(metadata[packageNickname])
metadata[packageNickname] = version

View File

@@ -1,3 +1,7 @@
#!/bin/sh
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
docker build -t aarch64-unknown-linux-gnu:latest --file .docker/cross/aarch64.Dockerfile .docker/cross

View File

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

View File

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

View File

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

View File

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

View File

@@ -39,16 +39,16 @@ This is common code that is reused in many places and offers useful utilities li
### Tauri Tooling
#### [api](https://github.com/tauri-apps/tauri/tree/dev/tooling/api) [TS -> JS]
#### [@tauri-apps/api](https://github.com/tauri-apps/tauri/tree/dev/tooling/api) [TS -> JS]
A TypeScript library that creates `cjs` and `esm` JavaScript endpoints for you to import into your Frontend framework so that the Webview can call and listen to backend activity. We also ship the pure TypeScript, because for some frameworks this is more optimal. It uses the message passing of webviews to their hosts.
#### [bundler](https://github.com/tauri-apps/tauri/tree/dev/tooling/bundler) [RUST / SHELL]
The bundler is a library that builds a Tauri App for the platform triple it detects / is told. At the moment it currently supports macOS, Windows and Linux - but in the near future will support mobile platforms as well. May be used outside of Tauri projects.
#### [cli.js](https://github.com/tauri-apps/tauri/tree/dev/tooling/cli/node) [JS]
It is a wrapper around [cli.rs](https://github.com/tauri-apps/tauri/blob/dev/tooling/cli) using [napi-rs](https://github.com/napi-rs/napi-rs) to produce NPM packages for each platform.
#### [@tauri-apps/cli](https://github.com/tauri-apps/tauri/tree/dev/tooling/cli/node) [JS]
It is a wrapper around [tauri-cli](https://github.com/tauri-apps/tauri/blob/dev/tooling/cli) using [napi-rs](https://github.com/napi-rs/napi-rs) to produce NPM packages for each platform.
#### [cli.rs](https://github.com/tauri-apps/tauri/tree/dev/tooling/cli) [RUST]
#### [tauri-cli](https://github.com/tauri-apps/tauri/tree/dev/tooling/cli) [RUST]
This rust executable provides the full interface to all of the required activities for which the CLI is required. It will run on macOS, Windows, and Linux.
#### [create-tauri-app](https://github.com/tauri-apps/create-tauri-app) [JS]
@@ -67,9 +67,6 @@ Tauri uses WRY as the abstract layer responsible to determine which webview is u
# Additional tooling
## [binary-releases](https://github.com/tauri-apps/binary-releases)
This is the delivery mechanism for tauri prebuilt binaries: currently the cli.rs (used by cli.js) and rustup binaries (used by the deps install command of cli.js). These artifacts are automatically created on release.
## [tauri-action](https://github.com/tauri-apps/tauri-action)
This is a github workflow that builds tauri binaries for all platforms. It is not the fastest out there, but it gets the job done and is highly configurable. Even allowing you to create a (very basic) tauri app even if tauri is not setup.
@@ -119,7 +116,7 @@ This will do several things:
1. start the JS Framework devserver
2. begin the long process of downloading and compiling the rust libraries
3. open an application window with devtools enabled
4. keep a long-lived console alive
4. keep a long-lived console alive
If you change your HTML/CSS/TS/JS, your framework devserver should give you its best shot at instant hot module reloading and you will see the changes instantly.
@@ -149,7 +146,7 @@ After some time, the process will end and you can see the results in the `./src-
End users will be provided with binaries in ways that are appropriate for their systems. Whether macOS, Linux, or Windows, direct download or store installations - they will be able to follow procedures for installing and removing that they are used to.
## What does the Updating flow look like?
When a new version is ready, the developer publishes the new signed artifacts to a server (that they have configured within `tauri.conf.json`).
When a new version is ready, the developer publishes the new signed artifacts to a server (that they have configured within `tauri.conf.json`).
The application can poll this server to see if there is a new release. When there is a new release, the user is prompted to update. The application update is downloaded, verified (checksum & signature), updated, closed, and restarted.

5737
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,5 @@
[workspace]
resolver = "2"
members = [
# core
"core/tauri",

View File

@@ -2,7 +2,7 @@
[![status](https://img.shields.io/badge/status-stable-blue.svg)](https://github.com/tauri-apps/tauri/tree/dev)
[![License](https://img.shields.io/badge/License-MIT%20or%20Apache%202-green.svg)](https://opencollective.com/tauri)
[![test library](https://img.shields.io/github/workflow/status/tauri-apps/tauri/test%20library?label=test%20library)](https://github.com/tauri-apps/tauri/actions?query=workflow%3A%22test+library%22)
[![test core](https://img.shields.io/github/actions/workflow/status/tauri-apps/tauri/test-core.yml?label=test%20core&logo=github)](https://github.com/tauri-apps/tauri/actions/workflows/test-core.yml)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Ftauri-apps%2Ftauri.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Ftauri-apps%2Ftauri?ref=badge_shield)
[![Chat Server](https://img.shields.io/badge/chat-discord-7289da.svg)](https://discord.gg/SpmNs4S)
[![website](https://img.shields.io/badge/website-tauri.app-purple.svg)](https://tauri.app)
@@ -25,12 +25,12 @@
### Tooling
| Component | Description | Version | Lin | Win | Mac |
| --------------------------------------------------------------------------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------ | --- | --- | --- |
| [**bundler**](https://github.com/tauri-apps/tauri/tree/dev/tooling/bundler) | manufacture the final binaries | [![](https://img.shields.io/crates/v/tauri-bundler.svg)](https://crates.io/crates/tauri-bundler) | ✅ | ✅ | ✅ |
| [**api.js**](https://github.com/tauri-apps/tauri/tree/dev/tooling/api) | JS API for interaction with Rust backend | [![](https://img.shields.io/npm/v/@tauri-apps/api.svg)](https://www.npmjs.com/package/@tauri-apps/api) | ✅ | ✅ | ✅ |
| [**cli.rs**](https://github.com/tauri-apps/tauri/tree/dev/tooling/cli) | create, develop and build apps | [![](https://img.shields.io/crates/v/tauri-cli.svg)](https://crates.io/crates/tauri-cli) | ✅ | ✅ | ✅ |
| [**cli.js**](https://github.com/tauri-apps/tauri/tree/dev/tooling/cli/node) | Node.js CLI wrapper for cli.rs | [![](https://img.shields.io/npm/v/@tauri-apps/cli.svg)](https://www.npmjs.com/package/@tauri-apps/cli) | ✅ | ✅ | ✅ |
| Component | Description | Version | Lin | Win | Mac |
| ------------------------------------------------------------------------------------ | ---------------------------------------- | ------------------------------------------------------------------------------------------------------ | --- | --- | --- |
| [**bundler**](https://github.com/tauri-apps/tauri/tree/dev/tooling/bundler) | manufacture the final binaries | [![](https://img.shields.io/crates/v/tauri-bundler.svg)](https://crates.io/crates/tauri-bundler) | ✅ | ✅ | ✅ |
| [**tauri-cli**](https://github.com/tauri-apps/tauri/tree/dev/tooling/cli) | create, develop and build apps | [![](https://img.shields.io/crates/v/tauri-cli.svg)](https://crates.io/crates/tauri-cli) | ✅ | ✅ | ✅ |
| [**@tauri-apps/cli**](https://github.com/tauri-apps/tauri/tree/dev/tooling/cli/node) | Node.js CLI wrapper for `tauri-cli` | [![](https://img.shields.io/npm/v/@tauri-apps/cli.svg)](https://www.npmjs.com/package/@tauri-apps/cli) | ✅ | ✅ | ✅ |
| [**@tauri-apps/api**](https://github.com/tauri-apps/tauri/tree/dev/tooling/api) | JS API for interaction with Rust backend | [![](https://img.shields.io/npm/v/@tauri-apps/api.svg)](https://www.npmjs.com/package/@tauri-apps/api) | ✅ | ✅ | ✅ |
### Utilities and Plugins
@@ -75,6 +75,8 @@ For **running** Tauri apps we support the below configurations (these are automa
- `webkit2gtk`, `gtk3`, `libayatana-appindicator`<sup>1</sup>
- Fedora (latest 2 versions) with the following packages installed:
- `webkit2gtk3`, `gtk3`, `libappindicator-gtk3`<sup>1</sup>
- Void with the following packages installed:
- `webkit2gtk`, `gtk+3`, `libappindicator`<sup>1</sup>
<sup>1</sup> `appindicator` is only required if system trays are used

View File

@@ -1,5 +1,52 @@
# Changelog
## \[1.5.3]
### Dependencies
- Upgraded to `tauri-utils@1.6.0`
- Upgraded to `tauri-codegen@1.4.4`
## \[1.5.2]
### Dependencies
- Upgraded to `tauri-utils@1.5.4`
- Upgraded to `tauri-codegen@1.4.3`
## \[1.5.1]
### Dependencies
- Upgraded to `tauri-utils@1.5.2`
- Upgraded to `tauri-codegen@1.4.2`
## \[1.5.0]
### What's Changed
- [`d1e09da0`](https://www.github.com/tauri-apps/tauri/commit/d1e09da084b849b9e384fc27ed250dd17e72c7a3)([#7918](https://www.github.com/tauri-apps/tauri/pull/7918)) Bump to 1.5 due to tauri-utils dependency bump.
## \[1.4.1]
### Bug Fixes
- [`5ecb46b3`](https://www.github.com/tauri-apps/tauri/commit/5ecb46b3410afd1b5c82494c1e0a91d5a358c41a)([#7773](https://www.github.com/tauri-apps/tauri/pull/7773)) Automatically set rpath on macOS if frameworks are bundled and copy frameworks to `src-tauri/target/Frameworks` for usage in development.
- [`290e366a`](https://www.github.com/tauri-apps/tauri/commit/290e366ae98e9a52b1b43bfd3e285150427ebffa)([#7419](https://www.github.com/tauri-apps/tauri/pull/7419)) Correctly copy the WebView2 runtime in development when `webviewInstallMode` is used instead of `webviewFixedRuntimePath`.
### Dependencies
- Upgraded to `tauri-utils@1.5.0`
- Upgraded to `tauri-codegen@1.4.1`
## \[1.4.0]
### Enhancements
- [`52474e47`](https://www.github.com/tauri-apps/tauri/commit/52474e479d695865299d8c8d868fb98b99731020)([#7141](https://www.github.com/tauri-apps/tauri/pull/7141)) Enhance Cargo features check.
- [`af937290`](https://www.github.com/tauri-apps/tauri/commit/af93729031565a69d1fde6cf16bea3b9b6e43a65)([#6676](https://www.github.com/tauri-apps/tauri/pull/6676)) On Windows, set `LegalCopyright` and `FileDescription` file properties on the executable from `tauri.bundle.copyright` and `tauri.bundle.shortDescription`,
- [`d2710e9d`](https://www.github.com/tauri-apps/tauri/commit/d2710e9d2e8fd93975ef6494512370faa8cb3b7e)([#6944](https://www.github.com/tauri-apps/tauri/pull/6944)) Unpin `time`, `ignore`, and `winnow` crate versions. Developers now have to pin crates if needed themselves. A list of crates that need pinning to adhere to Tauri's MSRV will be visible in Tauri's GitHub workflow: https://github.com/tauri-apps/tauri/blob/dev/.github/workflows/test-core.yml#L85.
## \[1.3.0]
- Bump minimum supported Rust version to 1.60.

View File

@@ -1,6 +1,6 @@
[package]
name = "tauri-build"
version = "1.3.0"
version = "1.5.3"
authors = [ "Tauri Programme within The Commons Conservancy" ]
categories = [ "gui", "web-programming" ]
license = "Apache-2.0 OR MIT"
@@ -19,16 +19,17 @@ 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" ] }
tauri-codegen = { version = "1.4.4", path = "../tauri-codegen", optional = true }
tauri-utils = { version = "1.6.0", path = "../tauri-utils", features = [ "build", "resources" ] }
cargo_toml = "0.15"
winnow = "=0.4.1"
serde = "1"
serde_json = "1"
heck = "0.4"
json-patch = "1.0"
heck = "0.5"
json-patch = "1.2"
tauri-winres = "0.1"
semver = "1"
walkdir = "2"
dirs-next = "2"
[features]
codegen = [ "tauri-codegen", "quote" ]

View File

@@ -4,7 +4,7 @@
[![status](https://img.shields.io/badge/status-stable-blue.svg)](https://github.com/tauri-apps/tauri/tree/dev)
[![License](https://img.shields.io/badge/License-MIT%20or%20Apache%202-green.svg)](https://opencollective.com/tauri)
[![test library](https://img.shields.io/github/workflow/status/tauri-apps/tauri/test%20library?label=test%20library)](https://github.com/tauri-apps/tauri/actions?query=workflow%3A%22test+library%22)
[![test core](https://img.shields.io/github/actions/workflow/status/tauri-apps/tauri/test-core.yml?label=test%20core&logo=github)](https://github.com/tauri-apps/tauri/actions/workflows/test-core.yml)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Ftauri-apps%2Ftauri.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Ftauri-apps%2Ftauri?ref=badge_shield)
[![Chat Server](https://img.shields.io/badge/chat-discord-7289da.svg)](https://discord.gg/SpmNs4S)
[![website](https://img.shields.io/badge/website-tauri.app-purple.svg)](https://tauri.app)

View File

@@ -0,0 +1,211 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use anyhow::{anyhow, Result};
use cargo_toml::{Dependency, Manifest};
use tauri_utils::config::{Config, PatternKind, TauriConfig};
#[derive(Debug, Default, PartialEq, Eq)]
struct Diff {
remove: Vec<String>,
add: Vec<String>,
}
#[derive(Debug, Clone, Copy)]
enum DependencyKind {
Build,
Normal,
}
#[derive(Debug)]
struct AllowlistedDependency {
name: String,
alias: Option<String>,
kind: DependencyKind,
all_cli_managed_features: Option<Vec<&'static str>>,
expected_features: Vec<String>,
}
pub fn check(config: &Config, manifest: &mut Manifest) -> Result<()> {
let dependencies = vec![
AllowlistedDependency {
name: "tauri-build".into(),
alias: None,
kind: DependencyKind::Build,
all_cli_managed_features: Some(vec!["isolation"]),
expected_features: match config.tauri.pattern {
PatternKind::Isolation { .. } => vec!["isolation".to_string()],
_ => vec![],
},
},
AllowlistedDependency {
name: "tauri".into(),
alias: None,
kind: DependencyKind::Normal,
all_cli_managed_features: Some(TauriConfig::all_features()),
expected_features: config
.tauri
.features()
.into_iter()
.map(|f| f.to_string())
.collect::<Vec<String>>(),
},
];
for metadata in dependencies {
let mut name = metadata.name.clone();
let mut deps = find_dependency(manifest, &metadata.name, metadata.kind);
if deps.is_empty() {
if let Some(alias) = &metadata.alias {
deps = find_dependency(manifest, alias, metadata.kind);
name = alias.clone();
}
}
for dep in deps {
if let Err(error) = check_features(dep, &metadata) {
return Err(anyhow!("
The `{}` 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 {}.
", name, error));
}
}
}
Ok(())
}
fn find_dependency(manifest: &mut Manifest, name: &str, kind: DependencyKind) -> Vec<Dependency> {
let dep = match kind {
DependencyKind::Build => manifest.build_dependencies.remove(name),
DependencyKind::Normal => manifest.dependencies.remove(name),
};
if let Some(dep) = dep {
vec![dep]
} else {
let mut deps = Vec::new();
for target in manifest.target.values_mut() {
if let Some(dep) = match kind {
DependencyKind::Build => target.build_dependencies.remove(name),
DependencyKind::Normal => target.dependencies.remove(name),
} {
deps.push(dep);
}
}
deps
}
}
fn features_diff(current: &[String], expected: &[String]) -> Diff {
let mut remove = Vec::new();
let mut add = Vec::new();
for feature in current {
if !expected.contains(feature) {
remove.push(feature.clone());
}
}
for feature in expected {
if !current.contains(feature) {
add.push(feature.clone());
}
}
Diff { remove, add }
}
fn check_features(dependency: Dependency, metadata: &AllowlistedDependency) -> Result<(), String> {
let features = match dependency {
Dependency::Simple(_) => Vec::new(),
Dependency::Detailed(dep) => dep.features,
Dependency::Inherited(dep) => dep.features,
};
let diff = if let Some(all_cli_managed_features) = &metadata.all_cli_managed_features {
features_diff(
&features
.into_iter()
.filter(|f| all_cli_managed_features.contains(&f.as_str()))
.collect::<Vec<String>>(),
&metadata.expected_features,
)
} else {
features_diff(
&features
.into_iter()
.filter(|f| f.starts_with("allow-"))
.collect::<Vec<String>>(),
&metadata.expected_features,
)
};
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() {
Ok(())
} else {
Err(error_message)
}
}
#[cfg(test)]
mod tests {
use super::Diff;
#[test]
fn array_diff() {
for (current, expected, result) in [
(vec![], vec![], Default::default()),
(
vec!["a".into()],
vec![],
Diff {
remove: vec!["a".into()],
add: vec![],
},
),
(vec!["a".into()], vec!["a".into()], Default::default()),
(
vec!["a".into(), "b".into()],
vec!["a".into()],
Diff {
remove: vec!["b".into()],
add: vec![],
},
),
(
vec!["a".into(), "b".into()],
vec!["a".into(), "c".into()],
Diff {
remove: vec!["b".into()],
add: vec!["c".into()],
},
),
] {
assert_eq!(super::features_diff(&current, &expected), result);
}
}
}

View File

@@ -4,17 +4,19 @@
#![cfg_attr(doc_cfg, feature(doc_cfg))]
use anyhow::Context;
pub use anyhow::Result;
use cargo_toml::{Dependency, Manifest};
use cargo_toml::Manifest;
use heck::AsShoutySnakeCase;
use tauri_utils::{
config::Config,
resources::{external_binaries, resource_relpath, ResourcePaths},
config::{BundleResources, Config, WebviewInstallMode},
resources::{external_binaries, ResourcePaths},
};
use std::path::{Path, PathBuf};
mod allowlist;
#[cfg(feature = "codegen")]
mod codegen;
mod static_vcruntime;
@@ -71,11 +73,117 @@ fn copy_binaries(
/// Copies resources to a path.
fn copy_resources(resources: ResourcePaths<'_>, path: &Path) -> Result<()> {
for src in resources {
let src = src?;
println!("cargo:rerun-if-changed={}", src.display());
let dest = path.join(resource_relpath(&src));
copy_file(&src, dest)?;
for resource in resources.iter() {
let resource = resource?;
println!("cargo:rerun-if-changed={}", resource.path().display());
copy_file(resource.path(), path.join(resource.target()))?;
}
Ok(())
}
#[cfg(unix)]
fn symlink_dir(src: &Path, dst: &Path) -> std::io::Result<()> {
std::os::unix::fs::symlink(src, dst)
}
/// Makes a symbolic link to a directory.
#[cfg(windows)]
fn symlink_dir(src: &Path, dst: &Path) -> std::io::Result<()> {
std::os::windows::fs::symlink_dir(src, dst)
}
/// Makes a symbolic link to a file.
#[cfg(unix)]
fn symlink_file(src: &Path, dst: &Path) -> std::io::Result<()> {
std::os::unix::fs::symlink(src, dst)
}
/// Makes a symbolic link to a file.
#[cfg(windows)]
fn symlink_file(src: &Path, dst: &Path) -> std::io::Result<()> {
std::os::windows::fs::symlink_file(src, dst)
}
fn copy_dir(from: &Path, to: &Path) -> Result<()> {
for entry in walkdir::WalkDir::new(from) {
let entry = entry?;
debug_assert!(entry.path().starts_with(from));
let rel_path = entry.path().strip_prefix(from)?;
let dest_path = to.join(rel_path);
if entry.file_type().is_symlink() {
let target = std::fs::read_link(entry.path())?;
if entry.path().is_dir() {
symlink_dir(&target, &dest_path)?;
} else {
symlink_file(&target, &dest_path)?;
}
} else if entry.file_type().is_dir() {
std::fs::create_dir(dest_path)?;
} else {
std::fs::copy(entry.path(), dest_path)?;
}
}
Ok(())
}
// Copies the framework under `{src_dir}/{framework}.framework` to `{dest_dir}/{framework}.framework`.
fn copy_framework_from(src_dir: &Path, framework: &str, dest_dir: &Path) -> Result<bool> {
let src_name = format!("{}.framework", framework);
let src_path = src_dir.join(&src_name);
if src_path.exists() {
copy_dir(&src_path, &dest_dir.join(&src_name))?;
Ok(true)
} else {
Ok(false)
}
}
// Copies the macOS application bundle frameworks to the target folder
fn copy_frameworks(dest_dir: &Path, frameworks: &[String]) -> Result<()> {
std::fs::create_dir_all(dest_dir).with_context(|| {
format!(
"Failed to create frameworks output directory at {:?}",
dest_dir
)
})?;
for framework in frameworks.iter() {
if framework.ends_with(".framework") {
let src_path = PathBuf::from(framework);
let src_name = src_path
.file_name()
.expect("Couldn't get framework filename");
let dest_path = dest_dir.join(src_name);
copy_dir(&src_path, &dest_path)?;
continue;
} else if framework.ends_with(".dylib") {
let src_path = PathBuf::from(framework);
if !src_path.exists() {
return Err(anyhow::anyhow!("Library not found: {}", framework));
}
let src_name = src_path.file_name().expect("Couldn't get library filename");
let dest_path = dest_dir.join(src_name);
copy_file(&src_path, &dest_path)?;
continue;
} else if framework.contains('/') {
return Err(anyhow::anyhow!(
"Framework path should have .framework extension: {}",
framework
));
}
if let Some(home_dir) = dirs_next::home_dir() {
if copy_framework_from(&home_dir.join("Library/Frameworks/"), framework, dest_dir)? {
continue;
}
}
if copy_framework_from(&PathBuf::from("/Library/Frameworks/"), framework, dest_dir)?
|| copy_framework_from(
&PathBuf::from("/Network/Library/Frameworks/"),
framework,
dest_dir,
)?
{
continue;
}
}
Ok(())
}
@@ -116,10 +224,28 @@ pub struct WindowsAttributes {
/// A string containing an [application manifest] to be included with the application on Windows.
///
/// Defaults to:
/// ```ignore
/// ```text
#[doc = include_str!("window-app-manifest.xml")]
/// ```
///
/// ## Warning
///
/// if you are using tauri's dialog APIs, you need to specify a dependency on Common Control v6 by adding the following to your custom manifest:
/// ```text
/// <dependency>
/// <dependentAssembly>
/// <assemblyIdentity
/// type="win32"
/// name="Microsoft.Windows.Common-Controls"
/// version="6.0.0.0"
/// processorArchitecture="*"
/// publicKeyToken="6595b64144ccf1df"
/// language="*"
/// />
/// </dependentAssembly>
/// </dependency>
/// ```
///
/// [application manifest]: https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests
app_manifest: Option<String>,
}
@@ -148,39 +274,57 @@ impl WindowsAttributes {
self
}
/// Sets the Windows app [manifest].
/// Sets the [application manifest] to be included with the application on Windows.
///
/// Defaults to:
/// ```text
#[doc = include_str!("window-app-manifest.xml")]
/// ```
///
/// ## Warning
///
/// if you are using tauri's dialog APIs, you need to specify a dependency on Common Control v6 by adding the following to your custom manifest:
/// ```text
/// <dependency>
/// <dependentAssembly>
/// <assemblyIdentity
/// type="win32"
/// name="Microsoft.Windows.Common-Controls"
/// version="6.0.0.0"
/// processorArchitecture="*"
/// publicKeyToken="6595b64144ccf1df"
/// language="*"
/// />
/// </dependentAssembly>
/// </dependency>
/// ```
///
/// # 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>
/// <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");
/// let attrs = tauri_build::Attributes::new().windows_attributes(windows);
/// tauri_build::try_build(attrs).expect("failed to run build script");
/// ```
///
/// Defaults to:
/// ```ignore
#[doc = include_str!("window-app-manifest.xml")]
/// Note that you can move the manifest contents to a separate file and use `include_str!("manifest.xml")`
/// instead of the inline string.
///
/// [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());
@@ -284,27 +428,7 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
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));
}
}
if let Some(tauri) = manifest.dependencies.remove("tauri") {
let error_message = check_features(&config, tauri, false);
if !error_message.is_empty() {
return Err(anyhow!("
The `tauri` 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));
}
}
allowlist::check(&config, &mut manifest)?;
let target_triple = std::env::var("TARGET").unwrap();
let out_dir = PathBuf::from(std::env::var("OUT_DIR").unwrap());
@@ -327,24 +451,53 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
}
#[allow(unused_mut, clippy::redundant_clone)]
let mut resources = config.tauri.bundle.resources.clone().unwrap_or_default();
let mut resources = config
.tauri
.bundle
.resources
.clone()
.unwrap_or_else(|| BundleResources::List(Vec::new()));
if target_triple.contains("windows") {
if let Some(fixed_webview2_runtime_path) =
&config.tauri.bundle.windows.webview_fixed_runtime_path
match &config.tauri.bundle.windows.webview_fixed_runtime_path {
Some(path) => Some(path),
None => match &config.tauri.bundle.windows.webview_install_mode {
WebviewInstallMode::FixedRuntime { path } => Some(path),
_ => None,
},
}
{
resources.push(fixed_webview2_runtime_path.display().to_string());
}
}
copy_resources(ResourcePaths::new(resources.as_slice(), true), target_dir)?;
match resources {
BundleResources::List(res) => {
copy_resources(ResourcePaths::new(res.as_slice(), true), target_dir)?
}
BundleResources::Map(map) => copy_resources(ResourcePaths::from_map(&map, true), target_dir)?,
}
if target_triple.contains("darwin") {
if let Some(frameworks) = &config.tauri.bundle.macos.frameworks {
if !frameworks.is_empty() {
let frameworks_dir = target_dir.parent().unwrap().join("Frameworks");
let _ = std::fs::remove_dir_all(&frameworks_dir);
// copy frameworks to the root `target` folder (instead of `target/debug` for instance)
// because the rpath is set to `@executable_path/../Frameworks`.
copy_frameworks(&frameworks_dir, frameworks)?;
// If we have frameworks, we need to set the @rpath
// https://github.com/tauri-apps/tauri/issues/7710
println!("cargo:rustc-link-arg=-Wl,-rpath,@executable_path/../Frameworks");
}
}
if let Some(version) = &config.tauri.bundle.macos.minimum_system_version {
println!("cargo:rustc-env=MACOSX_DEPLOYMENT_TARGET={version}");
}
}
if target_triple.contains("windows") {
use anyhow::Context;
use semver::Version;
use tauri_winres::{VersionInfo, WindowsResource};
@@ -374,27 +527,23 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
res.set_manifest(include_str!("window-app-manifest.xml"));
}
if let Some(sdk_dir) = &attributes.windows_attributes.sdk_dir {
if let Some(sdk_dir_str) = sdk_dir.to_str() {
res.set_toolkit_path(sdk_dir_str);
} else {
return Err(anyhow!(
"sdk_dir path is not valid; only UTF-8 characters are allowed"
));
}
}
if let Some(version) = &config.package.version {
if let Ok(v) = Version::parse(version) {
if let Some(version_str) = &config.package.version {
if let Ok(v) = Version::parse(version_str) {
let version = v.major << 48 | v.minor << 32 | v.patch << 16;
res.set_version_info(VersionInfo::FILEVERSION, version);
res.set_version_info(VersionInfo::PRODUCTVERSION, version);
}
res.set("FileVersion", version);
res.set("ProductVersion", version);
res.set("FileVersion", version_str);
res.set("ProductVersion", version_str);
}
if let Some(product_name) = &config.package.product_name {
res.set("ProductName", product_name);
res.set("FileDescription", product_name);
}
if let Some(short_description) = &config.tauri.bundle.short_description {
res.set("FileDescription", short_description);
}
if let Some(copyright) = &config.tauri.bundle.copyright {
res.set("LegalCopyright", copyright);
}
res.set_icon_with_id(&window_icon_path.display().to_string(), "32512");
res.compile().with_context(|| {
@@ -446,93 +595,6 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
Ok(())
}
#[derive(Debug, Default, PartialEq, Eq)]
struct Diff {
remove: Vec<String>,
add: Vec<String>,
}
fn features_diff(current: &[String], expected: &[String]) -> Diff {
let mut remove = Vec::new();
let mut add = Vec::new();
for feature in current {
if !expected.contains(feature) {
remove.push(feature.clone());
}
}
for feature in expected {
if !current.contains(feature) {
add.push(feature.clone());
}
}
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,
@@ -552,42 +614,3 @@ fn get_workspace_dir() -> Result<PathBuf> {
Ok(serde_json::from_slice::<CargoMetadata>(&output.stdout)?.workspace_root)
}
#[cfg(test)]
mod tests {
use super::Diff;
#[test]
fn array_diff() {
for (current, expected, result) in [
(vec![], vec![], Default::default()),
(
vec!["a".into()],
vec![],
Diff {
remove: vec!["a".into()],
add: vec![],
},
),
(vec!["a".into()], vec!["a".into()], Default::default()),
(
vec!["a".into(), "b".into()],
vec!["a".into()],
Diff {
remove: vec!["b".into()],
add: vec![],
},
),
(
vec!["a".into(), "b".into()],
vec!["a".into(), "c".into()],
Diff {
remove: vec!["b".into()],
add: vec!["c".into()],
},
),
] {
assert_eq!(super::features_diff(&current, &expected), result);
}
}
}

View File

@@ -1,5 +1,36 @@
# Changelog
## \[1.4.4]
### Dependencies
- Upgraded to `tauri-utils@1.6.0`
## \[1.4.3]
### Dependencies
- Upgraded to `tauri-utils@1.5.4`
## \[1.4.2]
### Dependencies
- Upgraded to `tauri-utils@1.5.2`
## \[1.4.1]
### Dependencies
- Upgraded to `tauri-utils@1.5.0`
## \[1.4.0]
### Enhancements
- [`17d5a4f5`](https://www.github.com/tauri-apps/tauri/commit/17d5a4f51f244d3ff42014b5d1b075fad7c636a5)([#6706](https://www.github.com/tauri-apps/tauri/pull/6706)) Early panic if the PNG icon is not RGBA.
- [`d2710e9d`](https://www.github.com/tauri-apps/tauri/commit/d2710e9d2e8fd93975ef6494512370faa8cb3b7e)([#6944](https://www.github.com/tauri-apps/tauri/pull/6944)) Unpin `time`, `ignore`, and `winnow` crate versions. Developers now have to pin crates if needed themselves. A list of crates that need pinning to adhere to Tauri's MSRV will be visible in Tauri's GitHub workflow: https://github.com/tauri-apps/tauri/blob/dev/.github/workflows/test-core.yml#L85.
## \[1.3.0]
- Bump minimum supported Rust version to 1.60.

View File

@@ -1,6 +1,6 @@
[package]
name = "tauri-codegen"
version = "1.3.0"
version = "1.4.4"
authors = [ "Tauri Programme within The Commons Conservancy" ]
categories = [ "gui", "web-programming" ]
license = "Apache-2.0 OR MIT"
@@ -19,20 +19,20 @@ 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.6.0", 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", optional = true }
uuid = { version = "1", features = [ "v4" ] }
semver = "1"
ico = "0.3"
png = "0.17"
json-patch = "1.0"
json-patch = "1.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

@@ -6,7 +6,7 @@
[![Chat Server](https://img.shields.io/badge/chat-on%20discord-7289da.svg)](https://discord.gg/SpmNs4S)
[![devto](https://img.shields.io/badge/blog-dev.to-black.svg)](https://dev.to/tauri)
![](https://img.shields.io/github/workflow/status/tauri-apps/tauri/test%20library?label=test%20library)
[![test core](https://img.shields.io/github/actions/workflow/status/tauri-apps/tauri/test-core.yml?label=test%20core&logo=github)](https://github.com/tauri-apps/tauri/actions/workflows/test-core.yml)
[![devto](https://img.shields.io/badge/documentation-site-purple.svg)](https://tauri.app)
[![https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg](https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg)](https://good-labs.github.io/greater-good-affirmation)

View File

@@ -176,10 +176,10 @@ pub fn context_codegen(data: ContextData) -> Result<TokenStream, EmbeddedAssetsE
.tauri
.security
.dev_csp
.clone()
.or_else(|| config.tauri.security.csp.clone())
.as_ref()
.or(config.tauri.security.csp.as_ref())
} else {
config.tauri.security.csp.clone()
config.tauri.security.csp.as_ref()
};
if csp.is_some() {
options = options.with_csp();
@@ -350,14 +350,11 @@ pub fn context_codegen(data: ContextData) -> Result<TokenStream, EmbeddedAssetsE
}
}
let out_path = out_dir.join("Info.plist");
info_plist
.to_file_xml(&out_path)
.to_file_xml(out_dir.join("Info.plist"))
.expect("failed to write Info.plist");
let info_plist_path = out_path.display().to_string();
quote!({
tauri::embed_plist::embed_info_plist!(#info_plist_path);
tauri::embed_plist::embed_info_plist!(concat!(std::env!("OUT_DIR"), "/Info.plist"));
})
} else {
quote!(())
@@ -473,15 +470,20 @@ fn ico_icon<P: AsRef<Path>>(
let width = entry.width();
let height = entry.height();
let out_path = out_dir.join(path.file_name().unwrap());
let icon_file_name = path.file_name().unwrap();
let out_path = out_dir.join(icon_file_name);
write_if_changed(&out_path, &rgba).map_err(|error| EmbeddedAssetsError::AssetWrite {
path: path.to_owned(),
error,
})?;
let out_path = out_path.display().to_string();
let icon = quote!(Some(#root::Icon::Rgba { rgba: include_bytes!(#out_path).to_vec(), width: #width, height: #height }));
let icon_file_name = icon_file_name.to_str().unwrap();
let icon = quote!(Some(
#root::Icon::Rgba {
rgba: include_bytes!(concat!(std::env!("OUT_DIR"), "/", #icon_file_name)).to_vec(),
width: #width,
height: #height
}));
Ok(icon)
}
@@ -497,9 +499,10 @@ fn raw_icon<P: AsRef<Path>>(out_dir: &Path, path: P) -> Result<TokenStream, Embe
error,
})?;
let out_path = out_path.display().to_string();
let icon = quote!(Some(include_bytes!(#out_path).to_vec()));
let icon_path = path.file_name().unwrap().to_str().unwrap().to_string();
let icon = quote!(::std::option::Option::Some(
include_bytes!(concat!(std::env!("OUT_DIR"), "/", #icon_path)).to_vec()
));
Ok(icon)
}
@@ -516,6 +519,13 @@ fn png_icon<P: AsRef<Path>>(
let mut reader = decoder
.read_info()
.unwrap_or_else(|e| panic!("failed to read icon {}: {}", path.display(), e));
let (color_type, _) = reader.output_color_type();
if color_type != png::ColorType::Rgba {
panic!("icon {} is not RGBA", path.display());
}
let mut buffer: Vec<u8> = Vec::new();
while let Ok(Some(row)) = reader.next_row() {
buffer.extend(row.data());
@@ -523,15 +533,21 @@ fn png_icon<P: AsRef<Path>>(
let width = reader.info().width;
let height = reader.info().height;
let out_path = out_dir.join(path.file_name().unwrap());
let icon_file_name = path.file_name().unwrap();
let out_path = out_dir.join(icon_file_name);
write_if_changed(&out_path, &buffer).map_err(|error| EmbeddedAssetsError::AssetWrite {
path: path.to_owned(),
error,
})?;
let out_path = out_path.display().to_string();
let icon = quote!(Some(#root::Icon::Rgba { rgba: include_bytes!(#out_path).to_vec(), width: #width, height: #height }));
let icon_file_name = icon_file_name.to_str().unwrap();
let icon = quote!(Some(
#root::Icon::Rgba {
rgba: include_bytes!(concat!(std::env!("OUT_DIR"), "/", #icon_file_name)).to_vec(),
width: #width,
height: #height,
}
));
Ok(icon)
}

View File

@@ -1,5 +1,5 @@
[package]
name = "tauri-tauri-config-schema"
name = "tauri-config-schema"
version = "0.0.0"
edition = "2021"
publish = false
@@ -8,8 +8,7 @@ publish = false
tauri-utils = { version = "1.0.0", features = [
"schema",
], path = "../tauri-utils" }
schemars = { version = "0.8", features = ["url", "preserve_order"] }
schemars = { version = "0.8.18", 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

@@ -105,6 +105,7 @@
"print": false,
"requestUserAttention": false,
"setAlwaysOnTop": false,
"setClosable": false,
"setContentProtected": false,
"setCursorGrab": false,
"setCursorIcon": false,
@@ -116,7 +117,9 @@
"setIcon": false,
"setIgnoreCursorEvents": false,
"setMaxSize": false,
"setMaximizable": false,
"setMinSize": false,
"setMinimizable": false,
"setPosition": false,
"setResizable": false,
"setSize": false,
@@ -136,17 +139,38 @@
"deb": {
"files": {}
},
"dmg": {
"appPosition": {
"x": 180,
"y": 170
},
"applicationFolderPosition": {
"x": 480,
"y": 170
},
"windowSize": {
"height": 400,
"width": 660
}
},
"icon": [],
"identifier": "",
"macOS": {
"minimumSystemVersion": "10.13"
},
"rpm": {
"epoch": 0,
"files": {},
"release": "1"
},
"targets": "all",
"useLocalToolsDir": false,
"windows": {
"allowDowngrades": true,
"certificateThumbprint": null,
"digestAlgorithm": null,
"nsis": null,
"signCommand": null,
"timestampUrl": null,
"tsp": false,
"webviewFixedRuntimePath": null,
@@ -164,6 +188,7 @@
"security": {
"dangerousDisableAssetCspModification": false,
"dangerousRemoteDomainIpcAccess": [],
"dangerousUseHttpScheme": false,
"freezePrototype": false
},
"updater": {
@@ -221,8 +246,7 @@
"pattern": "^[^/\\:*?\"<>|]+$"
},
"version": {
"description": "App version. It is a semver version number or a path to a `package.json` file containing the `version` field.",
"default": null,
"description": "App version. It is a semver version number or a path to a `package.json` file containing the `version` field. If removed the version number from `Cargo.toml` is used.",
"type": [
"string",
"null"
@@ -275,17 +299,38 @@
"deb": {
"files": {}
},
"dmg": {
"appPosition": {
"x": 180,
"y": 170
},
"applicationFolderPosition": {
"x": 480,
"y": 170
},
"windowSize": {
"height": 400,
"width": 660
}
},
"icon": [],
"identifier": "",
"macOS": {
"minimumSystemVersion": "10.13"
},
"rpm": {
"epoch": 0,
"files": {},
"release": "1"
},
"targets": "all",
"useLocalToolsDir": false,
"windows": {
"allowDowngrades": true,
"certificateThumbprint": null,
"digestAlgorithm": null,
"nsis": null,
"signCommand": null,
"timestampUrl": null,
"tsp": false,
"webviewFixedRuntimePath": null,
@@ -383,6 +428,7 @@
"print": false,
"requestUserAttention": false,
"setAlwaysOnTop": false,
"setClosable": false,
"setContentProtected": false,
"setCursorGrab": false,
"setCursorIcon": false,
@@ -394,7 +440,9 @@
"setIcon": false,
"setIgnoreCursorEvents": false,
"setMaxSize": false,
"setMaximizable": false,
"setMinSize": false,
"setMinimizable": false,
"setPosition": false,
"setResizable": false,
"setSize": false,
@@ -417,6 +465,7 @@
"default": {
"dangerousDisableAssetCspModification": false,
"dangerousRemoteDomainIpcAccess": [],
"dangerousUseHttpScheme": false,
"freezePrototype": false
},
"allOf": [
@@ -605,7 +654,22 @@
"format": "double"
},
"resizable": {
"description": "Whether the window is resizable or not.",
"description": "Whether the window is resizable or not. When resizable is set to false, native window's maximize button is automatically disabled.",
"default": true,
"type": "boolean"
},
"maximizable": {
"description": "Whether the window's native maximize button is enabled or not. If resizable is set to false, this setting is ignored.\n\n## Platform-specific\n\n- **macOS:** Disables the \"zoom\" button in the window titlebar, which is also used to enter fullscreen mode. - **Linux / iOS / Android:** Unsupported.",
"default": true,
"type": "boolean"
},
"minimizable": {
"description": "Whether the window's native minimize button is enabled or not.\n\n## Platform-specific\n\n- **Linux / iOS / Android:** Unsupported.",
"default": true,
"type": "boolean"
},
"closable": {
"description": "Whether the window's native close button is enabled or not.\n\n## Platform-specific\n\n- **Linux:** \"GTK+ will do its best to convince the window manager not to show a close button. Depending on the system, this function may not have any effect when called on a window that is already visible\" - **iOS / Android:** Unsupported.",
"default": true,
"type": "boolean"
},
@@ -1024,7 +1088,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\", \"rpm\", \"appimage\", \"nsis\", \"msi\", \"app\", \"dmg\", \"updater\"] or \"all\".",
"default": "all",
"allOf": [
{
@@ -1053,13 +1117,14 @@
},
"resources": {
"description": "App resources to bundle. Each resource is a path to a file or directory. Glob patterns are supported.",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
"anyOf": [
{
"$ref": "#/definitions/BundleResources"
},
{
"type": "null"
}
]
},
"copyright": {
"description": "A copyright string associated with your application.",
@@ -1089,6 +1154,11 @@
"null"
]
},
"useLocalToolsDir": {
"description": "Whether to use the project's `target` directory, for caching build tools (e.g., Wix and NSIS) when building this application. Defaults to `false`.\n\nIf true, tools will be cached in `target\\.tauri-tools`. If false, tools will be cached in the current user's platform-specific cache directory.\n\nAn example where it can be appropriate to set this to `true` is when building this application as a Windows System user (e.g., AWS EC2 workloads), because the Window system's app data directory is restricted.",
"default": false,
"type": "boolean"
},
"appimage": {
"description": "Configuration for the AppImage bundle.",
"default": {
@@ -1111,6 +1181,41 @@
}
]
},
"rpm": {
"description": "Configuration for the RPM bundle.",
"default": {
"epoch": 0,
"files": {},
"release": "1"
},
"allOf": [
{
"$ref": "#/definitions/RpmConfig"
}
]
},
"dmg": {
"description": "DMG-specific settings.",
"default": {
"appPosition": {
"x": 180,
"y": 170
},
"applicationFolderPosition": {
"x": 480,
"y": 170
},
"windowSize": {
"height": 400,
"width": 660
}
},
"allOf": [
{
"$ref": "#/definitions/DmgConfig"
}
]
},
"macOS": {
"description": "Configuration for the macOS bundles.",
"default": {
@@ -1139,6 +1244,7 @@
"certificateThumbprint": null,
"digestAlgorithm": null,
"nsis": null,
"signCommand": null,
"timestampUrl": null,
"tsp": false,
"webviewFixedRuntimePath": null,
@@ -1193,6 +1299,13 @@
"deb"
]
},
{
"description": "The RPM bundle (.rpm).",
"type": "string",
"enum": [
"rpm"
]
},
{
"description": "The AppImage bundle (.appimage).",
"type": "string",
@@ -1237,6 +1350,25 @@
}
]
},
"BundleResources": {
"description": "Definition for bundle resources. Can be either a list of paths to include or a map of source to target paths.",
"anyOf": [
{
"description": "A list of paths to include.",
"type": "array",
"items": {
"type": "string"
}
},
{
"description": "A map of source to target paths.",
"type": "object",
"additionalProperties": {
"type": "string"
}
}
]
},
"AppImageConfig": {
"description": "Configuration for AppImage bundles.\n\nSee more: https://tauri.app/v1/api/config#appimageconfig",
"type": "object",
@@ -1263,6 +1395,36 @@
"type": "string"
}
},
"provides": {
"description": "The list of dependencies the package provides.",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"conflicts": {
"description": "The list of package conflicts.",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"replaces": {
"description": "The list of package replaces.",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"files": {
"description": "The files to include on the package.",
"default": {},
@@ -1270,6 +1432,222 @@
"additionalProperties": {
"type": "string"
}
},
"desktopTemplate": {
"description": "Path to a custom desktop file Handlebars template.\n\nAvailable variables: `categories`, `comment` (optional), `exec`, `icon` and `name`.",
"type": [
"string",
"null"
]
},
"section": {
"description": "Define the section in Debian Control file. See : https://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections",
"type": [
"string",
"null"
]
},
"priority": {
"description": "Change the priority of the Debian Package. By default, it is set to `optional`. Recognized Priorities as of now are : `required`, `important`, `standard`, `optional`, `extra`",
"type": [
"string",
"null"
]
},
"changelog": {
"description": "Path of the uncompressed Changelog file, to be stored at /usr/share/doc/package-name/changelog.gz. See https://www.debian.org/doc/debian-policy/ch-docs.html#changelog-files-and-release-notes",
"type": [
"string",
"null"
]
}
},
"additionalProperties": false
},
"RpmConfig": {
"description": "Configuration for RPM bundles.",
"type": "object",
"properties": {
"license": {
"description": "The package's license identifier. If not set, defaults to the license from the Cargo.toml file.",
"type": [
"string",
"null"
]
},
"depends": {
"description": "The list of RPM dependencies your application relies on.",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"provides": {
"description": "The list of RPM dependencies your application provides.",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"conflicts": {
"description": "The list of RPM dependencies your application conflicts with. They must not be present in order for the package to be installed.",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"obsoletes": {
"description": "The list of RPM dependencies your application supersedes - if this package is installed, packages listed as “obsoletes” will be automatically removed (if they are present).",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"release": {
"description": "The RPM release tag.",
"default": "1",
"type": "string"
},
"epoch": {
"description": "The RPM epoch.",
"default": 0,
"type": "integer",
"format": "uint32",
"minimum": 0.0
},
"files": {
"description": "The files to include on the package.",
"default": {},
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"desktopTemplate": {
"description": "Path to a custom desktop file Handlebars template.\n\nAvailable variables: `categories`, `comment` (optional), `exec`, `icon` and `name`.",
"type": [
"string",
"null"
]
}
},
"additionalProperties": false
},
"DmgConfig": {
"description": "Configuration for Apple Disk Image (.dmg) bundles.\n\nSee more: https://tauri.app/v1/api/config#dmgconfig",
"type": "object",
"properties": {
"background": {
"description": "Image to use as the background in dmg file. Accepted formats: `png`/`jpg`/`gif`.",
"type": [
"string",
"null"
]
},
"windowPosition": {
"description": "Position of volume window on screen.",
"anyOf": [
{
"$ref": "#/definitions/Position"
},
{
"type": "null"
}
]
},
"windowSize": {
"description": "Size of volume window.",
"default": {
"height": 400,
"width": 660
},
"allOf": [
{
"$ref": "#/definitions/Size"
}
]
},
"appPosition": {
"description": "Position of app file on window.",
"default": {
"x": 180,
"y": 170
},
"allOf": [
{
"$ref": "#/definitions/Position"
}
]
},
"applicationFolderPosition": {
"description": "Position of application folder on window.",
"default": {
"x": 480,
"y": 170
},
"allOf": [
{
"$ref": "#/definitions/Position"
}
]
}
},
"additionalProperties": false
},
"Position": {
"description": "Position coordinates struct.",
"type": "object",
"required": [
"x",
"y"
],
"properties": {
"x": {
"description": "X coordinate.",
"type": "integer",
"format": "uint32",
"minimum": 0.0
},
"y": {
"description": "Y coordinate.",
"type": "integer",
"format": "uint32",
"minimum": 0.0
}
},
"additionalProperties": false
},
"Size": {
"description": "Size of the window.",
"type": "object",
"required": [
"height",
"width"
],
"properties": {
"width": {
"description": "Width of the window.",
"type": "integer",
"format": "uint32",
"minimum": 0.0
},
"height": {
"description": "Height of the window.",
"type": "integer",
"format": "uint32",
"minimum": 0.0
}
},
"additionalProperties": false
@@ -1409,6 +1787,13 @@
"type": "null"
}
]
},
"signCommand": {
"description": "Specify a custom command to sign the binaries. This command needs to have a `%1` in it which is just a placeholder for the binary path, which we will detect and replace before calling the command.\n\nExample: ```text sign-cli --arg1 --arg2 %1 ```\n\nBy Default we use `signtool.exe` which can be found only on Windows so if you are on another platform and want to cross-compile and sign you will need to use another tool like `osslsigncode`.",
"type": [
"string",
"null"
]
}
},
"additionalProperties": false
@@ -1661,6 +2046,13 @@
"description": "Configuration for the Installer bundle using NSIS.",
"type": "object",
"properties": {
"template": {
"description": "A custom .nsi template to use.",
"type": [
"string",
"null"
]
},
"license": {
"description": "The path to the license file to render on the installer.",
"type": [
@@ -1708,10 +2100,31 @@
"type": "string"
}
},
"customLanguageFiles": {
"description": "A key-value pair where the key is the language and the value is the path to a custom `.nsh` file that holds the translated text for tauri's custom messages.\n\nSee <https://github.com/tauri-apps/tauri/blob/dev/tooling/bundler/src/bundle/windows/templates/nsis-languages/English.nsh> for an example `.nsh` file.\n\n**Note**: the key must be a valid NSIS language and it must be added to [`NsisConfig`] languages array,",
"type": [
"object",
"null"
],
"additionalProperties": {
"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"
},
"compression": {
"description": "Set the compression algorithm used to compress files in the installer.\n\nSee <https://nsis.sourceforge.io/Reference/SetCompressor>",
"anyOf": [
{
"$ref": "#/definitions/NsisCompression"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false
@@ -1742,6 +2155,32 @@
}
]
},
"NsisCompression": {
"description": "Compression algorithms used in the NSIS installer.\n\nSee <https://nsis.sourceforge.io/Reference/SetCompressor>",
"oneOf": [
{
"description": "ZLIB uses the deflate algorithm, it is a quick and simple method. With the default compression level it uses about 300 KB of memory.",
"type": "string",
"enum": [
"zlib"
]
},
{
"description": "BZIP2 usually gives better compression ratios than ZLIB, but it is a bit slower and uses more memory. With the default compression level it uses about 4 MB of memory.",
"type": "string",
"enum": [
"bzip2"
]
},
{
"description": "LZMA (default) is a new compression method that gives very good compression ratios. The decompression speed is high (10-20 MB/s on a 2 GHz CPU), the compression speed is lower. The memory size that will be used for decompression is the dictionary size plus a few KBs, the default is 8 MB.",
"type": "string",
"enum": [
"lzma"
]
}
]
},
"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.",
"type": "object",
@@ -1785,6 +2224,7 @@
"print": false,
"requestUserAttention": false,
"setAlwaysOnTop": false,
"setClosable": false,
"setContentProtected": false,
"setCursorGrab": false,
"setCursorIcon": false,
@@ -1796,7 +2236,9 @@
"setIcon": false,
"setIgnoreCursorEvents": false,
"setMaxSize": false,
"setMaximizable": false,
"setMinSize": false,
"setMinimizable": false,
"setPosition": false,
"setResizable": false,
"setSize": false,
@@ -2052,6 +2494,13 @@
"items": {
"type": "string"
}
},
"requireLiteralLeadingDot": {
"description": "Whether or not paths that contain components that start with a `.` will require that `.` appears literally in the pattern; `*`, `?`, `**`, or `[...]` will not match. This is useful because such files are conventionally considered hidden on Unix systems and it might be desirable to skip them when listing files.\n\nDefaults to `true` on Unix systems and `false` on Windows",
"type": [
"boolean",
"null"
]
}
}
}
@@ -2086,6 +2535,21 @@
"default": false,
"type": "boolean"
},
"setMaximizable": {
"description": "Allows setting whether the window's native maximize button is enabled or not.",
"default": false,
"type": "boolean"
},
"setMinimizable": {
"description": "Allows setting whether the window's native minimize button is enabled or not.",
"default": false,
"type": "boolean"
},
"setClosable": {
"description": "Allows setting whether the window's native close button is enabled or not.",
"default": false,
"type": "boolean"
},
"setTitle": {
"description": "Allows changing the window title.",
"default": false,
@@ -2414,7 +2878,7 @@
"additionalProperties": false
},
"HttpAllowlistScope": {
"description": "HTTP API scope definition. It is a list of URLs that can be accessed by the webview when using the HTTP APIs. The scoped URL is matched against the request URL using a glob pattern.\n\nExamples: - \"https://**\": allows all HTTPS urls - \"https://*.github.com/tauri-apps/tauri\": allows any subdomain of \"github.com\" with the \"tauri-apps/api\" path - \"https://myapi.service.com/users/*\": allows access to any URLs that begins with \"https://myapi.service.com/users/\"",
"description": "HTTP API scope definition. It is a list of URLs that can be accessed by the webview when using the HTTP APIs. The scoped URL is matched against the request URL using a glob pattern.\n\nExamples: - \"https://*\": allows all HTTPS urls - \"https://*.github.com/tauri-apps/tauri\": allows any subdomain of \"github.com\" with the \"tauri-apps/api\" path - \"https://myapi.service.com/users/*\": allows access to any URLs that begins with \"https://myapi.service.com/users/\"",
"type": "array",
"items": {
"type": "string",
@@ -2613,6 +3077,11 @@
"items": {
"$ref": "#/definitions/RemoteDomainAccessScope"
}
},
"dangerousUseHttpScheme": {
"description": "Sets whether the custom protocols should use `http://<scheme>.localhost` instead of the default `https://<scheme>.localhost` on Windows.\n\n**WARNING:** Using a `http` scheme will allow mixed content when trying to fetch `http` endpoints and is therefore less secure but will match the behavior of the `<scheme>://localhost` protocols used on macOS and Linux.",
"default": false,
"type": "boolean"
}
},
"additionalProperties": false
@@ -2692,7 +3161,7 @@
}
},
"plugins": {
"description": "The list of plugins that are allowed in this scope.",
"description": "The list of plugins that are allowed in this scope. The names should be without the `tauri-plugin-` prefix, for example `\"store\"` for `tauri-plugin-store`.",
"default": [],
"type": "array",
"items": {
@@ -2791,7 +3260,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"

View File

@@ -1,5 +1,45 @@
# Changelog
## \[1.4.5]
### Dependencies
- Upgraded to `tauri-utils@1.6.0`
- Upgraded to `tauri-codegen@1.4.4`
## \[1.4.4]
### Dependencies
- Upgraded to `tauri-utils@1.5.4`
- Upgraded to `tauri-codegen@1.4.3`
## \[1.4.3]
### Dependencies
- Upgraded to `tauri-utils@1.5.2`
- Upgraded to `tauri-codegen@1.4.2`
## \[1.4.2]
### Enhancements
- [`5e05236b`](https://www.github.com/tauri-apps/tauri/commit/5e05236b4987346697c7caae0567d3c50714c198)([#8289](https://www.github.com/tauri-apps/tauri/pull/8289)) Added tracing for window startup, plugins, `Window::eval`, events, IPC, updater and custom protocol request handlers behind the `tracing` feature flag.
## \[1.4.1]
### Dependencies
- Upgraded to `tauri-utils@1.5.0`
- Upgraded to `tauri-codegen@1.4.1`
## \[1.4.0]
### Enhancements
- [`d68a25e3`](https://www.github.com/tauri-apps/tauri/commit/d68a25e32e012e57a9e5225b589b9ecbea70a887)([#6124](https://www.github.com/tauri-apps/tauri/pull/6124)) Improve compiler error message when generating an async command that has a reference input and don't return a Result.
## \[1.3.0]
- Bump minimum supported Rust version to 1.60.

View File

@@ -1,6 +1,6 @@
[package]
name = "tauri-macros"
version = "1.3.0"
version = "1.4.5"
authors = [ "Tauri Programme within The Commons Conservancy" ]
categories = [ "gui", "os", "filesystem", "web-programming" ]
license = "Apache-2.0 OR MIT"
@@ -16,12 +16,12 @@ readme = "README.md"
proc-macro = true
[dependencies]
proc-macro2 = "1"
proc-macro2 = { version = "1", features = [ "span-locations" ] }
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" }
heck = "0.5"
tauri-codegen = { version = "1.4.4", default-features = false, path = "../tauri-codegen" }
tauri-utils = { version = "1.6.0", path = "../tauri-utils" }
[features]
custom-protocol = [ ]
@@ -30,3 +30,4 @@ isolation = [ "tauri-codegen/isolation" ]
shell-scope = [ "tauri-codegen/shell-scope" ]
config-json5 = [ "tauri-codegen/config-json5", "tauri-utils/config-json5" ]
config-toml = [ "tauri-codegen/config-toml", "tauri-utils/config-toml" ]
tracing = [ ]

View File

@@ -4,7 +4,7 @@
[![status](https://img.shields.io/badge/status-stable-blue.svg)](https://github.com/tauri-apps/tauri/tree/dev)
[![License](https://img.shields.io/badge/License-MIT%20or%20Apache%202-green.svg)](https://opencollective.com/tauri)
[![test library](https://img.shields.io/github/workflow/status/tauri-apps/tauri/test%20library?label=test%20library)](https://github.com/tauri-apps/tauri/actions?query=workflow%3A%22test+library%22)
[![test core](https://img.shields.io/github/actions/workflow/status/tauri-apps/tauri/test-core.yml?label=test%20core&logo=github)](https://github.com/tauri-apps/tauri/actions/workflows/test-core.yml)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Ftauri-apps%2Ftauri.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Ftauri-apps%2Ftauri?ref=badge_shield)
[![Chat Server](https://img.shields.io/badge/chat-discord-7289da.svg)](https://discord.gg/SpmNs4S)
[![website](https://img.shields.io/badge/website-tauri.app-purple.svg)](https://tauri.app)

View File

@@ -5,7 +5,7 @@
use heck::{ToLowerCamelCase, ToSnakeCase};
use proc_macro::TokenStream;
use proc_macro2::TokenStream as TokenStream2;
use quote::{format_ident, quote};
use quote::{format_ident, quote, quote_spanned};
use syn::{
ext::IdentExt,
parse::{Parse, ParseStream},
@@ -103,24 +103,113 @@ pub fn wrapper(attributes: TokenStream, item: TokenStream) -> TokenStream {
resolver: format_ident!("__tauri_resolver__"),
};
// Tauri currently doesn't support async commands that take a reference as input and don't return
// a result. See: https://github.com/tauri-apps/tauri/issues/2533
//
// For now, we provide an informative error message to the user in that case. Once #2533 is
// resolved, this check can be removed.
let mut async_command_check = TokenStream2::new();
if function.sig.asyncness.is_some() {
// This check won't catch all possible problems but it should catch the most common ones.
let mut ref_argument_span = None;
for arg in &function.sig.inputs {
if let syn::FnArg::Typed(pat) = arg {
match &*pat.ty {
syn::Type::Reference(_) => {
ref_argument_span = Some(pat.span());
}
syn::Type::Path(path) => {
// Check if the type contains a lifetime argument
let last = path.path.segments.last().unwrap();
if let syn::PathArguments::AngleBracketed(args) = &last.arguments {
if args
.args
.iter()
.any(|arg| matches!(arg, syn::GenericArgument::Lifetime(_)))
{
ref_argument_span = Some(pat.span());
}
}
}
_ => {}
}
if let Some(span) = ref_argument_span {
if let syn::ReturnType::Type(_, return_type) = &function.sig.output {
// To check if the return type is `Result` we require it to check a trait that is
// only implemented by `Result`. That way we don't exclude renamed result types
// which we wouldn't otherwise be able to detect purely from the token stream.
// The "error message" displayed to the user is simply the trait name.
async_command_check = quote_spanned! {return_type.span() =>
#[allow(unreachable_code, clippy::diverging_sub_expression)]
const _: () = if false {
trait AsyncCommandMustReturnResult {}
impl<A, B> AsyncCommandMustReturnResult for ::std::result::Result<A, B> {}
let _check: #return_type = unreachable!();
let _: &dyn AsyncCommandMustReturnResult = &_check;
};
};
} else {
return quote_spanned! {
span => compile_error!("async commands that contain references as inputs must return a `Result`");
}.into();
}
}
}
}
}
// body to the command wrapper or a `compile_error!` of an error occurred while parsing it.
let body = syn::parse::<WrapperAttributes>(attributes)
let (body, attributes) = syn::parse::<WrapperAttributes>(attributes)
.map(|mut attrs| {
if function.sig.asyncness.is_some() {
attrs.execution_context = ExecutionContext::Async;
}
attrs
})
.and_then(|attrs| match attrs.execution_context {
ExecutionContext::Async => body_async(&function, &invoke, attrs.argument_case),
ExecutionContext::Blocking => body_blocking(&function, &invoke, attrs.argument_case),
.and_then(|attrs| {
let body = match attrs.execution_context {
ExecutionContext::Async => body_async(&function, &invoke, attrs.argument_case),
ExecutionContext::Blocking => body_blocking(&function, &invoke, attrs.argument_case),
};
body.map(|b| (b, Some(attrs)))
})
.unwrap_or_else(syn::Error::into_compile_error);
.unwrap_or_else(|e| (syn::Error::into_compile_error(e), None));
let Invoke { message, resolver } = invoke;
let kind = match attributes.as_ref().map(|a| &a.execution_context) {
Some(ExecutionContext::Async) if function.sig.asyncness.is_none() => "sync_threadpool",
Some(ExecutionContext::Async) => "async",
Some(ExecutionContext::Blocking) => "sync",
_ => "sync",
};
let loc = function.span().start();
let line = loc.line;
let col = loc.column;
let maybe_span = if cfg!(feature = "tracing") {
quote!({
let _span = tracing::debug_span!(
"ipc::request::handler",
cmd = #message.command(),
kind = #kind,
loc.line = #line,
loc.col = #col,
is_internal = false,
)
.entered();
})
} else {
quote!()
};
// Rely on rust 2018 edition to allow importing a macro from a path.
quote!(
#async_command_check
#function
#maybe_macro_export
@@ -134,6 +223,8 @@ pub fn wrapper(attributes: TokenStream, item: TokenStream) -> TokenStream {
#[allow(unused_variables)]
let ::tauri::Invoke { message: #message, resolver: #resolver } = $invoke;
#maybe_span
#body
}};
}
@@ -153,6 +244,20 @@ pub fn wrapper(attributes: TokenStream, item: TokenStream) -> TokenStream {
fn body_async(function: &ItemFn, invoke: &Invoke, case: ArgumentCase) -> syn::Result<TokenStream2> {
let Invoke { message, resolver } = invoke;
parse_args(function, message, case).map(|args| {
#[cfg(feature = "tracing")]
quote! {
use tracing::Instrument;
let span = tracing::debug_span!("ipc::request::run");
#resolver.respond_async_serialized(async move {
let result = $path(#(#args?),*);
let kind = (&result).async_kind();
kind.future(result).await
}
.instrument(span));
}
#[cfg(not(feature = "tracing"))]
quote! {
#resolver.respond_async_serialized(async move {
let result = $path(#(#args?),*);
@@ -182,7 +287,14 @@ fn body_blocking(
Err(err) => return #resolver.invoke_error(err),
});
let maybe_span = if cfg!(feature = "tracing") {
quote!(let _span = tracing::debug_span!("ipc::request::run").entered();)
} else {
quote!()
};
Ok(quote! {
#maybe_span
let result = $path(#(match #args #match_body),*);
let kind = (&result).blocking_kind();
kind.block(result, #resolver);

View File

@@ -272,12 +272,12 @@ pub fn command_handler(attributes: HandlerAttributes, function: ItemFn) -> Token
pub fn command_test(attributes: HandlerTestAttributes, function: ItemFn) -> TokenStream2 {
let allowlist = attributes.allowlist;
let error_message = attributes.error_message.as_str();
let signature = function.sig.clone();
let signature = &function.sig;
let enum_variant_name = function.sig.ident.to_string().to_lower_camel_case();
let response = match attributes.allowlist_check_kind {
AllowlistCheckKind::Runtime => {
let test_name = function.sig.ident.clone();
let test_name = &signature.ident;
quote!(super::Cmd::#test_name(crate::test::mock_invoke_context()))
}
AllowlistCheckKind::Serde => quote! {

View File

@@ -1,5 +1,97 @@
# Changelog
## \[0.14.9]
### Dependencies
- Upgraded to `tauri-utils@1.6.0`
- Upgraded to `tauri-runtime@0.14.4`
## \[0.14.8]
### Security fixes
- [`f6d81dfe0`](https://www.github.com/tauri-apps/tauri/commit/f6d81dfe0871e0ccd012e5190d41e3767e733608) Only process IPC commands from the main frame.
## \[0.14.7]
### Bug Fixes
- [`2eb21378a`](https://www.github.com/tauri-apps/tauri/commit/2eb21378a65107da0d4a1ab425767e99580966c2)([#9718](https://www.github.com/tauri-apps/tauri/pull/9718)) Fixes redraw tracing span not closing.
## \[0.14.6]
### Dependencies
- Upgraded to `tauri-utils@1.5.4`
- Upgraded to `tauri-runtime@0.14.3`
## \[0.14.5]
### What's Changed
- [`d42668ce`](https://www.github.com/tauri-apps/tauri/commit/d42668ce17494ab778f436aaa9b216d6db3f0b31)([#9003](https://www.github.com/tauri-apps/tauri/pull/9003)) Fix panic during intialization on wayland when using `clipboard` feature, instead propagate the error during API usage.
## \[0.14.4]
### Bug Fixes
- [`24210735`](https://www.github.com/tauri-apps/tauri/commit/2421073576a6d45783176be57b0188668558aff7)([#8117](https://www.github.com/tauri-apps/tauri/pull/8117)) Fixes a crash on macOS when accessing the windows map.
- [`510b6226`](https://www.github.com/tauri-apps/tauri/commit/510b62261c70331ce3f5bfd24137dac1bc4a0bbe)([#8822](https://www.github.com/tauri-apps/tauri/pull/8822)) Add missing `arboard` feature flag to prevent panics in wayland session.
## \[0.14.3]
### Bug Fixes
- [`0d0501cb`](https://www.github.com/tauri-apps/tauri/commit/0d0501cb7b5e767c51a3697a148acfe84211a7ad)([#8394](https://www.github.com/tauri-apps/tauri/pull/8394)) Use `arboard` instead of `tao` clipboard implementation to prevent a crash.
- [`b2f83f03`](https://www.github.com/tauri-apps/tauri/commit/b2f83f03a872baa91e2b6bbb22a3e7a5cd975dc0)([#8402](https://www.github.com/tauri-apps/tauri/pull/8402)) Use `Arc` instead of `Rc` to prevent crashes on macOS.
### Dependencies
- Upgraded to `tauri-utils@1.5.2`
- Upgraded to `tauri-runtime@0.14.2`
## \[0.14.2]
### Enhancements
- [`5e05236b`](https://www.github.com/tauri-apps/tauri/commit/5e05236b4987346697c7caae0567d3c50714c198)([#8289](https://www.github.com/tauri-apps/tauri/pull/8289)) Added tracing for window startup, plugins, `Window::eval`, events, IPC, updater and custom protocol request handlers behind the `tracing` feature flag.
## \[0.14.1]
### Enhancements
- [`9aa34ada`](https://www.github.com/tauri-apps/tauri/commit/9aa34ada5769dbefa7dfe5f7a6288b3d20b294e4)([#7645](https://www.github.com/tauri-apps/tauri/pull/7645)) Add setting to switch to `http://<scheme>.localhost/` for custom protocols on Windows.
### Bug Fixes
- [`4bf1e85e`](https://www.github.com/tauri-apps/tauri/commit/4bf1e85e6bf85a7ec92d50c8465bc0588a6399d8)([#7722](https://www.github.com/tauri-apps/tauri/pull/7722)) Properly respect the `focused` option when creating the webview.
### Dependencies
- Upgraded to `tauri-utils@1.5.0`
- Upgraded to `tauri-runtime@0.14.1`
## \[0.14.0]
### New Features
- [`c4d6fb4b`](https://www.github.com/tauri-apps/tauri/commit/c4d6fb4b1ea8acf02707a9fe5dcab47c1c5bae7b)([#2353](https://www.github.com/tauri-apps/tauri/pull/2353)) Added the `maximizable`, `minimizable` and `closable` methods to `WindowBuilder`.
- [`c4d6fb4b`](https://www.github.com/tauri-apps/tauri/commit/c4d6fb4b1ea8acf02707a9fe5dcab47c1c5bae7b)([#2353](https://www.github.com/tauri-apps/tauri/pull/2353)) Added `set_maximizable`, `set_minimizable`, `set_closable`, `is_maximizable`, `is_minimizable` and `is_closable` methods to the `Dispatch` trait.
- [`000104bc`](https://www.github.com/tauri-apps/tauri/commit/000104bc3bc0c9ff3d20558ab9cf2080f126e9e0)([#6472](https://www.github.com/tauri-apps/tauri/pull/6472)) Add `Window::is_focused` getter.
### Enhancements
- [`d2710e9d`](https://www.github.com/tauri-apps/tauri/commit/d2710e9d2e8fd93975ef6494512370faa8cb3b7e)([#6944](https://www.github.com/tauri-apps/tauri/pull/6944)) Unpin `time`, `ignore`, and `winnow` crate versions. Developers now have to pin crates if needed themselves. A list of crates that need pinning to adhere to Tauri's MSRV will be visible in Tauri's GitHub workflow: https://github.com/tauri-apps/tauri/blob/dev/.github/workflows/test-core.yml#L85.
### Bug Fixes
- [`b41b57eb`](https://www.github.com/tauri-apps/tauri/commit/b41b57ebb27befd366db5befaafb6043c18fdfef)([#7105](https://www.github.com/tauri-apps/tauri/pull/7105)) Fix panics when registering an invalid global shortcuts or checking it is registered and return proper errors instead.
### What's Changed
- [`076e1a81`](https://www.github.com/tauri-apps/tauri/commit/076e1a81a50468e3dfb34ae9ca7e77c5e1758daa)([#7119](https://www.github.com/tauri-apps/tauri/pull/7119)) Use `u32` instead of `u64` for js event listener ids
## \[0.13.0]
- Added the `additional_browser_args` option when creating a window.

View File

@@ -1,6 +1,6 @@
[package]
name = "tauri-runtime-wry"
version = "0.13.0"
version = "0.14.9"
authors = [ "Tauri Programme within The Commons Conservancy" ]
categories = [ "gui", "web-programming" ]
license = "Apache-2.0 OR MIT"
@@ -13,12 +13,14 @@ 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.24.10", default-features = false, features = [ "file-drop", "protocol" ] }
tauri-runtime = { version = "0.14.4", path = "../tauri-runtime" }
tauri-utils = { version = "1.6.0", path = "../tauri-utils" }
uuid = { version = "1", features = [ "v4" ] }
rand = "0.8"
raw-window-handle = "=0.5.0"
raw-window-handle = "0.5"
tracing = { version = "0.1", optional = true }
arboard = { version = "3", optional = true }
[target."cfg(windows)".dependencies]
webview2-com = "0.19.1"
@@ -46,5 +48,6 @@ macos-private-api = [
]
objc-exception = [ "wry/objc-exception" ]
global-shortcut = [ "tauri-runtime/global-shortcut" ]
clipboard = [ "tauri-runtime/clipboard" ]
clipboard = [ "tauri-runtime/clipboard", "arboard/wayland-data-control" ]
linux-headers = [ "wry/linux-headers", "webkit2gtk/v2_36" ]
tracing = [ "dep:tracing", "wry/tracing" ]

View File

@@ -6,8 +6,7 @@
[![Chat Server](https://img.shields.io/badge/chat-on%20discord-7289da.svg)](https://discord.gg/SpmNs4S)
[![devto](https://img.shields.io/badge/blog-dev.to-black.svg)](https://dev.to/tauri)
![](https://img.shields.io/github/workflow/status/tauri-apps/tauri/test%20library?label=test%20library
)
[![test core](https://img.shields.io/github/actions/workflow/status/tauri-apps/tauri/test-core.yml?label=test%20core&logo=github)](https://github.com/tauri-apps/tauri/actions/workflows/test-core.yml)
[![devto](https://img.shields.io/badge/documentation-site-purple.svg)](https://tauri.app)
[![https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg](https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg)](https://good-labs.github.io/greater-good-affirmation)

View File

@@ -4,59 +4,66 @@
//! Clipboard implementation.
use crate::{getter, Context, Message};
use std::sync::{
mpsc::{channel, Sender},
Arc, Mutex,
use std::{
fmt,
sync::{Arc, Mutex},
};
use tauri_runtime::{ClipboardManager, Result, UserEvent};
pub use wry::application::clipboard::Clipboard;
pub use arboard::Clipboard;
use tauri_runtime::{ClipboardManager, Result};
#[derive(Debug, Clone)]
pub enum ClipboardMessage {
WriteText(String, Sender<()>),
ReadText(Sender<Option<String>>),
#[derive(Clone)]
pub struct ClipboardManagerWrapper {
pub clipboard: Arc<Mutex<std::result::Result<Clipboard, arboard::Error>>>,
}
#[derive(Debug, Clone)]
pub struct ClipboardManagerWrapper<T: UserEvent> {
pub context: Context<T>,
impl fmt::Debug for ClipboardManagerWrapper {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("ClipboardManagerWrapper").finish()
}
}
// SAFETY: this is safe since the `Context` usage is guarded on `send_user_message`.
#[allow(clippy::non_send_fields_in_send_ty)]
unsafe impl<T: UserEvent> Sync for ClipboardManagerWrapper<T> {}
struct ClipboardError(String);
impl std::error::Error for ClipboardError {}
impl fmt::Display for ClipboardError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "ClipboardError: {}", self.0)
}
}
impl fmt::Debug for ClipboardError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("ClipboardError").field(&self.0).finish()
}
}
impl From<ClipboardError> for crate::Error {
fn from(e: ClipboardError) -> crate::Error {
crate::Error::Clipboard(Box::new(e))
}
}
impl<T: UserEvent> ClipboardManager for ClipboardManagerWrapper<T> {
impl ClipboardManager for ClipboardManagerWrapper {
fn read_text(&self) -> Result<Option<String>> {
let (tx, rx) = channel();
getter!(self, rx, Message::Clipboard(ClipboardMessage::ReadText(tx)))
self
.clipboard
.lock()
.unwrap()
.as_mut()
.map(|c| c.get_text().map(Some))
.map_err(|e| ClipboardError(e.to_string()))?
.map_err(|e| ClipboardError(e.to_string()))
.map_err(Into::into)
}
fn write_text<V: Into<String>>(&mut self, text: V) -> Result<()> {
let (tx, rx) = channel();
getter!(
self,
rx,
Message::Clipboard(ClipboardMessage::WriteText(text.into(), tx))
)?;
Ok(())
}
}
pub fn handle_clipboard_message(
message: ClipboardMessage,
clipboard_manager: &Arc<Mutex<Clipboard>>,
) {
match message {
ClipboardMessage::WriteText(text, tx) => {
clipboard_manager.lock().unwrap().write_text(text);
tx.send(()).unwrap();
}
ClipboardMessage::ReadText(tx) => tx
.send(clipboard_manager.lock().unwrap().read_text())
.unwrap(),
let text = text.into();
self
.clipboard
.lock()
.unwrap()
.as_mut()
.map(|c| c.set_text(text))
.map_err(|e| ClipboardError(e.to_string()))?
.map_err(|e| ClipboardError(e.to_string()))
.map_err(Into::into)
}
}

View File

@@ -6,7 +6,9 @@
use std::{
collections::HashMap,
error::Error as StdError,
fmt,
rc::Rc,
sync::{
mpsc::{channel, Sender},
Arc, Mutex,
@@ -18,7 +20,7 @@ use crate::{getter, Context, Message};
use tauri_runtime::{Error, GlobalShortcutManager, Result, UserEvent};
#[cfg(desktop)]
pub use wry::application::{
accelerator::{Accelerator, AcceleratorId},
accelerator::{Accelerator, AcceleratorId, AcceleratorParseError},
global_shortcut::{GlobalShortcut, ShortcutManager as WryShortcutManager},
};
@@ -39,6 +41,15 @@ pub struct GlobalShortcutWrapper(GlobalShortcut);
#[allow(clippy::non_send_fields_in_send_ty)]
unsafe impl Send for GlobalShortcutWrapper {}
#[derive(Debug, Clone)]
struct AcceleratorParseErrorWrapper(AcceleratorParseError);
impl fmt::Display for AcceleratorParseErrorWrapper {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.0)
}
}
impl StdError for AcceleratorParseErrorWrapper {}
/// Wrapper around [`WryShortcutManager`].
#[derive(Clone)]
pub struct GlobalShortcutManagerHandle<T: UserEvent> {
@@ -67,14 +78,21 @@ impl<T: UserEvent> GlobalShortcutManager for GlobalShortcutManagerHandle<T> {
self,
rx,
Message::GlobalShortcut(GlobalShortcutMessage::IsRegistered(
accelerator.parse().expect("invalid accelerator"),
accelerator
.parse()
.map_err(|e: AcceleratorParseError| Error::GlobalShortcut(Box::new(
AcceleratorParseErrorWrapper(e)
)))?,
tx
))
)
}
fn register<F: Fn() + Send + 'static>(&mut self, accelerator: &str, handler: F) -> Result<()> {
let wry_accelerator: Accelerator = accelerator.parse().expect("invalid accelerator");
let wry_accelerator: Accelerator =
accelerator.parse().map_err(|e: AcceleratorParseError| {
Error::GlobalShortcut(Box::new(AcceleratorParseErrorWrapper(e)))
})?;
let id = wry_accelerator.clone().id();
let (tx, rx) = channel();
let shortcut = getter!(
@@ -121,7 +139,7 @@ impl<T: UserEvent> GlobalShortcutManager for GlobalShortcutManagerHandle<T> {
pub fn handle_global_shortcut_message(
message: GlobalShortcutMessage,
global_shortcut_manager: &Arc<Mutex<WryShortcutManager>>,
global_shortcut_manager: &Rc<Mutex<WryShortcutManager>>,
) {
match message {
GlobalShortcutMessage::IsRegistered(accelerator, tx) => tx

View File

@@ -5,6 +5,7 @@
//! The [`wry`] Tauri [`Runtime`].
use raw_window_handle::{HasRawDisplayHandle, HasRawWindowHandle, RawDisplayHandle};
use std::{collections::BTreeMap, rc::Rc};
use tauri_runtime::{
http::{header::CONTENT_TYPE, Request as HttpRequest, RequestParts, Response as HttpResponse},
menu::{AboutMetadata, CustomMenuItem, Menu, MenuEntry, MenuHash, MenuId, MenuItem, MenuUpdate},
@@ -68,6 +69,7 @@ use wry::{
};
pub use wry::application::window::{Window, WindowBuilder as WryWindowBuilder, WindowId};
pub use wry::webview::webview_version;
#[cfg(windows)]
use wry::webview::WebviewExtWindows;
@@ -173,8 +175,6 @@ pub(crate) fn send_user_message<T: UserEvent>(
webview_id_map: context.webview_id_map.clone(),
#[cfg(all(desktop, feature = "global-shortcut"))]
global_shortcut_manager: context.main_thread.global_shortcut_manager.clone(),
#[cfg(feature = "clipboard")]
clipboard_manager: context.main_thread.clipboard_manager.clone(),
windows: context.main_thread.windows.clone(),
#[cfg(all(desktop, feature = "system-tray"))]
system_tray_manager: context.main_thread.system_tray_manager.clone(),
@@ -214,7 +214,6 @@ impl<T: UserEvent> Context<T> {
impl<T: UserEvent> Context<T> {
fn create_webview(&self, pending: PendingWindow<T, Wry<T>>) -> Result<DetachedWindow<T, Wry<T>>> {
let label = pending.label.clone();
let current_url = pending.current_url.clone();
let menu_ids = pending.menu_ids.clone();
let js_event_listeners = pending.js_event_listeners.clone();
let context = self.clone();
@@ -236,7 +235,6 @@ impl<T: UserEvent> Context<T> {
};
Ok(DetachedWindow {
label,
current_url,
dispatcher,
menu_ids,
js_event_listeners,
@@ -244,17 +242,52 @@ impl<T: UserEvent> Context<T> {
}
}
#[cfg(feature = "tracing")]
#[derive(Debug, Clone, Default)]
pub struct ActiveTraceSpanStore(Rc<RefCell<Vec<ActiveTracingSpan>>>);
#[cfg(feature = "tracing")]
impl ActiveTraceSpanStore {
pub fn remove_window_draw(&self) {
self
.0
.borrow_mut()
.retain(|t| !matches!(t, ActiveTracingSpan::WindowDraw { id: _, span: _ }));
}
}
#[cfg(feature = "tracing")]
#[derive(Debug)]
pub enum ActiveTracingSpan {
WindowDraw {
id: WindowId,
span: tracing::span::EnteredSpan,
},
}
#[derive(Debug)]
pub struct WindowsStore(RefCell<BTreeMap<WebviewId, WindowWrapper>>);
// SAFETY: we ensure this type is only used on the main thread.
#[allow(clippy::non_send_fields_in_send_ty)]
unsafe impl Send for WindowsStore {}
// SAFETY: we ensure this type is only used on the main thread.
#[allow(clippy::non_send_fields_in_send_ty)]
unsafe impl Sync for WindowsStore {}
#[derive(Debug, Clone)]
pub struct DispatcherMainThreadContext<T: UserEvent> {
pub window_target: EventLoopWindowTarget<Message<T>>,
pub web_context: WebContextStore,
#[cfg(all(desktop, feature = "global-shortcut"))]
pub global_shortcut_manager: Arc<Mutex<WryShortcutManager>>,
#[cfg(feature = "clipboard")]
pub clipboard_manager: Arc<Mutex<Clipboard>>,
pub windows: Arc<RefCell<HashMap<WebviewId, WindowWrapper>>>,
pub global_shortcut_manager: Rc<Mutex<WryShortcutManager>>,
// changing this to an Rc will cause frequent app crashes.
pub windows: Arc<WindowsStore>,
#[cfg(all(desktop, feature = "system-tray"))]
system_tray_manager: SystemTrayManager,
#[cfg(feature = "tracing")]
pub active_tracing_spans: ActiveTraceSpanStore,
}
// SAFETY: we ensure this type is only used on the main thread.
@@ -718,6 +751,9 @@ impl WindowBuilder for WindowBuilderWrapper {
.inner_size(config.width, config.height)
.visible(config.visible)
.resizable(config.resizable)
.maximizable(config.maximizable)
.minimizable(config.minimizable)
.closable(config.closable)
.fullscreen(config.fullscreen)
.decorations(config.decorations)
.maximized(config.maximized)
@@ -816,6 +852,21 @@ impl WindowBuilder for WindowBuilderWrapper {
self
}
fn maximizable(mut self, maximizable: bool) -> Self {
self.inner = self.inner.with_maximizable(maximizable);
self
}
fn minimizable(mut self, minimizable: bool) -> Self {
self.inner = self.inner.with_minimizable(minimizable);
self
}
fn closable(mut self, closable: bool) -> Self {
self.inner = self.inner.with_closable(closable);
self
}
fn title<S: Into<String>>(mut self, title: S) -> Self {
self.inner = self.inner.with_title(title.into());
self
@@ -1055,8 +1106,12 @@ pub enum WindowMessage {
IsFullscreen(Sender<bool>),
IsMinimized(Sender<bool>),
IsMaximized(Sender<bool>),
IsFocused(Sender<bool>),
IsDecorated(Sender<bool>),
IsResizable(Sender<bool>),
IsMaximizable(Sender<bool>),
IsMinimizable(Sender<bool>),
IsClosable(Sender<bool>),
IsVisible(Sender<bool>),
Title(Sender<String>),
IsMenuVisible(Sender<bool>),
@@ -1077,6 +1132,9 @@ pub enum WindowMessage {
Center,
RequestUserAttention(Option<UserAttentionTypeWrapper>),
SetResizable(bool),
SetMaximizable(bool),
SetMinimizable(bool),
SetClosable(bool),
SetTitle(String),
Maximize,
Unmaximize,
@@ -1110,7 +1168,10 @@ pub enum WindowMessage {
#[derive(Debug, Clone)]
pub enum WebviewMessage {
#[cfg(not(feature = "tracing"))]
EvaluateScript(String),
#[cfg(feature = "tracing")]
EvaluateScript(String, Sender<()>, tracing::Span),
#[allow(dead_code)]
WebviewEvent(WebviewEvent),
Print,
@@ -1157,8 +1218,6 @@ pub enum Message<T: 'static> {
),
#[cfg(all(desktop, feature = "global-shortcut"))]
GlobalShortcut(GlobalShortcutMessage),
#[cfg(feature = "clipboard")]
Clipboard(ClipboardMessage),
UserEvent(T),
}
@@ -1170,8 +1229,6 @@ impl<T: UserEvent> Clone for Message<T> {
Self::Tray(i, m) => Self::Tray(*i, m.clone()),
#[cfg(all(desktop, feature = "global-shortcut"))]
Self::GlobalShortcut(m) => Self::GlobalShortcut(m.clone()),
#[cfg(feature = "clipboard")]
Self::Clipboard(m) => Self::Clipboard(m.clone()),
Self::UserEvent(t) => Self::UserEvent(t.clone()),
_ => unimplemented!(),
}
@@ -1285,6 +1342,10 @@ impl<T: UserEvent> Dispatch<T> for WryDispatcher<T> {
window_getter!(self, WindowMessage::IsMaximized)
}
fn is_focused(&self) -> Result<bool> {
window_getter!(self, WindowMessage::IsFocused)
}
/// Gets the windows current decoration state.
fn is_decorated(&self) -> Result<bool> {
window_getter!(self, WindowMessage::IsDecorated)
@@ -1295,6 +1356,21 @@ impl<T: UserEvent> Dispatch<T> for WryDispatcher<T> {
window_getter!(self, WindowMessage::IsResizable)
}
/// Gets the current native window's maximize button state
fn is_maximizable(&self) -> Result<bool> {
window_getter!(self, WindowMessage::IsMaximizable)
}
/// Gets the current native window's minimize button state
fn is_minimizable(&self) -> Result<bool> {
window_getter!(self, WindowMessage::IsMinimizable)
}
/// Gets the current native window's close button state
fn is_closable(&self) -> Result<bool> {
window_getter!(self, WindowMessage::IsClosable)
}
fn is_visible(&self) -> Result<bool> {
window_getter!(self, WindowMessage::IsVisible)
}
@@ -1386,6 +1462,27 @@ impl<T: UserEvent> Dispatch<T> for WryDispatcher<T> {
)
}
fn set_maximizable(&self, maximizable: bool) -> Result<()> {
send_user_message(
&self.context,
Message::Window(self.window_id, WindowMessage::SetMaximizable(maximizable)),
)
}
fn set_minimizable(&self, minimizable: bool) -> Result<()> {
send_user_message(
&self.context,
Message::Window(self.window_id, WindowMessage::SetMinimizable(minimizable)),
)
}
fn set_closable(&self, closable: bool) -> Result<()> {
send_user_message(
&self.context,
Message::Window(self.window_id, WindowMessage::SetClosable(closable)),
)
}
fn set_title<S: Into<String>>(&self, title: S) -> Result<()> {
send_user_message(
&self.context,
@@ -1586,6 +1683,21 @@ impl<T: UserEvent> Dispatch<T> for WryDispatcher<T> {
)
}
#[cfg(feature = "tracing")]
fn eval_script<S: Into<String>>(&self, script: S) -> Result<()> {
// use a channel so the EvaluateScript task uses the current span as parent
let (tx, rx) = channel();
getter!(
self,
rx,
Message::Webview(
self.window_id,
WebviewMessage::EvaluateScript(script.into(), tx, tracing::Span::current()),
)
)
}
#[cfg(not(feature = "tracing"))]
fn eval_script<S: Into<String>>(&self, script: S) -> Result<()> {
send_user_message(
&self.context,
@@ -1607,7 +1719,7 @@ impl<T: UserEvent> Dispatch<T> for WryDispatcher<T> {
#[derive(Clone)]
enum WindowHandle {
Webview {
inner: Arc<WebView>,
inner: Rc<WebView>,
context_store: WebContextStore,
// the key of the WebContext if it's not shared
context_key: Option<PathBuf>,
@@ -1623,7 +1735,7 @@ impl Drop for WindowHandle {
context_key,
} = self
{
if Arc::get_mut(inner).is_some() {
if Rc::get_mut(inner).is_some() {
context_store.lock().unwrap().remove(context_key);
}
}
@@ -1718,7 +1830,7 @@ pub struct Wry<T: UserEvent> {
global_shortcut_manager_handle: GlobalShortcutManagerHandle<T>,
#[cfg(feature = "clipboard")]
clipboard_manager_handle: ClipboardManagerWrapper<T>,
clipboard_manager_handle: ClipboardManagerWrapper,
event_loop: EventLoop<Message<T>>,
}
@@ -1749,11 +1861,7 @@ impl<T: UserEvent> fmt::Debug for Wry<T> {
);
#[cfg(feature = "clipboard")]
d.field(
"clipboard_manager",
&self.context.main_thread.clipboard_manager,
)
.field("clipboard_manager_handle", &self.clipboard_manager_handle);
d.field("clipboard_manager_handle", &self.clipboard_manager_handle);
d.finish()
}
@@ -1872,12 +1980,10 @@ impl<T: UserEvent> Wry<T> {
let web_context = WebContextStore::default();
#[cfg(all(desktop, feature = "global-shortcut"))]
let global_shortcut_manager = Arc::new(Mutex::new(WryShortcutManager::new(&event_loop)));
let global_shortcut_manager = Rc::new(Mutex::new(WryShortcutManager::new(&event_loop)));
#[cfg(feature = "clipboard")]
let clipboard_manager = Arc::new(Mutex::new(Clipboard::new()));
let windows = Arc::new(WindowsStore(RefCell::new(BTreeMap::default())));
let windows = Arc::new(RefCell::new(HashMap::default()));
let webview_id_map = WebviewIdStore::default();
#[cfg(all(desktop, feature = "system-tray"))]
@@ -1892,11 +1998,11 @@ impl<T: UserEvent> Wry<T> {
web_context,
#[cfg(all(desktop, feature = "global-shortcut"))]
global_shortcut_manager,
#[cfg(feature = "clipboard")]
clipboard_manager,
windows,
#[cfg(all(desktop, feature = "system-tray"))]
system_tray_manager,
#[cfg(feature = "tracing")]
active_tracing_spans: Default::default(),
},
};
@@ -1910,7 +2016,7 @@ impl<T: UserEvent> Wry<T> {
#[cfg(feature = "clipboard")]
#[allow(clippy::redundant_clone)]
let clipboard_manager_handle = ClipboardManagerWrapper {
context: context.clone(),
clipboard: Arc::new(Mutex::new(Clipboard::new())),
};
Ok(Self {
@@ -1943,7 +2049,7 @@ impl<T: UserEvent> Runtime<T> for Wry<T> {
type GlobalShortcutManager = GlobalShortcutManagerHandle<T>;
#[cfg(feature = "clipboard")]
type ClipboardManager = ClipboardManagerWrapper<T>;
type ClipboardManager = ClipboardManagerWrapper;
#[cfg(all(desktop, feature = "system-tray"))]
type TrayHandler = SystemTrayHandle<T>;
@@ -1987,7 +2093,6 @@ impl<T: UserEvent> Runtime<T> for Wry<T> {
fn create_window(&self, pending: PendingWindow<T, Self>) -> Result<DetachedWindow<T, Self>> {
let label = pending.label.clone();
let current_url = pending.current_url.clone();
let menu_ids = pending.menu_ids.clone();
let js_event_listeners = pending.js_event_listeners.clone();
let window_id = rand::random();
@@ -2009,12 +2114,12 @@ impl<T: UserEvent> Runtime<T> for Wry<T> {
.context
.main_thread
.windows
.0
.borrow_mut()
.insert(window_id, webview);
Ok(DetachedWindow {
label,
current_url,
dispatcher,
menu_ids,
js_event_listeners,
@@ -2026,7 +2131,7 @@ impl<T: UserEvent> Runtime<T> for Wry<T> {
let id = system_tray.id;
let mut listeners = Vec::new();
if let Some(l) = system_tray.on_event.take() {
listeners.push(Arc::new(l));
listeners.push(Rc::new(l));
}
let (tray, items) = create_tray(WryTrayId(id), system_tray, &self.event_loop)?;
self
@@ -2039,9 +2144,9 @@ impl<T: UserEvent> Runtime<T> for Wry<T> {
.insert(
id,
TrayContext {
tray: Arc::new(Mutex::new(Some(tray))),
listeners: Arc::new(Mutex::new(listeners)),
items: Arc::new(Mutex::new(items)),
tray: Rc::new(RefCell::new(Some(tray))),
listeners: Rc::new(RefCell::new(listeners)),
items: Rc::new(RefCell::new(items)),
},
);
@@ -2102,13 +2207,14 @@ impl<T: UserEvent> Runtime<T> for Wry<T> {
#[cfg(all(desktop, feature = "system-tray"))]
let system_tray_manager = self.context.main_thread.system_tray_manager.clone();
#[cfg(feature = "tracing")]
let active_tracing_spans = self.context.main_thread.active_tracing_spans.clone();
#[cfg(all(desktop, feature = "global-shortcut"))]
let global_shortcut_manager = self.context.main_thread.global_shortcut_manager.clone();
#[cfg(all(desktop, feature = "global-shortcut"))]
let global_shortcut_manager_handle = self.global_shortcut_manager_handle.clone();
#[cfg(feature = "clipboard")]
let clipboard_manager = self.context.main_thread.clipboard_manager.clone();
let mut iteration = RunIteration::default();
let proxy = self.event_loop.create_proxy();
@@ -2135,10 +2241,10 @@ impl<T: UserEvent> Runtime<T> for Wry<T> {
global_shortcut_manager: global_shortcut_manager.clone(),
#[cfg(all(desktop, feature = "global-shortcut"))]
global_shortcut_manager_handle: &global_shortcut_manager_handle,
#[cfg(feature = "clipboard")]
clipboard_manager: clipboard_manager.clone(),
#[cfg(all(desktop, feature = "system-tray"))]
system_tray_manager: system_tray_manager.clone(),
#[cfg(feature = "tracing")]
active_tracing_spans: active_tracing_spans.clone(),
},
web_context,
);
@@ -2159,10 +2265,10 @@ impl<T: UserEvent> Runtime<T> for Wry<T> {
global_shortcut_manager: global_shortcut_manager.clone(),
#[cfg(all(desktop, feature = "global-shortcut"))]
global_shortcut_manager_handle: &global_shortcut_manager_handle,
#[cfg(feature = "clipboard")]
clipboard_manager: clipboard_manager.clone(),
#[cfg(all(desktop, feature = "system-tray"))]
system_tray_manager: system_tray_manager.clone(),
#[cfg(feature = "tracing")]
active_tracing_spans: active_tracing_spans.clone(),
},
web_context,
);
@@ -2177,6 +2283,9 @@ impl<T: UserEvent> Runtime<T> for Wry<T> {
let web_context = self.context.main_thread.web_context;
let mut plugins = self.plugins;
#[cfg(feature = "tracing")]
let active_tracing_spans = self.context.main_thread.active_tracing_spans.clone();
#[cfg(all(desktop, feature = "system-tray"))]
let system_tray_manager = self.context.main_thread.system_tray_manager;
@@ -2185,9 +2294,6 @@ impl<T: UserEvent> Runtime<T> for Wry<T> {
#[cfg(all(desktop, feature = "global-shortcut"))]
let global_shortcut_manager_handle = self.global_shortcut_manager_handle.clone();
#[cfg(feature = "clipboard")]
let clipboard_manager = self.context.main_thread.clipboard_manager.clone();
let proxy = self.event_loop.create_proxy();
self.event_loop.run(move |event, event_loop, control_flow| {
@@ -2205,10 +2311,10 @@ impl<T: UserEvent> Runtime<T> for Wry<T> {
global_shortcut_manager: global_shortcut_manager.clone(),
#[cfg(all(desktop, feature = "global-shortcut"))]
global_shortcut_manager_handle: &global_shortcut_manager_handle,
#[cfg(feature = "clipboard")]
clipboard_manager: clipboard_manager.clone(),
#[cfg(all(desktop, feature = "system-tray"))]
system_tray_manager: system_tray_manager.clone(),
#[cfg(feature = "tracing")]
active_tracing_spans: active_tracing_spans.clone(),
},
&web_context,
);
@@ -2228,10 +2334,10 @@ impl<T: UserEvent> Runtime<T> for Wry<T> {
global_shortcut_manager: global_shortcut_manager.clone(),
#[cfg(all(desktop, feature = "global-shortcut"))]
global_shortcut_manager_handle: &global_shortcut_manager_handle,
#[cfg(feature = "clipboard")]
clipboard_manager: clipboard_manager.clone(),
#[cfg(all(desktop, feature = "system-tray"))]
system_tray_manager: system_tray_manager.clone(),
#[cfg(feature = "tracing")]
active_tracing_spans: active_tracing_spans.clone(),
},
&web_context,
);
@@ -2242,24 +2348,22 @@ impl<T: UserEvent> Runtime<T> for Wry<T> {
pub struct EventLoopIterationContext<'a, T: UserEvent> {
pub callback: &'a mut (dyn FnMut(RunEvent<T>) + 'static),
pub webview_id_map: WebviewIdStore,
pub windows: Arc<RefCell<HashMap<WebviewId, WindowWrapper>>>,
pub windows: Arc<WindowsStore>,
#[cfg(all(desktop, feature = "global-shortcut"))]
pub global_shortcut_manager: Arc<Mutex<WryShortcutManager>>,
pub global_shortcut_manager: Rc<Mutex<WryShortcutManager>>,
#[cfg(all(desktop, feature = "global-shortcut"))]
pub global_shortcut_manager_handle: &'a GlobalShortcutManagerHandle<T>,
#[cfg(feature = "clipboard")]
pub clipboard_manager: Arc<Mutex<Clipboard>>,
#[cfg(all(desktop, feature = "system-tray"))]
pub system_tray_manager: SystemTrayManager,
#[cfg(feature = "tracing")]
pub active_tracing_spans: ActiveTraceSpanStore,
}
struct UserMessageContext {
windows: Arc<RefCell<HashMap<WebviewId, WindowWrapper>>>,
windows: Arc<WindowsStore>,
webview_id_map: WebviewIdStore,
#[cfg(all(desktop, feature = "global-shortcut"))]
global_shortcut_manager: Arc<Mutex<WryShortcutManager>>,
#[cfg(feature = "clipboard")]
clipboard_manager: Arc<Mutex<Clipboard>>,
global_shortcut_manager: Rc<Mutex<WryShortcutManager>>,
#[cfg(all(desktop, feature = "system-tray"))]
system_tray_manager: SystemTrayManager,
}
@@ -2274,8 +2378,6 @@ fn handle_user_message<T: UserEvent>(
webview_id_map,
#[cfg(all(desktop, feature = "global-shortcut"))]
global_shortcut_manager,
#[cfg(feature = "clipboard")]
clipboard_manager,
windows,
#[cfg(all(desktop, feature = "system-tray"))]
system_tray_manager,
@@ -2293,7 +2395,12 @@ fn handle_user_message<T: UserEvent>(
},
Message::Window(id, window_message) => {
if let WindowMessage::UpdateMenuItem(item_id, update) = window_message {
if let Some(menu_items) = windows.borrow_mut().get_mut(&id).map(|w| &mut w.menu_items) {
if let Some(menu_items) = windows
.0
.borrow_mut()
.get_mut(&id)
.map(|w| &mut w.menu_items)
{
if let Some(menu_items) = menu_items.as_mut() {
let item = menu_items.get_mut(&item_id).expect("menu item not found");
match update {
@@ -2308,7 +2415,7 @@ fn handle_user_message<T: UserEvent>(
}
}
} else {
let w = windows.borrow().get(&id).map(|w| {
let w = windows.0.borrow().get(&id).map(|w| {
(
w.inner.clone(),
w.window_event_listeners.clone(),
@@ -2410,8 +2517,12 @@ fn handle_user_message<T: UserEvent>(
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::IsFocused(tx) => tx.send(window.is_focused()).unwrap(),
WindowMessage::IsDecorated(tx) => tx.send(window.is_decorated()).unwrap(),
WindowMessage::IsResizable(tx) => tx.send(window.is_resizable()).unwrap(),
WindowMessage::IsMaximizable(tx) => tx.send(window.is_maximizable()).unwrap(),
WindowMessage::IsMinimizable(tx) => tx.send(window.is_minimizable()).unwrap(),
WindowMessage::IsClosable(tx) => tx.send(window.is_closable()).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(),
@@ -2444,6 +2555,9 @@ fn handle_user_message<T: UserEvent>(
window.request_user_attention(request_type.map(|r| r.0));
}
WindowMessage::SetResizable(resizable) => window.set_resizable(resizable),
WindowMessage::SetMaximizable(maximizable) => window.set_maximizable(maximizable),
WindowMessage::SetMinimizable(minimizable) => window.set_minimizable(minimizable),
WindowMessage::SetClosable(closable) => window.set_closable(closable),
WindowMessage::SetTitle(title) => window.set_title(&title),
WindowMessage::Maximize => window.set_maximized(true),
WindowMessage::Unmaximize => window.set_maximized(false),
@@ -2520,9 +2634,22 @@ fn handle_user_message<T: UserEvent>(
}
}
Message::Webview(id, webview_message) => match webview_message {
#[cfg(feature = "tracing")]
WebviewMessage::EvaluateScript(script, tx, span) => {
let _span = span.entered();
if let Some(WindowHandle::Webview { inner: webview, .. }) =
windows.0.borrow().get(&id).and_then(|w| w.inner.as_ref())
{
if let Err(e) = webview.evaluate_script(&script) {
debug_eprintln!("{}", e);
}
}
tx.send(()).unwrap();
}
#[cfg(not(feature = "tracing"))]
WebviewMessage::EvaluateScript(script) => {
if let Some(WindowHandle::Webview { inner: webview, .. }) =
windows.borrow().get(&id).and_then(|w| w.inner.as_ref())
windows.0.borrow().get(&id).and_then(|w| w.inner.as_ref())
{
if let Err(e) = webview.evaluate_script(&script) {
debug_eprintln!("{}", e);
@@ -2531,7 +2658,7 @@ fn handle_user_message<T: UserEvent>(
}
WebviewMessage::Print => {
if let Some(WindowHandle::Webview { inner: webview, .. }) =
windows.borrow().get(&id).and_then(|w| w.inner.as_ref())
windows.0.borrow().get(&id).and_then(|w| w.inner.as_ref())
{
let _ = webview.print();
}
@@ -2540,7 +2667,7 @@ fn handle_user_message<T: UserEvent>(
},
Message::CreateWebview(window_id, handler) => match handler(event_loop, web_context) {
Ok(webview) => {
windows.borrow_mut().insert(window_id, webview);
windows.0.borrow_mut().insert(window_id, webview);
}
Err(e) => {
debug_eprintln!("{}", e);
@@ -2553,7 +2680,7 @@ fn handle_user_message<T: UserEvent>(
let w = Arc::new(window);
windows.borrow_mut().insert(
windows.0.borrow_mut().insert(
window_id,
WindowWrapper {
label,
@@ -2576,16 +2703,16 @@ fn handle_user_message<T: UserEvent>(
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));
listeners.push(Rc::new(l));
}
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)),
items: Arc::new(Mutex::new(items)),
tray: Rc::new(RefCell::new(Some(tray))),
listeners: Rc::new(RefCell::new(listeners)),
items: Rc::new(RefCell::new(items)),
},
);
@@ -2599,7 +2726,7 @@ fn handle_user_message<T: UserEvent>(
} else if let Some(tray_context) = trays.get(&tray_id) {
match tray_message {
TrayMessage::UpdateItem(menu_id, update) => {
let mut tray = tray_context.items.as_ref().lock().unwrap();
let mut tray = tray_context.items.as_ref().borrow_mut();
let item = tray.get_mut(&menu_id).expect("menu item not found");
match update {
MenuUpdate::SetEnabled(enabled) => item.set_enabled(enabled),
@@ -2612,14 +2739,14 @@ fn handle_user_message<T: UserEvent>(
}
}
TrayMessage::UpdateMenu(menu) => {
if let Some(tray) = &mut *tray_context.tray.lock().unwrap() {
if let Some(tray) = &mut *tray_context.tray.borrow_mut() {
let mut items = HashMap::new();
tray.set_menu(&to_wry_context_menu(&mut items, menu));
*tray_context.items.lock().unwrap() = items;
*tray_context.items.borrow_mut() = items;
}
}
TrayMessage::UpdateIcon(icon) => {
if let Some(tray) = &mut *tray_context.tray.lock().unwrap() {
if let Some(tray) = &mut *tray_context.tray.borrow_mut() {
if let Ok(icon) = TrayIcon::try_from(icon) {
tray.set_icon(icon.0);
}
@@ -2627,18 +2754,18 @@ fn handle_user_message<T: UserEvent>(
}
#[cfg(target_os = "macos")]
TrayMessage::UpdateIconAsTemplate(is_template) => {
if let Some(tray) = &mut *tray_context.tray.lock().unwrap() {
if let Some(tray) = &mut *tray_context.tray.borrow_mut() {
tray.set_icon_as_template(is_template);
}
}
#[cfg(target_os = "macos")]
TrayMessage::UpdateTitle(title) => {
if let Some(tray) = &mut *tray_context.tray.lock().unwrap() {
if let Some(tray) = &mut *tray_context.tray.borrow_mut() {
tray.set_title(&title);
}
}
TrayMessage::UpdateTooltip(tooltip) => {
if let Some(tray) = &mut *tray_context.tray.lock().unwrap() {
if let Some(tray) = &mut *tray_context.tray.borrow_mut() {
tray.set_tooltip(&tooltip);
}
}
@@ -2646,9 +2773,9 @@ fn handle_user_message<T: UserEvent>(
// already handled
}
TrayMessage::Destroy(tx) => {
*tray_context.tray.lock().unwrap() = None;
tray_context.listeners.lock().unwrap().clear();
tray_context.items.lock().unwrap().clear();
*tray_context.tray.borrow_mut() = None;
tray_context.listeners.borrow_mut().clear();
tray_context.items.borrow_mut().clear();
tx.send(Ok(())).unwrap();
}
}
@@ -2658,13 +2785,11 @@ fn handle_user_message<T: UserEvent>(
Message::GlobalShortcut(message) => {
handle_global_shortcut_message(message, &global_shortcut_manager)
}
#[cfg(feature = "clipboard")]
Message::Clipboard(message) => handle_clipboard_message(message, &clipboard_manager),
Message::UserEvent(_) => (),
}
let it = RunIteration {
window_count: windows.borrow().len(),
window_count: windows.0.borrow().len(),
};
it
}
@@ -2684,10 +2809,10 @@ fn handle_event_loop<T: UserEvent>(
global_shortcut_manager,
#[cfg(all(desktop, feature = "global-shortcut"))]
global_shortcut_manager_handle,
#[cfg(feature = "clipboard")]
clipboard_manager,
#[cfg(all(desktop, feature = "system-tray"))]
system_tray_manager,
#[cfg(feature = "tracing")]
active_tracing_spans,
} = context;
if *control_flow != ControlFlow::Exit {
*control_flow = ControlFlow::Wait;
@@ -2710,6 +2835,11 @@ fn handle_event_loop<T: UserEvent>(
callback(RunEvent::Exit);
}
#[cfg(feature = "tracing")]
Event::RedrawEventsCleared => {
active_tracing_spans.remove_window_draw();
}
#[cfg(all(desktop, feature = "global-shortcut"))]
Event::GlobalShortcutEvent(accelerator_id) => {
for (id, handler) in &*global_shortcut_manager_handle.listeners.lock().unwrap() {
@@ -2747,6 +2877,7 @@ fn handle_event_loop<T: UserEvent>(
*webview_id_map.0.lock().unwrap().values().next().unwrap()
};
windows
.0
.borrow()
.get(&window_id)
.unwrap()
@@ -2774,11 +2905,11 @@ fn handle_event_loop<T: UserEvent>(
let (mut listeners, mut tray_id) = (None, 0);
for (id, tray_context) in trays_iter {
let has_menu = {
let items = tray_context.items.lock().unwrap();
let items = tray_context.items.borrow();
items.contains_key(&menu_id.0)
};
if has_menu {
listeners.replace(tray_context.listeners.lock().unwrap().clone());
listeners.replace(tray_context.listeners.borrow().clone());
tray_id = *id;
break;
}
@@ -2817,7 +2948,7 @@ fn handle_event_loop<T: UserEvent>(
};
let trays = system_tray_manager.trays.lock().unwrap();
if let Some(tray_context) = trays.get(&id.0) {
let listeners = tray_context.listeners.lock().unwrap();
let listeners = tray_context.listeners.borrow();
let iter = listeners.iter();
for handler in iter {
handler(&event);
@@ -2832,7 +2963,7 @@ fn handle_event_loop<T: UserEvent>(
}
Event::UserEvent(Message::Webview(id, WebviewMessage::WebviewEvent(event))) => {
if let Some(event) = WindowEventWrapper::from(&event).0 {
let windows = windows.borrow();
let windows = windows.0.borrow();
let window = windows.get(&id);
if let Some(window) = window {
callback(RunEvent::WindowEvent {
@@ -2853,7 +2984,7 @@ fn handle_event_loop<T: UserEvent>(
} => {
if let Some(window_id) = webview_id_map.get(&window_id) {
{
let windows_ref = windows.borrow();
let windows_ref = windows.0.borrow();
if let Some(window) = windows_ref.get(&window_id) {
if let Some(event) = WindowEventWrapper::parse(&window.inner, &event).0 {
let label = window.label.clone();
@@ -2877,7 +3008,7 @@ 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(window) = windows.0.borrow().get(&window_id) {
if let Some(WindowHandle::Webview { inner, .. }) = &window.inner {
let theme = match theme {
WryTheme::Dark => wry::webview::Theme::Dark,
@@ -2892,9 +3023,9 @@ fn handle_event_loop<T: UserEvent>(
on_close_requested(callback, window_id, windows.clone());
}
WryWindowEvent::Destroyed => {
let removed = windows.borrow_mut().remove(&window_id).is_some();
let removed = windows.0.borrow_mut().remove(&window_id).is_some();
if removed {
let is_empty = windows.borrow().is_empty();
let is_empty = windows.0.borrow().is_empty();
if is_empty {
let (tx, rx) = channel();
callback(RunEvent::ExitRequested { tx });
@@ -2925,8 +3056,6 @@ fn handle_event_loop<T: UserEvent>(
webview_id_map,
#[cfg(all(desktop, feature = "global-shortcut"))]
global_shortcut_manager,
#[cfg(feature = "clipboard")]
clipboard_manager,
windows,
#[cfg(all(desktop, feature = "system-tray"))]
system_tray_manager,
@@ -2939,7 +3068,7 @@ fn handle_event_loop<T: UserEvent>(
}
let it = RunIteration {
window_count: windows.borrow().len(),
window_count: windows.0.borrow().len(),
};
it
}
@@ -2947,10 +3076,10 @@ fn handle_event_loop<T: UserEvent>(
fn on_close_requested<'a, T: UserEvent>(
callback: &'a mut (dyn FnMut(RunEvent<T>) + 'static),
window_id: WebviewId,
windows: Arc<RefCell<HashMap<WebviewId, WindowWrapper>>>,
windows: Arc<WindowsStore>,
) {
let (tx, rx) = channel();
let windows_ref = windows.borrow();
let windows_ref = windows.0.borrow();
if let Some(w) = windows_ref.get(&window_id) {
let label = w.label.clone();
let window_event_listeners = w.window_event_listeners.clone();
@@ -2975,8 +3104,8 @@ fn on_close_requested<'a, T: UserEvent>(
}
}
fn on_window_close(window_id: WebviewId, windows: Arc<RefCell<HashMap<WebviewId, WindowWrapper>>>) {
if let Some(mut window_wrapper) = windows.borrow_mut().get_mut(&window_id) {
fn on_window_close(window_id: WebviewId, windows: Arc<WindowsStore>) {
if let Some(window_wrapper) = windows.0.borrow_mut().get_mut(&window_id) {
window_wrapper.inner = None;
}
}
@@ -3044,7 +3173,7 @@ fn create_webview<T: UserEvent>(
mut window_builder,
ipc_handler,
label,
current_url,
url,
menu_ids,
js_event_listeners,
..
@@ -3053,6 +3182,14 @@ fn create_webview<T: UserEvent>(
#[cfg(windows)]
let proxy = context.proxy.clone();
#[cfg(feature = "tracing")]
let _webview_create_span = tracing::debug_span!("wry::webview::create").entered();
#[cfg(feature = "tracing")]
let window_draw_span = tracing::debug_span!("wry::window::draw").entered();
#[cfg(feature = "tracing")]
let window_create_span =
tracing::debug_span!(parent: &window_draw_span, "wry::window::create").entered();
let window_event_listeners = WindowEventListeners::default();
#[cfg(windows)]
@@ -3084,8 +3221,24 @@ fn create_webview<T: UserEvent>(
} else {
None
};
let focused = window_builder.inner.window.focused;
let window = window_builder.inner.build(event_loop).unwrap();
#[cfg(feature = "tracing")]
{
drop(window_create_span);
context
.main_thread
.active_tracing_spans
.0
.borrow_mut()
.push(ActiveTracingSpan::WindowDraw {
id: window.id(),
span: window_draw_span,
});
}
webview_id_map.insert(window.id(), window_id);
if window_builder.center {
@@ -3093,7 +3246,8 @@ fn create_webview<T: UserEvent>(
}
let mut webview_builder = WebViewBuilder::new(window)
.map_err(|e| Error::CreateWebview(Box::new(e)))?
.with_url(current_url.lock().unwrap().as_str())
.with_focused(focused)
.with_url(&url)
.unwrap() // safe to unwrap because we validate the URL beforehand
.with_transparent(is_window_transparent)
.with_accept_first_mouse(webview_attributes.accept_first_mouse);
@@ -3124,11 +3278,15 @@ fn create_webview<T: UserEvent>(
});
}
#[cfg(windows)]
{
webview_builder = webview_builder.with_https_scheme(!pending.http_scheme);
}
if let Some(handler) = ipc_handler {
webview_builder = webview_builder.with_ipc_handler(create_ipc_handler(
context,
label.clone(),
current_url,
menu_ids,
js_event_listeners,
handler,
@@ -3221,7 +3379,7 @@ fn create_webview<T: UserEvent>(
Ok(WindowWrapper {
label,
inner: Some(WindowHandle::Webview {
inner: Arc::new(webview),
inner: Rc::new(webview),
context_store: web_context_store.clone(),
context_key: if automation_enabled {
None
@@ -3239,16 +3397,14 @@ fn create_webview<T: UserEvent>(
fn create_ipc_handler<T: UserEvent>(
context: Context<T>,
label: String,
current_url: Arc<Mutex<Url>>,
menu_ids: Arc<Mutex<HashMap<MenuHash, MenuId>>>,
js_event_listeners: Arc<Mutex<HashMap<JsEventListenerKey, HashSet<u64>>>>,
js_event_listeners: Arc<Mutex<HashMap<JsEventListenerKey, HashSet<u32>>>>,
handler: WebviewIpcHandler<T, Wry<T>>,
) -> Box<IpcHandler> {
Box::new(move |window, request| {
let window_id = context.webview_id_map.get(&window.id()).unwrap();
handler(
DetachedWindow {
current_url: current_url.clone(),
dispatcher: WryDispatcher {
window_id,
context: context.clone(),

View File

@@ -3,10 +3,7 @@
// SPDX-License-Identifier: MIT
pub use tauri_runtime::{
menu::{
Menu, MenuEntry, MenuItem, MenuUpdate, Submenu, SystemTrayMenu, SystemTrayMenuEntry,
SystemTrayMenuItem, TrayHandle,
},
menu::{MenuUpdate, SystemTrayMenu, SystemTrayMenuEntry, SystemTrayMenuItem, TrayHandle},
Icon, SystemTrayEvent,
};
use wry::application::event_loop::EventLoopWindowTarget;
@@ -32,8 +29,10 @@ use crate::{send_user_message, Context, Error, Message, Result, TrayId, TrayMess
use tauri_runtime::{menu::MenuHash, SystemTray, UserEvent};
use std::{
cell::RefCell,
collections::HashMap,
fmt,
rc::Rc,
sync::{Arc, Mutex},
};
@@ -41,12 +40,12 @@ pub type GlobalSystemTrayEventHandler = Box<dyn Fn(TrayId, &SystemTrayEvent) + S
pub type GlobalSystemTrayEventListeners = Arc<Mutex<Vec<Arc<GlobalSystemTrayEventHandler>>>>;
pub type SystemTrayEventHandler = Box<dyn Fn(&SystemTrayEvent) + Send>;
pub type SystemTrayEventListeners = Arc<Mutex<Vec<Arc<SystemTrayEventHandler>>>>;
pub type SystemTrayItems = Arc<Mutex<HashMap<u16, WryCustomMenuItem>>>;
pub type SystemTrayEventListeners = Rc<RefCell<Vec<Rc<SystemTrayEventHandler>>>>;
pub type SystemTrayItems = Rc<RefCell<HashMap<u16, WryCustomMenuItem>>>;
#[derive(Clone, Default)]
pub struct TrayContext {
pub tray: Arc<Mutex<Option<WrySystemTray>>>,
pub tray: Rc<RefCell<Option<WrySystemTray>>>,
pub listeners: SystemTrayEventListeners,
pub items: SystemTrayItems,
}

View File

@@ -1,5 +1,54 @@
# Changelog
## \[0.14.4]
### Dependencies
- Upgraded to `tauri-utils@1.6.0`
## \[0.14.3]
### Dependencies
- Upgraded to `tauri-utils@1.5.4`
## \[0.14.2]
### Dependencies
- Upgraded to `tauri-utils@1.5.2`
## \[0.14.1]
### Enhancements
- [`9aa34ada`](https://www.github.com/tauri-apps/tauri/commit/9aa34ada5769dbefa7dfe5f7a6288b3d20b294e4)([#7645](https://www.github.com/tauri-apps/tauri/pull/7645)) Add setting to switch to `http://<scheme>.localhost/` for custom protocols on Windows.
### Dependencies
- Upgraded to `tauri-utils@1.5.0`
## \[0.14.0]
### New Features
- [`c4d6fb4b`](https://www.github.com/tauri-apps/tauri/commit/c4d6fb4b1ea8acf02707a9fe5dcab47c1c5bae7b)([#2353](https://www.github.com/tauri-apps/tauri/pull/2353)) Added the `maximizable`, `minimizable` and `closable` methods to `WindowBuilder`.
- [`c4d6fb4b`](https://www.github.com/tauri-apps/tauri/commit/c4d6fb4b1ea8acf02707a9fe5dcab47c1c5bae7b)([#2353](https://www.github.com/tauri-apps/tauri/pull/2353)) Added `set_maximizable`, `set_minimizable`, `set_closable`, `is_maximizable`, `is_minimizable` and `is_closable` methods to the `Dispatch` trait.
- [`000104bc`](https://www.github.com/tauri-apps/tauri/commit/000104bc3bc0c9ff3d20558ab9cf2080f126e9e0)([#6472](https://www.github.com/tauri-apps/tauri/pull/6472)) Add `Window::is_focused` getter.
### Enhancements
- [`d2710e9d`](https://www.github.com/tauri-apps/tauri/commit/d2710e9d2e8fd93975ef6494512370faa8cb3b7e)([#6944](https://www.github.com/tauri-apps/tauri/pull/6944)) Unpin `time`, `ignore`, and `winnow` crate versions. Developers now have to pin crates if needed themselves. A list of crates that need pinning to adhere to Tauri's MSRV will be visible in Tauri's GitHub workflow: https://github.com/tauri-apps/tauri/blob/dev/.github/workflows/test-core.yml#L85.
### Bug Fixes
- [`2b487c94`](https://www.github.com/tauri-apps/tauri/commit/2b487c946737352187d7e042dd6142873e62a4ca)([#7012](https://www.github.com/tauri-apps/tauri/pull/7012)) Fixes typo in `CursorIcon` deserialization of the `ZoomIn` variant.
### What's Changed
- [`076e1a81`](https://www.github.com/tauri-apps/tauri/commit/076e1a81a50468e3dfb34ae9ca7e77c5e1758daa)([#7119](https://www.github.com/tauri-apps/tauri/pull/7119)) Use `u32` instead of `u64` for js event listener ids
- [`ff5e4dbb`](https://www.github.com/tauri-apps/tauri/commit/ff5e4dbbb01bf3fc9c5143df732c75eef6fd98cb)([#6794](https://www.github.com/tauri-apps/tauri/pull/6794)) impl `From<&WindowConfig>` for `WebviewAttributes`.
## \[0.13.0]
- Added the `additional_browser_args` option when creating a window.

View File

@@ -1,6 +1,6 @@
[package]
name = "tauri-runtime"
version = "0.13.0"
version = "0.14.4"
authors = [ "Tauri Programme within The Commons Conservancy" ]
categories = [ "gui", "web-programming" ]
license = "Apache-2.0 OR MIT"
@@ -26,11 +26,11 @@ 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.6.0", 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" }

View File

@@ -6,7 +6,7 @@
[![Chat Server](https://img.shields.io/badge/chat-on%20discord-7289da.svg)](https://discord.gg/SpmNs4S)
[![devto](https://img.shields.io/badge/blog-dev.to-black.svg)](https://dev.to/tauri)
![](https://img.shields.io/github/workflow/status/tauri-apps/tauri/test%20library?label=test%20library)
[![test core](https://img.shields.io/github/actions/workflow/status/tauri-apps/tauri/test-core.yml?label=test%20core&logo=github)](https://github.com/tauri-apps/tauri/actions/workflows/test-core.yml)
[![devto](https://img.shields.io/badge/documentation-site-purple.svg)](https://tauri.app)
[![https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg](https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg)](https://good-labs.github.io/greater-good-affirmation)

View File

@@ -252,6 +252,9 @@ pub enum Error {
#[cfg(all(desktop, feature = "global-shortcut"))]
#[error(transparent)]
GlobalShortcut(Box<dyn std::error::Error + Send + Sync>),
#[cfg(all(desktop, feature = "clipboard"))]
#[error(transparent)]
Clipboard(Box<dyn std::error::Error + Send + Sync>),
#[error("Invalid header name: {0}")]
InvalidHeaderName(#[from] InvalidHeaderName),
#[error("Invalid header value: {0}")]
@@ -576,12 +579,36 @@ pub trait Dispatch<T: UserEvent>: Debug + Clone + Send + Sync + Sized + 'static
/// Gets the window's current maximized state.
fn is_maximized(&self) -> Result<bool>;
/// Gets the window's current focus state.
fn is_focused(&self) -> Result<bool>;
/// Gets the windows current decoration state.
fn is_decorated(&self) -> Result<bool>;
/// Gets the windows current resizable state.
fn is_resizable(&self) -> Result<bool>;
/// Gets the window's native maximize button state.
///
/// ## Platform-specific
///
/// - **Linux / iOS / Android:** Unsupported.
fn is_maximizable(&self) -> Result<bool>;
/// Gets the window's native minize button state.
///
/// ## Platform-specific
///
/// - **Linux / iOS / Android:** Unsupported.
fn is_minimizable(&self) -> Result<bool>;
/// Gets the window's native close button state.
///
/// ## Platform-specific
///
/// - **iOS / Android:** Unsupported.
fn is_closable(&self) -> Result<bool>;
/// Gets the window's current visibility state.
fn is_visible(&self) -> Result<bool>;
/// Gets the window's current title.
@@ -640,6 +667,30 @@ pub trait Dispatch<T: UserEvent>: Debug + Clone + Send + Sync + Sized + 'static
/// Updates the window resizable flag.
fn set_resizable(&self, resizable: bool) -> Result<()>;
/// Updates the window's native maximize button state.
///
/// ## Platform-specific
///
/// - **macOS:** Disables the "zoom" button in the window titlebar, which is also used to enter fullscreen mode.
/// - **Linux / iOS / Android:** Unsupported.
fn set_maximizable(&self, maximizable: bool) -> Result<()>;
/// Updates the window's native minimize button state.
///
/// ## Platform-specific
///
/// - **Linux / iOS / Android:** Unsupported.
fn set_minimizable(&self, minimizable: bool) -> Result<()>;
/// Updates the window's native close button state.
///
/// ## Platform-specific
///
/// - **Linux:** "GTK+ will do its best to convince the window manager not to show a close button.
/// Depending on the system, this function may not have any effect when called on a window that is already visible"
/// - **iOS / Android:** Unsupported.
fn set_closable(&self, closable: bool) -> Result<()>;
/// Updates the window title.
fn set_title<S: Into<String>>(&self, title: S) -> Result<()>;

View File

@@ -335,6 +335,12 @@ impl Menu {
}
/// Adds the custom menu item to the menu.
///
/// ## Platform-spcific:
///
/// - **macOS:** Only [`Submenu`] can be added to the menu
///
/// [`Submenu`]: crate::Submenu
#[must_use]
pub fn add_item(mut self, item: CustomMenuItem) -> Self {
self.items.push(MenuEntry::CustomItem(item));

View File

@@ -31,6 +31,23 @@ pub struct WebviewAttributes {
pub additional_browser_args: Option<String>,
}
impl From<&WindowConfig> for WebviewAttributes {
fn from(config: &WindowConfig) -> Self {
let mut builder = Self::new(config.url.clone());
builder = builder.accept_first_mouse(config.accept_first_mouse);
if !config.file_drop_enabled {
builder = builder.disable_file_drop_handler();
}
if let Some(user_agent) = &config.user_agent {
builder = builder.user_agent(user_agent);
}
if let Some(additional_browser_args) = &config.additional_browser_args {
builder = builder.additional_browser_args(additional_browser_args);
}
builder
}
}
impl WebviewAttributes {
/// Initializes the default attributes for a webview.
pub fn new(url: WindowUrl) -> Self {
@@ -140,9 +157,38 @@ pub trait WindowBuilder: WindowBuilderBase {
fn max_inner_size(self, max_width: f64, max_height: f64) -> Self;
/// Whether the window is resizable or not.
/// When resizable is set to false, native window's maximize button is automatically disabled.
#[must_use]
fn resizable(self, resizable: bool) -> Self;
/// Whether the window's native maximize button is enabled or not.
/// If resizable is set to false, this setting is ignored.
///
/// ## Platform-specific
///
/// - **macOS:** Disables the "zoom" button in the window titlebar, which is also used to enter fullscreen mode.
/// - **Linux / iOS / Android:** Unsupported.
#[must_use]
fn maximizable(self, maximizable: bool) -> Self;
/// Whether the window's native minimize button is enabled or not.
///
/// ## Platform-specific
///
/// - **Linux / iOS / Android:** Unsupported.
#[must_use]
fn minimizable(self, minimizable: bool) -> Self;
/// Whether the window's native close button is enabled or not.
///
/// ## Platform-specific
///
/// - **Linux:** "GTK+ will do its best to convince the window manager not to show a close button.
/// Depending on the system, this function may not have any effect when called on a window that is already visible"
/// - **iOS / Android:** Unsupported.
#[must_use]
fn closable(self, closable: bool) -> Self;
/// The title of the window in the title bar.
#[must_use]
fn title<S: Into<String>>(self, title: S) -> Self;

View File

@@ -24,6 +24,8 @@ use std::{
type UriSchemeProtocol =
dyn Fn(&HttpRequest) -> Result<HttpResponse, Box<dyn std::error::Error>> + Send + Sync + 'static;
type WebResourceRequestHandler = dyn Fn(&HttpRequest, &mut HttpResponse) + Send + Sync;
/// UI scaling utilities.
pub mod dpi;
@@ -182,7 +184,7 @@ impl<'de> Deserialize<'de> for CursorIcon {
"grab" => CursorIcon::Grab,
"grabbing" => CursorIcon::Grabbing,
"allscroll" => CursorIcon::AllScroll,
"zoomun" => CursorIcon::ZoomIn,
"zoomin" => CursorIcon::ZoomIn,
"zoomout" => CursorIcon::ZoomOut,
"eresize" => CursorIcon::EResize,
"nresize" => CursorIcon::NResize,
@@ -222,6 +224,9 @@ pub struct PendingWindow<T: UserEvent, R: Runtime<T>> {
pub uri_scheme_protocols: HashMap<String, Box<UriSchemeProtocol>>,
// Whether custom protocols on windows should use http://<scheme>.localhost/ instead of https://<scheme>.localhost/
pub http_scheme: bool,
/// How to handle IPC calls on the webview window.
pub ipc_handler: Option<WebviewIpcHandler<T, R>>,
@@ -229,13 +234,15 @@ pub struct PendingWindow<T: UserEvent, R: Runtime<T>> {
pub menu_ids: Arc<Mutex<HashMap<MenuHash, MenuId>>>,
/// A HashMap mapping JS event names with associated listener ids.
pub js_event_listeners: Arc<Mutex<HashMap<JsEventListenerKey, HashSet<u64>>>>,
pub js_event_listeners: Arc<Mutex<HashMap<JsEventListenerKey, HashSet<u32>>>>,
/// A handler to decide if incoming url is allowed to navigate.
pub navigation_handler: Option<Box<dyn Fn(Url) -> bool + Send>>,
/// The current webview URL.
pub current_url: Arc<Mutex<Url>>,
pub web_resource_request_handler: Option<Box<WebResourceRequestHandler>>,
/// The resolved URL to load on the webview.
pub url: String,
}
pub fn is_label_valid(label: &str) -> bool {
@@ -275,7 +282,9 @@ impl<T: UserEvent, R: Runtime<T>> PendingWindow<T, R> {
menu_ids: Arc::new(Mutex::new(menu_ids)),
js_event_listeners: Default::default(),
navigation_handler: Default::default(),
current_url: Arc::new(Mutex::new("tauri://localhost".parse().unwrap())),
web_resource_request_handler: Default::default(),
url: "tauri://localhost".to_string(),
http_scheme: false,
})
}
}
@@ -305,7 +314,9 @@ impl<T: UserEvent, R: Runtime<T>> PendingWindow<T, R> {
menu_ids: Arc::new(Mutex::new(menu_ids)),
js_event_listeners: Default::default(),
navigation_handler: Default::default(),
current_url: Arc::new(Mutex::new("tauri://localhost".parse().unwrap())),
web_resource_request_handler: Default::default(),
url: "tauri://localhost".to_string(),
http_scheme: false,
})
}
}
@@ -346,9 +357,6 @@ pub struct JsEventListenerKey {
/// A webview window that is not yet managed by Tauri.
#[derive(Debug)]
pub struct DetachedWindow<T: UserEvent, R: Runtime<T>> {
/// The current webview URL.
pub current_url: Arc<Mutex<Url>>,
/// Name of the window
pub label: String,
@@ -359,13 +367,12 @@ pub struct DetachedWindow<T: UserEvent, R: Runtime<T>> {
pub menu_ids: Arc<Mutex<HashMap<MenuHash, MenuId>>>,
/// A HashMap mapping JS event names with associated listener ids.
pub js_event_listeners: Arc<Mutex<HashMap<JsEventListenerKey, HashSet<u64>>>>,
pub js_event_listeners: Arc<Mutex<HashMap<JsEventListenerKey, HashSet<u32>>>>,
}
impl<T: UserEvent, R: Runtime<T>> Clone for DetachedWindow<T, R> {
fn clone(&self) -> Self {
Self {
current_url: self.current_url.clone(),
label: self.label.clone(),
dispatcher: self.dispatcher.clone(),
menu_ids: self.menu_ids.clone(),

View File

@@ -1,5 +1,69 @@
# Changelog
## \[1.6.0]
### New Features
- [`253595a22`](https://www.github.com/tauri-apps/tauri/commit/253595a22d8659a1cb199bfc423e988ea82191e6) ([#9809](https://www.github.com/tauri-apps/tauri/pull/9809)) Add RPM packaging
- [`78fc84137`](https://www.github.com/tauri-apps/tauri/commit/78fc841370a76adf7af413bf1c9490b046b50de4) ([#9942](https://www.github.com/tauri-apps/tauri/pull/9942)) Added support for `provides`, `conflicts` and `replaces` (`obsoletes` for RPM) options for `bundler > deb` and `bundler > rpm` configs.
- [`590966276`](https://www.github.com/tauri-apps/tauri/commit/5909662766c2fe9947a9eadf33725170c2f6fa99) ([#9902](https://www.github.com/tauri-apps/tauri/pull/9902)) Add `sign_command` in `WindowsConfig`
- [`a301be52d`](https://www.github.com/tauri-apps/tauri/commit/a301be52d276f1e99316d23b4f0a8e458e29bc35) ([#9914](https://www.github.com/tauri-apps/tauri/pull/9914)) Add `use_local_tools_dir` option.
## \[1.5.4]
### Bug Fixes
- [`5ee5ed4dc`](https://www.github.com/tauri-apps/tauri/commit/5ee5ed4dc668aa8b60741b57ffe616a5a7aefd88)([#9680](https://www.github.com/tauri-apps/tauri/pull/9680)) Fixes `schemars` compilation issue.
## \[1.5.3]
### New features
- [`7aa30dec`](https://www.github.com/tauri-apps/tauri/commit/7aa30dec85a17c3d3faaf3841b93e10991b991b0)([#8620](https://www.github.com/tauri-apps/tauri/pull/8620)) Add `priority`, `section` and `changelog` options in Debian config.
## \[1.5.2]
### Bug Fixes
- [`9b230de7`](https://www.github.com/tauri-apps/tauri/commit/9b230de7bc6690c2733f5324d50b999af1f7a6ef)([#8407](https://www.github.com/tauri-apps/tauri/pull/8407)) Fix compile error when parsing config that includes float values.
## \[1.5.3]
### New Features
- [`b3e53e72`](https://www.github.com/tauri-apps/tauri/commit/b3e53e7243311a2659b7569dddc20c56ac9f9d8e)([#8288](https://www.github.com/tauri-apps/tauri/pull/8288)) Added `Assets::iter` to iterate on all embedded assets.
## \[1.5.0]
### New Features
- [`4dd4893d`](https://www.github.com/tauri-apps/tauri/commit/4dd4893d7d166ac3a3b6dc2e3bd2540326352a78)([#5950](https://www.github.com/tauri-apps/tauri/pull/5950)) Allow specifying resources as a map specifying source and target paths.
### Enhancements
- [`9aa34ada`](https://www.github.com/tauri-apps/tauri/commit/9aa34ada5769dbefa7dfe5f7a6288b3d20b294e4)([#7645](https://www.github.com/tauri-apps/tauri/pull/7645)) Add setting to switch to `http://<scheme>.localhost/` for custom protocols on Windows.
### Bug Fixes
- [`a6b52e44`](https://www.github.com/tauri-apps/tauri/commit/a6b52e44f22844009e273fb0250368d7a463f095)([#6519](https://www.github.com/tauri-apps/tauri/pull/6519)) Fix `io::read_line` not including the new line character `\n`.
### Security fixes
- [`eeff1784`](https://www.github.com/tauri-apps/tauri/commit/eeff1784e1ffa568e4ba024e17dd611f8e086784)([#7367](https://www.github.com/tauri-apps/tauri/pull/7367)) Changed HTML implementation from unmaintained `kuchiki` to `kuchikiki`.
## \[1.4.0]
### New Features
- [`acc36fe1`](https://www.github.com/tauri-apps/tauri/commit/acc36fe1176cc8aa9063bde932abeb94796c5c72)([#6158](https://www.github.com/tauri-apps/tauri/pull/6158)) Add option to configure `require_literal_leading_dot` on `fs` and `asset` protcol scopes.
- [`35cd751a`](https://www.github.com/tauri-apps/tauri/commit/35cd751adc6fef1f792696fa0cfb471b0bf99374)([#5176](https://www.github.com/tauri-apps/tauri/pull/5176)) Added the `desktop_template` option on `tauri.conf.json > tauri > bundle > deb`.
- [`c4d6fb4b`](https://www.github.com/tauri-apps/tauri/commit/c4d6fb4b1ea8acf02707a9fe5dcab47c1c5bae7b)([#2353](https://www.github.com/tauri-apps/tauri/pull/2353)) Added the `maximizable`, `minimizable` and `closable` options to the window configuration.
- [`3cb7a3e6`](https://www.github.com/tauri-apps/tauri/commit/3cb7a3e642bb10ee90dc1d24daa48b8c8c15c9ce)([#6997](https://www.github.com/tauri-apps/tauri/pull/6997)) Add `MimeType::parse_with_fallback` and `MimeType::parse_from_uri_with_fallback`
- [`29488205`](https://www.github.com/tauri-apps/tauri/commit/2948820579d20dfaa0861c2f0a58bd7737a7ffd1)([#6867](https://www.github.com/tauri-apps/tauri/pull/6867)) Allow specifying custom language files of Tauri's custom messages for the NSIS installer
- [`e092f799`](https://www.github.com/tauri-apps/tauri/commit/e092f799469ff32c7d1595d0f07d06fd2dab5c29)([#6887](https://www.github.com/tauri-apps/tauri/pull/6887)) Add `nsis > template` option to specify custom NSIS installer template.
- [`cd3846c8`](https://www.github.com/tauri-apps/tauri/commit/cd3846c8ce61ab2879b3911e831525e6242aaab2)([#6955](https://www.github.com/tauri-apps/tauri/pull/6955)) Add `WindowsUpdateInstallMode::nsis_args`
- [`85e77fb7`](https://www.github.com/tauri-apps/tauri/commit/85e77fb797ec17882f55d0944578d929fc6c9c1f)([#6762](https://www.github.com/tauri-apps/tauri/pull/6762)) Correctly determine MIME type of `.txt` files.
## \[1.3.0]
- Added the `additional_browser_args` option to the window configuration.

View File

@@ -1,6 +1,6 @@
[package]
name = "tauri-utils"
version = "1.3.0"
version = "1.6.0"
authors = [ "Tauri Programme within The Commons Conservancy" ]
license = "Apache-2.0 OR MIT"
homepage = "https://tauri.app"
@@ -15,40 +15,35 @@ readme = "README.md"
serde = { version = "1", features = [ "derive" ] }
serde_json = "1"
thiserror = "1"
phf = { version = "0.10", features = [ "macros" ] }
phf = { version = "0.11", features = [ "macros" ] }
brotli = { version = "3", optional = true, default-features = false, features = [ "std" ] }
url = { version = "2", features = [ "serde" ] }
kuchiki = "0.8"
html5ever = "0.25"
html5ever = "0.26"
kuchiki = { package = "kuchikiki", version = "0.8" }
proc-macro2 = { version = "1", optional = true }
quote = { version = "1", optional = true }
schemars = { version = "0.8", features = [ "url" ], optional = true }
serde_with = "2"
schemars = { version = "0.8.18", features = [ "url" ], optional = true }
serde_with = "3"
aes-gcm = { version = "0.10", optional = true }
getrandom = { version = "0.2", optional = true, features = [ "std" ] }
serialize-to-javascript = { version = "=0.1.1", optional = true }
ctor = "0.1"
ctor = "0.2"
json5 = { version = "0.4", optional = true }
toml = { version = "0.5", optional = true }
json-patch = "1.0"
toml = { version = "0.7", optional = true }
json-patch = "1.2"
glob = { version = "0.3", optional = true }
walkdir = { version = "2", optional = true }
memchr = "2"
semver = "1"
infer = "0.12"
infer = "0.13"
dunce = "1"
log = "0.4.20"
[target."cfg(target_os = \"linux\")".dependencies]
heck = "0.4"
heck = "0.5"
[target."cfg(windows)".dependencies.windows]
version = "0.39.0"
features = [
"implement",
"Win32_Foundation",
"Win32_System_Com",
"Win32_System_LibraryLoader",
"Win32_System_SystemInformation"
]
[target."cfg(windows)".dependencies]
windows-version = "0.1"
[features]
build = [ "proc-macro2", "quote" ]

View File

@@ -4,7 +4,7 @@
[![status](https://img.shields.io/badge/status-stable-blue.svg)](https://github.com/tauri-apps/tauri/tree/dev)
[![License](https://img.shields.io/badge/License-MIT%20or%20Apache%202-green.svg)](https://opencollective.com/tauri)
[![test library](https://img.shields.io/github/workflow/status/tauri-apps/tauri/test%20library?label=test%20library)](https://github.com/tauri-apps/tauri/actions?query=workflow%3A%22test+library%22)
[![test core](https://img.shields.io/github/actions/workflow/status/tauri-apps/tauri/test-core.yml?label=test%20core&logo=github)](https://github.com/tauri-apps/tauri/actions/workflows/test-core.yml)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Ftauri-apps%2Ftauri.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Ftauri-apps%2Ftauri?ref=badge_shield)
[![Chat Server](https://img.shields.io/badge/chat-discord-7289da.svg)](https://discord.gg/SpmNs4S)
[![website](https://img.shields.io/badge/website-tauri.app-purple.svg)](https://tauri.app)

View File

@@ -109,6 +109,9 @@ pub trait Assets: Send + Sync + 'static {
/// Get the content of the passed [`AssetKey`].
fn get(&self, key: &AssetKey) -> Option<Cow<'_, [u8]>>;
/// Iterator for the assets.
fn iter(&self) -> Box<dyn Iterator<Item = (&&str, &&[u8])> + '_>;
/// Gets the hashes for the CSP tag of the HTML on the given path.
fn csp_hashes(&self, html_path: &AssetKey) -> Box<dyn Iterator<Item = CspHash<'_>> + '_>;
}
@@ -163,6 +166,10 @@ impl Assets for EmbeddedAssets {
.map(|a| Cow::Owned(a.to_vec()))
}
fn iter(&self) -> Box<dyn Iterator<Item = (&&str, &&[u8])> + '_> {
Box::new(self.assets.into_iter())
}
fn csp_hashes(&self, html_path: &AssetKey) -> Box<dyn Iterator<Item = CspHash<'_>> + '_> {
Box::new(
self

View File

@@ -38,6 +38,10 @@ use crate::TitleBarStyle;
pub use self::parse::parse;
fn default_true() -> bool {
true
}
/// An URL to open on a Tauri webview window.
#[derive(PartialEq, Eq, Debug, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
@@ -74,6 +78,8 @@ impl Default for WindowUrl {
pub enum BundleType {
/// The debian bundle (.deb).
Deb,
/// The RPM bundle (.rpm).
Rpm,
/// The AppImage bundle (.appimage).
AppImage,
/// The Microsoft Installer bundle (.msi).
@@ -95,6 +101,7 @@ impl Display for BundleType {
"{}",
match self {
Self::Deb => "deb",
Self::Rpm => "rpm",
Self::AppImage => "appimage",
Self::Msi => "msi",
Self::Nsis => "nsis",
@@ -123,6 +130,7 @@ impl<'de> Deserialize<'de> for BundleType {
let s = String::deserialize(deserializer)?;
match s.to_lowercase().as_str() {
"deb" => Ok(Self::Deb),
"rpm" => Ok(Self::Rpm),
"appimage" => Ok(Self::AppImage),
"msi" => Ok(Self::Msi),
"nsis" => Ok(Self::Nsis),
@@ -162,19 +170,13 @@ impl schemars::JsonSchema for BundleTarget {
..Default::default()
}
.into(),
schemars::_private::apply_metadata(
schemars::_private::metadata::add_description(
gen.subschema_for::<Vec<BundleType>>(),
schemars::schema::Metadata {
description: Some("A list of bundle targets.".to_owned()),
..Default::default()
},
"A list of bundle targets.",
),
schemars::_private::apply_metadata(
schemars::_private::metadata::add_description(
gen.subschema_for::<BundleType>(),
schemars::schema::Metadata {
description: Some("A single bundle target.".to_owned()),
..Default::default()
},
"A single bundle target.",
),
];
@@ -269,9 +271,156 @@ pub struct AppImageConfig {
pub struct DebConfig {
/// The list of deb dependencies your application relies on.
pub depends: Option<Vec<String>>,
/// The list of dependencies the package provides.
pub provides: Option<Vec<String>>,
/// The list of package conflicts.
pub conflicts: Option<Vec<String>>,
/// The list of package replaces.
pub replaces: Option<Vec<String>>,
/// The files to include on the package.
#[serde(default)]
pub files: HashMap<PathBuf, PathBuf>,
/// Path to a custom desktop file Handlebars template.
///
/// Available variables: `categories`, `comment` (optional), `exec`, `icon` and `name`.
pub desktop_template: Option<PathBuf>,
/// Define the section in Debian Control file. See : https://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections
pub section: Option<String>,
/// Change the priority of the Debian Package. By default, it is set to `optional`.
/// Recognized Priorities as of now are : `required`, `important`, `standard`, `optional`, `extra`
pub priority: Option<String>,
/// Path of the uncompressed Changelog file, to be stored at /usr/share/doc/package-name/changelog.gz. See
/// https://www.debian.org/doc/debian-policy/ch-docs.html#changelog-files-and-release-notes
pub changelog: Option<PathBuf>,
}
/// Configuration for RPM bundles.
#[skip_serializing_none]
#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct RpmConfig {
/// The package's license identifier. If not set, defaults to the license from
/// the Cargo.toml file.
pub license: Option<String>,
/// The list of RPM dependencies your application relies on.
pub depends: Option<Vec<String>>,
/// The list of RPM dependencies your application provides.
pub provides: Option<Vec<String>>,
/// The list of RPM dependencies your application conflicts with. They must not be present
/// in order for the package to be installed.
pub conflicts: Option<Vec<String>>,
/// The list of RPM dependencies your application supersedes - if this package is installed,
/// packages listed as “obsoletes” will be automatically removed (if they are present).
pub obsoletes: Option<Vec<String>>,
/// The RPM release tag.
#[serde(default = "default_release")]
pub release: String,
/// The RPM epoch.
#[serde(default)]
pub epoch: u32,
/// The files to include on the package.
#[serde(default)]
pub files: HashMap<PathBuf, PathBuf>,
/// Path to a custom desktop file Handlebars template.
///
/// Available variables: `categories`, `comment` (optional), `exec`, `icon` and `name`.
pub desktop_template: Option<PathBuf>,
}
impl Default for RpmConfig {
fn default() -> Self {
Self {
license: None,
depends: None,
provides: None,
conflicts: None,
obsoletes: None,
release: default_release(),
epoch: 0,
files: Default::default(),
desktop_template: None,
}
}
}
fn default_release() -> String {
"1".into()
}
/// Position coordinates struct.
#[derive(Default, Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct Position {
/// X coordinate.
pub x: u32,
/// Y coordinate.
pub y: u32,
}
/// Size of the window.
#[derive(Default, Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct Size {
/// Width of the window.
pub width: u32,
/// Height of the window.
pub height: u32,
}
/// Configuration for Apple Disk Image (.dmg) bundles.
///
/// See more: https://tauri.app/v1/api/config#dmgconfig
#[skip_serializing_none]
#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct DmgConfig {
/// Image to use as the background in dmg file. Accepted formats: `png`/`jpg`/`gif`.
pub background: Option<PathBuf>,
/// Position of volume window on screen.
pub window_position: Option<Position>,
/// Size of volume window.
#[serde(default = "dmg_window_size", alias = "window-size")]
pub window_size: Size,
/// Position of app file on window.
#[serde(default = "dmg_app_position", alias = "app-position")]
pub app_position: Position,
/// Position of application folder on window.
#[serde(
default = "dmg_application_folder_position",
alias = "application-folder-position"
)]
pub application_folder_position: Position,
}
impl Default for DmgConfig {
fn default() -> Self {
Self {
background: None,
window_position: None,
window_size: dmg_window_size(),
app_position: dmg_app_position(),
application_folder_position: dmg_application_folder_position(),
}
}
}
fn dmg_window_size() -> Size {
Size {
width: 660,
height: 400,
}
}
fn dmg_app_position() -> Position {
Position { x: 180, y: 170 }
}
fn dmg_application_folder_position() -> Position {
Position { x: 480, y: 170 }
}
fn de_minimum_system_version<'de, D>(deserializer: D) -> Result<Option<String>, D::Error>
@@ -430,11 +579,28 @@ pub struct WixConfig {
pub dialog_image_path: Option<PathBuf>,
}
/// Compression algorithms used in the NSIS installer.
///
/// See <https://nsis.sourceforge.io/Reference/SetCompressor>
#[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub enum NsisCompression {
/// ZLIB uses the deflate algorithm, it is a quick and simple method. With the default compression level it uses about 300 KB of memory.
Zlib,
/// BZIP2 usually gives better compression ratios than ZLIB, but it is a bit slower and uses more memory. With the default compression level it uses about 4 MB of memory.
Bzip2,
/// LZMA (default) is a new compression method that gives very good compression ratios. The decompression speed is high (10-20 MB/s on a 2 GHz CPU), the compression speed is lower. The memory size that will be used for decompression is the dictionary size plus a few KBs, the default is 8 MB.
Lzma,
}
/// 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 {
/// A custom .nsi template to use.
pub template: Option<PathBuf>,
/// 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.
@@ -459,10 +625,21 @@ pub struct NsisConfig {
///
/// See <https://github.com/kichik/nsis/tree/9465c08046f00ccb6eda985abbdbf52c275c6c4d/Contrib/Language%20files> for the complete list of languages.
pub languages: Option<Vec<String>>,
/// A key-value pair where the key is the language and the
/// value is the path to a custom `.nsh` file that holds the translated text for tauri's custom messages.
///
/// See <https://github.com/tauri-apps/tauri/blob/dev/tooling/bundler/src/bundle/windows/templates/nsis-languages/English.nsh> for an example `.nsh` file.
///
/// **Note**: the key must be a valid NSIS language and it must be added to [`NsisConfig`] languages array,
pub custom_language_files: Option<HashMap<String, PathBuf>>,
/// 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,
/// Set the compression algorithm used to compress files in the installer.
///
/// See <https://nsis.sourceforge.io/Reference/SetCompressor>
pub compression: Option<NsisCompression>,
}
/// Install Modes for the NSIS installer.
@@ -510,7 +687,7 @@ pub enum WebviewInstallMode {
/// 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`.
#[serde(default = "default_webview_install_silent")]
#[serde(default = "default_true")]
silent: bool,
},
/// Embed the bootstrapper and run it.
@@ -518,7 +695,7 @@ pub enum WebviewInstallMode {
/// 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`.
#[serde(default = "default_webview_install_silent")]
#[serde(default = "default_true")]
silent: bool,
},
/// Embed the offline installer and run it.
@@ -526,7 +703,7 @@ pub enum WebviewInstallMode {
/// Increases the installer size by around 127MB.
OfflineInstaller {
/// Instructs the installer to run the installer in silent mode. Defaults to `true`.
#[serde(default = "default_webview_install_silent")]
#[serde(default = "default_true")]
silent: bool,
},
/// Embed a fixed webview2 version and use it at runtime.
@@ -540,15 +717,9 @@ pub enum WebviewInstallMode {
},
}
fn default_webview_install_silent() -> bool {
true
}
impl Default for WebviewInstallMode {
fn default() -> Self {
Self::DownloadBootstrapper {
silent: default_webview_install_silent(),
}
Self::DownloadBootstrapper { silent: true }
}
}
@@ -589,12 +760,26 @@ pub struct WindowsConfig {
/// For instance, if `1.2.1` is installed, the user won't be able to install app version `1.2.0` or `1.1.5`.
///
/// The default value of this flag is `true`.
#[serde(default = "default_allow_downgrades", alias = "allow-downgrades")]
#[serde(default = "default_true", alias = "allow-downgrades")]
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>,
/// Specify a custom command to sign the binaries.
/// This command needs to have a `%1` in it which is just a placeholder for the binary path,
/// which we will detect and replace before calling the command.
///
/// Example:
/// ```text
/// sign-cli --arg1 --arg2 %1
/// ```
///
/// By Default we use `signtool.exe` which can be found only on Windows so
/// if you are on another platform and want to cross-compile and sign you will
/// need to use another tool like `osslsigncode`.
#[serde(alias = "sign-command")]
pub sign_command: Option<String>,
}
impl Default for WindowsConfig {
@@ -606,15 +791,37 @@ impl Default for WindowsConfig {
tsp: false,
webview_install_mode: Default::default(),
webview_fixed_runtime_path: None,
allow_downgrades: default_allow_downgrades(),
allow_downgrades: true,
wix: None,
nsis: None,
sign_command: None,
}
}
}
fn default_allow_downgrades() -> bool {
true
/// Definition for bundle resources.
/// Can be either a list of paths to include or a map of source to target paths.
#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields, untagged)]
pub enum BundleResources {
/// A list of paths to include.
List(Vec<String>),
/// A map of source to target paths.
Map(HashMap<String, String>),
}
impl BundleResources {
/// Adds a path to the resource collection.
pub fn push(&mut self, path: impl Into<String>) {
match self {
Self::List(l) => l.push(path.into()),
Self::Map(l) => {
let path = path.into();
l.insert(path.clone(), path);
}
}
}
}
/// Configuration for tauri-bundler.
@@ -628,7 +835,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", "rpm", "appimage", "nsis", "msi", "app", "dmg", "updater"] or "all".
#[serde(default)]
pub targets: BundleTarget,
/// The application identifier in reverse domain name notation (e.g. `com.tauri.example`).
@@ -646,7 +853,7 @@ pub struct BundleConfig {
/// App resources to bundle.
/// Each resource is a path to a file or directory.
/// Glob patterns are supported.
pub resources: Option<Vec<String>>,
pub resources: Option<BundleResources>,
/// A copyright string associated with your application.
pub copyright: Option<String>,
/// The application kind.
@@ -660,12 +867,27 @@ pub struct BundleConfig {
/// A longer, multi-line description of the application.
#[serde(alias = "long-description")]
pub long_description: Option<String>,
/// Whether to use the project's `target` directory, for caching build tools (e.g., Wix and NSIS) when building this application. Defaults to `false`.
///
/// If true, tools will be cached in `target\.tauri-tools`.
/// If false, tools will be cached in the current user's platform-specific cache directory.
///
/// An example where it can be appropriate to set this to `true` is when building this application as a Windows System user (e.g., AWS EC2 workloads),
/// because the Window system's app data directory is restricted.
#[serde(default, alias = "use-local-tools-dir")]
pub use_local_tools_dir: bool,
/// Configuration for the AppImage bundle.
#[serde(default)]
pub appimage: AppImageConfig,
/// Configuration for the Debian bundle.
#[serde(default)]
pub deb: DebConfig,
/// Configuration for the RPM bundle.
#[serde(default)]
pub rpm: RpmConfig,
/// DMG-specific settings.
#[serde(default)]
pub dmg: DmgConfig,
/// Configuration for the macOS bundles.
#[serde(rename = "macOS", default)]
pub macos: MacConfig,
@@ -892,7 +1114,7 @@ pub struct WindowConfig {
/// Whether the file drop is enabled or not on the webview. By default it is enabled.
///
/// Disabling it is required to use drag and drop on the frontend on Windows.
#[serde(default = "default_file_drop_enabled", alias = "file-drop-enabled")]
#[serde(default = "default_true", alias = "file-drop-enabled")]
pub file_drop_enabled: bool,
/// Whether or not the window starts centered or not.
#[serde(default)]
@@ -919,9 +1141,34 @@ pub struct WindowConfig {
/// The max window height.
#[serde(alias = "max-height")]
pub max_height: Option<f64>,
/// Whether the window is resizable or not.
#[serde(default = "default_resizable")]
/// Whether the window is resizable or not. When resizable is set to false, native window's maximize button is automatically disabled.
#[serde(default = "default_true")]
pub resizable: bool,
/// Whether the window's native maximize button is enabled or not.
/// If resizable is set to false, this setting is ignored.
///
/// ## Platform-specific
///
/// - **macOS:** Disables the "zoom" button in the window titlebar, which is also used to enter fullscreen mode.
/// - **Linux / iOS / Android:** Unsupported.
#[serde(default = "default_true")]
pub maximizable: bool,
/// Whether the window's native minimize button is enabled or not.
///
/// ## Platform-specific
///
/// - **Linux / iOS / Android:** Unsupported.
#[serde(default = "default_true")]
pub minimizable: bool,
/// Whether the window's native close button is enabled or not.
///
/// ## Platform-specific
///
/// - **Linux:** "GTK+ will do its best to convince the window manager not to show a close button.
/// Depending on the system, this function may not have any effect when called on a window that is already visible"
/// - **iOS / Android:** Unsupported.
#[serde(default = "default_true")]
pub closable: bool,
/// The window title.
#[serde(default = "default_title")]
pub title: String,
@@ -929,7 +1176,7 @@ pub struct WindowConfig {
#[serde(default)]
pub fullscreen: bool,
/// Whether the window will be initially focused or not.
#[serde(default = "default_focus")]
#[serde(default = "default_true")]
pub focus: bool,
/// Whether the window is transparent or not.
///
@@ -941,10 +1188,10 @@ pub struct WindowConfig {
#[serde(default)]
pub maximized: bool,
/// Whether the window is visible or not.
#[serde(default = "default_visible")]
#[serde(default = "default_true")]
pub visible: bool,
/// Whether the window should have borders and bars.
#[serde(default = "default_decorations")]
#[serde(default = "default_true")]
pub decorations: bool,
/// Whether the window should always be on top of other windows.
#[serde(default, alias = "always-on-top")]
@@ -986,7 +1233,7 @@ impl Default for WindowConfig {
label: default_window_label(),
url: WindowUrl::default(),
user_agent: None,
file_drop_enabled: default_file_drop_enabled(),
file_drop_enabled: true,
center: false,
x: None,
y: None,
@@ -996,14 +1243,17 @@ impl Default for WindowConfig {
min_height: None,
max_width: None,
max_height: None,
resizable: default_resizable(),
resizable: true,
maximizable: true,
minimizable: true,
closable: true,
title: default_title(),
fullscreen: false,
focus: false,
transparent: false,
maximized: false,
visible: default_visible(),
decorations: default_decorations(),
visible: true,
decorations: true,
always_on_top: false,
content_protected: false,
skip_taskbar: false,
@@ -1029,30 +1279,10 @@ fn default_height() -> f64 {
600f64
}
fn default_resizable() -> bool {
true
}
fn default_title() -> String {
"Tauri App".to_string()
}
fn default_focus() -> bool {
true
}
fn default_visible() -> bool {
true
}
fn default_decorations() -> bool {
true
}
fn default_file_drop_enabled() -> bool {
true
}
/// A Content-Security-Policy directive source list.
/// See <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/Sources#sources>.
#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
@@ -1208,6 +1438,7 @@ pub struct RemoteDomainAccessScope {
/// The list of window labels this scope applies to.
pub windows: Vec<String>,
/// The list of plugins that are allowed in this scope.
/// The names should be without the `tauri-plugin-` prefix, for example `"store"` for `tauri-plugin-store`.
#[serde(default)]
pub plugins: Vec<String>,
/// Enables access to the Tauri API.
@@ -1266,6 +1497,11 @@ pub struct SecurityConfig {
/// vulnerable to dangerous Tauri command related attacks otherwise.
#[serde(default, alias = "dangerous-remote-domain-ipc-access")]
pub dangerous_remote_domain_ipc_access: Vec<RemoteDomainAccessScope>,
/// Sets whether the custom protocols should use `http://<scheme>.localhost` instead of the default `https://<scheme>.localhost` on Windows.
///
/// **WARNING:** Using a `http` scheme will allow mixed content when trying to fetch `http` endpoints and is therefore less secure but will match the behavior of the `<scheme>://localhost` protocols used on macOS and Linux.
#[serde(default, alias = "dangerous-use-http-scheme")]
pub dangerous_use_http_scheme: bool,
}
/// Defines an allowlist type.
@@ -1293,12 +1529,13 @@ macro_rules! check_feature {
/// `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`,
/// `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.
#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(untagged)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
pub enum FsAllowlistScope {
/// A list of paths that are allowed by this scope.
AllowedPaths(Vec<PathBuf>),
/// A complete scope configuration.
#[serde(rename_all = "camelCase")]
Scope {
/// A list of paths that are allowed by this scope.
#[serde(default)]
@@ -1307,6 +1544,16 @@ pub enum FsAllowlistScope {
/// This gets precedence over the [`Self::Scope::allow`] list.
#[serde(default)]
deny: Vec<PathBuf>,
/// Whether or not paths that contain components that start with a `.`
/// will require that `.` appears literally in the pattern; `*`, `?`, `**`,
/// or `[...]` will not match. This is useful because such files are
/// conventionally considered hidden on Unix systems and it might be
/// desirable to skip them when listing files.
///
/// Defaults to `true` on Unix systems and `false` on Windows
// dotfiles are not supposed to be exposed by default on unix
#[serde(alias = "require-literal-leading-dot")]
require_literal_leading_dot: Option<bool>,
},
}
@@ -1437,6 +1684,15 @@ pub struct WindowAllowlistConfig {
/// Allows setting the resizable flag of the window.
#[serde(default, alias = "set-resizable")]
pub set_resizable: bool,
/// Allows setting whether the window's native maximize button is enabled or not.
#[serde(default, alias = "set-maximizable")]
pub set_maximizable: bool,
/// Allows setting whether the window's native minimize button is enabled or not.
#[serde(default, alias = "set-minimizable")]
pub set_minimizable: bool,
/// Allows setting whether the window's native close button is enabled or not.
#[serde(default, alias = "set-closable")]
pub set_closable: bool,
/// Allows changing the window title.
#[serde(default, alias = "set-title")]
pub set_title: bool,
@@ -1525,6 +1781,9 @@ impl Allowlist for WindowAllowlistConfig {
center: true,
request_user_attention: true,
set_resizable: true,
set_maximizable: true,
set_minimizable: true,
set_closable: true,
set_title: true,
maximize: true,
unmaximize: true,
@@ -1571,6 +1830,9 @@ impl Allowlist for WindowAllowlistConfig {
"window-request-user-attention"
);
check_feature!(self, features, set_resizable, "window-set-resizable");
check_feature!(self, features, set_maximizable, "window-set-maximizable");
check_feature!(self, features, set_minimizable, "window-set-minimizable");
check_feature!(self, features, set_closable, "window-set-closable");
check_feature!(self, features, set_title, "window-set-title");
check_feature!(self, features, maximize, "window-maximize");
check_feature!(self, features, unmaximize, "window-unmaximize");
@@ -1883,11 +2145,13 @@ impl Allowlist for DialogAllowlistConfig {
/// The scoped URL is matched against the request URL using a glob pattern.
///
/// Examples:
/// - "https://**": allows all HTTPS urls
/// - "https://*": allows all HTTPS urls
/// - "https://*.github.com/tauri-apps/tauri": allows any subdomain of "github.com" with the "tauri-apps/api" path
/// - "https://myapi.service.com/users/*": allows access to any URLs that begins with "https://myapi.service.com/users/"
#[allow(rustdoc::bare_urls)]
#[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
// TODO: in v2, parse into a String or a custom type that perserves the
// glob string because Url type will add a trailing slash
#[cfg_attr(feature = "schema", derive(JsonSchema))]
pub struct HttpAllowlistScope(pub Vec<Url>);
@@ -2391,7 +2655,6 @@ pub struct TauriConfig {
impl TauriConfig {
/// Returns all Cargo features.
#[allow(dead_code)]
pub fn all_features() -> Vec<&'static str> {
let mut features = AllowlistConfig::all_features();
features.extend(vec![
@@ -2405,7 +2668,6 @@ impl TauriConfig {
}
/// Returns the enabled Cargo features.
#[allow(dead_code)]
pub fn features(&self) -> Vec<&str> {
let mut features = self.allowlist.to_features();
if self.cli.is_some() {
@@ -2468,7 +2730,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,
@@ -2485,6 +2747,18 @@ impl WindowsUpdateInstallMode {
Self::Passive => &["/passive"],
}
}
/// Returns the associated nsis arguments.
///
/// [WindowsUpdateInstallMode::Passive] will return `["/P", "/R"]`
/// [WindowsUpdateInstallMode::Quiet] will return `["/S", "/R"]`
pub fn nsis_args(&self) -> &'static [&'static str] {
match self {
Self::Passive => &["/P", "/R"],
Self::Quiet => &["/S", "/R"],
_ => &[],
}
}
}
impl Display for WindowsUpdateInstallMode {
@@ -2561,7 +2835,7 @@ pub struct UpdaterConfig {
#[serde(default)]
pub active: bool,
/// Display built-in dialog or use event system if disabled.
#[serde(default = "default_dialog")]
#[serde(default = "default_true")]
pub dialog: bool,
/// The updater endpoints. TLS is enforced on production.
///
@@ -2592,7 +2866,7 @@ impl<'de> Deserialize<'de> for UpdaterConfig {
struct InnerUpdaterConfig {
#[serde(default)]
active: bool,
#[serde(default = "default_dialog")]
#[serde(default = "default_true")]
dialog: bool,
endpoints: Option<Vec<UpdaterEndpoint>>,
pubkey: Option<String>,
@@ -2622,7 +2896,7 @@ impl Default for UpdaterConfig {
fn default() -> Self {
Self {
active: false,
dialog: default_dialog(),
dialog: true,
endpoints: None,
pubkey: "".into(),
windows: Default::default(),
@@ -2645,26 +2919,12 @@ pub struct SystemTrayConfig {
#[serde(default, alias = "icon-as-template")]
pub icon_as_template: bool,
/// A Boolean value that determines whether the menu should appear when the tray icon receives a left click on macOS.
#[serde(
default = "default_tray_menu_on_left_click",
alias = "menu-on-left-click"
)]
#[serde(default = "default_true", alias = "menu-on-left-click")]
pub menu_on_left_click: bool,
/// Title for MacOS tray
pub title: Option<String>,
}
fn default_tray_menu_on_left_click() -> bool {
true
}
// We enable the unnecessary_wraps because we need
// to use an Option for dialog otherwise the CLI schema will mark
// the dialog as a required field which is not as we default it to true.
fn default_dialog() -> bool {
true
}
/// Defines the URL or assets to embed in the application.
#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
@@ -2867,7 +3127,7 @@ pub struct PackageConfig {
#[serde(alias = "product-name")]
#[cfg_attr(feature = "schema", validate(regex(pattern = "^[^/\\:*?\"<>|]+$")))]
pub product_name: Option<String>,
/// App version. It is a semver version number or a path to a `package.json` file containing the `version` field.
/// App version. It is a semver version number or a path to a `package.json` file containing the `version` field. If removed the version number from `Cargo.toml` is used.
#[serde(deserialize_with = "version_deserializer", default)]
pub version: Option<String>,
}
@@ -3128,7 +3388,7 @@ mod build {
} else if num.is_f64() {
// guaranteed f64
let num = num.as_f64().unwrap();
quote! { #prefix::Number(#num.into()) }
quote! { #prefix::Number(::serde_json::Number::from_f64(#num).unwrap(/* safe to unwrap, guaranteed f64 */)) }
} else {
// invalid number
quote! { #prefix::Null }
@@ -3227,6 +3487,9 @@ mod build {
let max_width = opt_lit(self.max_width.as_ref());
let max_height = opt_lit(self.max_height.as_ref());
let resizable = self.resizable;
let maximizable = self.maximizable;
let minimizable = self.minimizable;
let closable = self.closable;
let title = str_lit(&self.title);
let fullscreen = self.fullscreen;
let focus = self.focus;
@@ -3261,6 +3524,9 @@ mod build {
max_width,
max_height,
resizable,
maximizable,
minimizable,
closable,
title,
fullscreen,
focus,
@@ -3447,8 +3713,11 @@ mod build {
let category = quote!(None);
let short_description = quote!(None);
let long_description = quote!(None);
let use_local_tools_dir = self.use_local_tools_dir;
let appimage = quote!(Default::default());
let deb = quote!(Default::default());
let rpm = quote!(Default::default());
let dmg = quote!(Default::default());
let macos = quote!(Default::default());
let external_bin = opt_vec_str_lit(self.external_bin.as_ref());
let windows = &self.windows;
@@ -3466,8 +3735,11 @@ mod build {
category,
short_description,
long_description,
use_local_tools_dir,
appimage,
deb,
rpm,
dmg,
macos,
external_bin,
windows
@@ -3649,6 +3921,7 @@ mod build {
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_use_http_scheme = &self.dangerous_use_http_scheme;
let dangerous_remote_domain_ipc_access =
vec_lit(&self.dangerous_remote_domain_ipc_access, identity);
@@ -3659,7 +3932,8 @@ mod build {
dev_csp,
freeze_prototype,
dangerous_disable_asset_csp_modification,
dangerous_remote_domain_ipc_access
dangerous_remote_domain_ipc_access,
dangerous_use_http_scheme
);
}
}
@@ -3690,10 +3964,11 @@ mod build {
let allowed_paths = vec_lit(allow, path_buf_lit);
quote! { #prefix::AllowedPaths(#allowed_paths) }
}
Self::Scope { allow, deny } => {
Self::Scope { allow, deny , require_literal_leading_dot} => {
let allow = vec_lit(allow, path_buf_lit);
let deny = vec_lit(deny, path_buf_lit);
quote! { #prefix::Scope { allow: #allow, deny: #deny } }
let require_literal_leading_dot = opt_lit(require_literal_leading_dot.as_ref());
quote! { #prefix::Scope { allow: #allow, deny: #deny, require_literal_leading_dot: #require_literal_leading_dot } }
}
});
}
@@ -3905,8 +4180,11 @@ mod test {
category: None,
short_description: None,
long_description: None,
use_local_tools_dir: false,
appimage: Default::default(),
deb: Default::default(),
rpm: Default::default(),
dmg: Default::default(),
macos: Default::default(),
external_bin: None,
windows: Default::default(),
@@ -3925,6 +4203,7 @@ mod test {
freeze_prototype: false,
dangerous_disable_asset_csp_modification: DisabledCspModificationKind::Flag(false),
dangerous_remote_domain_ipc_access: Vec::new(),
dangerous_use_http_scheme: false,
},
allowlist: AllowlistConfig::default(),
system_tray: None,

View File

@@ -302,7 +302,7 @@ mod tests {
assert_eq!(
document.to_string(),
format!(
r#"<html><head><meta content="{}" http-equiv="Content-Security-Policy"></head><body></body></html>"#,
r#"<html><head><meta http-equiv="Content-Security-Policy" content="{}"></head><body></body></html>"#,
super::CSP_TOKEN
)
);

View File

@@ -6,7 +6,7 @@
use std::io::BufRead;
/// Read a line breaking in both \n and \r.
/// Read all bytes until a newline (the `0xA` byte) or a carriage return (`\r`) is reached, and append them to the provided buffer.
///
/// Adapted from <https://doc.rust-lang.org/std/io/trait.BufRead.html#method.read_line>.
pub fn read_line<R: BufRead + ?Sized>(r: &mut R, buf: &mut Vec<u8>) -> std::io::Result<usize> {
@@ -16,6 +16,7 @@ pub fn read_line<R: BufRead + ?Sized>(r: &mut R, buf: &mut Vec<u8>) -> std::io::
let available = match r.fill_buf() {
Ok(n) => n,
Err(ref e) if e.kind() == std::io::ErrorKind::Interrupted => continue,
Err(e) => return Err(e),
};
match memchr::memchr(b'\n', available) {
@@ -40,9 +41,6 @@ pub fn read_line<R: BufRead + ?Sized>(r: &mut R, buf: &mut Vec<u8>) -> std::io::
r.consume(used);
read += used;
if done || used == 0 {
if buf.ends_with(&[b'\n']) {
buf.pop();
}
return Ok(read);
}
}

View File

@@ -13,6 +13,8 @@ use std::{
use semver::Version;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use log::warn;
pub mod assets;
pub mod config;
pub mod html;
@@ -202,7 +204,7 @@ impl Default for Env {
.unwrap_or(true);
if !is_temp {
panic!("`APPDIR` or `APPIMAGE` environment variable found but this application was not detected as an AppImage; this might be a security issue.");
warn!("`APPDIR` or `APPIMAGE` environment variable found but this application was not detected as an AppImage; this might be a security issue.");
}
}
env
@@ -298,11 +300,9 @@ macro_rules! debug_eprintln {
};
}
/// Reconstructs a path from its components using the platform separator then converts it to String
/// Reconstructs a path from its components using the platform separator then converts it to String and removes UNC prefixes on Windows if it exists.
pub fn display_path<P: AsRef<Path>>(p: P) -> String {
p.as_ref()
.components()
.collect::<PathBuf>()
dunce::simplified(&p.as_ref().components().collect::<PathBuf>())
.display()
.to_string()
}

View File

@@ -18,10 +18,11 @@ pub enum MimeType {
Js,
Json,
Jsonld,
Mp4,
OctetStream,
Rtf,
Svg,
Mp4,
Txt,
}
impl std::fmt::Display for MimeType {
@@ -34,10 +35,11 @@ impl std::fmt::Display for MimeType {
MimeType::Js => "text/javascript",
MimeType::Json => "application/json",
MimeType::Jsonld => "application/ld+json",
MimeType::Mp4 => "video/mp4",
MimeType::OctetStream => "application/octet-stream",
MimeType::Rtf => "application/rtf",
MimeType::Svg => "image/svg+xml",
MimeType::Mp4 => "video/mp4",
MimeType::Txt => MIMETYPE_PLAIN,
};
write!(f, "{mime}")
}
@@ -46,6 +48,11 @@ impl std::fmt::Display for MimeType {
impl MimeType {
/// parse a URI suffix to convert text/plain mimeType to their actual web compatible mimeType.
pub fn parse_from_uri(uri: &str) -> MimeType {
Self::parse_from_uri_with_fallback(uri, Self::Html)
}
/// parse a URI suffix to convert text/plain mimeType to their actual web compatible mimeType with specified fallback for unknown file extensions.
pub fn parse_from_uri_with_fallback(uri: &str, fallback: MimeType) -> MimeType {
let suffix = uri.split('.').last();
match suffix {
Some("bin") => Self::OctetStream,
@@ -57,19 +64,24 @@ impl MimeType {
Some("json") => Self::Json,
Some("jsonld") => Self::Jsonld,
Some("mjs") => Self::Js,
Some("mp4") => Self::Mp4,
Some("rtf") => Self::Rtf,
Some("svg") => Self::Svg,
Some("mp4") => Self::Mp4,
Some("txt") => Self::Txt,
// Assume HTML when a TLD is found for eg. `wry:://tauri.app` | `wry://hello.com`
Some(_) => Self::Html,
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
Some(_) => fallback,
// using octet stream according to this:
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
None => Self::OctetStream,
}
}
/// infer mimetype from content (or) URI if needed.
pub fn parse(content: &[u8], uri: &str) -> String {
Self::parse_with_fallback(content, uri, Self::Html)
}
/// infer mimetype from content (or) URI if needed with specified fallback for unknown file extensions.
pub fn parse_with_fallback(content: &[u8], uri: &str, fallback: MimeType) -> String {
let mime = if uri.ends_with(".svg") {
// when reading svg, we can't use `infer`
None
@@ -78,8 +90,10 @@ impl MimeType {
};
match mime {
Some(mime) if mime == MIMETYPE_PLAIN => Self::parse_from_uri(uri).to_string(),
None => Self::parse_from_uri(uri).to_string(),
Some(mime) if mime == MIMETYPE_PLAIN => {
Self::parse_from_uri_with_fallback(uri, fallback).to_string()
}
None => Self::parse_from_uri_with_fallback(uri, fallback).to_string(),
Some(mime) => mime.to_string(),
}
}
@@ -122,14 +136,17 @@ mod tests {
let mjs: String = MimeType::parse_from_uri("https://example.com/bundled.mjs").to_string();
assert_eq!(mjs, String::from("text/javascript"));
let mp4: String = MimeType::parse_from_uri("https://example.com/video.mp4").to_string();
assert_eq!(mp4, String::from("video/mp4"));
let rtf: String = MimeType::parse_from_uri("https://example.com/document.rtf").to_string();
assert_eq!(rtf, String::from("application/rtf"));
let svg: String = MimeType::parse_from_uri("https://example.com/picture.svg").to_string();
assert_eq!(svg, String::from("image/svg+xml"));
let mp4: String = MimeType::parse_from_uri("https://example.com/video.mp4").to_string();
assert_eq!(mp4, String::from("video/mp4"));
let txt: String = MimeType::parse_from_uri("https://example.com/file.txt").to_string();
assert_eq!(txt, String::from("text/plain"));
let custom_scheme = MimeType::parse_from_uri("wry://tauri.app").to_string();
assert_eq!(custom_scheme, String::from("text/html"));

View File

@@ -208,81 +208,16 @@ pub use windows_platform::{is_windows_7, windows_version};
#[cfg(windows)]
mod windows_platform {
use std::{iter::once, os::windows::prelude::OsStrExt};
use windows::{
core::{PCSTR, PCWSTR},
Win32::{
Foundation::FARPROC,
System::{
LibraryLoader::{GetProcAddress, LoadLibraryW},
SystemInformation::OSVERSIONINFOW,
},
},
};
/// Checks if we're running on Windows 7.
pub fn is_windows_7() -> bool {
if let Some(v) = windows_version() {
// windows 7 is 6.1
if v.0 == 6 && v.1 == 1 {
return true;
}
}
false
}
fn encode_wide(string: impl AsRef<std::ffi::OsStr>) -> Vec<u16> {
string.as_ref().encode_wide().chain(once(0)).collect()
}
// Helper function to dynamically load function pointer.
// `library` and `function` must be zero-terminated.
fn get_function_impl(library: &str, function: &str) -> Option<FARPROC> {
let library = encode_wide(library);
assert_eq!(function.chars().last(), Some('\0'));
let function = PCSTR::from_raw(function.as_ptr());
// Library names we will use are ASCII so we can use the A version to avoid string conversion.
let module = unsafe { LoadLibraryW(PCWSTR::from_raw(library.as_ptr())) }.unwrap_or_default();
if module.is_invalid() {
None
} else {
Some(unsafe { GetProcAddress(module, function) })
}
}
macro_rules! get_function {
($lib:expr, $func:ident) => {
get_function_impl(concat!($lib, '\0'), concat!(stringify!($func), '\0'))
.map(|f| unsafe { std::mem::transmute::<windows::Win32::Foundation::FARPROC, $func>(f) })
};
windows_version()
.map(|v| v.0 == 6 && v.1 == 1)
.unwrap_or_default()
}
/// Returns a tuple of (major, minor, buildnumber) for the Windows version.
pub fn windows_version() -> Option<(u32, u32, u32)> {
type RtlGetVersion = unsafe extern "system" fn(*mut OSVERSIONINFOW) -> i32;
let handle = get_function!("ntdll.dll", RtlGetVersion);
if let Some(rtl_get_version) = handle {
unsafe {
let mut vi = OSVERSIONINFOW {
dwOSVersionInfoSize: 0,
dwMajorVersion: 0,
dwMinorVersion: 0,
dwBuildNumber: 0,
dwPlatformId: 0,
szCSDVersion: [0; 128],
};
let status = (rtl_get_version)(&mut vi as _);
if status >= 0 {
Some((vi.dwMajorVersion, vi.dwMinorVersion, vi.dwBuildNumber))
} else {
None
}
}
} else {
None
}
let v = windows_version::OsVersion::current();
Some((v.major, v.minor, v.build))
}
}

View File

@@ -41,6 +41,8 @@ impl StartingBinary {
///
/// Because [`Error`] is not clone-able, it is recreated instead.
pub(super) fn cloned(&self) -> Result<PathBuf> {
// false positive
#[allow(clippy::useless_asref)]
self
.0
.as_ref()

View File

@@ -2,7 +2,10 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use std::path::{Component, Path, PathBuf};
use std::{
collections::HashMap,
path::{Component, Path, PathBuf},
};
/// Given a path (absolute or relative) to a resource file, returns the
/// relative path from the bundle resources directory where that resource
@@ -39,10 +42,58 @@ pub fn external_binaries(external_binaries: &[String], target_triple: &str) -> V
paths
}
enum PatternIter<'a> {
Slice(std::slice::Iter<'a, String>),
Map(std::collections::hash_map::Iter<'a, String, String>),
}
/// A helper to iterate through resources.
pub struct ResourcePaths<'a> {
iter: ResourcePathsIter<'a>,
}
impl<'a> ResourcePaths<'a> {
/// Creates a new ResourcePaths from a slice of patterns to iterate
pub fn new(patterns: &'a [String], allow_walk: bool) -> ResourcePaths<'a> {
ResourcePaths {
iter: ResourcePathsIter {
pattern_iter: PatternIter::Slice(patterns.iter()),
glob_iter: None,
walk_iter: None,
allow_walk,
current_pattern: None,
current_pattern_is_valid: false,
current_dest: None,
},
}
}
/// Creates a new ResourcePaths from a slice of patterns to iterate
pub fn from_map(patterns: &'a HashMap<String, String>, allow_walk: bool) -> ResourcePaths<'a> {
ResourcePaths {
iter: ResourcePathsIter {
pattern_iter: PatternIter::Map(patterns.iter()),
glob_iter: None,
walk_iter: None,
allow_walk,
current_pattern: None,
current_pattern_is_valid: false,
current_dest: None,
},
}
}
/// Returns the resource iterator that yields the source and target paths.
/// Needed when using [`Self::from_map`].
pub fn iter(self) -> ResourcePathsIter<'a> {
self.iter
}
}
/// Iterator of a [`ResourcePaths`].
pub struct ResourcePathsIter<'a> {
/// the patterns to iterate.
pattern_iter: std::slice::Iter<'a, String>,
pattern_iter: PatternIter<'a>,
/// the glob iterator if the path from the current iteration is a glob pattern.
glob_iter: Option<glob::Paths>,
/// the walkdir iterator if the path from the current iteration is a directory.
@@ -50,22 +101,28 @@ pub struct ResourcePaths<'a> {
/// whether the resource paths allows directories or not.
allow_walk: bool,
/// the pattern of the current iteration.
current_pattern: Option<String>,
current_pattern: Option<(String, PathBuf)>,
/// whether the current pattern is valid or not.
current_pattern_is_valid: bool,
/// Current destination path. Only set when the iterator comes from a Map.
current_dest: Option<PathBuf>,
}
impl<'a> ResourcePaths<'a> {
/// Creates a new ResourcePaths from a slice of patterns to iterate
pub fn new(patterns: &'a [String], allow_walk: bool) -> ResourcePaths<'a> {
ResourcePaths {
pattern_iter: patterns.iter(),
glob_iter: None,
walk_iter: None,
allow_walk,
current_pattern: None,
current_pattern_is_valid: false,
}
/// Information for a resource.
pub struct Resource {
path: PathBuf,
target: PathBuf,
}
impl Resource {
/// The path of the resource.
pub fn path(&self) -> &Path {
&self.path
}
/// The target location of the resource.
pub fn target(&self) -> &Path {
&self.target
}
}
@@ -73,6 +130,28 @@ impl<'a> Iterator for ResourcePaths<'a> {
type Item = crate::Result<PathBuf>;
fn next(&mut self) -> Option<crate::Result<PathBuf>> {
self.iter.next().map(|r| r.map(|res| res.path))
}
}
fn normalize(path: &Path) -> PathBuf {
let mut dest = PathBuf::new();
for component in path.components() {
match component {
Component::Prefix(_) => {}
Component::RootDir => dest.push("/"),
Component::CurDir => {}
Component::ParentDir => dest.push(".."),
Component::Normal(string) => dest.push(string),
}
}
dest
}
impl<'a> Iterator for ResourcePathsIter<'a> {
type Item = crate::Result<Resource>;
fn next(&mut self) -> Option<crate::Result<Resource>> {
loop {
if let Some(ref mut walk_entries) = self.walk_iter {
if let Some(entry) = walk_entries.next() {
@@ -85,7 +164,20 @@ impl<'a> Iterator for ResourcePaths<'a> {
continue;
}
self.current_pattern_is_valid = true;
return Some(Ok(path.to_path_buf()));
return Some(Ok(Resource {
target: if let (Some(current_dest), Some(current_pattern)) =
(&self.current_dest, &self.current_pattern)
{
if current_pattern.0.contains('*') {
current_dest.join(path.file_name().unwrap())
} else {
current_dest.join(path.strip_prefix(&current_pattern.1).unwrap())
}
} else {
resource_relpath(path)
},
path: path.to_path_buf(),
}));
}
}
self.walk_iter = None;
@@ -105,24 +197,51 @@ impl<'a> Iterator for ResourcePaths<'a> {
}
}
self.current_pattern_is_valid = true;
return Some(Ok(path));
return Some(Ok(Resource {
target: if let Some(current_dest) = &self.current_dest {
current_dest.join(path.file_name().unwrap())
} else {
resource_relpath(&path)
},
path,
}));
} else if let Some(current_path) = &self.current_pattern {
if !self.current_pattern_is_valid {
self.glob_iter = None;
return Some(Err(crate::Error::GlobPathNotFound(current_path.clone())));
return Some(Err(crate::Error::GlobPathNotFound(current_path.0.clone())));
}
}
}
self.glob_iter = None;
if let Some(pattern) = self.pattern_iter.next() {
self.current_pattern = Some(pattern.to_string());
self.current_pattern_is_valid = false;
let glob = match glob::glob(pattern) {
Ok(glob) => glob,
Err(error) => return Some(Err(error.into())),
};
self.glob_iter = Some(glob);
continue;
self.current_dest = None;
match &mut self.pattern_iter {
PatternIter::Slice(iter) => {
if let Some(pattern) = iter.next() {
self.current_pattern = Some((pattern.to_string(), normalize(Path::new(pattern))));
self.current_pattern_is_valid = false;
let glob = match glob::glob(pattern) {
Ok(glob) => glob,
Err(error) => return Some(Err(error.into())),
};
self.glob_iter = Some(glob);
continue;
}
}
PatternIter::Map(iter) => {
if let Some((pattern, dest)) = iter.next() {
self.current_pattern = Some((pattern.to_string(), normalize(Path::new(pattern))));
self.current_pattern_is_valid = false;
let glob = match glob::glob(pattern) {
Ok(glob) => glob,
Err(error) => return Some(Err(error.into())),
};
self
.current_dest
.replace(resource_relpath(&PathBuf::from(dest)));
self.glob_iter = Some(glob);
continue;
}
}
}
return None;
}

View File

@@ -1,5 +1,231 @@
# Changelog
## \[1.7.0]
### Enhancements
- [`44e3335da`](https://www.github.com/tauri-apps/tauri/commit/44e3335da8c1a811a2ebe72f2036dfad2381da24) ([#9796](https://www.github.com/tauri-apps/tauri/pull/9796)) Enhance the speed of The JS `Command.execute` API from `shell` module.
### Bug Fixes
- [`8ee8f0939`](https://www.github.com/tauri-apps/tauri/commit/8ee8f093900b22c584fdf00c5efdb43ef34f6771) ([#9588](https://www.github.com/tauri-apps/tauri/pull/9588)) Fix check temporary path permission on macos.
- [`07b02c9f9`](https://www.github.com/tauri-apps/tauri/commit/07b02c9f962312f4d90c001d21d3d72ca9daa03a) ([#9972](https://www.github.com/tauri-apps/tauri/pull/9972)) Added `test::INVOKE_KEY` to be used in `tauri::InvokePayload` when testing using `test::assert_ipc_response` and `test::get_ipc_response`.
- [`e48157da2`](https://www.github.com/tauri-apps/tauri/commit/e48157da2f0b88d8c5df13f3287705172a684525) ([#9698](https://www.github.com/tauri-apps/tauri/pull/9698)) Fix the JS `Command` API from `shell` module, losing events for `stdout`.
### Dependencies
- Upgraded to `tauri-utils@1.6.0`
- Upgraded to `tauri-runtime@0.14.4`
- Upgraded to `tauri-runtime-wry@0.14.9`
- Upgraded to `tauri-macros@1.4.5`
## \[1.6.7]
### Bug Fixes
- [`50aabad1f`](https://www.github.com/tauri-apps/tauri/commit/50aabad1f602066417d815b0f2d2c5948848bb00)([#9818](https://www.github.com/tauri-apps/tauri/pull/9818)) On Windows, fix flashing PowerShell for updates for NSIS installer, and address possible "permission denied" problems.
### Security fixes
- [`f6d81dfe0`](https://www.github.com/tauri-apps/tauri/commit/f6d81dfe0871e0ccd012e5190d41e3767e733608) Only process IPC commands from the main frame.
### Dependencies
- Upgraded to `tauri-runtime-wry@0.14.8`
## \[1.6.6]
### Bug Fixes
- [`704260bb3`](https://www.github.com/tauri-apps/tauri/commit/704260bb3c2bc54c149f2fe508bff09535b083ad)([#9784](https://www.github.com/tauri-apps/tauri/pull/9784)) Fix dialog crash on macOS when the `default_path` value is empty.
- [`3b69c1384`](https://www.github.com/tauri-apps/tauri/commit/3b69c1384bd089ad5dcff0c1b12fbfadeb585c6a)([#9792](https://www.github.com/tauri-apps/tauri/pull/9792)) Revert [#9706](https://github.com/tauri-apps/tauri/pull/9706) which broke compatability between `tauri` crate and the JS `@tauri-apps/api` npm package in a patch release where it should've been in a minor release.
## \[1.6.5]
### Bug Fixes
- [`ef35a793c`](https://www.github.com/tauri-apps/tauri/commit/ef35a793c5d923d55e338b51e04e6c280f7c810d)([#9729](https://www.github.com/tauri-apps/tauri/pull/9729)) Fix compilation error when `shell-execute` or `shell-sidecar` features are not active
## \[1.6.4]
### Enhancements
- [`7f885bd5e`](https://www.github.com/tauri-apps/tauri/commit/7f885bd5edf3e179ddf0b674c3ea7a96e26ce39e)([#9706](https://www.github.com/tauri-apps/tauri/pull/9706)) Enhance the speed of The JS `Command.execute` API from `shell` module.
### Dependencies
- Upgraded to `tauri-runtime-wry@0.14.7`
## \[1.6.3]
### Enhancements
- [`3e98145ac`](https://www.github.com/tauri-apps/tauri/commit/3e98145ac3f45d37230661e136e4afc08b072285)([#9570](https://www.github.com/tauri-apps/tauri/pull/9570)) Run each plugin initialization script on its own context so they do not interfere with each other or the Tauri init script.
### Dependencies
- Upgraded to `tauri-utils@1.5.4`
- Upgraded to `tauri-runtime@0.14.3`
- Upgraded to `tauri-runtime-wry@0.14.6`
- Upgraded to `tauri-macros@1.4.4`
## \[1.6.2]
### Bug Fixes
- [`e3b6d38d2`](https://www.github.com/tauri-apps/tauri/commit/e3b6d38d26d27b292f98d6c0e8603a15265a5b43)([#9166](https://www.github.com/tauri-apps/tauri/pull/9166)) Fix `basename(path, 'ext')` JS API when removing all occurances of `ext` where it should only remove the last one.
- [`705da977a`](https://www.github.com/tauri-apps/tauri/commit/705da977a9c941a4b2d90219b34925498f507ab2)([#9529](https://www.github.com/tauri-apps/tauri/pull/9529)) Do not use JS optional chaining to prevent script errors on older webviews such as macOS 10.14.
## \[1.6.1]
### Dependencies
- Upgraded to `tauri-runtime-wry@0.14.5`
## \[1.6.0]
### New Features
- [`6e488378`](https://www.github.com/tauri-apps/tauri/commit/6e48837860203582d2ef8e59d4524f98511a14c0)([#8474](https://www.github.com/tauri-apps/tauri/pull/8474)) Re-export `Url` type.
### Enhancements
- [`8ce51cec`](https://www.github.com/tauri-apps/tauri/commit/8ce51cec3baf4ed88d80c59bf3bbe96fd369c7a0)([#7718](https://www.github.com/tauri-apps/tauri/pull/7718)) On Windows, retain command line args when relaunching the app after an update. Supports NSIS and WiX (without elevated update task).
### Bug Fixes
- [`cc3d8e77`](https://www.github.com/tauri-apps/tauri/commit/cc3d8e77313672f25520e278bbe8fae1b275a735)([#8539](https://www.github.com/tauri-apps/tauri/pull/8539)) Fixes a deadlock when reading a stdout or stderr line returns an error.
- [`b546b42d`](https://www.github.com/tauri-apps/tauri/commit/b546b42db7e75a59232367dd6212fe3b75bb4c6d)([#8577](https://www.github.com/tauri-apps/tauri/pull/8577)) Preserve the order of JS object/map keys in IPC calls. This also fixes issues with the JS `http` module when calling to servers that required a specific order of `FormBody` contents.
- [`8f8729d9`](https://www.github.com/tauri-apps/tauri/commit/8f8729d91843acd2bd2a24731db865d690dd9ab1)([#8312](https://www.github.com/tauri-apps/tauri/pull/8312)) On macOS, allow cancelling maximization when doubleclick happens on `data-tauri-drag-region` by simply keeping the left moust button pressed and then moving the mouse away of the starting position of the click, which is consistent with the native behavior of macOS.
### Dependencies
- Upgraded to `tauri-runtime-wry@0.14.4`
## \[1.5.4]
### Enhancements
- [`3c371aa8`](https://www.github.com/tauri-apps/tauri/commit/3c371aa8ee4032998f859b570702e81e26e77c6c)([#8228](https://www.github.com/tauri-apps/tauri/pull/8228)) Added `test::get_ipc_response`.
### Bug Fixes
- [`50a3d170`](https://www.github.com/tauri-apps/tauri/commit/50a3d170f242178d41fe7e8a3adf964541f6fe9c)([#8408](https://www.github.com/tauri-apps/tauri/pull/8408)) On Windows, fix `open` dialog `defaultPath`, when invoked from JS, not working if the path uses forward slash (`/`)
- [`645e1dcc`](https://www.github.com/tauri-apps/tauri/commit/645e1dcc6e113564e2ddaacf9cb8338aed1a0bd0)([#8404](https://www.github.com/tauri-apps/tauri/pull/8404)) Fix NSIS updater failing to launch when using `basicUi` mode.
### Dependencies
- Upgraded to `tauri-runtime-wry@0.14.3`
- Upgraded to `tauri-utils@1.5.2`
- Upgraded to `tauri-runtime@0.14.2`
- Upgraded to `tauri-macros@1.4.3`
## \[1.5.3]
### Enhancements
- [`b3e53e72`](https://www.github.com/tauri-apps/tauri/commit/b3e53e7243311a2659b7569dddc20c56ac9f9d8e)([#8288](https://www.github.com/tauri-apps/tauri/pull/8288)) Added `AssetResolver::iter` to iterate on all embedded assets.
- [`5e05236b`](https://www.github.com/tauri-apps/tauri/commit/5e05236b4987346697c7caae0567d3c50714c198)([#8289](https://www.github.com/tauri-apps/tauri/pull/8289)) Added tracing for window startup, plugins, `Window::eval`, events, IPC, updater and custom protocol request handlers behind the `tracing` feature flag.
### Bug Fixes
- [`2ba88563`](https://www.github.com/tauri-apps/tauri/commit/2ba8856343e284ed022f28cff6d16db15ad4645f)([#8095](https://www.github.com/tauri-apps/tauri/pull/8095)) Fix docs.rs build for `x86_64-apple-darwin`.
- [`4b6a602a`](https://www.github.com/tauri-apps/tauri/commit/4b6a602a89b36f24d34d6ccd8e3c9b7ce202c9eb)([#8234](https://www.github.com/tauri-apps/tauri/pull/8234)) Escape path of the updater msi to avoid crashing on installers with spaces.
### Dependencies
- Upgraded to `tauri-runtime-wry@0.14.2`
- Upgraded to `tauri-macros@1.4.2`
## \[1.5.2]
### Bug Fixes
- [`21cdbb41`](https://www.github.com/tauri-apps/tauri/commit/21cdbb41a38f465148bbeb82feb3e7886c320182)([#7982](https://www.github.com/tauri-apps/tauri/pull/7982)) Set the correct `truncate` option on `OpenOptions` so that `write_file` can completely overwrite existing files.
## \[1.5.1]
### Bug Fixes
- [`3671edbc`](https://www.github.com/tauri-apps/tauri/commit/3671edbcff37447c95382ab4c9fd1c36a460a037)([#7937](https://www.github.com/tauri-apps/tauri/pull/7937)) Fix devtools not toggling on `ctrl+shift+i` or `cmd+alt+i` shortcuts.
## \[1.5.0]
### New Features
- [`eeb6be54`](https://www.github.com/tauri-apps/tauri/commit/eeb6be54228f3e5463a28c68956abb06a694c010)([#7512](https://www.github.com/tauri-apps/tauri/pull/7512)) Add `tauri::Manager::emit_filter` and only serialize once when emitting to multiple windows.
- [`6c408b73`](https://www.github.com/tauri-apps/tauri/commit/6c408b736c7aa2a0a91f0a40d45a2b7a7dedfe78)([#7269](https://www.github.com/tauri-apps/tauri/pull/7269)) Add option to specify notification sound.
- [`fdaee9a5`](https://www.github.com/tauri-apps/tauri/commit/fdaee9a5ce988c448dd035c2050c339d275e8d15)([#7350](https://www.github.com/tauri-apps/tauri/pull/7350)) Add `tauri::plugin::Builder::register_uri_scheme_protocol`
- [`10e362d0`](https://www.github.com/tauri-apps/tauri/commit/10e362d098c9bed48f832bad471fb2fab83ab0bb)([#7432](https://www.github.com/tauri-apps/tauri/pull/7432)) Added `UpdateBuilder::endpoints` to add request endpoints at runtime.
- [`10e362d0`](https://www.github.com/tauri-apps/tauri/commit/10e362d098c9bed48f832bad471fb2fab83ab0bb)([#7432](https://www.github.com/tauri-apps/tauri/pull/7432)) Added `UpdateResponse::header` and `UpdateResponse::remove_header` to modify the update download request headers.
### Enhancements
- [`757e959e`](https://www.github.com/tauri-apps/tauri/commit/757e959eb276ed535cfddb0dea8897c56441c644)([#7344](https://www.github.com/tauri-apps/tauri/pull/7344)) Open links externally when `<base target="_blank" />` exists
- [`c9827338`](https://www.github.com/tauri-apps/tauri/commit/c98273387c0ffbb8d0de78ce17006411a1f503ee)([#7416](https://www.github.com/tauri-apps/tauri/pull/7416)) Enhance `readDir` API error with path information.
- [`58d6b899`](https://www.github.com/tauri-apps/tauri/commit/58d6b899e21d37bb42810890d289deb57f2273bd)([#7636](https://www.github.com/tauri-apps/tauri/pull/7636)) Add `append` option to `FsOptions` in the `fs` JS module, used in `writeTextFile` and `writeBinaryFile`, to be able to append to existing files instead of overwriting it.
- [`9aa34ada`](https://www.github.com/tauri-apps/tauri/commit/9aa34ada5769dbefa7dfe5f7a6288b3d20b294e4)([#7645](https://www.github.com/tauri-apps/tauri/pull/7645)) Add setting to switch to `http://<scheme>.localhost/` for custom protocols on Windows.
### Bug Fixes
- [`4bf1e85e`](https://www.github.com/tauri-apps/tauri/commit/4bf1e85e6bf85a7ec92d50c8465bc0588a6399d8)([#7722](https://www.github.com/tauri-apps/tauri/pull/7722)) Properly respect the `focused` option when creating the webview.
- [`0797a002`](https://www.github.com/tauri-apps/tauri/commit/0797a002caad29cd8bedccf01f64bf3b45a5e528)([#7746](https://www.github.com/tauri-apps/tauri/pull/7746)) On macOS, fixed tapping on custom title bar doesn't maximize the window.
- [`1a3dcdb8`](https://www.github.com/tauri-apps/tauri/commit/1a3dcdb8302fad511f2c1cd418fbc4cff0bd62ac)([#7185](https://www.github.com/tauri-apps/tauri/pull/7185)) On Windows, fix NSIS installers requiring administrator rights failing to be launched by updater.
- [`fa7f9b77`](https://www.github.com/tauri-apps/tauri/commit/fa7f9b77ab8f0c890e9d7b120901610e0d3e4c46)([#7341](https://www.github.com/tauri-apps/tauri/pull/7341)) Fix updater not following endpoint redirects.
- [`6fbd6dba`](https://www.github.com/tauri-apps/tauri/commit/6fbd6dba5290dc017ab0ba5a44cf4358b022836f)([#17](https://www.github.com/tauri-apps/tauri/pull/17)) Fix the validation of `std::env::current_exe` warn the user if AppImage is not mounted instead of panicking
### Dependencies
- Upgraded to `tauri-utils@1.5.0`
- Upgraded to `tauri-runtime-wry@0.14.1`
- Upgraded to `tauri-runtime@0.14.1`
- Upgraded to `tauri-macros@1.4.1`
## \[1.4.1]
### Bug Fixes
- [`6afd3472`](https://www.github.com/tauri-apps/tauri/commit/6afd34727f153b32dbc568d169dbb17fb8dc3539)([#6680](https://www.github.com/tauri-apps/tauri/pull/6680)) Revert [#6680](https://github.com/tauri-apps/tauri/pull/6680) which added a default sound for notifications on Windows. This introduced inconsistency with other platforms that has silent notifications by default. In the upcoming releases, we will add support for modifying the notification sound across all platforms.
### Security fixes
- [`066c09a6`](https://www.github.com/tauri-apps/tauri/commit/066c09a6ea06f42f550d090715e06beb65cd5564)([#7227](https://www.github.com/tauri-apps/tauri/pull/7227)) Fix regression in `1.4` where the default behavior of the file system scope was changed to allow reading hidden files and directories by default.
## \[1.4.0]
### New Features
- [`7c237209`](https://www.github.com/tauri-apps/tauri/commit/7c237209207cd2938df660b6fd87d3b7d728bd03)([#6546](https://www.github.com/tauri-apps/tauri/pull/6546)) Added `tauri::VERSION` const to get Tauri's version from Rust.
- [`4c39e46a`](https://www.github.com/tauri-apps/tauri/commit/4c39e46a3b438d007f139166ab2a0ba34291a10a)([#7026](https://www.github.com/tauri-apps/tauri/pull/7026)) Added `tauri::webview_version` , to get webview version.
- [`359058ce`](https://www.github.com/tauri-apps/tauri/commit/359058cecca44a9c30b65140c44a8bb3a6dd3be8)([#5939](https://www.github.com/tauri-apps/tauri/pull/5939)) Add `tauri::api::os::locale` function to get the system locale.
- [`c4d6fb4b`](https://www.github.com/tauri-apps/tauri/commit/c4d6fb4b1ea8acf02707a9fe5dcab47c1c5bae7b)([#2353](https://www.github.com/tauri-apps/tauri/pull/2353)) Added the `maximizable`, `minimizable` and `closable` options to the window builder.
- [`c4d6fb4b`](https://www.github.com/tauri-apps/tauri/commit/c4d6fb4b1ea8acf02707a9fe5dcab47c1c5bae7b)([#2353](https://www.github.com/tauri-apps/tauri/pull/2353)) Added the `set_maximizable`, `set_minimizable`, `set_closable`, `is_maximizable`, `is_minimizable` and `is_closable` methods on `Window`.
- [`1d99f8a3`](https://www.github.com/tauri-apps/tauri/commit/1d99f8a3c2f989d1a5ba4d805e3a40b07a3ca8a5)([#4752](https://www.github.com/tauri-apps/tauri/pull/4752)) Expose the `test` module behind the `test` Cargo feature.
- [`000104bc`](https://www.github.com/tauri-apps/tauri/commit/000104bc3bc0c9ff3d20558ab9cf2080f126e9e0)([#6472](https://www.github.com/tauri-apps/tauri/pull/6472)) Add `Window::is_focused` and `Manager::get_focused_window` getters.
- [`441f9646`](https://www.github.com/tauri-apps/tauri/commit/441f96465488a4f8a5731cc51b8ac97b685898c7)([#5491](https://www.github.com/tauri-apps/tauri/pull/5491)) Add `MenuHandle::try_get_item` and `SystemTrayHandle::try_get_item` which returns a `Option` instead of panicking.
### Enhancements
- [`45330e38`](https://www.github.com/tauri-apps/tauri/commit/45330e38193d0b2a01aa926aec433acc6b8f6597)([#6375](https://www.github.com/tauri-apps/tauri/pull/6375)) Enhance the `asset` protocol to support streaming of large files.
- [`df89ccc1`](https://www.github.com/tauri-apps/tauri/commit/df89ccc1912db6b81d43d56c9e6d66980ece2e8d)([#6955](https://www.github.com/tauri-apps/tauri/pull/6955)) Support `passive` mode for NSIS updater.
- [`cd3846c8`](https://www.github.com/tauri-apps/tauri/commit/cd3846c8ce61ab2879b3911e831525e6242aaab2)([#6955](https://www.github.com/tauri-apps/tauri/pull/6955)) Restart the app after the NSIS updater is finished.
- [`db7c5fbf`](https://www.github.com/tauri-apps/tauri/commit/db7c5fbf2e86f3694720f65834eb2c258b7c1291)([#7143](https://www.github.com/tauri-apps/tauri/pull/7143)) Remove `attohttpc` in favor of `reqwest`.
- [`d2710e9d`](https://www.github.com/tauri-apps/tauri/commit/d2710e9d2e8fd93975ef6494512370faa8cb3b7e)([#6944](https://www.github.com/tauri-apps/tauri/pull/6944)) Unpin `time`, `ignore`, and `winnow` crate versions. Developers now have to pin crates if needed themselves. A list of crates that need pinning to adhere to Tauri's MSRV will be visible in Tauri's GitHub workflow: https://github.com/tauri-apps/tauri/blob/dev/.github/workflows/test-core.yml#L85.
- [`5d85d099`](https://www.github.com/tauri-apps/tauri/commit/5d85d0990cd13a1446953a58633edc24eda55afe)([#7128](https://www.github.com/tauri-apps/tauri/pull/7128)) Send updater status events even if default dialog is enabled.
### Bug Fixes
- [`82169e69`](https://www.github.com/tauri-apps/tauri/commit/82169e69fc904d2c7980534c4479bb6f38259fb4)([#5208](https://www.github.com/tauri-apps/tauri/pull/5208)) Fix parsing `allowlist > http > scope` urls that added a trailing slash which broke matching the incoming requests url.
- [`b41b57eb`](https://www.github.com/tauri-apps/tauri/commit/b41b57ebb27befd366db5befaafb6043c18fdfef)([#7105](https://www.github.com/tauri-apps/tauri/pull/7105)) Fix panics when registering an invalid global shortcuts or checking it is registered and return proper errors instead.
- [`aecf1469`](https://www.github.com/tauri-apps/tauri/commit/aecf14690947d109745b4ad823a3e8f4338de47a)([#6889](https://www.github.com/tauri-apps/tauri/pull/6889)) Fix IPC failing after a failed navigation to an external URL.
- [`076e1a81`](https://www.github.com/tauri-apps/tauri/commit/076e1a81a50468e3dfb34ae9ca7e77c5e1758daa)([#7119](https://www.github.com/tauri-apps/tauri/pull/7119)) Fix unlistening to window events failing sometimes.
- [`3f35b452`](https://www.github.com/tauri-apps/tauri/commit/3f35b452637ef1c794a423f1eda62a15d2ddaf42)([#4080](https://www.github.com/tauri-apps/tauri/pull/4080)) Fix `WindowBuilder::on_navigation` handler not registered properly.
- [`0503eb69`](https://www.github.com/tauri-apps/tauri/commit/0503eb69ce7df6b4ed8f5249fdb519b86cd57d8d)([#7078](https://www.github.com/tauri-apps/tauri/pull/7078)) On macOS and Linux, fix app crashing when creating a window with `data:` uri.
- [`3700793a`](https://www.github.com/tauri-apps/tauri/commit/3700793a2f1ea3686b1889c345d73007bb622a29)([#6934](https://www.github.com/tauri-apps/tauri/pull/6934)) Emit `UPTODATE` update status to javascript when the updater server returns status code `204`
- [`ff5e4dbb`](https://www.github.com/tauri-apps/tauri/commit/ff5e4dbbb01bf3fc9c5143df732c75eef6fd98cb)([#6794](https://www.github.com/tauri-apps/tauri/pull/6794)) Fix some configurations not applied when creating the window through Javascript.
- [`65fd674f`](https://www.github.com/tauri-apps/tauri/commit/65fd674f50ba0395d5cea23daf9d2f49f95647fe)([#6652](https://www.github.com/tauri-apps/tauri/pull/6652)) Play a sound when showing a notification on Windows.
- [`696d77c3`](https://www.github.com/tauri-apps/tauri/commit/696d77c3ce480f4a3b4c1c57dae64ff2bb7842ce)([#4493](https://www.github.com/tauri-apps/tauri/pull/4493)) Fixes global events not being received on window-specific event listeners.
## \[1.3.0]
- Added the `additional_browser_args` option when creating a window.

View File

@@ -10,14 +10,13 @@ license = "Apache-2.0 OR MIT"
name = "tauri"
readme = "README.md"
repository = "https://github.com/tauri-apps/tauri"
version = "1.3.0"
version = "1.7.0"
[package.metadata.docs.rs]
no-default-features = true
features = [
"wry",
"custom-protocol",
"api-all",
"windows7-compat",
"cli",
"updater",
@@ -26,7 +25,17 @@ features = [
"devtools",
"http-multipart",
"icon-png",
"dox"
"test",
"dox",
"dialog",
"global-shortcut",
"http-request",
"os-api",
"process-relaunch",
"process-exit",
"protocol-asset",
"process-command-api",
"shell-open"
]
rustdoc-args = [ "--cfg", "doc_cfg" ]
default-target = "x86_64-unknown-linux-gnu"
@@ -37,22 +46,22 @@ targets = [
]
[package.metadata.cargo-udeps.ignore]
normal = [ "attohttpc", "reqwest" ]
normal = [ "reqwest", "nix" ]
[dependencies]
serde_json = { version = "1.0", features = [ "raw_value" ] }
serde_json = { version = "1.0", features = [ "raw_value", "preserve_order" ] }
serde = { version = "1.0", features = [ "derive" ] }
tokio = { version = "1", features = [ "rt", "rt-multi-thread", "sync", "fs", "io-util" ] }
tokio = { version = "1", features = ["time", "rt", "rt-multi-thread", "sync", "fs", "io-util" ] }
futures-util = "0.3"
uuid = { version = "1", features = [ "v4" ] }
url = { version = "2.3" }
anyhow = "1.0"
thiserror = "1.0"
once_cell = "1"
tauri-runtime = { version = "0.13.0", path = "../tauri-runtime" }
tauri-macros = { version = "1.3.0", path = "../tauri-macros" }
tauri-utils = { version = "1.3.0", features = [ "resources" ], path = "../tauri-utils" }
tauri-runtime-wry = { version = "0.13.0", path = "../tauri-runtime-wry", optional = true }
tauri-runtime = { version = "0.14.4", path = "../tauri-runtime" }
tauri-macros = { version = "1.4.5", path = "../tauri-macros" }
tauri-utils = { version = "1.6.0", features = [ "resources" ], path = "../tauri-utils" }
tauri-runtime-wry = { version = "0.14.9", path = "../tauri-runtime-wry", optional = true }
rand = "0.8"
semver = { version = "1.0", features = [ "serde" ] }
serde_repr = "0.1"
@@ -60,7 +69,7 @@ state = "0.5"
tar = "0.4.38"
tempfile = "3"
zip = { version = "0.6", default-features = false, optional = true }
ignore = "=0.4.18"
ignore = "0.4"
flate2 = "1.0"
http = "0.2"
dirs-next = "2.0"
@@ -69,15 +78,14 @@ base64 = { version = "0.21", optional = true }
clap = { version = "3", optional = true }
reqwest = { version = "0.11", features = [ "json", "stream" ], optional = true }
bytes = { version = "1", features = [ "serde" ], optional = true }
attohttpc = { version = "0.22", features = [ "compress", "json", "form" ], optional = true }
open = { version = "3.2", optional = true }
shared_child = { version = "1.0", optional = true }
os_pipe = { version = "1.0", optional = true }
raw-window-handle = "=0.5.0"
raw-window-handle = "0.5"
minisign-verify = { version = "0.2", optional = true }
time = { version = "=0.3.15", features = [ "parsing", "formatting" ], optional = true }
time = { version = "0.3", features = [ "parsing", "formatting" ], optional = true }
os_info = { version = "3", optional = true }
regex = { version = "1.6.0", optional = true }
regex = { version = "1", optional = true }
glob = "0.3"
data-url = { version = "0.2", optional = true }
serialize-to-javascript = "=0.1.1"
@@ -85,6 +93,10 @@ infer = { version = "0.9", optional = true }
png = { version = "0.17", optional = true }
ico = { version = "0.2.0", optional = true }
encoding_rs = "0.8.31"
sys-locale = { version = "0.2.3", optional = true }
tracing = { version = "0.1", optional = true }
indexmap = { version = "1", features = [ "std", "serde" ], optional = true }
getrandom = { version = "0.2", features = [ "std" ] }
[target."cfg(any(target_os = \"macos\", windows, target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies]
rfd = { version = "0.10", optional = true, features = [ "gtk3", "common-controls-v6" ] }
@@ -94,6 +106,7 @@ notify-rust = { version = "4.5", optional = true }
gtk = { version = "0.15", features = [ "v3_20" ] }
glib = "0.15"
webkit2gtk = { version = "0.18.2", features = [ "v2_22" ] }
nix = { version = "0.26.0", default-features = false, features = [ "user", "socket", "uio" ], optional = true }
[target."cfg(target_os = \"macos\")".dependencies]
embed_plist = "1.2"
@@ -101,15 +114,20 @@ cocoa = "0.24"
objc = "0.2"
[target."cfg(windows)".dependencies]
dunce = "1"
webview2-com = "0.19.1"
win7-notifications = { version = "0.3.1", optional = true }
win7-notifications = { version = "0.4", optional = true }
[target."cfg(windows)".dependencies.windows]
version = "0.39.0"
features = [ "Win32_Foundation" ]
features = [
"Win32_Foundation",
"Win32_UI_WindowsAndMessaging",
"Win32_UI_Shell"
]
[build-dependencies]
heck = "0.4"
heck = "0.5"
once_cell = "1"
[dev-dependencies]
@@ -123,10 +141,15 @@ tauri = { path = ".", default-features = false, features = [ "wry" ] }
tokio-test = "0.4.2"
tokio = { version = "1", features = [ "full" ] }
cargo_toml = "0.11"
winnow = "=0.4.1"
[features]
default = [ "wry", "compression", "objc-exception" ]
tracing = [
"dep:tracing",
"tauri-macros/tracing",
"tauri-runtime-wry/tracing"
]
test = [ ]
compression = [ "tauri-macros/compression", "tauri-utils/compression" ]
wry = [ "tauri-runtime-wry" ]
objc-exception = [ "tauri-runtime-wry/objc-exception" ]
@@ -141,13 +164,14 @@ updater = [
"dialog-ask",
"fs-extract-api"
]
http-api = [ "attohttpc" ]
http-multipart = [ "attohttpc/multipart-form", "reqwest/multipart" ]
http-api = [ "reqwest", "bytes", "indexmap" ]
http-multipart = [ "reqwest/multipart" ]
os-api = [ "sys-locale" ]
shell-open-api = [ "open", "regex", "tauri-macros/shell-scope" ]
fs-extract-api = [ "zip" ]
reqwest-client = [ "reqwest", "bytes" ]
reqwest-native-tls-vendored = [ "reqwest-client", "reqwest/native-tls-vendored" ]
native-tls-vendored = [ "attohttpc/tls-vendored" ]
reqwest-client = [ "http-api" ]
reqwest-native-tls-vendored = [ "native-tls-vendored" ]
native-tls-vendored = [ "reqwest/native-tls-vendored" ]
process-command-api = [ "shared_child", "os_pipe" ]
global-shortcut = [
"tauri-runtime/global-shortcut",
@@ -155,7 +179,7 @@ global-shortcut = [
]
clipboard = [ "tauri-runtime/clipboard", "tauri-runtime-wry/clipboard" ]
dialog = [ "rfd" ]
notification = [ "notify-rust" ]
notification = [ "notify-rust", "nix" ]
cli = [ "clap" ]
system-tray = [ "tauri-runtime/system-tray", "tauri-runtime-wry/system-tray" ]
devtools = [ "tauri-runtime/devtools", "tauri-runtime-wry/devtools" ]
@@ -214,7 +238,7 @@ global-shortcut-all = [ "global-shortcut" ]
http-all = [ "http-request" ]
http-request = [ "http-api" ]
notification-all = [ "notification", "dialog-ask" ]
os-all = [ "os_info" ]
os-all = [ "os_info", "os-api" ]
path-all = [ ]
process-all = [ "process-relaunch", "process-exit" ]
process-exit = [ ]
@@ -231,6 +255,9 @@ window-all = [
"window-center",
"window-request-user-attention",
"window-set-resizable",
"window-set-maximizable",
"window-set-minimizable",
"window-set-closable",
"window-set-title",
"window-maximize",
"window-unmaximize",
@@ -262,6 +289,9 @@ window-create = [ ]
window-center = [ ]
window-request-user-attention = [ ]
window-set-resizable = [ ]
window-set-maximizable = [ ]
window-set-minimizable = [ ]
window-set-closable = [ ]
window-set-title = [ ]
window-maximize = [ ]
window-unmaximize = [ ]

View File

@@ -4,7 +4,7 @@
[![status](https://img.shields.io/badge/status-stable-blue.svg)](https://github.com/tauri-apps/tauri/tree/dev)
[![License](https://img.shields.io/badge/License-MIT%20or%20Apache%202-green.svg)](https://opencollective.com/tauri)
[![test library](https://img.shields.io/github/workflow/status/tauri-apps/tauri/test%20library?label=test%20library)](https://github.com/tauri-apps/tauri/actions?query=workflow%3A%22test+library%22)
[![test core](https://img.shields.io/github/actions/workflow/status/tauri-apps/tauri/test-core.yml?label=test%20core&logo=github)](https://github.com/tauri-apps/tauri/actions/workflows/test-core.yml)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Ftauri-apps%2Ftauri.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Ftauri-apps%2Ftauri?ref=badge_shield)
[![Chat Server](https://img.shields.io/badge/chat-discord-7289da.svg)](https://discord.gg/SpmNs4S)
[![website](https://img.shields.io/badge/website-tauri.app-purple.svg)](https://tauri.app)

View File

@@ -71,6 +71,9 @@ fn main() {
"center",
"request-user-attention",
"set-resizable",
"set-maximizable",
"set-minimizable",
"set-closable",
"set-title",
"maximize",
"unmaximize",

File diff suppressed because one or more lines are too long

View File

@@ -13,12 +13,22 @@
})
}
const osName = __TEMPLATE_os_name__
const protocolScheme = __TEMPLATE_protocol_scheme__
window.__TAURI__.convertFileSrc = function convertFileSrc(filePath, protocol = 'asset') {
const path = encodeURIComponent(filePath)
return osName === 'windows'
? `${protocolScheme}://${protocol}.localhost/${path}`
: `${protocol}://localhost/${path}`
}
window.__TAURI__.transformCallback = function transformCallback(
callback,
once
) {
var identifier = uid()
var prop = `_${identifier}`
const identifier = uid()
const prop = `_${identifier}`
Object.defineProperty(window, prop, {
value: (result) => {
@@ -50,11 +60,11 @@
window.__TAURI_INVOKE__ = function invoke(cmd, args = {}) {
return new Promise(function (resolve, reject) {
var callback = window.__TAURI__.transformCallback(function (r) {
const callback = window.__TAURI__.transformCallback(function (r) {
resolve(r)
delete window[`_${error}`]
}, true)
var error = window.__TAURI__.transformCallback(function (e) {
const error = window.__TAURI__.transformCallback(function (e) {
reject(e)
delete window[`_${callback}`]
}, true)
@@ -91,13 +101,15 @@
document.querySelector('body').addEventListener(
'click',
function (e) {
var target = e.target
let target = e.target
const base = document.querySelector('head base')
const baseTarget = base ? base.target : null
while (target != null) {
if (target.matches('a')) {
if (
target.href &&
(['http://', 'https://', 'mailto:', 'tel:'].some(v => target.href.startsWith(v))) &&
target.target === '_blank'
(target.target === '_blank' || (!target.target && baseTarget === "_blank"))
) {
window.__TAURI_INVOKE__('tauri', {
__tauriModule: 'Shell',
@@ -131,16 +143,40 @@
)
}
// drag region
//-----------------------//
// data-tauri-drag-region
//
// drag on mousedown and maximize on double click on Windows and Linux
// while macOS macos maximization should be on mouseup and if the mouse
// moves after the double click, it should be cancelled (see https://github.com/tauri-apps/tauri/issues/8306)
//-----------------------//
const TAURI_DRAG_REGION_ATTR = 'data-tauri-drag-region';
let x = 0, y = 0;
document.addEventListener('mousedown', (e) => {
if (e.target.hasAttribute('data-tauri-drag-region') && e.buttons === 1) {
if (
// element has the magic data attribute
e.target.hasAttribute(TAURI_DRAG_REGION_ATTR) &&
// and was left mouse button
e.button === 0 &&
// and was normal click to drag or double click to maximize
(e.detail === 1 || e.detail === 2)
) {
// macOS maximization happens on `mouseup`,
// so we save needed state and early return
if (osName === 'macos' && e.detail == 2) {
x = e.clientX
y = e.clientY
return
}
// prevents text cursor
e.preventDefault()
// fix #2549: double click on drag region edge causes content to maximize without window sizing change
// https://github.com/tauri-apps/tauri/issues/2549#issuecomment-1250036908
e.stopImmediatePropagation()
// start dragging if the element has a `tauri-drag-region` data attribute and maximize on double-clicking it
window.__TAURI_INVOKE__('tauri', {
__tauriModule: 'Window',
message: {
@@ -154,6 +190,34 @@
})
}
})
// on macOS we maximze on mouseup instead, to match the system behavior where maximization can be canceled
// if the mouse moves outside the data-tauri-drag-region
if (osName === "macos") {
document.addEventListener('mouseup', (e) => {
if (
// element has the magic data attribute
e.target.hasAttribute(TAURI_DRAG_REGION_ATTR) &&
// and was left mouse button
e.button === 0 &&
// and was double click
e.detail === 2 &&
// and the cursor hasn't moved from initial mousedown
e.clientX === x && e.clientY === y
) {
window.__TAURI_INVOKE__('tauri', {
__tauriModule: 'Window',
message: {
cmd: 'manage',
data: {
cmd: {
type: '__toggleMaximize'
}
}
}
})
}
})
}
let permissionSettable = false
let permissionValue = 'default'
@@ -210,7 +274,7 @@
}
window.Notification = function (title, options) {
var opts = options || {}
const opts = options || {}
sendNotification(
Object.assign(opts, {
title: title

File diff suppressed because one or more lines are too long

View File

@@ -2,19 +2,19 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
; (function () {
;(function() {
__RAW_freeze_prototype__
; (function () {
__RAW_hotkeys__
})()
;(function() {
__RAW_hotkeys__
})()
__RAW_pattern_script__
__RAW_ipc_script__
; (function () {
__RAW_bundle_script__
})()
;(function() {
__RAW_bundle_script__
})()
__RAW_listen_function__
@@ -22,13 +22,5 @@
__RAW_event_initialization_script__
if (window.ipc) {
window.__TAURI_INVOKE__('__initialized', { url: window.location.href })
} else {
window.addEventListener('DOMContentLoaded', function () {
window.__TAURI_INVOKE__('__initialized', { url: window.location.href })
})
}
__RAW_plugin_initialization_script__
window.__TAURI_INVOKE__('__initialized', { url: window.location.href })
})()

View File

@@ -7,7 +7,7 @@
*/
;
(function () {
(function() {
/**
* @type {string}
*/
@@ -18,6 +18,14 @@
*/
const isolationOrigin = __TEMPLATE_isolation_origin__
/**
* A runtime generated key to ensure an IPC call comes from an initialized frame.
*
* This is declared outside the `window.__TAURI_INVOKE__` definition to prevent
* the key from being leaked by `window.__TAURI_INVOKE__.toString()`.
*/
const __TAURI_INVOKE_KEY__ = __TEMPLATE_invoke_key__
/**
* @type {{queue: object[], ready: boolean, frame: HTMLElement | null}}
*/
@@ -85,6 +93,7 @@
Object.defineProperty(window, '__TAURI_IPC__', {
// todo: JSDoc this function
value: Object.freeze((message) => {
message.__TAURI_INVOKE_KEY__ = __TAURI_INVOKE_KEY__
switch (pattern) {
case 'brownfield':
window.__TAURI_POST_MESSAGE__(message)

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