add comments

This commit is contained in:
Georges-Antoine Assi
2025-10-01 09:15:40 -04:00
parent c28a027940
commit a2e6c3e612
2 changed files with 18 additions and 16 deletions

View File

@@ -403,7 +403,7 @@ async def download_roms(
for file in rom_files:
content_lines.append(
ZipContentLine(
crc32=None,
crc32=None, # The CRC hash stored for compressed files is for the uncompressed content
size_bytes=file.file_size_bytes,
encoded_location=quote(f"/library/{file.full_path}"),
filename=file.full_path,
@@ -637,7 +637,7 @@ async def get_rom_content(
content_lines = [
ZipContentLine(
crc32=None,
crc32=None, # The CRC hash stored for compressed files is for the uncompressed content
size_bytes=f.file_size_bytes,
encoded_location=quote(f"/library/{f.full_path}"),
filename=f.file_name_for_download(rom, hidden_folder),

View File

@@ -229,25 +229,27 @@ async function bulkDownloadRoms({
roms: SimpleRom[];
filename?: string;
}) {
if (roms.length === 0) return;
return new Promise<void>((resolve) => {
if (roms.length === 0) return resolve();
const romIds = roms.map((rom) => rom.id);
const romIds = roms.map((rom) => rom.id);
const queryParams = new URLSearchParams();
queryParams.append("rom_ids", romIds.join(","));
if (filename) queryParams.append("filename", filename);
const queryParams = new URLSearchParams();
queryParams.append("rom_ids", romIds.join(","));
if (filename) queryParams.append("filename", filename);
const a = document.createElement("a");
a.href = `/api/roms/download?${queryParams.toString()}`;
a.style.display = "none";
const a = document.createElement("a");
a.href = `/api/roms/download?${queryParams.toString()}`;
a.style.display = "none";
document.body.appendChild(a);
a.click();
document.body.appendChild(a);
a.click();
setTimeout(() => {
document.body.removeChild(a);
window.URL.revokeObjectURL(a.href);
}, DOWNLOAD_CLEANUP_DELAY);
setTimeout(() => {
document.body.removeChild(a);
resolve();
}, DOWNLOAD_CLEANUP_DELAY);
});
}
export type UpdateRom = SimpleRom & {