sumba 2.33.4 → 2.34.0
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/extend/bajo/hook.js +2 -1
- package/extend/dobo/fixture/team-user.json +1 -0
- package/index.js +10 -1
- package/package.json +1 -1
- package/wiki/CHANGES.md +7 -0
package/extend/bajo/hook.js
CHANGED
|
@@ -418,11 +418,12 @@ async function hook () {
|
|
|
418
418
|
ctx.decorateRequest('user', null)
|
|
419
419
|
}
|
|
420
420
|
}, {
|
|
421
|
-
level:
|
|
421
|
+
level: 5,
|
|
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
|
@@ -810,6 +810,16 @@ async function factory (pkgName) {
|
|
|
810
810
|
if (!get(req, 'user.isXSiteAdmin')) throw this.error('accessDenied', { statusCode: 403 })
|
|
811
811
|
}
|
|
812
812
|
|
|
813
|
+
checkRoute = async (req) => {
|
|
814
|
+
const { routePath } = this.app.waibu
|
|
815
|
+
const { outmatch } = this.app.lib
|
|
816
|
+
const routes = req.getSetting('waibu:route.disabled', []).map(item => routePath(item, false))
|
|
817
|
+
if (routes.length === 0) return
|
|
818
|
+
const isMatch = outmatch(routes)
|
|
819
|
+
const paths = this.pathsToCheck(req)
|
|
820
|
+
if (paths.find(isMatch)) throw this.error('_notFound')
|
|
821
|
+
}
|
|
822
|
+
|
|
813
823
|
parseNsSettings = (ns, setting, items) => {
|
|
814
824
|
const { trim, set, isPlainObject, isArray, isEmpty, find } = this.app.lib._
|
|
815
825
|
const { parseObject, dayjs } = this.app.lib
|
|
@@ -828,7 +838,6 @@ async function factory (pkgName) {
|
|
|
828
838
|
} catch (err) {}
|
|
829
839
|
} else if (Number(value)) value = Number(value)
|
|
830
840
|
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
841
|
else {
|
|
833
842
|
const dt = dayjs(value)
|
|
834
843
|
if (dt.isValid()) value = dt.toDate()
|
package/package.json
CHANGED
package/wiki/CHANGES.md
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2026-06-19
|
|
4
|
+
|
|
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
|
+
|
|
3
9
|
## 2026-06-18
|
|
4
10
|
|
|
5
11
|
- [2.33.2] Bug fix in ```hook.js```
|
|
6
12
|
- [2.33.3] Bug fix in ```hook.js```
|
|
7
13
|
- [2.33.4] Bug fix in ```create-new-site.js```
|
|
14
|
+
- [2.33.4] Normalize ```siteId``` & ```userId``` fields
|
|
8
15
|
|
|
9
16
|
## 2026-06-17
|
|
10
17
|
|