fix: update image references from 'preview.png' to 'diagram.png' in README and HTML template

main
Antonio De Lucreziis 6 months ago
parent 63cb99d90d
commit df58f1f599

@ -123,5 +123,5 @@ Each request creates a folder under `runs/<run_id>/` containing:
- `original.*` (your upload)
- `diagram.tex`
- `diagram.pdf` (if LaTeX compilation succeeded)
- `preview.png` (if ImageMagick rendering succeeded)
- `diagram.png` (if ImageMagick rendering succeeded)
- `run.log.txt` (all logs: LLM + pdflatex + magick)

@ -448,7 +448,7 @@ def _compile_pdflatex(
def _render_png_with_magick(
run_dir: Path, pdf_path: Path, run_logger: RunLogger, section_title: str, png_name: str = "preview.png"
run_dir: Path, pdf_path: Path, run_logger: RunLogger, section_title: str, png_name: str = "diagram.png"
) -> Optional[Path]:
png_path = run_dir / png_name
@ -551,7 +551,7 @@ def _compile_phase(
allowed, reason, digest = _should_compile(run_dir, tex_text, cooldown_s=COMPILE_COOLDOWN_SECS)
pdf_path_existing = run_dir / Path(tex_path.name).with_suffix(".pdf").name
png_path_existing = run_dir / "preview.png"
png_path_existing = run_dir / "diagram.png"
svg_path_existing = run_dir / "diagram.svg"
if not allowed:
@ -857,11 +857,11 @@ async def get_run_result(request: Request, run_id: str, warn: str | None = None)
tex_path = run_dir / "diagram.tex"
pdf_path = run_dir / "diagram.pdf"
png_path = run_dir / "preview.png"
png_path = run_dir / "diagram.png"
svg_path = run_dir / "diagram.svg"
tex = tex_path.read_text(encoding="utf-8", errors="replace") if tex_path.exists() else ""
png_url = f"{BASE_PATH}/runs/{run_id}/{png_path.name}" if png_path.exists() else None
png_url = f"{BASE_PATH}/d/{run_id}/files/{png_path.name}" if png_path.exists() else None
original_candidates = sorted(run_dir.glob("original.*"))
original_path = original_candidates[0] if original_candidates else (run_dir / "original")
@ -879,7 +879,7 @@ async def get_run_result(request: Request, run_id: str, warn: str | None = None)
error_text = _read_run_error(run_dir) or None
def file_url(name: str) -> str:
return f"{BASE_PATH}/runs/{run_id}/{name}"
return f"{BASE_PATH}/d/{run_id}/files/{name}"
download_pdf_url = file_url(pdf_path.name) if pdf_path.exists() else file_url("diagram.pdf")
download_svg_url = file_url(svg_path.name) if svg_path.exists() else file_url("diagram.svg")
@ -905,7 +905,7 @@ async def get_run_result(request: Request, run_id: str, warn: str | None = None)
"download_original_url": file_url(original_path.name),
"download_tex_url": file_url(tex_path.name),
"download_pdf_url": download_pdf_url,
"download_png_url": file_url("preview.png"),
"download_png_url": file_url("diagram.png"),
"download_svg_url": download_svg_url,
"error": error_text,
"base_path": BASE_PATH,
@ -1221,7 +1221,7 @@ async def delete_run(request: Request, run_id: str):
return RedirectResponse(url=f"{BASE_PATH}/", status_code=303)
@app.get("/runs/{run_id}/{filename}")
@app.get("/d/{run_id}/files/{filename}")
async def get_run_file(run_id: str, filename: str):
path = _safe_join_run_file(run_id, filename)
if path is None or not path.exists() or not path.is_file():

@ -8,7 +8,7 @@
<meta property="og:description" content="View and edit the LaTeX/TikZ code for diagram {{ run_id }}." />
<meta property="og:type" content="website" />
<meta property="og:url" content="{{ base_path }}/d/{{ run_id }}" />
<meta property="og:image" content="{{ base_path }}/d/{{ run_id }}/preview.png" />
<meta property="og:image" content="{{ base_path }}/d/{{ run_id }}/files/diagram.png" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link

Loading…
Cancel
Save