fix octoprint

This commit is contained in:
Stewart Allen 2020-06-10 20:48:34 -04:00
commit 0cc1490ba2
2 changed files with 11 additions and 6 deletions

View file

@ -164,7 +164,7 @@ let gs_kiri_export = exports;
API.show.alert("host missing protocol (http:// or https://)");
return;
}
if (SECURE && !isSecure(host)) {
if (API.const.SECURE && !API.util.isSecure(host)) {
API.show.alert("host must begin with 'https' on a secure site");
return;
}
@ -184,9 +184,10 @@ let gs_kiri_export = exports;
API.show.alert("octoprint error\nstatus: "+status+"\nmessage: "+ajax.responseText);
}
}
API.show.progress(0);
};
ajax.upload.addEventListener('progress', function(evt) {
setProgress(Math.ceil(evt.loaded/evt.total), "sending");
API.show.progress(evt.loaded/evt.total, "sending");
});
ajax.open("POST", host+"/api/files/local");
ajax.setRequestHeader("X-Api-Key", apik);
@ -334,7 +335,7 @@ let gs_kiri_export = exports;
API.show.alert("host:port malformed");
return;
}
if (SECURE && !isSecure(host)) {
if (API.const.SECURE && !API.util.isSecure(host)) {
API.show.alert("host must begin with 'https' on a secure site");
return;
}
@ -357,11 +358,11 @@ let gs_kiri_export = exports;
} else {
API.show.alert("grid:host error\nstatus: "+status+"\nmessage: "+xhtr.responseText, 10000);
}
setProgress(0);
API.show.progress(0);
}
};
xhtr.upload.addEventListener('progress', function(evt) {
setProgress(Math.ceil(evt.loaded/evt.total), "sending");
API.show.progress(evt.loaded/evt.total, "sending");
});
filename = $('print-filename').value;
xhtr.open("POST",

View file

@ -176,7 +176,8 @@ self.kiri.copyright = exports.COPYRIGHT;
LOCAL,
MODES,
VIEWS,
SETUP
SETUP,
SECURE
},
var: {
layer_at: Infinity,
@ -255,6 +256,9 @@ self.kiri.copyright = exports.COPYRIGHT;
clear: clearWorkspace,
save: saveWorkspace,
},
util: {
isSecure
},
view: {
get: function() { return viewMode },
set: setViewMode,