normalize cookie handling
This commit is contained in:
parent
16460c54d2
commit
57760fcd9c
1 changed files with 6 additions and 3 deletions
9
app.js
9
app.js
|
|
@ -46,10 +46,13 @@ function init(mod) {
|
|||
|
||||
mod.on.reload(() => level.close());
|
||||
mod.on.test((req) => {
|
||||
if (mod.meta.version && mod.meta.version !== "*") {
|
||||
return (cookieValue(req.headers.cookie, "version") === mod.meta.version);
|
||||
let vmatch = mod.meta.version || undefined;
|
||||
let strict = (vmatch && mod.vmatch !== "*") ? true : false;
|
||||
let cookie = cookieValue(req.headers.cookie, "version") || undefined;
|
||||
if (strict) {
|
||||
return cookie === mod.meta.version;
|
||||
} else {
|
||||
return true;
|
||||
return (!vmatch && !cookie) || (vmatch && cookie);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue