From 8dde2a127bb149cf0bcb996b5f0445982816367e Mon Sep 17 00:00:00 2001 From: Sahil Gupte Date: Mon, 2 Sep 2024 17:46:51 -0400 Subject: [PATCH] Misc changes --- .github/workflows/build.yaml | 4 ++-- src-tauri/Cargo.toml | 1 + src-tauri/extensions/src/lib.rs | 29 +++++++++++++-------------- src-tauri/macros/src/command_macro.rs | 4 ++-- src-tauri/src/providers/extension.rs | 6 +++++- src-tauri/src/providers/handler.rs | 6 +++++- 6 files changed, 29 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 6f686bb..cc57978 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -78,8 +78,8 @@ jobs: TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} with: - tagName: app-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version. - releaseName: "App v__VERSION__" + tagName: moosync-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version. + releaseName: "Moosync v__VERSION__" releaseBody: "See the assets to download this version and install." releaseDraft: true prerelease: true diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 20932f9..012b7f9 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -36,6 +36,7 @@ tauri = { version = "2.0.0-beta.24", features = [ "wry", "protocol-asset", "tray-icon", + "devtools", ], default-features = false } tauri-plugin-deep-link = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } tauri-plugin-dialog = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } diff --git a/src-tauri/extensions/src/lib.rs b/src-tauri/extensions/src/lib.rs index 21b8e2f..04fb975 100644 --- a/src-tauri/extensions/src/lib.rs +++ b/src-tauri/extensions/src/lib.rs @@ -46,7 +46,7 @@ macro_rules! helper1 { channel: Uuid::new_v4().to_string(), data: $data, }; - $self.broadcast(serde_json::to_value(value).unwrap()).await + $self.broadcast(serde_json::to_value(value)?).await } }; @@ -66,14 +66,13 @@ macro_rules! helper1 { let parsed = serde_json::from_value::>(first.clone()); if let Ok(parsed) = parsed { - println!("Parsed: {:?}", parsed); if package_name.is_empty() { return Ok(Default::default()); } let first_result = parsed.get(&package_name); if let Some(first_result) = first_result { - let parsed = serde_json::from_value(first_result.clone()).unwrap(); + let parsed = serde_json::from_value(first_result.clone())?; return Ok(parsed); } else { tracing::info!("Extension did not reply"); @@ -204,18 +203,18 @@ impl ExtensionHandler { }); }); - let exe_path = env::current_exe().unwrap(); - let _handle = Command::new(exe_path.clone().parent().unwrap().join("exthost")) - .args([ - "-ipcPath", - self.ipc_path.to_str().unwrap(), - "-extensionPath", - self.extensions_dir.to_str().unwrap(), - "-installPath", - exe_path.to_str().unwrap(), - ]) - .spawn() - .unwrap(); + // let exe_path = env::current_exe().unwrap(); + // let _handle = Command::new(exe_path.clone().parent().unwrap().join("exthost")) + // .args([ + // "-ipcPath", + // self.ipc_path.to_str().unwrap(), + // "-extensionPath", + // self.extensions_dir.to_str().unwrap(), + // "-installPath", + // exe_path.to_str().unwrap(), + // ]) + // .spawn() + // .unwrap(); Ok(rx_listen) } diff --git a/src-tauri/macros/src/command_macro.rs b/src-tauri/macros/src/command_macro.rs index 508310a..41f8ce5 100644 --- a/src-tauri/macros/src/command_macro.rs +++ b/src-tauri/macros/src/command_macro.rs @@ -23,7 +23,6 @@ macro_rules! generate_command_cached { #[tracing::instrument(level = "trace", skip(db, cache))] #[tauri::command(async)] pub async fn $method_name(db: State<'_, $state>, cache: State<'_, CacheHolder>, $($v: $t),*) -> types::errors::Result<$ret> { - tracing::info!("calling cached {}", stringify!($method_name)); let mut cache_string = String::new(); cache_string.push_str(stringify!($method_name)); $( @@ -32,6 +31,7 @@ macro_rules! generate_command_cached { } )* + tracing::info!("calling cached {}: {}", stringify!($method_name), cache_string); let cached = cache.get(cache_string.as_str()); if cached.is_ok() { return cached; @@ -83,7 +83,6 @@ macro_rules! generate_command_async_cached { #[tracing::instrument(level = "trace", skip(db, cache))] #[tauri::command(async)] pub async fn $method_name(db: State<'_, $state>, cache: State<'_, CacheHolder>, $($v: $t),*) -> types::errors::Result<$ret> { - tracing::info!("calling cached async {}", stringify!($method_name)); let mut cache_string = String::new(); cache_string.push_str(stringify!($method_name)); $( @@ -92,6 +91,7 @@ macro_rules! generate_command_async_cached { } )* + tracing::info!("calling cached async {}: {}", stringify!($method_name), cache_string); let cached = cache.get(cache_string.as_str()); if cached.is_ok() { diff --git a/src-tauri/src/providers/extension.rs b/src-tauri/src/providers/extension.rs index 0b685bf..7920f01 100644 --- a/src-tauri/src/providers/extension.rs +++ b/src-tauri/src/providers/extension.rs @@ -287,7 +287,11 @@ impl GenericProvider for ExtensionProvider { SongReturnType ); - Ok(res.song) + if let Some(song) = res.song { + return Ok(song); + } + + Err("Song not found".into()) } #[tracing::instrument(level = "trace", skip(self))] diff --git a/src-tauri/src/providers/handler.rs b/src-tauri/src/providers/handler.rs index 83239c6..62a26e4 100644 --- a/src-tauri/src/providers/handler.rs +++ b/src-tauri/src/providers/handler.rs @@ -156,7 +156,11 @@ impl ProviderHandler { let provides = ext_handler .get_provider_scopes(extension.package_name.clone().into()) .await; - tracing::info!("Got provider scopes from {}", extension.package_name); + tracing::info!( + "Got provider scopes from {} {:?}", + extension.package_name, + provides + ); if let Ok(provides) = provides { if provides.is_empty() { continue;