waibu 1.2.2 → 1.2.4
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/index.js +8 -1
- package/package.json +4 -1
package/index.js
CHANGED
|
@@ -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: '127.0.0.1',
|
|
26
26
|
port: 7771
|
|
27
27
|
},
|
|
28
28
|
factory: {
|
|
@@ -185,6 +185,13 @@ async function factory (pkgName) {
|
|
|
185
185
|
return fwd[0] ?? req.ip
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
+
getOrigin = (req) => {
|
|
189
|
+
const { isEmpty } = this.lib._
|
|
190
|
+
let host = req.host
|
|
191
|
+
if (isEmpty(host) || host === ':authority') host = `${this.config.server.host}:${this.config.server.port}`
|
|
192
|
+
return `${req.protocol}://${host}`
|
|
193
|
+
}
|
|
194
|
+
|
|
188
195
|
getPluginByPrefix = (prefix) => {
|
|
189
196
|
const { get, find } = this.lib._
|
|
190
197
|
const item = find(this.app.waibu.routes, r => {
|
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "waibu",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"description": "Web Framework for Bajo",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
|
+
"bajo": {
|
|
11
|
+
"type": "plugin"
|
|
12
|
+
},
|
|
10
13
|
"repository": {
|
|
11
14
|
"type": "git",
|
|
12
15
|
"url": "git+https://github.com/ardhi/waibu.git"
|