diff --git a/server.py b/server.py index bde8948..c4e3b28 100644 --- a/server.py +++ b/server.py @@ -895,26 +895,46 @@ async def run_detail(run_id: str, request: Request): ''' - # Publish section + # Publish section - check if already published to L2 publish_html = "" if run.status == "completed" and run.output_hash: - publish_html = f''' -
-

Publish to L2

-

Register this transformation output on the L2 ActivityPub server.

-
-
- - -
-
- ''' + l2_shares = await database.get_l2_shares(run.output_hash, ctx.actor_id) + if l2_shares: + # Already published - show link to L2 + share = l2_shares[0] + l2_server = share.get("l2_server", "") + l2_https = l2_server.replace("http://", "https://") + asset_name = share.get("asset_name", "") + publish_html = f''' +
+

Published to L2

+
+

+ Published as {asset_name} + View on L2 +

+
+
+ ''' + else: + # Not published - show publish form + publish_html = f''' +
+

Publish to L2

+

Register this transformation output on the L2 ActivityPub server.

+
+
+ + +
+
+ ''' # Delete section delete_html = f''' @@ -3659,9 +3679,12 @@ async def ui_publish_run(run_id: str, request: Request, output_name: str = Form( cache_manager.pin(fixed.content_hash, reason="fixed_input_in_published_recipe") break + # Use HTTPS for L2 links + l2_https = l2_server.replace("http://", "https://") return HTMLResponse(f'''
- Published to L2 as {result["asset"]["name"]} + Published to L2 as {result["asset"]["name"]}! + View on L2
''') except http_requests.exceptions.HTTPError as e: