diff --git a/js/kiri.js b/js/kiri.js index 95ff65e6..dc7e3dd8 100644 --- a/js/kiri.js +++ b/js/kiri.js @@ -1971,11 +1971,15 @@ self.kiri.license = exports.LICENSE; for (var i=0; i 0, isstl = lower.indexOf(".stl") > 0, issvg = lower.indexOf(".svg") > 0, isgcode = lower.indexOf(".gcode") > 0 || lower.indexOf(".nc") > 0; reader.file = files[i]; reader.onloadend = function (e) { + if (israw) platformAdd( + newWidget().loadVertices(JSON.parse(e.target.result).toFloat32()) + ); if (isstl) platformAdd( newWidget() .loadVertices(new MOTO.STL().parse(e.target.result)) diff --git a/js/moto-db.js b/js/moto-db.js index 95feaa71..e5e2acfd 100644 --- a/js/moto-db.js +++ b/js/moto-db.js @@ -97,7 +97,9 @@ var gs_moto_db = exports; } storage.db = request.result; storage.store = storage.db.createObjectStore(name); - setTimeout(function() { storage.runQueue() }); + event.target.transaction.oncomplete = function(event) { + storage.runQueue(); + }; }; request.onsuccess = function(event) { diff --git a/js/web-server.js b/js/web-server.js index d56cdcd0..9f51d0c2 100644 --- a/js/web-server.js +++ b/js/web-server.js @@ -1018,7 +1018,7 @@ function initModule(file, dir) { pre: arg => { modPaths.push(prepath(arg)) }, map: arg => { modPaths.push(fixedmap(arg)) }, full: arg => { modPaths.push(fullpath(arg)) }, - static: arg => { modPaths.push(serveStatic(arg)) }, + static: (root, pre) => { modPaths.push(handleStatic(root, pre)) }, code: (endpoint, path) => { if (debug) { code[endpoint] = fs.readFileSync(path); @@ -1031,7 +1031,7 @@ function initModule(file, dir) { }, handler: { addCORS: addCorsHeaders, - static: serveStatic, + static: handleStatic, redirect: redirect, reply404: reply404, reply: quickReply @@ -1039,10 +1039,28 @@ function initModule(file, dir) { }) } +function handleStatic(root, pre) { + let statServe = serveStatic(root); + return function(req, res, next) { + if (pre) { + if (req.url.indexOf(pre) === 0) { + if (req.url === pre) { + req.url = "/"; + } else { + req.url = req.url.substring(pre.length); + } + return statServe(req, res, next); + } + return next(); + } + statServe(req, res, next); + }; +} + // add static assets to be served -function addStatic(dir) { +function addStatic(dir, pre) { helper.log({static:dir}); - modPaths.push(serveStatic(dir)); + modPaths.push(handleStatic(dir, pre)); } // either add module assets to path or require(init.js) @@ -1101,7 +1119,7 @@ handler.use(fullpath({ .use(fixedmap("/api/", api)) .use(rewriteHTML) .use(compression) - .use(serveStatic(currentDir + "/web/")) + .use(handleStatic(currentDir + "/web/")) .listen(port); helper.log("------------------------------------------"); diff --git a/web/kiri/filter/FDM/GridBot.Two b/web/kiri/filter/FDM/GridBot.Two new file mode 120000 index 00000000..b188c4a2 --- /dev/null +++ b/web/kiri/filter/FDM/GridBot.Two @@ -0,0 +1 @@ +GridBot.One \ No newline at end of file diff --git a/web/kiri/index.html b/web/kiri/index.html index 01d71089..1270066e 100644 --- a/web/kiri/index.html +++ b/web/kiri/index.html @@ -8,7 +8,7 @@ - +