(
method: &str,
custom_url: Option<String>,
lan_ip: Option<String>,
)
| 505 | } |
| 506 | |
| 507 | fn parse_connection_method( |
| 508 | method: &str, |
| 509 | custom_url: Option<String>, |
| 510 | lan_ip: Option<String>, |
| 511 | ) -> Result<ConnectionMethod, String> { |
| 512 | match method { |
| 513 | "lan" => Ok(ConnectionMethod::Lan { |
| 514 | ip: lan_ip.filter(|s| !s.is_empty()), |
| 515 | }), |
| 516 | "ngrok" => Ok(ConnectionMethod::Ngrok), |
| 517 | "bitfun_server" => Ok(ConnectionMethod::BitfunServer), |
| 518 | "custom_server" => Ok(ConnectionMethod::CustomServer { |
| 519 | url: custom_url.unwrap_or_default(), |
| 520 | }), |
| 521 | "bot_feishu" => Ok(ConnectionMethod::BotFeishu), |
| 522 | "bot_telegram" => Ok(ConnectionMethod::BotTelegram), |
| 523 | "bot_weixin" => Ok(ConnectionMethod::BotWeixin), |
| 524 | _ => Err(format!("unknown connection method: {method}")), |
| 525 | } |
| 526 | } |
| 527 | |
| 528 | #[tauri::command] |
| 529 | pub async fn remote_connect_start( |
no test coverage detected