Clean up unused catalog function and wire source info into catalog view

This commit is contained in:
lashman
2026-02-28 00:25:05 +02:00
parent f12e74ba2b
commit 31da61f3da
2 changed files with 12 additions and 20 deletions

View File

@@ -94,24 +94,6 @@ pub fn sync_catalog(db: &Database, source: &CatalogSource) -> Result<u32, Catalo
Ok(count)
}
/// Search the local catalog database for apps matching a query.
pub fn search_catalog(db: &Database, query: &str) -> Vec<CatalogApp> {
let records = db.search_catalog_apps(query).unwrap_or_default();
records.into_iter().map(|r| CatalogApp {
name: r.name,
description: r.description,
categories: r.categories
.map(|c| c.split(", ").map(String::from).collect())
.unwrap_or_default(),
latest_version: r.latest_version,
download_url: r.download_url,
icon_url: r.icon_url,
homepage: r.homepage,
file_size: r.file_size.map(|s| s as u64),
architecture: r.architecture,
}).collect()
}
/// Download an AppImage from the catalog to a local directory.
pub fn install_from_catalog(app: &CatalogApp, install_dir: &Path) -> Result<PathBuf, CatalogError> {
fs::create_dir_all(install_dir).map_err(|e| CatalogError::Io(e.to_string()))?;
@@ -351,7 +333,7 @@ mod tests {
#[test]
fn test_search_catalog_empty() {
let db = crate::core::database::Database::open_in_memory().unwrap();
let results = search_catalog(&db, "firefox");
let results = db.search_catalog_apps("firefox").unwrap();
assert!(results.is_empty());
}