Add Share to L2 buttons for media, recipes, and runs

- Updated cache detail button from "Publish to IPFS" to "Share to L2"
- Added Share to L2 button on recipe detail page
- Added Share to L2 button on run detail page
- Created /recipes/{id}/publish endpoint
- Created /runs/{id}/publish endpoint (publishes run output)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gilesb
2026-01-11 18:21:14 +00:00
parent 088af1611b
commit 156014a1f3
5 changed files with 102 additions and 6 deletions

View File

@@ -97,14 +97,12 @@
class="bg-blue-600 hover:bg-blue-700 px-4 py-2 rounded font-medium">
Download
</a>
{% if not cache.ipfs_cid %}
<button hx-post="/cache/{{ cache.content_hash }}/publish"
hx-target="#publish-result"
class="bg-gray-700 hover:bg-gray-600 px-4 py-2 rounded font-medium">
Publish to IPFS
hx-target="#share-result"
class="bg-purple-600 hover:bg-purple-700 px-4 py-2 rounded font-medium">
Share to L2
</button>
<span id="publish-result"></span>
{% endif %}
<span id="share-result"></span>
</div>
</div>
{% endblock %}

View File

@@ -77,6 +77,16 @@
<div class="bg-gray-900 rounded-lg p-4 border border-gray-700">
<pre class="text-sm text-gray-300 overflow-x-auto whitespace-pre-wrap">{{ recipe.yaml }}</pre>
</div>
<!-- Actions -->
<div class="flex items-center space-x-4 mt-8">
<button hx-post="/recipes/{{ recipe.recipe_id }}/publish"
hx-target="#share-result"
class="bg-purple-600 hover:bg-purple-700 px-4 py-2 rounded font-medium">
Share to L2
</button>
<span id="share-result"></span>
</div>
</div>
<script>

View File

@@ -22,6 +22,13 @@
{% if run.cached %}
<span class="bg-purple-900 text-purple-300 px-3 py-1 rounded text-sm">Cached</span>
{% endif %}
<div class="flex-grow"></div>
<button hx-post="/runs/{{ run.run_id }}/publish"
hx-target="#share-result"
class="bg-purple-600 hover:bg-purple-700 px-3 py-1 rounded text-sm font-medium">
Share to L2
</button>
<span id="share-result"></span>
</div>
<!-- Info Grid -->