Skip to content

Commit

Permalink
chore: Update example to tauri v1.5 (#14)
Browse files Browse the repository at this point in the history
* chore: Update example to tauri v1.5

* fix clippy yaaaa
  • Loading branch information
FabianLars authored Oct 16, 2023
1 parent c4e8ac1 commit 5d7f536
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 28 deletions.
5 changes: 3 additions & 2 deletions examples/vanilla/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"tauri": "tauri"
},
"author": "",
"license": "MIT",
"dependencies": {
"@tauri-apps/cli": "^1.0.0-beta.10"
"@tauri-apps/cli": "^1.5.2"
}
}
4 changes: 2 additions & 2 deletions examples/vanilla/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ rust-version = "1.56"
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = [ "derive" ] }
tauri = "1.0.0-rc.3"
tauri = { version = "1.5", features = [] }
tauri-invoke-http = { path = "../../../" }

[build-dependencies]
tauri-build = "1.0.0-rc.3"
tauri-build = { version = "1.5", features = [] }

[features]
default = [ "custom-protocol" ]
Expand Down
4 changes: 2 additions & 2 deletions examples/vanilla/src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ fn my_command(args: u64) -> Result<String, ()> {

fn main() {
let http = tauri_invoke_http::Invoke::new(if cfg!(feature = "custom-protocol") {
["tauri://localhost"]
if cfg!(windows) { ["https://tauri.localhost"] } else { ["tauri://localhost"] }
} else {
["http://localhost:8080"]
["http://127.0.0.1:1430"]
});
tauri::Builder::default()
.invoke_system(http.initialization_script(), http.responder())
Expand Down
21 changes: 1 addition & 20 deletions examples/vanilla/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,10 @@
"icons/icon.icns",
"icons/icon.ico"
],
"resources": [],
"externalBin": [],
"copyright": "",
"category": "DeveloperTool",
"shortDescription": "",
"longDescription": "",
"deb": {
"depends": [],
"useBootstrapper": false
},
"macOS": {
"frameworks": [],
"minimumSystemVersion": "",
"useBootstrapper": false,
"exceptionDomain": "",
"signingIdentity": null,
"entitlements": null
},
"windows": {
"certificateThumbprint": null,
"digestAlgorithm": "sha256",
"timestampUrl": ""
}
"longDescription": ""
},
"updater": {
"active": false
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl Invoke {
continue;
}
let url = request.url().to_string();
let pieces = url.split("/").collect::<Vec<_>>();
let pieces = url.split('/').collect::<Vec<_>>();
let window_label = pieces[1];

if let Some(window) = app.get_window(window_label) {
Expand All @@ -73,7 +73,7 @@ impl Invoke {
} else {
unimplemented!()
};
let req_key = payload.callback.0.clone();
let req_key = payload.callback.0;
requests.lock().unwrap().insert(req_key, request);
let _ = window.on_message(payload);
} else {
Expand Down

0 comments on commit 5d7f536

Please sign in to comment.