🐛 Fix browser not opening when using --host parameter
This commit is contained in:
+1
-1
@@ -26,7 +26,7 @@ class Chat
|
|||||||
|
|
||||||
setSocket()
|
setSocket()
|
||||||
{
|
{
|
||||||
// Create a channel for this specific chjat
|
// Create a channel for this specific chat
|
||||||
this.chatSocket = this.config.socket.of('/project/' + this.slug + '/chat')
|
this.chatSocket = this.config.socket.of('/project/' + this.slug + '/chat')
|
||||||
|
|
||||||
// Connection event
|
// Connection event
|
||||||
|
|||||||
+44
-18
@@ -28,21 +28,16 @@ class App
|
|||||||
this.setConfig()
|
this.setConfig()
|
||||||
|
|
||||||
// If host is not specified
|
// If host is not specified
|
||||||
// Start the site
|
// Start the server
|
||||||
if(!this.config.host)
|
if(!this.config.host)
|
||||||
{
|
{
|
||||||
this.setSite(
|
this.setServer()
|
||||||
() =>
|
|
||||||
{
|
|
||||||
this.setSocket()
|
|
||||||
this.setProjects()
|
|
||||||
},
|
|
||||||
() =>
|
|
||||||
{
|
|
||||||
console.log('error'.red)
|
|
||||||
console.log('app'.green.bold + ' - ' + 'keppler seems to be running already'.cyan)
|
|
||||||
}
|
}
|
||||||
)
|
|
||||||
|
// If host is specified, show URL open in browser
|
||||||
|
if(this.config.host)
|
||||||
|
{
|
||||||
|
this.showUrlAndOpen()
|
||||||
}
|
}
|
||||||
|
|
||||||
// If not started as a server
|
// If not started as a server
|
||||||
@@ -175,6 +170,26 @@ class App
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set server
|
||||||
|
* Insitantiate the site and when the site is ready, instantiate the socket connexion and projects
|
||||||
|
*/
|
||||||
|
setServer()
|
||||||
|
{
|
||||||
|
this.setSite(
|
||||||
|
() =>
|
||||||
|
{
|
||||||
|
this.setSocket()
|
||||||
|
this.setProjects()
|
||||||
|
},
|
||||||
|
() =>
|
||||||
|
{
|
||||||
|
console.log('error'.red)
|
||||||
|
console.log('app'.green.bold + ' - ' + 'keppler seems to be running already'.cyan)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set site
|
* Set site
|
||||||
* Instantiate site
|
* Instantiate site
|
||||||
@@ -224,13 +239,10 @@ class App
|
|||||||
console.log(util.inspect(project.files.describe(), { depth: null, colors: true }))
|
console.log(util.inspect(project.files.describe(), { depth: null, colors: true }))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open in browser
|
// If not server, show URL open in browser
|
||||||
const url = this.config.domain
|
if(!this.config.server)
|
||||||
console.log('app'.green.bold + ' - ' + url.yellow)
|
|
||||||
|
|
||||||
if(this.config.open)
|
|
||||||
{
|
{
|
||||||
opener(url)
|
this.showUrlAndOpen()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -315,6 +327,20 @@ class App
|
|||||||
{
|
{
|
||||||
this.watcher = new Watcher(this.config)
|
this.watcher = new Watcher(this.config)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show URL and open it if should
|
||||||
|
*/
|
||||||
|
showUrlAndOpen()
|
||||||
|
{
|
||||||
|
const url = this.config.domain
|
||||||
|
console.log('app'.green.bold + ' - ' + url.yellow)
|
||||||
|
|
||||||
|
if(this.config.open)
|
||||||
|
{
|
||||||
|
opener(url)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = App
|
module.exports = App
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ Arguments list
|
|||||||
|parameter|`--server`|
|
|parameter|`--server`|
|
||||||
|shortcut|`-s`|
|
|shortcut|`-s`|
|
||||||
|default value|*(bool)*`false`|
|
|default value|*(bool)*`false`|
|
||||||
|description|Start keppler has a server<br>(if you want to run an online instance)|
|
|description|Start keppler server only<br>(if you want to run an online instance)|
|
||||||
|
|
||||||
|||
|
|||
|
||||||
|---|---|
|
|---|---|
|
||||||
|
|||||||
Reference in New Issue
Block a user