Better handle bigint

This commit is contained in:
2024-05-31 14:24:57 +08:00
parent 15ff42d8c4
commit 8437bf1436
36 changed files with 320 additions and 227 deletions

View File

@@ -1,16 +1,23 @@
import { Uint8ArrayReader, ZipWriter } from "zipjs/index.js";
import type { EhDb, PMeta } from "../db.ts";
import type { ExportZipConfig } from "../tasks/export_zip.ts";
import { addZero, configureZipJs, limitFilename } from "../utils.ts";
import {
addZero,
compareNum,
configureZipJs,
limitFilename,
} from "../utils.ts";
export function get_export_zip_response(
gid: number,
gid: number | bigint,
db: EhDb,
cfg: ExportZipConfig,
) {
const gmeta = db.get_gmeta_by_gid(gid);
if (!gmeta) return new Response("Gallery not found.", { status: 404 });
const pmetas = db.get_pmeta(gid).sort((a, b) => a.index - b.index);
const pmetas = db.get_pmeta(gid).sort((a, b) =>
compareNum(a.index, b.index)
);
const p = pmetas.length;
const l = gmeta.filecount.toString().length;
let c = 0;