diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 3aa723ff..33176df6 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,4 @@ +v1.0.352: Fixed API integration for cam.openbuilds.com v1.0.352: Added support for nodeIntegration (Additional backend support for awesome JS Macros) v1.0.351: Updated defaults for Surfacing Wizard UI, Updated text on Recovery wizard v1.0.350: Updated all dependencies, Updated to Node 18, Removed Drivelist Dependency diff --git a/index.js b/index.js index 65f5a847..a61f7f18 100644 --- a/index.js +++ b/index.js @@ -60,6 +60,18 @@ var fluidncConfig = ""; app.use(express.static(path.join(__dirname, "app"))); //app.use(express.limit('200M')); +app.use(function setCommonHeaders(req, res, next) { + res.set("Access-Control-Allow-Private-Network", "true"); + next(); +}); + +app.all('/*', function(req, res, next) { + res.header("Access-Control-Allow-Origin", "*"); + res.header("Access-Control-Allow-Headers", "X-Requested-With"); + res.header("Access-Control-Allow-Private-Network", "true"); + next(); +}); + // Interface firmware flash app.post('/uploadCustomFirmware', (req, res) => { @@ -501,7 +513,6 @@ var PortCheckinterval = setInterval(function() { checkPowerSettings() - // JSON API app.get('/api/version', (req, res) => { res.header("Access-Control-Allow-Origin", "*"); @@ -593,8 +604,9 @@ app.post('/upload', function(req, res) { }); form.on('fileBegin', function(name, file) { - debug_log('Uploading ' + file.name); - file.path = uploadsDir + file.name; + debug_log(JSON.stringify(name)); + debug_log(JSON.stringify(file)); + debug_log('Uploading ' + file.filepath); }); form.on('progress', function(bytesReceived, bytesExpected) { @@ -607,9 +619,9 @@ app.post('/upload', function(req, res) { }); form.on('file', function(name, file) { - debug_log('Uploaded ' + file.path); + debug_log('Uploaded ' + file.filepath); showJogWindow() - readFile(file.path) + readFile(file.filepath) }); form.on('aborted', function() { diff --git a/package.json b/package.json index e36014a1..b6757217 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "OpenBuildsCONTROL", - "version": "1.0.352", + "version": "1.0.353", "license": "AGPL-3.0", "description": "OpenBuildsCONTROL CNC Machine Host Software", "author": "github.com/openbuilds ",