Skip to content

Commit

Permalink
chore: update example and doc
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog committed Sep 17, 2024
1 parent 10c2ded commit 77f0cf4
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 12 deletions.
11 changes: 1 addition & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 1 addition & 1 deletion examples/vanilla/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"author": "",
"license": "MIT",
"dependencies": {
"@tauri-apps/cli": "^1.5.2"
"@tauri-apps/cli": "^2.0.0-rc"
}
}
125 changes: 125 additions & 0 deletions examples/vanilla/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions examples/vanilla/src-tauri/capabilities/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default",
"description": "enables the default permissions",
"windows": [
"main"
],
"permissions": [
"core:default"
]
}
1 change: 0 additions & 1 deletion src/invoke_system.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 77f0cf4

Please sign in to comment.