full rewrite

This commit is contained in:
2025-07-23 18:15:03 +00:00
parent f49017985c
commit 95492aa528
15 changed files with 1234 additions and 140 deletions

23
src/getImages.js Normal file
View File

@@ -0,0 +1,23 @@
const fs = require("fs");
const CSV_FILE = process.env.CSV_FILE || "./uploads/sha1.csv";
const IMAGE_BASE_URL = process.env.IMAGE_BASE_URL || "https://placehold.co/";
function getImages() {
if (!fs.existsSync(CSV_FILE)) return [];
return fs
.readFileSync(CSV_FILE, "utf-8")
.split("\n")
.filter(line => line.includes(";"))
.map(line => {
const [hash, filename] = line.split(";");
return {
url: `${IMAGE_BASE_URL.replace(/\/$/, "")}/${filename.trim()}`,
name: filename.trim(),
hash: hash,
};
});
}
module.exports = getImages;