Sửa lỗi đăng nhập vào admin mà không reload được page do lỗi tạo scene trước đó, sử dụng lệnh resetDB.js để khởi tạo lại, xóa các scene trước và ảnh đã upload

This commit is contained in:
2026-06-08 10:48:54 +07:00
parent 81de520071
commit c495efad36
25 changed files with 290 additions and 47 deletions
+9 -3
View File
@@ -32,11 +32,11 @@ const degToDmsRational = (deg) => {
const absolute = Math.abs(deg);
const d = Math.floor(absolute);
const m = Math.floor((absolute - d) * 60);
const s = Math.round((absolute - d - m / 60) * 3600 * 100) / 100;
const s = Math.round((absolute - d - m / 60) * 3600 * 100);
return [
[d, 1],
[m, 1],
[Math.round(s * 100), 100]
[s, 100]
];
};
@@ -77,7 +77,13 @@ const injectGPSCoordinates = async (filePath, lat, lng) => {
exifObj["GPS"][piexif.GPSIFD.GPSLongitudeRef] = lngRef;
exifObj["GPS"][piexif.GPSIFD.GPSLongitude] = degToDmsRational(lng);
const exifBytes = piexif.dump(exifObj);
// Chỉ đóng gói các IFD cần thiết để tránh lỗi 'pack' từ dữ liệu rác
const exifBytes = piexif.dump({
"0th": exifObj["0th"] || {},
"Exif": exifObj["Exif"] || {},
"GPS": exifObj["GPS"] || {}
});
const newJpegBinary = piexif.insert(exifBytes, jpegBinary);
fs.writeFileSync(filePath, Buffer.from(newJpegBinary, 'binary'));