Commit ad5c62c2 authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼 Committed by Rafael Monnerat

[slapos_jio] authorize to load https JSON in http page

/reviewed-on nexedi/slapos.core!114
parent 727782f1
...@@ -7,10 +7,8 @@ ...@@ -7,10 +7,8 @@
function getJSON(url) { function getJSON(url) {
var protocol = URI(url).protocol(); var protocol = URI(url).protocol();
if (protocol === "http" || protocol === "https") { if (protocol === "http" && URI(window.location).protocol() == "https") {
if (URI(window.location).protocol() !== protocol) { throw new Error("You cannot load http JSON in https page");
throw new Error("You cannot mixed http and https calls");
}
} }
return RSVP.Queue() return RSVP.Queue()
.push(function () { .push(function () {
......
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>971.50940.46169.22476</string> </value> <value> <string>975.40310.53592.2542</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1542815972.88</float> <float>1558534002.71</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -877,6 +877,7 @@ ...@@ -877,6 +877,7 @@
.fail(function (error) { .fail(function (error) {
var parameter_xml = ''; var parameter_xml = '';
console.warn(error);
console.log(error.stack); console.log(error.stack);
if (gadget.options.value.parameter.parameter_hash !== undefined) { if (gadget.options.value.parameter.parameter_hash !== undefined) {
parameter_xml = atob(gadget.options.value.parameter.parameter_hash); parameter_xml = atob(gadget.options.value.parameter.parameter_hash);
......
...@@ -274,7 +274,7 @@ ...@@ -274,7 +274,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>971.50926.27080.61815</string> </value> <value> <string>975.40310.53592.2542</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -292,7 +292,7 @@ ...@@ -292,7 +292,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1542815548.03</float> <float>1558534050.09</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
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