waibu 1.1.15 → 1.1.17

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.
@@ -1,4 +1,4 @@
1
- function buildHomesMenu (req) {
1
+ async function buildHomesMenu (req) {
2
2
  const { get, find, orderBy } = this.lib._
3
3
  const routes = []
4
4
  for (const ns of this.app.bajo.pluginNames) {
@@ -10,12 +10,14 @@ function buildHomesMenu (req) {
10
10
  return orderBy(routes, ['title'])
11
11
  }
12
12
 
13
- function buildPagesMenu (req) {
14
- const { find, orderBy, merge } = this.lib._
13
+ async function buildPagesMenu (req) {
14
+ const { find, orderBy, merge, isString } = this.lib._
15
+ const { callHandler } = this.app.bajo
15
16
  const all = [{ icon: 'house', href: '/', level: 1 }]
16
17
  for (const ns of this.app.bajo.pluginNames) {
17
18
  const items = []
18
- const pages = this.app[ns].getConfig('waibuMpa.pages', { defValue: [] })
19
+ let pages = this.app[ns].getConfig('waibuMpa.menuHandler', { defValue: [] })
20
+ if (isString(pages)) pages = await callHandler(pages, req)
19
21
  if (pages.length === 0) continue
20
22
  for (const page of pages) {
21
23
  const existing = find(all, { title: page.title })
@@ -77,8 +79,8 @@ async function buildLocals ({ tpl, params = {}, opts = {} } = {}) {
77
79
  if (this.app.bajo.config.env === 'dev') console.log(params.error)
78
80
  }
79
81
  if (reply && req.session && req.flash && !opts.partial) _meta.flash = reply.flash()
80
- set(params, 'menu.homes', buildHomesMenu.call(this, req))
81
- set(params, 'menu.pages', buildPagesMenu.call(this, req))
82
+ set(params, 'menu.homes', await buildHomesMenu.call(this, req))
83
+ set(params, 'menu.pages', await buildPagesMenu.call(this, req))
82
84
  const merged = merge({}, params, { _meta })
83
85
  await runHook(`${this.name}:afterBuildLocals`, merged, req)
84
86
  if (!isEmpty(routeOpts.ns)) await runHook(`${this.name}.${routeOpts.ns}:afterBuildLocals`, merged, req)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waibu",
3
- "version": "1.1.15",
3
+ "version": "1.1.17",
4
4
  "description": "Web Framework for Bajo",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/plugin/factory.js CHANGED
@@ -27,7 +27,8 @@ async function factory (pkgName) {
27
27
  },
28
28
  factory: {
29
29
  trustProxy: true,
30
- bodyLimit: 10485760
30
+ bodyLimit: 10485760,
31
+ pluginTimeout: 30000
31
32
  },
32
33
  prefixVirtual: '~',
33
34
  qsKey: {