Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/i18n.rs
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,7 @@ impl Locale {
strings.insert("update_all".into(), "Tout mettre à jour ({count})".into());
strings.insert("whats_new".into(), "Nouveautés de {version}".into());
strings.insert("view_on_github".into(), "Voir sur GitHub".into());
strings.insert("installed_version".into(), "Installé : {version}".into());
strings.insert("launcher_update_system_managed".into(), "Mise à jour {version} disponible - cette installation est gérée par le gestionnaire de paquets, mettez à jour via « pacman -Syu » (colony-bin)".into());
// Detail tabs
strings.insert("tab_readme".into(), "ReadMe".into());
Expand Down Expand Up @@ -1337,6 +1338,7 @@ impl Locale {
strings.insert("update_all".into(), "Update all ({count})".into());
strings.insert("whats_new".into(), "What's new in {version}".into());
strings.insert("view_on_github".into(), "View on GitHub".into());
strings.insert("installed_version".into(), "Installed: {version}".into());
strings.insert("launcher_update_system_managed".into(), "Update {version} is available - this install is managed by the package manager, update via 'pacman -Syu' (colony-bin)".into());
// Detail tabs
strings.insert("tab_readme".into(), "ReadMe".into());
Expand Down
26 changes: 26 additions & 0 deletions src/persistence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,32 @@ pub struct CachedApp {
pub origin: String,
}

/// Remove doc/icon caches for repos that are NO LONGER in the catalog, so a
/// deleted or renamed repo does not leave its caches behind forever. Runs
/// after each successful catalog fetch (never on a cache fallback, where a
/// transient absence must not purge anything). Uninstalling a still-listed
/// app deliberately keeps its caches - they render the catalog entry.
pub fn prune_orphaned_repo_caches(live_repo_names: &[String]) {
let Ok(base) = colony_data_dir() else {
return;
};
for parent in ["repo-docs", "repo-icons"] {
let Ok(entries) = std::fs::read_dir(base.join(parent)) else {
continue;
};
for entry in entries.flatten() {
let name = entry.file_name().to_string_lossy().to_string();
if !live_repo_names.iter().any(|r| r == &name) {
let path = entry.path();
tracing::info!("pruning orphaned cache {}", path.display());
if let Err(e) = std::fs::remove_dir_all(&path) {
tracing::warn!("failed to prune {}: {e}", path.display());
}
}
}
}
}

/// Load the cached application scan (`None` if absent or unreadable). Read at
/// boot when the startup scan is disabled, so the local-apps grid restores the
/// last known state instead of showing "0 apps" at every launch.
Expand Down
4 changes: 4 additions & 0 deletions src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,11 @@ impl App {
if query.is_empty() {
return true;
}
// Search the description and display name too: "music" must
// find Grape ("Lecteur musique..."), not just name matches.
repo.name.to_lowercase().contains(&query)
|| repo.manifest.name.to_lowercase().contains(&query)
|| repo.description.to_lowercase().contains(&query)
})
.collect()
}
Expand Down
18 changes: 16 additions & 2 deletions src/ui/detail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,22 @@ impl App {
})
.collect();

let mut footer_items: Vec<Element<'_, Message>> =
vec![container(text("")).width(Fill).into()];
let mut footer_items: Vec<Element<'_, Message>> = Vec::new();
// Store-basics metadata: the installed version was recorded at install
// time but never shown anywhere on the detail page.
if let Some(installed) = github::load_installed_version(&repo.name) {
footer_items.push(
text(crate::i18n::t_fmt(
"installed_version",
&[("version", &installed)],
))
.size(self.sz(12))
.font(self.app_font())
.color(Palette::TEXT_DIM())
.into(),
);
}
footer_items.push(container(text("")).width(Fill).into());
for pt in platform_labels {
footer_items.push(pt);
}
Expand Down
13 changes: 13 additions & 0 deletions src/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,14 @@ impl App {
// The catalog is stored regardless of sign-in state: anonymous
// fetches land here too.
self.colony_repo_list = repos;
// A successful fetch is the one moment we KNOW which repos
// exist: drop doc/icon caches of repos that left the catalog.
let live: Vec<String> = self
.colony_repo_list
.iter()
.map(|r| r.name.clone())
.collect();
crate::persistence::prune_orphaned_repo_caches(&live);
// Decode any freshly-cached app icons into image handles.
self.reload_app_icons();
// New docs may have landed for the repo currently viewed.
Expand Down Expand Up @@ -624,6 +632,11 @@ impl App {
self.confirm_uninstall = None;
// An uninstalled app has no meaningful "update available".
self.available_updates.remove(&repo_name);
// Stale notes describe the version that was just removed.
// (Doc/icon caches and the favorite deliberately survive: they
// belong to the CATALOG entry, which is still listed - orphan
// cleanup happens on catalog refresh instead.)
self.release_notes.remove(&repo_name);
match github::colony_apps_dir() {
Ok(apps_dir) => {
let app_dir = apps_dir.join(&repo_name);
Expand Down
Loading