From 5ba66ed11e73da028239232f467bc45ed3f8910d Mon Sep 17 00:00:00 2001 From: gilesb Date: Fri, 9 Jan 2026 03:51:36 +0000 Subject: [PATCH] Record L2 share when publishing runs from UI When ui_publish_run publishes a run to L2, now properly records the share in the local database so the UI can display the L2 badge and published status. Co-Authored-By: Claude Opus 4.5 --- server.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/server.py b/server.py index 405687c..2f23aa2 100644 --- a/server.py +++ b/server.py @@ -3623,9 +3623,20 @@ async def ui_publish_run(run_id: str, request: Request, output_name: str = Form( resp.raise_for_status() result = resp.json() - # Pin the output + # Pin the output and record L2 share if run.output_hash: await database.update_item_metadata(run.output_hash, ctx.actor_id, pinned=True, pin_reason="published") + # Record L2 share so UI shows published status + cache_path = get_cache_path(run.output_hash) + media_type = detect_media_type(cache_path) if cache_path else "image" + content_type = "video" if media_type == "video" else "image" + await database.save_l2_share( + content_hash=run.output_hash, + actor_id=ctx.actor_id, + l2_server=l2_server, + asset_name=result["asset"]["name"], + content_type=content_type + ) # Pin the inputs (for provenance) for input_hash in run.inputs: