@abtnode/util 1.16.43-beta-20250427-232837-e671de06 → 1.16.43-beta-20250429-130236-269254ff
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/blocklet.js +13 -0
- package/lib/logo-middleware.js +8 -0
- package/lib/security.js +6 -2
- package/package.json +5 -5
package/lib/blocklet.js
CHANGED
|
@@ -56,9 +56,15 @@ const formatLogoURL = (logoURL, defaultLogoURL, height = 80) => {
|
|
|
56
56
|
|
|
57
57
|
const getBlockletLogos = (blocklet) => {
|
|
58
58
|
let appLogo = blocklet.environments?.find((x) => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_SQUARE)?.value;
|
|
59
|
+
let appLogoDark = blocklet.environments?.find(
|
|
60
|
+
(x) => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_SQUARE_DARK
|
|
61
|
+
)?.value;
|
|
59
62
|
let appLogoRect = blocklet.environments?.find(
|
|
60
63
|
(x) => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_RECT
|
|
61
64
|
)?.value;
|
|
65
|
+
let appLogoRectDark = blocklet.environments?.find(
|
|
66
|
+
(x) => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_RECT_DARK
|
|
67
|
+
)?.value;
|
|
62
68
|
let appSplashPortrait = blocklet.environments?.find(
|
|
63
69
|
(x) => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPLASH_PORTRAIT
|
|
64
70
|
)?.value;
|
|
@@ -67,7 +73,12 @@ const getBlockletLogos = (blocklet) => {
|
|
|
67
73
|
)?.value;
|
|
68
74
|
|
|
69
75
|
appLogo = formatLogoURL(appLogo, `http://127.0.0.1${WELLKNOWN_SERVICE_PATH_PREFIX}/blocklet/logo`);
|
|
76
|
+
appLogoDark = formatLogoURL(appLogoDark, `http://127.0.0.1${WELLKNOWN_SERVICE_PATH_PREFIX}/blocklet/logo-dark`);
|
|
70
77
|
appLogoRect = formatLogoURL(appLogoRect, `http://127.0.0.1${WELLKNOWN_SERVICE_PATH_PREFIX}/blocklet/logo-rect`);
|
|
78
|
+
appLogoRectDark = formatLogoURL(
|
|
79
|
+
appLogoRectDark,
|
|
80
|
+
`http://127.0.0.1${WELLKNOWN_SERVICE_PATH_PREFIX}/blocklet/logo-rect-dark`
|
|
81
|
+
);
|
|
71
82
|
appSplashPortrait = formatLogoURL(
|
|
72
83
|
appSplashPortrait,
|
|
73
84
|
`http://127.0.0.1${WELLKNOWN_SERVICE_PATH_PREFIX}/blocklet/splash/portrait`,
|
|
@@ -82,6 +93,8 @@ const getBlockletLogos = (blocklet) => {
|
|
|
82
93
|
return {
|
|
83
94
|
appLogo: appLogo || joinURL(WELLKNOWN_SERVICE_PATH_PREFIX, '/blocklet/logo?imageFilter=convert&f=png&h=80'),
|
|
84
95
|
appLogoRect: appLogoRect || '',
|
|
96
|
+
appLogoDark: appLogoDark || '',
|
|
97
|
+
appLogoRectDark: appLogoRectDark || '',
|
|
85
98
|
appSplashPortrait,
|
|
86
99
|
appSplashLandscape,
|
|
87
100
|
};
|
package/lib/logo-middleware.js
CHANGED
|
@@ -120,6 +120,9 @@ const ensureCustomLogo = (req, res, next, logoKey) => {
|
|
|
120
120
|
const ensureCustomSquareLogo = (req, res, next) => {
|
|
121
121
|
return ensureCustomLogo(req, res, next, 'BLOCKLET_APP_LOGO_SQUARE');
|
|
122
122
|
};
|
|
123
|
+
const ensureCustomSquareDarkLogo = (req, res, next) => {
|
|
124
|
+
return ensureCustomLogo(req, res, next, 'BLOCKLET_APP_LOGO_SQUARE_DARK');
|
|
125
|
+
};
|
|
123
126
|
|
|
124
127
|
/**
|
|
125
128
|
* @param {import('express').Request & {blocklet: any, sendOptions: any}} req
|
|
@@ -130,6 +133,9 @@ const ensureCustomSquareLogo = (req, res, next) => {
|
|
|
130
133
|
const ensureCustomRectLogo = (req, res, next) => {
|
|
131
134
|
return ensureCustomLogo(req, res, next, 'BLOCKLET_APP_LOGO_RECT');
|
|
132
135
|
};
|
|
136
|
+
const ensureCustomRectDarkLogo = (req, res, next) => {
|
|
137
|
+
return ensureCustomLogo(req, res, next, 'BLOCKLET_APP_LOGO_RECT_DARK');
|
|
138
|
+
};
|
|
133
139
|
|
|
134
140
|
const ensureCustomSplashPortrait = (req, res, next) => {
|
|
135
141
|
return ensureCustomLogo(req, res, next, 'BLOCKLET_APP_SPLASH_PORTRAIT');
|
|
@@ -276,9 +282,11 @@ module.exports = {
|
|
|
276
282
|
attachSendLogoContext,
|
|
277
283
|
ensureBlockletExist,
|
|
278
284
|
ensureCustomSquareLogo,
|
|
285
|
+
ensureCustomSquareDarkLogo,
|
|
279
286
|
ensureBundleLogo,
|
|
280
287
|
ensureCustomFavicon,
|
|
281
288
|
ensureCustomRectLogo,
|
|
289
|
+
ensureCustomRectDarkLogo,
|
|
282
290
|
ensureCustomSplashPortrait,
|
|
283
291
|
ensureCustomSplashLandscape,
|
|
284
292
|
ensureCustomOgImage,
|
package/lib/security.js
CHANGED
|
@@ -190,7 +190,7 @@ function patchValueIntoDirectives(directives, key, value) {
|
|
|
190
190
|
return [...new Set(currentValue)];
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
async function patchResponseHeader(rawConfig, { node, blocklet }) {
|
|
193
|
+
async function patchResponseHeader(rawConfig, { node, blocklet, trustedDomains = [] }) {
|
|
194
194
|
if (!rawConfig?.contentSecurityPolicy?.directives) {
|
|
195
195
|
return rawConfig;
|
|
196
196
|
}
|
|
@@ -261,7 +261,11 @@ async function patchResponseHeader(rawConfig, { node, blocklet }) {
|
|
|
261
261
|
config.contentSecurityPolicy.directives['frame-ancestors'] = patchValueIntoDirectives(
|
|
262
262
|
config.contentSecurityPolicy.directives,
|
|
263
263
|
'frame-ancestors',
|
|
264
|
-
[
|
|
264
|
+
[
|
|
265
|
+
"'self'",
|
|
266
|
+
...(blocklet.settings.userSpaceHosts || []).map((x) => `https://${x}`),
|
|
267
|
+
...trustedDomains.filter(Boolean).map((x) => `http://${x}`),
|
|
268
|
+
]
|
|
265
269
|
);
|
|
266
270
|
|
|
267
271
|
return config;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.43-beta-
|
|
6
|
+
"version": "1.16.43-beta-20250429-130236-269254ff",
|
|
7
7
|
"description": "ArcBlock's JavaScript utility",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
"author": "polunzh <polunzh@gmail.com> (http://github.com/polunzh)",
|
|
19
19
|
"license": "Apache-2.0",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@abtnode/constant": "1.16.43-beta-
|
|
21
|
+
"@abtnode/constant": "1.16.43-beta-20250429-130236-269254ff",
|
|
22
22
|
"@arcblock/did": "^1.20.2",
|
|
23
23
|
"@arcblock/pm2": "^5.4.0",
|
|
24
|
-
"@blocklet/constant": "1.16.43-beta-
|
|
25
|
-
"@blocklet/meta": "1.16.43-beta-
|
|
24
|
+
"@blocklet/constant": "1.16.43-beta-20250429-130236-269254ff",
|
|
25
|
+
"@blocklet/meta": "1.16.43-beta-20250429-130236-269254ff",
|
|
26
26
|
"@ocap/client": "1.20.2",
|
|
27
27
|
"@ocap/mcrypto": "1.20.2",
|
|
28
28
|
"@ocap/util": "1.20.2",
|
|
@@ -86,5 +86,5 @@
|
|
|
86
86
|
"fs-extra": "^11.2.0",
|
|
87
87
|
"jest": "^29.7.0"
|
|
88
88
|
},
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "0826633a53695ac92965f8993e46985259adb65f"
|
|
90
90
|
}
|