mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-20 18:25:21 -04:00
Added server option "useCdn", use template statement to route resources' source
This commit is contained in:
parent
09a1e662f9
commit
b6c758f2fc
8 changed files with 71 additions and 16 deletions
|
@ -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)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue