diff --git a/.changes/config.json b/.changes/config.json new file mode 100644 index 000000000..d527385de --- /dev/null +++ b/.changes/config.json @@ -0,0 +1,159 @@ +{ + "gitSiteUrl": "https://github.com/tauri-apps/plugins-workspace/", + "pkgManagers": { + "javascript": { + "version": true, + "getPublishedVersion": "pnpm view ${ pkgFile.pkg.name } version", + "publish": ["pnpm build", "pnpm publish --access public --no-git-checks"] + }, + "rust": { + "version": true, + "getPublishedVersion": "cargo search ${ pkgFile.pkg.package.name } --limit 1 | sed -nE 's/^[^\"]*\"//; s/\".*//1p' -", + "publish": [ + { + "command": "cargo package --no-verify", + "dryRunCommand": true + }, + { + "command": "echo '
\n

Cargo Publish

\n\n```'", + "dryRunCommand": true, + "pipe": true + }, + { + "command": "cargo publish", + "dryRunCommand": "cargo publish --dry-run", + "pipe": true + }, + { + "command": "echo '```\n\n
\n'", + "dryRunCommand": true, + "pipe": true + } + ] + } + }, + "packages": { + "authenticator": { + "path": "./plugins/authenticator", + "manager": "rust-disabled" + }, + "authenticator-js": { + "path": "./plugins/authenticator", + "manager": "javascript-disabled" + }, + + "autostart": { + "path": "./plugins/autostart", + "manager": "rust-disabled" + }, + "autostart-js": { + "path": "./plugins/autostart", + "manager": "javascript-disabled" + }, + + "fs-extra": { + "path": "./plugins/fs-extra", + "manager": "rust-disabled" + }, + "fs-extra-js": { + "path": "./plugins/fs-extra", + "manager": "javascript-disabled" + }, + + "fs-watch": { + "path": "./plugins/fs-watch", + "manager": "rust-disabled" + }, + "fs-watch-js": { + "path": "./plugins/fs-watch", + "manager": "javascript-disabled" + }, + + "localhost": { + "path": "./plugins/localhost", + "manager": "rust" + }, + + "log": { + "path": "./plugins/log", + "manager": "rust-disabled" + }, + "log-js": { + "path": "./plugins/log", + "manager": "javascript-disabled" + }, + + "persisted-scope": { + "path": "./plugins/persisted-scope", + "manager": "rust" + }, + + "positioner": { + "path": "./plugins/positioner", + "manager": "rust" + }, + "positioner-js": { + "path": "./plugins/positioner", + "manager": "javascript-disabled" + }, + + "single-instance": { + "path": "./plugins/single-instance", + "manager": "rust-disabled" + }, + + "sql": { + "path": "./plugins/sql", + "manager": "rust-disabled" + }, + "sql-js": { + "path": "./plugins/sql", + "manager": "javascript-disabled" + }, + + "store": { + "path": "./plugins/store", + "manager": "rust-disabled" + }, + "store-js": { + "path": "./plugins/store", + "manager": "javascript-disabled" + }, + + "stronghold": { + "path": "./plugins/stronghold", + "manager": "rust-disabled" + }, + "stronghold-js": { + "path": "./plugins/stronghold", + "manager": "javascript-disabled" + }, + + "upload": { + "path": "./plugins/upload", + "manager": "rust-disabled" + }, + "upload-js": { + "path": "./plugins/upload", + "manager": "javascript-disabled" + }, + + "websocket": { + "path": "./plugins/websocket", + "manager": "rust-disabled" + }, + "websocket-js": { + "path": "./plugins/websocket", + "manager": "javascript-disabled" + }, + + "window-state": { + "path": "./plugins/window-state", + "manager": "rust" + }, + "window-state-js": { + "path": "./plugins/window-state", + "manager": "javascript-disabled" + } + } +} diff --git a/.changes/persisted-scope-fix-oom.md b/.changes/persisted-scope-fix-oom.md new file mode 100644 index 000000000..6e6520aff --- /dev/null +++ b/.changes/persisted-scope-fix-oom.md @@ -0,0 +1,5 @@ +--- +persisted-scope: patch +--- + +Recursively unescape saved patterns before allowing/forbidding them. This effectively prevents `.persisted-scope` files from blowing up, which caused Out-Of-Memory issues, while automatically fixing existing broken files seamlessly. diff --git a/.changes/readme.md b/.changes/readme.md new file mode 100644 index 000000000..002f46432 --- /dev/null +++ b/.changes/readme.md @@ -0,0 +1,30 @@ +# Changes + +##### via https://github.com/jbolda/covector + +As you create PRs and make changes that require a version bump, please add a new markdown file in this folder. You do not note the version _number_, but rather the type of bump that you expect: major, minor, or patch. The filename is not important, as long as it is a `.md`, but we recommend that it represents the overall change for organizational purposes. + +When you select the version bump required, you do _not_ need to consider dependencies. Only note the package with the actual change, and any packages that depend on that package will be bumped automatically in the process. + +Use the following format: + +```md +--- +"package-a": patch +"package-b": minor +--- + +Change summary goes here +``` + +Summaries do not have a specific character limit, but are text only. These summaries are used within the (future implementation of) changelogs. They will give context to the change and also point back to the original PR if more details and context are needed. + +Changes will be designated as a `major`, `minor` or `patch` as further described in [semver](https://semver.org/). + +Given a version number MAJOR.MINOR.PATCH, increment the: + +- MAJOR version when you make incompatible API changes, +- MINOR version when you add functionality in a backwards compatible manner, and +- PATCH version when you make backwards compatible bug fixes. + +Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format, but will be discussed prior to usage (as extra steps will be necessary in consideration of merging and publishing). diff --git a/.github/sync-to-mirrors.sh b/.github/sync-to-mirrors.sh index 1a65bf2d0..52d4c27f1 100755 --- a/.github/sync-to-mirrors.sh +++ b/.github/sync-to-mirrors.sh @@ -38,9 +38,10 @@ fi if [[ -z "$COMMIT_MESSAGE" ]]; then MONOREPO_COMMIT_MESSAGE=$(cd "${SOURCE_DIR:-.}" && git show -s --format=%B $GITHUB_SHA) - COMMIT_MESSAGE=$( printf "%s\n\nCommitted via a GitHub action: https://github.com/%s/actions/runs/%s\n" "$MONOREPO_COMMIT_MESSAGE" "$GITHUB_REPOSITORY" "$GITHUB_RUN_ID" ) + COMMIT_MESSAGE=$( printf "%s\n\nCommitted via a GitHub action: https://github.com/%s/actions/runs/%s" "$MONOREPO_COMMIT_MESSAGE" "$GITHUB_REPOSITORY" "$GITHUB_RUN_ID" ) fi -COMMIT_ORIGINAL_AUTHOR="${GITHUB_ACTOR} <${GITHUB_ACTOR}@users.noreply.github.com>" +COMMIT_ACTOR="${GITHUB_ACTOR} <${GITHUB_ACTOR}@users.noreply.github.com>" +COMMIT_AUTHOR=$(cd "${SOURCE_DIR:-.}" &&git show -s --format="%an <%ae>" $GITHUB_SHA) if [[ "$GITHUB_REF" =~ ^refs/heads/ ]]; then BRANCH=${GITHUB_REF#refs/heads/} @@ -59,6 +60,9 @@ fi # : > "$BUILD_BASE/changes.diff" +# Collect tags of current commit +readarray -t COMMIT_TAGS < <(git tag --points-at HEAD) + EXIT=0 while read -r PLUGIN_NAME; do printf "\n\n\e[7m Mirror: %s \e[0m\n" "$PLUGIN_NAME" @@ -98,12 +102,24 @@ while read -r PLUGIN_NAME; do if [[ -n "$FORCE_COMMIT" || -n "$(git status --porcelain)" ]]; then echo "Committing to $PLUGIN_NAME" - if git commit $FORCE_COMMIT --author="${COMMIT_ORIGINAL_AUTHOR}" -m "${COMMIT_MESSAGE}" && + GIT_CLI_COMMIT_MESSAGE=$( printf "%s \n\nCo-authored-by: %s" "$COMMIT_MESSAGE" "$COMMIT_ACTOR" ) + if git commit $FORCE_COMMIT --author="${COMMIT_AUTHOR}" -m "${GIT_CLI_COMMIT_MESSAGE}" && { [[ -z "$CI" ]] || git push origin "$BRANCH"; } # Only do the actual push from the GitHub Action then # echo "$BUILD_BASE/changes.diff" # git show --pretty= --src-prefix="a/$PLUGIN_NAME/" --dst-prefix="b/$PLUGIN_NAME/" >> "$BUILD_BASE/changes.diff" echo "https://github.com/tauri-apps/tauri-plugin-$PLUGIN_NAME/commit/$(git rev-parse HEAD)" + + # Add new tags + for FULL_TAG in "${COMMIT_TAGS[@]}"; do + if [[ "$FULL_TAG" =~ ^"$PLUGIN_NAME-js-v" ]]; then + TAG_NAME="${FULL_TAG#"$PLUGIN_NAME-js-"}" + echo "Creating tag $TAG_NAME" + git tag "${TAG_NAME}" -m "${GIT_CLI_COMMIT_MESSAGE}" + git push origin "${TAG_NAME}" + fi + done + echo "Completed $PLUGIN_NAME" else echo "::error::Commit of ${PLUGIN_NAME} failed" @@ -114,4 +130,4 @@ while read -r PLUGIN_NAME; do fi done < "$BUILD_BASE/mirrors.txt" -exit $EXIT \ No newline at end of file +exit $EXIT diff --git a/.github/workflows/audit-javascript.yml b/.github/workflows/audit-javascript.yml index 5d971450a..bd84610da 100644 --- a/.github/workflows/audit-javascript.yml +++ b/.github/workflows/audit-javascript.yml @@ -38,8 +38,9 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18 - - uses: pnpm/action-setup@v2.2.4 + - uses: pnpm/action-setup@v2 with: + version: 7.x.x run_install: true - name: audit run: pnpm audit diff --git a/.github/workflows/audit-rust.yml b/.github/workflows/audit-rust.yml index f3ae64e24..7a824fa1a 100644 --- a/.github/workflows/audit-rust.yml +++ b/.github/workflows/audit-rust.yml @@ -28,6 +28,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions-rs/audit-check@v1 + - uses: rustsec/audit-check@v1 with: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/covector-status.yml b/.github/workflows/covector-status.yml new file mode 100644 index 000000000..cb5a344a2 --- /dev/null +++ b/.github/workflows/covector-status.yml @@ -0,0 +1,16 @@ +name: covector status +on: [pull_request] + +jobs: + covector: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # required for use of git history + - name: covector status + uses: jbolda/covector/packages/action@covector-v0.8 + id: covector + with: + command: "status" diff --git a/.github/workflows/covector-version-or-publish.yml b/.github/workflows/covector-version-or-publish.yml new file mode 100644 index 000000000..14057c07a --- /dev/null +++ b/.github/workflows/covector-version-or-publish.yml @@ -0,0 +1,59 @@ +name: version or publish + +on: + push: + branches: + - dev + +jobs: + version-or-publish: + runs-on: ubuntu-latest + timeout-minutes: 65 + outputs: + change: ${{ steps.covector.outputs.change }} + commandRan: ${{ steps.covector.outputs.commandRan }} + successfulPublish: ${{ steps.covector.outputs.successfulPublish }} + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # required for use of git history + + - uses: actions/setup-node@v3 + with: + node-version: "lts/*" + registry-url: "https://registry.npmjs.org" + + - uses: pnpm/action-setup@v2 + with: + version: 7.x.x + run_install: true + + - name: cargo login + run: cargo login ${{ secrets.ORG_CRATES_IO_TOKEN }} + + - name: git config + run: | + git config --global user.name "${{ github.event.pusher.name }}" + git config --global user.email "${{ github.event.pusher.email }}" + + - name: covector version or publish (publish when no change files present) + uses: jbolda/covector/packages/action@covector-v0.8 + id: covector + env: + NODE_AUTH_TOKEN: ${{ secrets.ORG_NPM_TOKEN }} + with: + token: ${{ secrets.GITHUB_TOKEN }} + command: "version-or-publish" + createRelease: true + + - name: Create Pull Request With Versions Bumped + id: cpr + uses: tauri-apps/create-pull-request@v3 + if: steps.covector.outputs.commandRan == 'version' + with: + title: "Publish New Versions" + commit-message: "publish new versions" + labels: "version updates" + branch: "release" + body: ${{ steps.covector.outputs.change }} diff --git a/.github/workflows/lint-javascript.yml b/.github/workflows/lint-javascript.yml index 3fbe96e37..1483f288a 100644 --- a/.github/workflows/lint-javascript.yml +++ b/.github/workflows/lint-javascript.yml @@ -41,8 +41,9 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18 - - uses: pnpm/action-setup@v2.2.4 + - uses: pnpm/action-setup@v2 with: + version: 7.x.x run_install: true - name: eslint run: pnpm lint @@ -60,8 +61,9 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18 - - uses: pnpm/action-setup@v2.2.4 + - uses: pnpm/action-setup@v2 with: + version: 7.x.x run_install: true - name: prettier check run: pnpm format-check diff --git a/.github/workflows/msrv-check.yml b/.github/workflows/msrv-check.yml new file mode 100644 index 000000000..a603e8f07 --- /dev/null +++ b/.github/workflows/msrv-check.yml @@ -0,0 +1,53 @@ +name: Check MSRV + +on: + push: + branches: + - dev + paths: + - ".github/workflows/msrv-check.yml" + - "plugins/*/src/**" + - "**/Cargo.toml" + - "**/Cargo.lock" + pull_request: + branches: + - dev + paths: + - ".github/workflows/msrv-check.yml" + - "plugins/*/src/**" + - "**/Cargo.toml" + - "**/Cargo.lock" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + msrv: + runs-on: ubuntu-latest + strategy: + fail-fast: false + + steps: + - uses: actions/checkout@v3 + + - name: install webkit2gtk and libudev for [authenticator] + run: | + sudo apt-get update + sudo apt-get install -y webkit2gtk-4.0 libudev-dev + + - uses: dtolnay/rust-toolchain@1.64.0 + + - uses: Swatinem/rust-cache@v2 + + - name: build + run: cargo build --workspace --exclude 'tauri-plugin-sql' --all-targets --all-features + + - name: build sql:sqlite + run: cargo build --package 'tauri-plugin-sql' --all-targets --features sqlite + + - name: build sql:mysql + run: cargo build --package 'tauri-plugin-sql' --all-targets --features mysql + + - name: build sql:postgres + run: cargo build --package 'tauri-plugin-sql' --all-targets --features postgres diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index 51521aab2..6b42bf536 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -5,6 +5,7 @@ on: push: branches: - dev + - next concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -15,6 +16,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + + - name: Fetch git tags + run: git fetch origin 'refs/tags/*:refs/tags/*' + - name: Cache pnpm modules uses: actions/cache@v3 with: @@ -22,14 +27,19 @@ jobs: key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}- + - uses: actions/setup-node@v3 with: node-version: 18 - - uses: pnpm/action-setup@v2.2.4 + + - uses: pnpm/action-setup@v2 with: + version: 7.x.x run_install: true + - name: Build packages run: pnpm build + - name: Sync run: .github/sync-to-mirrors.sh env: diff --git a/Cargo.lock b/Cargo.lock index 4f4f107b3..bb45602bf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -63,6 +63,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "aho-corasick" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04" +dependencies = [ + "memchr", +] + [[package]] name = "alloc-no-stdlib" version = "2.0.4" @@ -309,7 +318,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39991bc421ddf72f70159011b323ff49b0f783cc676a7287c59453da2e2531cf" dependencies = [ "atk-sys", - "bitflags", + "bitflags 1.3.2", "glib", "libc", ] @@ -358,7 +367,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08cee7a0952628fde958e149507c2bb321ab4fccfafd225da0b20adc956ef88a" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "devd-rs", "libc", @@ -425,6 +434,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24a6904aef64d73cf10ab17ebace7befb918b82164785cb89907993be7f83813" + [[package]] name = "blake2" version = "0.10.6" @@ -568,7 +583,7 @@ version = "0.16.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3125b15ec28b84c238f6f476c6034016a5f6cc0221cb514ca46c532139fc97d" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cairo-sys-rs", "glib", "libc", @@ -707,7 +722,7 @@ checksum = "14a1a858f532119338887a4b8e1af9c60de8249cd7bafd68036a489e261e37b6" dependencies = [ "anstream", "anstyle", - "bitflags", + "bitflags 1.3.2", "clap_lex", "strsim", ] @@ -735,7 +750,7 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f425db7937052c684daec3bd6375c8abe2d146dca4b8b143d6db777c39138f3a" dependencies = [ - "bitflags", + "bitflags 1.3.2", "block", "cocoa-foundation", "core-foundation", @@ -751,7 +766,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "931d3837c286f56e3c58423ce4eba12d08db2374461a785c86f672b08b5650d6" dependencies = [ - "bitflags", + "bitflags 1.3.2", "block", "core-foundation", "core-graphics-types", @@ -858,7 +873,7 @@ version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "core-graphics-types", "foreign-types", @@ -871,7 +886,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a68b68b3446082644c91ac778bf50cd4104bfb002b5a6a7c44cca5a2c70788b" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "foreign-types", "libc", @@ -1581,7 +1596,7 @@ version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa9cb33da481c6c040404a11f8212d193889e9b435db2c14fd86987f630d3ce1" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cairo-rs", "gdk-pixbuf", "gdk-sys", @@ -1597,7 +1612,7 @@ version = "0.16.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3578c60dee9d029ad86593ed88cb40f35c1b83360e12498d055022385dd9a05" dependencies = [ - "bitflags", + "bitflags 1.3.2", "gdk-pixbuf-sys", "gio", "glib", @@ -1734,7 +1749,7 @@ version = "0.16.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a1c84b4534a290a29160ef5c6eff2a9c95833111472e824fc5cb78b513dd092" dependencies = [ - "bitflags", + "bitflags 1.3.2", "futures-channel", "futures-core", "futures-io", @@ -1767,7 +1782,7 @@ version = "0.16.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ddd4df61a866ed7259d6189b8bcb1464989a77f1d85d25d002279bbe9dd38b2f" dependencies = [ - "bitflags", + "bitflags 1.3.2", "futures-channel", "futures-core", "futures-executor", @@ -1834,7 +1849,7 @@ version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc" dependencies = [ - "aho-corasick", + "aho-corasick 0.7.20", "bstr", "fnv", "log", @@ -1859,7 +1874,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4d3507d43908c866c805f74c9dd593c0ce7ba5c38e576e41846639cdcd4bee6" dependencies = [ "atk", - "bitflags", + "bitflags 1.3.2", "cairo-rs", "field-offset", "futures-channel", @@ -2199,7 +2214,7 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8069d3ec154eb856955c1c0fbffefbf5f3c40a104ec912d4797314c1801abff" dependencies = [ - "bitflags", + "bitflags 1.3.2", "inotify-sys", "libc", ] @@ -2259,6 +2274,15 @@ dependencies = [ "zeroize", ] +[[package]] +name = "iota-crypto" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92cdfcd73d2b8a67b913789ecd7fc06c68254f68cd2b24cc3f0419c7f8fe6bbe" +dependencies = [ + "autocfg", +] + [[package]] name = "iota_stronghold" version = "1.0.5" @@ -2267,7 +2291,7 @@ checksum = "6c5baaa2460627283f54b968db7a38c9c754dc6059157cae64550ed1b79c91aa" dependencies = [ "bincode", "hkdf", - "iota-crypto", + "iota-crypto 0.15.3", "rust-argon2", "serde", "stronghold-derive", @@ -2350,7 +2374,7 @@ version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "110b9902c80c12bf113c432d0b71c7a94490b294a8234f326fd0abca2fac0b00" dependencies = [ - "bitflags", + "bitflags 1.3.2", "glib", "javascriptcore-rs-sys", ] @@ -2420,7 +2444,7 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7668b7cff6a51fe61cdde64cd27c8a220786f399501b57ebe36f7d8112fd68" dependencies = [ - "bitflags", + "bitflags 1.3.2", "serde", "unicode-segmentation", ] @@ -2441,7 +2465,7 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8367585489f01bc55dd27404dcf56b95e6da061a256a666ab23be9ba96a2e587" dependencies = [ - "bitflags", + "bitflags 1.3.2", "libc", ] @@ -2757,7 +2781,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2032c77e030ddee34a6787a64166008da93f6a352b629261d0fee232b8742dd4" dependencies = [ - "bitflags", + "bitflags 1.3.2", "jni-sys", "ndk-sys", "num_enum", @@ -2791,7 +2815,7 @@ version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg-if", "libc", "memoffset 0.6.5", @@ -2803,7 +2827,7 @@ version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg-if", "libc", "memoffset 0.7.1", @@ -2833,7 +2857,7 @@ version = "5.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "58ea850aa68a06e48fdb069c0ec44d0d64c8dbffa49bf3b6f7f0a901fdea1ba9" dependencies = [ - "bitflags", + "bitflags 1.3.2", "crossbeam-channel", "filetime", "fsevent-sys", @@ -2968,6 +2992,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "num_threads" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" +dependencies = [ + "libc", +] + [[package]] name = "objc" version = "0.2.7" @@ -3035,7 +3068,7 @@ version = "0.10.49" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d2f106ab837a24e03672c59b1239669a0596406ff657c3c0835b6b7f0f35a33" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg-if", "foreign-types", "libc", @@ -3105,7 +3138,7 @@ version = "0.16.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdff66b271861037b89d028656184059e03b0b6ccb36003820be19f7200b1e94" dependencies = [ - "bitflags", + "bitflags 1.3.2", "gio", "glib", "libc", @@ -3393,7 +3426,7 @@ version = "0.17.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d708eaf860a19b19ce538740d2b4bdeeb8337fa53f7738455e706623ad5c638" dependencies = [ - "bitflags", + "bitflags 1.3.2", "crc32fast", "flate2", "miniz_oxide", @@ -3406,7 +3439,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e1f879b2998099c2d69ab9605d145d5b661195627eccc680002c4918a7fb6fa" dependencies = [ "autocfg", - "bitflags", + "bitflags 1.3.2", "cfg-if", "concurrent-queue", "libc", @@ -3627,7 +3660,7 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -3636,7 +3669,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -3656,7 +3689,7 @@ version = "1.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b1f693b24f6ac912f4893ef08244d70b6067480d2f1a46e950c9691e6749d1d" dependencies = [ - "aho-corasick", + "aho-corasick 0.7.20", "memchr", "regex-syntax", ] @@ -3808,7 +3841,7 @@ version = "0.37.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62b24138615de35e32031d041a09032ef3487a616d901ca4db224e7d557efae2" dependencies = [ - "bitflags", + "bitflags 1.3.2", "errno", "io-lifetimes", "libc", @@ -3919,7 +3952,7 @@ version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "core-foundation-sys", "libc", @@ -3942,7 +3975,7 @@ version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df320f1889ac4ba6bc0cdc9c9af7af4bd64bb927bccdf32d81140dc1f9be12fe" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cssparser", "derive_more", "fxhash", @@ -4173,7 +4206,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "82bc46048125fefd69d30b32b9d263d6556c9ffe82a7a7df181a86d912da5616" dependencies = [ - "bitflags", + "bitflags 1.3.2", "futures-channel", "gio", "glib", @@ -4250,7 +4283,7 @@ dependencies = [ "ahash", "atoi", "base64 0.13.1", - "bitflags", + "bitflags 1.3.2", "byteorder", "bytes 1.4.0", "crc", @@ -4295,6 +4328,7 @@ dependencies = [ "sqlx-rt", "stringprep", "thiserror", + "time 0.3.20", "tokio-stream", "url", "webpki-roots", @@ -4413,7 +4447,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d93abb10fbd11335d31c33a70b2523c0caab348215caa2ce6da04a268c30afcb" dependencies = [ "dirs", - "iota-crypto", + "iota-crypto 0.15.3", "libc", "libsodium-sys", "log", @@ -4444,7 +4478,7 @@ dependencies = [ "anyhow", "dirs-next", "hex", - "iota-crypto", + "iota-crypto 0.15.3", "once_cell", "paste", "serde", @@ -4517,7 +4551,7 @@ version = "0.18.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f2340617d383561b0ea25358b97ec2c2ba04db48c458ce71dd1b38d7fd09ac5" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cairo-rs", "cc", "cocoa", @@ -4696,10 +4730,10 @@ dependencies = [ [[package]] name = "tauri-plugin-authenticator" -version = "0.1.0" +version = "0.0.0" dependencies = [ "authenticator", - "base64 0.13.1", + "base64 0.21.0", "chrono", "log", "once_cell", @@ -4715,7 +4749,7 @@ dependencies = [ [[package]] name = "tauri-plugin-autostart" -version = "0.1.0" +version = "0.0.0" dependencies = [ "auto-launch", "log", @@ -4727,7 +4761,7 @@ dependencies = [ [[package]] name = "tauri-plugin-cli" -version = "0.1.0" +version = "0.0.0" dependencies = [ "clap", "log", @@ -4739,7 +4773,7 @@ dependencies = [ [[package]] name = "tauri-plugin-clipboard" -version = "0.1.0" +version = "0.0.0" dependencies = [ "arboard", "log", @@ -4752,7 +4786,7 @@ dependencies = [ [[package]] name = "tauri-plugin-dialog" -version = "0.1.0" +version = "0.0.0" dependencies = [ "glib", "log", @@ -4767,7 +4801,7 @@ dependencies = [ [[package]] name = "tauri-plugin-fs-watch" -version = "0.1.0" +version = "0.0.0" dependencies = [ "log", "notify", @@ -4780,7 +4814,7 @@ dependencies = [ [[package]] name = "tauri-plugin-global-shortcut" -version = "0.1.0" +version = "0.0.0" dependencies = [ "global-hotkey", "log", @@ -4805,7 +4839,7 @@ dependencies = [ [[package]] name = "tauri-plugin-log" -version = "0.1.0" +version = "0.0.0" dependencies = [ "android_logger", "byte-unit", @@ -4826,6 +4860,7 @@ dependencies = [ name = "tauri-plugin-persisted-scope" version = "0.1.0" dependencies = [ + "aho-corasick 1.0.1", "bincode", "log", "serde", @@ -4836,7 +4871,7 @@ dependencies = [ [[package]] name = "tauri-plugin-positioner" -version = "0.2.7" +version = "1.0.4" dependencies = [ "log", "serde", @@ -4848,7 +4883,7 @@ dependencies = [ [[package]] name = "tauri-plugin-shell" -version = "0.1.0" +version = "0.0.0" dependencies = [ "encoding_rs", "log", @@ -4864,34 +4899,35 @@ dependencies = [ [[package]] name = "tauri-plugin-single-instance" -version = "0.1.0" +version = "0.0.0" dependencies = [ "log", "serde", "serde_json", "tauri", "thiserror", - "windows-sys 0.42.0", + "windows-sys 0.48.0", "zbus", ] [[package]] name = "tauri-plugin-sql" -version = "0.1.0" +version = "0.0.0" dependencies = [ - "futures", + "futures-core", "log", "serde", "serde_json", "sqlx", "tauri", "thiserror", + "time 0.3.20", "tokio", ] [[package]] name = "tauri-plugin-store" -version = "0.1.0" +version = "0.0.0" dependencies = [ "log", "serde", @@ -4902,10 +4938,10 @@ dependencies = [ [[package]] name = "tauri-plugin-stronghold" -version = "0.1.0" +version = "0.0.0" dependencies = [ "hex", - "iota-crypto", + "iota-crypto 0.17.1", "iota_stronghold", "log", "rand 0.8.5", @@ -4919,7 +4955,7 @@ dependencies = [ [[package]] name = "tauri-plugin-upload" -version = "0.1.0" +version = "0.0.0" dependencies = [ "futures-util", "log", @@ -4935,7 +4971,7 @@ dependencies = [ [[package]] name = "tauri-plugin-websocket" -version = "0.1.0" +version = "0.0.0" dependencies = [ "futures-util", "log", @@ -4953,7 +4989,7 @@ name = "tauri-plugin-window-state" version = "0.1.0" dependencies = [ "bincode", - "bitflags", + "bitflags 2.2.1", "log", "serde", "serde_json", @@ -5140,6 +5176,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd0cbfecb4d19b5ea75bb31ad904eb5b9fa13f21079c3b92017ebdf4999a5890" dependencies = [ "itoa 1.0.6", + "libc", + "num_threads", "serde", "time-core", "time-macros", @@ -5718,7 +5756,7 @@ version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d8eea819afe15eb8dcdff4f19d8bfda540bae84d874c10e6f4b8faf2d6704bd1" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cairo-rs", "gdk", "gdk-sys", @@ -5742,7 +5780,7 @@ version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0ac7a95ddd3fdfcaf83d8e513b4b1ad101b95b413b6aa6662ed95f284fc3d5b" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cairo-sys-rs", "gdk-sys", "gio-sys", diff --git a/package.json b/package.json index 9ad65f84d..18e0f3009 100644 --- a/package.json +++ b/package.json @@ -10,20 +10,22 @@ "format-check": "prettier --check ." }, "devDependencies": { - "@rollup/plugin-node-resolve": "^15.0.1", - "@rollup/plugin-terser": "^0.4.0", - "@rollup/plugin-typescript": "^11.0.0", - "@typescript-eslint/eslint-plugin": "^5.0.0", - "@typescript-eslint/parser": "^5.46.1", - "eslint": "^8.0.1", - "eslint-config-prettier": "^8.5.0", - "eslint-config-standard-with-typescript": "^34.0.0", - "eslint-plugin-import": "^2.25.2", - "eslint-plugin-n": "^15.0.0", - "eslint-plugin-promise": "^6.0.0", - "prettier": "^2.8.1", - "rollup": "^3.7.4", - "typescript": "^4.9.4" + "@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": "^34.0.1", + "eslint-plugin-import": "^2.27.5", + "eslint-plugin-n": "^15.7.0", + "eslint-plugin-promise": "^6.1.1", + "prettier": "^2.8.7", + "rollup": "^3.20.4", + "typescript": "^5.0.4" }, - "packageManager": "pnpm@7.18.1" + "engines": { + "pnpm": ">=7.24.2" + } } diff --git a/plugins/authenticator/Cargo.toml b/plugins/authenticator/Cargo.toml index 0df4e4b16..007e63f46 100644 --- a/plugins/authenticator/Cargo.toml +++ b/plugins/authenticator/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-authenticator" -version = "0.1.0" +version = "0.0.0" description = "Use hardware security-keys in your Tauri App." authors.workspace = true license.workspace = true @@ -18,7 +18,7 @@ thiserror.workspace = true authenticator = "0.3.1" once_cell = "1" sha2 = "0.10" -base64 = { version = "^0.13" } +base64 = "0.21" u2f = "0.2" chrono = "0.4" diff --git a/plugins/authenticator/package.json b/plugins/authenticator/package.json index d859eef49..7374695f0 100644 --- a/plugins/authenticator/package.json +++ b/plugins/authenticator/package.json @@ -25,7 +25,7 @@ "LICENSE" ], "devDependencies": { - "tslib": "^2.4.1" + "tslib": "^2.5.0" }, "dependencies": { "@tauri-apps/api": "^1.2.0" diff --git a/plugins/authenticator/src/auth.rs b/plugins/authenticator/src/auth.rs index d75084789..c334173d4 100644 --- a/plugins/authenticator/src/auth.rs +++ b/plugins/authenticator/src/auth.rs @@ -6,7 +6,7 @@ use authenticator::{ authenticatorservice::AuthenticatorService, statecallback::StateCallback, AuthenticatorTransports, KeyHandle, RegisterFlags, SignFlags, StatusUpdate, }; -use base64::{decode_config, encode_config, URL_SAFE_NO_PAD}; +use base64::{engine::general_purpose::URL_SAFE_NO_PAD, Engine}; use once_cell::sync::Lazy; use serde::Serialize; use sha2::{Digest, Sha256}; @@ -75,9 +75,9 @@ pub fn register(application: String, timeout: u64, challenge: String) -> crate:: let (key_handle, public_key) = _u2f_get_key_handle_and_public_key_from_register_response(®ister_data).unwrap(); - let key_handle_base64 = encode_config(key_handle, URL_SAFE_NO_PAD); - let public_key_base64 = encode_config(public_key, URL_SAFE_NO_PAD); - let register_data_base64 = encode_config(®ister_data, URL_SAFE_NO_PAD); + let key_handle_base64 = URL_SAFE_NO_PAD.encode(key_handle); + let public_key_base64 = URL_SAFE_NO_PAD.encode(public_key); + let register_data_base64 = URL_SAFE_NO_PAD.encode(®ister_data); println!("Key Handle: {}", &key_handle_base64); println!("Public Key: {}", &public_key_base64); @@ -108,7 +108,7 @@ pub fn sign( challenge: String, key_handle: String, ) -> crate::Result { - let credential = match decode_config(key_handle, URL_SAFE_NO_PAD) { + let credential = match URL_SAFE_NO_PAD.decode(key_handle) { Ok(v) => v, Err(e) => { return Err(e.into()); @@ -152,19 +152,16 @@ pub fn sign( let (_, handle_used, sign_data, device_info) = sign_result.unwrap(); - let sig = encode_config(sign_data, URL_SAFE_NO_PAD); + let sig = URL_SAFE_NO_PAD.encode(sign_data); println!("Sign result: {sig}"); - println!( - "Key handle used: {}", - encode_config(&handle_used, URL_SAFE_NO_PAD) - ); + println!("Key handle used: {}", URL_SAFE_NO_PAD.encode(&handle_used)); println!("Device info: {}", &device_info); println!("Done."); let res = serde_json::to_string(&Signature { sign_data: sig, - key_handle: encode_config(&handle_used, URL_SAFE_NO_PAD), + key_handle: URL_SAFE_NO_PAD.encode(&handle_used), })?; Ok(res) } diff --git a/plugins/authenticator/src/u2f.rs b/plugins/authenticator/src/u2f.rs index 026917cab..e8bd5de96 100644 --- a/plugins/authenticator/src/u2f.rs +++ b/plugins/authenticator/src/u2f.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -use base64::{decode_config, encode_config, URL_SAFE_NO_PAD}; +use base64::{engine::general_purpose::URL_SAFE_NO_PAD, Engine}; use chrono::prelude::*; use serde::Serialize; use std::convert::Into; @@ -15,7 +15,7 @@ static VERSION: &str = "U2F_V2"; pub fn make_challenge(app_id: &str, challenge_bytes: Vec) -> Challenge { let utc: DateTime = Utc::now(); Challenge { - challenge: encode_config(challenge_bytes, URL_SAFE_NO_PAD), + challenge: URL_SAFE_NO_PAD.encode(challenge_bytes), timestamp: format!("{utc:?}"), app_id: app_id.to_string(), } @@ -35,10 +35,10 @@ pub fn verify_registration( register_data: String, client_data: String, ) -> crate::Result { - let challenge_bytes = decode_config(challenge, URL_SAFE_NO_PAD)?; + let challenge_bytes = URL_SAFE_NO_PAD.decode(challenge)?; let challenge = make_challenge(&app_id, challenge_bytes); let client_data_bytes: Vec = client_data.as_bytes().into(); - let client_data_base64 = encode_config(client_data_bytes, URL_SAFE_NO_PAD); + let client_data_base64 = URL_SAFE_NO_PAD.encode(client_data_bytes); let client = U2f::new(app_id); match client.register_response( challenge, @@ -50,8 +50,8 @@ pub fn verify_registration( ) { Ok(v) => { let rv = RegistrationVerification { - key_handle: encode_config(&v.key_handle, URL_SAFE_NO_PAD), - pubkey: encode_config(&v.pub_key, URL_SAFE_NO_PAD), + key_handle: URL_SAFE_NO_PAD.encode(&v.key_handle), + pubkey: URL_SAFE_NO_PAD.encode(&v.pub_key), device_name: v.device_name, }; Ok(serde_json::to_string(&rv)?) @@ -74,12 +74,12 @@ pub fn verify_signature( key_handle: String, pub_key: String, ) -> crate::Result { - let challenge_bytes = decode_config(challenge, URL_SAFE_NO_PAD)?; + let challenge_bytes = URL_SAFE_NO_PAD.decode(challenge)?; let chal = make_challenge(&app_id, challenge_bytes); let client_data_bytes: Vec = client_data.as_bytes().into(); - let client_data_base64 = encode_config(client_data_bytes, URL_SAFE_NO_PAD); - let key_handle_bytes = decode_config(&key_handle, URL_SAFE_NO_PAD)?; - let pubkey_bytes = decode_config(pub_key, URL_SAFE_NO_PAD)?; + let client_data_base64 = URL_SAFE_NO_PAD.encode(client_data_bytes); + let key_handle_bytes = URL_SAFE_NO_PAD.decode(&key_handle)?; + let pubkey_bytes = URL_SAFE_NO_PAD.decode(pub_key)?; let client = U2f::new(app_id); let mut _counter: u32 = 0; match client.sign_response( diff --git a/plugins/autostart/Cargo.toml b/plugins/autostart/Cargo.toml index dc42168d2..8d0abc507 100644 --- a/plugins/autostart/Cargo.toml +++ b/plugins/autostart/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-autostart" -version = "0.1.0" +version = "0.0.0" description = "Automatically launch your application at startup." authors.workspace = true license.workspace = true diff --git a/plugins/autostart/package.json b/plugins/autostart/package.json index dd5304677..f8cf56cbb 100644 --- a/plugins/autostart/package.json +++ b/plugins/autostart/package.json @@ -24,7 +24,7 @@ "LICENSE" ], "devDependencies": { - "tslib": "^2.4.1" + "tslib": "^2.5.0" }, "dependencies": { "@tauri-apps/api": "^1.2.0" diff --git a/plugins/cli/Cargo.toml b/plugins/cli/Cargo.toml index bb95b67e2..f6dc2cd3c 100644 --- a/plugins/cli/Cargo.toml +++ b/plugins/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-cli" -version = "0.1.0" +version = "0.0.0" edition.workspace = true authors.workspace = true license.workspace = true diff --git a/plugins/clipboard/Cargo.toml b/plugins/clipboard/Cargo.toml index 5c0596ba0..00864ff44 100644 --- a/plugins/clipboard/Cargo.toml +++ b/plugins/clipboard/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-clipboard" -version = "0.1.0" +version = "0.0.0" edition.workspace = true authors.workspace = true license.workspace = true diff --git a/plugins/dialog/Cargo.toml b/plugins/dialog/Cargo.toml index eef657195..905de823b 100644 --- a/plugins/dialog/Cargo.toml +++ b/plugins/dialog/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-dialog" -version = "0.1.0" +version = "0.0.0" edition.workspace = true authors.workspace = true license.workspace = true diff --git a/plugins/fs-watch/Cargo.toml b/plugins/fs-watch/Cargo.toml index f939dd2bd..8431bae07 100644 --- a/plugins/fs-watch/Cargo.toml +++ b/plugins/fs-watch/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-fs-watch" -version = "0.1.0" +version = "0.0.0" description = "Watch files and directories for changes." authors.workspace = true license.workspace = true diff --git a/plugins/fs-watch/package.json b/plugins/fs-watch/package.json index 2f080773b..4ac452410 100644 --- a/plugins/fs-watch/package.json +++ b/plugins/fs-watch/package.json @@ -25,7 +25,7 @@ "LICENSE" ], "devDependencies": { - "tslib": "^2.4.1" + "tslib": "^2.5.0" }, "dependencies": { "@tauri-apps/api": "^1.2.0" diff --git a/plugins/fs/Cargo.toml b/plugins/fs/Cargo.toml index 207dac8a0..6e2add71c 100644 --- a/plugins/fs/Cargo.toml +++ b/plugins/fs/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-fs" -version = "0.1.0" +version = "0.0.0" description = "Access the file system." edition = "2021" #authors.workspace = true diff --git a/plugins/global-shortcut/Cargo.toml b/plugins/global-shortcut/Cargo.toml index 24e0b4d05..842695740 100644 --- a/plugins/global-shortcut/Cargo.toml +++ b/plugins/global-shortcut/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-global-shortcut" -version = "0.1.0" +version = "0.0.0" edition.workspace = true authors.workspace = true license.workspace = true diff --git a/plugins/http/Cargo.toml b/plugins/http/Cargo.toml index a60abb354..ef5741c66 100644 --- a/plugins/http/Cargo.toml +++ b/plugins/http/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-http" -version = "0.1.0" +version = "0.0.0" edition = "2021" #edition.workspace = true #authors.workspace = true diff --git a/plugins/http/package.json b/plugins/http/package.json index 7f799acb3..cb35a7742 100644 --- a/plugins/http/package.json +++ b/plugins/http/package.json @@ -24,7 +24,7 @@ "LICENSE" ], "devDependencies": { - "tslib": "^2.4.1" + "tslib": "^2.5.0" }, "dependencies": { "@tauri-apps/api": "^1.2.0" diff --git a/plugins/log/Cargo.toml b/plugins/log/Cargo.toml index 05a3b0581..c33705495 100644 --- a/plugins/log/Cargo.toml +++ b/plugins/log/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-log" -version = "0.1.0" +version = "0.0.0" description = "Configurable logging for your Tauri app." authors.workspace = true license.workspace = true @@ -19,7 +19,7 @@ tauri.workspace = true serde_repr = "0.1" byte-unit = "4.0" log = { workspace = true, features = ["kv_unstable"] } -time = { version = "0.3", features = ["formatting"] } +time = { version = "0.3", features = ["formatting", "local-offset"] } fern = "0.6" [target."cfg(target_os = \"android\")".dependencies] diff --git a/plugins/log/package.json b/plugins/log/package.json index fefd3c339..b610090d5 100644 --- a/plugins/log/package.json +++ b/plugins/log/package.json @@ -25,7 +25,7 @@ "LICENSE" ], "devDependencies": { - "tslib": "^2.4.1" + "tslib": "^2.5.0" }, "dependencies": { "@tauri-apps/api": "^1.2.0" diff --git a/plugins/log/src/lib.rs b/plugins/log/src/lib.rs index 635206eba..4f7f3134b 100644 --- a/plugins/log/src/lib.rs +++ b/plugins/log/src/lib.rs @@ -21,6 +21,7 @@ use tauri::{ }; pub use fern; +use time::OffsetDateTime; #[cfg(target_os = "ios")] mod ios { @@ -56,6 +57,7 @@ mod ios { const DEFAULT_MAX_FILE_SIZE: u128 = 40000; const DEFAULT_ROTATION_STRATEGY: RotationStrategy = RotationStrategy::KeepOne; +const DEFAULT_TIMEZONE_STRATEGY: TimezoneStrategy = TimezoneStrategy::UseUtc; const DEFAULT_LOG_TARGETS: [LogTarget; 2] = [LogTarget::Stdout, LogTarget::LogDir]; /// An enum representing the available verbosity levels of the logger. @@ -115,6 +117,23 @@ pub enum RotationStrategy { KeepOne, } +#[derive(Debug, Clone)] +pub enum TimezoneStrategy { + UseUtc, + UseLocal, +} + +impl TimezoneStrategy { + pub fn get_now(&self) -> OffsetDateTime { + match self { + TimezoneStrategy::UseUtc => OffsetDateTime::now_utc(), + TimezoneStrategy::UseLocal => { + OffsetDateTime::now_local().unwrap_or_else(|_| OffsetDateTime::now_utc()) + } // Fallback to UTC since Rust cannot determine local timezone + } + } +} + #[derive(Debug, Serialize, Clone)] struct RecordPayload { message: String, @@ -177,6 +196,7 @@ fn log( pub struct Builder { dispatch: fern::Dispatch, rotation_strategy: RotationStrategy, + timezone_strategy: TimezoneStrategy, max_file_size: u128, targets: Vec, } @@ -194,7 +214,7 @@ impl Default for Builder { #[cfg(desktop)] format_args!( "{}[{}][{}] {}", - time::OffsetDateTime::now_utc().format(&format).unwrap(), + DEFAULT_TIMEZONE_STRATEGY.get_now().format(&format).unwrap(), record.target(), record.level(), message @@ -204,6 +224,7 @@ impl Default for Builder { Self { dispatch, rotation_strategy: DEFAULT_ROTATION_STRATEGY, + timezone_strategy: DEFAULT_TIMEZONE_STRATEGY, max_file_size: DEFAULT_MAX_FILE_SIZE, targets: DEFAULT_LOG_TARGETS.into(), } @@ -220,6 +241,24 @@ impl Builder { self } + pub fn timezone_strategy(mut self, timezone_strategy: TimezoneStrategy) -> Self { + self.timezone_strategy = timezone_strategy.clone(); + + let format = + time::format_description::parse("[[[year]-[month]-[day]][[[hour]:[minute]:[second]]") + .unwrap(); + self.dispatch = fern::Dispatch::new().format(move |out, message, record| { + out.finish(format_args!( + "{}[{}][{}] {}", + timezone_strategy.get_now().format(&format).unwrap(), + record.target(), + record.level(), + message + )) + }); + self + } + pub fn max_file_size(mut self, max_file_size: u128) -> Self { self.max_file_size = max_file_size; self @@ -266,10 +305,12 @@ impl Builder { let format = time::format_description::parse("[[[year]-[month]-[day]][[[hour]:[minute]:[second]]") .unwrap(); + + let timezone_strategy = self.timezone_strategy.clone(); self.format(move |out, message, record| { out.finish(format_args!( "{}[{}][{}] {}", - time::OffsetDateTime::now_utc().format(&format).unwrap(), + timezone_strategy.get_now().format(&format).unwrap(), record.target(), colors.color(record.level()), message @@ -319,6 +360,7 @@ impl Builder { &path, app_name, &self.rotation_strategy, + &self.timezone_strategy, self.max_file_size, )?)? .into() @@ -336,6 +378,7 @@ impl Builder { &path, app_name, &self.rotation_strategy, + &self.timezone_strategy, self.max_file_size, )?)? .into() @@ -370,6 +413,7 @@ fn get_log_file_path( dir: &impl AsRef, app_name: &str, rotation_strategy: &RotationStrategy, + timezone_strategy: &TimezoneStrategy, max_file_size: u128, ) -> plugin::Result { let path = dir.as_ref().join(format!("{app_name}.log")); @@ -382,7 +426,8 @@ fn get_log_file_path( let to = dir.as_ref().join(format!( "{}_{}.log", app_name, - time::OffsetDateTime::now_utc() + timezone_strategy + .get_now() .format( &time::format_description::parse( "[year]-[month]-[day]_[hour]-[minute]-[second]" diff --git a/plugins/persisted-scope/Cargo.toml b/plugins/persisted-scope/Cargo.toml index 7bc30228d..4e1f24d05 100644 --- a/plugins/persisted-scope/Cargo.toml +++ b/plugins/persisted-scope/Cargo.toml @@ -15,6 +15,7 @@ serde_json.workspace = true tauri.workspace = true log.workspace = true thiserror.workspace = true +aho-corasick = "1.0" bincode = "1" [features] diff --git a/plugins/persisted-scope/src/lib.rs b/plugins/persisted-scope/src/lib.rs index c7fbc4338..1473056c8 100644 --- a/plugins/persisted-scope/src/lib.rs +++ b/plugins/persisted-scope/src/lib.rs @@ -2,19 +2,34 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT +use aho_corasick::AhoCorasick; use serde::{Deserialize, Serialize}; use tauri::{ plugin::{Builder, TauriPlugin}, - FsScopeEvent, Manager, Runtime, + AppHandle, FsScopeEvent, Manager, Runtime, }; use std::{ fs::{create_dir_all, File}, io::Write, + path::Path, }; const SCOPE_STATE_FILENAME: &str = ".persisted-scope"; +// 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"\\?\\\?\"] +const PATTERNS: &[&str] = &[ + r"[[]", + r"[]]", + r"[?]", + r"[*]", + r"\?\?", + r"\\?\\?\", + r"\\?\\\?\", +]; +const REPLACE_WITH: &[&str] = &[r"[", r"]", r"?", r"*", r"\?", r"\\?\", r"\\?\"]; + #[derive(Debug, thiserror::Error)] enum Error { #[error(transparent)] @@ -33,6 +48,41 @@ struct Scope { forbidden_patterns: Vec, } +fn fix_pattern(ac: &AhoCorasick, s: &str) -> String { + let s = ac.replace_all(s, REPLACE_WITH); + + if ac.find(&s).is_some() { + return fix_pattern(ac, &s); + } + + s +} + +fn save_scopes(app: &AppHandle, app_dir: &Path, scope_state_path: &Path) { + let fs_scope = app.fs_scope(); + + let scope = Scope { + allowed_paths: fs_scope + .allowed_patterns() + .into_iter() + .map(|p| p.to_string()) + .collect(), + forbidden_patterns: fs_scope + .forbidden_patterns() + .into_iter() + .map(|p| p.to_string()) + .collect(), + }; + + let _ = create_dir_all(app_dir) + .and_then(|_| File::create(scope_state_path)) + .map_err(Error::Io) + .and_then(|mut f| { + f.write_all(&bincode::serialize(&scope).map_err(Error::from)?) + .map_err(Into::into) + }); +} + pub fn init() -> TauriPlugin { Builder::new("persisted-scope") .setup(|app, _api| { @@ -49,49 +99,38 @@ pub fn init() -> TauriPlugin { #[cfg(feature = "protocol-asset")] let _ = asset_protocol_scope.forbid_file(&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) .map_err(Error::from) .and_then(|scope| bincode::deserialize(&scope).map_err(Into::into)) .unwrap_or_default(); for allowed in &scope.allowed_paths { - // allows the path as is - let _ = fs_scope.allow_file(allowed); + let allowed = fix_pattern(&ac, allowed); + + let _ = fs_scope.allow_file(&allowed); #[cfg(feature = "protocol-asset")] - let _ = asset_protocol_scope.allow_file(allowed); + let _ = asset_protocol_scope.allow_file(&allowed); } for forbidden in &scope.forbidden_patterns { - // forbid the path as is - let _ = fs_scope.forbid_file(forbidden); + let forbidden = fix_pattern(&ac, forbidden); + + let _ = fs_scope.forbid_file(&forbidden); #[cfg(feature = "protocol-asset")] - let _ = asset_protocol_scope.forbid_file(forbidden); + let _ = asset_protocol_scope.forbid_file(&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); } fs_scope.listen(move |event| { - let fs_scope = app.fs_scope(); if let FsScopeEvent::PathAllowed(_) = event { - let scope = Scope { - allowed_paths: fs_scope - .allowed_patterns() - .into_iter() - .map(|p| p.to_string()) - .collect(), - forbidden_patterns: fs_scope - .forbidden_patterns() - .into_iter() - .map(|p| p.to_string()) - .collect(), - }; - let scope_state_path = scope_state_path.clone(); - - let _ = create_dir_all(&app_dir) - .and_then(|_| File::create(scope_state_path)) - .map_err(Error::Io) - .and_then(|mut f| { - f.write_all(&bincode::serialize(&scope).map_err(Error::from)?) - .map_err(Into::into) - }); + save_scopes(&app, &app_dir, &scope_state_path); } }); } diff --git a/plugins/positioner/Cargo.toml b/plugins/positioner/Cargo.toml index 08155a5d8..dcab86c96 100644 --- a/plugins/positioner/Cargo.toml +++ b/plugins/positioner/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-positioner" -version = "0.2.7" +version = "1.0.4" description = "Position your windows at well-known locations." authors.workspace = true license.workspace = true diff --git a/plugins/positioner/package.json b/plugins/positioner/package.json index 0cc584282..83acb56f3 100644 --- a/plugins/positioner/package.json +++ b/plugins/positioner/package.json @@ -1,6 +1,6 @@ { "name": "tauri-plugin-positioner-api", - "version": "0.0.0", + "version": "0.2.7", "description": "Position your windows at well-known locations.", "license": "MIT or APACHE-2.0", "authors": [ @@ -25,7 +25,7 @@ "LICENSE" ], "devDependencies": { - "tslib": "^2.4.1" + "tslib": "^2.5.0" }, "dependencies": { "@tauri-apps/api": "^1.2.0" diff --git a/plugins/shell/Cargo.toml b/plugins/shell/Cargo.toml index e3df745d4..fa5170998 100644 --- a/plugins/shell/Cargo.toml +++ b/plugins/shell/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-shell" -version = "0.1.0" +version = "0.0.0" edition.workspace = true authors.workspace = true license.workspace = true diff --git a/plugins/single-instance/Cargo.toml b/plugins/single-instance/Cargo.toml index 4762e0339..be46f3aa2 100644 --- a/plugins/single-instance/Cargo.toml +++ b/plugins/single-instance/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-single-instance" -version = "0.1.0" +version = "0.0.0" description = "Ensure a single instance of your tauri app is running." authors.workspace = true license.workspace = true @@ -18,7 +18,7 @@ log.workspace = true thiserror.workspace = true [target.'cfg(target_os = "windows")'.dependencies.windows-sys] -version = "0.42" +version = "0.48" features = [ "Win32_System_Threading", "Win32_System_DataExchange", diff --git a/plugins/single-instance/README.md b/plugins/single-instance/README.md index 1efbba906..595d6b176 100644 --- a/plugins/single-instance/README.md +++ b/plugins/single-instance/README.md @@ -1,4 +1,4 @@ -![tauri-plugin-single-instance](banner.jpg) +![tauri-plugin-single-instance](banner.png) Ensure a single instance of your tauri app is running. @@ -38,7 +38,7 @@ struct Payload { fn main() { tauri::Builder::default() - .plugin(auri_plugin_single_instance::init(|app, argv, cwd| { + .plugin(tauri_plugin_single_instance::init(|app, argv, cwd| { println!("{}, {argv:?}, {cwd}", app.package_info().name); app.emit_all("single-instance", Payload { args: argv, cwd }).unwrap(); diff --git a/plugins/sql/Cargo.toml b/plugins/sql/Cargo.toml index c72e237c0..91a839acb 100644 --- a/plugins/sql/Cargo.toml +++ b/plugins/sql/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-sql" -version = "0.1.0" +version = "0.0.0" description = "Interface with SQL databases." authors.workspace = true license.workspace = true @@ -15,9 +15,10 @@ serde_json.workspace = true tauri.workspace = true log.workspace = true thiserror.workspace = true -sqlx = { version = "0.6", features = ["runtime-tokio-rustls", "json"] } +futures-core = "0.3" +sqlx = { version = "0.6", features = ["runtime-tokio-rustls", "json", "time"] } +time = "0.3" tokio = { version = "1", features = ["sync"] } -futures = "0.3" [features] sqlite = ["sqlx/sqlite"] diff --git a/plugins/sql/package.json b/plugins/sql/package.json index f60d81167..a5607cd67 100644 --- a/plugins/sql/package.json +++ b/plugins/sql/package.json @@ -25,7 +25,7 @@ "LICENSE" ], "devDependencies": { - "tslib": "^2.4.1" + "tslib": "^2.5.0" }, "dependencies": { "@tauri-apps/api": "^1.2.0" diff --git a/plugins/sql/src/decode/mod.rs b/plugins/sql/src/decode/mod.rs new file mode 100644 index 000000000..415c99b87 --- /dev/null +++ b/plugins/sql/src/decode/mod.rs @@ -0,0 +1,15 @@ +#[cfg(feature = "mysql")] +mod mysql; +#[cfg(feature = "postgres")] +mod postgres; +#[cfg(feature = "sqlite")] +mod sqlite; + +#[cfg(feature = "mysql")] +pub(crate) use mysql::to_json; + +#[cfg(feature = "postgres")] +pub(crate) use postgres::to_json; + +#[cfg(feature = "sqlite")] +pub(crate) use sqlite::to_json; diff --git a/plugins/sql/src/decode/mysql.rs b/plugins/sql/src/decode/mysql.rs new file mode 100644 index 000000000..e68bd1ac2 --- /dev/null +++ b/plugins/sql/src/decode/mysql.rs @@ -0,0 +1,90 @@ +use serde_json::Value as JsonValue; +use sqlx::{mysql::MySqlValueRef, TypeInfo, Value, ValueRef}; +use time::{Date, OffsetDateTime, PrimitiveDateTime, Time}; + +use crate::Error; + +pub(crate) fn to_json(v: MySqlValueRef) -> Result { + if v.is_null() { + return Ok(JsonValue::Null); + } + + let res = match v.type_info().name() { + "CHAR" | "VARCHAR" | "TINYTEXT" | "TEXT" | "MEDIUMTEXT" | "LONGTEXT" | "ENUM" => { + if let Ok(v) = ValueRef::to_owned(&v).try_decode() { + JsonValue::String(v) + } else { + JsonValue::Null + } + } + "FLOAT" | "DOUBLE" => { + if let Ok(v) = ValueRef::to_owned(&v).try_decode::() { + JsonValue::from(v) + } else { + JsonValue::Null + } + } + "TINYINT" | "SMALLINT" | "INT" | "MEDIUMINT" | "BIGINT" => { + if let Ok(v) = ValueRef::to_owned(&v).try_decode::() { + JsonValue::Number(v.into()) + } else { + JsonValue::Null + } + } + "TINYINT UNSIGNED" | "SMALLINT UNSIGNED" | "INT UNSIGNED" | "MEDIUMINT UNSIGNED" + | "BIGINT UNSIGNED" | "YEAR" => { + if let Ok(v) = ValueRef::to_owned(&v).try_decode::() { + JsonValue::Number(v.into()) + } else { + JsonValue::Null + } + } + "BOOLEAN" => { + if let Ok(v) = ValueRef::to_owned(&v).try_decode() { + JsonValue::Bool(v) + } else { + JsonValue::Null + } + } + "DATE" => { + if let Ok(v) = ValueRef::to_owned(&v).try_decode::() { + JsonValue::String(v.to_string()) + } else { + JsonValue::Null + } + } + "TIME" => { + if let Ok(v) = ValueRef::to_owned(&v).try_decode::