mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-12 22:26:08 -04:00
Update slide mode to show extra info and support url actions and support disqus via yaml-metadata
This commit is contained in:
parent
e12fae6999
commit
a013c9d3bc
11 changed files with 155 additions and 4 deletions
39
lib/response.js
Normal file → Executable file
39
lib/response.js
Normal file → Executable file
|
@ -47,6 +47,7 @@ var response = {
|
|||
showIndex: showIndex,
|
||||
noteActions: noteActions,
|
||||
publishNoteActions: publishNoteActions,
|
||||
publishSlideActions: publishSlideActions,
|
||||
githubActions: githubActions,
|
||||
gitlabActions: gitlabActions
|
||||
};
|
||||
|
@ -241,7 +242,8 @@ function showPublishNote(req, res, next) {
|
|||
useCDN: config.usecdn,
|
||||
lastchangeuserprofile: note.lastchangeuser ? models.User.parseProfile(note.lastchangeuser.profile) : null,
|
||||
robots: meta.robots || false, //default allow robots
|
||||
GA: meta.GA
|
||||
GA: meta.GA,
|
||||
disqus: meta.disqus
|
||||
};
|
||||
return renderPublish(data, res);
|
||||
}).catch(function (err) {
|
||||
|
@ -410,6 +412,20 @@ function publishNoteActions(req, res, next) {
|
|||
});
|
||||
}
|
||||
|
||||
function publishSlideActions(req, res, next) {
|
||||
findNote(req, res, function (note) {
|
||||
var action = req.params.action;
|
||||
switch (action) {
|
||||
case "edit":
|
||||
res.redirect(config.serverurl + '/' + (note.alias ? note.alias : LZString.compressToBase64(note.id)));
|
||||
break;
|
||||
default:
|
||||
res.redirect(config.serverurl + '/p/' + note.shortid);
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function githubActions(req, res, next) {
|
||||
var noteId = req.params.noteId;
|
||||
findNote(req, res, function (note) {
|
||||
|
@ -530,6 +546,13 @@ function gitlabActionProjects(req, res, note) {
|
|||
}
|
||||
|
||||
function showPublishSlide(req, res, next) {
|
||||
var include = [{
|
||||
model: models.User,
|
||||
as: "owner"
|
||||
}, {
|
||||
model: models.User,
|
||||
as: "lastchangeuser"
|
||||
}];
|
||||
findNote(req, res, function (note) {
|
||||
// force to use short id
|
||||
var shortid = req.params.shortid;
|
||||
|
@ -549,26 +572,34 @@ function showPublishSlide(req, res, next) {
|
|||
//na
|
||||
}
|
||||
if (!meta) meta = {};
|
||||
var createtime = note.createdAt;
|
||||
var updatetime = note.lastchangeAt;
|
||||
var text = S(body).escapeHTML().s;
|
||||
var title = models.Note.decodeTitle(note.title);
|
||||
title = models.Note.generateWebTitle(meta.title || title);
|
||||
var slides = md.slidify(text, slideOptions);
|
||||
var origin = config.serverurl;
|
||||
var data = {
|
||||
url: origin,
|
||||
title: title,
|
||||
description: meta.description,
|
||||
viewcount: note.viewcount,
|
||||
createtime: createtime,
|
||||
updatetime: updatetime,
|
||||
url: origin,
|
||||
slides: slides,
|
||||
meta: JSON.stringify(obj.meta || {}),
|
||||
useCDN: config.usecdn,
|
||||
lastchangeuserprofile: note.lastchangeuser ? models.User.parseProfile(note.lastchangeuser.profile) : null,
|
||||
robots: meta.robots || false, //default allow robots
|
||||
GA: meta.GA,
|
||||
useCDN: config.usecdn
|
||||
disqus: meta.disqus
|
||||
};
|
||||
return renderPublishSlide(data, res);
|
||||
}).catch(function (err) {
|
||||
logger.error(err);
|
||||
return response.errorInternalError(res);
|
||||
});
|
||||
});
|
||||
}, include);
|
||||
}
|
||||
|
||||
function renderPublishSlide(data, res) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue