Files
photo_booth/camera/static/script.js
T
2026-05-30 00:22:52 +02:00

21 lines
537 B
JavaScript

async function refreshGallery() {
const res = await fetch("/photos");
const files = await res.json();
const gallery = document.getElementById("gallery");
if (files.length === 0) return;
gallery.innerHTML = files
.map((f) => `<img src="/photo/${f}" alt="${f}" title="${f}">`)
.join("");
}
document.addEventListener("keydown", async (e) => {
if (e.key !== "c" && e.key !== "C") return;
await fetch("/capture");
refreshGallery();
});
refreshGallery();
setInterval(refreshGallery, 10000);