feat: make manual-images list dynamic and resolve checkmark encoding issues
This commit is contained in:
1 parent
a211593f2c
commit
43e6eea253
7 files changed
+57
-40
No files matched your search
Binary file not shown.
@@ -1,38 +1,22 @@
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
const testFiles = [
|
||||
"1782870899198-sample_do.jpeg",
|
||||
"1782872141829-rotated_1782872118246_rotated_1782872112296_rotated_1782872107513_CAP3481952560331460805.jpg",
|
||||
"1782875271815-rotated_1782875258464_rotated_1782875254091_rotated_1782875250123_CAP1599226410575173446.jpg",
|
||||
"1782884664859-rotated_1782884661516_rotated_1782884658097_rotated_1782884654697_CAP5956452738616729026.jpg",
|
||||
"1782888127716-CAP6161747431193129837.jpg",
|
||||
"1782888211457-rotated_1782888204591_rotated_1782888199962_rotated_1782888195402_CAP7202641176939787142.jpg",
|
||||
"1782888609885-rotated_1782888593813_1000000454.jpg",
|
||||
"1782890303600-1000000465.jpg",
|
||||
"1782892728794-1000000466.jpg",
|
||||
"1782909791970-sample_do.jpeg",
|
||||
"IMG_20260630_145445.jpg",
|
||||
"IMG_20260701_134446.jpg",
|
||||
"IMG_20260701_134504.jpg",
|
||||
"IMG_20260701_134533.jpg",
|
||||
"IMG_20260701_134555.jpg",
|
||||
"IMG_20260701_134555~2.jpg",
|
||||
"IMG_20260701_134635.jpg",
|
||||
"IMG_20260701_134636.jpg",
|
||||
"IMG_20260701_134646.jpg",
|
||||
"IMG_20260701_134646~2.jpg",
|
||||
"IMG_20260701_134704.jpg",
|
||||
"IMG_20260701_134704~2.jpg",
|
||||
"IMG_20260701_134810.jpg",
|
||||
"IMG_20260701_134817.jpg",
|
||||
"IMG_20260701_135900.jpg",
|
||||
"IMG_20260701_135910.jpg",
|
||||
"IMG_20260701_135923.jpg",
|
||||
"IMG_20260701_135938.jpg",
|
||||
"IMG_20260701_135950.jpg",
|
||||
"IMG_20260701_140005.jpg"
|
||||
];
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
export async function GET() {
|
||||
return NextResponse.json({ files: testFiles });
|
||||
try {
|
||||
const dirPath = path.join(process.cwd(), "public/test-images");
|
||||
if (!fs.existsSync(dirPath)) {
|
||||
return NextResponse.json({ files: [] });
|
||||
}
|
||||
const files = fs.readdirSync(dirPath).filter(file => {
|
||||
const ext = path.extname(file).toLowerCase();
|
||||
return ext === ".jpg" || ext === ".jpeg" || ext === ".png";
|
||||
});
|
||||
// Sort files to keep consistent ordering in UI
|
||||
files.sort();
|
||||
return NextResponse.json({ files });
|
||||
} catch (error: any) {
|
||||
console.error("Error reading test-images directory:", error);
|
||||
return NextResponse.json({ error: error.message }, { status: 500 });
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user