mirror of
https://github.com/lifegpc/eh-downloader.git
synced 2026-07-08 01:31:00 +08:00
Add meiliserach server support
Fix GalleryMetadata contains escaped html data
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { unescape } from "std/html/mod.ts";
|
||||
import { GMeta } from "../db.ts";
|
||||
|
||||
export type GalleryMetadataTorrentInfo = {
|
||||
@@ -12,10 +13,13 @@ export type GalleryMetadataSingle = {
|
||||
gid: number;
|
||||
token: string;
|
||||
archiver_key: string;
|
||||
/// HTML escaped
|
||||
title: string;
|
||||
/// HTML escaped
|
||||
title_jpn: string;
|
||||
category: string;
|
||||
thumb: string;
|
||||
/// HTML escaped
|
||||
uploader: string;
|
||||
posted: string;
|
||||
filecount: string;
|
||||
@@ -45,10 +49,10 @@ class GalleryMetadata {
|
||||
return {
|
||||
gid: g.gid,
|
||||
token: g.token,
|
||||
title: g.title,
|
||||
title_jpn: g.title_jpn,
|
||||
title: unescape(g.title),
|
||||
title_jpn: unescape(g.title_jpn),
|
||||
category: g.category,
|
||||
uploader: g.uploader,
|
||||
uploader: unescape(g.uploader),
|
||||
posted: parseInt(g.posted),
|
||||
filecount: parseInt(g.filecount),
|
||||
filesize: g.filesize,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { assert, assertEquals } from "std/testing/asserts.ts";
|
||||
import { Client } from "../client.ts";
|
||||
import { load_settings } from "../config.ts";
|
||||
import { API_PERMISSION } from "../test_base.ts";
|
||||
@@ -8,6 +9,17 @@ Deno.test({
|
||||
}, async () => {
|
||||
const cfg = await load_settings("./config.json");
|
||||
const client = new Client(cfg);
|
||||
const re = await client.fetchGalleryMetadataByAPI([2552611, "3132307627"]);
|
||||
const re = await client.fetchGalleryMetadataByAPI([1389215, "b5e43bd12d"]);
|
||||
console.log(re.obj);
|
||||
const gdata = re.map.get(1389215);
|
||||
assert(gdata !== undefined && typeof gdata !== "string");
|
||||
assertEquals(
|
||||
gdata.title,
|
||||
"(C95) [Shiratamaco (Shiratama)] Usagi Syndrome 4 (Gochuumon wa Usagi desu ka?) [Chinese] [白玉症候群&绅士仓库联合汉化]",
|
||||
);
|
||||
const gmeta = re.convert(gdata);
|
||||
assertEquals(
|
||||
gmeta.title,
|
||||
"(C95) [Shiratamaco (Shiratama)] Usagi Syndrome 4 (Gochuumon wa Usagi desu ka?) [Chinese] [白玉症候群&绅士仓库联合汉化]",
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user