Reorganize into src/ with script/assets/templates, illustration/ at root

New layout:
  src/script/app/    Python package (was app/)
  src/assets/img/    SVGs (was static/*.svg)
  src/assets/css/    stylesheet (was static/style.css)
  src/templates/     HTML templates (was templates/)
  illustration/      README screenshot (was screenshots/), kept at
                      the repo root since it's a doc asset, not
                      something the app serves
  main.py, jobs/, VERSION, docker/  unchanged locations

main.py stays at the repo root as the entry point (matches how
Docker and local runs already invoke it) and prepends src/script to
sys.path before importing app, rather than moving into src/script/
itself and needing every entry point updated to match.

config.py's path constants are recomputed for app/config.py's new
depth (src/script/app/), with SRC_DIR and REPO_ROOT resolved
explicitly rather than a single ambiguous BASE_DIR, since "templates
and assets live under src/" and "jobs and VERSION live at the repo
root" are no longer the same directory. Flask's static_folder now
points at src/assets, which serves img/ and css/ under it at
whatever URL prefix Flask derives from the folder name (/assets, not
/static); templates already reference assets via the "static"
endpoint name through url_for, so this needed the url_for() calls'
filename argument updated with the img/ or css/ prefix, not a
hardcoded URL change.

Docker copies src/ into the image preserving this same internal
structure, so the path arithmetic in config.py resolves identically
in both a local checkout and the container, no --chdir or other
container-specific path handling needed.

Verified end to end after the move: local Flask dev server, a full
Docker rebuild, and a real HTTP conversion request through the
running container (TIFF HDR pipeline, numpy/tifffile imports
included) all succeed.
This commit is contained in:
Djeex
2026-08-01 15:26:18 +02:00
parent d67a2569f4
commit 974690132e
15 changed files with 29 additions and 23 deletions
+75
View File
@@ -0,0 +1,75 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Instagram HDR Assembler — Result</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
</head>
<body>
<div class="wrap">
<p class="eyebrow">Conversion report</p>
<h1>{{ heading }}</h1>
{% for item in items %}
<div class="card pair-card">
<span class="status {{ 'ok' if item.success else 'err' }}">
{{ "✓ success" if item.success else "✗ error" }}{% if total_count > 1 %} — {{ item.name }}{% endif %}
</span>
{% if item.warning %}
<div class="warning-banner">
⚠ The report flags a <strong>negative GainMapMin</strong> — that's the same symptom as
the bug reported on Lightroom Mobile: Instagram may reject this file despite a
"successful" conversion. Worth tweaking the HDR export settings before
re-uploading if the upload fails.
</div>
{% endif %}
<pre class="log">{{ item.log }}</pre>
</div>
{% endfor %}
<div class="actions">
{% if ok_count > 0 %}
<a class="btn-download" href="{{ url_for('download', job_id=job_id) }}">
{{ "Download the JPEG" if ok_count == 1 else "Download .zip (" ~ ok_count ~ " files)" }}
</a>
{% endif %}
<a class="btn-secondary" href="{{ url_for('index') }}">← New conversion</a>
</div>
<p class="footnote">
Remember to upload from a desktop browser (up-to-date Chrome) afterwards, choosing
<code>Original</code> as the crop — not the default 1:1 crop.
</p>
<p class="version">Instagram HDR Assembler v{{ app_version }}</p>
<div class="repo-links">
<a href="https://git.djeex.fr/Djeex/insta-hdr-converter" target="_blank" rel="noopener">
<span class="icon"><img src="{{ url_for('static', filename='img/gitea.svg') }}" alt=""></span>
Gitea
</a>
<a href="https://github.com/Djeex/insta-hdr-converter" target="_blank" rel="noopener">
<span class="icon"><img src="{{ url_for('static', filename='img/github.svg') }}" alt=""></span>
GitHub
</a>
</div>
</div>
<script>
(function () {
var jobId = {{ job_id | tojson }};
// Keeps the job's files alive while this page is open. If pings
// stop (tab closed, navigated away) the server purges the job a
// few seconds later. A refresh just resumes pinging, so it's safe.
function ping() {
if (document.visibilityState === 'visible') {
fetch('/heartbeat/' + jobId, { method: 'POST', keepalive: true }).catch(function () {});
}
}
ping();
setInterval(ping, 4000);
})();
</script>
</body>
</html>