From 9877e61b5de4a160d4364038392c805881d43a21 Mon Sep 17 00:00:00 2001 From: gilesb Date: Thu, 8 Jan 2026 18:20:01 +0000 Subject: [PATCH] Send ipfs_cid when publishing cache to L2 L1 now includes IPFS CID in publish requests so L2 can pin content on its own IPFS node for federation. Co-Authored-By: Claude Opus 4.5 --- server.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server.py b/server.py index 2f8792b..78f7ba2 100644 --- a/server.py +++ b/server.py @@ -2116,6 +2116,10 @@ async def ui_publish_cache(content_hash: str, request: Request): if not origin or "type" not in origin: return '
Set origin before publishing
' + # Get IPFS CID from cache item + cache_item = await database.get_cache_item(content_hash) + ipfs_cid = cache_item.get("ipfs_cid") if cache_item else None + # Call the L2 server from user's context l2_server = ctx.l2_server try: @@ -2124,6 +2128,7 @@ async def ui_publish_cache(content_hash: str, request: Request): headers={"Authorization": f"Bearer {token}"}, json={ "content_hash": content_hash, + "ipfs_cid": ipfs_cid, "asset_name": asset_name, "asset_type": asset_type, "origin": origin, @@ -2793,6 +2798,10 @@ async def publish_cache_to_l2( if not origin or "type" not in origin: raise HTTPException(400, "Origin must be set before publishing. Use --origin self or --origin-url ") + # Get IPFS CID from cache item + cache_item = await database.get_cache_item(content_hash) + ipfs_cid = cache_item.get("ipfs_cid") if cache_item else None + # Get auth token to pass to L2 token = request.cookies.get("auth_token") if not token: @@ -2812,6 +2821,7 @@ async def publish_cache_to_l2( headers={"Authorization": f"Bearer {token}"}, json={ "content_hash": content_hash, + "ipfs_cid": ipfs_cid, "asset_name": req.asset_name, "asset_type": req.asset_type, "origin": origin,