mirror of
https://github.com/lifegpc/eh-downloader.git
synced 2026-06-06 05:38:44 +08:00
feat: Add log API endpoint and enhance error logging in task handler
This commit is contained in:
@@ -22,6 +22,7 @@ import * as $api_gallery_gid_ from "./routes/api/gallery/[gid].ts";
|
||||
import * as $api_gallery_list from "./routes/api/gallery/list.ts";
|
||||
import * as $api_gallery_meta_gids_ from "./routes/api/gallery/meta/[gids].ts";
|
||||
import * as $api_health_check from "./routes/api/health_check.ts";
|
||||
import * as $api_log from "./routes/api/log.ts";
|
||||
import * as $api_shared_token from "./routes/api/shared_token.ts";
|
||||
import * as $api_shared_token_list from "./routes/api/shared_token/list.ts";
|
||||
import * as $api_status from "./routes/api/status.ts";
|
||||
@@ -72,6 +73,7 @@ const manifest = {
|
||||
"./routes/api/gallery/list.ts": $api_gallery_list,
|
||||
"./routes/api/gallery/meta/[gids].ts": $api_gallery_meta_gids_,
|
||||
"./routes/api/health_check.ts": $api_health_check,
|
||||
"./routes/api/log.ts": $api_log,
|
||||
"./routes/api/shared_token.ts": $api_shared_token,
|
||||
"./routes/api/shared_token/list.ts": $api_shared_token_list,
|
||||
"./routes/api/status.ts": $api_status,
|
||||
|
||||
@@ -148,7 +148,8 @@ export const handler: Handlers = {
|
||||
}
|
||||
return return_data(task, 201);
|
||||
} catch (e) {
|
||||
return return_error(500, e.message);
|
||||
logger.error("Failed to add download task:", e);
|
||||
return return_error(500, "Internal Server Error");
|
||||
}
|
||||
} else if (typ == "export_zip") {
|
||||
const gid = await parse_big_int(form.get("gid"), null);
|
||||
@@ -168,7 +169,8 @@ export const handler: Handlers = {
|
||||
const task = await t.add_export_zip_task(gid, dcfg);
|
||||
return return_data(task, 201);
|
||||
} catch (e) {
|
||||
return return_error(500, e.message);
|
||||
logger.error("Failed to add export zip task:", e);
|
||||
return return_error(500, "Internal Server Error");
|
||||
}
|
||||
} else if (typ == "update_meili_search_data") {
|
||||
const gid = await parse_big_int(form.get("gid"), 0);
|
||||
@@ -176,7 +178,8 @@ export const handler: Handlers = {
|
||||
const task = await t.add_update_meili_search_data_task(gid);
|
||||
return return_data(task, 201);
|
||||
} catch (e) {
|
||||
return return_error(500, e.message);
|
||||
logger.error("Failed to add update meili search data task:", e);
|
||||
return return_error(500, "Internal Server Error");
|
||||
}
|
||||
} else if (typ == "import") {
|
||||
const gid = await parse_big_int(form.get("gid"), null);
|
||||
@@ -207,7 +210,8 @@ export const handler: Handlers = {
|
||||
}
|
||||
return return_data(task, 201);
|
||||
} catch (e) {
|
||||
return return_error(500, e.message);
|
||||
logger.error("Failed to add import task:", e);
|
||||
return return_error(500, "Internal Server Error");
|
||||
}
|
||||
} else if (typ == "update_tag_translation") {
|
||||
const cfg = await get_string(form.get("cfg"));
|
||||
@@ -229,7 +233,8 @@ export const handler: Handlers = {
|
||||
}
|
||||
return return_data(task, 201);
|
||||
} catch (e) {
|
||||
return return_error(500, e.message);
|
||||
logger.error("Failed to add update tag translation task:", e);
|
||||
return return_error(500, "Internal Server Error");
|
||||
}
|
||||
} else {
|
||||
return return_error(5, "unknown type");
|
||||
|
||||
Reference in New Issue
Block a user