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

View file

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