Initial commit

This commit is contained in:
Edward Betts 2025-11-15 10:54:32 +00:00
commit 1180c0817f
15 changed files with 1012 additions and 0 deletions

28
templates/base.html Normal file
View file

@ -0,0 +1,28 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Immich Alt Text Helper</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
</head>
<body>
<header class="site-header">
<div class="container">
<h1><a href="{{ url_for('main.index') }}">Immich Alt Text Helper</a></h1>
</div>
</header>
<main class="container">
{% with messages = get_flashed_messages() %}
{% if messages %}
<div class="flash-messages">
{% for message in messages %}
<div class="flash">{{ message }}</div>
{% endfor %}
</div>
{% endif %}
{% endwith %}
{% block content %}{% endblock %}
</main>
</body>
</html>

52
templates/detail.html Normal file
View file

@ -0,0 +1,52 @@
{% extends "base.html" %}
{% block content %}
{% if not asset %}
<div class="error">{{ error_message }}</div>
{% else %}
<section class="asset-detail">
<div class="image">
<img src="{{ url_for('main.asset_proxy', asset_id=asset.id, variant='preview') }}" alt="{{ asset.file_name }}">
</div>
<div class="details">
<h2>{{ asset.file_name }}</h2>
{% if asset.captured_display %}
<p class="date">Captured: {{ asset.captured_display }}</p>
{% endif %}
{% if alt_text %}
<div class="alt-text-block">
<h3>Current alt text</h3>
<p>{{ alt_text }}</p>
</div>
{% endif %}
{% if asset.location or (asset.latitude and asset.longitude) %}
<div class="location-block">
<h3>Location</h3>
{% if asset.location %}
<p>{{ asset.location }}</p>
{% endif %}
{% if asset.latitude and asset.longitude %}
<p class="coords">{{ "%.5f"|format(asset.latitude) }}, {{ "%.5f"|format(asset.longitude) }}</p>
{% endif %}
</div>
{% endif %}
{% if error_message %}
<div class="error">{{ error_message }}</div>
{% endif %}
<form method="post" class="notes-form">
<label for="notes">Optional notes for the model</label>
<textarea id="notes" name="notes" rows="4" placeholder="Mention any extra context you want included.">{{ notes }}</textarea>
<div class="actions">
<button type="submit">Generate alt text</button>
</div>
</form>
<p class="links">
<a href="{{ url_for('main.asset_proxy', asset_id=asset.id, variant='original') }}"
target="_blank" rel="noopener">Download original</a>
|
<a href="{{ asset.web_url }}" target="_blank" rel="noopener">View on Immich</a>
</p>
</div>
</section>
{% endif %}
{% endblock %}

38
templates/index.html Normal file
View file

@ -0,0 +1,38 @@
{% extends "base.html" %}
{% block content %}
<section class="intro">
<p>Choose a recent Immich photo to request Mastodon-friendly alt text.</p>
</section>
{% if error_message %}
<div class="error">{{ error_message }}</div>
{% endif %}
<section class="grid">
{% if assets %}
{% for asset in assets %}
<article class="asset-card">
<a href="{{ url_for('main.asset_detail', asset_id=asset.id) }}" class="thumbnail">
<img src="{{ url_for('main.asset_proxy', asset_id=asset.id, variant='thumbnail') }}"
alt="{{ asset.file_name }}">
</a>
<div class="meta">
{% if asset.captured_display %}
<div class="date">{{ asset.captured_display }}</div>
{% endif %}
</div>
<div class="alt-text">
{% if asset.alt_text %}
{{ asset.alt_text }}
{% else %}
<em>No alt text yet</em>
{% endif %}
</div>
</article>
{% endfor %}
{% else %}
<p>No recent assets were returned.</p>
{% endif %}
</section>
{% endblock %}