diff --git a/app.js b/app.js index b903136a..7c151c95 100644 --- a/app.js +++ b/app.js @@ -81,7 +81,7 @@ function init(mod) { } mod.on.test((req) => { - let cookie = cookieValue(req.headers.cookie, "version") || undefined; + let cookie = cookieValue(req.headers.cookie, "version") || ''; let vmatch = mod.meta.version || "*"; if (!Array.isArray(vmatch)) { vmatch = [ vmatch ]; @@ -92,6 +92,17 @@ function init(mod) { return vmatch.indexOf(cookie) >= 0; }); + mod.on.testv((version) => { + let vmatch = mod.meta.version || "*"; + if (!Array.isArray(vmatch)) { + vmatch = [ vmatch ]; + } + if (vmatch.indexOf("*") >= 0) { + return true; + } + return vmatch.indexOf(version) >= 0; + }); + mod.add(handleSetup); mod.add(handleOptions); mod.add(serveWasm); @@ -174,6 +185,9 @@ function loadModule(mod, dir) { if (lastmod(`${mod.dir}/${dir}/.ignore`)) { return; } + // either load the module, or if it's not a module + // directory, serve the module as static content + // bound to the root lastmod(`${mod.dir}/${dir}/init.js`) ? initModule(mod, `./${dir}/init.js`, dir) : mod.static("/", `${mod.dir}/${dir}`); diff --git a/web/kiri/manifest.json b/web/kiri/manifest.json index 661bb6d5..92a74d65 100644 --- a/web/kiri/manifest.json +++ b/web/kiri/manifest.json @@ -1,5 +1,5 @@ { - "name": "Kiri:Moto 4.2.0", + "name": "Kiri:Moto 4.3.0", "short_name": "Kiri:Moto", "description": "Slicer for 3D printers, CNC mills, laser cutters and more", "start_url": "/kiri/",