waibu 2.1.3 → 2.2.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 +5 -5
- package/lib/handle-favicon.js +20 -0
- package/package.json +1 -2
- package/wiki/CHANGES.md +5 -2
package/index.js
CHANGED
|
@@ -5,10 +5,10 @@ import routeHook from './lib/webapp-scope/route-hook.js'
|
|
|
5
5
|
import printRoutes from './lib/print-routes.js'
|
|
6
6
|
import { boot } from './lib/app.js'
|
|
7
7
|
import sensible from '@fastify/sensible'
|
|
8
|
-
import noIcon from 'fastify-no-icon'
|
|
9
8
|
import underPressure from '@fastify/under-pressure'
|
|
10
9
|
import handleForward from './lib/handle-forward.js'
|
|
11
10
|
import handleRedirect from './lib/handle-redirect.js'
|
|
11
|
+
import handleFavicon from './lib/handle-favicon.js'
|
|
12
12
|
import buildLocals from './lib/build-locals.js'
|
|
13
13
|
import queryString from 'query-string'
|
|
14
14
|
|
|
@@ -91,7 +91,7 @@ async function factory (pkgName) {
|
|
|
91
91
|
bboxLatField: 'bboxLatField',
|
|
92
92
|
bboxLngField: 'bboxLngField',
|
|
93
93
|
query: 'query',
|
|
94
|
-
|
|
94
|
+
search: 'search',
|
|
95
95
|
skip: 'skip',
|
|
96
96
|
page: 'page',
|
|
97
97
|
limit: 'limit',
|
|
@@ -117,7 +117,7 @@ async function factory (pkgName) {
|
|
|
117
117
|
fileSize: 10485760
|
|
118
118
|
}
|
|
119
119
|
},
|
|
120
|
-
|
|
120
|
+
favicon: false,
|
|
121
121
|
underPressure: false,
|
|
122
122
|
forwardOpts: {
|
|
123
123
|
disableRequestLogging: true,
|
|
@@ -187,7 +187,7 @@ async function factory (pkgName) {
|
|
|
187
187
|
await runHook('waibu:afterCreateContext', instance)
|
|
188
188
|
await instance.register(sensible)
|
|
189
189
|
if (cfg.underPressure) await instance.register(underPressure)
|
|
190
|
-
|
|
190
|
+
await handleFavicon.call(this, instance)
|
|
191
191
|
await handleRedirect.call(this, instance)
|
|
192
192
|
await handleForward.call(this, instance)
|
|
193
193
|
await appHook.call(this)
|
|
@@ -443,7 +443,7 @@ async function factory (pkgName) {
|
|
|
443
443
|
* @param {Object} [options.params={}] - Parameter object. If provided, it will be merged to returned value
|
|
444
444
|
* @returns {string}
|
|
445
445
|
*/
|
|
446
|
-
routePath = (name, options = {}) => {
|
|
446
|
+
routePath = (name = '', options = {}) => {
|
|
447
447
|
const { getPlugin } = this.app.bajo
|
|
448
448
|
const { defaultsDeep } = this.app.lib.aneka
|
|
449
449
|
const { isEmpty, get, trimEnd, trimStart } = this.app.lib._
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import path from 'path'
|
|
2
|
+
import handleDownload from './handle-download.js'
|
|
3
|
+
|
|
4
|
+
async function handleFavicon (ctx) {
|
|
5
|
+
const { getPluginFile } = this.app.bajo
|
|
6
|
+
let file
|
|
7
|
+
let ext = '.ico'
|
|
8
|
+
if (this.config.favicon) {
|
|
9
|
+
file = getPluginFile(this.config.favicon === true ? 'main:/favicon.ico' : this.config.favicon)
|
|
10
|
+
ext = path.extname(file)
|
|
11
|
+
}
|
|
12
|
+
const me = this
|
|
13
|
+
ctx.get(`/favicon${ext}`, async function (req, reply) {
|
|
14
|
+
if (!file) return reply.code(404).send()
|
|
15
|
+
reply.header('cache-control', 'max-age=86400')
|
|
16
|
+
return await handleDownload.call(me, file, req, reply)
|
|
17
|
+
})
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default handleFavicon
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "waibu",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Web Framework for Bajo",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -49,7 +49,6 @@
|
|
|
49
49
|
"@fastify/session": "^11.1.1",
|
|
50
50
|
"@fastify/under-pressure": "^9.0.3",
|
|
51
51
|
"fastify": "^5.6.2",
|
|
52
|
-
"fastify-no-icon": "^7.0.0",
|
|
53
52
|
"query-string": "^9.3.1",
|
|
54
53
|
"waibu-fastify-static": "^2.0.0"
|
|
55
54
|
},
|
package/wiki/CHANGES.md
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2026-02-01
|
|
4
|
+
|
|
5
|
+
- [2.2.0] Change query string token ```match``` to ```search``` for fulltext search
|
|
6
|
+
|
|
3
7
|
## 2026-01-21
|
|
4
8
|
|
|
5
|
-
- [2.1.3] Add ```getPluginTitle()```
|
|
6
|
-
- [2.1.3] Bug fix on ```getAppTitle()```
|
|
7
9
|
- [2.1.3] Rework on all title handlers
|
|
10
|
+
- [2.1.4] Faviocn handling
|
|
8
11
|
|
|
9
12
|
## 2026-01-19
|
|
10
13
|
|