Skip to content

Commit 41a7845

Browse files
committed
feat: update qobuz-player version to 0.2.4, improve security and error handling
1 parent 28ff15e commit 41a7845

File tree

5 files changed

+25
-19
lines changed

5 files changed

+25
-19
lines changed

src-tauri/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "qobuz-player"
3-
version = "0.2.3"
3+
version = "0.2.4"
44
description = "Web Container for Qobuz Web Player"
55
authors = ["Leonardo Calé"]
66
edition = "2024"

src-tauri/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ fn main() {
8181
}
8282
"show" => {
8383
if let Some(window) = app.get_webview_window("main") {
84-
window.show().unwrap();
85-
window.set_focus().unwrap();
84+
let _ = window.show();
85+
let _ = window.set_focus();
8686
}
8787
}
8888
_ => {}
@@ -160,7 +160,7 @@ fn main() {
160160
WindowEvent::CloseRequested { api, .. } => {
161161
api.prevent_close();
162162
if let Some(window) = app.get_webview_window("main") {
163-
window.hide().unwrap();
163+
let _ = window.hide();
164164
}
165165
}
166166
_ => {}

src-tauri/src/thumbar.rs

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ mod windows_impl {
3232
pub fn set_stored_hwnd(h: raw_window_handle::Win32WindowHandle) {
3333
if STORED_HWND.get().is_some() {
3434
if let Some(m) = STORED_HWND.get() {
35-
let mut guard = m.lock().unwrap();
36-
*guard = Some(h);
35+
if let Ok(mut guard) = m.lock() {
36+
*guard = Some(h);
37+
}
3738
}
3839
} else {
3940
let _ = STORED_HWND.set(std::sync::Mutex::new(Some(h)));
@@ -202,12 +203,15 @@ mod windows_impl {
202203
use std::mem::MaybeUninit;
203204

204205
let hwnd_raw = if let Some(m) = STORED_HWND.get() {
205-
let guard = m.lock().unwrap();
206-
if let Some(h) = guard.as_ref() {
207-
h.hwnd.get()
208-
} else {
209-
return;
210-
}
206+
if let Ok(guard) = m.lock() {
207+
if let Some(h) = guard.as_ref() {
208+
h.hwnd.get()
209+
} else {
210+
return;
211+
}
212+
} else {
213+
return;
214+
}
211215
} else {
212216
return;
213217
};
@@ -281,8 +285,9 @@ mod windows_impl {
281285
pub fn register_subclass() {
282286
// Obtain stored HWND
283287
let hwnd_raw = if let Some(m) = STORED_HWND.get() {
284-
let guard = m.lock().unwrap();
285-
if let Some(h) = guard.as_ref() { h.hwnd.get() } else { return }
288+
if let Ok(guard) = m.lock() {
289+
if let Some(h) = guard.as_ref() { h.hwnd.get() } else { return }
290+
} else { return }
286291
} else { return };
287292
if hwnd_raw == 0 { return; }
288293
let hwnd = windows::Win32::Foundation::HWND(hwnd_raw as *mut std::ffi::c_void);
@@ -339,8 +344,9 @@ mod windows_impl {
339344

340345
pub fn remove_subclass() {
341346
let hwnd_raw = if let Some(m) = STORED_HWND.get() {
342-
let guard = m.lock().unwrap();
343-
if let Some(h) = guard.as_ref() { h.hwnd.get() } else { return }
347+
if let Ok(guard) = m.lock() {
348+
if let Some(h) = guard.as_ref() { h.hwnd.get() } else { return }
349+
} else { return }
344350
} else { return };
345351
if hwnd_raw == 0 { return; }
346352
let hwnd = windows::Win32::Foundation::HWND(hwnd_raw as *mut std::ffi::c_void);

src-tauri/tauri.conf.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://schema.tauri.app/config/2",
33
"productName": "qobuz-player",
4-
"version": "0.2.3",
4+
"version": "0.2.4",
55
"identifier": "com.leo.qobuz-player",
66
"build": {},
77
"app": {
@@ -19,7 +19,7 @@
1919
}
2020
],
2121
"security": {
22-
"csp": "default-src 'self' https://play.qobuz.com https://*.qobuz.com; script-src 'self' https://play.qobuz.com https://*.qobuz.com; style-src 'self' 'unsafe-inline' https://play.qobuz.com https://*.qobuz.com; img-src 'self' data: https://play.qobuz.com https://*.qobuz.com; media-src *; connect-src *"
22+
"csp": "default-src 'self' https://play.qobuz.com https://*.qobuz.com; script-src 'self' https://play.qobuz.com https://*.qobuz.com; style-src 'self' 'unsafe-inline' https://play.qobuz.com https://*.qobuz.com; img-src 'self' data: https://play.qobuz.com https://*.qobuz.com; media-src 'self' https://*.qobuz.com data: blob:; connect-src 'self' https://*.qobuz.com wss://*.qobuz.com"
2323
}
2424
},
2525
"bundle": {

0 commit comments

Comments
 (0)