mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-29 06:15:29 -04:00
Support set url path and use relative url, move raphael to bower and fixed minor issue in history
This commit is contained in:
parent
3f2f063e9b
commit
b2b1be3dda
22 changed files with 222 additions and 198 deletions
lib
|
@ -68,6 +68,7 @@ function responseError(res, code, detail, msg) {
|
|||
});
|
||||
var template = config.errorpath;
|
||||
var content = ejs.render(fs.readFileSync(template, 'utf8'), {
|
||||
url: config.getserverurl(),
|
||||
title: code + ' ' + detail + ' ' + msg,
|
||||
cache: !config.debug,
|
||||
filename: template,
|
||||
|
@ -86,6 +87,7 @@ function showIndex(req, res, next) {
|
|||
});
|
||||
var template = config.indexpath;
|
||||
var content = ejs.render(fs.readFileSync(template, 'utf8'), {
|
||||
url: config.getserverurl(),
|
||||
useCDN: config.usecdn
|
||||
});
|
||||
res.write(content);
|
||||
|
@ -115,6 +117,7 @@ function responseHackMD(res, noteId) {
|
|||
};
|
||||
var compiled = ejs.compile(fs.readFileSync(template, 'utf8'), options);
|
||||
var html = compiled({
|
||||
url: config.getserverurl(),
|
||||
title: title,
|
||||
useCDN: config.usecdn,
|
||||
robots: (meta && meta.robots) || false //default allow robots
|
||||
|
@ -145,7 +148,7 @@ function newNote(req, res, next) {
|
|||
if (err) {
|
||||
return response.errorInternalError(res);
|
||||
}
|
||||
res.redirect("/" + LZString.compressToBase64(newId));
|
||||
res.redirect(config.getserverurl() + "/" + LZString.compressToBase64(newId));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -272,6 +275,7 @@ function showPublishNote(req, res, next) {
|
|||
function renderPublish(data, res) {
|
||||
var template = config.prettypath;
|
||||
var options = {
|
||||
url: config.getserverurl(),
|
||||
cache: !config.debug,
|
||||
filename: template
|
||||
};
|
||||
|
@ -296,7 +300,7 @@ function actionPublish(req, res, noteId) {
|
|||
if (err) {
|
||||
return response.errorNotFound(res);
|
||||
}
|
||||
res.redirect("/s/" + note.shortid);
|
||||
res.redirect(config.getserverurl() + "/s/" + note.shortid);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -311,7 +315,7 @@ function actionSlide(req, res, noteId) {
|
|||
if (err) {
|
||||
return response.errorNotFound(res);
|
||||
}
|
||||
res.redirect("/p/" + note.shortid);
|
||||
res.redirect(config.getserverurl() + "/p/" + note.shortid);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -433,9 +437,9 @@ function noteActions(req, res, next) {
|
|||
break;
|
||||
default:
|
||||
if (noteId != config.featuresnotename)
|
||||
res.redirect('/' + LZString.compressToBase64(noteId));
|
||||
res.redirect(config.getserverurl() + '/' + LZString.compressToBase64(noteId));
|
||||
else
|
||||
res.redirect('/' + noteId);
|
||||
res.redirect(config.getserverurl() + '/' + noteId);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
@ -463,9 +467,9 @@ function publishNoteActions(req, res, next) {
|
|||
switch (action) {
|
||||
case "edit":
|
||||
if (note.id != config.featuresnotename)
|
||||
res.redirect('/' + LZString.compressToBase64(note.id));
|
||||
res.redirect(config.getserverurl() + '/' + LZString.compressToBase64(note.id));
|
||||
else
|
||||
res.redirect('/' + note.id);
|
||||
res.redirect(config.getserverurl() + '/' + note.id);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
@ -505,9 +509,9 @@ function githubActions(req, res, next) {
|
|||
break;
|
||||
default:
|
||||
if (noteId != config.featuresnotename)
|
||||
res.redirect('/' + LZString.compressToBase64(noteId));
|
||||
res.redirect(config.getserverurl() + '/' + LZString.compressToBase64(noteId));
|
||||
else
|
||||
res.redirect('/' + noteId);
|
||||
res.redirect(config.getserverurl() + '/' + noteId);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
@ -627,6 +631,7 @@ var render = function (res, title, markdown) {
|
|||
var slides = md.slidify(markdown, opts);
|
||||
|
||||
res.end(Mustache.to_html(opts.template, {
|
||||
url: config.getserverurl(),
|
||||
title: title,
|
||||
theme: opts.theme,
|
||||
highlightTheme: opts.highlightTheme,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue