Skip to content

Commit a762928

Browse files
committed
Do final internal renameing
A little minor change, by moving the CodiMD version header in its own middleware. Should simplify to determine the version number of the Backend in future. Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
1 parent 23c33c0 commit a762928

4 files changed

Lines changed: 15 additions & 6 deletions

File tree

app.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ app.use(passport.session())
163163
app.use(require('./lib/web/middleware/checkURIValid'))
164164
// redirect url without trailing slashes
165165
app.use(require('./lib/web/middleware/redirectWithoutTrailingSlashes'))
166+
app.use(require('./lib/web/middleware/codiMDVersion'))
166167

167168
// routes need sessions
168169
// template files

lib/response.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ function showIndex (req, res, next) {
109109
}
110110
}
111111

112-
function responseHackMD (res, note) {
112+
function responseCodiMD (res, note) {
113113
var body = note.content
114114
var extracted = models.Note.extractMeta(body)
115115
var meta = models.Note.parseMeta(extracted.meta)
@@ -214,7 +214,7 @@ function showNote (req, res, next) {
214214
var noteId = req.params.noteId
215215
var id = models.Note.encodeNoteId(note.id)
216216
if ((note.alias && noteId !== note.alias) || (!note.alias && noteId !== id)) { return res.redirect(config.serverURL + '/' + (note.alias || id)) }
217-
return responseHackMD(res, note)
217+
return responseCodiMD(res, note)
218218
})
219219
}
220220

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
'use strict'
2+
3+
const config = require('../../config')
4+
5+
module.exports = function (req, res, next) {
6+
res.set({
7+
'CodiMD-Version': config.version
8+
})
9+
return next()
10+
}

lib/web/statusRouter.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ statusRouter.get('/status', function (req, res, next) {
1717
realtime.getStatus(function (data) {
1818
res.set({
1919
'Cache-Control': 'private', // only cache by client
20-
'X-Robots-Tag': 'noindex, nofollow', // prevent crawling
21-
'HackMD-Version': config.version
20+
'X-Robots-Tag': 'noindex, nofollow' // prevent crawling
2221
})
2322
res.send(data)
2423
})
@@ -102,8 +101,7 @@ statusRouter.get('/config', function (req, res) {
102101
}
103102
res.set({
104103
'Cache-Control': 'private', // only cache by client
105-
'X-Robots-Tag': 'noindex, nofollow', // prevent crawling
106-
'HackMD-Version': config.version
104+
'X-Robots-Tag': 'noindex, nofollow' // prevent crawling
107105
})
108106
res.render(config.constantsPath, data)
109107
})

0 commit comments

Comments
 (0)