mirror of
https://github.com/lifegpc/eh-downloader.git
synced 2026-07-08 01:31:00 +08:00
Add new config use_path_based_img_url
Fix parseBitInt
This commit is contained in:
@@ -12,6 +12,7 @@ import type { EhFileExtend } from "../../../server/files.ts";
|
||||
import { User, UserPermission } from "../../../db.ts";
|
||||
import { SortableURLSearchParams } from "../../../server/SortableURLSearchParams.ts";
|
||||
import { isNumNaN, parseBigInt } from "../../../utils.ts";
|
||||
import { extname } from "@std/path";
|
||||
|
||||
export const handler: Handlers = {
|
||||
async GET(req, ctx) {
|
||||
@@ -77,6 +78,12 @@ export const handler: Handlers = {
|
||||
),
|
||||
);
|
||||
if (verify === null) {
|
||||
if (m.cfg.use_path_based_img_url) {
|
||||
const ext = extname(f.path);
|
||||
return Response.redirect(
|
||||
`${get_host(req)}/file/${tverify}/${f.id}${ext}`,
|
||||
);
|
||||
}
|
||||
const b = new URLSearchParams();
|
||||
b.append("verify", tverify);
|
||||
return Response.redirect(
|
||||
|
||||
@@ -167,6 +167,11 @@ export const handler: Handlers = {
|
||||
);
|
||||
const b = new URLSearchParams(bs.toString());
|
||||
b.append("verify", tverify);
|
||||
if (m.cfg.use_path_based_img_url) {
|
||||
return Response.redirect(
|
||||
`${get_host(req)}/thumbnail/${b}/${f.id}.jpg`,
|
||||
);
|
||||
}
|
||||
return Response.redirect(
|
||||
`${get_host(req)}/thumbnail/${f.id}?${b}`,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user