mirror of
https://github.com/lifegpc/eh-downloader.git
synced 2026-06-06 05:38:44 +08:00
Add /api/filemeta and /api/filemeta/[token]
This commit is contained in:
13
db.ts
13
db.ts
@@ -461,6 +461,12 @@ export class EhDb {
|
||||
return s[s.length - 1];
|
||||
}
|
||||
}
|
||||
add_filemeta(m: EhFileMeta) {
|
||||
this.db.query(
|
||||
"INSERT OR REPLACE INTO filemeta VALUES (:token, :is_nsfw, :is_ad);",
|
||||
m,
|
||||
);
|
||||
}
|
||||
add_pmeta(pmeta: PMeta) {
|
||||
this.db.queryEntries(
|
||||
"INSERT OR REPLACE INTO pmeta VALUES (:gid, :index, :token, :name, :width, :height)",
|
||||
@@ -682,6 +688,13 @@ export class EhDb {
|
||||
));
|
||||
return d.length ? d[0] : null;
|
||||
}
|
||||
get_filemeta(token: string) {
|
||||
const d = this.convert_filemeta(this.db.queryEntries<EhFileMetaRaw>(
|
||||
"SELECT * FROM filemeta WHERE token = ?;",
|
||||
[token],
|
||||
));
|
||||
return d.length ? d[0] : null;
|
||||
}
|
||||
get_files(token: string) {
|
||||
return this.convert_file(this.db.queryEntries<EhFileRaw>(
|
||||
"SELECT * FROM file WHERE token = ?;",
|
||||
|
||||
Reference in New Issue
Block a user