disable browser auto-open when webserver first starts, not the `open browser` console cmd
This commit is contained in:
parent
d03cfebbdf
commit
8acab6ef5b
|
@ -22,7 +22,6 @@ class WebServer {
|
||||||
|
|
||||||
this.host = this.webServerConfig.host;
|
this.host = this.webServerConfig.host;
|
||||||
this.port = parseInt(this.webServerConfig.port, 10);
|
this.port = parseInt(this.webServerConfig.port, 10);
|
||||||
this._openBrowser = this.webServerConfig.openBrowser;
|
|
||||||
|
|
||||||
this.events.emit("status", __("Starting Server"));
|
this.events.emit("status", __("Starting Server"));
|
||||||
|
|
||||||
|
@ -30,7 +29,8 @@ class WebServer {
|
||||||
buildDir: this.buildDir,
|
buildDir: this.buildDir,
|
||||||
events: this.events,
|
events: this.events,
|
||||||
host: this.host,
|
host: this.host,
|
||||||
port: this.port
|
port: this.port,
|
||||||
|
openBrowser: this.webServerConfig.openBrowser
|
||||||
});
|
});
|
||||||
|
|
||||||
this.events.on('webserver:config:change', () => {
|
this.events.on('webserver:config:change', () => {
|
||||||
|
@ -136,9 +136,6 @@ class WebServer {
|
||||||
}
|
}
|
||||||
|
|
||||||
openBrowser(cb) {
|
openBrowser(cb) {
|
||||||
if (!this._openBrowser) {
|
|
||||||
return cb();
|
|
||||||
}
|
|
||||||
const _cb = () => { cb(); };
|
const _cb = () => { cb(); };
|
||||||
return opn(
|
return opn(
|
||||||
`http://${canonicalHost(this.server.hostname)}:${this.server.port}`,
|
`http://${canonicalHost(this.server.hostname)}:${this.server.port}`,
|
||||||
|
|
|
@ -13,6 +13,7 @@ class Server {
|
||||||
this.hostname = dockerHostSwap(options.host) || defaultHost;
|
this.hostname = dockerHostSwap(options.host) || defaultHost;
|
||||||
this.isFirstStart = true;
|
this.isFirstStart = true;
|
||||||
this.opened = false;
|
this.opened = false;
|
||||||
|
this.openBrowser = options.openBrowser;
|
||||||
}
|
}
|
||||||
|
|
||||||
start(callback) {
|
start(callback) {
|
||||||
|
@ -45,7 +46,7 @@ class Server {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
function openBrowser(next) {
|
function openBrowser(next) {
|
||||||
if (self.opened) {
|
if (!self.openBrowser || self.opened) {
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
self.opened = true;
|
self.opened = true;
|
||||||
|
|
Loading…
Reference in New Issue