opennebula-4.12.0-vncoversameport.diff

Roy Keene, 03/30/2015 06:33 PM

Download (4.09 KB)

View differences:

opennebula-4.12.0-vncoversameport/src/sunstone/public/js/plugins/vms-tab.js 2015-03-17 02:49:12.579664536 -0400
3346 3346

  
3347 3347
function vncCallback(request,response){
3348 3348
    rfb = new RFB({'target':       $D('VNC_canvas'),
3349
                   'encrypt':      config['user_config']['vnc_wss'] == "yes",
3349
                   'encrypt':      window.location.protocol === 'https:',
3350 3350
                   'true_color':   true,
3351 3351
                   'local_cursor': true,
3352 3352
                   'shared':       true,
3353 3353
                   'onUpdateState':  updateVNCState});
3354 3354

  
3355 3355
    var proxy_host = window.location.hostname;
3356
    var proxy_port = config['system_config']['vnc_proxy_port'];
3356
    var proxy_port = window.location.port;
3357

  
3358
    // if port == 80 (or 443) then it won't be present and should be
3359
    // set manually
3360
    if (!proxy_port) {
3361
        if (window.location.protocol === 'http:') {
3362
            proxy_port = 80;
3363
        } else if (window.location.protocol === 'https:') {
3364
            proxy_port = 443;
3365
        }
3366
    }
3367

  
3357 3368
    var pw = response["password"];
3358 3369
    var token = response["token"];
3359 3370
    var vm_name = response["vm_name"];
3360 3371
    var path = '?token='+token;
3361 3372

  
3362 3373
    var url = "vnc?";
3363
    url += "host=" + proxy_host;
3364
    url += "&port=" + proxy_port;
3365
    url += "&token=" + token;
3374
    url += "token=" + token;
3366 3375
    url += "&password=" + pw;
3367
    url += "&encrypt=" + config['user_config']['vnc_wss'];
3368 3376
    url += "&title=" + vm_name;
3369 3377

  
3370 3378
    $("#open_in_a_new_window").attr('href', url)
......
3402 3410

  
3403 3411
    var host, port, password, scheme = "ws://", uri, token, vm_name;
3404 3412

  
3405
    if (config['user_config']['vnc_wss'] == "yes") {
3413
    if (window.location.protocol === 'https:') {
3406 3414
        scheme = "wss://";
3407 3415
    }
3408 3416

  
3409 3417
    host = window.location.hostname;
3410
    port = config['system_config']['vnc_proxy_port'];
3418
    port = window.location.port;
3419
    // if port == 80 (or 443) then it won't be present and should be
3420
    // set manually
3421
    if (!port) {
3422
        if (window.location.protocol === 'http:') {
3423
            port = 80;
3424
        } else if (window.location.protocol === 'https:') {
3425
            port = 443;
3426
        }
3427
    }
3428

  
3411 3429
    password = response["password"];
3412 3430
    token = response["token"];
3413 3431
    vm_name = response["vm_name"];
......
3433 3451
    }
3434 3452

  
3435 3453
    var url = "spice?";
3436
    url += "host=" + host;
3437
    url += "&port=" + port;
3438
    url += "&token=" + token;
3454
    url += "token=" + token;
3439 3455
    url += "&password=" + password;
3440
    url += "&encrypt=" + config['user_config']['vnc_wss'];
3441 3456
    url += "&title=" + vm_name;
3442 3457

  
3443 3458
    $("#open_in_a_new_window_spice").attr('href', url)
opennebula-4.12.0-vncoversameport/src/sunstone/views/vnc.erb 2015-03-17 02:44:05.891678029 -0400
169 169
            // if port == 80 (or 443) then it won't be present and should be
170 170
            // set manually
171 171
            if (!port) {
172
                if (window.location.protocol.substring(0,4) == 'http') {
172
                if (window.location.protocol === 'http:') {
173 173
                    port = 80;
174
                }
175
                else if (window.location.protocol.substring(0,5) == 'https') {
174
                } else if (window.location.protocol === 'https:') {
176 175
                    port = 443;
177 176
                }
178 177
            }
......
205 204
                           'onXvpInit':    xvpInit,
206 205
                           'onPasswordRequired':  passwordRequired});
207 206

  
208
            rfb.connect("<%= params['host']%>", "<%= params['port']%>", "<%= params['password']%>", path+"?token=<%= params['token']%>");
207
            rfb.connect(host, port, "<%= params['password']%>", path+"?token=<%= params['token']%>");
209 208
        };
210 209

  
211 210
        </script>