mirror of
https://github.com/azures04/crafatar.git
synced 2026-05-06 11:00:39 +02:00
allow editing index html when debug_enabled = true
This commit is contained in:
@@ -1,12 +1,25 @@
|
||||
var logging = require("../logging");
|
||||
var config = require("../../config");
|
||||
var path = require("path");
|
||||
var read = require("fs").readFileSync;
|
||||
var ejs = require("ejs");
|
||||
|
||||
var str = read(path.join(__dirname, "..", "views", "index.html.ejs"), "utf-8");
|
||||
var index = ejs.compile(str);
|
||||
var str;
|
||||
var index;
|
||||
|
||||
function compile() {
|
||||
logging.log("Compiling index page");
|
||||
str = read(path.join(__dirname, "..", "views", "index.html.ejs"), "utf-8");
|
||||
index = ejs.compile(str);
|
||||
}
|
||||
|
||||
compile();
|
||||
|
||||
module.exports = function(req, callback) {
|
||||
if (config.server.debug_enabled) {
|
||||
// allow changes without reloading
|
||||
compile();
|
||||
}
|
||||
var html = index({
|
||||
title: "Crafatar",
|
||||
domain: "https://" + req.headers.host,
|
||||
|
||||
Reference in New Issue
Block a user