Compare commits

...

143 Commits

Author SHA1 Message Date
FabianLars a71a0192b8 check progress size in last event instead 2023-10-31 13:29:38 +01:00
FabianLars e7d9efee37 emitlast event 2023-10-31 13:28:31 +01:00
FabianLars dd8bc4ab39 fix(upload) reduce amount of emitted tauri events 2023-10-31 13:23:16 +01:00
renovate[bot] 8d6045421a chore(deps): update dependency rollup to v4.2.0 (#693)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-31 11:14:58 +01:00
renovate[bot] c77cbe936d chore(deps): update dependency rollup to v4.1.6 (#692)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-31 10:51:53 +01:00
renovate[bot] 11048fd997 chore(deps): update typescript-eslint monorepo to v6.9.1 (#691)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-30 20:51:36 +01:00
Fabian-Lars f595684ba8 ci: ignore tauri-cli vite config CVE (#690) 2023-10-30 08:41:51 -03:00
renovate[bot] d472eebad2 chore(deps): update dependency rollup to v4 (#639)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-30 11:02:52 +01:00
renovate[bot] c27699ffab chore(deps): update dependency @sveltejs/kit to v1.27.2 (#689)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-30 10:26:01 +01:00
renovate[bot] 68d77f999c chore(deps): update dependency @sveltejs/kit to v1.27.1 (#685)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-25 19:39:28 +02:00
Fabian-Lars 1712f27b77 feat(upload): Use BufWriter for file downloads. (#684) 2023-10-25 12:25:33 +02:00
renovate[bot] 8dd371814a chore(deps): update dependency eslint-plugin-import to v2.29.0 (#678)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-24 11:50:35 +02:00
renovate[bot] 5c3b2f7511 chore(deps): update dependency @sveltejs/kit to v1.27.0 (#681)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-24 11:17:57 +02:00
renovate[bot] 227bf5424a chore(deps): update typescript-eslint monorepo to v6.9.0 (#682)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-24 11:12:26 +02:00
renovate[bot] c25b7537e3 chore(deps): update dependency eslint to v8.52.0 (#674)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-21 10:28:46 +02:00
renovate[bot] 9e24e52164 chore(deps): update dependency @tauri-apps/cli to v1.5.5 (#672)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-19 22:54:28 +00:00
renovate[bot] 444a16ca73 chore(deps): update dependency @sveltejs/kit to v1.26.0 (#668)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-19 12:53:41 +02:00
renovate[bot] cff0cdeaa8 chore(deps): update dependency svelte to v4.2.2 (#670)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-19 12:52:03 +02:00
dependabot[bot] 57c1db41a3 chore(deps): bump rustix from 0.37.23 to 0.37.25 (#669)
Bumps [rustix](https://github.com/bytecodealliance/rustix) from 0.37.23 to 0.37.25.
- [Release notes](https://github.com/bytecodealliance/rustix/releases)
- [Commits](https://github.com/bytecodealliance/rustix/compare/v0.37.23...v0.37.25)

---
updated-dependencies:
- dependency-name: rustix
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-19 12:43:17 +02:00
renovate[bot] 6630e5db75 fix(deps): update tauri monorepo (#665)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-18 12:50:05 +02:00
renovate[bot] 662c61826b chore(deps): update dependency vite to v4.5.0 (#666)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-18 12:45:03 +02:00
renovate[bot] 44df7726ae chore(deps): update typescript-eslint monorepo to v6.8.0 (#664)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-16 19:43:23 +02:00
renovate[bot] b4535af927 chore(deps): update dependency eslint-plugin-n to v16.2.0 (#651)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-16 19:33:00 +02:00
Pylogmon 77b81af36c chore(sql): Refine features for sql plugin (#660)
This makes it possible to use the sqlite feature without ring for windows-aarch64 support until all dependencies update to ring 0.17
2023-10-15 18:34:47 +02:00
renovate[bot] 9b20f28d74 chore(deps): update dependency @sveltejs/kit to v1.25.2 (#647)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-10 08:59:10 +02:00
renovate[bot] 1e56d86b51 chore(deps): update typescript-eslint monorepo to v6.7.5 (#646)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-09 22:27:01 +02:00
renovate[bot] 07650ca94b chore(deps): update dependency @rollup/plugin-node-resolve to v15.2.3 (#645)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-09 11:55:42 +02:00
renovate[bot] d68d5cce60 chore(deps): update dependency @tauri-apps/cli to v1.5.2 (#643)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-08 18:55:01 +02:00
renovate[bot] faab5f6cee chore(deps): update dependency eslint-config-standard-with-typescript to v39.1.1 (#641)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-07 12:14:32 +02:00
renovate[bot] 4ecc649839 chore(deps): update dependency eslint to v8.51.0 (#640)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-07 11:19:51 +02:00
renovate[bot] 9f27e6e441 chore(deps): update dependency @rollup/plugin-typescript to v11.1.5 (#638)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-05 17:33:33 +02:00
renovate[bot] 3f0917bd50 chore(deps): update dependency @rollup/plugin-terser to v0.4.4 (#637)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-05 17:11:22 +02:00
renovate[bot] 9048f80a4e chore(deps): update dependency @rollup/plugin-node-resolve to v15.2.2 (#636)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-05 17:05:30 +02:00
mellobacon ac7390973b feat(log): Custom .log file names (#633)
* feat (log): custom .log file names

* fix (log): corrected typo

* chore (log): refactor

* chore (log): replaced empty string with Option

* Apply suggestions from code review

* Update plugins/log/src/lib.rs

---------

Co-authored-by: Fabian-Lars <fabianlars@fabianlars.de>
2023-10-05 15:24:04 +02:00
renovate[bot] d5f5d78830 chore(deps): update dependency vite to v4.4.11 (#635)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-05 13:51:01 +02:00
renovate[bot] 1f799ae25e chore(deps): update dependency vite to v4.4.10 (#632)
* chore(deps): update dependency vite to v4.4.10

* update postcss to fix audit

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: FabianLars <fabianlars@fabianlars.de>
2023-10-04 11:47:49 +02:00
renovate[bot] fa32d1afa9 chore(deps): update dependency @tauri-apps/cli to v1.5.1 (#630)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-03 17:36:00 +02:00
renovate[bot] f41d3e5e77 chore(deps): update typescript-eslint monorepo to v6.7.4 (#631)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-03 16:34:35 +02:00
renovate[bot] 9b96996b5a fix(deps): update tauri monorepo to v1.5.0 (#626)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-29 11:59:59 +02:00
renovate[bot] 9af4c3727c chore(deps): update dependency rollup to v3.29.4 (#624)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-28 11:47:03 +02:00
Xinyu Yang 3d279094d4 fix(positioner): Prevent tray relative windows from being moved off-screen (#291)
* feat: add system tray positioning method

* apply patch

* remove pos

* fix linter

* fix cargo fmt

* linter

* add changefile

* Update and rename stronghold-tray-position.md to tray-position.md

---------

Co-authored-by: Fabian-Lars <fabianlars@fabianlars.de>
2023-09-27 15:55:44 +02:00
renovate[bot] 6c7a4c0984 chore(deps): update dependency eslint-config-standard-with-typescript to v39 (#622)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-26 21:00:16 +02:00
renovate[bot] 1c17161f2a chore(deps): update dependency eslint-plugin-n to v16.1.0 (#580)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-26 18:55:07 +02:00
renovate[bot] 6111c7f3da fix(deps): update rust crate notify-debouncer-mini to 0.4 (#577)
* fix(deps): update rust crate notify-debouncer-mini to 0.4

* Update lib.rs

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Fabian-Lars <fabianlars@fabianlars.de>
2023-09-26 18:54:26 +02:00
renovate[bot] 746067bb70 fix(deps): update rust crate auto-launch to 0.5 (#621)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-26 18:53:46 +02:00
renovate[bot] 0623903f12 chore(deps): update dependency eslint to v8.50.0 (#618)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-26 18:38:06 +02:00
renovate[bot] 043de033b0 chore(deps): update dependency @rollup/plugin-node-resolve to v15.2.1 (#572)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-26 18:36:46 +02:00
renovate[bot] 7432a399db fix(deps): update rust crate aho-corasick to 1.1 (#620)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-26 18:36:26 +02:00
renovate[bot] 305c5793ae chore(deps): update dependency eslint-plugin-import to v2.28.1 (#575)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-26 18:30:56 +02:00
renovate[bot] 4a39b74d5c chore(deps): update dependency typescript to v5.2.2 (#619)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-26 18:29:31 +02:00
renovate[bot] dc5a14b6ad chore(deps): update dependency tslib to v2.6.2 (#574)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-26 18:24:12 +02:00
renovate[bot] 2b65e0a149 chore(deps): update typescript-eslint monorepo to v6.7.3 (#579)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-26 17:00:30 +02:00
renovate[bot] beb9095f11 chore(deps): update dependency rollup to v3.29.3 (#581)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-26 16:59:51 +02:00
renovate[bot] 418294b1a3 chore(deps): update dependency svelte-check to v3.5.2 (#617)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-26 16:51:09 +02:00
renovate[bot] 3febb72f28 chore(deps): update dependency svelte to v4.2.1 (#616)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-26 16:38:45 +02:00
renovate[bot] 90fecadb86 chore(deps): update dependency prettier to v3.0.3 (#615)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-26 16:26:36 +02:00
dependabot[bot] 63834d9b63 chore(deps): bump tungstenite from 0.20.0 to 0.20.1 (#614)
Bumps [tungstenite](https://github.com/snapview/tungstenite-rs) from 0.20.0 to 0.20.1.
- [Changelog](https://github.com/snapview/tungstenite-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/snapview/tungstenite-rs/compare/v0.20.0...v0.20.1)

---
updated-dependencies:
- dependency-name: tungstenite
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-26 16:22:07 +02:00
renovate[bot] 8654caa26e chore(deps): update dependency @rollup/plugin-typescript to v11.1.4 (#586)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-26 16:21:12 +02:00
renovate[bot] 473991371d chore(deps): update dependency @sveltejs/kit to v1.25.1 (#584)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-26 15:58:34 +02:00
Fabian-Lars e98e8eac3d fix(docs): Revert a single change from #612 (#613) 2023-09-26 16:44:51 +03:00
Praveen Ravichandran 44d8f60e0d fix(typo): fixed some language related issues in the documentation (#612) 2023-09-26 09:25:22 +03:00
Lorenzo Castellino b04bde3461 fix: small typo in README (#611)
"te" -> "the"
2023-09-24 17:19:46 +02:00
Fabian-Lars 0190f68f1d fix(sql): split up datatypes more granular, fixes #462 (#608) 2023-09-20 12:03:30 +02:00
Fabian-Lars 5b85dd22c7 fix(sql): decode float columns as f32, closes #602 (#607) 2023-09-20 07:30:12 +02:00
Lucas Fernandes Nogueira 76832e60bf Revert "fix(deps): update rust crate rust-argon2 to v2 (#552)" (#565)
This reverts commit 83148da959.

Co-authored-by: FabianLars <fabianlars@fabianlars.de>
2023-09-19 16:34:47 +02:00
dependabot[bot] 5b814f56e6 chore(deps): bump rustls-webpki from 0.101.2 to 0.101.4 (#582)
Bumps [rustls-webpki](https://github.com/rustls/webpki) from 0.101.2 to 0.101.4.
- [Release notes](https://github.com/rustls/webpki/releases)
- [Commits](https://github.com/rustls/webpki/compare/v/0.101.2...v/0.101.4)

---
updated-dependencies:
- dependency-name: rustls-webpki
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-23 08:16:29 +02:00
renovate[bot] 6647e6ea90 chore(deps): update dependency prettier to v3.0.2 (#563)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-15 21:00:35 +02:00
renovate[bot] 83148da959 fix(deps): update rust crate rust-argon2 to v2 (#552)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-15 10:11:04 -03:00
renovate[bot] e8d7e765e7 chore(deps): update dependency svelte to v4.2.0 (#550)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-15 08:01:32 -03:00
renovate[bot] 76bcecf5b2 chore(deps): update dependency rollup to v3.28.0 (#544)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-15 07:47:58 -03:00
renovate[bot] d49aa664e9 chore(deps): update dependency eslint to v8.47.0 (#549)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-15 07:47:30 -03:00
renovate[bot] bd0d88243a chore(deps): update dependency svelte-check to v3.5.0 (#551)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-15 07:44:43 -03:00
renovate[bot] f001df870f chore(deps): update dependency @sveltejs/kit to v1.22.6 (#548)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-15 07:44:09 -03:00
renovate[bot] 72a6e3ba68 chore(deps): update typescript-eslint monorepo to v6.4.0 (#538)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-15 07:43:48 -03:00
Lorenzo Rizzotti 7e58dc8502 feat(websocket): add custom headers feature (#542)
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
2023-08-08 13:18:20 -03:00
Lorenzo Rizzotti ac495b9fb4 fix(websocket): config (#541)
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
2023-08-08 10:32:34 -03:00
Alexandre Dang dacde1629d feat(stronghold): add an init function that uses argon2 (#449)
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
2023-08-08 09:36:16 -03:00
renovate[bot] 700549ab02 chore(deps): update dependency prettier to v3.0.1 (#532)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-07 09:37:51 -03:00
renovate[bot] 811b1ec12d chore(deps): update dependency vite to v4.4.9 (#537)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-07 09:36:47 -03:00
renovate[bot] 174c5e52e3 chore(deps): update dependency rollup to v3.27.2 (#534)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-07 08:35:52 -03:00
renovate[bot] 37d057df61 chore(deps): update dependency eslint-config-prettier to v9 (#535)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-07 08:35:35 -03:00
renovate[bot] cdb77c4b65 chore(deps): update dependency eslint-plugin-import to v2.28.0 (#520)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-02 12:05:41 -03:00
renovate[bot] e47dca954f chore(deps): update dependency rollup to v3.27.0 (#522)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-02 07:40:45 -03:00
renovate[bot] 94f62d2503 chore(deps): update typescript-eslint monorepo to v6.2.1 (#528)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-02 07:40:34 -03:00
renovate[bot] ee0d314bb5 chore(deps): update dependency svelte to v4.1.2 (#524)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-01 18:14:12 +02:00
renovate[bot] ae8a581f9a chore(deps): update dependency @sveltejs/kit to v1.22.4 (#525)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-01 18:06:12 +02:00
renovate[bot] 67bff4559d chore(deps): update dependency vite to v4.4.8 (#529)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-01 18:01:29 +02:00
renovate[bot] d272bde2bb chore(deps): update dependency eslint to v8.46.0 (#521)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-28 18:50:40 +02:00
renovate[bot] 919616d7d3 chore(deps): update typescript-eslint monorepo to v6.2.0 (#514)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-27 14:16:30 +02:00
renovate[bot] b60b46a0b8 chore(deps): update dependency svelte to v4.1.1 (#508)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-27 14:15:02 +02:00
renovate[bot] 6d8f517148 chore(deps): update dependency tslib to v2.6.1 (#515)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-27 14:04:12 +02:00
renovate[bot] 949c59f8a5 chore(deps): update dependency vite to v4.4.7 (#510)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-27 14:02:51 +02:00
renovate[bot] b99844706e chore(deps): update dependency eslint-config-prettier to v8.9.0 (#517)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-27 14:01:27 +02:00
renovate[bot] 92514cca47 fix(deps): update rust crate tokio-tungstenite to 0.20 (#513)
* fix(deps): update rust crate tokio-tungstenite to 0.20

* adapt new websocket config struct

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: FabianLars <fabianlars@fabianlars.de>
2023-07-24 12:22:22 +02:00
renovate[bot] 81fb450c39 chore(deps): update dependency eslint-config-standard-with-typescript to v37 (#512)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-22 21:28:33 +02:00
renovate[bot] c3a6dab24c chore(deps): update dependency eslint-config-standard-with-typescript to v36.1.1 (#511)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-22 09:34:05 +02:00
renovate[bot] 0863f800b8 chore(deps): update dependency rollup to v3.26.3 (#503)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-18 10:55:58 +02:00
renovate[bot] 600ad30756 chore(deps): update typescript-eslint monorepo to v6.1.0 (#505)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-18 10:43:33 +02:00
David Blythe 51f20b438e MySQL examples (#501)
* Update README.md

* Update index.ts
2023-07-16 22:24:20 +02:00
renovate[bot] 4fd6b58070 chore(deps): update dependency eslint-config-standard-with-typescript to v36.1.0 (#500)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-15 11:12:31 +02:00
renovate[bot] c8c6d56d1b chore(deps): update dependency vite to v4.4.4 (#496)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-14 20:27:41 +02:00
renovate[bot] 2ed0fd716c chore(deps): update dependency eslint-config-standard-with-typescript to v36.0.1 (#497)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-14 20:08:24 +02:00
renovate[bot] 8286b06198 chore(deps): update dependency eslint to v8.45.0 (#498)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-14 20:00:08 +02:00
renovate[bot] 180ec441aa fix(deps): update rust crate iota-crypto to 0.23 (#495)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-13 22:40:05 +02:00
renovate[bot] 07f3a89df0 chore(deps): update dependency @sveltejs/kit to v1.22.3 (#493)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-13 09:59:57 +02:00
renovate[bot] c009cb383f chore(deps): update dependency eslint-plugin-n to v16.0.1 (#485)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-11 21:34:37 +02:00
renovate[bot] 00915af7e7 chore(deps): update dependency @sveltejs/kit to v1.22.2 (#484)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-11 21:29:57 +02:00
renovate[bot] c499238892 chore(deps): update dependency svelte to v4.0.5 (#486)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-11 19:26:59 +02:00
renovate[bot] ac6f08f193 chore(deps): update dependency svelte-check to v3.4.6 (#487)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-11 19:17:53 +02:00
renovate[bot] 84d8a21e55 chore(deps): update dependency vite to v4.4.3 (#492)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-11 18:48:47 +02:00
renovate[bot] 280f99c5f3 chore(deps): update dependency vite to v4.4.2 (#488)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-11 18:00:15 +02:00
renovate[bot] 8c10a1b0a7 chore(deps): update dependency @rollup/plugin-node-resolve to v15.1.0 (#489)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-11 15:22:10 +02:00
renovate[bot] b6ffbe33da chore(deps): update dependency eslint to v8.44.0 (#490)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-11 15:03:06 +02:00
renovate[bot] 2f2da76aa8 chore(deps): update dependency rollup to v3.26.2 (#491)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-11 15:02:11 +02:00
renovate[bot] 9dba680114 chore(deps): update dependency tslib to v2.6.0 (#483)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-11 14:44:03 +02:00
renovate[bot] 2365c46534 fix(deps): update tauri monorepo to v1.4.0 (#482)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-11 14:39:27 +02:00
renovate[bot] 01ede23b34 chore(deps): update typescript-eslint monorepo to v6 (#481)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-11 14:36:11 +02:00
renovate[bot] a2503b795d chore(deps): update dependency typescript to v5.1.6 (#480)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-11 14:32:38 +02:00
renovate[bot] 65e6870195 chore(deps): update dependency @rollup/plugin-typescript to v11.1.2 (#479)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-11 14:16:38 +02:00
renovate[bot] ec74b2d69a chore(deps): update dependency @rollup/plugin-terser to v0.4.3 (#478)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-11 14:13:25 +02:00
Fabian-Lars 6845cefc82 chore: Lock npm deps versions (#477)
* chore: Lock npm deps versions

* lock ws example too

* override optionator
2023-07-11 14:09:35 +02:00
renovate[bot] 2a8e168149 fix(deps): update rust crate iota-crypto to 0.22 (#475)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-11 11:49:09 +02:00
Fabian-Lars efcc3df3fe chore: Update pnpm to v7.33.1 (#472) 2023-07-10 15:39:29 +02:00
Fabian-Lars 9e440d27ae chore: Re-add changefiles from #416 and #422 (#457)
This reverts commit 8916544034.
2023-07-10 12:51:28 +02:00
github-actions[bot] 395ff65547 Publish New Versions (#470)
* publish new versions

* Update Cargo.toml

---------

Co-authored-by: FabianLars <FabianLars@users.noreply.github.com>
Co-authored-by: Fabian-Lars <fabianlars@fabianlars.de>
2023-07-10 12:29:59 +02:00
Fabian-Lars ad3028646c fix(persisted-scope): separately save asset protocol patterns (#459) 2023-07-10 11:22:11 +02:00
renovate[bot] 0d0ed7b907 chore(deps): update dependency prettier to v3 (#467)
* chore(deps): update dependency prettier to v3

* fmt

* semver override

* update example deps

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: FabianLars <fabianlars@fabianlars.de>
2023-07-06 11:47:41 +02:00
renovate[bot] 92233ea64a fix(deps): update rust crate sqlx to 0.7. plugin-sql msrv is now 1.65 (#464)
* fix(deps): update rust crate sqlx to 0.7

* Update sql's msrv in workflow to 1.65

* Update README.md

* Update Cargo.toml

* Update Cargo.toml

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Fabian-Lars <fabianlars@fabianlars.de>
2023-07-05 10:46:51 +02:00
renovate[bot] 36b7296746 chore(deps): update dependency svelte to v4 (#453)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-30 10:52:33 +02:00
renovate[bot] d9b2331237 chore(deps): update dependency eslint-config-standard-with-typescript to v36 (#458)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-30 10:50:38 +02:00
github-actions[bot] 8916544034 remove changefiles to publish release (#456)
Co-authored-by: FabianLars <FabianLars@users.noreply.github.com>
2023-06-30 00:26:02 +02:00
github-actions[bot] 3d4697b34a publish new versions (#417)
Co-authored-by: FabianLars <fabianlars@fabianlars.de>
2023-06-30 00:15:29 +02:00
Thibault 9174b808dc [persisted scope] fix: handle recursive directory correctly (#455)
* fix: use correct functions to allow/forbid
Without changing the data structure

* fix: wrong type passed when passing path by ref

* fix: remove '**' before allowing pattern to no trash the scope

* fmt: run fmt

* fix: Remove trailling '*' for non-recursive directories

* fix: remove superfluous asteriks recursively

* info: add changefile

* fix: remove unwated yarn.lock

* fix: simplify directories' fix and apply it to forbid_path too.

* fix: simplify path to str in fix_directory

* don't convert path back to str

* Update persisted-scope-fix-handle-glob-directories.md

---------

Co-authored-by: FabianLars <fabianlars@fabianlars.de>
2023-06-29 23:23:08 +02:00
NaokiM03 a305ad3ddb chore(fs-watch) Update Usage (#451) 2023-06-22 11:29:08 +02:00
Duke Jones 7b9d7a1d88 docs(websocket): fix readme example (#447) 2023-06-20 08:57:13 +02:00
renovate[bot] c4d2c8c693 fix(deps): update rust crate iota-crypto to 0.21 (#438)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-14 14:52:07 +02:00
amrbashir be2a90b7e2 chore: remove unneeded change file 2023-06-13 15:56:09 +03:00
Amr Bashir 417c85a2dd fix(window-state): manual default implentation (#425)
* fix(window-state): manual default implentation, closes #421

* Update lib.rs
2023-06-13 15:48:10 +03:00
Amr Bashir 617cf38069 fix(window-state): propagate promise (#435)
closes #432
2023-06-13 15:47:55 +03:00
Ludea 6ad221ed36 fix(stronghold): return null if there is no record (#129)
* [stronghold] return null if there is no record

* Return value

* return statement

* prettier

* fix function signature

* fix if condition

* simplify condition

---------

Co-authored-by: Fabian-Lars <fabianlars@fabianlars.de>
2023-06-12 19:26:08 +02:00
Fabian-Lars 0984fc8374 chore: Add branch to install instructions that use git (#433) 2023-06-12 11:20:59 +02:00
Fabian-Lars 523bcdc528 fix(window-state): correctly set decoration state if no saved state exists, fixes #421 (#424) 2023-06-07 15:19:29 +03:00
Alexandre Dang ea63b40224 fix(stronghold): change wrong argument name for remove (#422) 2023-06-07 08:09:43 -03:00
94 changed files with 2991 additions and 2025 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"stronghold-js": patch
---
Change the argument name of the `Stronghold.remove` from `location` to `recordPath` to match the Stronghold command argument
+5
View File
@@ -0,0 +1,5 @@
---
"stronghold": patch
---
Added `Builder::with_argon2`.
+5
View File
@@ -0,0 +1,5 @@
---
"positioner": patch
---
`TrayLeft`, `TrayRight` and `TrayCenter` will now position the window according to the tray position relative to the monitor dimensions to prevent windows being displayed partially off-screen.
+2
View File
@@ -45,6 +45,8 @@ jobs:
- name: build
run: cargo build --workspace --exclude 'tauri-plugin-sql' --all-targets --all-features
- uses: dtolnay/rust-toolchain@1.65.0
- name: build sql:sqlite
run: cargo build --package 'tauri-plugin-sql' --all-targets --features sqlite
+1 -1
View File
@@ -48,7 +48,7 @@ https.get(url, options, (response) => {
console.log(versions.length ? versions[0].num : "0.0.0");
} else if (kind === "npm") {
const versions = Object.keys(data.versions).filter((v) =>
v.startsWith(target)
v.startsWith(target),
);
console.log(versions[versions.length - 1] || "0.0.0");
}
Generated
+1247 -1026
View File
File diff suppressed because it is too large Load Diff
+27 -16
View File
@@ -10,23 +10,34 @@
"format-check": "prettier --check ."
},
"devDependencies": {
"@rollup/plugin-node-resolve": "^15.0.2",
"@rollup/plugin-terser": "^0.4.1",
"@rollup/plugin-typescript": "^11.1.0",
"@typescript-eslint/eslint-plugin": "^5.58.0",
"@typescript-eslint/parser": "^5.58.0",
"eslint": "^8.38.0",
"eslint-config-prettier": "^8.8.0",
"eslint-config-standard-with-typescript": "^35.0.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-n": "^16.0.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-security": "^1.7.1",
"prettier": "^2.8.7",
"rollup": "^3.20.4",
"typescript": "^5.0.4"
"@rollup/plugin-node-resolve": "15.2.3",
"@rollup/plugin-terser": "0.4.4",
"@rollup/plugin-typescript": "11.1.5",
"@typescript-eslint/eslint-plugin": "6.9.1",
"@typescript-eslint/parser": "6.9.1",
"eslint": "8.52.0",
"eslint-config-prettier": "9.0.0",
"eslint-config-standard-with-typescript": "39.1.1",
"eslint-plugin-import": "2.29.0",
"eslint-plugin-n": "16.2.0",
"eslint-plugin-promise": "6.1.1",
"eslint-plugin-security": "1.7.1",
"prettier": "3.0.3",
"rollup": "4.2.0",
"typescript": "5.2.2"
},
"resolutions": {
"semver": ">=7.5.2",
"optionator": ">=0.9.3"
},
"engines": {
"pnpm": ">=7.33.0"
"pnpm": ">=7.33.1"
},
"pnpm": {
"auditConfig": {
"ignoreCves": [
"CVE-2023-46115"
]
}
}
}
+11 -11
View File
@@ -8,11 +8,11 @@ _This plugin requires a Rust version of at least **1.64**_
There are three general methods of installation that we can recommend.
1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked)
1. Use crates.io and npm (easiest and requires you to trust that our publishing pipeline worked)
2. Pull sources directly from Github using git tags / revision hashes (most secure)
3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use)
3. Git submodule install this repo in your tauri project and then use the file protocol to ingest the source (most secure, but inconvenient to use)
Install the Core plugin by adding the following to your `Cargo.toml` file:
Install the authenticator plugin by adding the following lines to your `Cargo.toml` file:
`src-tauri/Cargo.toml`
@@ -28,16 +28,16 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa
> Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use.
```sh
pnpm add https://github.com/tauri-apps/tauri-plugin-authenticator
pnpm add https://github.com/tauri-apps/tauri-plugin-authenticator#v1
# or
npm add https://github.com/tauri-apps/tauri-plugin-authenticator
npm add https://github.com/tauri-apps/tauri-plugin-authenticator#v1
# or
yarn add https://github.com/tauri-apps/tauri-plugin-authenticator
yarn add https://github.com/tauri-apps/tauri-plugin-authenticator#v1
```
## Usage
First you need to register the core plugin with Tauri:
First, you need to register the authenticator plugin with Tauri:
`src-tauri/src/main.rs`
@@ -50,7 +50,7 @@ fn main() {
}
```
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
Afterwards, all the plugin's APIs are available through the JavaScript guest bindings:
```javascript
import { Authenticator } from "tauri-plugin-authenticator-api";
@@ -71,12 +71,12 @@ const domain = "https://tauri.app";
const json = await auth.register(challenge, domain);
const registerResult = JSON.parse(json);
// verify te registration was successfull
// verify the registration was successful
const r2 = await auth.verifyRegistration(
challenge,
app,
registerResult.registerData,
registerResult.clientData
registerResult.clientData,
);
const j2 = JSON.parse(r2);
@@ -91,7 +91,7 @@ const counter = await auth.verifySignature(
signData.signData,
clientData,
keyHandle,
pubkey
pubkey,
);
if (counter && counter > 0) {
+3 -3
View File
@@ -17,7 +17,7 @@ export class Authenticator {
challenge: string,
application: string,
registerData: string,
clientData: string
clientData: string,
): Promise<string> {
return await invoke("plugin:authenticator|verify_registration", {
challenge,
@@ -30,7 +30,7 @@ export class Authenticator {
async sign(
challenge: string,
application: string,
keyHandle: string
keyHandle: string,
): Promise<string> {
return await invoke("plugin:authenticator|sign", {
timeout: 10000,
@@ -46,7 +46,7 @@ export class Authenticator {
signData: string,
clientData: string,
keyHandle: string,
pubkey: string
pubkey: string,
): Promise<number> {
return await invoke("plugin:authenticator|verify_signature", {
challenge,
+2 -2
View File
@@ -25,9 +25,9 @@
"LICENSE"
],
"devDependencies": {
"tslib": "^2.5.0"
"tslib": "2.6.2"
},
"dependencies": {
"@tauri-apps/api": "^1.2.0"
"@tauri-apps/api": "1.5.1"
}
}
+1 -1
View File
@@ -5,7 +5,7 @@ import { createConfig } from "../../shared/rollup.config.mjs";
export default createConfig({
input: "guest-js/index.ts",
pkg: JSON.parse(
readFileSync(new URL("./package.json", import.meta.url), "utf8")
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
),
external: [/^@tauri-apps\/api/],
});
-1
View File
@@ -1 +0,0 @@
../../shared/tsconfig.json
+4
View File
@@ -0,0 +1,4 @@
{
"extends": "../../tsconfig.base.json",
"include": ["guest-js/*.ts"]
}
+1 -1
View File
@@ -15,4 +15,4 @@ serde_json.workspace = true
tauri.workspace = true
log.workspace = true
thiserror.workspace = true
auto-launch = "0.4"
auto-launch = "0.5"
+3 -3
View File
@@ -26,11 +26,11 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa
> Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use.
```sh
pnpm add https://github.com/tauri-apps/tauri-plugin-autostart
pnpm add https://github.com/tauri-apps/tauri-plugin-autostart#v1
# or
npm add https://github.com/tauri-apps/tauri-plugin-autostart
npm add https://github.com/tauri-apps/tauri-plugin-autostart#v1
# or
yarn add https://github.com/tauri-apps/tauri-plugin-autostart
yarn add https://github.com/tauri-apps/tauri-plugin-autostart#v1
```
## Usage
+2 -2
View File
@@ -24,9 +24,9 @@
"LICENSE"
],
"devDependencies": {
"tslib": "^2.5.0"
"tslib": "2.6.2"
},
"dependencies": {
"@tauri-apps/api": "^1.2.0"
"@tauri-apps/api": "1.5.1"
}
}
+1 -1
View File
@@ -5,7 +5,7 @@ import { createConfig } from "../../shared/rollup.config.mjs";
export default createConfig({
input: "guest-js/index.ts",
pkg: JSON.parse(
readFileSync(new URL("./package.json", import.meta.url), "utf8")
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
),
external: [/^@tauri-apps\/api/],
});
-1
View File
@@ -1 +0,0 @@
../../shared/tsconfig.json
+4
View File
@@ -0,0 +1,4 @@
{
"extends": "../../tsconfig.base.json",
"include": ["guest-js/*.ts"]
}
+3 -3
View File
@@ -26,11 +26,11 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa
> Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use.
```sh
pnpm add https://github.com/tauri-apps/tauri-plugin-fs-extra
pnpm add https://github.com/tauri-apps/tauri-plugin-fs-extra#v1
# or
npm add https://github.com/tauri-apps/tauri-plugin-fs-extra
npm add https://github.com/tauri-apps/tauri-plugin-fs-extra#v1
# or
yarn add https://github.com/tauri-apps/tauri-plugin-fs-extra
yarn add https://github.com/tauri-apps/tauri-plugin-fs-extra#v1
```
## Usage
+2 -2
View File
@@ -25,9 +25,9 @@
"LICENSE"
],
"devDependencies": {
"tslib": "^2.5.0"
"tslib": "2.6.2"
},
"dependencies": {
"@tauri-apps/api": "^1.2.0"
"@tauri-apps/api": "1.5.1"
}
}
+1 -1
View File
@@ -5,7 +5,7 @@ import { createConfig } from "../../shared/rollup.config.mjs";
export default createConfig({
input: "guest-js/index.ts",
pkg: JSON.parse(
readFileSync(new URL("./package.json", import.meta.url), "utf8")
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
),
external: [/^@tauri-apps\/api/],
});
-1
View File
@@ -1 +0,0 @@
../../shared/tsconfig.json
+4
View File
@@ -0,0 +1,4 @@
{
"extends": "../../tsconfig.base.json",
"include": ["guest-js/*.ts"]
}
+1 -1
View File
@@ -16,4 +16,4 @@ tauri.workspace = true
log.workspace = true
thiserror.workspace = true
notify = { version = "6" , features = ["serde"] }
notify-debouncer-mini = { version = "0.3" , features = ["serde"] }
notify-debouncer-mini = { version = "0.4" , features = ["serde"] }
+7 -7
View File
@@ -26,11 +26,11 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa
> Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use.
```sh
pnpm add https://github.com/tauri-apps/tauri-plugin-fs-watch
pnpm add https://github.com/tauri-apps/tauri-plugin-fs-watch#v1
# or
npm add https://github.com/tauri-apps/tauri-plugin-fs-watch
npm add https://github.com/tauri-apps/tauri-plugin-fs-watch#v1
# or
yarn add https://github.com/tauri-apps/tauri-plugin-fs-watch
yarn add https://github.com/tauri-apps/tauri-plugin-fs-watch#v1
```
## Usage
@@ -57,17 +57,17 @@ import { watch, watchImmediate } from "tauri-plugin-fs-watch-api";
const stopWatching = await watch(
"/path/to/something",
(event) => {
const { type, payload } = event;
const { kind, path } = event;
},
{ recursive: true }
{ recursive: true },
);
const stopRawWatcher = await watchImmediate(
["/path/a", "/path/b"],
(event) => {
const { path, operation, cookie } = event;
const { type, paths, attrs } = event;
},
{}
{},
);
```
+4 -4
View File
@@ -45,7 +45,7 @@ async function unwatch(id: number): Promise<void> {
export async function watch(
paths: string | string[],
cb: (event: DebouncedEvent) => void,
options: DebouncedWatchOptions = {}
options: DebouncedWatchOptions = {},
): Promise<UnlistenFn> {
const opts = {
recursive: false,
@@ -71,7 +71,7 @@ export async function watch(
`watcher://debounced-event/${id}`,
(event) => {
cb(event.payload);
}
},
);
return () => {
@@ -83,7 +83,7 @@ export async function watch(
export async function watchImmediate(
paths: string | string[],
cb: (event: RawEvent) => void,
options: WatchOptions = {}
options: WatchOptions = {},
): Promise<UnlistenFn> {
const opts = {
recursive: false,
@@ -109,7 +109,7 @@ export async function watchImmediate(
`watcher://raw-event/${id}`,
(event) => {
cb(event.payload);
}
},
);
return () => {
+2 -2
View File
@@ -25,9 +25,9 @@
"LICENSE"
],
"devDependencies": {
"tslib": "^2.5.0"
"tslib": "2.6.2"
},
"dependencies": {
"@tauri-apps/api": "^1.2.0"
"@tauri-apps/api": "1.5.1"
}
}
+1 -1
View File
@@ -5,7 +5,7 @@ import { createConfig } from "../../shared/rollup.config.mjs";
export default createConfig({
input: "guest-js/index.ts",
pkg: JSON.parse(
readFileSync(new URL("./package.json", import.meta.url), "utf8")
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
),
external: [/^@tauri-apps\/api/],
});
+1 -1
View File
@@ -91,7 +91,7 @@ async fn watch<R: Runtime>(
let watcher = if let Some(delay) = options.delay_ms {
let (tx, rx) = channel();
let mut debouncer = new_debouncer(Duration::from_millis(delay), None, tx)?;
let mut debouncer = new_debouncer(Duration::from_millis(delay), tx)?;
let watcher = debouncer.watcher();
for path in &paths {
watcher.watch(path, mode)?;
-1
View File
@@ -1 +0,0 @@
../../shared/tsconfig.json
+4
View File
@@ -0,0 +1,4 @@
{
"extends": "../../tsconfig.base.json",
"include": ["guest-js/*.ts"]
}
+3 -3
View File
@@ -26,11 +26,11 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa
> Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use.
```sh
pnpm add https://github.com/tauri-apps/tauri-plugin-log
pnpm add https://github.com/tauri-apps/tauri-plugin-log#v1
# or
npm add https://github.com/tauri-apps/tauri-plugin-log
npm add https://github.com/tauri-apps/tauri-plugin-log#v1
# or
yarn add https://github.com/tauri-apps/tauri-plugin-log
yarn add https://github.com/tauri-apps/tauri-plugin-log#v1
```
## Usage
+7 -7
View File
@@ -43,7 +43,7 @@ enum LogLevel {
async function log(
level: LogLevel,
message: string,
options?: LogOptions
options?: LogOptions,
): Promise<void> {
const traces = new Error().stack?.split("\n").map((line) => line.split("@"));
@@ -86,7 +86,7 @@ async function log(
*/
export async function error(
message: string,
options?: LogOptions
options?: LogOptions,
): Promise<void> {
await log(LogLevel.Error, message, options);
}
@@ -108,7 +108,7 @@ export async function error(
*/
export async function warn(
message: string,
options?: LogOptions
options?: LogOptions,
): Promise<void> {
await log(LogLevel.Warn, message, options);
}
@@ -130,7 +130,7 @@ export async function warn(
*/
export async function info(
message: string,
options?: LogOptions
options?: LogOptions,
): Promise<void> {
await log(LogLevel.Info, message, options);
}
@@ -152,7 +152,7 @@ export async function info(
*/
export async function debug(
message: string,
options?: LogOptions
options?: LogOptions,
): Promise<void> {
await log(LogLevel.Debug, message, options);
}
@@ -174,7 +174,7 @@ export async function debug(
*/
export async function trace(
message: string,
options?: LogOptions
options?: LogOptions,
): Promise<void> {
await log(LogLevel.Trace, message, options);
}
@@ -193,7 +193,7 @@ export async function attachConsole(): Promise<UnlistenFn> {
// TODO: Investigate security/detect-unsafe-regex
// eslint-disable-next-line no-control-regex, security/detect-unsafe-regex
/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,
""
"",
);
switch (payload.level) {
+2 -2
View File
@@ -25,9 +25,9 @@
"LICENSE"
],
"devDependencies": {
"tslib": "^2.5.0"
"tslib": "2.6.2"
},
"dependencies": {
"@tauri-apps/api": "^1.2.0"
"@tauri-apps/api": "1.5.1"
}
}
+1 -1
View File
@@ -5,7 +5,7 @@ import { createConfig } from "../../shared/rollup.config.mjs";
export default createConfig({
input: "guest-js/index.ts",
pkg: JSON.parse(
readFileSync(new URL("./package.json", import.meta.url), "utf8")
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
),
external: [/^@tauri-apps\/api/],
});
+35 -7
View File
@@ -118,7 +118,7 @@ pub enum LogTarget {
///
/// The plugin will ensure the directory exists before writing logs.
Folder(PathBuf),
/// Write logs to the OS specififc logs directory.
/// Write logs to the OS specific logs directory.
///
/// ### Platform-specific
///
@@ -167,6 +167,7 @@ pub struct Builder {
timezone_strategy: TimezoneStrategy,
max_file_size: u128,
targets: Vec<LogTarget>,
log_name: Option<String>,
}
impl Default for Builder {
@@ -189,6 +190,7 @@ impl Default for Builder {
timezone_strategy: DEFAULT_TIMEZONE_STRATEGY,
max_file_size: DEFAULT_MAX_FILE_SIZE,
targets: DEFAULT_LOG_TARGETS.into(),
log_name: None,
}
}
}
@@ -262,6 +264,29 @@ impl Builder {
self
}
/// Writes logs to the given file. Default: <app_name>.log)
///
/// Note: This does not modify the directory logs go into. For that refer to `LogTarget::Folder`.
///
/// # Examples
///
/// ```
/// use tauri_plugin_log::Builder;
/// let name = "custom-name";
/// let builder = Builder::default()
/// .targets([
/// LogTarget::LogDir
/// ])
/// .log_name(name)
/// .build()
/// ); // Outputs content to custom-name.log
///
/// ```
pub fn log_name<S: Into<String>>(mut self, log_name: S) -> Self {
self.log_name = Some(log_name.into());
self
}
#[cfg(feature = "colored")]
pub fn with_colors(self, colors: fern::colors::ColoredLevelConfig) -> Self {
let format =
@@ -284,7 +309,10 @@ impl Builder {
plugin::Builder::new("log")
.invoke_handler(tauri::generate_handler![log])
.setup(move |app_handle| {
let app_name = &app_handle.package_info().name;
let log_name = self
.log_name
.as_deref()
.unwrap_or_else(|| &app_handle.package_info().name);
// setup targets
for target in &self.targets {
@@ -298,7 +326,7 @@ impl Builder {
fern::log_file(get_log_file_path(
&path,
app_name,
log_name,
&self.rotation_strategy,
&self.timezone_strategy,
self.max_file_size,
@@ -313,7 +341,7 @@ impl Builder {
fern::log_file(get_log_file_path(
&path,
app_name,
log_name,
&self.rotation_strategy,
&self.timezone_strategy,
self.max_file_size,
@@ -347,12 +375,12 @@ impl Builder {
fn get_log_file_path(
dir: &impl AsRef<Path>,
app_name: &str,
log_name: &str,
rotation_strategy: &RotationStrategy,
timezone_strategy: &TimezoneStrategy,
max_file_size: u128,
) -> plugin::Result<PathBuf> {
let path = dir.as_ref().join(format!("{app_name}.log"));
let path = dir.as_ref().join(format!("{log_name}.log"));
if path.exists() {
let log_size = File::open(&path)?.metadata()?.len() as u128;
@@ -361,7 +389,7 @@ fn get_log_file_path(
RotationStrategy::KeepAll => {
let to = dir.as_ref().join(format!(
"{}_{}.log",
app_name,
log_name,
timezone_strategy
.get_now()
.format(
-1
View File
@@ -1 +0,0 @@
../../shared/tsconfig.json
+4
View File
@@ -0,0 +1,4 @@
{
"extends": "../../tsconfig.base.json",
"include": ["guest-js/*.ts"]
}
+10
View File
@@ -1,5 +1,15 @@
# Changelog
## \[0.1.3]
- Split up fs and asset scopes. **This will reset the asset protocol scope once!**
- [ad30286](https://github.com/tauri-apps/plugins-workspace/commit/ad3028646c96ed213a2f483823ffdc3c17b5fc1e) fix(persisted-scope): separately save asset protocol patterns ([#459](https://github.com/tauri-apps/plugins-workspace/pull/459)) on 2023-07-10
## \[0.1.2]
- Fix usage of directory patterns by removing glob asterisks at the end before allowing/forbidding them. This was causing them to be escaped, and so undesirable paths were allowed/forbidden while polluting the `.persisted_scope` file.
- [9174b80](https://github.com/tauri-apps/plugins-workspace/commit/9174b808dc37154999c119fcc3f31258a9c5a3fb) \[persisted scope] fix: handle recursive directory correctly ([#455](https://github.com/tauri-apps/plugins-workspace/pull/455)) on 2023-06-29
## \[0.1.1]
- The MSRV was raised to 1.64!
+2 -2
View File
@@ -1,6 +1,6 @@
[package]
name = "tauri-plugin-persisted-scope"
version = "0.1.1"
version = "0.1.3"
description = "Save filesystem and asset scopes and restore them when the app is reopened."
authors.workspace = true
license.workspace = true
@@ -15,7 +15,7 @@ serde_json.workspace = true
tauri.workspace = true
log.workspace = true
thiserror.workspace = true
aho-corasick = "1.0"
aho-corasick = "1.1"
bincode = "1"
[features]
+118 -21
View File
@@ -6,7 +6,7 @@ use aho_corasick::AhoCorasick;
use serde::{Deserialize, Serialize};
use tauri::{
plugin::{Builder, TauriPlugin},
AppHandle, FsScopeEvent, Manager, Runtime,
FsScope, FsScopeEvent, Manager, Runtime,
};
use std::{
@@ -15,7 +15,10 @@ use std::{
path::Path,
};
// Using 2 separate files so that we don't have to think about write conflicts and not break backwards compat.
const SCOPE_STATE_FILENAME: &str = ".persisted-scope";
#[cfg(feature = "protocol-asset")]
const ASSET_SCOPE_STATE_FILENAME: &str = ".persisted-scope-asset";
// Most of these patterns are just added to try to fix broken files in the wild.
// After a while we can hopefully reduce it to something like [r"[?]", r"[*]", r"\\?\\\?\"]
@@ -42,6 +45,14 @@ enum Error {
Bincode(#[from] Box<bincode::ErrorKind>),
}
#[derive(Debug, Default, Deserialize, Serialize, Eq, PartialEq, Hash)]
enum TargetType {
#[default]
File,
Directory,
RecursiveDirectory,
}
#[derive(Debug, Default, Deserialize, Serialize)]
struct Scope {
allowed_paths: Vec<String>,
@@ -58,16 +69,74 @@ fn fix_pattern(ac: &AhoCorasick, s: &str) -> String {
s
}
fn save_scopes<R: Runtime>(app: &AppHandle<R>, app_dir: &Path, scope_state_path: &Path) {
let fs_scope = app.fs_scope();
const RESURSIVE_DIRECTORY_SUFFIX: &str = "**";
const DIRECTORY_SUFFIX: &str = "*";
fn detect_scope_type(scope_state_path: &str) -> TargetType {
if scope_state_path.ends_with(RESURSIVE_DIRECTORY_SUFFIX) {
TargetType::RecursiveDirectory
} else if scope_state_path.ends_with(DIRECTORY_SUFFIX) {
TargetType::Directory
} else {
TargetType::File
}
}
fn fix_directory(path_str: &str) -> &Path {
let mut path = Path::new(path_str);
if path.ends_with(DIRECTORY_SUFFIX) || path.ends_with(RESURSIVE_DIRECTORY_SUFFIX) {
path = match path.parent() {
Some(value) => value,
None => return path,
};
}
path
}
fn allow_path(scope: &FsScope, path: &str) {
let target_type = detect_scope_type(path);
match target_type {
TargetType::File => {
let _ = scope.allow_file(path);
}
TargetType::Directory => {
// We remove the '*' at the end of it, else it will be escaped by the pattern.
let _ = scope.allow_directory(fix_directory(path), false);
}
TargetType::RecursiveDirectory => {
// We remove the '**' at the end of it, else it will be escaped by the pattern.
let _ = scope.allow_directory(fix_directory(path), true);
}
}
}
fn forbid_path(scope: &FsScope, path: &str) {
let target_type = detect_scope_type(path);
match target_type {
TargetType::File => {
let _ = scope.forbid_file(path);
}
TargetType::Directory => {
let _ = scope.forbid_directory(fix_directory(path), false);
}
TargetType::RecursiveDirectory => {
let _ = scope.forbid_directory(fix_directory(path), true);
}
}
}
fn save_scopes(scope: &FsScope, app_dir: &Path, scope_state_path: &Path) {
let scope = Scope {
allowed_paths: fs_scope
allowed_paths: scope
.allowed_patterns()
.into_iter()
.map(|p| p.to_string())
.collect(),
forbidden_patterns: fs_scope
forbidden_patterns: scope
.forbidden_patterns()
.into_iter()
.map(|p| p.to_string())
@@ -93,46 +162,74 @@ pub fn init<R: Runtime>() -> TauriPlugin<R> {
let app_dir = app.path_resolver().app_data_dir();
if let Some(app_dir) = app_dir {
let scope_state_path = app_dir.join(SCOPE_STATE_FILENAME);
let _ = fs_scope.forbid_file(&scope_state_path);
let fs_scope_state_path = app_dir.join(SCOPE_STATE_FILENAME);
#[cfg(feature = "protocol-asset")]
let _ = asset_protocol_scope.forbid_file(&scope_state_path);
let asset_scope_state_path = app_dir.join(ASSET_SCOPE_STATE_FILENAME);
let _ = fs_scope.forbid_file(&fs_scope_state_path);
#[cfg(feature = "protocol-asset")]
let _ = asset_protocol_scope.forbid_file(&asset_scope_state_path);
// We're trying to fix broken .persisted-scope files seamlessly, so we'll be running this on the values read on the saved file.
// We will still save some semi-broken values because the scope events are quite spammy and we don't want to reduce runtime performance any further.
let ac = AhoCorasick::new(PATTERNS).unwrap(/* This should be impossible to fail since we're using a small static input */);
if scope_state_path.exists() {
let scope: Scope = tauri::api::file::read_binary(&scope_state_path)
if fs_scope_state_path.exists() {
let scope: Scope = tauri::api::file::read_binary(&fs_scope_state_path)
.map_err(Error::from)
.and_then(|scope| bincode::deserialize(&scope).map_err(Into::into))
.unwrap_or_default();
for allowed in &scope.allowed_paths {
let allowed = fix_pattern(&ac, allowed);
let _ = fs_scope.allow_file(&allowed);
#[cfg(feature = "protocol-asset")]
let _ = asset_protocol_scope.allow_file(&allowed);
allow_path(&fs_scope, &allowed);
}
for forbidden in &scope.forbidden_patterns {
let forbidden = fix_pattern(&ac, forbidden);
let _ = fs_scope.forbid_file(&forbidden);
#[cfg(feature = "protocol-asset")]
let _ = asset_protocol_scope.forbid_file(&forbidden);
forbid_path(&fs_scope, &forbidden);
}
// Manually save the fixed scopes to disk once.
// This is needed to fix broken .peristed-scope files in case the app doesn't update the scope itself.
save_scopes(&app, &app_dir, &scope_state_path);
save_scopes(&fs_scope, &app_dir, &fs_scope_state_path);
}
#[cfg(feature = "protocol-asset")]
if asset_scope_state_path.exists() {
let scope: Scope = tauri::api::file::read_binary(&asset_scope_state_path)
.map_err(Error::from)
.and_then(|scope| bincode::deserialize(&scope).map_err(Into::into))
.unwrap_or_default();
for allowed in &scope.allowed_paths {
let allowed = fix_pattern(&ac, allowed);
allow_path(&asset_protocol_scope, &allowed);
}
for forbidden in &scope.forbidden_patterns {
let forbidden = fix_pattern(&ac, forbidden);
forbid_path(&asset_protocol_scope, &forbidden);
}
// Manually save the fixed scopes to disk once.
save_scopes(&asset_protocol_scope, &app_dir, &asset_scope_state_path);
}
#[cfg(feature = "protocol-asset")]
let app_dir_ = app_dir.clone();
let fs_scope_ = fs_scope.clone();
fs_scope.listen(move |event| {
if let FsScopeEvent::PathAllowed(_) = event {
save_scopes(&app, &app_dir, &scope_state_path);
save_scopes(&fs_scope_, &app_dir, &fs_scope_state_path);
}
});
#[cfg(feature = "protocol-asset")]
{
let asset_protocol_scope_ = asset_protocol_scope.clone();
asset_protocol_scope.listen(move |event| {
if let FsScopeEvent::PathAllowed(_) = event {
save_scopes(&asset_protocol_scope_, &app_dir_, &asset_scope_state_path);
}
});}
}
Ok(())
})
+3 -3
View File
@@ -40,11 +40,11 @@ yarn add tauri-plugin-positioner-api
Or through git:
```sh
pnpm add https://github.com/tauri-apps/tauri-plugin-positioner
pnpm add https://github.com/tauri-apps/tauri-plugin-positioner#v1
# or
npm add https://github.com/tauri-apps/tauri-plugin-positioner
npm add https://github.com/tauri-apps/tauri-plugin-positioner#v1
# or
yarn add https://github.com/tauri-apps/tauri-plugin-positioner
yarn add https://github.com/tauri-apps/tauri-plugin-positioner#v1
```
## Usage
+2 -2
View File
@@ -25,9 +25,9 @@
"LICENSE"
],
"devDependencies": {
"tslib": "^2.5.0"
"tslib": "2.6.2"
},
"dependencies": {
"@tauri-apps/api": "^1.2.0"
"@tauri-apps/api": "1.5.1"
}
}
+1 -1
View File
@@ -5,7 +5,7 @@ import { createConfig } from "../../shared/rollup.config.mjs";
export default createConfig({
input: "guest-js/index.ts",
pkg: JSON.parse(
readFileSync(new URL("./package.json", import.meta.url), "utf8")
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
),
external: [/^@tauri-apps\/api/],
});
+36 -13
View File
@@ -107,13 +107,20 @@ impl<R: Runtime> WindowExt for Window<R> {
},
#[cfg(feature = "system-tray")]
TrayLeft => {
if let Some((tray_x, tray_y)) = tray_position {
PhysicalPosition {
x: tray_x,
y: tray_y - window_size.height,
}
if let (Some((tray_x, tray_y)), Some((_, _tray_height))) =
(tray_position, tray_size)
{
let y = tray_y - window_size.height;
// Choose y value based on the target OS
#[cfg(target_os = "windows")]
let y = if y < 0 { tray_y + _tray_height } else { y };
#[cfg(target_os = "macos")]
let y = if y < 0 { tray_y } else { y };
PhysicalPosition { x: tray_x, y }
} else {
panic!("tray position not set");
panic!("Tray position not set");
}
}
#[cfg(feature = "system-tray")]
@@ -129,11 +136,20 @@ impl<R: Runtime> WindowExt for Window<R> {
}
#[cfg(feature = "system-tray")]
TrayRight => {
if let (Some((tray_x, tray_y)), Some((tray_width, _))) = (tray_position, tray_size)
if let (Some((tray_x, tray_y)), Some((tray_width, _tray_height))) =
(tray_position, tray_size)
{
let y = tray_y - window_size.height;
// Choose y value based on the target OS
#[cfg(target_os = "windows")]
let y = if y < 0 { tray_y + _tray_height } else { y };
#[cfg(target_os = "macos")]
let y = if y < 0 { tray_y } else { y };
PhysicalPosition {
x: tray_x + tray_width,
y: tray_y - window_size.height,
y,
}
} else {
panic!("Tray position not set");
@@ -153,12 +169,19 @@ impl<R: Runtime> WindowExt for Window<R> {
}
#[cfg(feature = "system-tray")]
TrayCenter => {
if let (Some((tray_x, tray_y)), Some((tray_width, _))) = (tray_position, tray_size)
if let (Some((tray_x, tray_y)), Some((tray_width, _tray_height))) =
(tray_position, tray_size)
{
PhysicalPosition {
x: tray_x + (tray_width / 2) - (window_size.width / 2),
y: tray_y - window_size.height,
}
let x = tray_x + tray_width / 2 - window_size.width / 2;
let y = tray_y - window_size.height;
// Choose y value based on the target OS
#[cfg(target_os = "windows")]
let y = if y < 0 { tray_y + _tray_height } else { y };
#[cfg(target_os = "macos")]
let y = if y < 0 { tray_y } else { y };
PhysicalPosition { x, y }
} else {
panic!("Tray position not set");
}
-1
View File
@@ -1 +0,0 @@
../../shared/tsconfig.json
+4
View File
@@ -0,0 +1,4 @@
{
"extends": "../../tsconfig.base.json",
"include": ["guest-js/*.ts"]
}
@@ -9,6 +9,6 @@
"author": "",
"license": "MIT",
"devDependencies": {
"@tauri-apps/cli": "^1.2.3"
"@tauri-apps/cli": "1.5.5"
}
}
-106
View File
@@ -1,106 +0,0 @@
lockfileVersion: 5.4
specifiers:
'@tauri-apps/cli': ^1.0.0
dependencies:
'@tauri-apps/cli': 1.0.2
packages:
/@tauri-apps/cli-darwin-arm64/1.0.2:
resolution: {integrity: sha512-Ahd951yoYon1+WLNBg6xsx6Bb7+GJt7WwC1FllHZ2/iLCbrtWCS2qfeLS0L4ngBqCuWyL35JC/M2LIr9mcUzrg==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [darwin]
requiresBuild: true
dev: false
optional: true
/@tauri-apps/cli-darwin-x64/1.0.2:
resolution: {integrity: sha512-8wo+SN1zWoXFQVa/iyEt3Cs0vNMjxDXqVe3Srm4UNpgKboFN5mIgbugwqvM+aJKnEZAH8h8n+ZJUHzc4wtPGHA==}
engines: {node: '>= 10'}
cpu: [x64]
os: [darwin]
requiresBuild: true
dev: false
optional: true
/@tauri-apps/cli-linux-arm-gnueabihf/1.0.2:
resolution: {integrity: sha512-PGQghMn0adt9PTnyi2K2o/CLG3tWbOyZvwQjam5cfQbK757WmMgPErC1VqsxiQc+PItWYvqoE9gjANiFc2MpAQ==}
engines: {node: '>= 10'}
cpu: [arm]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@tauri-apps/cli-linux-arm64-gnu/1.0.2:
resolution: {integrity: sha512-Uc+XNlWelrnRh7DYrdxBi8Oam9JAQM1GzgEwjupF6Pv7BwlODN7s0HImGPQOKrEkqzpfmYw7KpfgWiiEjS5/3Q==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@tauri-apps/cli-linux-arm64-musl/1.0.2:
resolution: {integrity: sha512-lVwCG1QzQs2zWP32H4+Dw8NKgJ6hBox2X+bmawGfV9Ce+K4P84bnqfNgpdaSAncjeiTjrO+g7yT9gJFQCOrjlQ==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@tauri-apps/cli-linux-x64-gnu/1.0.2:
resolution: {integrity: sha512-G2XmGxvufW9sgGhA3rx+HehcifVTUo8zyISd8DpvGwtpp6Z4WakbivzKFyGiNnnok0nvj/WUrLgBxtUbfdSY+A==}
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@tauri-apps/cli-linux-x64-musl/1.0.2:
resolution: {integrity: sha512-/eX536p+KXSmkFuINGeU6EQmYiQEXj6JXbmetmJmkXN0297HbtH3rS3wlyVDCnobRzh1hMeOJEnV+XA20GghMA==}
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@tauri-apps/cli-win32-ia32-msvc/1.0.2:
resolution: {integrity: sha512-ZvnaKkCABqUbyUKlNk4RdxKyfOte30D5BxN1pj6iZNeKAwXEuTcgP6iPzOovdeaDirkIjcWCEZymwtZDXN4Rvg==}
engines: {node: '>= 10'}
cpu: [ia32]
os: [win32]
requiresBuild: true
dev: false
optional: true
/@tauri-apps/cli-win32-x64-msvc/1.0.2:
resolution: {integrity: sha512-uMcQyQQD7nyxps34HyYBYUYzFwH26lP58/qdT/GZWvBL1Sv2rqkQXuxHT7xtp4g7nTs0fGRWOtfcnvYIr/1wDw==}
engines: {node: '>= 10'}
cpu: [x64]
os: [win32]
requiresBuild: true
dev: false
optional: true
/@tauri-apps/cli/1.0.2:
resolution: {integrity: sha512-OJdQJVwtKnTAuv2a9JQlOd0gHbbGsXwT+N6M6YQiXZ3/5WdlXey1zhnD78GXwZsf8Cz0R7QIGTBECO4ur4fnKg==}
engines: {node: '>= 10'}
hasBin: true
optionalDependencies:
'@tauri-apps/cli-darwin-arm64': 1.0.2
'@tauri-apps/cli-darwin-x64': 1.0.2
'@tauri-apps/cli-linux-arm-gnueabihf': 1.0.2
'@tauri-apps/cli-linux-arm64-gnu': 1.0.2
'@tauri-apps/cli-linux-arm64-musl': 1.0.2
'@tauri-apps/cli-linux-x64-gnu': 1.0.2
'@tauri-apps/cli-linux-x64-musl': 1.0.2
'@tauri-apps/cli-win32-ia32-msvc': 1.0.2
'@tauri-apps/cli-win32-x64-msvc': 1.0.2
dev: false
+6 -5
View File
@@ -5,7 +5,8 @@ description = "Interface with SQL databases."
authors.workspace = true
license.workspace = true
edition.workspace = true
rust-version.workspace = true
#rust-version.workspace = true
rust-version = "1.65"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@@ -16,11 +17,11 @@ tauri.workspace = true
log.workspace = true
thiserror.workspace = true
futures-core = "0.3"
sqlx = { version = "0.6", features = ["runtime-tokio-rustls", "json", "time"] }
sqlx = { version = "0.7", features = ["json", "time"] }
time = "0.3"
tokio = { version = "1", features = ["sync"] }
[features]
sqlite = ["sqlx/sqlite"]
mysql = ["sqlx/mysql"]
postgres = ["sqlx/postgres"]
sqlite = ["sqlx/sqlite", "sqlx/runtime-tokio"]
mysql = ["sqlx/mysql", "sqlx/runtime-tokio-rustls"]
postgres = ["sqlx/postgres", "sqlx/runtime-tokio-rustls"]
+35 -4
View File
@@ -4,7 +4,7 @@ Interface with SQL databases through [sqlx](https://github.com/launchbadge/sqlx)
## Install
_This plugin requires a Rust version of at least **1.64**_
_This plugin requires a Rust version of at least **1.65**_
There are three general methods of installation that we can recommend.
@@ -28,11 +28,11 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa
> Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use.
```sh
pnpm add https://github.com/tauri-apps/tauri-plugin-sql
pnpm add https://github.com/tauri-apps/tauri-plugin-sql#v1
# or
npm add https://github.com/tauri-apps/tauri-plugin-sql
npm add https://github.com/tauri-apps/tauri-plugin-sql#v1
# or
yarn add https://github.com/tauri-apps/tauri-plugin-sql
yarn add https://github.com/tauri-apps/tauri-plugin-sql#v1
```
## Usage
@@ -65,6 +65,37 @@ const db = await Database.load("postgres://postgres:password@localhost/test");
await db.execute("INSERT INTO ...");
```
## Syntax
We use sqlx as our underlying library, adopting their query syntax:
- sqlite and postgres use the "$#" syntax when substituting query data
- mysql uses "?" when substituting query data
```javascript
// INSERT and UPDATE examples for sqlite and postgres
const result = await db.execute(
"INSERT into todos (id, title, status) VALUES ($1, $2, $3)",
[todos.id, todos.title, todos.status],
);
const result = await db.execute(
"UPDATE todos SET title = $1, completed = $2 WHERE id = $3",
[todos.title, todos.status, todos.id],
);
// INSERT and UPDATE examples for mysql
const result = await db.execute(
"INSERT into todos (id, title, status) VALUES (?, ?, ?)",
[todos.id, todos.title, todos.status],
);
const result = await db.execute(
"UPDATE todos SET title = ?, completed = ? WHERE id = ?",
[todos.title, todos.status, todos.id],
);
```
## Contributing
PRs accepted. Please make sure to read the Contributing Guide before making a pull request.
+26 -3
View File
@@ -76,10 +76,29 @@ export default class Database {
*
* @example
* ```ts
* // for sqlite & postgres
* // INSERT example
* const result = await db.execute(
* "INSERT into todos (id, title, status) VALUES ($1, $2, $3)",
* [ todos.id, todos.title, todos.status ]
* );
* // UPDATE example
* const result = await db.execute(
* "UPDATE todos SET title = $1, completed = $2 WHERE id = $3",
* [ todos.title, todos.status, todos.id ]
* );
*
* // for mysql
* // INSERT example
* const result = await db.execute(
* "INSERT into todos (id, title, status) VALUES (?, ?, ?)",
* [ todos.id, todos.title, todos.status ]
* );
* // UPDATE example
* const result = await db.execute(
* "UPDATE todos SET title = ?, completed = ? WHERE id = ?",
* [ todos.title, todos.status, todos.id ]
* );
* ```
*/
async execute(query: string, bindValues?: unknown[]): Promise<QueryResult> {
@@ -89,15 +108,13 @@ export default class Database {
db: this.path,
query,
values: bindValues ?? [],
}
},
);
return {
lastInsertId,
rowsAffected,
};
}
/**
* **select**
*
@@ -105,9 +122,15 @@ export default class Database {
*
* @example
* ```ts
* // for sqlite & postgres
* const result = await db.select(
* "SELECT * from todos WHERE id = $1", id
* );
*
* // for mysql
* const result = await db.select(
* "SELECT * from todos WHERE id = ?", id
* );
* ```
*/
async select<T>(query: string, bindValues?: unknown[]): Promise<T> {
+2 -2
View File
@@ -25,9 +25,9 @@
"LICENSE"
],
"devDependencies": {
"tslib": "^2.5.0"
"tslib": "2.6.2"
},
"dependencies": {
"@tauri-apps/api": "^1.2.0"
"@tauri-apps/api": "1.5.1"
}
}
+1 -1
View File
@@ -5,7 +5,7 @@ import { createConfig } from "../../shared/rollup.config.mjs";
export default createConfig({
input: "guest-js/index.ts",
pkg: JSON.parse(
readFileSync(new URL("./package.json", import.meta.url), "utf8")
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
),
external: [/^@tauri-apps\/api/],
});
+8 -1
View File
@@ -17,7 +17,14 @@ pub(crate) fn to_json(v: MySqlValueRef) -> Result<JsonValue, Error> {
JsonValue::Null
}
}
"FLOAT" | "DOUBLE" => {
"FLOAT" => {
if let Ok(v) = ValueRef::to_owned(&v).try_decode::<f32>() {
JsonValue::from(v)
} else {
JsonValue::Null
}
}
"DOUBLE" => {
if let Ok(v) = ValueRef::to_owned(&v).try_decode::<f64>() {
JsonValue::from(v)
} else {
+23 -2
View File
@@ -17,14 +17,35 @@ pub(crate) fn to_json(v: PgValueRef) -> Result<JsonValue, Error> {
JsonValue::Null
}
}
"FLOAT4" | "FLOAT8" => {
"FLOAT4" => {
if let Ok(v) = ValueRef::to_owned(&v).try_decode::<f32>() {
JsonValue::from(v)
} else {
JsonValue::Null
}
}
"FLOAT8" => {
if let Ok(v) = ValueRef::to_owned(&v).try_decode::<f64>() {
JsonValue::from(v)
} else {
JsonValue::Null
}
}
"INT2" | "INT4" | "INT8" => {
"INT2" => {
if let Ok(v) = ValueRef::to_owned(&v).try_decode::<i16>() {
JsonValue::Number(v.into())
} else {
JsonValue::Null
}
}
"INT4" => {
if let Ok(v) = ValueRef::to_owned(&v).try_decode::<i32>() {
JsonValue::Number(v.into())
} else {
JsonValue::Null
}
}
"INT8" => {
if let Ok(v) = ValueRef::to_owned(&v).try_decode::<i64>() {
JsonValue::Number(v.into())
} else {
-1
View File
@@ -1 +0,0 @@
../../shared/tsconfig.json
+4
View File
@@ -0,0 +1,4 @@
{
"extends": "../../tsconfig.base.json",
"include": ["guest-js/*.ts"]
}
+3 -3
View File
@@ -26,11 +26,11 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa
> Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use.
```sh
pnpm add https://github.com/tauri-apps/tauri-plugin-store
pnpm add https://github.com/tauri-apps/tauri-plugin-store#v1
# or
npm add https://github.com/tauri-apps/tauri-plugin-store
npm add https://github.com/tauri-apps/tauri-plugin-store#v1
# or
yarn add https://github.com/tauri-apps/tauri-plugin-store
yarn add https://github.com/tauri-apps/tauri-plugin-store#v1
```
## Usage
+2 -2
View File
@@ -177,7 +177,7 @@ export class Store {
*/
async onKeyChange<T>(
key: string,
cb: (value: T | null) => void
cb: (value: T | null) => void,
): Promise<UnlistenFn> {
return await listen<ChangePayload<T>>("store://change", (event) => {
if (event.payload.path === this.path && event.payload.key === key) {
@@ -192,7 +192,7 @@ export class Store {
* @returns A promise resolving to a function to unlisten to the event.
*/
async onChange<T>(
cb: (key: string, value: T | null) => void
cb: (key: string, value: T | null) => void,
): Promise<UnlistenFn> {
return await listen<ChangePayload<T>>("store://change", (event) => {
if (event.payload.path === this.path) {
+2 -2
View File
@@ -25,9 +25,9 @@
"LICENSE"
],
"devDependencies": {
"tslib": "^2.5.0"
"tslib": "2.6.2"
},
"dependencies": {
"@tauri-apps/api": "^1.2.0"
"@tauri-apps/api": "1.5.1"
}
}
+1 -1
View File
@@ -5,7 +5,7 @@ import { createConfig } from "../../shared/rollup.config.mjs";
export default createConfig({
input: "guest-js/index.ts",
pkg: JSON.parse(
readFileSync(new URL("./package.json", import.meta.url), "utf8")
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
),
external: [/^@tauri-apps\/api/],
});
-1
View File
@@ -1 +0,0 @@
../../shared/tsconfig.json
+4
View File
@@ -0,0 +1,4 @@
{
"extends": "../../tsconfig.base.json",
"include": ["guest-js/*.ts"]
}
+11 -2
View File
@@ -16,10 +16,19 @@ tauri.workspace = true
log.workspace = true
thiserror.workspace = true
iota_stronghold = "1"
iota-crypto = "0.20"
iota-crypto = "0.23"
hex = "0.4"
zeroize = { version = "1", features = ["zeroize_derive"] }
# kdf dependencies
rust-argon2 = { version = "1", optional = true }
rand_chacha = { version = "0.3.1", optional = true }
rand_core = { version = "0.6.4", features = ["getrandom"], optional = true }
[dev-dependencies]
rand = "0.8"
rusty-fork = "0.3"
rusty-fork = "0.3"
[features]
default = ["kdf"]
kdf = ["dep:rust-argon2", "dep:rand_chacha", "dep:rand_core"]
+3 -3
View File
@@ -26,11 +26,11 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa
> Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use.
```sh
pnpm add https://github.com/tauri-apps/tauri-plugin-stronghold
pnpm add https://github.com/tauri-apps/tauri-plugin-stronghold#v1
# or
npm add https://github.com/tauri-apps/tauri-plugin-stronghold
npm add https://github.com/tauri-apps/tauri-plugin-stronghold#v1
# or
yarn add https://github.com/tauri-apps/tauri-plugin-stronghold
yarn add https://github.com/tauri-apps/tauri-plugin-stronghold#v1
```
## Usage
+17 -11
View File
@@ -23,7 +23,7 @@ export type StoreKey =
| ArrayBuffer;
function toBytesDto(
v: ClientPath | VaultPath | RecordPath | StoreKey
v: ClientPath | VaultPath | RecordPath | StoreKey,
): string | number[] {
if (typeof v === "string") {
return v;
@@ -125,7 +125,7 @@ class ProcedureExecutor {
*/
async generateSLIP10Seed(
outputLocation: Location,
sizeBytes?: number
sizeBytes?: number,
): Promise<Uint8Array> {
return await invoke<number[]>("plugin:stronghold|execute_procedure", {
...this.procedureArgs,
@@ -152,7 +152,7 @@ class ProcedureExecutor {
chain: number[],
source: "Seed" | "Key",
sourceLocation: Location,
outputLocation: Location
outputLocation: Location,
): Promise<Uint8Array> {
return await invoke<number[]>("plugin:stronghold|execute_procedure", {
...this.procedureArgs,
@@ -181,7 +181,7 @@ class ProcedureExecutor {
async recoverBIP39(
mnemonic: string,
outputLocation: Location,
passphrase?: string
passphrase?: string,
): Promise<Uint8Array> {
return await invoke<number[]>("plugin:stronghold|execute_procedure", {
...this.procedureArgs,
@@ -205,7 +205,7 @@ class ProcedureExecutor {
*/
async generateBIP39(
outputLocation: Location,
passphrase?: string
passphrase?: string,
): Promise<Uint8Array> {
return await invoke<number[]>("plugin:stronghold|execute_procedure", {
...this.procedureArgs,
@@ -245,7 +245,7 @@ class ProcedureExecutor {
*/
async signEd25519(
privateKeyLocation: Location,
msg: string
msg: string,
): Promise<Uint8Array> {
return await invoke<number[]>("plugin:stronghold|execute_procedure", {
...this.procedureArgs,
@@ -293,18 +293,24 @@ export class Store {
this.client = client;
}
async get(key: StoreKey): Promise<Uint8Array> {
async get(key: StoreKey): Promise<Uint8Array | null> {
return await invoke<number[]>("plugin:stronghold|get_store_record", {
snapshotPath: this.path,
client: this.client,
key: toBytesDto(key),
}).then((v) => Uint8Array.from(v));
}).then((v) => {
if (v) {
return Uint8Array.from(v);
} else {
return null;
}
});
}
async insert(
key: StoreKey,
value: number[],
lifetime?: Duration
lifetime?: Duration,
): Promise<void> {
return await invoke("plugin:stronghold|save_store_record", {
snapshotPath: this.path,
@@ -322,7 +328,7 @@ export class Store {
snapshotPath: this.path,
client: this.client,
key: toBytesDto(key),
}
},
).then((v) => (v != null ? Uint8Array.from(v) : null));
}
}
@@ -378,7 +384,7 @@ export class Vault extends ProcedureExecutor {
snapshotPath: this.path,
client: this.client,
vault: this.name,
location,
recordPath: location.payload.record,
});
}
}
+2 -2
View File
@@ -25,9 +25,9 @@
"LICENSE"
],
"devDependencies": {
"tslib": "^2.5.0"
"tslib": "2.6.2"
},
"dependencies": {
"@tauri-apps/api": "^1.2.0"
"@tauri-apps/api": "1.5.1"
}
}
+1 -1
View File
@@ -5,7 +5,7 @@ import { createConfig } from "../../shared/rollup.config.mjs";
export default createConfig({
input: "guest-js/index.ts",
pkg: JSON.parse(
readFileSync(new URL("./package.json", import.meta.url), "utf8")
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
),
external: [/^@tauri-apps\/api/],
});
+35
View File
@@ -0,0 +1,35 @@
use rand_chacha::ChaCha20Rng;
use rand_core::{RngCore, SeedableRng};
use std::path::Path;
/// NOTE: Hash supplied to Stronghold must be 32bits long.
/// This is a current limitation of Stronghold.
const HASH_LENGTH: usize = 32;
pub struct KeyDerivation {}
impl KeyDerivation {
/// Will create a key from [`password`] and a generated salt.
/// Salt will be generated to file [`salt_path`] or taken from it
/// if file already exists
pub fn argon2(password: &str, salt_path: &Path) -> Vec<u8> {
let mut salt = [0u8; HASH_LENGTH];
create_or_get_salt(&mut salt, salt_path);
argon2::hash_raw(password.as_bytes(), &salt, &Default::default())
.expect("Failed to generate hash for password")
}
}
fn create_or_get_salt(salt: &mut [u8], salt_path: &Path) {
if salt_path.is_file() {
// Get existing salt
let tmp = std::fs::read(salt_path).unwrap();
salt.clone_from_slice(&tmp);
} else {
// Generate new salt
let mut gen = ChaCha20Rng::from_entropy();
gen.fill_bytes(salt);
std::fs::write(salt_path, salt).expect("Failed to write salt for Stronghold")
}
}
+55 -8
View File
@@ -22,6 +22,9 @@ use tauri::{
};
use zeroize::Zeroize;
#[cfg(feature = "kdf")]
pub mod kdf;
pub mod stronghold;
type PasswordHashFn = dyn Fn(&str) -> Vec<u8> + Send + Sync;
@@ -394,26 +397,70 @@ fn get_client(
}
}
enum PasswordHashFunctionKind {
#[cfg(feature = "kdf")]
Argon2(PathBuf),
Custom(Box<PasswordHashFn>),
}
pub struct Builder {
password_hash_function: Box<PasswordHashFn>,
password_hash_function: PasswordHashFunctionKind,
}
impl Builder {
pub fn new<F: Fn(&str) -> Vec<u8> + Send + Sync + 'static>(password_hash_function: F) -> Self {
Self {
password_hash_function: Box::new(password_hash_function),
password_hash_function: PasswordHashFunctionKind::Custom(Box::new(
password_hash_function,
)),
}
}
/// Initializes [`Self`] with argon2 as password hash function.
///
/// # Examples
///
/// ```rust
/// tauri::Builder::default()
/// .setup(|app| {
/// let salt_path = app
/// .path_resolver()
/// .app_local_data_dir()
/// .expect("could not resolve app local data path")
/// .join("salt.txt");
/// app.handle().plugin(tauri_plugin_stronghold::Builder::with_argon2(&salt_path).build())?;
/// Ok(())
/// });
/// ```
#[cfg(feature = "kdf")]
pub fn with_argon2(salt_path: &std::path::Path) -> Self {
Self {
password_hash_function: PasswordHashFunctionKind::Argon2(salt_path.to_owned()),
}
}
pub fn build<R: Runtime>(self) -> TauriPlugin<R> {
let password_hash_function = self.password_hash_function;
PluginBuilder::new("stronghold")
.setup(move |app| {
app.manage(StrongholdCollection::default());
app.manage(PasswordHashFunction(password_hash_function));
Ok(())
})
let plugin_builder = PluginBuilder::new("stronghold").setup(move |app| {
app.manage(StrongholdCollection::default());
app.manage(PasswordHashFunction(match password_hash_function {
#[cfg(feature = "kdf")]
PasswordHashFunctionKind::Argon2(path) => {
Box::new(move |p| kdf::KeyDerivation::argon2(p, &path))
}
PasswordHashFunctionKind::Custom(f) => f,
}));
Ok(())
});
Builder::invoke_stronghold_handlers_and_build(plugin_builder)
}
fn invoke_stronghold_handlers_and_build<R: Runtime>(
builder: PluginBuilder<R>,
) -> TauriPlugin<R> {
builder
.invoke_handler(tauri::generate_handler![
initialize,
destroy,
-1
View File
@@ -1 +0,0 @@
../../shared/tsconfig.json
+4
View File
@@ -0,0 +1,4 @@
{
"extends": "../../tsconfig.base.json",
"include": ["guest-js/*.ts"]
}
+5 -5
View File
@@ -27,11 +27,11 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa
> Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use.
```sh
pnpm add https://github.com/tauri-apps/tauri-plugin-upload
pnpm add https://github.com/tauri-apps/tauri-plugin-upload#v1
# or
npm add https://github.com/tauri-apps/tauri-plugin-upload
npm add https://github.com/tauri-apps/tauri-plugin-upload#v1
# or
yarn add https://github.com/tauri-apps/tauri-plugin-upload
yarn add https://github.com/tauri-apps/tauri-plugin-upload#v1
```
## Usage
@@ -58,7 +58,7 @@ upload(
"https://example.com/file-upload",
"./path/to/my/file.txt",
(progress, total) => console.log(`Uploaded ${progress} of ${total} bytes`), // a callback that will be called with the upload progress
{ "Content-Type": "text/plain" } // optional headers to send with the request
{ "Content-Type": "text/plain" }, // optional headers to send with the request
);
```
@@ -69,7 +69,7 @@ download(
"https://example.com/file-download-link",
"./path/to/save/my/file.txt",
(progress, total) => console.log(`Downloaded ${progress} of ${total} bytes`), // a callback that will be called with the download progress
{ "Content-Type": "text/plain" } // optional headers to send with the request
{ "Content-Type": "text/plain" }, // optional headers to send with the request
);
```
+2 -2
View File
@@ -31,7 +31,7 @@ async function upload(
url: string,
filePath: string,
progressHandler?: ProgressHandler,
headers?: Map<string, string>
headers?: Map<string, string>,
): Promise<void> {
const ids = new Uint32Array(1);
window.crypto.getRandomValues(ids);
@@ -59,7 +59,7 @@ async function download(
url: string,
filePath: string,
progressHandler?: ProgressHandler,
headers?: Map<string, string>
headers?: Map<string, string>,
): Promise<void> {
const ids = new Uint32Array(1);
window.crypto.getRandomValues(ids);
+2 -2
View File
@@ -25,9 +25,9 @@
"LICENSE"
],
"devDependencies": {
"tslib": "^2.5.0"
"tslib": "2.6.2"
},
"dependencies": {
"@tauri-apps/api": "^1.2.0"
"@tauri-apps/api": "1.5.1"
}
}
+1 -1
View File
@@ -5,7 +5,7 @@ import { createConfig } from "../../shared/rollup.config.mjs";
export default createConfig({
input: "guest-js/index.ts",
pkg: JSON.parse(
readFileSync(new URL("./package.json", import.meta.url), "utf8")
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
),
external: [/^@tauri-apps\/api/],
});
+37 -10
View File
@@ -9,7 +9,10 @@ use tauri::{
plugin::{Builder as PluginBuilder, TauriPlugin},
Runtime, Window,
};
use tokio::{fs::File, io::AsyncWriteExt};
use tokio::{
fs::File,
io::{AsyncWriteExt, BufWriter},
};
use tokio_util::codec::{BytesCodec, FramedRead};
use read_progress_stream::ReadProgressStream;
@@ -64,20 +67,44 @@ async fn download<R: Runtime>(
let response = request.send().await?;
let total = response.content_length().unwrap_or(0);
let mut file = File::create(file_path).await?;
let mut file = BufWriter::new(File::create(file_path).await?);
let mut stream = response.bytes_stream();
let mut i = 0;
let mut temp_progress = 0;
while let Some(chunk) = stream.try_next().await? {
i = i + 1;
file.write_all(&chunk).await?;
let _ = window.emit(
"download://progress",
ProgressPayload {
id,
progress: chunk.len() as u64,
total,
},
);
temp_progress = temp_progress + chunk.len();
if i >= 10 {
window
.emit(
"download://progress",
ProgressPayload {
id,
progress: temp_progress as u64,
total,
},
)
.unwrap(); // TODO: remove the unwrap again.
i = 0;
temp_progress = 0;
}
}
if temp_progress != 0 {
window
.emit(
"download://progress",
ProgressPayload {
id,
progress: temp_progress as u64,
total,
},
)
.unwrap(); // TODO: remove the unwrap again.
}
file.flush().await?;
Ok(id)
}
-1
View File
@@ -1 +0,0 @@
../../shared/tsconfig.json
+4
View File
@@ -0,0 +1,4 @@
{
"extends": "../../tsconfig.base.json",
"include": ["guest-js/*.ts"]
}
+1 -1
View File
@@ -18,4 +18,4 @@ thiserror.workspace = true
rand = "0.8"
futures-util = "0.3"
tokio = { version = "1", features = ["net", "sync"] }
tokio-tungstenite = { version = "0.19", features = ["native-tls"] }
tokio-tungstenite = { version = "0.20", features = ["native-tls"] }
+4 -4
View File
@@ -26,11 +26,11 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa
> Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use.
```sh
pnpm add https://github.com/tauri-apps/tauri-plugin-websocket
pnpm add https://github.com/tauri-apps/tauri-plugin-websocket#v1
# or
npm add https://github.com/tauri-apps/tauri-plugin-websocket
npm add https://github.com/tauri-apps/tauri-plugin-websocket#v1
# or
yarn add https://github.com/tauri-apps/tauri-plugin-websocket
yarn add https://github.com/tauri-apps/tauri-plugin-websocket#v1
```
## Usage
@@ -51,7 +51,7 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript
import { WebSocket } from "tauri-plugin-websocket-api";
import WebSocket from "tauri-plugin-websocket-api";
const ws = await WebSocket.connect("wss://example.com");
@@ -11,14 +11,14 @@
"tauri": "tauri"
},
"devDependencies": {
"@sveltejs/adapter-auto": "^2.0.0",
"@sveltejs/kit": "^1.15.5",
"@tauri-apps/cli": "^1.2.3",
"svelte": "^3.58.0",
"svelte-check": "^3.2.0",
"tslib": "^2.5.0",
"typescript": "^5.0.4",
"vite": "^4.2.1"
"@sveltejs/adapter-auto": "2.1.0",
"@sveltejs/kit": "1.27.2",
"@tauri-apps/cli": "1.5.5",
"svelte": "4.2.2",
"svelte-check": "3.5.2",
"tslib": "2.6.2",
"typescript": "5.2.2",
"vite": "4.5.0"
},
"dependencies": {
"tauri-plugin-websocket-api": "link:../../"
+4 -4
View File
@@ -2774,9 +2774,9 @@ dependencies = [
[[package]]
name = "tokio-tungstenite"
version = "0.19.0"
version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec509ac96e9a0c43427c74f003127d953a265737636129424288d27cb5c4b12c"
checksum = "2b2dbec703c26b00d74844519606ef15d09a7d6857860f84ad223dec002ddea2"
dependencies = [
"futures-util",
"log",
@@ -2806,9 +2806,9 @@ dependencies = [
[[package]]
name = "tungstenite"
version = "0.19.0"
version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15fba1a6d6bb030745759a9a2a588bfe8490fc8b4751a277db3a0be1c9ebbf67"
checksum = "e862a1c4128df0112ab625f55cd5c934bcb4312ba80b39ae4b4835a3fd58e649"
dependencies = [
"byteorder",
"bytes",
@@ -13,7 +13,7 @@ tauri = { version = "1", features = [] }
tokio = { version = "1", features = ["net"] }
futures-util = "0.3"
tauri-plugin-websocket = { path = "../../../" }
tokio-tungstenite = "0.19"
tokio-tungstenite = "0.20"
[build-dependencies]
tauri-build = { version = "1", features = [] }
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
+19 -3
View File
@@ -1,5 +1,14 @@
import { invoke, transformCallback } from "@tauri-apps/api/tauri";
export interface ConnectionConfig {
writeBufferSize?: number;
maxWriteBufferSize?: number;
maxMessageSize?: number;
maxFrameSize?: number;
acceptUnmaskedFrames?: boolean;
headers?: HeadersInit;
}
export interface MessageKind<T, D> {
type: T;
data: D;
@@ -26,16 +35,23 @@ export default class WebSocket {
this.listeners = listeners;
}
static async connect(url: string, options?: unknown): Promise<WebSocket> {
static async connect(
url: string,
config?: ConnectionConfig,
): Promise<WebSocket> {
const listeners: Array<(arg: Message) => void> = [];
const handler = (message: Message): void => {
listeners.forEach((l) => l(message));
};
if (config?.headers) {
config.headers = Array.from(new Headers(config.headers).entries());
}
return await invoke<number>("plugin:websocket|connect", {
url,
callbackFunction: transformCallback(handler),
options,
config,
}).then((id) => new WebSocket(id, listeners));
}
@@ -53,7 +69,7 @@ export default class WebSocket {
m = { type: "Binary", data: message };
} else {
throw new Error(
"invalid `message` type, expected a `{ type: string, data: any }` object, a string or a numeric array"
"invalid `message` type, expected a `{ type: string, data: any }` object, a string or a numeric array",
);
}
return await invoke("plugin:websocket|send", {
+2 -2
View File
@@ -24,9 +24,9 @@
"LICENSE"
],
"devDependencies": {
"tslib": "^2.5.0"
"tslib": "2.6.2"
},
"dependencies": {
"@tauri-apps/api": "^1.2.0"
"@tauri-apps/api": "1.5.1"
}
}
+1 -1
View File
@@ -5,7 +5,7 @@ import { createConfig } from "../../shared/rollup.config.mjs";
export default createConfig({
input: "guest-js/index.ts",
pkg: JSON.parse(
readFileSync(new URL("./package.json", import.meta.url), "utf8")
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
),
external: [/^@tauri-apps\/api/],
});
+30 -4
View File
@@ -16,6 +16,9 @@ use tokio_tungstenite::{
};
use std::collections::HashMap;
use std::str::FromStr;
use tauri::http::header::{HeaderName, HeaderValue};
use tokio_tungstenite::tungstenite::client::IntoClientRequest;
type Id = u32;
type WebSocket = WebSocketStream<MaybeTlsStream<TcpStream>>;
@@ -28,6 +31,10 @@ enum Error {
Websocket(#[from] tokio_tungstenite::tungstenite::Error),
#[error("connection not found for the given id: {0}")]
ConnectionNotFound(Id),
#[error(transparent)]
InvalidHeaderValue(#[from] tokio_tungstenite::tungstenite::http::header::InvalidHeaderValue),
#[error(transparent)]
InvalidHeaderName(#[from] tokio_tungstenite::tungstenite::http::header::InvalidHeaderName),
}
impl Serialize for Error {
@@ -42,20 +49,29 @@ impl Serialize for Error {
#[derive(Default)]
struct ConnectionManager(Mutex<HashMap<Id, WebSocketWriter>>);
#[derive(Default, Deserialize)]
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ConnectionConfig {
pub max_send_queue: Option<usize>,
pub write_buffer_size: Option<usize>,
pub max_write_buffer_size: Option<usize>,
pub max_message_size: Option<usize>,
pub max_frame_size: Option<usize>,
#[serde(default)]
pub accept_unmasked_frames: bool,
pub headers: Option<Vec<(String, String)>>,
}
impl From<ConnectionConfig> for WebSocketConfig {
fn from(config: ConnectionConfig) -> Self {
// Disabling the warning on max_send_queue which we don't use anymore since it was deprecated.
#[allow(deprecated)]
Self {
max_send_queue: config.max_send_queue,
max_send_queue: None,
write_buffer_size: config.write_buffer_size.unwrap_or(128 * 1024),
max_write_buffer_size: config.max_write_buffer_size.unwrap_or(usize::MAX),
// This may be harmful since if it's not provided from js we're overwriting the default value with None, meaning no size limit.
max_message_size: config.max_message_size,
// This may be harmful since if it's not provided from js we're overwriting the default value with None, meaning no size limit.
max_frame_size: config.max_frame_size,
accept_unmasked_frames: config.accept_unmasked_frames,
}
@@ -86,7 +102,17 @@ async fn connect<R: Runtime>(
config: Option<ConnectionConfig>,
) -> Result<Id> {
let id = rand::random();
let (ws_stream, _) = connect_async_with_config(url, config.map(Into::into), false).await?;
let mut request = url.into_client_request()?;
if let Some(headers) = config.as_ref().and_then(|c| c.headers.as_ref()) {
for (k, v) in headers {
let header_name = HeaderName::from_str(k.as_str())?;
let header_value = HeaderValue::from_str(v.as_str())?;
request.headers_mut().insert(header_name, header_value);
}
}
let (ws_stream, _) = connect_async_with_config(request, config.map(Into::into), false).await?;
tauri::async_runtime::spawn(async move {
let (write, read) = ws_stream.split();
-1
View File
@@ -1 +0,0 @@
../../shared/tsconfig.json
+4
View File
@@ -0,0 +1,4 @@
{
"extends": "../../tsconfig.base.json",
"include": ["guest-js/*.ts"]
}
+3 -3
View File
@@ -26,11 +26,11 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa
> Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use.
```sh
pnpm add https://github.com/tauri-apps/tauri-plugin-window-state
pnpm add https://github.com/tauri-apps/tauri-plugin-window-state#v1
# or
npm add https://github.com/tauri-apps/tauri-plugin-window-state
npm add https://github.com/tauri-apps/tauri-plugin-window-state#v1
# or
yarn add https://github.com/tauri-apps/tauri-plugin-window-state
yarn add https://github.com/tauri-apps/tauri-plugin-window-state#v1
```
## Usage
+9 -6
View File
@@ -14,22 +14,25 @@ export enum StateFlags {
/**
* Save the state of all open windows to disk.
*/
async function saveWindowState(flags: StateFlags) {
invoke("plugin:window-state|save_window_state", { flags });
async function saveWindowState(flags: StateFlags): Promise<void> {
return invoke("plugin:window-state|save_window_state", { flags });
}
/**
* Restore the state for the specified window from disk.
*/
async function restoreState(label: WindowLabel, flags: StateFlags) {
invoke("plugin:window-state|restore_state", { label, flags });
async function restoreState(
label: WindowLabel,
flags: StateFlags,
): Promise<void> {
return invoke("plugin:window-state|restore_state", { label, flags });
}
/**
* Restore the state for the current window from disk.
*/
async function restoreStateCurrent(flags: StateFlags) {
restoreState(getCurrent().label, flags);
async function restoreStateCurrent(flags: StateFlags): Promise<void> {
return restoreState(getCurrent().label, flags);
}
export { restoreState, restoreStateCurrent, saveWindowState };
+2 -2
View File
@@ -25,9 +25,9 @@
"LICENSE"
],
"devDependencies": {
"tslib": "^2.5.0"
"tslib": "2.6.2"
},
"dependencies": {
"@tauri-apps/api": "^1.2.0"
"@tauri-apps/api": "1.5.1"
}
}
+1 -1
View File
@@ -5,7 +5,7 @@ import { createConfig } from "../../shared/rollup.config.mjs";
export default createConfig({
input: "guest-js/index.ts",
pkg: JSON.parse(
readFileSync(new URL("./package.json", import.meta.url), "utf8")
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
),
external: [/^@tauri-apps\/api/],
});
+17 -2
View File
@@ -53,7 +53,7 @@ impl Default for StateFlags {
}
}
#[derive(Debug, Default, Deserialize, Serialize, PartialEq)]
#[derive(Debug, Deserialize, Serialize, PartialEq)]
struct WindowState {
width: f64,
height: f64,
@@ -65,6 +65,21 @@ struct WindowState {
fullscreen: bool,
}
impl Default for WindowState {
fn default() -> Self {
Self {
width: Default::default(),
height: Default::default(),
x: Default::default(),
y: Default::default(),
maximized: Default::default(),
visible: true,
decorated: true,
fullscreen: Default::default(),
}
}
}
struct WindowStateCache(Arc<Mutex<HashMap<String, WindowState>>>);
pub trait AppHandleExt {
/// Saves all open windows state to disk
@@ -175,7 +190,7 @@ impl<R: Runtime> WindowExt for Window<R> {
}
if flags.contains(StateFlags::DECORATIONS) {
metadata.visible = self.is_visible()?;
metadata.decorated = self.is_decorated()?;
}
if flags.contains(StateFlags::FULLSCREEN) {
-1
View File
@@ -1 +0,0 @@
../../shared/tsconfig.json
+4
View File
@@ -0,0 +1,4 @@
{
"extends": "../../tsconfig.base.json",
"include": ["guest-js/*.ts"]
}

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