This commit is contained in:
Flummi
2020-04-05 18:47:09 +02:00
parent a202ae2e69
commit 29329702da
10 changed files with 188 additions and 234 deletions

View File

@ -1,9 +1,10 @@
import router from "../router.mjs";
import cfg from "../../../config.json";
import fs from "fs";
import sql from "../sql.mjs";
import swig from "swig";
import url from "url";
import sql from "../sql.mjs";
import lib from "../lib.mjs";
import tpl from "../tpl.mjs";
const templates = {
contact: fs.readFileSync("./views/contact.html", "utf-8"),
@ -21,7 +22,7 @@ router.get("/", async (req, res) => {
};
res.reply({
body: swig.compile(templates.index)(data)
body: tpl.render(templates.index, data)
});
});
@ -74,7 +75,7 @@ router.get(/^\/([0-9]+)$/, async (req, res) => {
data.thumb = `${cfg.websrv.paths.thumbnails}/${e.id}.png`;
data.dest = `${cfg.websrv.paths.images}/${e.dest}`;
data.mime = e.mime;
data.size = e.size;//lib.formatSize(e.size);
data.size = lib.formatSize(e.size);
data.userchannel = e.userchannel;
data.usernetwork = e.usernetwork;
data.timestamp = new Date(e.stamp * 1000).toISOString();
@ -84,7 +85,7 @@ router.get(/^\/([0-9]+)$/, async (req, res) => {
data.prev = query[2][0].id;
}
res.reply({
body: swig.compile(templates.item)(data)
body: tpl.render(templates.item, data)
});
});