add remote workspace load (cors req'd)
This commit is contained in:
parent
d4f2ac21bd
commit
70f9146a96
2 changed files with 15 additions and 0 deletions
|
|
@ -2507,6 +2507,11 @@
|
|||
console.log({octoprint:ohost});
|
||||
}
|
||||
|
||||
// load workspace from url
|
||||
if (SETUP.wrk) {
|
||||
api.settings.import_url(`${proto}//${SETUP.wrk[0]}`, true);
|
||||
}
|
||||
|
||||
// bind this to UI so main can call it on settings import
|
||||
ui.sync = function() {
|
||||
const current = settings();
|
||||
|
|
|
|||
|
|
@ -575,6 +575,15 @@ function settingsImport(data, ask) {
|
|||
}
|
||||
}
|
||||
|
||||
function settingsImportUrl(url, ask) {
|
||||
fetch(url).then(r => r.arrayBuffer()).then(a => {
|
||||
settingsImport(a, ask);
|
||||
}).catch(error => {
|
||||
console.log({workspace_url: url, error: error.message || error});
|
||||
api.show.alert('workspace load failed');
|
||||
});
|
||||
}
|
||||
|
||||
function settingsImportZip(data, ask) {
|
||||
let alert = api.show.alert("Importing Workspace");
|
||||
JSZip.loadAsync(data).then(zip => {
|
||||
|
|
@ -679,6 +688,7 @@ api.settings = {
|
|||
get: getSettings,
|
||||
import: settingsImport,
|
||||
import_zip: settingsImportZip,
|
||||
import_url: settingsImportUrl,
|
||||
import_prusa: settingsPrusaConvert,
|
||||
dev() { return settings.device },
|
||||
proc() { return settings.process },
|
||||
|
|
|
|||
Loading…
Reference in a new issue