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

@@ -30,7 +30,7 @@ export type DownloadConfig = {
download_original_img?: boolean;
max_retry_count?: number;
remove_previous_gallery?: boolean;
replaced_gallery?: { gid: number; token: string }[];
replaced_gallery?: { gid: number | bigint; token: string }[];
};
export const DEFAULT_DOWNLOAD_CONFIG: DownloadConfig = {};
@@ -326,13 +326,13 @@ export async function download_task(
if (f === undefined) throw Error("Failed to get file.");
m.add_new_details({
downloaded: 0,
height: f.height,
height: Number(f.height),
index: i.index,
is_original: f.is_original,
name: i.name,
token: i.page_token,
total: 0,
width: f.width,
width: Number(f.width),
started: 0,
speed: 0,
last_updated: 0,

View File

@@ -4,6 +4,7 @@ import type { EhDb } from "../db.ts";
import {
addZero,
asyncForEach,
compareNum,
configureZipJs,
filterFilename,
limitFilename,
@@ -36,7 +37,7 @@ export async function export_zip(
? ecfg.jpn_title
: cfg.export_zip_jpn_title;
const progress: TaskExportZipProgress = {
total_page: g.filecount,
total_page: Number(g.filecount),
added_page: 0,
};
const sendEvent = () => {
@@ -64,7 +65,7 @@ export async function export_zip(
});
const l = g.filecount.toString().length;
await asyncForEach(
db.get_pmeta(gid).sort((a, b) => a.index - b.index),
db.get_pmeta(gid).sort((a, b) => compareNum(a.index, b.index)),
async (p) => {
const f = db.get_files(p.token);
const t = db.get_filemeta(p.token);

View File

@@ -18,7 +18,7 @@ export async function update_meili_search_data(
progress,
);
};
if (task.gid !== 0) {
if (task.gid != 0) {
progress.total_gallery = 1;
sendEvent();
await manager.meilisearch.updateGallery(task.gid);