waibu 2.18.0 → 2.18.1

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 CHANGED
@@ -485,7 +485,7 @@ async function factory (pkgName) {
485
485
  if (['%', '.', '/', '?', '#'].includes(name[0]) || name.slice(1, 2) === ':') info.path = name
486
486
  else if (['~'].includes(name[0])) info.path = name.slice(1)
487
487
  else {
488
- info = breakNsPath(name)
488
+ info = breakNsPath(name, false)
489
489
  }
490
490
  if (info.path.slice(0, 2) === './') info.path = info.path.slice(2)
491
491
  if (this.routePathHandlers[info.subNs]) return (neg ? '!' : '') + this.routePathHandlers[info.subNs].handler(name, options)
@@ -603,9 +603,10 @@ async function factory (pkgName) {
603
603
  const paths = path.replaceAll('/', '.').split('.')
604
604
  if (paths[0] === '') paths.shift()
605
605
  path = paths.join('.')
606
- const cfgValue = get(this.app, `${ns}.config.${path}`)
607
- const reqValue = get(req, `site.setting.${ns}.${path}`)
608
- if (isPlainObject(cfgValue) || isArray(cfgValue)) return defaultsDeep({}, reqValue, cfgValue, defValue)
606
+ const cfgValue = get(this.app, `${ns}.config.${path}`, defValue)
607
+ const reqValue = get(req, `site.setting.${ns}.${path}`, defValue)
608
+ if (isPlainObject(cfgValue)) return defaultsDeep({}, reqValue, cfgValue)
609
+ if (isArray(cfgValue)) return reqValue.length > 0 ? reqValue : cfgValue
609
610
  return reqValue ?? cfgValue ?? defValue
610
611
  }
611
612
 
package/lib/decorate.js CHANGED
@@ -1,6 +1,4 @@
1
1
  async function decorate () {
2
- const { isPlainObject, isArray } = this.app.lib._
3
- const { defaultsDeep } = this.app.lib.aneka
4
2
  const me = this
5
3
  this.instance.decorateRequest('lang', null)
6
4
  this.instance.decorateRequest('t', () => {})
@@ -10,9 +8,7 @@ async function decorate () {
10
8
  this.instance.decorateRequest('site', null)
11
9
  this.instance.decorateRequest('ns', null)
12
10
  this.instance.decorateRequest('getSetting', function (key, defValue) {
13
- const value = me.app.waibu.getSetting(key, { req: this })
14
- if (isPlainObject(value) || isArray(value)) return defaultsDeep({}, value, defValue)
15
- return value ?? defValue
11
+ return me.app.waibu.getSetting(key, { req: this, defValue })
16
12
  })
17
13
  }
18
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waibu",
3
- "version": "2.18.0",
3
+ "version": "2.18.1",
4
4
  "description": "Web Framework for Bajo",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/wiki/CHANGES.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changes
2
2
 
3
+ ## 2026-06-19
4
+
5
+ - [2.18.1] Bug fix in ```routePath()```
6
+ - [2.18.1] Bug fix in ```req.getSetting()```
7
+
3
8
  ## 2026-06-12
4
9
 
5
10
  - [2.18.0] Necessary updates to ```bajo@2.18.0``` specs