sumba 2.33.5 → 2.34.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.
@@ -418,11 +418,12 @@ async function hook () {
418
418
  ctx.decorateRequest('user', null)
419
419
  }
420
420
  }, {
421
- level: 5,
421
+ level: 10,
422
422
  name: 'waibu:preParsing',
423
423
  handler: async function (req, reply) {
424
424
  const { getHostname } = this.app.waibu
425
425
  req.site = await this.getSite(getHostname(req))
426
+ await this.checkRoute(req)
426
427
  }
427
428
  }, {
428
429
  name: 'waibu:beforeStart',
package/index.js CHANGED
@@ -690,8 +690,9 @@ async function factory (pkgName) {
690
690
  }
691
691
 
692
692
  pathsToCheck = (req) => {
693
+ const { isSet } = this.app.lib.aneka
693
694
  const { uniq, without } = this.app.lib._
694
- const items = [req.routeOptions.url, req.url].map(url => url.split('?')[0].split('#')[0])
695
+ const items = [req.routeOptions.url, req.url].filter(url => isSet(url)).map(url => url.split('?')[0].split('#')[0])
695
696
  return uniq(without(items, undefined, null))
696
697
  }
697
698
 
@@ -810,6 +811,16 @@ async function factory (pkgName) {
810
811
  if (!get(req, 'user.isXSiteAdmin')) throw this.error('accessDenied', { statusCode: 403 })
811
812
  }
812
813
 
814
+ checkRoute = async (req) => {
815
+ const { routePath } = this.app.waibu
816
+ const { outmatch } = this.app.lib
817
+ const routes = req.getSetting('waibu:route.disabled', []).map(item => routePath(item, false))
818
+ if (routes.length === 0) return
819
+ const isMatch = outmatch(routes)
820
+ const paths = this.pathsToCheck(req)
821
+ if (paths.find(isMatch)) throw this.error('_notFound')
822
+ }
823
+
813
824
  parseNsSettings = (ns, setting, items) => {
814
825
  const { trim, set, isPlainObject, isArray, isEmpty, find } = this.app.lib._
815
826
  const { parseObject, dayjs } = this.app.lib
@@ -828,7 +839,6 @@ async function factory (pkgName) {
828
839
  } catch (err) {}
829
840
  } else if (Number(value)) value = Number(value)
830
841
  else if (['true', 'false'].includes(value)) value = value === 'true'
831
- else if (item.key.endsWith('$in')) value = value.split('\n').map(v => v.trim())
832
842
  else {
833
843
  const dt = dayjs(value)
834
844
  if (dt.isValid()) value = dt.toDate()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sumba",
3
- "version": "2.33.5",
3
+ "version": "2.34.1",
4
4
  "description": "Biz Suite for Bajo Framework",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/wiki/CHANGES.md CHANGED
@@ -3,6 +3,10 @@
3
3
  ## 2026-06-19
4
4
 
5
5
  - [2.33.5] Bug fix in ```team-user.json```
6
+ - [2.34.0] Add ```checkRoute()```
7
+ - [2.34.0] Add route checking to ```waibu:preParsing``` hook
8
+ - [2.34.1] Bug fix in ```pathsToCheck()```
9
+ - [2.34.1] Bug fix in ```hook.js```
6
10
 
7
11
  ## 2026-06-18
8
12