Skip to content
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
142 changes: 142 additions & 0 deletions openless-all/app/src-tauri/backend-tests/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions openless-all/app/src-tauri/backend-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ cpal = "0.15"
enigo = "0.3"
global-hotkey = "0.6"
libc = "0.2"
local-ip-address = "^0.6"
log = "0.4"
once_cell = "1"
parking_lot = "0.12"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ mod hotkey;
mod insertion;
#[path = "../../src/remote_server/pin_persistence.rs"]
mod pin_persistence;
#[path = "../../src/remote_server/lan_addresses.rs"]
mod lan_addresses;
#[path = "../../src/recorder.rs"]
mod recorder;
#[path = "../../src/shortcut_binding.rs"]
Expand Down
28 changes: 14 additions & 14 deletions openless-all/app/src-tauri/src/commands/remote_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,16 @@ pub fn get_remote_input_status(
}

#[tauri::command]
pub fn list_local_ips() -> Vec<String> {
crate::remote_server::local_lan_ipv4s()
.iter()
.map(|ip| ip.to_string())
.collect()
pub async fn list_local_ips(app: AppHandle) -> Vec<String> {
tauri::async_runtime::spawn_blocking(move || {
crate::remote_server::discover_lan_addresses(&app)
.ips
.iter()
.map(|ip| ip.to_string())
.collect()
})
.await
.unwrap_or_default()
}

#[tauri::command]
Expand All @@ -28,15 +33,10 @@ pub fn regenerate_remote_pin(coord: CoordinatorState<'_>) -> Result<String, Stri
}

/// 同步 PC 端界面语言到远程输入服务,H5 录音页据此显示对应语言。
///
/// 不要在这里 `run_on_main_thread` 刷托盘:本命令是同步 IPC,设置页一挂载就调用。
/// 等主线程会和 WebView 互相卡住,窗口变成「未响应」。
#[tauri::command]
pub fn set_remote_locale(app: AppHandle, coord: CoordinatorState<'_>, locale: String) {
pub fn set_remote_locale(coord: CoordinatorState<'_>, locale: String) {
coord.set_remote_locale(locale);
let refresh_app = app.clone();
if let Err(err) = app.run_on_main_thread(move || {
if let Err(err) = crate::refresh_tray_microphone_menu(&refresh_app) {
log::warn!("[tray] refresh menu after locale change failed: {err}");
}
}) {
log::warn!("[tray] dispatch locale refresh failed: {err}");
}
}
Loading
Loading