let fs = require("fs"); let path = require("path"); let mkdirp = require("mkdirp"); const staticDir = path.join(__dirname, "static"); module.exports = (app) => { function renderAndSave(file, template, options) { file = path.join(staticDir, file); mkdirp.sync(path.join(file, "..")); options.layout = "html"; app.render(template, options, (e, r) => { if (e) return fs.writeFile(file, "Something went wrong!

Something went wrong!

Could not render this page! Please contact the administrator!

", () => undefined); return fs.writeFile(file, r, () => undefined); }); } if (!fs.existsSync(staticDir)) fs.mkdirSync(staticDir); [ ["index.htm", "linkList", { title: "Key Server of banananet.work", links: [ {href: "/ssh/", name: "Public SSH Keys"}, ], }], ["ssh/index.htm", "linkList", { title: "SSH Keys of banananet.work", links: [ {href: "/ssh/user", name: "Get all user keys"}, {href: "/ssh/ca/", name: "Certificate Authorities"}, ] }], ].forEach(e => renderAndSave(e[0], e[1], e[2])); };