sumba 2.47.0 → 2.47.3
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/.github/FUNDING.yml +0 -0
- package/.github/workflows/repo-lockdown.yml +0 -0
- package/.jsdoc.conf.json +0 -0
- package/LICENSE +0 -0
- package/README.md +0 -0
- package/docs/Sumba.html +0 -0
- package/docs/data/search.json +0 -0
- package/docs/fonts/Inconsolata-Regular.ttf +0 -0
- package/docs/fonts/OpenSans-Regular.ttf +0 -0
- package/docs/fonts/WorkSans-Bold.ttf +0 -0
- package/docs/global.html +0 -0
- package/docs/index.html +0 -0
- package/docs/index.js.html +0 -0
- package/docs/lib_config.js.html +0 -0
- package/docs/lib_constant.js.html +0 -0
- package/docs/lib_token-schema.js.html +0 -0
- package/docs/scripts/core.js +0 -0
- package/docs/scripts/core.min.js +0 -0
- package/docs/scripts/resize.js +0 -0
- package/docs/scripts/search.js +0 -0
- package/docs/scripts/search.min.js +5 -5
- package/docs/scripts/third-party/Apache-License-2.0.txt +0 -0
- package/docs/scripts/third-party/fuse.js +0 -0
- package/docs/scripts/third-party/hljs-line-num-original.js +0 -0
- package/docs/scripts/third-party/hljs-line-num.js +0 -0
- package/docs/scripts/third-party/hljs-original.js +0 -0
- package/docs/scripts/third-party/hljs.js +0 -0
- package/docs/scripts/third-party/popper.js +0 -0
- package/docs/scripts/third-party/tippy.js +0 -0
- package/docs/scripts/third-party/tocbot.js +0 -0
- package/docs/scripts/third-party/tocbot.min.js +0 -0
- package/docs/static/bitcoin.jpeg +0 -0
- package/docs/static/home.md +0 -0
- package/docs/static/logo-ecosystem.png +0 -0
- package/docs/static/logo.png +0 -0
- package/docs/styles/clean-jsdoc-theme-base.css +0 -0
- package/docs/styles/clean-jsdoc-theme-dark.css +0 -0
- package/docs/styles/clean-jsdoc-theme-light.css +0 -0
- package/docs/styles/clean-jsdoc-theme-scrollbar.css +0 -0
- package/docs/styles/clean-jsdoc-theme-without-scrollbar.min.css +0 -0
- package/docs/styles/clean-jsdoc-theme.min.css +0 -0
- package/extend/bajo/hook.js +300 -300
- package/extend/bajo/intl/en-US.json +0 -0
- package/extend/bajo/intl/id.json +0 -0
- package/extend/bajoCli/applet/create-new-site.js +21 -21
- package/extend/bajoCli/applet/populate-model-with-site.js +54 -54
- package/extend/bajoCli/applet/remove-site.js +20 -20
- package/extend/bajoCli/applet.js +0 -0
- package/extend/bajoTemplate/layout/centered.html +0 -0
- package/extend/bajoTemplate/layout/default.html +0 -0
- package/extend/bajoTemplate/layout/email.html +0 -0
- package/extend/bajoTemplate/layout/email.id.html +0 -0
- package/extend/bajoTemplate/layout/error.html +0 -0
- package/extend/bajoTemplate/layout/info.html +0 -0
- package/extend/bajoTemplate/partial/403.html +0 -0
- package/extend/bajoTemplate/partial/_admin/reset-user-password.html +0 -0
- package/extend/bajoTemplate/partial/_mail/help-contact-form.html +0 -0
- package/extend/bajoTemplate/partial/_mail/help-contact-form.id.html +0 -0
- package/extend/bajoTemplate/partial/_mail/mystuff-change-password.html +0 -0
- package/extend/bajoTemplate/partial/_mail/mystuff-change-password.id.html +0 -0
- package/extend/bajoTemplate/partial/_mail/mystuff-reset-api-key.html +0 -0
- package/extend/bajoTemplate/partial/_mail/mystuff-reset-api-key.id.html +0 -0
- package/extend/bajoTemplate/partial/_mail/user-activation-success.html +0 -0
- package/extend/bajoTemplate/partial/_mail/user-activation-success.id.html +0 -0
- package/extend/bajoTemplate/partial/_mail/user-forgot-password-changed.html +0 -0
- package/extend/bajoTemplate/partial/_mail/user-forgot-password-changed.id.html +0 -0
- package/extend/bajoTemplate/partial/_mail/user-forgot-password-link.html +0 -0
- package/extend/bajoTemplate/partial/_mail/user-forgot-password-link.id.html +0 -0
- package/extend/bajoTemplate/partial/_mail/user-signup-success-active.html +0 -0
- package/extend/bajoTemplate/partial/_mail/user-signup-success-active.id.html +0 -0
- package/extend/bajoTemplate/partial/_mail/user-signup-success.html +0 -0
- package/extend/bajoTemplate/partial/_mail/user-signup-success.id.html +0 -0
- package/extend/bajoTemplate/partial/api-key-modal.html +0 -0
- package/extend/bajoTemplate/partial/app-launcher.html +0 -0
- package/extend/bajoTemplate/partial/help/contact-form/form.html +0 -0
- package/extend/bajoTemplate/partial/help/contact-form/success.html +0 -0
- package/extend/bajoTemplate/partial/help/trouble-tickets/add.html +0 -0
- package/extend/bajoTemplate/partial/help/trouble-tickets/details.html +0 -0
- package/extend/bajoTemplate/partial/help/trouble-tickets/list.html +0 -0
- package/extend/bajoTemplate/partial/layout/address.html +0 -0
- package/extend/bajoTemplate/partial/layout/breadcrumb.html +0 -0
- package/extend/bajoTemplate/partial/layout/footer.html +0 -0
- package/extend/bajoTemplate/partial/layout/more-info.html +0 -0
- package/extend/bajoTemplate/partial/layout/more-info.id.html +0 -0
- package/extend/bajoTemplate/partial/layout/navbar.html +0 -0
- package/extend/bajoTemplate/partial/layout/sidebar.html +0 -0
- package/extend/bajoTemplate/partial/layout/socmed.html +0 -0
- package/extend/bajoTemplate/partial/list-item/change-password.html +0 -0
- package/extend/bajoTemplate/partial/list-item/forgot-password.html +0 -0
- package/extend/bajoTemplate/partial/list-item/goto-home.html +0 -0
- package/extend/bajoTemplate/partial/list-item/member-links.html +0 -0
- package/extend/bajoTemplate/partial/list-item/oauth-signin.html +0 -0
- package/extend/bajoTemplate/partial/list-item/signin.html +0 -0
- package/extend/bajoTemplate/partial/list-item/signout.html +0 -0
- package/extend/bajoTemplate/partial/list-item/user-signup.html +0 -0
- package/extend/bajoTemplate/partial/list-item/your-profile.html +0 -0
- package/extend/bajoTemplate/partial/signin.html +0 -0
- package/extend/bajoTemplate/partial/signout.html +0 -0
- package/extend/bajoTemplate/partial/user/activation.html +0 -0
- package/extend/bajoTemplate/partial/user/forgot-password-nomail.id.md +0 -0
- package/extend/bajoTemplate/partial/user/forgot-password-nomail.md +0 -0
- package/extend/bajoTemplate/partial/user/forgot-password.html +0 -0
- package/extend/bajoTemplate/partial/user/fpl-invalid.html +0 -0
- package/extend/bajoTemplate/partial/user/fpl-invalid.id.md +0 -0
- package/extend/bajoTemplate/partial/user/fpl-invalid.md +0 -0
- package/extend/bajoTemplate/partial/user/fpl.html +0 -0
- package/extend/bajoTemplate/partial/user/signup/form.html +0 -0
- package/extend/bajoTemplate/partial/user/signup/success-mail.id.md +0 -0
- package/extend/bajoTemplate/partial/user/signup/success-mail.md +0 -0
- package/extend/bajoTemplate/partial/user/signup/success-nomail.id.md +0 -0
- package/extend/bajoTemplate/partial/user/signup/success-nomail.md +0 -0
- package/extend/bajoTemplate/partial/user/signup/success.html +0 -0
- package/extend/bajoTemplate/partial/your-stuff/change-password.html +0 -0
- package/extend/bajoTemplate/partial/your-stuff/profile/edit.html +0 -0
- package/extend/bajoTemplate/partial/your-stuff/profile/view.html +0 -0
- package/extend/bajoTemplate/partial/your-stuff/reset-api-key.html +0 -0
- package/extend/bajoTemplate/template/403.html +0 -0
- package/extend/bajoTemplate/template/_admin/reset-user-password.html +0 -0
- package/extend/bajoTemplate/template/_mail/help-contact-form.html +0 -0
- package/extend/bajoTemplate/template/_mail/mystuff-change-password.html +0 -0
- package/extend/bajoTemplate/template/_mail/mystuff-reset-api-key.html +0 -0
- package/extend/bajoTemplate/template/_mail/user-activation-success.html +0 -0
- package/extend/bajoTemplate/template/_mail/user-forgot-password-changed.html +0 -0
- package/extend/bajoTemplate/template/_mail/user-forgot-password-link.html +0 -0
- package/extend/bajoTemplate/template/_mail/user-signup-success-active.html +0 -0
- package/extend/bajoTemplate/template/_mail/user-signup-success.html +0 -0
- package/extend/bajoTemplate/template/help/contact-form/form.html +0 -0
- package/extend/bajoTemplate/template/help/contact-form/success.html +0 -0
- package/extend/bajoTemplate/template/help/trouble-tickets/add.html +0 -0
- package/extend/bajoTemplate/template/help/trouble-tickets/details.html +0 -0
- package/extend/bajoTemplate/template/help/trouble-tickets/list.html +0 -0
- package/extend/bajoTemplate/template/info/about-us.md +0 -0
- package/extend/bajoTemplate/template/info/cookie-policy.md +0 -0
- package/extend/bajoTemplate/template/info/privacy.md +0 -0
- package/extend/bajoTemplate/template/info/terms-conditions.md +0 -0
- package/extend/bajoTemplate/template/signin.html +0 -0
- package/extend/bajoTemplate/template/signout.html +0 -0
- package/extend/bajoTemplate/template/user/activation.html +0 -0
- package/extend/bajoTemplate/template/user/forgot-password.html +0 -0
- package/extend/bajoTemplate/template/user/fpl-invalid.html +0 -0
- package/extend/bajoTemplate/template/user/fpl.html +0 -0
- package/extend/bajoTemplate/template/user/signup/form.html +0 -0
- package/extend/bajoTemplate/template/user/signup/success.html +0 -0
- package/extend/bajoTemplate/template/your-stuff/change-password.html +0 -0
- package/extend/bajoTemplate/template/your-stuff/profile/edit.html +0 -0
- package/extend/bajoTemplate/template/your-stuff/profile/view.html +0 -0
- package/extend/bajoTemplate/template/your-stuff/reset-api-key.html +0 -0
- package/extend/dobo/feature/address.js +0 -0
- package/extend/dobo/feature/category.js +0 -0
- package/extend/dobo/feature/country.js +4 -2
- package/extend/dobo/feature/email.js +0 -0
- package/extend/dobo/feature/lat-lng.js +0 -0
- package/extend/dobo/feature/lat.js +0 -0
- package/extend/dobo/feature/lng.js +0 -0
- package/extend/dobo/feature/notes.js +0 -0
- package/extend/dobo/feature/person-in-charge.js +0 -0
- package/extend/dobo/feature/phone.js +0 -0
- package/extend/dobo/feature/site-id.js +0 -0
- package/extend/dobo/feature/site-ids.js +0 -0
- package/extend/dobo/feature/slug.js +0 -0
- package/extend/dobo/feature/social.js +0 -0
- package/extend/dobo/feature/status.js +0 -0
- package/extend/dobo/feature/team-id.js +0 -0
- package/extend/dobo/feature/team-ids.js +0 -0
- package/extend/dobo/feature/ts.js +0 -0
- package/extend/dobo/feature/url.js +0 -0
- package/extend/dobo/feature/user-id.js +0 -0
- package/extend/dobo/fixture/contact-form-cat.json +0 -0
- package/extend/dobo/fixture/site.json +0 -0
- package/extend/dobo/fixture/team-user.json +0 -0
- package/extend/dobo/fixture/team.json +0 -0
- package/extend/dobo/fixture/ticket-cat.json +0 -0
- package/extend/dobo/fixture/user.json +0 -0
- package/extend/dobo/model.js +303 -303
- package/extend/dobo/model.json +161 -161
- package/extend/masohiSocketIo/middleware/server/auth.js +0 -0
- package/extend/sumba/route/anonymous.json +5 -5
- package/extend/sumba/route/secure.json +8 -8
- package/extend/waibuBootstrap/theme/component/widget/nav-dropdown-user.js +0 -0
- package/extend/waibuDb/schema/anonymous-guard.js +0 -0
- package/extend/waibuDb/schema/attrib-guard.js +0 -0
- package/extend/waibuDb/schema/contact-form-cat.json +0 -0
- package/extend/waibuDb/schema/contact-form.json +0 -0
- package/extend/waibuDb/schema/download.js +0 -0
- package/extend/waibuDb/schema/model-guard.js +0 -0
- package/extend/waibuDb/schema/secure-guard.js +0 -0
- package/extend/waibuDb/schema/site-setting.js +0 -0
- package/extend/waibuDb/schema/site.js +0 -0
- package/extend/waibuDb/schema/team-setting.js +0 -0
- package/extend/waibuDb/schema/team-user.js +0 -0
- package/extend/waibuDb/schema/team.json +0 -0
- package/extend/waibuDb/schema/ticket-cat.json +0 -0
- package/extend/waibuDb/schema/ticket.js +0 -0
- package/extend/waibuDb/schema/user-setting.js +0 -0
- package/extend/waibuDb/schema/user.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/action-guard/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/anonymous-guard/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/attrib-guard/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/contact-form/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/contact-form-cat/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/download/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/query-guard/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/reset-user-password.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/secure-guard/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/site-setting/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/site.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/team/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/team-setting/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/team-user/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/ticket/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/ticket-cat/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/user/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/user-setting/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/x/cache/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/x/session/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/x/site/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/x/site-setting/@action.js +0 -0
- package/extend/waibuMpa/route/access-token.js +0 -0
- package/extend/waibuMpa/route/help/contact-form.js +0 -0
- package/extend/waibuMpa/route/help/trouble-tickets/add.js +0 -0
- package/extend/waibuMpa/route/help/trouble-tickets/details/@id.js +0 -0
- package/extend/waibuMpa/route/help/trouble-tickets/list.js +0 -0
- package/extend/waibuMpa/route/info/@item.js +0 -0
- package/extend/waibuMpa/route/signin.js +0 -0
- package/extend/waibuMpa/route/signout.js +0 -0
- package/extend/waibuMpa/route/user/activation.js +0 -0
- package/extend/waibuMpa/route/user/forgot-password/@fpl.js +0 -0
- package/extend/waibuMpa/route/user/forgot-password.js +0 -0
- package/extend/waibuMpa/route/user/signup.js +0 -0
- package/extend/waibuMpa/route/your-stuff/change-password.js +0 -0
- package/extend/waibuMpa/route/your-stuff/download/@action.js +0 -0
- package/extend/waibuMpa/route/your-stuff/download/get.js +0 -0
- package/extend/waibuMpa/route/your-stuff/profile/edit.js +0 -0
- package/extend/waibuMpa/route/your-stuff/profile.js +0 -0
- package/extend/waibuMpa/route/your-stuff/reset-api-key.js +0 -0
- package/extend/waibuRestApi/route/info/get.js +0 -0
- package/extend/waibuRestApi/route/manage/anonymous-guard/model-builder.json +0 -0
- package/extend/waibuRestApi/route/manage/secure-guard/model-builder.json +0 -0
- package/extend/waibuRestApi/route/manage/team/model-builder.json +0 -0
- package/extend/waibuRestApi/route/manage/ticket-cat/model-builder.json +0 -0
- package/extend/waibuRestApi/route/manage/user/model-builder.json +0 -0
- package/extend/waibuRestApi/route/user/access-token/@type/create.js +0 -0
- package/extend/waibuRestApi/route/user/api-key/get.js +0 -0
- package/extend/waibuRestApi/route/your-stuff/api-key/get.js +0 -0
- package/extend/waibuRestApi/route/your-stuff/api-key/update.js +0 -0
- package/extend/waibuRestApi/route/your-stuff/change-password/update.js +0 -0
- package/extend/waibuRestApi/route/your-stuff/profile/get.js +0 -0
- package/extend/waibuRestApi/route/your-stuff/profile/update.js +0 -0
- package/extend/waibuSocketIo/middleware/server/auth.js +0 -0
- package/extend/waibuStatic/asset/user-profile.png +0 -0
- package/index.js +2 -1
- package/lib/config.js +202 -202
- package/lib/constant.js +0 -0
- package/logo.png +0 -0
- package/package.json +1 -1
- package/wiki/CHANGES.md +395 -383
- package/wiki/CONFIG.md +0 -0
- package/wiki/CONTRIBUTING.md +0 -0
- package/wiki/DEV-GUIDE.md +0 -0
- package/wiki/ECOSYSTEM.md +0 -0
- package/wiki/GETTING-STARTED.md +0 -0
- package/wiki/USER-GUIDE.md +0 -0
package/extend/bajo/hook.js
CHANGED
|
@@ -1,300 +1,300 @@
|
|
|
1
|
-
import path from 'path'
|
|
2
|
-
|
|
3
|
-
async function hook () {
|
|
4
|
-
return [{
|
|
5
|
-
name: 'bajo.extend:afterReadConfig',
|
|
6
|
-
handler: async function afterReadConfig (file, result, options) {
|
|
7
|
-
const base = path.basename(file, path.extname(file))
|
|
8
|
-
// rewrite fixtures
|
|
9
|
-
if (!(base === 'route-guard' && Array.isArray(result) && file.includes('/fixture/'))) return
|
|
10
|
-
for (const res of result) {
|
|
11
|
-
if (res.path.slice(0, 2) === ':/') res.path = options.sourceNs + res.path
|
|
12
|
-
res.path = res.path.replaceAll('{ns}', options.sourceNs)
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}, {
|
|
16
|
-
name: ['dobo.sumbaAttribGuard:afterTransaction'],
|
|
17
|
-
handler: async function (action, ...args) {
|
|
18
|
-
if (!['createRecord', 'updateRecord', 'removeRecord'].includes(action)) return
|
|
19
|
-
await this.getAttribGuards(true)
|
|
20
|
-
}
|
|
21
|
-
}, {
|
|
22
|
-
name: 'dobo.sumbaContactForm:afterCreateRecord',
|
|
23
|
-
handler: async function afterCreateRecord (body, rec, options = {}) {
|
|
24
|
-
const { data } = rec
|
|
25
|
-
const { req } = options
|
|
26
|
-
const { get } = this.app.lib._
|
|
27
|
-
const t = get(req, 't', this.t)
|
|
28
|
-
const to = `${data.firstName} ${data.lastName} <${data.email}>`
|
|
29
|
-
let bcc
|
|
30
|
-
if (req.site) bcc = req.site.email
|
|
31
|
-
const subject = t('contactForm')
|
|
32
|
-
const payload = { to, bcc, subject, data }
|
|
33
|
-
await this.sendMail(
|
|
34
|
-
'sumba.template:/_mail/help-contact-form.html',
|
|
35
|
-
{ payload, options, source: this.ns }
|
|
36
|
-
)
|
|
37
|
-
}
|
|
38
|
-
}, {
|
|
39
|
-
level: 1000,
|
|
40
|
-
name: 'dobo.sumbaContactForm:beforeCreateRecord',
|
|
41
|
-
handler: async function (body, options = {}) {
|
|
42
|
-
const { get, isEmpty } = this.app.lib._
|
|
43
|
-
const user = get(options, 'req.user')
|
|
44
|
-
if (user) {
|
|
45
|
-
if (isEmpty(body.firstName)) body.firstName = user.firstName
|
|
46
|
-
if (isEmpty(body.lastName)) body.lastName = user.firstName
|
|
47
|
-
if (isEmpty(body.email)) body.email = user.email
|
|
48
|
-
}
|
|
49
|
-
if (isEmpty(body.category)) body.category = 'MISC'
|
|
50
|
-
options.checksumId = true
|
|
51
|
-
}
|
|
52
|
-
}, {
|
|
53
|
-
name: ['dobo.sumbaQueryGuard:afterTransaction'],
|
|
54
|
-
handler: async function (action, ...args) {
|
|
55
|
-
if (!['createRecord', 'updateRecord', 'removeRecord'].includes(action)) return
|
|
56
|
-
await this.getQueryGuards(true)
|
|
57
|
-
}
|
|
58
|
-
}, {
|
|
59
|
-
name: ['dobo.sumbaSecureGuard:afterTransaction'],
|
|
60
|
-
handler: async function (action, ...args) {
|
|
61
|
-
if (!['createRecord', 'updateRecord', 'removeRecord'].includes(action)) return
|
|
62
|
-
await this.getSecureGuards(true)
|
|
63
|
-
}
|
|
64
|
-
}, {
|
|
65
|
-
name: ['dobo.sumbaActionGuard:afterTransaction'],
|
|
66
|
-
handler: async function (action, ...args) {
|
|
67
|
-
if (!['createRecord', 'updateRecord', 'removeRecord'].includes(action)) return
|
|
68
|
-
await this.getActionGuards(true)
|
|
69
|
-
}
|
|
70
|
-
}, {
|
|
71
|
-
name: ['dobo.sumbaAnonymousGuard:afterTransaction'],
|
|
72
|
-
handler: async function (action, ...args) {
|
|
73
|
-
if (!['createRecord', 'updateRecord', 'removeRecord'].includes(action)) return
|
|
74
|
-
await this.getAnonymousGuards(true)
|
|
75
|
-
}
|
|
76
|
-
}, {
|
|
77
|
-
name: 'dobo.sumbaSite:afterCreateRecord',
|
|
78
|
-
handler: async function afterCreateRecord (body, result, options) {
|
|
79
|
-
const fixtures = await this.getAllFixtures(result.data.alias)
|
|
80
|
-
await this.createRefs(result.data, fixtures, options)
|
|
81
|
-
}
|
|
82
|
-
}, {
|
|
83
|
-
name: 'dobo.sumbaSite:afterRemoveRecord',
|
|
84
|
-
handler: async function afterRemoveRecord (id, result, options) {
|
|
85
|
-
await this.removeRefs(result.oldData, options)
|
|
86
|
-
await this.clearCacheSite(id, result)
|
|
87
|
-
}
|
|
88
|
-
}, {
|
|
89
|
-
name: 'dobo.sumbaSite:afterUpdateRecord',
|
|
90
|
-
handler: async function (id, input, result, opts) {
|
|
91
|
-
await this.clearCacheSite(id, result)
|
|
92
|
-
}
|
|
93
|
-
}, {
|
|
94
|
-
name: ['dobo.sumbaTeam:afterTransaction', 'dobo.sumbaSite:afterTransaction'],
|
|
95
|
-
handler: async function (action, ...args) {
|
|
96
|
-
if (!['createRecord', 'updateRecord', 'removeRecord'].includes(action)) return
|
|
97
|
-
await this.getSecureGuards(true)
|
|
98
|
-
await this.getQueryGuards(true)
|
|
99
|
-
await this.getActionGuards(true)
|
|
100
|
-
await this.getAttribGuards(true)
|
|
101
|
-
}
|
|
102
|
-
}, {
|
|
103
|
-
name: 'dobo.sumbaUser:afterCreateRecord',
|
|
104
|
-
handler: async function (body, rec, options = {}) {
|
|
105
|
-
const { data } = rec
|
|
106
|
-
const { req } = options
|
|
107
|
-
const { get } = this.app.lib._
|
|
108
|
-
const t = get(req, 't', this.t)
|
|
109
|
-
const to = `${data.firstName} ${data.lastName} <${data.email}>`
|
|
110
|
-
const subject = t('newUserSignup')
|
|
111
|
-
const payload = { to, subject, data }
|
|
112
|
-
await this.sendMail(
|
|
113
|
-
`sumba.template:/_mail/user-signup-success${data.status === 'ACTIVE' ? '-active' : ''}.html`,
|
|
114
|
-
{ payload, options, source: this.ns }
|
|
115
|
-
)
|
|
116
|
-
}
|
|
117
|
-
}, {
|
|
118
|
-
name: 'dobo.sumbaUser:afterRemoveRecord',
|
|
119
|
-
handler: async function (id, rec, options = {}) {
|
|
120
|
-
await this.clearCacheUser(id, rec)
|
|
121
|
-
}
|
|
122
|
-
}, {
|
|
123
|
-
name: 'dobo.sumbaUser:afterUpdateRecord',
|
|
124
|
-
handler: async function (id, body, rec, options = {}) {
|
|
125
|
-
const { data, oldData } = rec
|
|
126
|
-
const { req } = options
|
|
127
|
-
const { get } = this.app.lib._
|
|
128
|
-
const t = get(req, 't', this.t)
|
|
129
|
-
const to = `${data.firstName} ${data.lastName} <${data.email}>`
|
|
130
|
-
const source = this.ns
|
|
131
|
-
|
|
132
|
-
await this.clearCacheUser(id, rec)
|
|
133
|
-
|
|
134
|
-
let subject
|
|
135
|
-
const payload = { to, subject, data }
|
|
136
|
-
|
|
137
|
-
if (oldData.status === 'UNVERIFIED' && data.status === 'ACTIVE') {
|
|
138
|
-
payload.subject = t('userActivation')
|
|
139
|
-
await this.sendMail(
|
|
140
|
-
'sumba.template:/_mail/user-activation-success.html',
|
|
141
|
-
{ payload, options, source }
|
|
142
|
-
)
|
|
143
|
-
} else if (oldData.token !== data.token) {
|
|
144
|
-
payload.subject = t('resetApiKey')
|
|
145
|
-
await this.sendMail(
|
|
146
|
-
'sumba.template:/_mail/mystuff-reset-api-key.html',
|
|
147
|
-
{ payload, options, source }
|
|
148
|
-
)
|
|
149
|
-
} else if (body.password) {
|
|
150
|
-
payload.subject = t('changePassword')
|
|
151
|
-
await this.sendMail(
|
|
152
|
-
'sumba.template:/_mail/mystuff-change-password.html',
|
|
153
|
-
{ payload, options, source }
|
|
154
|
-
)
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}, {
|
|
158
|
-
level: 1000,
|
|
159
|
-
name: 'dobo.adapter:beforeAny',
|
|
160
|
-
handler: async function (model, options) {
|
|
161
|
-
await this.applyActionHook({ model, options })
|
|
162
|
-
}
|
|
163
|
-
}, {
|
|
164
|
-
level: 1000,
|
|
165
|
-
name: 'dobo.adapter:beforeCreateRecord',
|
|
166
|
-
handler: async function (model, body, options = {}) {
|
|
167
|
-
const { get } = this.app.lib._
|
|
168
|
-
const { isSet } = this.app.lib.aneka
|
|
169
|
-
const { req } = options
|
|
170
|
-
if (options.noAutoFilter || !req || get(req, 'routeOptions.config.xSite')) return
|
|
171
|
-
const item = { siteId: 'site.id', userId: 'user.id' }
|
|
172
|
-
for (const i in item) {
|
|
173
|
-
const rec = get(req, item[i])
|
|
174
|
-
const field = model.getProperty(i)
|
|
175
|
-
if (rec && field && !isSet(body[i])) body[i] = field.type === 'string' ? (rec + '') : rec
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}, {
|
|
179
|
-
level: 1000,
|
|
180
|
-
name: ['dobo.adapter:beforeFindRecord', 'dobo.adapter:beforeFindAllRecord', 'dobo.adapter:beforeCountRecord'],
|
|
181
|
-
handler: async function handler (model, filter, options = {}) {
|
|
182
|
-
const { isEmpty } = this.app.lib._
|
|
183
|
-
const { req = {} } = options
|
|
184
|
-
if (options.noAutoFilter || isEmpty(req) || isEmpty(req.site)) return
|
|
185
|
-
await this.rebuildFilter(model, filter, options)
|
|
186
|
-
}
|
|
187
|
-
}, {
|
|
188
|
-
level: 1000,
|
|
189
|
-
name: ['dobo.adapter:beforeGetRecord', 'dobo.adapter:beforeRemoveRecord', 'dobo.adapter:beforeUpdateRecord'],
|
|
190
|
-
handler: async function (model, id, options) {
|
|
191
|
-
await this.applyQueryHook(model, id, options)
|
|
192
|
-
}
|
|
193
|
-
}, {
|
|
194
|
-
name: 'waibuMpa.sumba:afterBuildLocals',
|
|
195
|
-
handler: async function (locals, req) {
|
|
196
|
-
const { routePath } = this.app.waibu
|
|
197
|
-
const items = []
|
|
198
|
-
if (req.user) {
|
|
199
|
-
items.push({ icon: 'person', 't:tooltip': 'yourProfile', href: routePath('sumba:/your-stuff/profile') })
|
|
200
|
-
items.push({ icon: 'key', 't:tooltip': 'changePassword', href: routePath('sumba:/your-stuff/change-password') })
|
|
201
|
-
items.push({ component: 'navItemSignout', 't:tooltip': 'signout', bottom: true })
|
|
202
|
-
} else {
|
|
203
|
-
items.push({ icon: 'signin', 't:tooltip': 'signin', href: routePath('sumba:/signin') })
|
|
204
|
-
items.push({ icon: 'key', 't:tooltip': 'forgotPassword', href: routePath('sumba:/user/forgot-password') })
|
|
205
|
-
items.push({ icon: 'personAdd', 't:tooltip': 'newUserSignup', href: routePath('sumba:/user/signup') })
|
|
206
|
-
}
|
|
207
|
-
items.push({ divider: true })
|
|
208
|
-
items.push({ icon: 'envelope', 't:tooltip': 'contactForm', href: routePath('sumba:/help/contact-form') })
|
|
209
|
-
items.push({ icon: 'chat', 't:tooltip': 'troubleTickets', href: routePath('sumba:/help/trouble-tickets') })
|
|
210
|
-
locals.sidebar = items
|
|
211
|
-
}
|
|
212
|
-
}, {
|
|
213
|
-
level: 10,
|
|
214
|
-
name: 'waibuMpa:preParsing',
|
|
215
|
-
handler: async function (req, reply) {
|
|
216
|
-
const secure = await this.checkUser(req, reply, 'waibuMpa')
|
|
217
|
-
if (!secure) return
|
|
218
|
-
await this.checkTeam(req, reply)
|
|
219
|
-
await this.checkXSite(req, reply)
|
|
220
|
-
}
|
|
221
|
-
}, {
|
|
222
|
-
level: 10,
|
|
223
|
-
name: 'waibuRestApi:preParsing',
|
|
224
|
-
handler: async function (req, reply) {
|
|
225
|
-
const secure = await this.checkUser(req, reply, 'waibuRestApi')
|
|
226
|
-
if (!secure) return
|
|
227
|
-
await this.checkTeam(req, reply)
|
|
228
|
-
await this.checkXSite(req, reply)
|
|
229
|
-
}
|
|
230
|
-
}, {
|
|
231
|
-
level: 10,
|
|
232
|
-
name: 'waibuStatic:preParsing',
|
|
233
|
-
handler: async function (req, reply) {
|
|
234
|
-
const secure = await this.checkUser(req, reply, 'waibuStatic')
|
|
235
|
-
if (!secure) return
|
|
236
|
-
await this.checkTeam(req, reply)
|
|
237
|
-
await this.checkXSite(req, reply)
|
|
238
|
-
}
|
|
239
|
-
}, {
|
|
240
|
-
name: 'waibu:afterAppBoot',
|
|
241
|
-
handler: async function () {
|
|
242
|
-
await this.getAnonymousGuards(true)
|
|
243
|
-
await this.getSecureGuards(true)
|
|
244
|
-
await this.getQueryGuards(true)
|
|
245
|
-
await this.getActionGuards(true)
|
|
246
|
-
await this.getAttribGuards(true)
|
|
247
|
-
}
|
|
248
|
-
}, {
|
|
249
|
-
name: 'waibu:afterCreateContext',
|
|
250
|
-
handler: async function (ctx) {
|
|
251
|
-
ctx.decorateRequest('user', null)
|
|
252
|
-
}
|
|
253
|
-
}, {
|
|
254
|
-
level: 10,
|
|
255
|
-
name: 'waibu:preParsing',
|
|
256
|
-
handler: async function (req, reply) {
|
|
257
|
-
const { get } = this.app.lib._
|
|
258
|
-
const { getHostname, checkRoute } = this.app.waibu
|
|
259
|
-
const { checkTheme, checkIconset } = this.app.waibuMpa
|
|
260
|
-
req.site = await this.getSite(getHostname(req))
|
|
261
|
-
await checkRoute(req)
|
|
262
|
-
if (get(req, 'routeOptions.config.webApp') !== 'waibuMpa') return
|
|
263
|
-
await checkTheme(req, reply)
|
|
264
|
-
await checkIconset(req, reply)
|
|
265
|
-
}
|
|
266
|
-
}, {
|
|
267
|
-
name: 'waibu:beforeStart',
|
|
268
|
-
handler: async function () {
|
|
269
|
-
if (this.app.sumba.config.multiSite.enabled) return
|
|
270
|
-
const routes = ['waibuAdmin:/site/x/site/*']
|
|
271
|
-
this.app.waibu.config.route.disabled.push(...routes)
|
|
272
|
-
}
|
|
273
|
-
}, {
|
|
274
|
-
name: 'dobo.sumbaDownload:afterRemoveRecord',
|
|
275
|
-
handler: async function (id, rec, options = {}) {
|
|
276
|
-
const { fs } = this.app.lib
|
|
277
|
-
try {
|
|
278
|
-
await fs.remove(rec.oldData.jobQueue.result.file)
|
|
279
|
-
} catch (err) {
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
}, {
|
|
283
|
-
level: 1000,
|
|
284
|
-
name: 'waibuMpa:afterBuildLocals',
|
|
285
|
-
handler: async function (locals, req, opts = {}) {
|
|
286
|
-
const { normalizeMenuItems } = this.app.waibuMpa
|
|
287
|
-
const { pullAt } = this.app.lib._
|
|
288
|
-
locals.sidebar = await normalizeMenuItems(locals.sidebar, req)
|
|
289
|
-
const deleted = []
|
|
290
|
-
for (const [index, menu] of locals.menu.pages.entries()) {
|
|
291
|
-
if (!menu.children) continue
|
|
292
|
-
menu.children = await normalizeMenuItems(menu.children, req)
|
|
293
|
-
if (menu.children.length === 0) deleted.push(index)
|
|
294
|
-
}
|
|
295
|
-
pullAt(locals.menu.pages, deleted)
|
|
296
|
-
}
|
|
297
|
-
}]
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
export default hook
|
|
1
|
+
import path from 'path'
|
|
2
|
+
|
|
3
|
+
async function hook () {
|
|
4
|
+
return [{
|
|
5
|
+
name: 'bajo.extend:afterReadConfig',
|
|
6
|
+
handler: async function afterReadConfig (file, result, options) {
|
|
7
|
+
const base = path.basename(file, path.extname(file))
|
|
8
|
+
// rewrite fixtures
|
|
9
|
+
if (!(base === 'route-guard' && Array.isArray(result) && file.includes('/fixture/'))) return
|
|
10
|
+
for (const res of result) {
|
|
11
|
+
if (res.path.slice(0, 2) === ':/') res.path = options.sourceNs + res.path
|
|
12
|
+
res.path = res.path.replaceAll('{ns}', options.sourceNs)
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}, {
|
|
16
|
+
name: ['dobo.sumbaAttribGuard:afterTransaction'],
|
|
17
|
+
handler: async function (action, ...args) {
|
|
18
|
+
if (!['createRecord', 'updateRecord', 'removeRecord'].includes(action)) return
|
|
19
|
+
await this.getAttribGuards(true)
|
|
20
|
+
}
|
|
21
|
+
}, {
|
|
22
|
+
name: 'dobo.sumbaContactForm:afterCreateRecord',
|
|
23
|
+
handler: async function afterCreateRecord (body, rec, options = {}) {
|
|
24
|
+
const { data } = rec
|
|
25
|
+
const { req } = options
|
|
26
|
+
const { get } = this.app.lib._
|
|
27
|
+
const t = get(req, 't', this.t)
|
|
28
|
+
const to = `${data.firstName} ${data.lastName} <${data.email}>`
|
|
29
|
+
let bcc
|
|
30
|
+
if (req.site) bcc = req.site.email
|
|
31
|
+
const subject = t('contactForm')
|
|
32
|
+
const payload = { to, bcc, subject, data }
|
|
33
|
+
await this.sendMail(
|
|
34
|
+
'sumba.template:/_mail/help-contact-form.html',
|
|
35
|
+
{ payload, options, source: this.ns }
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
}, {
|
|
39
|
+
level: 1000,
|
|
40
|
+
name: 'dobo.sumbaContactForm:beforeCreateRecord',
|
|
41
|
+
handler: async function (body, options = {}) {
|
|
42
|
+
const { get, isEmpty } = this.app.lib._
|
|
43
|
+
const user = get(options, 'req.user')
|
|
44
|
+
if (user) {
|
|
45
|
+
if (isEmpty(body.firstName)) body.firstName = user.firstName
|
|
46
|
+
if (isEmpty(body.lastName)) body.lastName = user.firstName
|
|
47
|
+
if (isEmpty(body.email)) body.email = user.email
|
|
48
|
+
}
|
|
49
|
+
if (isEmpty(body.category)) body.category = 'MISC'
|
|
50
|
+
options.checksumId = true
|
|
51
|
+
}
|
|
52
|
+
}, {
|
|
53
|
+
name: ['dobo.sumbaQueryGuard:afterTransaction'],
|
|
54
|
+
handler: async function (action, ...args) {
|
|
55
|
+
if (!['createRecord', 'updateRecord', 'removeRecord'].includes(action)) return
|
|
56
|
+
await this.getQueryGuards(true)
|
|
57
|
+
}
|
|
58
|
+
}, {
|
|
59
|
+
name: ['dobo.sumbaSecureGuard:afterTransaction'],
|
|
60
|
+
handler: async function (action, ...args) {
|
|
61
|
+
if (!['createRecord', 'updateRecord', 'removeRecord'].includes(action)) return
|
|
62
|
+
await this.getSecureGuards(true)
|
|
63
|
+
}
|
|
64
|
+
}, {
|
|
65
|
+
name: ['dobo.sumbaActionGuard:afterTransaction'],
|
|
66
|
+
handler: async function (action, ...args) {
|
|
67
|
+
if (!['createRecord', 'updateRecord', 'removeRecord'].includes(action)) return
|
|
68
|
+
await this.getActionGuards(true)
|
|
69
|
+
}
|
|
70
|
+
}, {
|
|
71
|
+
name: ['dobo.sumbaAnonymousGuard:afterTransaction'],
|
|
72
|
+
handler: async function (action, ...args) {
|
|
73
|
+
if (!['createRecord', 'updateRecord', 'removeRecord'].includes(action)) return
|
|
74
|
+
await this.getAnonymousGuards(true)
|
|
75
|
+
}
|
|
76
|
+
}, {
|
|
77
|
+
name: 'dobo.sumbaSite:afterCreateRecord',
|
|
78
|
+
handler: async function afterCreateRecord (body, result, options) {
|
|
79
|
+
const fixtures = await this.getAllFixtures(result.data.alias)
|
|
80
|
+
await this.createRefs(result.data, fixtures, options)
|
|
81
|
+
}
|
|
82
|
+
}, {
|
|
83
|
+
name: 'dobo.sumbaSite:afterRemoveRecord',
|
|
84
|
+
handler: async function afterRemoveRecord (id, result, options) {
|
|
85
|
+
await this.removeRefs(result.oldData, options)
|
|
86
|
+
await this.clearCacheSite(id, result)
|
|
87
|
+
}
|
|
88
|
+
}, {
|
|
89
|
+
name: 'dobo.sumbaSite:afterUpdateRecord',
|
|
90
|
+
handler: async function (id, input, result, opts) {
|
|
91
|
+
await this.clearCacheSite(id, result)
|
|
92
|
+
}
|
|
93
|
+
}, {
|
|
94
|
+
name: ['dobo.sumbaTeam:afterTransaction', 'dobo.sumbaSite:afterTransaction'],
|
|
95
|
+
handler: async function (action, ...args) {
|
|
96
|
+
if (!['createRecord', 'updateRecord', 'removeRecord'].includes(action)) return
|
|
97
|
+
await this.getSecureGuards(true)
|
|
98
|
+
await this.getQueryGuards(true)
|
|
99
|
+
await this.getActionGuards(true)
|
|
100
|
+
await this.getAttribGuards(true)
|
|
101
|
+
}
|
|
102
|
+
}, {
|
|
103
|
+
name: 'dobo.sumbaUser:afterCreateRecord',
|
|
104
|
+
handler: async function (body, rec, options = {}) {
|
|
105
|
+
const { data } = rec
|
|
106
|
+
const { req } = options
|
|
107
|
+
const { get } = this.app.lib._
|
|
108
|
+
const t = get(req, 't', this.t)
|
|
109
|
+
const to = `${data.firstName} ${data.lastName} <${data.email}>`
|
|
110
|
+
const subject = t('newUserSignup')
|
|
111
|
+
const payload = { to, subject, data }
|
|
112
|
+
await this.sendMail(
|
|
113
|
+
`sumba.template:/_mail/user-signup-success${data.status === 'ACTIVE' ? '-active' : ''}.html`,
|
|
114
|
+
{ payload, options, source: this.ns }
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
}, {
|
|
118
|
+
name: 'dobo.sumbaUser:afterRemoveRecord',
|
|
119
|
+
handler: async function (id, rec, options = {}) {
|
|
120
|
+
await this.clearCacheUser(id, rec)
|
|
121
|
+
}
|
|
122
|
+
}, {
|
|
123
|
+
name: 'dobo.sumbaUser:afterUpdateRecord',
|
|
124
|
+
handler: async function (id, body, rec, options = {}) {
|
|
125
|
+
const { data, oldData } = rec
|
|
126
|
+
const { req } = options
|
|
127
|
+
const { get } = this.app.lib._
|
|
128
|
+
const t = get(req, 't', this.t)
|
|
129
|
+
const to = `${data.firstName} ${data.lastName} <${data.email}>`
|
|
130
|
+
const source = this.ns
|
|
131
|
+
|
|
132
|
+
await this.clearCacheUser(id, rec)
|
|
133
|
+
|
|
134
|
+
let subject
|
|
135
|
+
const payload = { to, subject, data }
|
|
136
|
+
|
|
137
|
+
if (oldData.status === 'UNVERIFIED' && data.status === 'ACTIVE') {
|
|
138
|
+
payload.subject = t('userActivation')
|
|
139
|
+
await this.sendMail(
|
|
140
|
+
'sumba.template:/_mail/user-activation-success.html',
|
|
141
|
+
{ payload, options, source }
|
|
142
|
+
)
|
|
143
|
+
} else if (oldData.token !== data.token) {
|
|
144
|
+
payload.subject = t('resetApiKey')
|
|
145
|
+
await this.sendMail(
|
|
146
|
+
'sumba.template:/_mail/mystuff-reset-api-key.html',
|
|
147
|
+
{ payload, options, source }
|
|
148
|
+
)
|
|
149
|
+
} else if (body.password) {
|
|
150
|
+
payload.subject = t('changePassword')
|
|
151
|
+
await this.sendMail(
|
|
152
|
+
'sumba.template:/_mail/mystuff-change-password.html',
|
|
153
|
+
{ payload, options, source }
|
|
154
|
+
)
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}, {
|
|
158
|
+
level: 1000,
|
|
159
|
+
name: 'dobo.adapter:beforeAny',
|
|
160
|
+
handler: async function (model, options) {
|
|
161
|
+
await this.applyActionHook({ model, options })
|
|
162
|
+
}
|
|
163
|
+
}, {
|
|
164
|
+
level: 1000,
|
|
165
|
+
name: 'dobo.adapter:beforeCreateRecord',
|
|
166
|
+
handler: async function (model, body, options = {}) {
|
|
167
|
+
const { get } = this.app.lib._
|
|
168
|
+
const { isSet } = this.app.lib.aneka
|
|
169
|
+
const { req } = options
|
|
170
|
+
if (options.noAutoFilter || !req || get(req, 'routeOptions.config.xSite')) return
|
|
171
|
+
const item = { siteId: 'site.id', userId: 'user.id' }
|
|
172
|
+
for (const i in item) {
|
|
173
|
+
const rec = get(req, item[i])
|
|
174
|
+
const field = model.getProperty(i)
|
|
175
|
+
if (rec && field && !isSet(body[i])) body[i] = field.type === 'string' ? (rec + '') : rec
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}, {
|
|
179
|
+
level: 1000,
|
|
180
|
+
name: ['dobo.adapter:beforeFindRecord', 'dobo.adapter:beforeFindAllRecord', 'dobo.adapter:beforeCountRecord'],
|
|
181
|
+
handler: async function handler (model, filter, options = {}) {
|
|
182
|
+
const { isEmpty } = this.app.lib._
|
|
183
|
+
const { req = {} } = options
|
|
184
|
+
if (options.noAutoFilter || isEmpty(req) || isEmpty(req.site)) return
|
|
185
|
+
await this.rebuildFilter(model, filter, options)
|
|
186
|
+
}
|
|
187
|
+
}, {
|
|
188
|
+
level: 1000,
|
|
189
|
+
name: ['dobo.adapter:beforeGetRecord', 'dobo.adapter:beforeRemoveRecord', 'dobo.adapter:beforeUpdateRecord'],
|
|
190
|
+
handler: async function (model, id, options) {
|
|
191
|
+
await this.applyQueryHook(model, id, options)
|
|
192
|
+
}
|
|
193
|
+
}, {
|
|
194
|
+
name: 'waibuMpa.sumba:afterBuildLocals',
|
|
195
|
+
handler: async function (locals, req) {
|
|
196
|
+
const { routePath } = this.app.waibu
|
|
197
|
+
const items = []
|
|
198
|
+
if (req.user) {
|
|
199
|
+
items.push({ icon: 'person', 't:tooltip': 'yourProfile', href: routePath('sumba:/your-stuff/profile') })
|
|
200
|
+
items.push({ icon: 'key', 't:tooltip': 'changePassword', href: routePath('sumba:/your-stuff/change-password') })
|
|
201
|
+
items.push({ component: 'navItemSignout', 't:tooltip': 'signout', bottom: true })
|
|
202
|
+
} else {
|
|
203
|
+
items.push({ icon: 'signin', 't:tooltip': 'signin', href: routePath('sumba:/signin') })
|
|
204
|
+
items.push({ icon: 'key', 't:tooltip': 'forgotPassword', href: routePath('sumba:/user/forgot-password') })
|
|
205
|
+
items.push({ icon: 'personAdd', 't:tooltip': 'newUserSignup', href: routePath('sumba:/user/signup') })
|
|
206
|
+
}
|
|
207
|
+
items.push({ divider: true })
|
|
208
|
+
items.push({ icon: 'envelope', 't:tooltip': 'contactForm', href: routePath('sumba:/help/contact-form') })
|
|
209
|
+
items.push({ icon: 'chat', 't:tooltip': 'troubleTickets', href: routePath('sumba:/help/trouble-tickets') })
|
|
210
|
+
locals.sidebar = items
|
|
211
|
+
}
|
|
212
|
+
}, {
|
|
213
|
+
level: 10,
|
|
214
|
+
name: 'waibuMpa:preParsing',
|
|
215
|
+
handler: async function (req, reply) {
|
|
216
|
+
const secure = await this.checkUser(req, reply, 'waibuMpa')
|
|
217
|
+
if (!secure) return
|
|
218
|
+
await this.checkTeam(req, reply)
|
|
219
|
+
await this.checkXSite(req, reply)
|
|
220
|
+
}
|
|
221
|
+
}, {
|
|
222
|
+
level: 10,
|
|
223
|
+
name: 'waibuRestApi:preParsing',
|
|
224
|
+
handler: async function (req, reply) {
|
|
225
|
+
const secure = await this.checkUser(req, reply, 'waibuRestApi')
|
|
226
|
+
if (!secure) return
|
|
227
|
+
await this.checkTeam(req, reply)
|
|
228
|
+
await this.checkXSite(req, reply)
|
|
229
|
+
}
|
|
230
|
+
}, {
|
|
231
|
+
level: 10,
|
|
232
|
+
name: 'waibuStatic:preParsing',
|
|
233
|
+
handler: async function (req, reply) {
|
|
234
|
+
const secure = await this.checkUser(req, reply, 'waibuStatic')
|
|
235
|
+
if (!secure) return
|
|
236
|
+
await this.checkTeam(req, reply)
|
|
237
|
+
await this.checkXSite(req, reply)
|
|
238
|
+
}
|
|
239
|
+
}, {
|
|
240
|
+
name: 'waibu:afterAppBoot',
|
|
241
|
+
handler: async function () {
|
|
242
|
+
await this.getAnonymousGuards(true)
|
|
243
|
+
await this.getSecureGuards(true)
|
|
244
|
+
await this.getQueryGuards(true)
|
|
245
|
+
await this.getActionGuards(true)
|
|
246
|
+
await this.getAttribGuards(true)
|
|
247
|
+
}
|
|
248
|
+
}, {
|
|
249
|
+
name: 'waibu:afterCreateContext',
|
|
250
|
+
handler: async function (ctx) {
|
|
251
|
+
ctx.decorateRequest('user', null)
|
|
252
|
+
}
|
|
253
|
+
}, {
|
|
254
|
+
level: 10,
|
|
255
|
+
name: 'waibu:preParsing',
|
|
256
|
+
handler: async function (req, reply) {
|
|
257
|
+
const { get } = this.app.lib._
|
|
258
|
+
const { getHostname, checkRoute } = this.app.waibu
|
|
259
|
+
const { checkTheme, checkIconset } = this.app.waibuMpa
|
|
260
|
+
req.site = await this.getSite(getHostname(req))
|
|
261
|
+
await checkRoute(req)
|
|
262
|
+
if (get(req, 'routeOptions.config.webApp') !== 'waibuMpa') return
|
|
263
|
+
await checkTheme(req, reply)
|
|
264
|
+
await checkIconset(req, reply)
|
|
265
|
+
}
|
|
266
|
+
}, {
|
|
267
|
+
name: 'waibu:beforeStart',
|
|
268
|
+
handler: async function () {
|
|
269
|
+
if (this.app.sumba.config.multiSite.enabled) return
|
|
270
|
+
const routes = ['waibuAdmin:/site/x/site/*']
|
|
271
|
+
this.app.waibu.config.route.disabled.push(...routes)
|
|
272
|
+
}
|
|
273
|
+
}, {
|
|
274
|
+
name: 'dobo.sumbaDownload:afterRemoveRecord',
|
|
275
|
+
handler: async function (id, rec, options = {}) {
|
|
276
|
+
const { fs } = this.app.lib
|
|
277
|
+
try {
|
|
278
|
+
await fs.remove(rec.oldData.jobQueue.result.file)
|
|
279
|
+
} catch (err) {
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}, {
|
|
283
|
+
level: 1000,
|
|
284
|
+
name: 'waibuMpa:afterBuildLocals',
|
|
285
|
+
handler: async function (locals, req, opts = {}) {
|
|
286
|
+
const { normalizeMenuItems } = this.app.waibuMpa
|
|
287
|
+
const { pullAt } = this.app.lib._
|
|
288
|
+
locals.sidebar = await normalizeMenuItems(locals.sidebar, req)
|
|
289
|
+
const deleted = []
|
|
290
|
+
for (const [index, menu] of locals.menu.pages.entries()) {
|
|
291
|
+
if (!menu.children) continue
|
|
292
|
+
menu.children = await normalizeMenuItems(menu.children, req)
|
|
293
|
+
if (menu.children.length === 0) deleted.push(index)
|
|
294
|
+
}
|
|
295
|
+
pullAt(locals.menu.pages, deleted)
|
|
296
|
+
}
|
|
297
|
+
}]
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export default hook
|
|
File without changes
|
package/extend/bajo/intl/id.json
CHANGED
|
File without changes
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
async function createSite (path, ...args) {
|
|
2
|
-
const { createNewSite } = this.app.sumba
|
|
3
|
-
const { importPkg } = this.app.bajo
|
|
4
|
-
const confirm = await importPkg('bajoCli:@inquirer/confirm')
|
|
5
|
-
const [alias, hostname] = args
|
|
6
|
-
if (!alias) this.print.fatal('aliasRequired')
|
|
7
|
-
const answer = await confirm({ message: this.print.buildText('aboutToCreateSite%s', alias), default: false })
|
|
8
|
-
if (!answer) {
|
|
9
|
-
this.print.fail('aborted')
|
|
10
|
-
this.app.exit()
|
|
11
|
-
}
|
|
12
|
-
await this.app.dobo.start()
|
|
13
|
-
try {
|
|
14
|
-
await createNewSite(alias, hostname, true)
|
|
15
|
-
} catch (err) {
|
|
16
|
-
this.print.fatal(err)
|
|
17
|
-
}
|
|
18
|
-
this.app.exit()
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export default createSite
|
|
1
|
+
async function createSite (path, ...args) {
|
|
2
|
+
const { createNewSite } = this.app.sumba
|
|
3
|
+
const { importPkg } = this.app.bajo
|
|
4
|
+
const confirm = await importPkg('bajoCli:@inquirer/confirm')
|
|
5
|
+
const [alias, hostname] = args
|
|
6
|
+
if (!alias) this.print.fatal('aliasRequired')
|
|
7
|
+
const answer = await confirm({ message: this.print.buildText('aboutToCreateSite%s', alias), default: false })
|
|
8
|
+
if (!answer) {
|
|
9
|
+
this.print.fail('aborted')
|
|
10
|
+
this.app.exit()
|
|
11
|
+
}
|
|
12
|
+
await this.app.dobo.start()
|
|
13
|
+
try {
|
|
14
|
+
await createNewSite(alias, hostname, true)
|
|
15
|
+
} catch (err) {
|
|
16
|
+
this.print.fatal(err)
|
|
17
|
+
}
|
|
18
|
+
this.app.exit()
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default createSite
|