diff --git a/server.py b/server.py index 1818567..160712e 100644 --- a/server.py +++ b/server.py @@ -1762,6 +1762,28 @@ async def recipe_detail_page(recipe_id: str, request: Request): if pinned: pinned_badge = f'Pinned: {pin_reason}' + # Check if shared to L2 + l2_shares = await database.get_l2_shares(recipe_id, ctx.actor_id if ctx else None) + l2_link_html = "" + if l2_shares: + share = l2_shares[0] + l2_server = share.get("l2_server", "").replace("http://", "https://") + asset_name = share.get("asset_name", "") + l2_link_html = f'View on L2' + + # Load recipe source YAML + recipe_path = cache_manager.get_by_content_hash(recipe_id) + recipe_source = "" + if recipe_path and recipe_path.exists(): + try: + recipe_source = recipe_path.read_text() + except Exception: + recipe_source = "(Could not load recipe source)" + + # Escape HTML in source for display + import html + recipe_source_escaped = html.escape(recipe_source) + content = f'''
← Back to recipes @@ -1772,12 +1794,18 @@ async def recipe_detail_page(recipe_id: str, request: Request):

{recipe.name}

v{recipe.version} {pinned_badge} + {l2_link_html}

{recipe.description or 'No description'}

-
{recipe.recipe_id}
+
{recipe.recipe_id}
{fixed_inputs_html} +
+

Recipe Source

+
{recipe_source_escaped}
+
+

Run this Recipe