Unverified Commit 849f18fe authored by Pavitra Golchha's avatar Pavitra Golchha Committed by GitHub

Allow loading Tutorial URLs with https (#2353)

parent 4e4cc5f8
......@@ -2431,16 +2431,23 @@ public class Ode implements EntryPoint {
}
public void setTutorialURL(String newURL) {
if (newURL.isEmpty() || (!newURL.startsWith("http://appinventor.mit.edu/")
&& !newURL.startsWith("http://appinv.us/"))) {
boolean isUrlAllowed = !newURL.isEmpty()
&& (newURL.startsWith("http://appinventor.mit.edu/")
|| newURL.startsWith("https://appinventor.mit.edu/")
|| newURL.startsWith("http://appinv.us/"));
if (!isUrlAllowed) {
designToolbar.setTutorialToggleVisible(false);
setTutorialVisible(false);
} else {
String[] urlSplits = newURL.split("//"); // [protocol, rest]
boolean isHttps = Window.Location.getProtocol() == "https:" || urlSplits[0] == "https:";
String locale = Window.Location.getParameter("locale");
if (locale != null) {
newURL += (newURL.contains("?") ? "&" : "?") + "locale=" + locale;
}
tutorialPanel.setUrl(newURL);
String effectiveUrl = (isHttps ? "https://" : "http://") + urlSplits[1];
tutorialPanel.setUrl(effectiveUrl);
designToolbar.setTutorialToggleVisible(true);
setTutorialVisible(true);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment