From 76af58bf5f0a677037c5fac55502566f9518a103 Mon Sep 17 00:00:00 2001 From: Ilja Kartashov Date: Mon, 13 Nov 2023 11:58:24 +0100 Subject: [PATCH] Add .bgcode support --- src/helpers/upload_request.js | 5 ++++- tools/server/mock/fdm.js | 2 +- webpack.config.js | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/helpers/upload_request.js b/src/helpers/upload_request.js index 652667e9..b8d6d2ad 100644 --- a/src/helpers/upload_request.js +++ b/src/helpers/upload_request.js @@ -38,7 +38,10 @@ request.setRequestHeader("Print-After-Upload", "?1"); } request.setRequestHeader("Overwrite", "?1"); - request.setRequestHeader("Content-Type", "text/x.gcode"); + request.setRequestHeader( + "Content-Type", + url.endsWith(".bgcode") ? "application/gcode+binary" : "text/x.gcode" + ); for (const [key, value] of Object.entries(getHeaders())) { request.setRequestHeader(key, value); } diff --git a/tools/server/mock/fdm.js b/tools/server/mock/fdm.js index dab05320..b5b895b0 100644 --- a/tools/server/mock/fdm.js +++ b/tools/server/mock/fdm.js @@ -45,7 +45,7 @@ class PrinterFDM extends Printer { } projectExtensions() { - return [".gcode"] + return [".gcode", ".bgcode"] } uploadFile(options) { diff --git a/webpack.config.js b/webpack.config.js index e7f9a899..a8b76488 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -28,7 +28,7 @@ module.exports = (env, args) => { PRINTER_NAME: printerName, PRINTER_CODE: printerName.split(" ").slice(-1)[0].toLowerCase(), PRINTER_TYPE: env["PRINTER_TYPE"] || "fdm", // "fdm" | "sla" - FILE_EXTENSIONS: env["FILE_EXTENSIONS"] || [".gcode"], + FILE_EXTENSIONS: env["FILE_EXTENSIONS"] || [".gcode", ".bgcode"], APP_NAME: env["APP_NAME"] || "PrusaLink", APP_TITLE: env["APP_TITLE"] || env["PRINTER_NAME"] || DEFAULT_NAME,