Merge branch 'master' of github.com:GridSpace/grid-apps

This commit is contained in:
Stewart Allen 2020-02-15 11:30:11 -05:00
commit ec207d896a
5 changed files with 32 additions and 7 deletions

View file

@ -1971,11 +1971,15 @@ self.kiri.license = exports.LICENSE;
for (var i=0; i<files.length; i++) {
var reader = new FileReader(),
lower = files[i].name.toLowerCase(),
israw = lower.indexOf(".raw") > 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))

View file

@ -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) {

View file

@ -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("------------------------------------------");

View file

@ -0,0 +1 @@
GridBot.One

View file

@ -8,7 +8,7 @@
<meta name="author" content="Stewart Allen">
<meta name="robots" content="noindex, nofollow">
<meta property="og:description" content="Kiri:Moto is a unique multi-modal 3D slicer that runs entirely in browser and creates output for your favorite maker tools: 3D Printers, CNC Mills and Laser Cutters. Advanted layer view helps debug prints ahead of time.">
<meta property="og:title" content="Cloud-based Slicer for Makers">
<meta property="og:title" content="Browser-based Slicer for Makers">
<meta property="og:type" content="website">
<meta property="og:url" content="https://grid.space/kiri">
<meta property="og:image" content="https://grid.space/img/logo_km_og.png">