()
| 447 | |
| 448 | #[tauri::command] |
| 449 | pub async fn remote_connect_get_methods() -> Result<Vec<ConnectionMethodInfo>, String> { |
| 450 | ensure_service().await?; |
| 451 | let holder = get_service_holder(); |
| 452 | let guard = holder.read().await; |
| 453 | let service = guard.as_ref().ok_or("service not initialized")?; |
| 454 | let methods = service.available_methods().await; |
| 455 | |
| 456 | let infos = methods |
| 457 | .into_iter() |
| 458 | .map(|m| match m { |
| 459 | ConnectionMethod::Lan { .. } => ConnectionMethodInfo { |
| 460 | id: "lan".into(), |
| 461 | name: "LAN".into(), |
| 462 | available: true, |
| 463 | description: "Same local network".into(), |
| 464 | }, |
| 465 | ConnectionMethod::Ngrok => ConnectionMethodInfo { |
| 466 | id: "ngrok".into(), |
| 467 | name: "ngrok".into(), |
| 468 | available: true, |
| 469 | description: "Internet via ngrok tunnel".into(), |
| 470 | }, |
| 471 | ConnectionMethod::BitfunServer => ConnectionMethodInfo { |
| 472 | id: "bitfun_server".into(), |
| 473 | name: "BitFun Server".into(), |
| 474 | available: true, |
| 475 | description: "Official BitFun relay".into(), |
| 476 | }, |
| 477 | ConnectionMethod::CustomServer { url } => ConnectionMethodInfo { |
| 478 | id: "custom_server".into(), |
| 479 | name: "Custom Server".into(), |
| 480 | available: true, |
| 481 | description: format!("Self-hosted: {url}"), |
| 482 | }, |
| 483 | ConnectionMethod::BotFeishu => ConnectionMethodInfo { |
| 484 | id: "bot_feishu".into(), |
| 485 | name: "Feishu Bot".into(), |
| 486 | available: true, |
| 487 | description: "Via Feishu messenger".into(), |
| 488 | }, |
| 489 | ConnectionMethod::BotTelegram => ConnectionMethodInfo { |
| 490 | id: "bot_telegram".into(), |
| 491 | name: "Telegram Bot".into(), |
| 492 | available: true, |
| 493 | description: "Via Telegram".into(), |
| 494 | }, |
| 495 | ConnectionMethod::BotWeixin => ConnectionMethodInfo { |
| 496 | id: "bot_weixin".into(), |
| 497 | name: "WeChat (Weixin)".into(), |
| 498 | available: true, |
| 499 | description: "Via WeChat iLink bot".into(), |
| 500 | }, |
| 501 | }) |
| 502 | .collect(); |
| 503 | |
| 504 | Ok(infos) |
| 505 | } |
| 506 |
nothing calls this directly
no test coverage detected