...
This commit is contained in:
@ -13,7 +13,12 @@ const allowedMimes = [ "audio", "image", "video", "%" ];
|
||||
router.get(/^\/(audio\/?|image\/?|video\/?)?(p\/\d+)?$/, async (req, res) => {
|
||||
const tmpmime = (allowedMimes.filter(n => req.url.split[0].startsWith(n))[0] ? req.url.split[0] : "");
|
||||
const mime = tmpmime + "%";
|
||||
const total = (await sql("items").where("mime", "like", mime).count("* as total"))[0].total;
|
||||
|
||||
const total = (
|
||||
await sql("items")
|
||||
.where("mime", "like", mime)
|
||||
.count("* as total")
|
||||
)[0].total;
|
||||
|
||||
const pages = +Math.ceil(total / cfg.websrv.eps);
|
||||
const page = Math.min(pages, +req.url.split[tmpmime.length > 0 ? 2 : 1] || 1);
|
||||
|
Reference in New Issue
Block a user