sumba 2.2.4 → 2.3.1
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/extend/bajo/hook/waibu-mpa@pre-parsing.js +0 -20
- package/extend/bajo/hook/waibu@on-request.js +2 -2
- package/extend/bajo/intl/en-US.json +4 -1
- package/extend/bajo/intl/id.json +4 -0
- package/extend/dobo/feature/address.js +1 -4
- package/extend/dobo/feature/country.js +4 -0
- package/extend/dobo/model/site-setting.json +4 -0
- package/extend/waibuDb/schema/site.json +1 -1
- package/extend/waibuMpa/extend/waibuAdmin/route/site-setting/@action.js +11 -0
- package/index.js +14 -5
- package/lib/check-iconset.js +1 -1
- package/lib/check-theme.js +1 -1
- package/package.json +2 -1
- package/wiki/CHANGES.md +10 -0
|
@@ -6,30 +6,10 @@ import checkTeam from '../../../lib/check-team.js'
|
|
|
6
6
|
const preParsing = {
|
|
7
7
|
level: 10,
|
|
8
8
|
handler: async function (req, reply) {
|
|
9
|
-
// const { routePath } = this.app.waibu
|
|
10
|
-
|
|
11
9
|
await checkTheme.call(this, req, reply)
|
|
12
10
|
await checkIconset.call(this, req, reply)
|
|
13
11
|
await checkUserId.call(this, req, reply, 'waibuMpa')
|
|
14
12
|
await checkTeam.call(this, req, reply, 'waibuMpa')
|
|
15
|
-
/*
|
|
16
|
-
req.menu = req.menu ?? {}
|
|
17
|
-
if (req.user) {
|
|
18
|
-
req.menu.user = [
|
|
19
|
-
{ value: routePath('sumba:/your-stuff/change-password', req), text: req.t('Change Password') },
|
|
20
|
-
{ value: routePath('sumba:/your-stuff/profile', req), text: req.t('yourProfile') },
|
|
21
|
-
'-',
|
|
22
|
-
{ value: routePath('sumba:/signout', req), text: req.t('signout') }
|
|
23
|
-
]
|
|
24
|
-
} else {
|
|
25
|
-
req.menu.user = [
|
|
26
|
-
{ value: routePath('sumba:/signin', req), text: req.t('signin') },
|
|
27
|
-
'-',
|
|
28
|
-
{ value: routePath('sumba:/user/signup', req), text: req.t('signup') },
|
|
29
|
-
{ value: routePath('sumba:/user/forgot-password', req), text: req.t('forgotPassword') }
|
|
30
|
-
]
|
|
31
|
-
}
|
|
32
|
-
*/
|
|
33
13
|
}
|
|
34
14
|
}
|
|
35
15
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const onRequest = {
|
|
2
2
|
level: 10,
|
|
3
3
|
handler: async function (req, reply) {
|
|
4
|
-
const
|
|
5
|
-
req.site = await this.getSite(
|
|
4
|
+
const { getHostname } = this.app.waibu
|
|
5
|
+
req.site = await this.getSite(getHostname(req))
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
|
|
@@ -109,7 +109,10 @@
|
|
|
109
109
|
"downloadList": "Download List",
|
|
110
110
|
"manageDownload": "Manage Download",
|
|
111
111
|
"userSession": "User Session",
|
|
112
|
-
"XHandler": "Twitter Account",
|
|
112
|
+
"XHandler": "Twitter/X Account",
|
|
113
|
+
"unverified": "Unverified",
|
|
114
|
+
"active": "Active",
|
|
115
|
+
"inactive": "Inactive",
|
|
113
116
|
"field": {
|
|
114
117
|
"currentPassword": "Current Password",
|
|
115
118
|
"newPassword": "New Password",
|
package/extend/bajo/intl/id.json
CHANGED
|
@@ -110,6 +110,10 @@
|
|
|
110
110
|
"downloadList": "Daftar Unduh",
|
|
111
111
|
"manageDownload": "Kelola Unduhan",
|
|
112
112
|
"userSession": "Sesi Pengguna",
|
|
113
|
+
"XHandler": "Akun Twitter/X",
|
|
114
|
+
"unverified": "Belum Terverifikasi",
|
|
115
|
+
"active": "Aktif",
|
|
116
|
+
"inactive": "Non Aktif",
|
|
113
117
|
"field": {
|
|
114
118
|
"currentPassword": "Kata Sandi Saat Ini",
|
|
115
119
|
"newPassword": "Kata Sandi Baru",
|
|
@@ -23,10 +23,7 @@ async function address (opts = {}) {
|
|
|
23
23
|
index: true
|
|
24
24
|
}, {
|
|
25
25
|
name: 'country',
|
|
26
|
-
type: '
|
|
27
|
-
maxLength: 2,
|
|
28
|
-
index: true,
|
|
29
|
-
rules: ['uppercase', { rule: 'length', params: 2 }]
|
|
26
|
+
type: 'sumba:country'
|
|
30
27
|
}, {
|
|
31
28
|
name: 'phone',
|
|
32
29
|
type: 'string',
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
async function country (opts = {}) {
|
|
2
|
+
const { readConfig } = this.app.bajo
|
|
2
3
|
opts.fieldName = opts.fieldName ?? 'country'
|
|
4
|
+
const countries = await readConfig('bajoCommonDb:/extend/dobo/fixture/country.json', { ignoreError: true, defValue: [] })
|
|
5
|
+
const values = countries.map(item => ({ value: item.id, text: item.name.replaceAll('\'', '') }))
|
|
3
6
|
return {
|
|
4
7
|
properties: [{
|
|
5
8
|
name: opts.fieldName,
|
|
6
9
|
type: 'string',
|
|
7
10
|
maxLength: 2,
|
|
8
11
|
index: opts.index ?? true,
|
|
12
|
+
values,
|
|
9
13
|
rules: ['uppercase', { rule: 'length', params: 2 }]
|
|
10
14
|
}],
|
|
11
15
|
rules: [{ rule: 'trim', fields: [opts.fieldName] }]
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const action = {
|
|
2
|
+
method: ['GET', 'POST'],
|
|
3
|
+
title: 'siteSetting',
|
|
4
|
+
handler: async function (req, reply) {
|
|
5
|
+
const { importModule } = this.app.bajo
|
|
6
|
+
const crudSkel = await importModule('waibuAdmin:/lib/crud-skel.js')
|
|
7
|
+
return await crudSkel.call(this, 'SumbaSiteSetting', req, reply)
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default action
|
package/index.js
CHANGED
|
@@ -182,6 +182,8 @@ async function factory (pkgName) {
|
|
|
182
182
|
{ title: 'manageTeam', href: `waibuAdmin:/${prefix}/team/list` },
|
|
183
183
|
{ title: 'manageTeamUser', href: `waibuAdmin:/${prefix}/team-user/list` },
|
|
184
184
|
{ title: 'manageDownload', href: `waibuAdmin:/${prefix}/download/list` },
|
|
185
|
+
{ title: '-' },
|
|
186
|
+
{ title: 'siteSetting', href: `waibuAdmin:/${prefix}/site-setting/list` },
|
|
185
187
|
{ title: 'resetUserPassword', href: `waibuAdmin:/${prefix}/reset-user-password` }
|
|
186
188
|
]
|
|
187
189
|
}, {
|
|
@@ -403,7 +405,7 @@ async function factory (pkgName) {
|
|
|
403
405
|
|
|
404
406
|
const mergeSetting = async (site) => {
|
|
405
407
|
const { defaultsDeep } = this.app.lib.aneka
|
|
406
|
-
const { parseObject } = this.app.lib
|
|
408
|
+
const { parseObject, dayjs } = this.app.lib
|
|
407
409
|
const { trim, get, filter } = this.app.lib._
|
|
408
410
|
const defSetting = {}
|
|
409
411
|
const nsSetting = {}
|
|
@@ -412,20 +414,27 @@ async function factory (pkgName) {
|
|
|
412
414
|
ns: { $in: names },
|
|
413
415
|
siteId: site.id
|
|
414
416
|
}
|
|
415
|
-
const all = await this.app.dobo.getModel('SumbaSiteSetting').
|
|
417
|
+
const all = await this.app.dobo.getModel('SumbaSiteSetting').findAllRecord({ query })
|
|
416
418
|
for (const ns of names) {
|
|
417
419
|
nsSetting[ns] = {}
|
|
418
420
|
defSetting[ns] = get(this, `app.${ns}.config.siteSetting`, {})
|
|
419
421
|
const items = filter(all, { ns })
|
|
420
422
|
for (const item of items) {
|
|
421
423
|
let value = trim([item.value] ?? '')
|
|
422
|
-
if (['[', '{'].includes(value[0]))
|
|
423
|
-
|
|
424
|
+
if (['[', '{'].includes(value[0])) {
|
|
425
|
+
try {
|
|
426
|
+
value = parseObject(JSON.parse(value))
|
|
427
|
+
} catch (err) {}
|
|
428
|
+
} else if (Number(value)) value = Number(value)
|
|
424
429
|
else if (['true', 'false'].includes(value)) value = value === 'true'
|
|
430
|
+
else {
|
|
431
|
+
const dt = dayjs(value)
|
|
432
|
+
if (dt.isValid()) value = dt.toDate()
|
|
433
|
+
}
|
|
425
434
|
nsSetting[ns][item.key] = value
|
|
426
435
|
}
|
|
427
436
|
}
|
|
428
|
-
site.setting =
|
|
437
|
+
site.setting = defaultsDeep({}, nsSetting, defSetting)
|
|
429
438
|
// additional fields
|
|
430
439
|
const country = await this.app.dobo.getModel('CdbCountry').getRecord(site.country, { noHook: true })
|
|
431
440
|
site.countryName = (country ?? {}).name ?? site.country
|
package/lib/check-iconset.js
CHANGED
|
@@ -4,7 +4,7 @@ async function checkIconset (req, reply) {
|
|
|
4
4
|
|
|
5
5
|
if (!req.site) return
|
|
6
6
|
const siteIconset = get(req, 'site.setting.waibuMpa.iconset')
|
|
7
|
-
req.iconset = get(mpa, 'config.iconset.set',
|
|
7
|
+
req.iconset = siteIconset ?? get(mpa, 'config.iconset.set', 'default')
|
|
8
8
|
const hiconset = req.headers['x-iconset']
|
|
9
9
|
if (isString(hiconset) && mpa.getIconset(hiconset)) req.iconset = hiconset
|
|
10
10
|
req.iconset = req.iconset ?? 'default'
|
package/lib/check-theme.js
CHANGED
|
@@ -4,7 +4,7 @@ async function checkTheme (req, reply) {
|
|
|
4
4
|
|
|
5
5
|
if (!req.site) return
|
|
6
6
|
const siteTheme = get(req, 'site.setting.waibuMpa.theme')
|
|
7
|
-
req.theme = get(mpa, 'config.theme.set',
|
|
7
|
+
req.theme = siteTheme ?? get(mpa, 'config.theme.set', 'default')
|
|
8
8
|
const htheme = req.headers['x-theme']
|
|
9
9
|
if (isString(htheme) && mpa.getTheme(htheme)) req.theme = htheme
|
|
10
10
|
req.theme = req.theme ?? 'default'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sumba",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "Biz Suite for Bajo Framework",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"keywords": [
|
|
21
21
|
"sumba",
|
|
22
22
|
"bajo",
|
|
23
|
+
"bajoCommonDb",
|
|
23
24
|
"framework",
|
|
24
25
|
"addons",
|
|
25
26
|
"multidomain"
|
package/wiki/CHANGES.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2026-02-17
|
|
4
|
+
|
|
5
|
+
- [2.3.0] Add admin menu links to ```siteSetting```
|
|
6
|
+
- [2.3.0] Bug fix on ```getSite()```
|
|
7
|
+
- [2.3.0] Add unique index on model ```SumbaSiteSetting```
|
|
8
|
+
- [2.3.0] Add admin subroute to manage site setting
|
|
9
|
+
- [2.3.0] Bug fix on ```req.theme``` and ```req.iconset``` resolver
|
|
10
|
+
- [2.3.1] Update translations
|
|
11
|
+
- [2.3.1] Bug fix on ```sumba:country``` feature
|
|
12
|
+
|
|
3
13
|
## 2026-02-09
|
|
4
14
|
|
|
5
15
|
- [2.2.3] Bug fix on sidebar menu
|