update Tauri deps

This commit is contained in:
Martin Kavík 2024-12-04 15:15:26 +01:00
parent 6500531270
commit 4c00a633af
6 changed files with 774 additions and 677 deletions

1403
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -165,7 +165,7 @@ description = "Install Tauri CLI (tauri) locally"
command = "cargo" command = "cargo"
args = [ args = [
"install", "install",
"tauri-cli@=2.0.0-beta.17", "tauri-cli@=2.1.0",
"--locked", "--locked",
"--root", "--root",
"tauri", "tauri",

View file

@ -13,16 +13,16 @@ name = "app_lib"
crate-type = ["staticlib", "cdylib", "rlib"] crate-type = ["staticlib", "cdylib", "rlib"]
[build-dependencies] [build-dependencies]
tauri-build = { version = "=2.0.0-beta.17", features = [] } tauri-build = { version = "2.0.3", features = [] }
[dependencies] [dependencies]
wellen.workspace = true wellen.workspace = true
shared = { path = "../shared", features = ["backend"] } shared = { path = "../shared", features = ["backend"] }
serde_json = "1.0" serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
tauri = { version = "=2.0.0-beta.22", features = ["macos-private-api", "linux-ipc-protocol"] } tauri = { version = "2.1.1", features = ["macos-private-api"] }
tauri-plugin-window-state = "=2.0.0-beta.9" tauri-plugin-window-state = "2.0.2"
tauri-plugin-dialog = "=2.0.0-beta.9" tauri-plugin-dialog = "2.0.4"
once_cell = "1.19.0" once_cell = "1.19.0"
futures = "0.3.30" futures = "0.3.30"
reqwest = "0.12.9" reqwest = "0.12.9"

View file

@ -4,14 +4,6 @@
"description": "enables the default permissions", "description": "enables the default permissions",
"windows": ["main"], "windows": ["main"],
"permissions": [ "permissions": [
"path:default", "core:default"
"event:default",
"window:default",
"webview:default",
"app:default",
"resources:default",
"image:default",
"menu:default",
"tray:default"
] ]
} }

View file

@ -6,7 +6,7 @@ use once_cell::sync::Lazy;
use shared::{DiagramConnectorMessage, VarFormat}; use shared::{DiagramConnectorMessage, VarFormat};
use std::sync::Arc; use std::sync::Arc;
use tauri::async_runtime::{Mutex, RwLock}; use tauri::async_runtime::{Mutex, RwLock};
use tauri::Manager; use tauri::Emitter;
use wasmtime::component::{Component as WasmtimeComponent, *}; use wasmtime::component::{Component as WasmtimeComponent, *};
use wasmtime::{AsContextMut, Engine, Store}; use wasmtime::{AsContextMut, Engine, Store};
use wasmtime_wasi::{WasiCtx, WasiView}; use wasmtime_wasi::{WasiCtx, WasiView};

View file

@ -42,27 +42,30 @@ async fn pick_and_load_waveform(
store: tauri::State<'_, Store>, store: tauri::State<'_, Store>,
app: tauri::AppHandle, app: tauri::AppHandle,
) -> Result<Option<Filename>, ()> { ) -> Result<Option<Filename>, ()> {
let Some(file_response) = app.dialog().file().blocking_pick_file() else { let Some(file_path) = app.dialog().file().blocking_pick_file() else {
return Ok(None); return Ok(None);
}; };
let file_path = file_response.path.as_os_str().to_str().unwrap(); let file_buf = file_path.into_path().unwrap();
let file_str = file_buf.as_os_str().to_str().unwrap();
// @TODO `read` should accept `Path` instead of `&str` // @TODO `read` should accept `Path` instead of `&str`
let waveform = wellen::simple::read(file_path); let waveform = wellen::simple::read(file_str);
let Ok(waveform) = waveform else { let Ok(waveform) = waveform else {
panic!("Waveform file reading failed") panic!("Waveform file reading failed")
}; };
*store.waveform.write().await = Some(waveform); *store.waveform.write().await = Some(waveform);
*WAVEFORM.write().unwrap() = Arc::clone(&store.waveform); *WAVEFORM.write().unwrap() = Arc::clone(&store.waveform);
Ok(Some(file_response.name.unwrap())) Ok(Some(
file_buf.file_name().unwrap().to_string_lossy().to_string(),
))
} }
#[tauri::command(rename_all = "snake_case")] #[tauri::command(rename_all = "snake_case")]
async fn load_file_with_selected_vars(app: tauri::AppHandle) -> Result<Option<JavascriptCode>, ()> { async fn load_file_with_selected_vars(app: tauri::AppHandle) -> Result<Option<JavascriptCode>, ()> {
let Some(file_response) = app.dialog().file().blocking_pick_file() else { let Some(file_path) = app.dialog().file().blocking_pick_file() else {
return Ok(None); return Ok(None);
}; };
// @TODO Tokio's `fs` or a Tauri `fs`? // @TODO Tokio's `fs` or a Tauri `fs`?
let Ok(javascript_code) = fs::read_to_string(file_response.path) else { let Ok(javascript_code) = fs::read_to_string(file_path.into_path().unwrap()) else {
panic!("Selected vars file reading failed") panic!("Selected vars file reading failed")
}; };
Ok(Some(javascript_code)) Ok(Some(javascript_code))
@ -184,10 +187,15 @@ async fn notify_diagram_connector_text_change(
#[tauri::command(rename_all = "snake_case")] #[tauri::command(rename_all = "snake_case")]
async fn open_konata_file(app: tauri::AppHandle) { async fn open_konata_file(app: tauri::AppHandle) {
let Some(file_response) = app.dialog().file().blocking_pick_file() else { let Some(file_path) = app.dialog().file().blocking_pick_file() else {
return; return;
}; };
let file_path = file_response.path.into_os_string().into_string().unwrap(); let file_str = file_path
.into_path()
.unwrap()
.into_os_string()
.into_string()
.unwrap();
let port = 30000; let port = 30000;
let base_url = format!("http://localhost:{port}"); let base_url = format!("http://localhost:{port}");
@ -226,7 +234,7 @@ async fn open_konata_file(app: tauri::AppHandle) {
client client
.post(format!("{base_url}/open-konata-file")) .post(format!("{base_url}/open-konata-file"))
.json(&serde_json::json!({ .json(&serde_json::json!({
"file_path": file_path "file_path": file_str
})) }))
.send() .send()
.await .await