WIP
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
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);
|
||||
Reference in New Issue
Block a user