summaryrefslogtreecommitdiff
path: root/lib/response.js
diff options
context:
space:
mode:
author蒼時弦也2017-01-05 22:36:40 +0800
committer蒼時弦也2017-01-05 22:36:40 +0800
commitaaf1ff4b2f5ae7ae3a5e4e4a202422484503f559 (patch)
tree91772db04e1059d29d70c8f27ff5911e14361c4f /lib/response.js
parent23a12dd927b66880fa991b377d450455851b69a9 (diff)
Add limit for constrain anonymous view note
Diffstat (limited to 'lib/response.js')
-rwxr-xr-xlib/response.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/response.js b/lib/response.js
index a0dc8b1f..69854815 100755
--- a/lib/response.js
+++ b/lib/response.js
@@ -117,7 +117,7 @@ function newNote(req, res, next) {
}
function checkViewPermission(req, note) {
- if (note.permission == 'private') {
+ if (note.permission == 'private' || !config.allowanonymousView) {
if (!req.isAuthenticated() || note.ownerId != req.user.id)
return false;
else
@@ -161,7 +161,7 @@ function showNote(req, res, next) {
findNote(req, res, function (note) {
// force to use note id
var noteId = req.params.noteId;
- var id = LZString.compressToBase64(note.id);
+ var id = LZString.compressToBase64(note.id);
if ((note.alias && noteId != note.alias) || (!note.alias && noteId != id))
return res.redirect(config.serverurl + "/" + (note.alias || id));
return responseHackMD(res, note);
@@ -413,7 +413,7 @@ function publishSlideActions(req, res, next) {
res.redirect(config.serverurl + '/' + (note.alias ? note.alias : LZString.compressToBase64(note.id)));
break;
default:
- res.redirect(config.serverurl + '/p/' + note.shortid);
+ res.redirect(config.serverurl + '/p/' + note.shortid);
break;
}
});