Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update example to tauri v1.5 #14

Merged
merged 2 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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