fix octoprint

This commit is contained in:
Stewart Allen 2020-06-10 18:56:55 -04:00
commit c658ac48b9
2 changed files with 16 additions and 7 deletions

View file

@ -54,8 +54,12 @@
}
segment = line.message;
}
if (line.progress) API.show.progress(line.progress, "exporting");
if (line.data) lines.push(line.data);
if (line.progress) {
API.show.progress(line.progress, "exporting");
}
if (line.data) {
lines.push(line.data);
}
}, function(done) {
currentPrint.exported = true;
times[`${seq++}_${segment}`] = Date.now() - mark;
@ -161,7 +165,7 @@
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;
}
@ -180,10 +184,11 @@
} else {
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);
@ -362,11 +367,11 @@
} 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(Math.ceil(evt.loaded/evt.total), "sending");
});
filename = $('print-filename').value;
xhtr.open("POST",

View file

@ -172,7 +172,8 @@
LOCAL,
MODES,
VIEWS,
SETUP
SETUP,
SECURE
},
var: {
layer_lo: 0,
@ -250,6 +251,9 @@
clear: clearWorkspace,
save: saveWorkspace,
},
util: {
isSecure
},
view: {
get: function() { return viewMode },
set: setViewMode,