show dest & srchost
This commit is contained in:
parent
a3a195b26b
commit
1058d313a1
|
@ -1,5 +1,6 @@
|
||||||
import router from "../router";
|
import router from "../router";
|
||||||
import sql from "../sql";
|
import sql from "../sql";
|
||||||
|
import { parse } from "url";
|
||||||
import cfg from "../../../config.json";
|
import cfg from "../../../config.json";
|
||||||
|
|
||||||
import { mimes, queries } from "./inc/api";
|
import { mimes, queries } from "./inc/api";
|
||||||
|
@ -77,6 +78,7 @@ router.get(/^\/api\/item\/[0-9]+$/, async (req, res) => {
|
||||||
const data = rows[0].length > 0 ? {
|
const data = rows[0].length > 0 ? {
|
||||||
...rows[0][0], ...{
|
...rows[0][0], ...{
|
||||||
thumb: `${cfg.main.url}/t/${rows[0][0].id}.png`,
|
thumb: `${cfg.main.url}/t/${rows[0][0].id}.png`,
|
||||||
|
srchost: parse(rows[0][0].src).hostname,
|
||||||
next: rows[1].length ? rows[1][0].id : null,
|
next: rows[1].length ? rows[1][0].id : null,
|
||||||
prev: rows[2].length ? rows[2][0].id : null,
|
prev: rows[2].length ? rows[2][0].id : null,
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ export const queries = {
|
||||||
main: "select id, mime, size, username, userchannel, usernetwork, stamp, dest, src from items ",
|
main: "select id, mime, size, username, userchannel, usernetwork, stamp, dest, src from items ",
|
||||||
where: where => `${where?`where ${where}`:""} order by rand() limit 1`
|
where: where => `${where?`where ${where}`:""} order by rand() limit 1`
|
||||||
},
|
},
|
||||||
item: "select id, mime, size, src, stamp, userchannel, username, usernetwork from items where id = ? limit 1;"
|
item: "select id, mime, dest, size, src, stamp, userchannel, username, usernetwork from items where id = ? limit 1;"
|
||||||
+ "select id from items where id = (select min(id) from items where id > ?);"
|
+ "select id from items where id = (select min(id) from items where id > ?);"
|
||||||
+ "select id from items where id = (select max(id) from items where id < ?)",
|
+ "select id from items where id = (select max(id) from items where id < ?)",
|
||||||
p: (trend, order) => `select id, mime from items where id ${trend} ? order by id ${order} limit ?`,
|
p: (trend, order) => `select id, mime from items where id ${trend} ? order by id ${order} limit ?`,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user