allow for referer version testing for manifest request which does not receive cookies
This commit is contained in:
parent
cb9781c3cd
commit
083e874f26
2 changed files with 16 additions and 2 deletions
16
app.js
16
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}`);
|
||||
|
|
|
|||
|
|
@ -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/",
|
||||
|
|
|
|||
Loading…
Reference in a new issue