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 <noreply@anthropic.com>
This commit is contained in:
gilesb
2026-01-08 18:20:01 +00:00
parent c0c3096e48
commit 9877e61b5d

View File

@@ -2116,6 +2116,10 @@ async def ui_publish_cache(content_hash: str, request: Request):
if not origin or "type" not in origin:
return '<div class="bg-red-900/50 border border-red-700 text-red-300 px-4 py-3 rounded-lg mb-4">Set origin before publishing</div>'
# 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 <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,