summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChristoph (Sheogorath) Kern2018-11-17 13:30:06 +0100
committerGitHub2018-11-17 13:30:06 +0100
commit5f0d04334b5aaf6d8e61b99f07b63a2cc05c2ee2 (patch)
treef73a1558f611db637e2e1d8e57f66ed4c2437df2 /lib
parent6f7fd74b1aad24de2bb62eb2f80e02b94a1168cd (diff)
parent4bd8d7eb91524cc936bc607f8291804689de35ea (diff)
Merge pull request #1053 from dsprenkels/robots.txt
Disallow creation of robots.txt in freeurl
Diffstat (limited to '')
-rw-r--r--lib/config/default.js1
-rw-r--r--lib/config/environment.js1
-rw-r--r--lib/response.js2
3 files changed, 3 insertions, 1 deletions
diff --git a/lib/config/default.js b/lib/config/default.js
index 71375b98..d7a8f471 100644
--- a/lib/config/default.js
+++ b/lib/config/default.js
@@ -32,6 +32,7 @@ module.exports = {
allowAnonymous: true,
allowAnonymousEdits: false,
allowFreeURL: false,
+ forbiddenNoteIDs: ['robots.txt', 'favicon.ico', 'api'],
defaultPermission: 'editable',
dbURL: '',
db: {},
diff --git a/lib/config/environment.js b/lib/config/environment.js
index 4220e54d..a57fe0db 100644
--- a/lib/config/environment.js
+++ b/lib/config/environment.js
@@ -28,6 +28,7 @@ module.exports = {
allowAnonymous: toBooleanConfig(process.env.CMD_ALLOW_ANONYMOUS),
allowAnonymousEdits: toBooleanConfig(process.env.CMD_ALLOW_ANONYMOUS_EDITS),
allowFreeURL: toBooleanConfig(process.env.CMD_ALLOW_FREEURL),
+ forbiddenNoteIDs: toArrayConfig(process.env.CMD_FORBIDDEN_NOTE_IDS),
defaultPermission: process.env.CMD_DEFAULT_PERMISSION,
dbURL: process.env.CMD_DB_URL,
sessionSecret: process.env.CMD_SESSION_SECRET,
diff --git a/lib/response.js b/lib/response.js
index 671aa120..b94f473a 100644
--- a/lib/response.js
+++ b/lib/response.js
@@ -157,7 +157,7 @@ function findNote (req, res, callback, include) {
include: include || null
}).then(function (note) {
if (!note) {
- if (config.allowFreeURL && noteId) {
+ if (config.allowFreeURL && noteId && !config.forbiddenNoteIDs.includes(noteId)) {
req.alias = noteId
return newNote(req, res)
} else {