Add Forgejo edit/refresh sync path for space content (T05)

Keep git as source of truth: deep-link to Forgejo editor, manual refresh to
drop cache, and optional signed push webhook for automatic invalidation.
This commit is contained in:
tegwick 2026-08-12 03:29:26 +02:00
parent 9c10037f34
commit 3f30bcd340
9 changed files with 458 additions and 5 deletions

View file

@ -23,11 +23,19 @@
border-left: 3px solid var(--color-primary);
color: var(--color-muted);
}
.content-meta { font-size: 0.85rem; margin-top: 0.5rem; }
.content-meta { font-size: 0.85rem; margin-top: 0.75rem; }
.content-error {
border-color: #fcd34d;
background: #fffbeb;
}
.content-actions {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
margin: 1rem 0 0;
align-items: center;
}
.content-actions form { display: inline; margin: 0; }
</style>
{% endblock %}
{% block content %}
@ -39,6 +47,25 @@
<p class="muted">{{ space.description }}</p>
{% endif %}
{% if space.has_content_binding %}
<div class="content-actions">
{% if forgejo_edit_url %}
<a class="btn small" href="{{ forgejo_edit_url }}" target="_blank" rel="noopener">Edit in Forgejo</a>
{% endif %}
{% if forgejo_blob_url %}
<a class="btn secondary small" href="{{ forgejo_blob_url }}" target="_blank" rel="noopener">View source</a>
{% endif %}
<form method="post" action="{% url 'spaces:refresh' space.slug %}">
{% csrf_token %}
<input type="hidden" name="page" value="{{ page.slug|default:'index' }}">
<button type="submit" class="btn secondary small">Refresh content</button>
</form>
</div>
<p class="muted content-meta" style="margin-top:0.5rem;">
Git is the source of truth. Edit in Forgejo, then refresh (or wait for webhook).
</p>
{% endif %}
{% if page.error %}
<div class="card content-error">
<h2 style="margin-top:0;">Content unavailable</h2>