| @@ -322,7 +322,7 @@ async fn main() { |
| let tags: Vec<TagDef> = if config.tags.is_empty() { |
| default_tags() |
| } else { |
| - config.tags |
| + config.tags.clone() |
| }; |
| let bind_address = config.bind_address.clone().unwrap_or_else(|| "127.0.0.1".into()); |
| let page_size = config.page_size.unwrap_or(20); |
| @@ -653,15 +653,15 @@ async fn main() { |
| match action { |
| ImportAction::Bookmarks { source, profile, db_path } => { |
| let db_path = resolve_db_path(db_path, config.db_path.as_deref()); |
| - run_import(&source, profile, &db_path.to_string_lossy(), tags.clone(), tagging_enabled, tag_threshold, &exclude_hosts, ImportKind::Bookmarks, cache_path.clone(), max_tags, truncation, onnx_model.clone()).await; |
| + run_import(&source, profile, &db_path.to_string_lossy(), &config, ImportKind::Bookmarks, cache_path.clone()).await; |
| } |
| ImportAction::History { source, profile, db_path } => { |
| let db_path = resolve_db_path(db_path, config.db_path.as_deref()); |
| - run_import(&source, profile, &db_path.to_string_lossy(), tags.clone(), tagging_enabled, tag_threshold, &exclude_hosts, ImportKind::History, cache_path.clone(), max_tags, truncation, onnx_model.clone()).await; |
| + run_import(&source, profile, &db_path.to_string_lossy(), &config, ImportKind::History, cache_path.clone()).await; |
| } |
| ImportAction::All { source, profile, db_path } => { |
| let db_path = resolve_db_path(db_path, config.db_path.as_deref()); |
| - run_import(&source, profile, &db_path.to_string_lossy(), tags.clone(), tagging_enabled, tag_threshold, &exclude_hosts, ImportKind::All, cache_path.clone(), max_tags, truncation, onnx_model.clone()).await; |
| + run_import(&source, profile, &db_path.to_string_lossy(), &config, ImportKind::All, cache_path.clone()).await; |
| } |
| } |
| } |
| @@ -721,8 +721,17 @@ fn resolve_profiles(importer: &(impl Importer + ?Sized), profile: Option<String> |
| } |
| } |
| |
| -#[allow(clippy::too_many_arguments)] |
| -async fn run_import(source: &str, profile: Option<String>, db_path: &str, tags: Vec<TagDef>, tagging_enabled: bool, tag_threshold: f32, exclude_hosts: &[String], kind: ImportKind, cache_path: PathBuf, max_tags: usize, truncation: usize, onnx_model: String) { |
| +async fn run_import(source: &str, profile: Option<String>, db_path: &str, config: &Config, kind: ImportKind, cache_path: PathBuf) { |
| + let tagging_enabled = config.tagging_enabled.unwrap_or(false); |
| + let tag_threshold: f32 = config.tagging_threshold.map(|t| t as f32).unwrap_or(0.60); |
| + let tags: Vec<TagDef> = if config.tags.is_empty() { default_tags() } else { config.tags.clone() }; |
| + let exclude_hosts: Vec<String> = config.exclude_urls.clone().unwrap_or_else(|| { |
| + vec!["localhost".into(), "127.0.0.1".into(), "::1".into()] |
| + }); |
| + let max_tags = config.max_tags.unwrap_or(5); |
| + let truncation = config.truncation.unwrap_or(2000); |
| + let onnx_model = config.onnx_model.clone().unwrap_or_else(|| "BGESmallENV15".into()); |
| + |
| let importer: Box<dyn Importer> = match source { |
| "firefox" => Box::new(FirefoxImporter), |
| "zen" => Box::new(ZenImporter), |