@ladjs/web 16.0.2 → 16.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +10 -21
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -364,7 +364,6 @@ class Web {
|
|
|
364
364
|
ctx.state.ctx.path = ctx.path;
|
|
365
365
|
ctx.state.ctx.pathWithoutLocale = ctx.pathWithoutLocale;
|
|
366
366
|
ctx.state.ctx.query = ctx.query;
|
|
367
|
-
ctx.state.ctx.session = ctx.session;
|
|
368
367
|
ctx.state.ctx.sessionId = ctx.sessionId;
|
|
369
368
|
ctx.state.ctx.translate = ctx.translate;
|
|
370
369
|
ctx.state.ctx.url = ctx.url;
|
|
@@ -374,23 +373,15 @@ class Web {
|
|
|
374
373
|
|
|
375
374
|
// session store
|
|
376
375
|
app.keys = this.config.sessionKeys;
|
|
377
|
-
app.use(
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
} catch (err) {
|
|
387
|
-
// this would indicate that redis is down
|
|
388
|
-
ctx.logger.error(err);
|
|
389
|
-
delete ctx.session;
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
return next();
|
|
393
|
-
});
|
|
376
|
+
app.use(
|
|
377
|
+
session({
|
|
378
|
+
store: redisStore({ client: this.client }),
|
|
379
|
+
key: this.config.cookiesKey,
|
|
380
|
+
cookie: this.config.cookies,
|
|
381
|
+
genSid: this.config.genSid,
|
|
382
|
+
...this.config.session
|
|
383
|
+
})
|
|
384
|
+
);
|
|
394
385
|
|
|
395
386
|
// redirect loop (must come after sessions added)
|
|
396
387
|
if (this.config.redirectLoop) {
|
|
@@ -440,9 +431,7 @@ class Web {
|
|
|
440
431
|
} catch (err) {
|
|
441
432
|
ctx.logger.error(err);
|
|
442
433
|
let error = err;
|
|
443
|
-
|
|
444
|
-
if (!ctx.session) error = Boom.clientTimeout();
|
|
445
|
-
else if (err.name && err.name === 'ForbiddenError')
|
|
434
|
+
if (err.name && err.name === 'ForbiddenError')
|
|
446
435
|
error = Boom.forbidden(err.message);
|
|
447
436
|
|
|
448
437
|
ctx.throw(error);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ladjs/web",
|
|
3
3
|
"description": "Web server for Lad",
|
|
4
|
-
"version": "16.0.
|
|
4
|
+
"version": "16.0.3",
|
|
5
5
|
"author": "Nick Baugh <niftylettuce@gmail.com> (http://niftylettuce.com/)",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/ladjs/web/issues",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@ladjs/koa-simple-ratelimit": "^3.0.0",
|
|
21
21
|
"@ladjs/redis": "^1.0.7",
|
|
22
22
|
"@ladjs/shared-config": "^7.0.3",
|
|
23
|
-
"@ladjs/state-helper": "^2.0.
|
|
23
|
+
"@ladjs/state-helper": "^2.0.1",
|
|
24
24
|
"@ladjs/store-ip-address": "^0.0.7",
|
|
25
25
|
"boolean": "^3.2.0",
|
|
26
26
|
"cabin": "^9.1.2",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"koa-compress": "^5.1.0",
|
|
40
40
|
"koa-conditional-get": "^3.0.0",
|
|
41
41
|
"koa-connect": "^2.1.0",
|
|
42
|
-
"koa-csrf": "^4.0.
|
|
42
|
+
"koa-csrf": "^4.0.1",
|
|
43
43
|
"koa-etag": "^4.0.0",
|
|
44
44
|
"koa-favicon": "^2.1.0",
|
|
45
45
|
"koa-generic-session": "^2.3.0",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"@ladjs/passport": "^5.0.2",
|
|
64
64
|
"ava": "^4.3.0",
|
|
65
65
|
"cross-env": "^7.0.3",
|
|
66
|
-
"eslint": "^8.
|
|
66
|
+
"eslint": "^8.19.0",
|
|
67
67
|
"eslint-config-xo-lass": "^2.0.1",
|
|
68
68
|
"fixpack": "^4.0.0",
|
|
69
69
|
"husky": "^8.0.1",
|