This commit is contained in:
parent
9479be52a2
commit
a38a26e847
2 changed files with 23 additions and 4 deletions
|
|
@ -1,9 +1,14 @@
|
|||
# Changelog
|
||||
|
||||
## 0.48.6
|
||||
|
||||
- main
|
||||
- detect http server silent setup failure
|
||||
|
||||
## 0.48.5
|
||||
|
||||
- bug fixes
|
||||
- regression breaking support for utf-8 strings in received osc messages
|
||||
- regression breaking support for utf-8 strings in received osc messages
|
||||
|
||||
## 0.48.4
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@ var urlparser = require('url'),
|
|||
zeroconf = require('./zeroconf'),
|
||||
appAddresses = settings.read('appAddresses'),
|
||||
osc = {},
|
||||
clients = {}
|
||||
clients = {},
|
||||
httpCheckTimeout
|
||||
|
||||
function httpRoute(req, res) {
|
||||
|
||||
|
|
@ -59,6 +60,8 @@ function httpRoute(req, res) {
|
|||
// absolute resolution (session path)
|
||||
res.sendFile(path.resolve(url))
|
||||
}
|
||||
} else if (url.includes('/osc-ping')) {
|
||||
httpCheck(true)
|
||||
} else {
|
||||
res.writeHead(403)
|
||||
res.end()
|
||||
|
|
@ -71,6 +74,19 @@ function httpRoute(req, res) {
|
|||
|
||||
server.listen(settings.read('httpPort'))
|
||||
|
||||
http.get(settings.read('appAddresses')[0] + '/osc-ping', ()=>{}).on('error', ()=>{httpCheck(false)})
|
||||
httpCheckTimeout = setTimeout(()=>{httpCheck(false)}, 5000)
|
||||
function httpCheck(ok){
|
||||
if (!httpCheckTimeout) return
|
||||
clearTimeout(httpCheckTimeout)
|
||||
httpCheckTimeout = null
|
||||
if (ok) {
|
||||
console.log('App available at ' + appAddresses.join(' & '))
|
||||
} else {
|
||||
console.error('Error: could not setup http server, maybe try a different port ?')
|
||||
}
|
||||
}
|
||||
|
||||
zeroconf.publish({
|
||||
name: settings.read('appName') + (settings.read('instanceName') ? ' (' + settings.read('instanceName') + ')' : ''),
|
||||
type: 'http',
|
||||
|
|
@ -104,8 +120,6 @@ var bindCallbacks = function(callbacks) {
|
|||
|
||||
}
|
||||
|
||||
console.log('App available at ' + appAddresses.join(' & '))
|
||||
|
||||
module.exports = {
|
||||
ipc:ipc,
|
||||
bindCallbacks:bindCallbacks,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue