mirror of
https://github.com/J3vb/OwnCord.git
synced 2026-09-03 03:50:00 +03:00
fix: resolve Clippy -D warnings in Tauri client
- Remove unused `use tauri::Manager` in commands.rs - Remove dead hotkeys.rs module (register_push_to_talk, unregister_all never called) - Fix `mut cred` → immutable in credentials.rs (CredWriteW takes &CREDENTIALW)
This commit is contained in:
@@ -146,7 +146,6 @@ pub fn get_cert_fingerprint(
|
||||
pub fn open_devtools(_window: tauri::WebviewWindow) {
|
||||
#[cfg(feature = "devtools")]
|
||||
{
|
||||
use tauri::Manager;
|
||||
_window.open_devtools();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ pub fn save_credential(host: String, username: String, token: String, password:
|
||||
}
|
||||
let blob = payload.to_string().into_bytes();
|
||||
|
||||
let mut cred = CREDENTIALW {
|
||||
let cred = CREDENTIALW {
|
||||
Flags: CRED_FLAGS(0),
|
||||
Type: CRED_TYPE_GENERIC,
|
||||
TargetName: PWSTR(target.as_ptr() as *mut u16),
|
||||
@@ -95,7 +95,7 @@ pub fn save_credential(host: String, username: String, token: String, password:
|
||||
};
|
||||
|
||||
unsafe {
|
||||
CredWriteW(&mut cred, 0)
|
||||
CredWriteW(&cred, 0)
|
||||
.map_err(|e| format!("CredWriteW failed: {e}"))?;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
use tauri::{Emitter, Runtime};
|
||||
use tauri_plugin_global_shortcut::{GlobalShortcutExt, ShortcutState};
|
||||
|
||||
/// Registers a global push-to-talk shortcut that emits `ptt-press` and
|
||||
/// `ptt-release` events to the frontend webview.
|
||||
pub fn register_push_to_talk<R: Runtime>(
|
||||
app: &tauri::AppHandle<R>,
|
||||
shortcut_str: &str,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let shortcut: tauri_plugin_global_shortcut::Shortcut = shortcut_str.parse()?;
|
||||
|
||||
// Remove any previous binding for this shortcut before registering.
|
||||
if app.global_shortcut().is_registered(shortcut) {
|
||||
app.global_shortcut().unregister(shortcut)?;
|
||||
}
|
||||
|
||||
let handle = app.clone();
|
||||
app.global_shortcut().on_shortcut(shortcut, move |_app, _shortcut, event| {
|
||||
let event_name = match event.state {
|
||||
ShortcutState::Pressed => "ptt-press",
|
||||
ShortcutState::Released => "ptt-release",
|
||||
};
|
||||
let _ = handle.emit(event_name, ());
|
||||
})?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Removes all registered global shortcuts.
|
||||
pub fn unregister_all<R: Runtime>(
|
||||
app: &tauri::AppHandle<R>,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
app.global_shortcut().unregister_all()?;
|
||||
Ok(())
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
mod commands;
|
||||
mod credentials;
|
||||
mod hotkeys;
|
||||
mod livekit_proxy;
|
||||
mod ptt;
|
||||
mod tray;
|
||||
|
||||
Reference in New Issue
Block a user