From 77f0cf4033cff0bc6ed6b5b02c602c27a08863fe Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Tue, 17 Sep 2024 12:53:30 -0300 Subject: [PATCH] chore: update example and doc --- README.md | 11 +- examples/vanilla/package.json | 2 +- examples/vanilla/pnpm-lock.yaml | 125 ++++++++++++++++++ .../vanilla/src-tauri/capabilities/app.json | 11 ++ src/invoke_system.js | 1 - 5 files changed, 138 insertions(+), 12 deletions(-) create mode 100644 examples/vanilla/pnpm-lock.yaml create mode 100644 examples/vanilla/src-tauri/capabilities/app.json diff --git a/README.md b/README.md index d7d5f72..c7a24e7 100644 --- a/README.md +++ b/README.md @@ -33,13 +33,4 @@ fn main() { } ``` -To invoke a custom command from your own or remote system you can use `curl` or similar tooling. -See [`examples/vanilla`](examples/vanilla/) to test this on your system. - -An example command to invoke the `exit` command in the example Tauri app exposing port `18436` (randomly chosen port) could look like: - -```sh -curl localhost:18436/main -H 'Content-Type: application/json' -d '{ "__tauriModule": "Process", "cmd": "exit", "callback": 1234, "error": 1234, "message": {"cmd": "exit", "exitCode": 1 } }' -``` - - +See [`examples/vanilla`](examples/vanilla/) to see the custom invoke system in practice. diff --git a/examples/vanilla/package.json b/examples/vanilla/package.json index c5b8c30..b062105 100644 --- a/examples/vanilla/package.json +++ b/examples/vanilla/package.json @@ -10,6 +10,6 @@ "author": "", "license": "MIT", "dependencies": { - "@tauri-apps/cli": "^1.5.2" + "@tauri-apps/cli": "^2.0.0-rc" } } diff --git a/examples/vanilla/pnpm-lock.yaml b/examples/vanilla/pnpm-lock.yaml new file mode 100644 index 0000000..86a1e70 --- /dev/null +++ b/examples/vanilla/pnpm-lock.yaml @@ -0,0 +1,125 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + dependencies: + '@tauri-apps/cli': + specifier: ^2.0.0-rc + version: 2.0.0-rc.16 + +packages: + + '@tauri-apps/cli-darwin-arm64@2.0.0-rc.16': + resolution: {integrity: sha512-lISZU4gG0c9PbY7h/j/gW7nJLxZEygNBrYEET6zN8R99Znf5rSO+CfjenaMcJUUj6yTAd8gzdakRpLqNSAWegA==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [darwin] + + '@tauri-apps/cli-darwin-x64@2.0.0-rc.16': + resolution: {integrity: sha512-D9uxPCxpyYcTSQulJGFX3POAKPOJd8WcWHFH8x6YVM1cIx6EWRXIE1sZnPUOjFr7qCg+bSdYdr8/BFHcZGcApQ==} + engines: {node: '>= 10'} + cpu: [x64] + os: [darwin] + + '@tauri-apps/cli-linux-arm-gnueabihf@2.0.0-rc.16': + resolution: {integrity: sha512-WsVdKm4D1I1XV8I9yRnmOINZRwwWfh6xcLV3m19+B9g6TohK8RkRxWfxvs3TLQlWOLQ6lo8BzS9rzXB+KtjDpg==} + engines: {node: '>= 10'} + cpu: [arm] + os: [linux] + + '@tauri-apps/cli-linux-arm64-gnu@2.0.0-rc.16': + resolution: {integrity: sha512-2jpZDagNs6rrqposHJihHBayttgOl5aB2+bYiVEC6ye+haiFtmYmpdaPOaVIw+YVQs6lepf5PVrisCoU9DmYsg==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [linux] + + '@tauri-apps/cli-linux-arm64-musl@2.0.0-rc.16': + resolution: {integrity: sha512-SNEDcB+sWOls/B0a+UpUHVa/oegvlXXKYWsTxuXtgWIr5VbWG7rXLZ3fZpLLP3SpRVGTGTnABcyqshFbWSqqKQ==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [linux] + + '@tauri-apps/cli-linux-x64-gnu@2.0.0-rc.16': + resolution: {integrity: sha512-Zsq29MM1ooeH1+chQBa7ffDFnzAZebBBFdsvs4e05tS1H8gn4oKE+PSMn9p/okzVXykEk9ri2/n7BG1XFeifMA==} + engines: {node: '>= 10'} + cpu: [x64] + os: [linux] + + '@tauri-apps/cli-linux-x64-musl@2.0.0-rc.16': + resolution: {integrity: sha512-g+pwSuis2YMxhJJ/pJYwp/Nps5CWvlv/5MV5UfDvClkCkeAyzIqVX+HbBLPcs5S0CePUQNeP0j4d4jBWUqZZQg==} + engines: {node: '>= 10'} + cpu: [x64] + os: [linux] + + '@tauri-apps/cli-win32-arm64-msvc@2.0.0-rc.16': + resolution: {integrity: sha512-PpPqdMTwJSDAK4KnNjvh77ShSkY+7pih1f6e50EtXar8bjC17e3XcEqFhDNne5mxEVTLYhibs6p1JLPad0ZjRA==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [win32] + + '@tauri-apps/cli-win32-ia32-msvc@2.0.0-rc.16': + resolution: {integrity: sha512-io2yIcEcG7YLP+9n13NbilB93SjcB7jIl8GbURC4XZT4/4t9D1PWHpJr5hySVsGRLCz5e8NzwC5RlnenNzmpPQ==} + engines: {node: '>= 10'} + cpu: [ia32] + os: [win32] + + '@tauri-apps/cli-win32-x64-msvc@2.0.0-rc.16': + resolution: {integrity: sha512-Rfkmxe3k+cBVA/kVYt8O25QrQqWKJlH9AiH7Q3C6xBzzG9PCSRMBszCp+JhBF8jhVlwNmOBv6UG+lm85kspwGg==} + engines: {node: '>= 10'} + cpu: [x64] + os: [win32] + + '@tauri-apps/cli@2.0.0-rc.16': + resolution: {integrity: sha512-wdjZg/M3dcxiqgWG6VRnABpX0dYxRww93t0d1MYoZxFDrnyoUz5kYwFQ0v4J9u0qenEgskjoypvon7V/Nj9qrg==} + engines: {node: '>= 10'} + hasBin: true + +snapshots: + + '@tauri-apps/cli-darwin-arm64@2.0.0-rc.16': + optional: true + + '@tauri-apps/cli-darwin-x64@2.0.0-rc.16': + optional: true + + '@tauri-apps/cli-linux-arm-gnueabihf@2.0.0-rc.16': + optional: true + + '@tauri-apps/cli-linux-arm64-gnu@2.0.0-rc.16': + optional: true + + '@tauri-apps/cli-linux-arm64-musl@2.0.0-rc.16': + optional: true + + '@tauri-apps/cli-linux-x64-gnu@2.0.0-rc.16': + optional: true + + '@tauri-apps/cli-linux-x64-musl@2.0.0-rc.16': + optional: true + + '@tauri-apps/cli-win32-arm64-msvc@2.0.0-rc.16': + optional: true + + '@tauri-apps/cli-win32-ia32-msvc@2.0.0-rc.16': + optional: true + + '@tauri-apps/cli-win32-x64-msvc@2.0.0-rc.16': + optional: true + + '@tauri-apps/cli@2.0.0-rc.16': + optionalDependencies: + '@tauri-apps/cli-darwin-arm64': 2.0.0-rc.16 + '@tauri-apps/cli-darwin-x64': 2.0.0-rc.16 + '@tauri-apps/cli-linux-arm-gnueabihf': 2.0.0-rc.16 + '@tauri-apps/cli-linux-arm64-gnu': 2.0.0-rc.16 + '@tauri-apps/cli-linux-arm64-musl': 2.0.0-rc.16 + '@tauri-apps/cli-linux-x64-gnu': 2.0.0-rc.16 + '@tauri-apps/cli-linux-x64-musl': 2.0.0-rc.16 + '@tauri-apps/cli-win32-arm64-msvc': 2.0.0-rc.16 + '@tauri-apps/cli-win32-ia32-msvc': 2.0.0-rc.16 + '@tauri-apps/cli-win32-x64-msvc': 2.0.0-rc.16 diff --git a/examples/vanilla/src-tauri/capabilities/app.json b/examples/vanilla/src-tauri/capabilities/app.json new file mode 100644 index 0000000..c135d7f --- /dev/null +++ b/examples/vanilla/src-tauri/capabilities/app.json @@ -0,0 +1,11 @@ +{ + "$schema": "../gen/schemas/desktop-schema.json", + "identifier": "default", + "description": "enables the default permissions", + "windows": [ + "main" + ], + "permissions": [ + "core:default" + ] +} diff --git a/src/invoke_system.js b/src/invoke_system.js index 240fd40..e6c1424 100644 --- a/src/invoke_system.js +++ b/src/invoke_system.js @@ -56,7 +56,6 @@ const port = __PORT__; }, }) .then((response) => { - console.log("res", response.headers.get("Tauri-Response")); const cb = response.headers.get("Tauri-Response") === "ok" ? callback : error; // we need to split here because on Android the content-type gets duplicated