@ladjs/web 18.0.1 → 18.0.4
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 +27 -27
- package/package.json +7 -7
package/index.js
CHANGED
|
@@ -329,33 +329,6 @@ class Web {
|
|
|
329
329
|
const stateHelper = new StateHelper(this.config.views.locals);
|
|
330
330
|
app.use(stateHelper.middleware);
|
|
331
331
|
|
|
332
|
-
// add specific locals
|
|
333
|
-
app.use((ctx, next) => {
|
|
334
|
-
// passport-related helpers (e.g. for rendering log in with X buttons)
|
|
335
|
-
ctx.state.passport = ctx.passport ? {} : false;
|
|
336
|
-
if (
|
|
337
|
-
ctx.passport &&
|
|
338
|
-
ctx.passport.config &&
|
|
339
|
-
ctx.passport.config.providers
|
|
340
|
-
) {
|
|
341
|
-
for (const key of Object.keys(ctx.passport.config.providers)) {
|
|
342
|
-
ctx.state.passport[key] = boolean(ctx.passport.config.providers[key]);
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
// add limited `ctx` object to the state for views
|
|
347
|
-
ctx.state.ctx = {};
|
|
348
|
-
ctx.state.ctx.get = ctx.get.bind(ctx);
|
|
349
|
-
ctx.state.ctx.locale = ctx.locale;
|
|
350
|
-
ctx.state.ctx.path = ctx.path;
|
|
351
|
-
ctx.state.ctx.pathWithoutLocale = ctx.pathWithoutLocale;
|
|
352
|
-
ctx.state.ctx.query = ctx.query;
|
|
353
|
-
ctx.state.ctx.sessionId = ctx.sessionId;
|
|
354
|
-
ctx.state.ctx.url = ctx.url;
|
|
355
|
-
|
|
356
|
-
return next();
|
|
357
|
-
});
|
|
358
|
-
|
|
359
332
|
// session store
|
|
360
333
|
app.keys = this.config.sessionKeys;
|
|
361
334
|
app.use(
|
|
@@ -417,6 +390,33 @@ class Web {
|
|
|
417
390
|
app.use(this.passport.session());
|
|
418
391
|
}
|
|
419
392
|
|
|
393
|
+
// add specific locals
|
|
394
|
+
app.use((ctx, next) => {
|
|
395
|
+
// passport-related helpers (e.g. for rendering log in with X buttons)
|
|
396
|
+
ctx.state.passport = ctx.passport ? {} : false;
|
|
397
|
+
if (
|
|
398
|
+
ctx.passport &&
|
|
399
|
+
ctx.passport.config &&
|
|
400
|
+
ctx.passport.config.providers
|
|
401
|
+
) {
|
|
402
|
+
for (const key of Object.keys(ctx.passport.config.providers)) {
|
|
403
|
+
ctx.state.passport[key] = boolean(ctx.passport.config.providers[key]);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
// add limited `ctx` object to the state for views
|
|
408
|
+
ctx.state.ctx = {};
|
|
409
|
+
ctx.state.ctx.get = ctx.get.bind(ctx);
|
|
410
|
+
ctx.state.ctx.locale = ctx.locale;
|
|
411
|
+
ctx.state.ctx.path = ctx.path;
|
|
412
|
+
ctx.state.ctx.pathWithoutLocale = ctx.pathWithoutLocale;
|
|
413
|
+
ctx.state.ctx.query = ctx.query;
|
|
414
|
+
ctx.state.ctx.sessionId = ctx.sessionId;
|
|
415
|
+
ctx.state.ctx.url = ctx.url;
|
|
416
|
+
|
|
417
|
+
return next();
|
|
418
|
+
});
|
|
419
|
+
|
|
420
420
|
// rate limiting
|
|
421
421
|
if (this.client && this.config.rateLimit)
|
|
422
422
|
app.use(
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ladjs/web",
|
|
3
3
|
"description": "Web server for Lad",
|
|
4
|
-
"version": "18.0.
|
|
4
|
+
"version": "18.0.4",
|
|
5
5
|
"author": "Nick Baugh <niftylettuce@gmail.com> (http://niftylettuce.com/)",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/ladjs/web/issues",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
],
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@hapi/boom": "^10.0.0",
|
|
15
|
-
"@koa/router": "^
|
|
15
|
+
"@koa/router": "^12.0.0",
|
|
16
16
|
"@ladjs/i18n": "^8.0.1",
|
|
17
17
|
"@ladjs/koa-better-static": "^2.0.1",
|
|
18
18
|
"@ladjs/koa-cache-responses": "^0.0.3",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@ladjs/koa-simple-ratelimit": "^4.0.1",
|
|
21
21
|
"@ladjs/redis": "^1.0.7",
|
|
22
22
|
"@ladjs/shared-config": "^8.0.0",
|
|
23
|
-
"@ladjs/state-helper": "^
|
|
23
|
+
"@ladjs/state-helper": "^3.0.1",
|
|
24
24
|
"@ladjs/store-ip-address": "^0.0.7",
|
|
25
25
|
"boolean": "^3.2.0",
|
|
26
26
|
"cabin": "^9.1.2",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"koa-meta": "^3.0.3",
|
|
49
49
|
"koa-methodoverride": "^2.0.0",
|
|
50
50
|
"koa-no-trailing-slash": "^2.1.0",
|
|
51
|
-
"koa-redirect-loop": "^3.0.
|
|
51
|
+
"koa-redirect-loop": "^3.0.1",
|
|
52
52
|
"koa-redis": "^4.0.1",
|
|
53
53
|
"koa-views": "^8.0.0",
|
|
54
54
|
"lodash": "^4.17.21",
|
|
@@ -60,13 +60,13 @@
|
|
|
60
60
|
"@commitlint/cli": "^17.0.3",
|
|
61
61
|
"@commitlint/config-conventional": "^17.0.3",
|
|
62
62
|
"@ladjs/passport": "^5.0.3",
|
|
63
|
-
"ava": "^4.3.
|
|
63
|
+
"ava": "^4.3.1",
|
|
64
64
|
"cross-env": "^7.0.3",
|
|
65
|
-
"eslint": "^8.
|
|
65
|
+
"eslint": "^8.20.0",
|
|
66
66
|
"eslint-config-xo-lass": "^2.0.1",
|
|
67
67
|
"fixpack": "^4.0.0",
|
|
68
68
|
"husky": "^8.0.1",
|
|
69
|
-
"ioredis": "^5.1
|
|
69
|
+
"ioredis": "^5.2.1",
|
|
70
70
|
"ioredis-mock": "^8.2.2",
|
|
71
71
|
"lint-staged": "^13.0.3",
|
|
72
72
|
"nyc": "^15.1.0",
|