forked from pangeo-data/pangeo-custom-jupyterhub-templates
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Unconditionally redirect everyone to the common landing page"
This reverts commit 20ea792.
- Loading branch information
Showing
1 changed file
with
30 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,32 @@ | ||
function redirectIfNeeded() { | ||
// Only redirect utoronto.2i2c.cloud, lets us keep staging at staging.utoronto.2i2c.cloud | ||
if (window.location.hostname === 'utoronto.2i2c.cloud') { | ||
// Let's give users an indication that something is happening | ||
document.write("Redirecting you to jupyter.utoronto.ca"); | ||
window.location.hostname = 'jupyter.utoronto.ca'; | ||
} | ||
} | ||
function setInterface(interfaceUrl) { | ||
let loginUrl = new URL($('#home').data('authenticator-login-url'), document.location.origin); | ||
loginUrl.searchParams.set('next', '/hub/user-redirect/' + interfaceUrl) | ||
$('#login-button').attr( | ||
'href', | ||
loginUrl.toString() | ||
); | ||
} | ||
$(function() { | ||
// The 'unified' home page for all the hubs is at https://datatools.utoronto.ca, | ||
// so anyone landing on the home page should just be redirected. | ||
document.write("Redirecting you to datatools.utoronto.ca"); | ||
window.location.replace("https://datatools.utoronto.ca"); | ||
redirectIfNeeded(); | ||
// if next query param is presentm just do nothing | ||
const nextPresent = new URL(document.location).searchParams.get('next'); | ||
// /hub/ being next should be treated same as no next present | ||
if (!nextPresent || nextPresent === "/hub/") { | ||
setInterface($("input[name='interface']:checked").val()); | ||
|
||
$("input[name='interface']").change(function() { | ||
if (this.checked) { | ||
setInterface(this.value) | ||
} | ||
}); | ||
} | ||
|
||
}) |