diff --git a/config/plugins/interactive_environments/rstudio/config/allowed_images.yml.sample b/config/plugins/interactive_environments/rstudio/config/allowed_images.yml.sample index bcbcb82d27c..0c97c0cf26e 100644 --- a/config/plugins/interactive_environments/rstudio/config/allowed_images.yml.sample +++ b/config/plugins/interactive_environments/rstudio/config/allowed_images.yml.sample @@ -6,7 +6,7 @@ # appropriate `apt-get/pip install` statements. --- - - image: erasche/docker-rstudio-notebook:15.10 + image: erasche/docker-rstudio-notebook:16.10 description: | If you've ever done R analysis, you probably used RStudio. This familiar R analysis software suite will let you explore your datasets diff --git a/config/plugins/interactive_environments/rstudio/static/js/rstudio.js b/config/plugins/interactive_environments/rstudio/static/js/rstudio.js index ccff80ff943..cc0b62ee7a1 100644 --- a/config/plugins/interactive_environments/rstudio/static/js/rstudio.js +++ b/config/plugins/interactive_environments/rstudio/static/js/rstudio.js @@ -1,15 +1,7 @@ -function message_failed_auth(password){ - toastr.info( - "Automatic authorization failed. You can manually login with:
" + password + "
More details ...", - "Please login manually", - {'closeButton': true, 'timeOut': 100000, 'tapToDismiss': false} - ); -} - function message_failed_connection(){ toastr.error( - "Could not connect to IPython Notebook. Please contact your administrator. More details ...", - "Security warning", + "Could not connect to RStudio. Please contact your administrator.", + "Security warning", {'closeButton': true, 'timeOut': 20000, 'tapToDismiss': true} ); } @@ -45,62 +37,36 @@ function load_notebook(notebook_login_url, notebook_access_url, notebook_pubkey_ var enc_hex = rsa.encrypt(payload); var encrypted = hex2b64(enc_hex); console.log("E: " + encrypted); - _handle_notebook_loading(encrypted, notebook_login_url, notebook_access_url); + + // Now we can login + $.ajax({ + type: "POST", + // to the Login URL + url: notebook_login_url, + // With our password + data: { + 'v': encrypted, + 'persist': 1, + 'clientPath': '/rstudio/auth-sign-in', + 'appUri': '', + }, + contentType: "application/x-www-form-urlencoded", + xhrFields: { + withCredentials: true + }, + // If that is successful, load the notebook + success: function(){ + append_notebook(notebook_access_url); + }, + error: function(jqxhr, status, error){ + message_failed_connection(); + // Do we want to try and load the notebook anyway? Just in case? + append_notebook(notebook_access_url); + } + }); } }); }); }); } - -/** - * Must be implemented by IEs - */ -function _handle_notebook_loading(password, notebook_login_url, notebook_access_url){ - if ( ie_password_auth ) { - $.ajax({ - type: "POST", - // to the Login URL - url: notebook_login_url, - // With our password - data: { - 'v': password, - 'persist': 1, - 'clientPath': '/rstudio/auth-sign-in', - 'appUri': '', - }, - contentType: "application/x-www-form-urlencoded", - xhrFields: { - withCredentials: true - }, - // If that is successful, load the notebook - success: function(){ - append_notebook(notebook_access_url); - }, - error: function(jqxhr, status, error){ - if(ie_password_auth){ - // Failure now happens because the redirect that RStudio gives us includes the - // port internal to nginx. (E.g. localhost:NNNN/rstudio/NNNN/) - // so disabling the message here makes sense as long as it's working correctly - // - // Additionally: - // XMLHttpRequest cannot load http://localhost:46725/rstudio/46725/. The - // 'Access-Control-Allow-Origin' header has a value 'http://localhost:8081' that - // is not equal to the supplied origin. Origin 'null' is therefore not allowed - // access. - // message_failed_auth(ie_password); - append_notebook(notebook_access_url); - }else{ - message_failed_connection(); - // Do we want to try and load the notebook anyway? Just in case? - append_notebook(notebook_access_url); - } - } - }); - } - else { - // Not using password auth, just embed it to avoid content-origin issues. - message_no_auth(); - append_notebook(notebook_access_url); - } -} diff --git a/config/plugins/interactive_environments/rstudio/templates/rstudio.mako b/config/plugins/interactive_environments/rstudio/templates/rstudio.mako index 26156de3a2c..46b9b2b9e3c 100644 --- a/config/plugins/interactive_environments/rstudio/templates/rstudio.mako +++ b/config/plugins/interactive_environments/rstudio/templates/rstudio.mako @@ -9,8 +9,10 @@ ie_request.load_deploy_config() ie_request.attr.docker_port = 80 # Create tempdir in galaxy temp_dir = ie_request.temp_dir -PASSWORD = ie_request.notebook_pw -USERNAME = "galaxy" +PASSWORD = "rstudio" +USERNAME = "rstudio" +# Then override it again +ie_request.notebook_pw = "rstudio" # Did the user give us an RData file? if hda.datatype.__class__.__name__ == "RData": @@ -31,7 +33,7 @@ ie_request.launch( # through proxy. notebook_pubkey_url = ie_request.url_template('${PROXY_URL}/rstudio/auth-public-key') notebook_access_url = ie_request.url_template('${PROXY_URL}/rstudio/') -notebook_login_url = ie_request.url_template('${PROXY_URL}/rstudio/auth-do-sign-in') +notebook_login_url = ie_request.url_template('${PROXY_URL}/rstudio/auth-sign-in') %>