mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-25 11:16:31 -05:00
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>
This commit is contained in:
parent
23c33c0c04
commit
a762928e97
4 changed files with 15 additions and 6 deletions
1
app.js
1
app.js
|
@ -163,6 +163,7 @@ app.use(passport.session())
|
|||
app.use(require('./lib/web/middleware/checkURIValid'))
|
||||
// redirect url without trailing slashes
|
||||
app.use(require('./lib/web/middleware/redirectWithoutTrailingSlashes'))
|
||||
app.use(require('./lib/web/middleware/codiMDVersion'))
|
||||
|
||||
// routes need sessions
|
||||
// template files
|
||||
|
|
|
@ -109,7 +109,7 @@ function showIndex (req, res, next) {
|
|||
}
|
||||
}
|
||||
|
||||
function responseHackMD (res, note) {
|
||||
function responseCodiMD (res, note) {
|
||||
var body = note.content
|
||||
var extracted = models.Note.extractMeta(body)
|
||||
var meta = models.Note.parseMeta(extracted.meta)
|
||||
|
@ -214,7 +214,7 @@ function showNote (req, res, next) {
|
|||
var noteId = req.params.noteId
|
||||
var id = models.Note.encodeNoteId(note.id)
|
||||
if ((note.alias && noteId !== note.alias) || (!note.alias && noteId !== id)) { return res.redirect(config.serverURL + '/' + (note.alias || id)) }
|
||||
return responseHackMD(res, note)
|
||||
return responseCodiMD(res, note)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
10
lib/web/middleware/codiMDVersion.js
Normal file
10
lib/web/middleware/codiMDVersion.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
'use strict'
|
||||
|
||||
const config = require('../../config')
|
||||
|
||||
module.exports = function (req, res, next) {
|
||||
res.set({
|
||||
'CodiMD-Version': config.version
|
||||
})
|
||||
return next()
|
||||
}
|
|
@ -17,8 +17,7 @@ statusRouter.get('/status', function (req, res, next) {
|
|||
realtime.getStatus(function (data) {
|
||||
res.set({
|
||||
'Cache-Control': 'private', // only cache by client
|
||||
'X-Robots-Tag': 'noindex, nofollow', // prevent crawling
|
||||
'HackMD-Version': config.version
|
||||
'X-Robots-Tag': 'noindex, nofollow' // prevent crawling
|
||||
})
|
||||
res.send(data)
|
||||
})
|
||||
|
@ -102,8 +101,7 @@ statusRouter.get('/config', function (req, res) {
|
|||
}
|
||||
res.set({
|
||||
'Cache-Control': 'private', // only cache by client
|
||||
'X-Robots-Tag': 'noindex, nofollow', // prevent crawling
|
||||
'HackMD-Version': config.version
|
||||
'X-Robots-Tag': 'noindex, nofollow' // prevent crawling
|
||||
})
|
||||
res.render(config.constantsPath, data)
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue