Compare commits
3 Commits
8fece9090f
...
4669e1c0d4
Author | SHA1 | Date | |
---|---|---|---|
|
4669e1c0d4 | ||
|
2a5cb909b5 | ||
|
e5d410d809 |
3
.gitignore
vendored
3
.gitignore
vendored
@ -14,7 +14,8 @@ app/**
|
|||||||
settings.json
|
settings.json
|
||||||
comic_config.json
|
comic_config.json
|
||||||
**/comic_config.json
|
**/comic_config.json
|
||||||
compiled/
|
compile/
|
||||||
|
compile/**
|
||||||
deploy-scripts/
|
deploy-scripts/
|
||||||
|
|
||||||
.pnpm-store/**
|
.pnpm-store/**
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"compile": "swc src --out-dir compile",
|
"compile": "swc src --out-dir compile",
|
||||||
"dev": "nodemon -r @swc-node/register --enable-source-maps --exec node app.ts",
|
"dev": "nodemon -r @swc-node/register --enable-source-maps --exec node app.ts",
|
||||||
"start": "node compile/app.js"
|
"start": "node compile/src/app.js"
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
|
@ -14,7 +14,7 @@ interface ComicDesc {
|
|||||||
character?: string[];
|
character?: string[];
|
||||||
tags?: string[];
|
tags?: string[];
|
||||||
}
|
}
|
||||||
const ImageExt = [".gif", ".png", ".jpeg", ".bmp", ".webp", ".jpg"];
|
const ImageExt = [".gif", ".png", ".jpeg", ".bmp", ".webp", ".jpg", ".avif"];
|
||||||
export class ComicReferrer extends createDefaultClass("comic") {
|
export class ComicReferrer extends createDefaultClass("comic") {
|
||||||
desc: ComicDesc | undefined;
|
desc: ComicDesc | undefined;
|
||||||
pagenum: number;
|
pagenum: number;
|
||||||
|
@ -21,6 +21,20 @@ class SqliteDocumentAccessor implements DocumentAccessor {
|
|||||||
throw new Error("Method not implemented.");
|
throw new Error("Method not implemented.");
|
||||||
}
|
}
|
||||||
async addList(content_list: DocumentBody[]): Promise<number[]> {
|
async addList(content_list: DocumentBody[]): Promise<number[]> {
|
||||||
|
if (content_list.length === 0) return [];
|
||||||
|
if (content_list.length > 256) {
|
||||||
|
// if content_list is too long, split it.
|
||||||
|
const chunkLength = 256;
|
||||||
|
const chunked = [];
|
||||||
|
for (let i = 0; i < content_list.length; i += chunkLength) {
|
||||||
|
chunked.push(content_list.slice(i, i + chunkLength));
|
||||||
|
}
|
||||||
|
const ids = [];
|
||||||
|
for (const chunk of chunked) {
|
||||||
|
ids.push(await this.addList(chunk));
|
||||||
|
}
|
||||||
|
return ids.flat();
|
||||||
|
}
|
||||||
return await this.kysely.transaction().execute(async (trx) => {
|
return await this.kysely.transaction().execute(async (trx) => {
|
||||||
// add tags
|
// add tags
|
||||||
const tagCollected = new Set<string>();
|
const tagCollected = new Set<string>();
|
||||||
|
@ -68,7 +68,7 @@ function releaseZip(path: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function renderZipImage(ctx: Context, path: string, page: number) {
|
async function renderZipImage(ctx: Context, path: string, page: number) {
|
||||||
const image_ext = ["gif", "png", "jpeg", "bmp", "webp", "jpg"];
|
const image_ext = ["gif", "png", "jpeg", "bmp", "webp", "jpg", "avif"];
|
||||||
const marked = markUseZip(path);
|
const marked = markUseZip(path);
|
||||||
const zip = await acquireZip(path, marked);
|
const zip = await acquireZip(path, marked);
|
||||||
const entries = (await entriesByNaturalOrder(zip)).filter((x) => {
|
const entries = (await entriesByNaturalOrder(zip)).filter((x) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user