proxy print start command when needed
This commit is contained in:
parent
c572f2b096
commit
13420592dd
2 changed files with 5 additions and 2 deletions
|
|
@ -46,7 +46,7 @@ function proxy_post(req, res, next) {
|
||||||
res.end();
|
res.end();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log('drop proxy due to lack of host');
|
console.log('drop proxy due to lack of host', { chunks: chunks.map(c => c.toString()) });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -284,9 +284,12 @@ function exportGCodeDialog(gcode, sections, info, names) {
|
||||||
}
|
}
|
||||||
api.show.progress(0);
|
api.show.progress(0);
|
||||||
if (start && type === 'moonraker') {
|
if (start && type === 'moonraker') {
|
||||||
|
const headers = { 'Content-Type': 'application/json' };
|
||||||
|
if (proxy) hdr['X-Host'] = proxy;
|
||||||
|
if (apik) hdr['X-Api-Key'] = apik;
|
||||||
fetch(`${host}/printer/print/start`, {
|
fetch(`${host}/printer/print/start`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers,
|
||||||
body: JSON.stringify({ filename })
|
body: JSON.stringify({ filename })
|
||||||
})
|
})
|
||||||
.then(r => r.json())
|
.then(r => r.json())
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue