mirror of
https://codeberg.org/Toasterson/ips.git
synced 2026-04-10 13:20:42 +00:00
fix: Show actual repo last-modified time and widen publisher cards
Read last-modified from catalog.attrs instead of using get_info() which falls back to current time when the package directory scan finds nothing. Widened publisher card grid min-width from 320px to 420px so the formatted date doesn't get cut off.
This commit is contained in:
parent
0d737168e0
commit
195863f6d8
4 changed files with 18 additions and 5 deletions
|
|
@ -101,6 +101,17 @@ fn parse_version_parts(version_full: &str) -> VersionParts {
|
|||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Helper: read last-modified from catalog.attrs for a publisher
|
||||
// ---------------------------------------------------------------------------
|
||||
fn read_catalog_last_modified(repo: &DepotRepo, publisher: &str) -> Option<String> {
|
||||
let attrs_path = repo.shard_dir(publisher).join("catalog.attrs");
|
||||
let content = std::fs::read_to_string(&attrs_path).ok()?;
|
||||
let json: serde_json::Value = serde_json::from_str(&content).ok()?;
|
||||
let last_modified = json.get("last-modified")?.as_str()?;
|
||||
format_packaging_date(last_modified)
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
// Templates
|
||||
// ===========================================================================
|
||||
|
|
@ -219,8 +230,6 @@ pub async fn ui_index(
|
|||
.publishers
|
||||
.into_iter()
|
||||
.map(|p| {
|
||||
let updated = format_packaging_date(&p.updated)
|
||||
.unwrap_or(p.updated);
|
||||
// If backend reports 0 packages, try counting via list_packages
|
||||
let package_count = if p.package_count == 0 {
|
||||
repo.list_packages(Some(&p.name), None)
|
||||
|
|
@ -229,6 +238,10 @@ pub async fn ui_index(
|
|||
} else {
|
||||
p.package_count
|
||||
};
|
||||
// Try to get last-modified from catalog.attrs (more accurate than get_info)
|
||||
let updated = read_catalog_last_modified(&repo, &p.name)
|
||||
.or_else(|| format_packaging_date(&p.updated))
|
||||
.unwrap_or(p.updated);
|
||||
PublisherDisplay {
|
||||
name: p.name,
|
||||
package_count,
|
||||
|
|
|
|||
|
|
@ -224,7 +224,7 @@ main.container {
|
|||
|
||||
.publisher-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
|
||||
grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
.page-header .breadcrumb a{color:var(--d-text-muted)}
|
||||
.page-header .breadcrumb a:hover{color:var(--d-link)}
|
||||
.page-header .breadcrumb .sep{margin:0 0.35rem;opacity:0.4}
|
||||
.publisher-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(320px,1fr));gap:0.75rem}
|
||||
.publisher-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(420px,1fr));gap:0.75rem}
|
||||
.publisher-card{display:block;background:var(--d-bg-raised);border:1px solid var(--d-border);border-left:3px solid var(--d-accent);border-radius:var(--d-radius);padding:1.1rem 1.25rem;text-decoration:none;color:inherit;transition:background var(--d-transition),border-color var(--d-transition)}
|
||||
.publisher-card:hover{background:var(--d-bg-hover);border-color:var(--d-accent-dim);color:inherit}
|
||||
.publisher-card .pub-name{font-family:var(--d-mono);font-weight:600;font-size:1.05rem;color:var(--d-heading);margin-bottom:0.6rem}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
</div>
|
||||
{% if !pub_info.updated.is_empty() %}
|
||||
<div class="stat">
|
||||
<span class="stat-value" style="font-size: 0.85rem;">{{ pub_info.updated }}</span>
|
||||
<span class="stat-value" style="font-size: 0.82rem; font-weight: 500;">{{ pub_info.updated }}</span>
|
||||
<span class="stat-label">Last Updated</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue