Skip to content

Commit

Permalink
Console: HTTPS support.
Browse files Browse the repository at this point in the history
  • Loading branch information
julien-f committed Feb 4, 2015
1 parent cd1fc73 commit 929fce6
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions app/modules/console/index.coffee
Expand Up @@ -134,10 +134,15 @@ module.exports = angular.module 'xoWebApp.console', [
# If the URL is empty, nothing to do.
return unless url

# Parse the URL.
url = parseUrl url

isSecure = url.protocol is 'https:' or url.protocol is 'wss:'

# Creates the new RFB object.
rfb = new $window.RFB {
# Options.
encrypt: false
encrypt: isSecure
# local_cursor: true
target: $element[0]
wsProtocols: ['chat']
Expand All @@ -150,9 +155,6 @@ module.exports = angular.module 'xoWebApp.console', [
onUpdateState: (args...) -> console.log args
}

# Parse the URL.
url = parseUrl url

path = url.path
# Leading '/' is added by noVNC.
if path[0] is '/'
Expand All @@ -161,7 +163,7 @@ module.exports = angular.module 'xoWebApp.console', [
# Connects.
rfb.connect(
url.hostname
url.port || (if url.protocol is 'https:' then 443 else 80)
url.port || (if isSecure then 443 else 80)
'' # TODO: comment.
path
)
Expand Down

0 comments on commit 929fce6

Please sign in to comment.