waibu 2.20.0 → 2.21.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/intl/en-US.json +1 -1
- package/extend/bajo/intl/id.json +1 -1
- package/index.js +5 -2
- package/lib/handle-home.js +1 -0
- package/package.json +1 -1
- package/wiki/CHANGES.md +4 -0
|
@@ -20,6 +20,6 @@
|
|
|
20
20
|
"pageNotFound": "Page Not Found",
|
|
21
21
|
"pageNotFoundDesc": "Sorry, the page you're looking for is nowhere to be found!",
|
|
22
22
|
"accessDenied": "Access Denied",
|
|
23
|
-
"accessDeniedDesc": "Sorry, you don't have permission to access this page!",
|
|
23
|
+
"accessDeniedDesc": "Sorry, you don't have permission to access this page or to perform this action!",
|
|
24
24
|
"internalServerErrorDesc": "Sorry, something went wrong on our end. Please try again later or contact support if the problem persists."
|
|
25
25
|
}
|
package/extend/bajo/intl/id.json
CHANGED
|
@@ -20,6 +20,6 @@
|
|
|
20
20
|
"pageNotFound": "Halaman Tidak Ditemukan",
|
|
21
21
|
"pageNotFoundDesc": "Maaf, halaman yang akan Anda tuju tidak bisa ditemukan dimanapun!",
|
|
22
22
|
"accessDenied": "Akses Ditolak",
|
|
23
|
-
"accessDeniedDesc": "Maaf, Anda tidak memiliki izin untuk mengakses halaman ini!",
|
|
23
|
+
"accessDeniedDesc": "Maaf, Anda tidak memiliki izin untuk mengakses halaman ini atau melakukan tindakan ini!",
|
|
24
24
|
"internalServerErrorDesc": "Maaf, terjadi kesalahan di pihak kami. Silakan coba lagi nanti atau hubungi dukungan jika masalah ini terus berlanjut."
|
|
25
25
|
}
|
package/index.js
CHANGED
|
@@ -130,6 +130,7 @@ async function factory (pkgName) {
|
|
|
130
130
|
fileSize: 10485760
|
|
131
131
|
}
|
|
132
132
|
},
|
|
133
|
+
exposeError: undefined,
|
|
133
134
|
underPressure: false,
|
|
134
135
|
forwardOpts: {
|
|
135
136
|
disableRequestLogging: true,
|
|
@@ -164,8 +165,10 @@ async function factory (pkgName) {
|
|
|
164
165
|
*/
|
|
165
166
|
init = async () => {
|
|
166
167
|
const { isString } = this.app.lib._
|
|
168
|
+
const { isSet } = this.app.lib.aneka
|
|
167
169
|
if (isString(this.config.log.disable)) this.config.log.disable = [this.config.log.disable]
|
|
168
170
|
await collectRoutePathHandlers.call(this)
|
|
171
|
+
if (!isSet(this.config.exposeError)) this.config.exposeError = this.app.bajo.config.env === 'dev'
|
|
169
172
|
}
|
|
170
173
|
|
|
171
174
|
/**
|
|
@@ -472,7 +475,7 @@ async function factory (pkgName) {
|
|
|
472
475
|
const { defaultsDeep } = this.app.lib.aneka
|
|
473
476
|
const { isEmpty, get, trimEnd, trimStart } = this.app.lib._
|
|
474
477
|
const { breakNsPath } = this.app.bajo
|
|
475
|
-
const { query = {}, ns = this.ns, params = {}, guessHost, defaults = {}, uriEncoded } = options
|
|
478
|
+
const { query = {}, ns = this.ns, params = {}, guessHost, defaults = {}, uriEncoded, throwError = false } = options
|
|
476
479
|
|
|
477
480
|
const plugin = this.app.getPlugin(ns)
|
|
478
481
|
const cfg = plugin.config ?? {}
|
|
@@ -484,7 +487,7 @@ async function factory (pkgName) {
|
|
|
484
487
|
if (['%', '.', '/', '?', '#'].includes(name[0]) || name.slice(1, 2) === ':') info.path = name
|
|
485
488
|
else if (['~'].includes(name[0])) info.path = name.slice(1)
|
|
486
489
|
else {
|
|
487
|
-
info = breakNsPath(name,
|
|
490
|
+
info = breakNsPath(name, throwError)
|
|
488
491
|
}
|
|
489
492
|
if (info.path.slice(0, 2) === './') info.path = info.path.slice(2)
|
|
490
493
|
if (this.routePathHandlers[info.subNs]) return (neg ? '!' : '') + this.routePathHandlers[info.subNs].handler(name, options)
|
package/lib/handle-home.js
CHANGED
|
@@ -6,6 +6,7 @@ async function handleHome () {
|
|
|
6
6
|
const home = req.getSetting('waibu:home', {})
|
|
7
7
|
if (!home.path) throw me.error('_notFound')
|
|
8
8
|
home.options = home.options ?? {}
|
|
9
|
+
home.options.throwError = true
|
|
9
10
|
if (!home.forward) return reply.redirectTo(home.path, home.options)
|
|
10
11
|
const opts = defaultsDeep(pick(req, ['params', 'query']), pick(home, ['params', 'query']))
|
|
11
12
|
return reply.forwardTo(home.path, opts)
|
package/package.json
CHANGED