Add new settings jpn_title to export zip task

This commit is contained in:
2023-06-11 09:34:19 +08:00
parent 28387eda1c
commit f16264dfbc
10 changed files with 48 additions and 12 deletions

View File

@@ -1,14 +1,19 @@
import { Handlers } from "$fresh/server.ts";
import { get_task_manager } from "../../../../../server.ts";
import { get_export_zip_response } from "../../../../../server/export_zip.ts";
import { parse_bool } from "../../../../../server/parse_form.ts";
import { ExportZipConfig } from "../../../../../tasks/export_zip.ts";
export const handler: Handlers = {
GET(_req, ctx) {
async GET(req, ctx) {
const gid = parseInt(ctx.params.gid);
if (isNaN(gid)) {
return new Response("Bad Request", { status: 400 });
}
const params = new URL(req.url).searchParams;
const cfg: ExportZipConfig = {};
cfg.jpn_title = await parse_bool(params.get("jpn_title"), false);
const m = get_task_manager();
return get_export_zip_response(gid, m.db);
return get_export_zip_response(gid, m.db, cfg);
},
};