From b6c758f2fc2cb502ed194f2700e033564f2521f4 Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Tue, 22 Sep 2015 12:06:13 +0800 Subject: Added server option "useCdn", use template statement to route resources' source --- lib/response.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/response.js') diff --git a/lib/response.js b/lib/response.js index b8cfab17..1f7fbd54 100644 --- a/lib/response.js +++ b/lib/response.js @@ -34,6 +34,7 @@ var response = { showFeatures: showFeatures, showNote: showNote, showPublishNote: showPublishNote, + showIndex: showIndex, noteActions: noteActions, publishNoteActions: publishNoteActions }; @@ -55,6 +56,18 @@ function responseError(res, code, detail, msg) { res.end(); } +function showIndex(req, res, next) { + res.writeHead(200, { + 'Content-Type': 'text/html' + }); + var template = config.indexpath; + var content = ejs.render(fs.readFileSync(template, 'utf8'), { + useCDN: config.usecdn + }); + res.write(content); + res.end(); +} + function responseHackMD(res, noteId) { if (noteId != config.featuresnotename) { if (!Note.checkNoteIdValid(noteId)) { -- cgit v1.2.3