waibu 1.1.22 → 1.2.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.
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import collectRoutePathHandlers from '
|
|
1
|
+
import collectRoutePathHandlers from './lib/collect-route-path-handlers.js'
|
|
2
2
|
import fastify from 'fastify'
|
|
3
|
-
import appHook from '
|
|
4
|
-
import routeHook from '
|
|
5
|
-
import logRoutes from '
|
|
6
|
-
import { boot } from '
|
|
3
|
+
import appHook from './lib/app-hook.js'
|
|
4
|
+
import routeHook from './lib/webapp-scope/route-hook.js'
|
|
5
|
+
import logRoutes from './lib/log-routes.js'
|
|
6
|
+
import { boot } from './lib/app.js'
|
|
7
7
|
import sensible from '@fastify/sensible'
|
|
8
8
|
import noIcon from 'fastify-no-icon'
|
|
9
9
|
import underPressure from '@fastify/under-pressure'
|
|
10
|
-
import handleForward from '
|
|
11
|
-
import handleRedirect from '
|
|
12
|
-
import buildLocals from '
|
|
10
|
+
import handleForward from './lib/handle-forward.js'
|
|
11
|
+
import handleRedirect from './lib/handle-redirect.js'
|
|
12
|
+
import buildLocals from './lib/build-locals.js'
|
|
13
13
|
import queryString from 'query-string'
|
|
14
14
|
|
|
15
15
|
async function factory (pkgName) {
|
|
@@ -22,7 +22,7 @@ async function factory (pkgName) {
|
|
|
22
22
|
this.dependencies = ['bajo-logger', 'bajo-extra']
|
|
23
23
|
this.config = {
|
|
24
24
|
server: {
|
|
25
|
-
host: '
|
|
25
|
+
host: '0.0.0.0',
|
|
26
26
|
port: 7771
|
|
27
27
|
},
|
|
28
28
|
factory: {
|
|
@@ -64,7 +64,15 @@ async function factory (pkgName) {
|
|
|
64
64
|
noIcon: true,
|
|
65
65
|
underPressure: false,
|
|
66
66
|
forwardOpts: {
|
|
67
|
-
disableRequestLogging: true
|
|
67
|
+
disableRequestLogging: true,
|
|
68
|
+
undici: {
|
|
69
|
+
connections: 128,
|
|
70
|
+
pipelining: 1,
|
|
71
|
+
keepAliveTimeout: 60 * 1000,
|
|
72
|
+
tls: {
|
|
73
|
+
rejectUnauthorized: false
|
|
74
|
+
}
|
|
75
|
+
}
|
|
68
76
|
}
|
|
69
77
|
}
|
|
70
78
|
this.escapeChars = {
|
|
@@ -134,7 +142,9 @@ async function factory (pkgName) {
|
|
|
134
142
|
const { outmatch } = this.lib
|
|
135
143
|
const { find } = this.lib._
|
|
136
144
|
const { breakNsPath } = this.app.bajo
|
|
137
|
-
|
|
145
|
+
let { ns, subNs = '', path } = breakNsPath(route)
|
|
146
|
+
const params = path.split('|')
|
|
147
|
+
if (params.length > 1) path = params[0]
|
|
138
148
|
return find(this.routes, r => {
|
|
139
149
|
if (r.path.startsWith('*')) return false
|
|
140
150
|
r.config = r.config ?? {}
|
package/lib/handle-forward.js
CHANGED
|
@@ -15,13 +15,11 @@ async function handleForward (ctx) {
|
|
|
15
15
|
const options = defaultsDeep({ base }, this.config.forwardOpts)
|
|
16
16
|
await ctx.register(replyFrom, options)
|
|
17
17
|
|
|
18
|
-
ctx.decorateReply('forwardTo',
|
|
19
|
-
if (url.startsWith('http')) this.redirectTo(url)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
})
|
|
24
|
-
}
|
|
18
|
+
ctx.decorateReply('forwardTo', function (url, options = {}) {
|
|
19
|
+
if (url.startsWith('http')) return this.redirectTo(url)
|
|
20
|
+
this.from(me.routePath(url, options), {
|
|
21
|
+
rewriteHeaders
|
|
22
|
+
})
|
|
25
23
|
return this
|
|
26
24
|
})
|
|
27
25
|
}
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|