fix(feed): update feed.json after every upload so browser sees new activities
merge_all(user_dir) updates the per-user _merged/ shard but the home page loads feed.json first via loadCombinedFeed. write_combined_feed was only called by the CLI render command, not by the API upload endpoints or the dev watcher, leaving feed.json permanently stale after any runtime upload. Add write_combined_feed(_get_data_dir()) after every merge_all call in /api/upload/bas, /api/upload/raw, the dev.py file watcher, and dev startup.
This commit is contained in:
@@ -532,8 +532,9 @@ async def upload_bas_activity(
|
||||
if not gj_path.exists():
|
||||
gj_path.write_text(json.dumps(body["geojson"], ensure_ascii=False), encoding="utf-8")
|
||||
|
||||
from bincio.render.merge import merge_all
|
||||
from bincio.render.merge import merge_all, write_combined_feed
|
||||
merge_all(user_dir)
|
||||
write_combined_feed(_get_data_dir())
|
||||
|
||||
log.info("upload/bas[%s]: imported %s", user.handle, activity_id)
|
||||
return JSONResponse({"ok": True, "id": activity_id, "status": "imported"})
|
||||
@@ -621,8 +622,9 @@ async def upload_raw_activity(
|
||||
if geojson and not (acts_dir / f"{act_id}.geojson").exists():
|
||||
(acts_dir / f"{act_id}.geojson").write_text(json.dumps(geojson), encoding="utf-8")
|
||||
|
||||
from bincio.render.merge import merge_all
|
||||
from bincio.render.merge import merge_all, write_combined_feed
|
||||
merge_all(user_dir)
|
||||
write_combined_feed(_get_data_dir())
|
||||
|
||||
except Exception as exc:
|
||||
log.warning("upload/raw[%s]: extraction failed: %s", user.handle, exc)
|
||||
|
||||
Reference in New Issue
Block a user