Add REST API for preset-based generation and fallback cover images
REST API (routes/api.py): Three endpoints behind API key auth for programmatic image generation via presets — list presets, queue generation with optional overrides, and poll job status. Shared generation logic extracted from routes/presets.py into services/generation.py so both web UI and API use the same code path. Fallback covers: library index pages now show a random generated image at reduced opacity when no cover is assigned, instead of "No Image". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -29,9 +29,15 @@
|
||||
<img id="img-{{ look.slug }}" src="{{ url_for('static', filename='uploads/' + look.image_path) }}" alt="{{ look.name }}">
|
||||
<span id="no-img-{{ look.slug }}" class="text-muted d-none">No Image</span>
|
||||
{% else %}
|
||||
{% set fallback = random_gen_image('looks', look.slug) %}
|
||||
{% if fallback %}
|
||||
<img id="img-{{ look.slug }}" src="{{ url_for('static', filename='uploads/' + fallback) }}" alt="{{ look.name }}" class="fallback-cover">
|
||||
<span id="no-img-{{ look.slug }}" class="text-muted d-none">No Image</span>
|
||||
{% else %}
|
||||
<img id="img-{{ look.slug }}" src="" alt="{{ look.name }}" class="d-none">
|
||||
<span id="no-img-{{ look.slug }}" class="text-muted">No Image</span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if look_assignments.get(look.look_id, 0) > 0 %}
|
||||
<span class="assignment-badge" title="Assigned to {{ look_assignments.get(look.look_id, 0) }} character(s)">{{ look_assignments.get(look.look_id, 0) }}</span>
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user