0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-04-01 02:42:23 -05:00

display favicon properly

This commit is contained in:
Alex Kocharin 2014-11-12 19:18:30 +03:00
parent 148795918f
commit 100430227c
3 changed files with 22 additions and 7 deletions

View file

@ -37,6 +37,11 @@ module.exports = function(config, auth, storage) {
})
})
app.get('/favicon.ico', function(req, res, next) {
req.url = '/-/static/favicon.png'
next()
})
// Static
app.get('/-/static/:filename', function(req, res, next) {
var file = __dirname + '/static/' + req.params.filename

View file

@ -103,6 +103,14 @@ module.exports = function(config_hash) {
app.param('org_couchdb_user', match(/^org\.couchdb\.user:/))
app.param('anything', match(/.*/))
if (config.web && config.web.enable) {
app.use(require('./index-web')(config, auth, storage))
} else {
app.get('/', function(req, res) {
res.send('Web interface is disabled in the config file')
})
}
/* app.get('/-/all', function(req, res) {
var https = require('https')
var JSONStream = require('JSONStream')
@ -407,13 +415,6 @@ module.exports = function(config_hash) {
res.report_error(err)
})
if (config.web && config.web.enable) {
app.use(require('./index-web')(config, auth, storage))
} else {
app.get('/', function(req, res) {
res.send('Web interface is disabled in the config file')
})
}
return app
}

View file

@ -61,8 +61,13 @@ module.exports.log_and_etagify = function(req, res, next) {
var _auth = req.headers.authorization
if (_auth) req.headers.authorization = '<Classified>'
var _url = req.url
req.url = req.originalUrl
req.log.info( { req: req, ip: req.ip }
, '@{ip} requested \'@{req.method} @{req.url}\'' )
req.originalUrl = req.url
if (_auth) req.headers.authorization = _auth
var bytesin = 0
@ -122,6 +127,9 @@ module.exports.log_and_etagify = function(req, res, next) {
} else {
message += ', bytes: @{bytes.in}/@{bytes.out}'
}
var _url = req.url
req.url = req.originalUrl
req.log.warn({
request : { method: req.method, url: req.url },
level : 35, // http
@ -133,6 +141,7 @@ module.exports.log_and_etagify = function(req, res, next) {
out : bytesout,
}
}, message)
req.originalUrl = req.url
}
req.on('close', function() {