waibu 2.9.0 → 2.9.2
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/favicon.png +0 -0
- package/index.js +0 -2
- package/lib/webapp-scope/handle-multipart-body.js +8 -1
- package/package.json +1 -1
- package/wiki/CHANGES.md +19 -11
- package/lib/handle-body.js +0 -33
package/favicon.png
ADDED
|
Binary file
|
package/index.js
CHANGED
|
@@ -12,7 +12,6 @@ import handleError from './lib/handle-error.js'
|
|
|
12
12
|
import handleNotFound from './lib/handle-not-found.js'
|
|
13
13
|
import handleHome from './lib/handle-home.js'
|
|
14
14
|
import queryString from 'query-string'
|
|
15
|
-
import handleBody from './lib/handle-body.js'
|
|
16
15
|
|
|
17
16
|
/**
|
|
18
17
|
* @typedef TEscapeChars
|
|
@@ -197,7 +196,6 @@ async function factory (pkgName) {
|
|
|
197
196
|
await handleAppHook.call(this)
|
|
198
197
|
await handleError.call(this)
|
|
199
198
|
await routeHook.call(this, this.ns)
|
|
200
|
-
await handleBody.call(this)
|
|
201
199
|
await webApp.call(this)
|
|
202
200
|
await handleHome.call(this)
|
|
203
201
|
await handleNotFound.call(this)
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import multipart from '@fastify/multipart'
|
|
2
2
|
import { promisify } from 'util'
|
|
3
3
|
import { pipeline } from 'stream'
|
|
4
|
-
import { normalizeValue } from '../handle-body.js'
|
|
5
4
|
import path from 'path'
|
|
6
5
|
const pump = promisify(pipeline)
|
|
7
6
|
|
|
7
|
+
function normalizeValue (value) {
|
|
8
|
+
const { isSet } = this.app.lib.aneka
|
|
9
|
+
if (!isSet(value)) return
|
|
10
|
+
if (value === 'null') value = null
|
|
11
|
+
else if (value === 'undefined') value = undefined
|
|
12
|
+
return value
|
|
13
|
+
}
|
|
14
|
+
|
|
8
15
|
async function onFileHandler () {
|
|
9
16
|
const { getPluginDataDir } = this.app.bajo
|
|
10
17
|
const { fs } = this.app.lib
|
package/package.json
CHANGED
package/wiki/CHANGES.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2026-03-15
|
|
4
|
+
|
|
5
|
+
- [2.9.2] Bug fix missing default ```favicon.png```
|
|
6
|
+
|
|
7
|
+
## 2026-03-12
|
|
8
|
+
|
|
9
|
+
- [2.9.1] Bug fix in ```req.body``` parsing with multipart body parser
|
|
10
|
+
|
|
3
11
|
## 2026-03-07
|
|
4
12
|
|
|
5
13
|
- [2.9.0] Change logo
|
|
@@ -7,8 +15,8 @@
|
|
|
7
15
|
|
|
8
16
|
## 2026-03-06
|
|
9
17
|
|
|
10
|
-
- [2.8.1] Bug fix
|
|
11
|
-
- [2.8.2] Bug fix
|
|
18
|
+
- [2.8.1] Bug fix in ```req.body``` parsing
|
|
19
|
+
- [2.8.2] Bug fix in ```preValidation```
|
|
12
20
|
|
|
13
21
|
## 2026-03-02
|
|
14
22
|
|
|
@@ -17,16 +25,16 @@
|
|
|
17
25
|
|
|
18
26
|
## 2026-02-21
|
|
19
27
|
|
|
20
|
-
- [2.7.1] Bug fix
|
|
21
|
-
- [2.7.1] Bug fix
|
|
28
|
+
- [2.7.1] Bug fix in ```errorHandler```
|
|
29
|
+
- [2.7.1] Bug fix in ```notFoundHandler```
|
|
22
30
|
- [2.7.1] Add fallback template for both handlers above
|
|
23
31
|
|
|
24
32
|
|
|
25
33
|
## 2026-02-20
|
|
26
34
|
|
|
27
35
|
- [2.7.0] Add ```req.te()``` decorator
|
|
28
|
-
- [2.7.0] Bug fix
|
|
29
|
-
- [2.7.0] Bug fix
|
|
36
|
+
- [2.7.0] Bug fix in ```getPluginByPrefix()```
|
|
37
|
+
- [2.7.0] Bug fix in ```notFoundHandler.interceptor()```
|
|
30
38
|
|
|
31
39
|
## 2026-02-18
|
|
32
40
|
|
|
@@ -38,13 +46,13 @@
|
|
|
38
46
|
|
|
39
47
|
## 2026-02-16
|
|
40
48
|
|
|
41
|
-
- [2.4.1] Bug fix
|
|
49
|
+
- [2.4.1] Bug fix in page with features
|
|
42
50
|
|
|
43
51
|
## 2026-02-09
|
|
44
52
|
|
|
45
|
-
- [2.3.4] Bug fix
|
|
46
|
-
- [2.3.4] Bug fix
|
|
47
|
-
- [2.3.4] Bug fix
|
|
53
|
+
- [2.3.4] Bug fix in error handling
|
|
54
|
+
- [2.3.4] Bug fix in not found handling
|
|
55
|
+
- [2.3.4] Bug fix in redirection handling
|
|
48
56
|
- [2.4.0] Accept path parameter as in ```{param}``` to complement ```:param``` in ```routePath()```
|
|
49
57
|
|
|
50
58
|
## 2026-02-08
|
|
@@ -65,7 +73,7 @@
|
|
|
65
73
|
|
|
66
74
|
## 2026-01-19
|
|
67
75
|
|
|
68
|
-
- [2.1.2] Bug fix
|
|
76
|
+
- [2.1.2] Bug fix in ```getAppTitle()```
|
|
69
77
|
- [2.1.2] Add missing some translation
|
|
70
78
|
|
|
71
79
|
## 2025-12-28
|
package/lib/handle-body.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export function normalizeValue (value) {
|
|
2
|
-
const { isSet } = this.app.lib.aneka
|
|
3
|
-
const { isArray, trim, isPlainObject } = this.app.lib._
|
|
4
|
-
if (!isSet(value)) return
|
|
5
|
-
if (value === 'null') value = null
|
|
6
|
-
else if (value === 'undefined') value = undefined
|
|
7
|
-
else {
|
|
8
|
-
const val = trim(value)
|
|
9
|
-
if (['{', '['].includes(val[0])) {
|
|
10
|
-
try {
|
|
11
|
-
const parsed = JSON.parse(val)
|
|
12
|
-
if (isPlainObject(parsed) || isArray(parsed)) value = parsed
|
|
13
|
-
} catch (err) {
|
|
14
|
-
value = val
|
|
15
|
-
}
|
|
16
|
-
} else value = val
|
|
17
|
-
}
|
|
18
|
-
return value
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
async function handleBody (options = {}) {
|
|
22
|
-
const { isPlainObject } = this.app.lib._
|
|
23
|
-
const me = this
|
|
24
|
-
this.instance.addHook('preValidation', async function (req, reply) {
|
|
25
|
-
if (req.body && isPlainObject(req.body)) {
|
|
26
|
-
for (const key in req.body) {
|
|
27
|
-
req.body[key] = normalizeValue.call(me, req.body[key])
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
})
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export default handleBody
|