+3
-9
plugins/decent-ui.js
+3
-9
plugins/decent-ui.js
···
3
3
var path = require('path')
4
4
5
5
var DEFAULT_PORT = 8888
6
-
var DEFAULT_HOST = '127.0.0.1'
6
+
var DEFAULT_HOST = 'localhost'
7
7
var MIME_MAP = {
8
8
'.html': 'text/html; charset=utf-8',
9
9
'.css': 'text/css; charset=utf-8',
···
37
37
var decentDir = path.join(__dirname, '..', 'decent', 'build')
38
38
var cfg = config && config.decent ? config.decent : {}
39
39
var port = typeof cfg.port === 'number' ? cfg.port : DEFAULT_PORT
40
-
var hasHost = cfg && Object.prototype.hasOwnProperty.call(cfg, 'host')
41
-
var host = hasHost && typeof cfg.host === 'string' ? cfg.host : null
40
+
var host = DEFAULT_HOST
42
41
var wsCfg = config && config.ws ? config.ws : {}
43
-
if (!host && typeof wsCfg.host === 'string')
44
-
host = wsCfg.host
45
-
if (!host)
46
-
host = DEFAULT_HOST
47
42
var wsPort = typeof wsCfg.port === 'number' ? wsCfg.port : 8989
48
43
49
44
function respondNotFound (res) {
···
174
169
175
170
server.listen(port, host, function () {
176
171
var addr = server.address()
177
-
var address = addr && addr.address ? addr.address : host
178
172
var listeningPort = addr && addr.port ? addr.port : port
179
-
startUrl = 'http://' + address + ':' + listeningPort + '/'
173
+
startUrl = 'http://' + host + ':' + listeningPort + '/'
180
174
console.log('Decent launched at ' + startUrl)
181
175
})
182
176