@abtnode/ux 1.16.17-beta-ce49fe0e → 1.16.17-beta-2679e686
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/es/blocklet/configuration.js +169 -32
- package/es/blocklet/publish/create-release.js +1 -1
- package/es/hooks/use-app-logo.js +20 -4
- package/es/locales/en.js +6 -4
- package/es/locales/zh.js +6 -4
- package/es/util/index.js +2 -1
- package/lib/blocklet/configuration.js +141 -33
- package/lib/blocklet/publish/create-release.js +1 -1
- package/lib/hooks/use-app-logo.js +21 -4
- package/lib/locales/en.js +6 -4
- package/lib/locales/zh.js +6 -4
- package/lib/util/index.js +4 -2
- package/package.json +9 -9
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import React, { useState, useContext } from 'react';
|
|
1
|
+
import React, { useState, useContext, lazy, useRef } from 'react';
|
|
2
2
|
import styled from '@emotion/styled';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import get from 'lodash/get';
|
|
5
5
|
import isEqual from 'lodash/isEqual';
|
|
6
|
+
import classnames from 'classnames';
|
|
7
|
+
import joinUrl from 'url-join';
|
|
6
8
|
import Box from '@mui/material/Box';
|
|
7
9
|
import Switch from '@mui/material/Switch';
|
|
8
10
|
import Divider from '@mui/material/Divider';
|
|
9
11
|
import { LocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
10
12
|
import Button from '@arcblock/ux/lib/Button';
|
|
11
13
|
import LoopIcon from '@mui/icons-material/Loop';
|
|
14
|
+
import Avatar from '@mui/material/Avatar';
|
|
12
15
|
import { EVENTS } from '@abtnode/constant';
|
|
13
16
|
import { BLOCKLET_CONFIGURABLE_KEY, SUPPORTED_LANGUAGES } from '@blocklet/constant';
|
|
14
17
|
import { getWhoCanAccess } from '@blocklet/meta/lib/util';
|
|
@@ -22,19 +25,34 @@ import Permission, { withPermission } from '../permission';
|
|
|
22
25
|
import ClearCache from '../clear-cache';
|
|
23
26
|
import AppSk from './preferences/app-sk';
|
|
24
27
|
import TransferOwner from './transfer-owner';
|
|
28
|
+
import useAppLogo from '../hooks/use-app-logo';
|
|
25
29
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
26
30
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
27
31
|
const languages = Object.keys(SUPPORTED_LANGUAGES).map(x => ({
|
|
28
32
|
code: x,
|
|
29
33
|
name: SUPPORTED_LANGUAGES[x].nativeName
|
|
30
34
|
}));
|
|
35
|
+
|
|
36
|
+
// eslint-disable-next-line import/no-unresolved
|
|
37
|
+
const UploaderComponent = /*#__PURE__*/lazy(() => import('@blocklet/uploader/react').then(res => ({
|
|
38
|
+
default: res.Uploader
|
|
39
|
+
})));
|
|
40
|
+
const uploadPrefix = '/blocklet/logo/upload';
|
|
31
41
|
function BlockletEnvironment({
|
|
32
42
|
blocklet,
|
|
33
43
|
onUpdate,
|
|
34
44
|
hasPermission,
|
|
35
45
|
...rest
|
|
36
46
|
}) {
|
|
37
|
-
const
|
|
47
|
+
const {
|
|
48
|
+
api,
|
|
49
|
+
inService,
|
|
50
|
+
prefix,
|
|
51
|
+
getSessionInHeader,
|
|
52
|
+
ws: {
|
|
53
|
+
useSubscription
|
|
54
|
+
}
|
|
55
|
+
} = useNodeContext();
|
|
38
56
|
const {
|
|
39
57
|
t
|
|
40
58
|
} = useContext(LocaleContext);
|
|
@@ -44,12 +62,28 @@ function BlockletEnvironment({
|
|
|
44
62
|
const whoCanAccess = getWhoCanAccess(blocklet);
|
|
45
63
|
const publicToStore = blocklet?.settings?.publicToStore;
|
|
46
64
|
const disabled = loading || !hasPermission;
|
|
65
|
+
const uploaderLogoRef = useRef(null);
|
|
47
66
|
const {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
67
|
+
logoUrl,
|
|
68
|
+
rectLogoUrl,
|
|
69
|
+
faviconUrl
|
|
70
|
+
} = useAppLogo({
|
|
71
|
+
blocklet
|
|
72
|
+
});
|
|
73
|
+
const [apiPathProps, setApiPathProps] = useState();
|
|
74
|
+
const uploadLogoPrefix = joinUrl(prefix, uploadPrefix, 'square', blocklet.meta.did);
|
|
75
|
+
const uploadLogoRectPrefix = joinUrl(prefix, uploadPrefix, 'rect', blocklet.meta.did);
|
|
76
|
+
const uploadLogoFaviconPrefix = joinUrl(prefix, uploadPrefix, 'favicon', blocklet.meta.did);
|
|
77
|
+
const openUploader = uploaderPrefix => {
|
|
78
|
+
if (!hasPermission) {
|
|
79
|
+
return;
|
|
51
80
|
}
|
|
52
|
-
|
|
81
|
+
setApiPathProps({
|
|
82
|
+
uploader: uploaderPrefix,
|
|
83
|
+
disableMediaKitPrefix: true
|
|
84
|
+
});
|
|
85
|
+
uploaderLogoRef.current.open();
|
|
86
|
+
};
|
|
53
87
|
const {
|
|
54
88
|
did
|
|
55
89
|
} = blocklet.meta;
|
|
@@ -71,10 +105,6 @@ function BlockletEnvironment({
|
|
|
71
105
|
const deletable = !customDelete || customDelete.value === 'yes';
|
|
72
106
|
const customLanguages = blocklet.environments.find(x => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LANGUAGES);
|
|
73
107
|
const customUrl = blocklet.environments.find(x => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL);
|
|
74
|
-
const customLogoSquare = blocklet.environments.find(x => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_SQUARE);
|
|
75
|
-
const customLogoRect = blocklet.environments.find(x => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_RECT);
|
|
76
|
-
const customLogoFavicon = blocklet.environments.find(x => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_FAVICON);
|
|
77
|
-
const customLogoDeprecated = blocklet.environments.find(x => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO);
|
|
78
108
|
const copyrightOwner = blocklet.environments.find(x => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER);
|
|
79
109
|
const copyrightYear = blocklet.environments.find(x => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR);
|
|
80
110
|
const configurableEnvs = [{
|
|
@@ -89,22 +119,6 @@ function BlockletEnvironment({
|
|
|
89
119
|
key: BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL,
|
|
90
120
|
description: t('blocklet.config.appUrl'),
|
|
91
121
|
value: customUrl ? customUrl.value : ''
|
|
92
|
-
}, {
|
|
93
|
-
key: BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_SQUARE,
|
|
94
|
-
description: t('blocklet.config.logoSquare'),
|
|
95
|
-
value: customLogoSquare ? customLogoSquare.value : ''
|
|
96
|
-
}, {
|
|
97
|
-
key: BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_RECT,
|
|
98
|
-
description: t('blocklet.config.logoRect'),
|
|
99
|
-
value: customLogoRect ? customLogoRect.value : ''
|
|
100
|
-
}, {
|
|
101
|
-
key: BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_FAVICON,
|
|
102
|
-
description: t('blocklet.config.logoFavicon'),
|
|
103
|
-
value: customLogoFavicon ? customLogoFavicon.value : ''
|
|
104
|
-
}, {
|
|
105
|
-
key: BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO,
|
|
106
|
-
description: t('blocklet.config.logo'),
|
|
107
|
-
value: customLogoDeprecated ? customLogoDeprecated.value : ''
|
|
108
122
|
}, {
|
|
109
123
|
key: BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER,
|
|
110
124
|
description: t('blocklet.config.copyrightOwner'),
|
|
@@ -135,7 +149,7 @@ function BlockletEnvironment({
|
|
|
135
149
|
} = e.target;
|
|
136
150
|
const {
|
|
137
151
|
blocklet: data
|
|
138
|
-
} = await
|
|
152
|
+
} = await api.configPublicToStore({
|
|
139
153
|
input: {
|
|
140
154
|
did: blocklet.meta.did,
|
|
141
155
|
publicToStore: checked
|
|
@@ -167,7 +181,7 @@ function BlockletEnvironment({
|
|
|
167
181
|
setLoading(true);
|
|
168
182
|
const {
|
|
169
183
|
blocklet: data
|
|
170
|
-
} = await
|
|
184
|
+
} = await api.configBlocklet({
|
|
171
185
|
input: {
|
|
172
186
|
did: blocklet.meta.did,
|
|
173
187
|
configs: params
|
|
@@ -191,7 +205,7 @@ function BlockletEnvironment({
|
|
|
191
205
|
} = e.target;
|
|
192
206
|
const {
|
|
193
207
|
blocklet: data
|
|
194
|
-
} = await
|
|
208
|
+
} = await api.configBlocklet({
|
|
195
209
|
input: {
|
|
196
210
|
did: blocklet.meta.did,
|
|
197
211
|
configs: [{
|
|
@@ -216,7 +230,7 @@ function BlockletEnvironment({
|
|
|
216
230
|
try {
|
|
217
231
|
setLoading(true);
|
|
218
232
|
const corsAllowedOrigins = newValue.length ? newValue : ['__none__'];
|
|
219
|
-
await
|
|
233
|
+
await api.updateRoutingSite({
|
|
220
234
|
input: {
|
|
221
235
|
id: site.id,
|
|
222
236
|
corsAllowedOrigins,
|
|
@@ -239,7 +253,7 @@ function BlockletEnvironment({
|
|
|
239
253
|
try {
|
|
240
254
|
const {
|
|
241
255
|
blocklet: data
|
|
242
|
-
} = await
|
|
256
|
+
} = await api.configBlocklet({
|
|
243
257
|
input: {
|
|
244
258
|
did: blocklet.meta.did,
|
|
245
259
|
configs: [{
|
|
@@ -255,6 +269,11 @@ function BlockletEnvironment({
|
|
|
255
269
|
setLoading(false);
|
|
256
270
|
}
|
|
257
271
|
};
|
|
272
|
+
const uploaderStyle = {
|
|
273
|
+
'&::after': {
|
|
274
|
+
content: `"${t('common.switch')}"`
|
|
275
|
+
}
|
|
276
|
+
};
|
|
258
277
|
return /*#__PURE__*/_jsxs(Div, {
|
|
259
278
|
...rest,
|
|
260
279
|
children: [configurableEnvs.map(item => /*#__PURE__*/_jsxs(Box, {
|
|
@@ -275,6 +294,95 @@ function BlockletEnvironment({
|
|
|
275
294
|
onSubmit: value => onSubmitConfig(item.key, value)
|
|
276
295
|
})]
|
|
277
296
|
})), /*#__PURE__*/_jsx(Box, {
|
|
297
|
+
className: "config-form",
|
|
298
|
+
component: Divider,
|
|
299
|
+
my: 3
|
|
300
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
301
|
+
className: "config-label",
|
|
302
|
+
fontSize: 14,
|
|
303
|
+
mb: 1,
|
|
304
|
+
sx: {
|
|
305
|
+
flexGrow: 0,
|
|
306
|
+
width: 'auto'
|
|
307
|
+
},
|
|
308
|
+
children: t('blocklet.config.logoSquare')
|
|
309
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
310
|
+
className: classnames('uploader-wrapper', hasPermission && 'enabled'),
|
|
311
|
+
sx: uploaderStyle,
|
|
312
|
+
onClick: () => openUploader(uploadLogoPrefix),
|
|
313
|
+
children: /*#__PURE__*/_jsx(Avatar, {
|
|
314
|
+
sx: {
|
|
315
|
+
height: 80,
|
|
316
|
+
width: 80
|
|
317
|
+
},
|
|
318
|
+
variant: "square",
|
|
319
|
+
alt: "Blocklet Logo",
|
|
320
|
+
src: logoUrl
|
|
321
|
+
})
|
|
322
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
323
|
+
className: "config-label",
|
|
324
|
+
fontSize: 14,
|
|
325
|
+
mt: 4,
|
|
326
|
+
children: t('blocklet.config.logoRect')
|
|
327
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
328
|
+
mb: 1.5,
|
|
329
|
+
className: "config-desc",
|
|
330
|
+
children: t('blocklet.config.logoRectDesc')
|
|
331
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
332
|
+
className: classnames('uploader-wrapper', hasPermission && 'enabled'),
|
|
333
|
+
sx: uploaderStyle,
|
|
334
|
+
onClick: () => openUploader(uploadLogoRectPrefix),
|
|
335
|
+
children: /*#__PURE__*/_jsx("img", {
|
|
336
|
+
alt: "Blocklet Rect Logo",
|
|
337
|
+
src: rectLogoUrl,
|
|
338
|
+
style: {
|
|
339
|
+
height: '80px'
|
|
340
|
+
}
|
|
341
|
+
})
|
|
342
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
343
|
+
className: "config-label",
|
|
344
|
+
fontSize: 14,
|
|
345
|
+
mt: 4,
|
|
346
|
+
children: t('blocklet.config.logoFavicon')
|
|
347
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
348
|
+
mb: 1.5,
|
|
349
|
+
className: "config-desc",
|
|
350
|
+
children: t('blocklet.config.logoFaviconDesc')
|
|
351
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
352
|
+
sx: {
|
|
353
|
+
display: 'inline-flex',
|
|
354
|
+
cursor: hasPermission ? 'pointer' : 'default'
|
|
355
|
+
},
|
|
356
|
+
onClick: () => openUploader(uploadLogoFaviconPrefix),
|
|
357
|
+
children: /*#__PURE__*/_jsx(Avatar, {
|
|
358
|
+
variant: "square",
|
|
359
|
+
sx: {
|
|
360
|
+
width: 20,
|
|
361
|
+
height: 20
|
|
362
|
+
},
|
|
363
|
+
alt: "Blocklet Favicon Logo",
|
|
364
|
+
src: faviconUrl
|
|
365
|
+
})
|
|
366
|
+
}), /*#__PURE__*/_jsx(UploaderComponent, {
|
|
367
|
+
id: "\u200Buploader-logo",
|
|
368
|
+
ref: uploaderLogoRef,
|
|
369
|
+
popup: true,
|
|
370
|
+
onUploadFinish: () => {
|
|
371
|
+
uploaderLogoRef.current.close();
|
|
372
|
+
},
|
|
373
|
+
plugins: [],
|
|
374
|
+
apiPathProps: apiPathProps,
|
|
375
|
+
coreProps: {
|
|
376
|
+
restrictions: {
|
|
377
|
+
allowedFileTypes: ['image/*', '.jpg', '.jpeg', '.png', '.gif', '.svg'],
|
|
378
|
+
maxFileSize: 1024 * 1024 * 10,
|
|
379
|
+
maxNumberOfFiles: 1
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
tusProps: {
|
|
383
|
+
headers: getSessionInHeader
|
|
384
|
+
}
|
|
385
|
+
}, "uploader-logo"), /*#__PURE__*/_jsx(Box, {
|
|
278
386
|
className: "config-form",
|
|
279
387
|
children: whoCanAccess === 'all' && blocklet.source === 'registry' && /*#__PURE__*/_jsxs(Box, {
|
|
280
388
|
className: "config-item",
|
|
@@ -485,7 +593,6 @@ const Div = styled.div`
|
|
|
485
593
|
flex-shrink: 0;
|
|
486
594
|
padding: 0 24px;
|
|
487
595
|
transform: translate(0, 0);
|
|
488
|
-
max-height: 60vh;
|
|
489
596
|
}
|
|
490
597
|
}
|
|
491
598
|
|
|
@@ -509,4 +616,34 @@ const Div = styled.div`
|
|
|
509
616
|
.form-item {
|
|
510
617
|
margin-top: 0;
|
|
511
618
|
}
|
|
619
|
+
|
|
620
|
+
.uploader-wrapper {
|
|
621
|
+
display: inline-flex;
|
|
622
|
+
position: relative;
|
|
623
|
+
font-size: 0px;
|
|
624
|
+
&.enabled {
|
|
625
|
+
cursor: pointer;
|
|
626
|
+
}
|
|
627
|
+
&::after {
|
|
628
|
+
display: none;
|
|
629
|
+
}
|
|
630
|
+
&.enabled::after {
|
|
631
|
+
display: block;
|
|
632
|
+
opacity: 0;
|
|
633
|
+
position: absolute;
|
|
634
|
+
bottom: 0;
|
|
635
|
+
background: rgba(0, 0, 0, 0.2);
|
|
636
|
+
left: 0;
|
|
637
|
+
right: 0;
|
|
638
|
+
height: 2.2em;
|
|
639
|
+
color: white;
|
|
640
|
+
text-align: center;
|
|
641
|
+
font-size: 12px;
|
|
642
|
+
line-height: 2em;
|
|
643
|
+
transition: opacity 0.3s ease;
|
|
644
|
+
}
|
|
645
|
+
&:hover::after {
|
|
646
|
+
opacity: 1;
|
|
647
|
+
}
|
|
648
|
+
}
|
|
512
649
|
`;
|
|
@@ -582,7 +582,7 @@ export default function CreateRelease({
|
|
|
582
582
|
maxNumberOfFiles: 1
|
|
583
583
|
}
|
|
584
584
|
}
|
|
585
|
-
}, "uploader-
|
|
585
|
+
}, "uploader-logo"), /*#__PURE__*/_jsx(UploaderComponent, {
|
|
586
586
|
id: "\u200Buploader-screenshot",
|
|
587
587
|
ref: uploaderScreenshotRef,
|
|
588
588
|
popup: true,
|
package/es/hooks/use-app-logo.js
CHANGED
|
@@ -1,16 +1,32 @@
|
|
|
1
1
|
import joinUrl from 'url-join';
|
|
2
|
+
import { BLOCKLET_CONFIGURABLE_KEY } from '@blocklet/constant';
|
|
2
3
|
import { useNodeContext } from '../contexts/node';
|
|
3
|
-
import { isInstalling } from '../util';
|
|
4
|
+
import { isInstalling, getLogoHash } from '../util';
|
|
5
|
+
const getSearch = (blocklet, customLogo) => {
|
|
6
|
+
let search = '?v=';
|
|
7
|
+
if (customLogo) {
|
|
8
|
+
search += getLogoHash(customLogo);
|
|
9
|
+
} else {
|
|
10
|
+
search += `${blocklet?.meta?.version}${isInstalling(blocklet?.status) ? '~' : ''}`;
|
|
11
|
+
}
|
|
12
|
+
return search;
|
|
13
|
+
};
|
|
4
14
|
export default function useAppLogo({
|
|
5
15
|
blocklet
|
|
6
16
|
}) {
|
|
7
17
|
const {
|
|
8
18
|
inService
|
|
9
19
|
} = useNodeContext();
|
|
20
|
+
const customLogo = (blocklet?.environments || []).find(x => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_SQUARE)?.value;
|
|
21
|
+
const customRectLogo = (blocklet?.environments || []).find(x => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_RECT)?.value;
|
|
22
|
+
const customFavicon = (blocklet?.environments || []).find(x => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_FAVICON)?.value;
|
|
10
23
|
const prefix = window.env?.apiPrefix || '/';
|
|
11
|
-
const
|
|
12
|
-
const
|
|
24
|
+
const logoUrl = joinUrl(prefix, `/blocklet/logo/${inService ? '' : blocklet.meta.did}`, getSearch(blocklet, customLogo));
|
|
25
|
+
const rectLogoUrl = joinUrl(prefix, `/blocklet/logo-rect/${inService ? '' : blocklet.meta.did}`, getSearch(blocklet, customRectLogo));
|
|
26
|
+
const faviconUrl = joinUrl(prefix, `/blocklet/logo-favicon/${inService ? '' : blocklet.meta.did}`, getSearch(blocklet, customFavicon));
|
|
13
27
|
return {
|
|
14
|
-
logoUrl
|
|
28
|
+
logoUrl,
|
|
29
|
+
rectLogoUrl,
|
|
30
|
+
faviconUrl
|
|
15
31
|
};
|
|
16
32
|
}
|
package/es/locales/en.js
CHANGED
|
@@ -278,6 +278,7 @@ module.exports = {
|
|
|
278
278
|
succeeded: 'Succeeded',
|
|
279
279
|
subscription: 'Subscription',
|
|
280
280
|
support: 'Support',
|
|
281
|
+
switch: 'Switch',
|
|
281
282
|
team: 'Team',
|
|
282
283
|
the: 'The',
|
|
283
284
|
timeAgo: '{time} ago',
|
|
@@ -391,10 +392,11 @@ module.exports = {
|
|
|
391
392
|
name: 'Blocklet Name',
|
|
392
393
|
description: 'Blocklet Description',
|
|
393
394
|
sk: 'Secret key for the blocklet wallet',
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
logoFavicon: '
|
|
395
|
+
logoSquare: 'App Logo',
|
|
396
|
+
logoRect: 'Rect logo',
|
|
397
|
+
logoRectDesc: 'Usually displayed at the top of the page, default to app logo',
|
|
398
|
+
logoFavicon: 'Favicon',
|
|
399
|
+
logoFaviconDesc: "Usually displayed in the browser's address bar or tab page, default to app logo",
|
|
398
400
|
clusterSize: 'Instance count when run this blocklet in cluster mode',
|
|
399
401
|
copyrightOwner: 'Copyright Owner (Display in footer)',
|
|
400
402
|
copyrightYear: 'Copyright Year (Display in footer)',
|
package/es/locales/zh.js
CHANGED
|
@@ -283,6 +283,7 @@ module.exports = {
|
|
|
283
283
|
succeeded: '成功',
|
|
284
284
|
subscription: '订阅',
|
|
285
285
|
support: '服务支持',
|
|
286
|
+
switch: '切换',
|
|
286
287
|
team: '团队',
|
|
287
288
|
the: '此',
|
|
288
289
|
timeAgo: '{time}前',
|
|
@@ -395,10 +396,11 @@ module.exports = {
|
|
|
395
396
|
name: '应用名称',
|
|
396
397
|
description: '应用描述',
|
|
397
398
|
sk: '应用账户私钥',
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
logoFavicon: '
|
|
399
|
+
logoSquare: '应用 Logo',
|
|
400
|
+
logoRect: '横版 Logo',
|
|
401
|
+
logoRectDesc: '通常显示在页面顶部,默认和应用 Logo 相同',
|
|
402
|
+
logoFavicon: 'Favicon',
|
|
403
|
+
logoFaviconDesc: '通常显示在浏览器的地址栏或标签页中,默认和应用 Logo 相同',
|
|
402
404
|
clusterSize: '以 Cluster 模式启动时的实例数量',
|
|
403
405
|
copyrightOwner: '版权所有者 (展示在页脚中)',
|
|
404
406
|
copyrightYear: '版权年份 (展示在页脚中)',
|
package/es/util/index.js
CHANGED
|
@@ -614,4 +614,5 @@ export const getSubscriptionURL = async ({
|
|
|
614
614
|
return joinUrl(baseUrl, `/${nftId}/subscription?locale=${locale}&return-url=${encodeURIComponent(window.location.href)}`);
|
|
615
615
|
};
|
|
616
616
|
export const nanoid = (length = 16) => [...Array(length)].map(() => Math.random().toString(36)[2]).join('');
|
|
617
|
-
export const getSystemDomains = domains => domains.filter(x => x.isProtected);
|
|
617
|
+
export const getSystemDomains = domains => domains.filter(x => x.isProtected);
|
|
618
|
+
export const getLogoHash = logo => encodeURIComponent((logo || '').split('/').slice(-1)[0].slice(0, 7));
|
|
@@ -9,12 +9,15 @@ var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
|
9
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
10
|
var _get = _interopRequireDefault(require("lodash/get"));
|
|
11
11
|
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
var _urlJoin = _interopRequireDefault(require("url-join"));
|
|
12
14
|
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
13
15
|
var _Switch = _interopRequireDefault(require("@mui/material/Switch"));
|
|
14
16
|
var _Divider = _interopRequireDefault(require("@mui/material/Divider"));
|
|
15
17
|
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
16
18
|
var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
|
|
17
19
|
var _Loop = _interopRequireDefault(require("@mui/icons-material/Loop"));
|
|
20
|
+
var _Avatar = _interopRequireDefault(require("@mui/material/Avatar"));
|
|
18
21
|
var _constant = require("@abtnode/constant");
|
|
19
22
|
var _constant2 = require("@blocklet/constant");
|
|
20
23
|
var _util = require("@blocklet/meta/lib/util");
|
|
@@ -28,12 +31,11 @@ var _permission = _interopRequireWildcard(require("../permission"));
|
|
|
28
31
|
var _clearCache = _interopRequireDefault(require("../clear-cache"));
|
|
29
32
|
var _appSk = _interopRequireDefault(require("./preferences/app-sk"));
|
|
30
33
|
var _transferOwner = _interopRequireDefault(require("./transfer-owner"));
|
|
34
|
+
var _useAppLogo = _interopRequireDefault(require("../hooks/use-app-logo"));
|
|
31
35
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
32
36
|
var _templateObject;
|
|
33
37
|
const _excluded = ["blocklet", "onUpdate", "hasPermission"];
|
|
34
38
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
35
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
36
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
37
39
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
38
40
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
39
41
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -42,10 +44,18 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typ
|
|
|
42
44
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
43
45
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
44
46
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
47
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
48
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
45
49
|
const languages = Object.keys(_constant2.SUPPORTED_LANGUAGES).map(x => ({
|
|
46
50
|
code: x,
|
|
47
51
|
name: _constant2.SUPPORTED_LANGUAGES[x].nativeName
|
|
48
52
|
}));
|
|
53
|
+
|
|
54
|
+
// eslint-disable-next-line import/no-unresolved
|
|
55
|
+
const UploaderComponent = /*#__PURE__*/(0, _react.lazy)(() => Promise.resolve().then(() => _interopRequireWildcard(require('@blocklet/uploader/react'))).then(res => ({
|
|
56
|
+
default: res.Uploader
|
|
57
|
+
})));
|
|
58
|
+
const uploadPrefix = '/blocklet/logo/upload';
|
|
49
59
|
function BlockletEnvironment(_ref) {
|
|
50
60
|
var _blocklet$settings;
|
|
51
61
|
let {
|
|
@@ -54,7 +64,15 @@ function BlockletEnvironment(_ref) {
|
|
|
54
64
|
hasPermission
|
|
55
65
|
} = _ref,
|
|
56
66
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
57
|
-
const
|
|
67
|
+
const {
|
|
68
|
+
api,
|
|
69
|
+
inService,
|
|
70
|
+
prefix,
|
|
71
|
+
getSessionInHeader,
|
|
72
|
+
ws: {
|
|
73
|
+
useSubscription
|
|
74
|
+
}
|
|
75
|
+
} = (0, _node.useNodeContext)();
|
|
58
76
|
const {
|
|
59
77
|
t
|
|
60
78
|
} = (0, _react.useContext)(_context.LocaleContext);
|
|
@@ -64,12 +82,28 @@ function BlockletEnvironment(_ref) {
|
|
|
64
82
|
const whoCanAccess = (0, _util.getWhoCanAccess)(blocklet);
|
|
65
83
|
const publicToStore = blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$settings = blocklet.settings) === null || _blocklet$settings === void 0 ? void 0 : _blocklet$settings.publicToStore;
|
|
66
84
|
const disabled = loading || !hasPermission;
|
|
85
|
+
const uploaderLogoRef = (0, _react.useRef)(null);
|
|
67
86
|
const {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
87
|
+
logoUrl,
|
|
88
|
+
rectLogoUrl,
|
|
89
|
+
faviconUrl
|
|
90
|
+
} = (0, _useAppLogo.default)({
|
|
91
|
+
blocklet
|
|
92
|
+
});
|
|
93
|
+
const [apiPathProps, setApiPathProps] = (0, _react.useState)();
|
|
94
|
+
const uploadLogoPrefix = (0, _urlJoin.default)(prefix, uploadPrefix, 'square', blocklet.meta.did);
|
|
95
|
+
const uploadLogoRectPrefix = (0, _urlJoin.default)(prefix, uploadPrefix, 'rect', blocklet.meta.did);
|
|
96
|
+
const uploadLogoFaviconPrefix = (0, _urlJoin.default)(prefix, uploadPrefix, 'favicon', blocklet.meta.did);
|
|
97
|
+
const openUploader = uploaderPrefix => {
|
|
98
|
+
if (!hasPermission) {
|
|
99
|
+
return;
|
|
71
100
|
}
|
|
72
|
-
|
|
101
|
+
setApiPathProps({
|
|
102
|
+
uploader: uploaderPrefix,
|
|
103
|
+
disableMediaKitPrefix: true
|
|
104
|
+
});
|
|
105
|
+
uploaderLogoRef.current.open();
|
|
106
|
+
};
|
|
73
107
|
const {
|
|
74
108
|
did
|
|
75
109
|
} = blocklet.meta;
|
|
@@ -91,10 +125,6 @@ function BlockletEnvironment(_ref) {
|
|
|
91
125
|
const deletable = !customDelete || customDelete.value === 'yes';
|
|
92
126
|
const customLanguages = blocklet.environments.find(x => x.key === _constant2.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LANGUAGES);
|
|
93
127
|
const customUrl = blocklet.environments.find(x => x.key === _constant2.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL);
|
|
94
|
-
const customLogoSquare = blocklet.environments.find(x => x.key === _constant2.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_SQUARE);
|
|
95
|
-
const customLogoRect = blocklet.environments.find(x => x.key === _constant2.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_RECT);
|
|
96
|
-
const customLogoFavicon = blocklet.environments.find(x => x.key === _constant2.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_FAVICON);
|
|
97
|
-
const customLogoDeprecated = blocklet.environments.find(x => x.key === _constant2.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO);
|
|
98
128
|
const copyrightOwner = blocklet.environments.find(x => x.key === _constant2.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER);
|
|
99
129
|
const copyrightYear = blocklet.environments.find(x => x.key === _constant2.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR);
|
|
100
130
|
const configurableEnvs = [{
|
|
@@ -109,22 +139,6 @@ function BlockletEnvironment(_ref) {
|
|
|
109
139
|
key: _constant2.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL,
|
|
110
140
|
description: t('blocklet.config.appUrl'),
|
|
111
141
|
value: customUrl ? customUrl.value : ''
|
|
112
|
-
}, {
|
|
113
|
-
key: _constant2.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_SQUARE,
|
|
114
|
-
description: t('blocklet.config.logoSquare'),
|
|
115
|
-
value: customLogoSquare ? customLogoSquare.value : ''
|
|
116
|
-
}, {
|
|
117
|
-
key: _constant2.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_RECT,
|
|
118
|
-
description: t('blocklet.config.logoRect'),
|
|
119
|
-
value: customLogoRect ? customLogoRect.value : ''
|
|
120
|
-
}, {
|
|
121
|
-
key: _constant2.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_FAVICON,
|
|
122
|
-
description: t('blocklet.config.logoFavicon'),
|
|
123
|
-
value: customLogoFavicon ? customLogoFavicon.value : ''
|
|
124
|
-
}, {
|
|
125
|
-
key: _constant2.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO,
|
|
126
|
-
description: t('blocklet.config.logo'),
|
|
127
|
-
value: customLogoDeprecated ? customLogoDeprecated.value : ''
|
|
128
142
|
}, {
|
|
129
143
|
key: _constant2.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER,
|
|
130
144
|
description: t('blocklet.config.copyrightOwner'),
|
|
@@ -155,7 +169,7 @@ function BlockletEnvironment(_ref) {
|
|
|
155
169
|
} = e.target;
|
|
156
170
|
const {
|
|
157
171
|
blocklet: data
|
|
158
|
-
} = await
|
|
172
|
+
} = await api.configPublicToStore({
|
|
159
173
|
input: {
|
|
160
174
|
did: blocklet.meta.did,
|
|
161
175
|
publicToStore: checked
|
|
@@ -187,7 +201,7 @@ function BlockletEnvironment(_ref) {
|
|
|
187
201
|
setLoading(true);
|
|
188
202
|
const {
|
|
189
203
|
blocklet: data
|
|
190
|
-
} = await
|
|
204
|
+
} = await api.configBlocklet({
|
|
191
205
|
input: {
|
|
192
206
|
did: blocklet.meta.did,
|
|
193
207
|
configs: params
|
|
@@ -211,7 +225,7 @@ function BlockletEnvironment(_ref) {
|
|
|
211
225
|
} = e.target;
|
|
212
226
|
const {
|
|
213
227
|
blocklet: data
|
|
214
|
-
} = await
|
|
228
|
+
} = await api.configBlocklet({
|
|
215
229
|
input: {
|
|
216
230
|
did: blocklet.meta.did,
|
|
217
231
|
configs: [{
|
|
@@ -236,7 +250,7 @@ function BlockletEnvironment(_ref) {
|
|
|
236
250
|
try {
|
|
237
251
|
setLoading(true);
|
|
238
252
|
const corsAllowedOrigins = newValue.length ? newValue : ['__none__'];
|
|
239
|
-
await
|
|
253
|
+
await api.updateRoutingSite({
|
|
240
254
|
input: {
|
|
241
255
|
id: site.id,
|
|
242
256
|
corsAllowedOrigins,
|
|
@@ -259,7 +273,7 @@ function BlockletEnvironment(_ref) {
|
|
|
259
273
|
try {
|
|
260
274
|
const {
|
|
261
275
|
blocklet: data
|
|
262
|
-
} = await
|
|
276
|
+
} = await api.configBlocklet({
|
|
263
277
|
input: {
|
|
264
278
|
did: blocklet.meta.did,
|
|
265
279
|
configs: [{
|
|
@@ -275,6 +289,11 @@ function BlockletEnvironment(_ref) {
|
|
|
275
289
|
setLoading(false);
|
|
276
290
|
}
|
|
277
291
|
};
|
|
292
|
+
const uploaderStyle = {
|
|
293
|
+
'&::after': {
|
|
294
|
+
content: "\"".concat(t('common.switch'), "\"")
|
|
295
|
+
}
|
|
296
|
+
};
|
|
278
297
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Div, _objectSpread(_objectSpread({}, rest), {}, {
|
|
279
298
|
children: [configurableEnvs.map(item => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
280
299
|
className: "config-form",
|
|
@@ -294,6 +313,95 @@ function BlockletEnvironment(_ref) {
|
|
|
294
313
|
onSubmit: value => onSubmitConfig(item.key, value)
|
|
295
314
|
})]
|
|
296
315
|
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
316
|
+
className: "config-form",
|
|
317
|
+
component: _Divider.default,
|
|
318
|
+
my: 3
|
|
319
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
320
|
+
className: "config-label",
|
|
321
|
+
fontSize: 14,
|
|
322
|
+
mb: 1,
|
|
323
|
+
sx: {
|
|
324
|
+
flexGrow: 0,
|
|
325
|
+
width: 'auto'
|
|
326
|
+
},
|
|
327
|
+
children: t('blocklet.config.logoSquare')
|
|
328
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
329
|
+
className: (0, _classnames.default)('uploader-wrapper', hasPermission && 'enabled'),
|
|
330
|
+
sx: uploaderStyle,
|
|
331
|
+
onClick: () => openUploader(uploadLogoPrefix),
|
|
332
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Avatar.default, {
|
|
333
|
+
sx: {
|
|
334
|
+
height: 80,
|
|
335
|
+
width: 80
|
|
336
|
+
},
|
|
337
|
+
variant: "square",
|
|
338
|
+
alt: "Blocklet Logo",
|
|
339
|
+
src: logoUrl
|
|
340
|
+
})
|
|
341
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
342
|
+
className: "config-label",
|
|
343
|
+
fontSize: 14,
|
|
344
|
+
mt: 4,
|
|
345
|
+
children: t('blocklet.config.logoRect')
|
|
346
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
347
|
+
mb: 1.5,
|
|
348
|
+
className: "config-desc",
|
|
349
|
+
children: t('blocklet.config.logoRectDesc')
|
|
350
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
351
|
+
className: (0, _classnames.default)('uploader-wrapper', hasPermission && 'enabled'),
|
|
352
|
+
sx: uploaderStyle,
|
|
353
|
+
onClick: () => openUploader(uploadLogoRectPrefix),
|
|
354
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
355
|
+
alt: "Blocklet Rect Logo",
|
|
356
|
+
src: rectLogoUrl,
|
|
357
|
+
style: {
|
|
358
|
+
height: '80px'
|
|
359
|
+
}
|
|
360
|
+
})
|
|
361
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
362
|
+
className: "config-label",
|
|
363
|
+
fontSize: 14,
|
|
364
|
+
mt: 4,
|
|
365
|
+
children: t('blocklet.config.logoFavicon')
|
|
366
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
367
|
+
mb: 1.5,
|
|
368
|
+
className: "config-desc",
|
|
369
|
+
children: t('blocklet.config.logoFaviconDesc')
|
|
370
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
371
|
+
sx: {
|
|
372
|
+
display: 'inline-flex',
|
|
373
|
+
cursor: hasPermission ? 'pointer' : 'default'
|
|
374
|
+
},
|
|
375
|
+
onClick: () => openUploader(uploadLogoFaviconPrefix),
|
|
376
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Avatar.default, {
|
|
377
|
+
variant: "square",
|
|
378
|
+
sx: {
|
|
379
|
+
width: 20,
|
|
380
|
+
height: 20
|
|
381
|
+
},
|
|
382
|
+
alt: "Blocklet Favicon Logo",
|
|
383
|
+
src: faviconUrl
|
|
384
|
+
})
|
|
385
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(UploaderComponent, {
|
|
386
|
+
id: "\u200Buploader-logo",
|
|
387
|
+
ref: uploaderLogoRef,
|
|
388
|
+
popup: true,
|
|
389
|
+
onUploadFinish: () => {
|
|
390
|
+
uploaderLogoRef.current.close();
|
|
391
|
+
},
|
|
392
|
+
plugins: [],
|
|
393
|
+
apiPathProps: apiPathProps,
|
|
394
|
+
coreProps: {
|
|
395
|
+
restrictions: {
|
|
396
|
+
allowedFileTypes: ['image/*', '.jpg', '.jpeg', '.png', '.gif', '.svg'],
|
|
397
|
+
maxFileSize: 1024 * 1024 * 10,
|
|
398
|
+
maxNumberOfFiles: 1
|
|
399
|
+
}
|
|
400
|
+
},
|
|
401
|
+
tusProps: {
|
|
402
|
+
headers: getSessionInHeader
|
|
403
|
+
}
|
|
404
|
+
}, "uploader-logo"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
297
405
|
className: "config-form",
|
|
298
406
|
children: whoCanAccess === 'all' && blocklet.source === 'registry' && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
299
407
|
className: "config-item",
|
|
@@ -490,4 +598,4 @@ BlockletEnvironment.defaultProps = {
|
|
|
490
598
|
onUpdate: () => {},
|
|
491
599
|
hasPermission: false
|
|
492
600
|
};
|
|
493
|
-
const Div = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding-top: 24px;\n .config-form {\n flex-grow: 1;\n overflow-y: auto;\n ", " {\n width: 100%;\n flex-shrink: 0;\n padding: 0 24px;\n transform: translate(0, 0);\n
|
|
601
|
+
const Div = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding-top: 24px;\n .config-form {\n flex-grow: 1;\n overflow-y: auto;\n ", " {\n width: 100%;\n flex-shrink: 0;\n padding: 0 24px;\n transform: translate(0, 0);\n }\n }\n\n .config-item {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin: 16px 0;\n }\n\n .config-label {\n font-weight: bold;\n }\n\n .config-desc {\n font-weight: normal;\n font-size: 12px;\n color: #666;\n }\n\n .form-item {\n margin-top: 0;\n }\n\n .uploader-wrapper {\n display: inline-flex;\n position: relative;\n font-size: 0px;\n &.enabled {\n cursor: pointer;\n }\n &::after {\n display: none;\n }\n &.enabled::after {\n display: block;\n opacity: 0;\n position: absolute;\n bottom: 0;\n background: rgba(0, 0, 0, 0.2);\n left: 0;\n right: 0;\n height: 2.2em;\n color: white;\n text-align: center;\n font-size: 12px;\n line-height: 2em;\n transition: opacity 0.3s ease;\n }\n &:hover::after {\n opacity: 1;\n }\n }\n"])), props => props.theme.breakpoints.down('md'));
|
|
@@ -592,7 +592,7 @@ function CreateRelease(_ref2) {
|
|
|
592
592
|
maxNumberOfFiles: 1
|
|
593
593
|
}
|
|
594
594
|
}
|
|
595
|
-
}, "uploader-
|
|
595
|
+
}, "uploader-logo"), /*#__PURE__*/(0, _jsxRuntime.jsx)(UploaderComponent, {
|
|
596
596
|
id: "\u200Buploader-screenshot",
|
|
597
597
|
ref: uploaderScreenshotRef,
|
|
598
598
|
popup: true,
|
|
@@ -5,21 +5,38 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = useAppLogo;
|
|
7
7
|
var _urlJoin = _interopRequireDefault(require("url-join"));
|
|
8
|
+
var _constant = require("@blocklet/constant");
|
|
8
9
|
var _node = require("../contexts/node");
|
|
9
10
|
var _util = require("../util");
|
|
10
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
const getSearch = (blocklet, customLogo) => {
|
|
13
|
+
let search = '?v=';
|
|
14
|
+
if (customLogo) {
|
|
15
|
+
search += (0, _util.getLogoHash)(customLogo);
|
|
16
|
+
} else {
|
|
17
|
+
var _blocklet$meta;
|
|
18
|
+
search += "".concat(blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$meta = blocklet.meta) === null || _blocklet$meta === void 0 ? void 0 : _blocklet$meta.version).concat((0, _util.isInstalling)(blocklet === null || blocklet === void 0 ? void 0 : blocklet.status) ? '~' : '');
|
|
19
|
+
}
|
|
20
|
+
return search;
|
|
21
|
+
};
|
|
11
22
|
function useAppLogo(_ref) {
|
|
12
|
-
var _window$env
|
|
23
|
+
var _find, _find2, _find3, _window$env;
|
|
13
24
|
let {
|
|
14
25
|
blocklet
|
|
15
26
|
} = _ref;
|
|
16
27
|
const {
|
|
17
28
|
inService
|
|
18
29
|
} = (0, _node.useNodeContext)();
|
|
30
|
+
const customLogo = (_find = ((blocklet === null || blocklet === void 0 ? void 0 : blocklet.environments) || []).find(x => x.key === _constant.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_SQUARE)) === null || _find === void 0 ? void 0 : _find.value;
|
|
31
|
+
const customRectLogo = (_find2 = ((blocklet === null || blocklet === void 0 ? void 0 : blocklet.environments) || []).find(x => x.key === _constant.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_RECT)) === null || _find2 === void 0 ? void 0 : _find2.value;
|
|
32
|
+
const customFavicon = (_find3 = ((blocklet === null || blocklet === void 0 ? void 0 : blocklet.environments) || []).find(x => x.key === _constant.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_FAVICON)) === null || _find3 === void 0 ? void 0 : _find3.value;
|
|
19
33
|
const prefix = ((_window$env = window.env) === null || _window$env === void 0 ? void 0 : _window$env.apiPrefix) || '/';
|
|
20
|
-
const
|
|
21
|
-
const
|
|
34
|
+
const logoUrl = (0, _urlJoin.default)(prefix, "/blocklet/logo/".concat(inService ? '' : blocklet.meta.did), getSearch(blocklet, customLogo));
|
|
35
|
+
const rectLogoUrl = (0, _urlJoin.default)(prefix, "/blocklet/logo-rect/".concat(inService ? '' : blocklet.meta.did), getSearch(blocklet, customRectLogo));
|
|
36
|
+
const faviconUrl = (0, _urlJoin.default)(prefix, "/blocklet/logo-favicon/".concat(inService ? '' : blocklet.meta.did), getSearch(blocklet, customFavicon));
|
|
22
37
|
return {
|
|
23
|
-
logoUrl
|
|
38
|
+
logoUrl,
|
|
39
|
+
rectLogoUrl,
|
|
40
|
+
faviconUrl
|
|
24
41
|
};
|
|
25
42
|
}
|
package/lib/locales/en.js
CHANGED
|
@@ -280,6 +280,7 @@ module.exports = {
|
|
|
280
280
|
succeeded: 'Succeeded',
|
|
281
281
|
subscription: 'Subscription',
|
|
282
282
|
support: 'Support',
|
|
283
|
+
switch: 'Switch',
|
|
283
284
|
team: 'Team',
|
|
284
285
|
the: 'The',
|
|
285
286
|
timeAgo: '{time} ago',
|
|
@@ -393,10 +394,11 @@ module.exports = {
|
|
|
393
394
|
name: 'Blocklet Name',
|
|
394
395
|
description: 'Blocklet Description',
|
|
395
396
|
sk: 'Secret key for the blocklet wallet',
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
logoFavicon: '
|
|
397
|
+
logoSquare: 'App Logo',
|
|
398
|
+
logoRect: 'Rect logo',
|
|
399
|
+
logoRectDesc: 'Usually displayed at the top of the page, default to app logo',
|
|
400
|
+
logoFavicon: 'Favicon',
|
|
401
|
+
logoFaviconDesc: "Usually displayed in the browser's address bar or tab page, default to app logo",
|
|
400
402
|
clusterSize: 'Instance count when run this blocklet in cluster mode',
|
|
401
403
|
copyrightOwner: 'Copyright Owner (Display in footer)',
|
|
402
404
|
copyrightYear: 'Copyright Year (Display in footer)',
|
package/lib/locales/zh.js
CHANGED
|
@@ -285,6 +285,7 @@ module.exports = {
|
|
|
285
285
|
succeeded: '成功',
|
|
286
286
|
subscription: '订阅',
|
|
287
287
|
support: '服务支持',
|
|
288
|
+
switch: '切换',
|
|
288
289
|
team: '团队',
|
|
289
290
|
the: '此',
|
|
290
291
|
timeAgo: '{time}前',
|
|
@@ -397,10 +398,11 @@ module.exports = {
|
|
|
397
398
|
name: '应用名称',
|
|
398
399
|
description: '应用描述',
|
|
399
400
|
sk: '应用账户私钥',
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
logoFavicon: '
|
|
401
|
+
logoSquare: '应用 Logo',
|
|
402
|
+
logoRect: '横版 Logo',
|
|
403
|
+
logoRectDesc: '通常显示在页面顶部,默认和应用 Logo 相同',
|
|
404
|
+
logoFavicon: 'Favicon',
|
|
405
|
+
logoFaviconDesc: '通常显示在浏览器的地址栏或标签页中,默认和应用 Logo 相同',
|
|
404
406
|
clusterSize: '以 Cluster 模式启动时的实例数量',
|
|
405
407
|
copyrightOwner: '版权所有者 (展示在页脚中)',
|
|
406
408
|
copyrightYear: '版权年份 (展示在页脚中)',
|
package/lib/util/index.js
CHANGED
|
@@ -30,7 +30,7 @@ exports.getBlockletUrl = getBlockletUrl;
|
|
|
30
30
|
exports.getBlockletUrlParams = void 0;
|
|
31
31
|
exports.getBlockletUrls = getBlockletUrls;
|
|
32
32
|
exports.getExplorerLink = getExplorerLink;
|
|
33
|
-
exports.getTransferAppLink = exports.getSystemDomains = exports.getSubscriptionURL = exports.getStoreList = exports.getRenewBlockletURL = exports.getPathPrefix = exports.getIssuePassportLink = exports.getInviteLink = void 0;
|
|
33
|
+
exports.getTransferAppLink = exports.getSystemDomains = exports.getSubscriptionURL = exports.getStoreList = exports.getRenewBlockletURL = exports.getPathPrefix = exports.getLogoHash = exports.getIssuePassportLink = exports.getInviteLink = void 0;
|
|
34
34
|
exports.getWebWalletUrl = getWebWalletUrl;
|
|
35
35
|
exports.isNewStoreUrl = exports.isInstalling = exports.isDownloading = exports.isChrome = exports.isCertificateMatch = exports.isBlockletDev = void 0;
|
|
36
36
|
exports.isProtectedRole = isProtectedRole;
|
|
@@ -727,4 +727,6 @@ const nanoid = function nanoid() {
|
|
|
727
727
|
};
|
|
728
728
|
exports.nanoid = nanoid;
|
|
729
729
|
const getSystemDomains = domains => domains.filter(x => x.isProtected);
|
|
730
|
-
exports.getSystemDomains = getSystemDomains;
|
|
730
|
+
exports.getSystemDomains = getSystemDomains;
|
|
731
|
+
const getLogoHash = logo => encodeURIComponent((logo || '').split('/').slice(-1)[0].slice(0, 7));
|
|
732
|
+
exports.getLogoHash = getLogoHash;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abtnode/ux",
|
|
3
|
-
"version": "1.16.17-beta-
|
|
3
|
+
"version": "1.16.17-beta-2679e686",
|
|
4
4
|
"description": "UX components shared across abtnode packages",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
|
|
28
28
|
"license": "Apache-2.0",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@abtnode/auth": "1.16.17-beta-
|
|
31
|
-
"@abtnode/constant": "1.16.17-beta-
|
|
32
|
-
"@abtnode/util": "1.16.17-beta-
|
|
30
|
+
"@abtnode/auth": "1.16.17-beta-2679e686",
|
|
31
|
+
"@abtnode/constant": "1.16.17-beta-2679e686",
|
|
32
|
+
"@abtnode/util": "1.16.17-beta-2679e686",
|
|
33
33
|
"@ahooksjs/use-url-state": "^3.5.1",
|
|
34
34
|
"@arcblock/did": "^1.18.92",
|
|
35
35
|
"@arcblock/did-connect": "^2.7.29",
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"@arcblock/react-hooks": "^2.7.29",
|
|
40
40
|
"@arcblock/terminal": "^2.7.29",
|
|
41
41
|
"@arcblock/ux": "^2.7.29",
|
|
42
|
-
"@blocklet/constant": "1.16.17-beta-
|
|
43
|
-
"@blocklet/launcher-layout": "2.2.
|
|
42
|
+
"@blocklet/constant": "1.16.17-beta-2679e686",
|
|
43
|
+
"@blocklet/launcher-layout": "2.2.22",
|
|
44
44
|
"@blocklet/list": "^0.12.45",
|
|
45
|
-
"@blocklet/meta": "1.16.17-beta-
|
|
45
|
+
"@blocklet/meta": "1.16.17-beta-2679e686",
|
|
46
46
|
"@blocklet/ui-react": "^2.7.29",
|
|
47
|
-
"@blocklet/uploader": "^0.0.
|
|
47
|
+
"@blocklet/uploader": "^0.0.32",
|
|
48
48
|
"@emotion/react": "^11.10.4",
|
|
49
49
|
"@emotion/styled": "^11.10.4",
|
|
50
50
|
"@iconify/react": "^4.0.0",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"babel-plugin-inline-react-svg": "^1.1.2",
|
|
101
101
|
"glob": "^10.3.3"
|
|
102
102
|
},
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "abbe4a479b379552cd9ebd8c27732b360844cb73",
|
|
104
104
|
"exports": {
|
|
105
105
|
".": {
|
|
106
106
|
"import": "./es/index.js",
|