waibu-mpa 1.2.9 → 1.2.10
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/package.json +1 -1
- package/waibuMpa/route/logo/@id.js +9 -12
package/package.json
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
async function logo (req, reply) {
|
|
4
|
-
const { importPkg } = this.app.bajo
|
|
5
|
-
const mime = await importPkg('waibu:mime')
|
|
1
|
+
async function resolveFile (req) {
|
|
6
2
|
const { getPlugin } = this.app.bajo
|
|
7
3
|
const { camelCase } = this.lib._
|
|
8
|
-
const { fastGlob
|
|
4
|
+
const { fastGlob } = this.lib
|
|
9
5
|
const id = camelCase(req.params.id)
|
|
10
6
|
const plugin = getPlugin(id)
|
|
11
7
|
let type = ''
|
|
12
8
|
if (req.query.type) type = `-${req.query.type}`
|
|
13
9
|
const files = await fastGlob(`${plugin.dir.pkg}/logo${type}.*`)
|
|
14
10
|
if (files.length === 0) throw this.error('_notFound')
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
return files[0]
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async function logo (req, reply) {
|
|
15
|
+
const { importModule } = this.app.bajo
|
|
16
|
+
const handler = await importModule('waibu:/lib/handle-download.js')
|
|
17
|
+
return await handler.call(this, resolveFile, req, reply)
|
|
21
18
|
}
|
|
22
19
|
|
|
23
20
|
export default logo
|