mirror of
https://github.com/lifegpc/eh-downloader.git
synced 2026-06-06 05:38:44 +08:00
fix: Unescape html character in eh metadata on server side
This commit is contained in:
6
db.ts
6
db.ts
@@ -351,7 +351,7 @@ export class EhDb {
|
||||
#base_path: string;
|
||||
#db_path: string;
|
||||
#use_ffi = false;
|
||||
readonly version = parse_ver("1.0.0-14");
|
||||
readonly version = parse_ver("1.0.0-15");
|
||||
constructor(base_path: string) {
|
||||
this.#base_path = base_path;
|
||||
this.#db_path = join(base_path, "data.db");
|
||||
@@ -509,6 +509,10 @@ export class EhDb {
|
||||
if (compare_ver(v, parse_ver("1.0.0-14")) === -1) {
|
||||
this.db.execute(PMETA_INDEX);
|
||||
}
|
||||
if (compare_ver(v, parse_ver("1.0.0-15")) === -1) {
|
||||
this.db.execute("DELETE FROM ehmeta;");
|
||||
need_optimize = true;
|
||||
}
|
||||
this.#write_version();
|
||||
if (need_optimize) this.optimize();
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ export type GalleryMetadataTorrentInfo = {
|
||||
export type GalleryMetadataSingle = {
|
||||
gid: number;
|
||||
token: string;
|
||||
archiver_key: string;
|
||||
archiver_key?: string;
|
||||
/// HTML escaped
|
||||
title: string;
|
||||
/// HTML escaped
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
return_error,
|
||||
} from "../../../server/utils.ts";
|
||||
import { base_logger } from "../../../utils/logger.ts";
|
||||
import { unescape } from "@std/html";
|
||||
|
||||
const logger = base_logger.get_logger("api-eh-metadata");
|
||||
|
||||
@@ -73,6 +74,9 @@ export const handler: Handlers = {
|
||||
if (typeof v === "string") {
|
||||
data[k.toString()] = gen_error(2, v);
|
||||
} else {
|
||||
v.title = unescape(v.title);
|
||||
v.title_jpn = unescape(v.title_jpn);
|
||||
v.uploader = unescape(v.uploader);
|
||||
data[k.toString()] = gen_data(v);
|
||||
m.db.add_ehmeta(v);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user