Do not crash when the console URL cannot be found.
This commit is contained in:
parent
22ed022787
commit
5801b29ede
21
src/index.js
21
src/index.js
@ -304,6 +304,10 @@ const getVmConsoleUrl = (xo, id) => {
|
||||
}
|
||||
})
|
||||
|
||||
if (!url) {
|
||||
throw new Error('VM console not found')
|
||||
}
|
||||
|
||||
return url
|
||||
}
|
||||
|
||||
@ -320,17 +324,16 @@ const setUpConsoleProxy = (webServer, xo) => {
|
||||
return
|
||||
}
|
||||
|
||||
const url = getVmConsoleUrl(xo, matches[1])
|
||||
if (!url) {
|
||||
return
|
||||
}
|
||||
try {
|
||||
const url = getVmConsoleUrl(xo, matches[1])
|
||||
|
||||
// FIXME: lost connection due to VM restart is not detected.
|
||||
webSocketServer.handleUpgrade(req, socket, head, connection => {
|
||||
wsProxy(connection, url, {
|
||||
rejectUnauthorized: false
|
||||
// FIXME: lost connection due to VM restart is not detected.
|
||||
webSocketServer.handleUpgrade(req, socket, head, connection => {
|
||||
wsProxy(connection, url, {
|
||||
rejectUnauthorized: false
|
||||
})
|
||||
})
|
||||
})
|
||||
} catch (_) {}
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user