sumba 1.0.11 → 1.0.12
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/lib/check-site-id.js
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
async function mergeSetting (req) {
|
|
2
|
-
const {
|
|
3
|
-
const { getPlugin, pascalCase } = this.app.bajo
|
|
2
|
+
const { trim } = this.app.bajo.lib._
|
|
4
3
|
const { recordFind } = this.app.dobo
|
|
5
4
|
const setting = {}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
const query = {
|
|
6
|
+
ns: { $in: this.app.bajo.pluginNames },
|
|
7
|
+
siteId: req.site.id
|
|
8
|
+
}
|
|
9
|
+
const items = await recordFind('SumbaSiteSetting', { query, limit: 200 })
|
|
10
|
+
for (const item of items) {
|
|
11
|
+
setting[item.ns] = setting[item.ns] ?? {}
|
|
12
|
+
let value = trim([item.value] ?? '')
|
|
13
|
+
if (['[', '{'].includes(value[0])) value = JSON.parse(value)
|
|
14
|
+
else if (Number(value)) value = Number(value)
|
|
15
|
+
else if (['true', 'false'].includes(value)) value = value === 'true'
|
|
16
|
+
setting[item.ns][item.key] = value
|
|
14
17
|
}
|
|
15
18
|
req.site.setting = setting
|
|
16
19
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<c:page-start title="<%= page.fullTitle %>" />
|
|
2
|
+
<c:main flex>
|
|
3
|
+
<c:include resource="sumba.partial:/layout/sidebar.html" />
|
|
4
|
+
<c:div flex="fill column">
|
|
5
|
+
<c:include resource="sumba.partial:/layout/navbar.html" />
|
|
6
|
+
<c:include resource="sumba.partial:/layout/breadcrumb.html" />
|
|
7
|
+
<c:container margin="start-0 bottom-5" padding="x-3">
|
|
8
|
+
<c:div style="max-width: 992px;">
|
|
9
|
+
<!-- body -->
|
|
10
|
+
<c:include resource="sumba.partial:/layout/footer.html" />
|
|
11
|
+
</c:div>
|
|
12
|
+
</c:container>
|
|
13
|
+
</c:div>
|
|
14
|
+
</c:main>
|
|
15
|
+
<c:page-end back-to-top/>
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
level: 1,
|
|
3
3
|
handler: async function (socket) {
|
|
4
|
-
const { importPkg } = this.app.bajo
|
|
5
4
|
const { merge } = this.app.bajo.lib._
|
|
6
5
|
const { recordGet } = this.app.dobo
|
|
6
|
+
const { getSessionId } = this.app.waibuMpa
|
|
7
7
|
|
|
8
|
-
const fcookie = await importPkg('waibu:@fastify/cookie')
|
|
9
8
|
if (socket.handshake) {
|
|
10
|
-
const
|
|
11
|
-
const key = this.config.auth.common.session.cookieName
|
|
12
|
-
const sessionId = (cookie[key] ?? '').split('.')[0]
|
|
9
|
+
const sessionId = await getSessionId(socket.request.headers.cookie)
|
|
13
10
|
const resp = await recordGet('WbmpaSession', sessionId, { noHook: true, thrownNotFound: false })
|
|
14
11
|
if (resp) {
|
|
15
12
|
const session = JSON.parse(resp.session) ?? {}
|