waibu-mpa 2.19.0 → 2.20.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.
@@ -1,5 +1,4 @@
1
1
  async function resolveFile (req) {
2
- const { getPlugin, getPluginDataDir } = this.app.bajo
3
2
  const { camelCase } = this.app.lib._
4
3
  const { fastGlob } = this.app.lib
5
4
  const id = camelCase(req.params.id)
@@ -7,7 +6,7 @@ async function resolveFile (req) {
7
6
  let files
8
7
  if (req.query.type) type = `-${req.query.type}`
9
8
  if (id !== 'main') {
10
- const plugin = getPlugin(id)
9
+ const plugin = this.app.getPlugin(id)
11
10
  files = await fastGlob(`${plugin.dir.pkg}/logo${type}.*`)
12
11
  if (files.length > 0) return files[0]
13
12
  throw this.error('_notFound')
@@ -16,7 +15,7 @@ async function resolveFile (req) {
16
15
  files = await fastGlob(`${this.app.main.dir.pkg}/logo${type}.*`)
17
16
  // 2. site attachment
18
17
  if (files.length > 0) return files[0]
19
- let dir = getPluginDataDir('dobo')
18
+ let dir = this.app.getPluginDataDir('dobo')
20
19
  files = await fastGlob(`${dir}/attachment/SumbaSite/${req.site.id}/file/logo${type}.*`)
21
20
  if (files.length > 0) return files[0]
22
21
  // 3. theme
package/index.js CHANGED
@@ -199,9 +199,8 @@ async function factory (pkgName) {
199
199
  }
200
200
 
201
201
  getPluginTitle = (name, req) => {
202
- const { getPlugin } = this.app.bajo
203
202
  const { get } = this.app.lib._
204
- const plugin = getPlugin(name, true)
203
+ const plugin = this.app.getPlugin(name, true)
205
204
  if (!plugin) return
206
205
  const text = get(plugin, 'config.waibuMpa.title', plugin.ns)
207
206
  return this.t(text, { lang: req.lang })
@@ -216,7 +215,7 @@ async function factory (pkgName) {
216
215
  getResource (name) {
217
216
  const subNses = ['layout', 'template', 'partial']
218
217
  const { ns, path, subNs, subSubNs, qs } = this.app.bajo.breakNsPath(name)
219
- const plugin = this.app.bajo.getPlugin(ns)
218
+ const plugin = this.app.getPlugin(ns)
220
219
  const dir = `${plugin.dir.pkg}/extend/waibuMpa`
221
220
  if (!subNses.includes(subNs)) throw this.error('unknownResource%s', name)
222
221
  const fullPath = subSubNs ? `${dir}/${subSubNs}/${subNs}${path}` : `${dir}/${subNs}${path}`
@@ -14,7 +14,7 @@ async function widgetFactory () {
14
14
  super(component.plugin)
15
15
  const names = kebabCase(this.constructor.name).split('-')
16
16
  const alias = names.length > 1 ? names[0] : 'wbs'
17
- let plugin = this.app.bajo.getPlugin(alias, true)
17
+ let plugin = this.app.getPlugin(alias, true)
18
18
  if (!plugin) plugin = this.app.waibuBootstrap
19
19
  this.plugin = plugin
20
20
  this.app = plugin.app
package/lib/favicon.js CHANGED
@@ -1,14 +1,14 @@
1
1
  async function handleFavicon () {
2
2
  if (!this.config.favicon) return
3
- const { getPluginFile, importModule, getPluginDataDir } = this.app.bajo
3
+ const { importModule } = this.app.bajo
4
4
  const { fs } = this.app.lib
5
5
  const handleDownload = await importModule('waibu:/lib/handle-download.js')
6
6
  const me = this
7
7
  this.webAppCtx.get('/favicon.:ext', async function (req, reply) {
8
8
  // 1. main favicon
9
- let file = getPluginFile(`main:/favicon.${req.params.ext}`)
9
+ let file = me.app.getPluginFile(`main:/favicon.${req.params.ext}`)
10
10
  if (!fs.existsSync(file)) {
11
- const dir = getPluginDataDir('dobo')
11
+ const dir = me.app.getPluginDataDir('dobo')
12
12
  // 2. site attachment
13
13
  file = `${dir}/attachment/SumbaSite/${req.site.id}/file/favicon.${req.params.ext}`
14
14
  }
@@ -18,7 +18,7 @@ async function handleFavicon () {
18
18
  file = `${theme.plugin.dir.pkg}/extend/waibuStatic/asset/favicon.${req.params.ext}`
19
19
  }
20
20
  // 4. Default
21
- if (!fs.existsSync(file)) file = getPluginFile('waibu:/favicon.png')
21
+ if (!fs.existsSync(file)) file = me.app.getPluginFile('waibu:/favicon.png')
22
22
  reply.header('cache-control', 'max-age=86400')
23
23
  return await handleDownload.call(me, file, req, reply)
24
24
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waibu-mpa",
3
- "version": "2.19.0",
3
+ "version": "2.20.0",
4
4
  "description": "MPA support for Waibu Framework",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/wiki/CHANGES.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changes
2
2
 
3
+ ## 2026-06-12
4
+
5
+ - [2.20.0] Necessary updates to ```bajo@2.18.0``` specs
6
+
3
7
  ## 2026-06-10
4
8
 
5
9
  - [2.19.0] Remove route redirects because now directly handled by ```waibu```