feat(deeplink): add config merge command for preview

Expose config merging functionality to frontend for preview.
- Add merge_deeplink_config Tauri command
- Make parse_and_merge_config public for reuse
- Enable frontend to display complete config before import
This commit is contained in:
YoVinchen
2025-11-22 17:58:18 +08:00
parent cf57fbed7b
commit 2b1ae2aa71
3 changed files with 12 additions and 1 deletions

View File

@@ -9,6 +9,16 @@ pub fn parse_deeplink(url: String) -> Result<DeepLinkImportRequest, String> {
parse_deeplink_url(&url).map_err(|e| e.to_string()) parse_deeplink_url(&url).map_err(|e| e.to_string())
} }
/// Merge configuration from Base64/URL into a deep link request
/// This is used by the frontend to show the complete configuration in the confirmation dialog
#[tauri::command]
pub fn merge_deeplink_config(
request: DeepLinkImportRequest,
) -> Result<DeepLinkImportRequest, String> {
log::info!("Merging config for deep link request: {}", request.name);
crate::deeplink::parse_and_merge_config(&request).map_err(|e| e.to_string())
}
/// Import a provider from a deep link request (after user confirmation) /// Import a provider from a deep link request (after user confirmation)
#[tauri::command] #[tauri::command]
pub fn import_from_deeplink( pub fn import_from_deeplink(

View File

@@ -398,7 +398,7 @@ requires_openai_auth = true
/// Parse and merge configuration from Base64 encoded config or remote URL /// Parse and merge configuration from Base64 encoded config or remote URL
/// ///
/// Priority: URL params > inline config > remote config /// Priority: URL params > inline config > remote config
fn parse_and_merge_config( pub fn parse_and_merge_config(
request: &DeepLinkImportRequest, request: &DeepLinkImportRequest,
) -> Result<DeepLinkImportRequest, AppError> { ) -> Result<DeepLinkImportRequest, AppError> {
use base64::prelude::*; use base64::prelude::*;

View File

@@ -706,6 +706,7 @@ pub fn run() {
commands::sync_current_providers_live, commands::sync_current_providers_live,
// Deep link import // Deep link import
commands::parse_deeplink, commands::parse_deeplink,
commands::merge_deeplink_config,
commands::import_from_deeplink, commands::import_from_deeplink,
update_tray_menu, update_tray_menu,
// Environment variable management // Environment variable management