commit f7cb01ac54810d214228c639874c7326c88809f2
parent 3206cafb941f4342674d1abc9d7292e504e84a02
Author: notamitgamer-bot <noreply@github.com>
Date: Wed, 30 Sep 2026 09:35:06 +0000
remove: 'Recently modified' block from the home page
Drops the template block, its CSS/JS, the get_recent_activity() helper and the extra Hugging Face list_repo_commits call it made.
Diffstat:
3 files changed, 0 insertions(+), 131 deletions(-)
diff --git a/app/main.py b/app/main.py
@@ -27,7 +27,6 @@ from .storage import (
upload_temp_file,
upload_folder_scoped,
repo_stats,
- get_recent_activity,
search_files,
write_batch_manifest,
get_batch_manifest,
@@ -984,9 +983,6 @@ async def serve(request: Request, path: str):
"raw_base_url": RAW_BASE_URL,
}
- if not clean_path:
- extra_ctx["recent_activity"] = await get_recent_activity()
-
ctx = await render_context(extra_ctx)
return templates.TemplateResponse(
diff --git a/app/storage.py b/app/storage.py
@@ -224,59 +224,6 @@ async def repo_stats():
_set_cache(cache_key, result)
return result
-_UPLOAD_FILE_RE = re.compile(r"^Upload (.+?)(?: with huggingface_hub)?$")
-_GH_SYNC_RE = re.compile(r"^gh-sync: update (.+)$")
-
-def _do_list_repo_commits():
- return list(api.list_repo_commits(repo_id=HF_REPO_ID, repo_type="dataset"))
-
-async def get_recent_activity(limit: int = 3):
- """Recently changed top-level paths, newest first, deduped by path.
-
- Derived from commit titles (list_repo_commits doesn't return changed
- file paths directly), so this is best-effort: commits whose title
- doesn't match one of this app's own upload patterns are skipped rather
- than guessed at. Cached briefly since it's one extra HF API call.
- """
- cache_key = "recent_activity"
- cached = _get_cache(cache_key)
- if cached is not None:
- return cached
-
- try:
- commits = await asyncio.to_thread(_do_list_repo_commits)
- except Exception:
- return []
-
- seen_paths = set()
- result = []
- for commit in commits:
- title = (commit.title or "").strip()
- gh_match = _GH_SYNC_RE.match(title)
- upload_match = _UPLOAD_FILE_RE.match(title) if not gh_match else None
- if gh_match:
- # already "owner/repo" - that whole pair is the unit, don't truncate it
- top_level = gh_match.group(1).strip().strip("/")
- elif upload_match:
- raw_path = upload_match.group(1).strip().strip("/")
- top_level = raw_path.split("/")[0] if raw_path else ""
- else:
- continue
- if not top_level or _is_hidden_path(top_level):
- continue
- if top_level in seen_paths:
- continue
- seen_paths.add(top_level)
- result.append({
- "path": top_level,
- "iso_time": commit.created_at.isoformat() if commit.created_at else None,
- })
- if len(result) >= limit:
- break
-
- _set_cache(cache_key, result)
- return result
-
async def search_files(query: str):
q = query.strip().lower()
if not q:
diff --git a/app/templates/index.html b/app/templates/index.html
@@ -121,46 +121,6 @@
.site-notice { margin-top: 0.5rem; }
- .recent-activity {
- margin-bottom: 2.25rem;
- border: 1px solid var(--border);
- border-radius: var(--radius-md);
- background: var(--surface);
- overflow: hidden;
- }
- .recent-activity-heading {
- display: flex;
- align-items: center;
- gap: 0.5rem;
- color: var(--text-dim);
- font-size: 0.9rem;
- font-weight: 500;
- padding: 0.7rem 1rem;
- }
- .recent-activity-list {
- list-style: none;
- margin: 0;
- padding: 0 1rem 0.6rem;
- }
- .recent-activity-list li {
- display: flex;
- justify-content: space-between;
- align-items: baseline;
- gap: 1rem;
- padding: 0.35rem 0;
- border-top: 1px solid var(--border);
- font-size: 0.9rem;
- }
- .recent-activity-list li:first-child { border-top: none; }
- .recent-activity-list a { text-decoration: none; }
- .recent-activity-list a:hover { text-decoration: underline; }
- .recent-activity-time {
- color: var(--text-dim);
- font-size: 0.8rem;
- white-space: nowrap;
- flex-shrink: 0;
- }
-
a { color: var(--accent-primary); text-decoration: none; transition: color 0.15s;}
a:hover { color: var(--accent-primary-hover); text-decoration: underline; }
@@ -897,22 +857,6 @@
<a href="/gh-sync">Sync</a> at the top to see how to set it up. Project assets live here;
files and paths may change over time, so use direct links with that in mind.
</blockquote>
- {% if recent_activity %}
- <div class="recent-activity" id="recent-activity">
- <div class="recent-activity-heading">
- <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>
- <span>Recently modified</span>
- </div>
- <ul class="recent-activity-list">
- {% for entry in recent_activity %}
- <li>
- <a href="/{{ entry.path }}/">{{ entry.path }}/</a>
- {% if entry.iso_time %}<time class="recent-activity-time" datetime="{{ entry.iso_time }}">{{ entry.iso_time }}</time>{% endif %}
- </li>
- {% endfor %}
- </ul>
- </div>
- {% endif %}
{% endif %}
{% if page == 'listing' %}
@@ -1957,24 +1901,6 @@
}
</script>
<script>
- // --- Recently modified: convert timestamps to the visitor's own timezone. ---
- (function () {
- document.querySelectorAll('.recent-activity-time[datetime]').forEach(function (el) {
- var d = new Date(el.getAttribute('datetime'));
- if (isNaN(d.getTime())) return;
- var now = new Date();
- var diffMs = now - d;
- var diffMin = Math.round(diffMs / 60000);
- var label;
- if (diffMin < 1) label = 'just now';
- else if (diffMin < 60) label = diffMin + 'm ago';
- else if (diffMin < 60 * 24) label = Math.round(diffMin / 60) + 'h ago';
- else label = d.toLocaleString(undefined, { month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit' });
- el.textContent = label;
- el.title = d.toLocaleString();
- });
- })();
-
// --- Visited history: silently logs file/folder pages viewed on this browser,
// shown on /history. localStorage only - there's no account system, so this is
// per-browser, same limitation as ordinary browser history.