waibu 2.4.0 → 2.5.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/index.js +11 -1
- package/lib/build-locals.js +1 -1
- package/package.json +1 -1
- package/wiki/CHANGES.md +8 -0
package/index.js
CHANGED
|
@@ -301,7 +301,7 @@ async function factory (pkgName) {
|
|
|
301
301
|
}
|
|
302
302
|
|
|
303
303
|
/**
|
|
304
|
-
* Get origin
|
|
304
|
+
* Get origin from fastify's request object
|
|
305
305
|
*
|
|
306
306
|
* @method
|
|
307
307
|
* @param {Object} req
|
|
@@ -314,6 +314,16 @@ async function factory (pkgName) {
|
|
|
314
314
|
return `${req.protocol}://${host}`
|
|
315
315
|
}
|
|
316
316
|
|
|
317
|
+
/**
|
|
318
|
+
* Get hostname from fastify's request object
|
|
319
|
+
*
|
|
320
|
+
* @param {Object} req
|
|
321
|
+
* @returns {string}
|
|
322
|
+
*/
|
|
323
|
+
getHostname = (req) => {
|
|
324
|
+
return req.hostname.split(':')[0]
|
|
325
|
+
}
|
|
326
|
+
|
|
317
327
|
/**
|
|
318
328
|
* Get plugin by prefix
|
|
319
329
|
*
|
package/lib/build-locals.js
CHANGED
|
@@ -56,7 +56,7 @@ async function buildLocals ({ tpl, params = {}, opts = {} } = {}) {
|
|
|
56
56
|
const { runHook } = this.app.bajo
|
|
57
57
|
const { set, merge, pick, get, isEmpty, find, pullAt } = this.app.lib._
|
|
58
58
|
const { req, reply } = opts
|
|
59
|
-
params.page = merge(params.page ?? {}, { ns: req.ns })
|
|
59
|
+
params.page = merge(params.page ?? {}, { ns: req.ns, features: [] })
|
|
60
60
|
params.sidebar = params.sidebar ?? []
|
|
61
61
|
|
|
62
62
|
const { site, user, lang, darkMode } = req
|
package/package.json
CHANGED