@abtnode/ux 1.16.16-beta-2e5e3db7 → 1.16.16-beta-cfa95fa6
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/agreement-app.js +3 -2
- package/es/blocklet/audit-logs.js +14 -2
- package/es/blocklet/component/navigation/navigation-preview.js +9 -1
- package/es/blocklet/configuration.js +17 -7
- package/es/blocklet/oauth/federated-detail-dialog.js +26 -6
- package/es/blocklet/oauth/federated-site-list.js +8 -10
- package/es/locales/en.js +2 -0
- package/es/locales/zh.js +2 -0
- package/lib/blocklet/agreement-app.js +3 -2
- package/lib/blocklet/audit-logs.js +11 -3
- package/lib/blocklet/component/navigation/navigation-preview.js +10 -1
- package/lib/blocklet/configuration.js +17 -7
- package/lib/blocklet/oauth/federated-detail-dialog.js +26 -6
- package/lib/blocklet/oauth/federated-site-list.js +11 -14
- package/lib/locales/en.js +2 -0
- package/lib/locales/zh.js +2 -0
- package/package.json +21 -21
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { COPYRIGHT_OWNER } from '@abtnode/constant';
|
|
1
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
3
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
4
|
export default function AgreementApp({
|
|
@@ -10,8 +11,8 @@ export default function AgreementApp({
|
|
|
10
11
|
},
|
|
11
12
|
children: [/*#__PURE__*/_jsx("h3", {
|
|
12
13
|
children: "End User License Agreement for Application"
|
|
13
|
-
}), /*#__PURE__*/
|
|
14
|
-
children: "Blocklet Server License Agreement
|
|
14
|
+
}), /*#__PURE__*/_jsxs("p", {
|
|
15
|
+
children: ["Blocklet Server License Agreement ", COPYRIGHT_OWNER, " version 2020-08-28"]
|
|
15
16
|
}), /*#__PURE__*/_jsx("p", {
|
|
16
17
|
children: "BLOCKLET SERVER LICENSE AGREEMENT"
|
|
17
18
|
}), /*#__PURE__*/_jsx("p", {
|
|
@@ -48,15 +48,21 @@ function AuditLog({
|
|
|
48
48
|
if (!log.actor.did) {
|
|
49
49
|
return null;
|
|
50
50
|
}
|
|
51
|
+
|
|
52
|
+
// HACK: blocklet 类型会在存储前被强制置为 `''`,所以需要增加空字符串判断
|
|
53
|
+
const isUser = !['blocklet', ''].includes(log.actor.role);
|
|
51
54
|
return /*#__PURE__*/_jsxs(Box, {
|
|
52
55
|
className: "log-entry",
|
|
53
56
|
"data-cy": "log-entry",
|
|
54
57
|
children: [/*#__PURE__*/_jsx("div", {
|
|
55
58
|
className: "log-author",
|
|
56
|
-
children: /*#__PURE__*/_jsx(DidAvatar, {
|
|
59
|
+
children: isUser ? /*#__PURE__*/_jsx(DidAvatar, {
|
|
57
60
|
did: log.actor.did,
|
|
58
61
|
size: 36,
|
|
59
62
|
shape: "circle"
|
|
63
|
+
}) : /*#__PURE__*/_jsx(DidAvatar, {
|
|
64
|
+
did: log.actor.did,
|
|
65
|
+
size: 36
|
|
60
66
|
})
|
|
61
67
|
}), /*#__PURE__*/_jsxs("div", {
|
|
62
68
|
className: "log-body",
|
|
@@ -75,7 +81,7 @@ function AuditLog({
|
|
|
75
81
|
},
|
|
76
82
|
children: scopeFormatter(log.scope)
|
|
77
83
|
})
|
|
78
|
-
}), /*#__PURE__*/_jsxs(Link, {
|
|
84
|
+
}), isUser ? /*#__PURE__*/_jsxs(Link, {
|
|
79
85
|
to: getUserLink({
|
|
80
86
|
log,
|
|
81
87
|
inService,
|
|
@@ -83,6 +89,8 @@ function AuditLog({
|
|
|
83
89
|
}),
|
|
84
90
|
target: "_blank",
|
|
85
91
|
children: [log.actor.fullName, log.actor.role ? `(${log.actor.role})` : '']
|
|
92
|
+
}) : /*#__PURE__*/_jsxs("span", {
|
|
93
|
+
children: [log.actor.fullName, log.actor.role ? `(${log.actor.role})` : '']
|
|
86
94
|
}), ' ', /*#__PURE__*/_jsx("span", {
|
|
87
95
|
style: {
|
|
88
96
|
margin: '0 4px'
|
|
@@ -242,6 +250,10 @@ const Div = styled.div`
|
|
|
242
250
|
li {
|
|
243
251
|
list-style-type: disc;
|
|
244
252
|
}
|
|
253
|
+
code.code-highlight {
|
|
254
|
+
max-height: 300px;
|
|
255
|
+
overflow: auto;
|
|
256
|
+
}
|
|
245
257
|
}
|
|
246
258
|
|
|
247
259
|
.log-meta {
|
|
@@ -7,6 +7,7 @@ import Box from '@mui/material/Box';
|
|
|
7
7
|
import Grid from '@mui/material/Grid';
|
|
8
8
|
import Skeleton from '@mui/material/Skeleton';
|
|
9
9
|
import styled from '@emotion/styled';
|
|
10
|
+
import { BLOCKLET_CONFIGURABLE_KEY } from '@blocklet/constant';
|
|
10
11
|
import { useBlockletContext } from '../../../contexts/blocklet';
|
|
11
12
|
import useAppLogo from '../../../hooks/use-app-logo';
|
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -23,13 +24,20 @@ function NavigationPreview({
|
|
|
23
24
|
} = useAppLogo({
|
|
24
25
|
blocklet
|
|
25
26
|
});
|
|
27
|
+
const owner = blocklet?.environments?.find(x => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER)?.value;
|
|
28
|
+
const year = blocklet?.environments?.find(x => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR)?.value;
|
|
29
|
+
const copyright = owner || year ? {
|
|
30
|
+
owner,
|
|
31
|
+
year
|
|
32
|
+
} : undefined;
|
|
26
33
|
const blockletInfo = {
|
|
27
34
|
appId: blocklet.appDid,
|
|
28
35
|
appLogo: logoUrl,
|
|
29
36
|
appName: blocklet.meta.title,
|
|
30
37
|
enableConnect: true,
|
|
31
38
|
enableLocale: false,
|
|
32
|
-
navigation
|
|
39
|
+
navigation,
|
|
40
|
+
copyright
|
|
33
41
|
};
|
|
34
42
|
return /*#__PURE__*/_jsx(LinkBlocker, {
|
|
35
43
|
children: /*#__PURE__*/_jsxs(Box, {
|
|
@@ -67,14 +67,16 @@ function BlockletEnvironment({
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
// configurable blocklet environment
|
|
70
|
-
const customDelete = blocklet.environments.find(x => x.key ===
|
|
70
|
+
const customDelete = blocklet.environments.find(x => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_DELETABLE);
|
|
71
71
|
const deletable = !customDelete || customDelete.value === 'yes';
|
|
72
|
-
const customLanguages = blocklet.environments.find(x => x.key ===
|
|
73
|
-
const customUrl = blocklet.environments.find(x => x.key ===
|
|
74
|
-
const customLogoSquare = blocklet.environments.find(x => x.key ===
|
|
75
|
-
const customLogoRect = blocklet.environments.find(x => x.key ===
|
|
76
|
-
const customLogoFavicon = blocklet.environments.find(x => x.key ===
|
|
77
|
-
const customLogoDeprecated = blocklet.environments.find(x => x.key ===
|
|
72
|
+
const customLanguages = blocklet.environments.find(x => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LANGUAGES);
|
|
73
|
+
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
|
+
const copyrightOwner = blocklet.environments.find(x => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER);
|
|
79
|
+
const copyrightYear = blocklet.environments.find(x => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR);
|
|
78
80
|
const configurableEnvs = [{
|
|
79
81
|
key: BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_NAME,
|
|
80
82
|
description: t('blocklet.config.name'),
|
|
@@ -103,6 +105,14 @@ function BlockletEnvironment({
|
|
|
103
105
|
key: BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO,
|
|
104
106
|
description: t('blocklet.config.logo'),
|
|
105
107
|
value: customLogoDeprecated ? customLogoDeprecated.value : ''
|
|
108
|
+
}, {
|
|
109
|
+
key: BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER,
|
|
110
|
+
description: t('blocklet.config.copyrightOwner'),
|
|
111
|
+
value: copyrightOwner ? copyrightOwner.value : ''
|
|
112
|
+
}, {
|
|
113
|
+
key: BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR,
|
|
114
|
+
description: t('blocklet.config.copyrightYear'),
|
|
115
|
+
value: copyrightYear ? copyrightYear.value : ''
|
|
106
116
|
}];
|
|
107
117
|
if (clusterMode) {
|
|
108
118
|
const exist = blocklet.configs.find(x => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE);
|
|
@@ -10,6 +10,8 @@ import { Box, Button, SvgIcon } from '@mui/material';
|
|
|
10
10
|
import { Address } from '@arcblock/did-connect';
|
|
11
11
|
import Dialog from '@arcblock/ux/lib/Dialog';
|
|
12
12
|
import StarsIcon from '@mui/icons-material/Stars';
|
|
13
|
+
import isUrl from 'is-url';
|
|
14
|
+
import joinUrl from 'url-join';
|
|
13
15
|
import { useBlockletContext } from '../../contexts/blocklet';
|
|
14
16
|
import { useNodeContext } from '../../contexts/node';
|
|
15
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -61,6 +63,9 @@ const FederatedDetailDialog = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
61
63
|
approve
|
|
62
64
|
}), [open, close, approve]);
|
|
63
65
|
const infoList = useCreation(() => {
|
|
66
|
+
if (!state.show) {
|
|
67
|
+
return [];
|
|
68
|
+
}
|
|
64
69
|
state.data.migratedFrom = [state.data.appId, state.data.appPid];
|
|
65
70
|
const keys = ['appName', 'appLogo', 'appId', 'appPid', 'migratedFrom', 'appDescription', 'appUrl', 'version', 'appliedAt', 'status', 'serverId', 'serverVersion'];
|
|
66
71
|
if (state.data.isMaster !== false) {
|
|
@@ -92,12 +97,27 @@ const FederatedDetailDialog = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
92
97
|
});
|
|
93
98
|
}
|
|
94
99
|
if (['appLogo'].includes(key)) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
const logoUrl = isUrl(value) ? value : joinUrl(state.data.appUrl || '', value || '');
|
|
101
|
+
try {
|
|
102
|
+
const logoUrlInstance = new URL(logoUrl);
|
|
103
|
+
logoUrlInstance.searchParams.set('imageFilter', 'resize');
|
|
104
|
+
// HACK: 保持跟其他地方使用的尺寸一致,可以复用同一资源的缓存,减少网络请求
|
|
105
|
+
logoUrlInstance.searchParams.set('w', '80');
|
|
106
|
+
logoUrlInstance.searchParams.set('h', '80');
|
|
107
|
+
value = /*#__PURE__*/_jsx("img", {
|
|
108
|
+
src: logoUrlInstance.href,
|
|
109
|
+
width: "60",
|
|
110
|
+
height: "60",
|
|
111
|
+
alt: state.data.appName
|
|
112
|
+
});
|
|
113
|
+
} catch {
|
|
114
|
+
value = /*#__PURE__*/_jsx("img", {
|
|
115
|
+
src: logoUrl,
|
|
116
|
+
width: "60",
|
|
117
|
+
height: "60",
|
|
118
|
+
alt: state.data.appName
|
|
119
|
+
});
|
|
120
|
+
}
|
|
101
121
|
}
|
|
102
122
|
if (key === 'status') {
|
|
103
123
|
value = value && t(`federated.status.${value}`);
|
|
@@ -11,6 +11,7 @@ import { useContext, useRef, useState } from 'react';
|
|
|
11
11
|
import { useCreation, useMemoizedFn } from 'ahooks';
|
|
12
12
|
import Button from '@arcblock/ux/lib/Button';
|
|
13
13
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
14
|
+
import { BLOCKLET_CONFIGURABLE_KEY } from '@blocklet/constant';
|
|
14
15
|
import { useBlockletContext } from '../../contexts/blocklet';
|
|
15
16
|
import { useNodeContext } from '../../contexts/node';
|
|
16
17
|
import useConfirm from '../../hooks/confirm';
|
|
@@ -226,16 +227,13 @@ function FederatedSiteList({
|
|
|
226
227
|
};
|
|
227
228
|
}, []);
|
|
228
229
|
const showInvite = useMemoizedFn(() => {
|
|
229
|
-
const
|
|
230
|
-
if (
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
} catch {
|
|
237
|
-
Toast.error(t('federated.failedToGetFederatedLoginLink'));
|
|
238
|
-
}
|
|
230
|
+
const customUrl = blocklet.environments.find(x => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL);
|
|
231
|
+
if (customUrl?.value) {
|
|
232
|
+
federatedInviteDialogRef.current?.open({
|
|
233
|
+
link: customUrl.value
|
|
234
|
+
});
|
|
235
|
+
} else {
|
|
236
|
+
Toast.error(t('federated.failedToGetFederatedLoginLink'));
|
|
239
237
|
}
|
|
240
238
|
}, [blocklet.site?.domainAliases?.[0]?.href]);
|
|
241
239
|
const [checked, setChecked] = useState(federatedConfig.autoLogin || false);
|
package/es/locales/en.js
CHANGED
|
@@ -391,6 +391,8 @@ module.exports = {
|
|
|
391
391
|
logoRect: 'Horizontal logo URL or path for the blocklet (optional)',
|
|
392
392
|
logoFavicon: 'favicon URL or path for the blocklet (optional, default to square logo)',
|
|
393
393
|
clusterSize: 'Instance count when run this blocklet in cluster mode',
|
|
394
|
+
copyrightOwner: 'Copyright Owner (Display in footer)',
|
|
395
|
+
copyrightYear: 'Copyright Year (Display in footer)',
|
|
394
396
|
deletable: {
|
|
395
397
|
name: 'Delete Protection',
|
|
396
398
|
enable: 'This blocklet can NOT currently be deleted',
|
package/es/locales/zh.js
CHANGED
|
@@ -395,6 +395,8 @@ module.exports = {
|
|
|
395
395
|
logoRect: '横版 Logo 地址或路径 (可选)',
|
|
396
396
|
logoFavicon: 'favicon 地址或路径 (可选,默认和正方形 Logo 相同)',
|
|
397
397
|
clusterSize: '以 Cluster 模式启动时的实例数量',
|
|
398
|
+
copyrightOwner: '版权所有者 (展示在页脚中)',
|
|
399
|
+
copyrightYear: '版权年份 (展示在页脚中)',
|
|
398
400
|
deletable: {
|
|
399
401
|
name: '删除保护',
|
|
400
402
|
enable: '此应用当前不可被删除',
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = AgreementApp;
|
|
7
|
+
var _constant = require("@abtnode/constant");
|
|
7
8
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
9
|
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; }
|
|
9
10
|
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; }
|
|
@@ -19,8 +20,8 @@ function AgreementApp(_ref) {
|
|
|
19
20
|
},
|
|
20
21
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h3", {
|
|
21
22
|
children: "End User License Agreement for Application"
|
|
22
|
-
}), /*#__PURE__*/(0, _jsxRuntime.
|
|
23
|
-
children: "Blocklet Server License Agreement
|
|
23
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
|
|
24
|
+
children: ["Blocklet Server License Agreement ", _constant.COPYRIGHT_OWNER, " version 2020-08-28"]
|
|
24
25
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
25
26
|
children: "BLOCKLET SERVER LICENSE AGREEMENT"
|
|
26
27
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
@@ -59,15 +59,21 @@ function AuditLog(_ref2) {
|
|
|
59
59
|
if (!log.actor.did) {
|
|
60
60
|
return null;
|
|
61
61
|
}
|
|
62
|
+
|
|
63
|
+
// HACK: blocklet 类型会在存储前被强制置为 `''`,所以需要增加空字符串判断
|
|
64
|
+
const isUser = !['blocklet', ''].includes(log.actor.role);
|
|
62
65
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
63
66
|
className: "log-entry",
|
|
64
67
|
"data-cy": "log-entry",
|
|
65
68
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
66
69
|
className: "log-author",
|
|
67
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Avatar.default, {
|
|
70
|
+
children: isUser ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Avatar.default, {
|
|
68
71
|
did: log.actor.did,
|
|
69
72
|
size: 36,
|
|
70
73
|
shape: "circle"
|
|
74
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Avatar.default, {
|
|
75
|
+
did: log.actor.did,
|
|
76
|
+
size: 36
|
|
71
77
|
})
|
|
72
78
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
73
79
|
className: "log-body",
|
|
@@ -86,7 +92,7 @@ function AuditLog(_ref2) {
|
|
|
86
92
|
},
|
|
87
93
|
children: scopeFormatter(log.scope)
|
|
88
94
|
})
|
|
89
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactRouterDom.Link, {
|
|
95
|
+
}), isUser ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactRouterDom.Link, {
|
|
90
96
|
to: getUserLink({
|
|
91
97
|
log,
|
|
92
98
|
inService,
|
|
@@ -94,6 +100,8 @@ function AuditLog(_ref2) {
|
|
|
94
100
|
}),
|
|
95
101
|
target: "_blank",
|
|
96
102
|
children: [log.actor.fullName, log.actor.role ? "(".concat(log.actor.role, ")") : '']
|
|
103
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
104
|
+
children: [log.actor.fullName, log.actor.role ? "(".concat(log.actor.role, ")") : '']
|
|
97
105
|
}), ' ', /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
98
106
|
style: {
|
|
99
107
|
margin: '0 4px'
|
|
@@ -218,7 +226,7 @@ function WrappedAuditLogs(_ref3) {
|
|
|
218
226
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(AuditLogs, {})
|
|
219
227
|
});
|
|
220
228
|
}
|
|
221
|
-
const Div = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .log-controls {\n display: flex;\n justify-content: space-between;\n }\n .log-entry {\n display: flex;\n margin: 16px 0;\n\n .log-author {\n margin-right: 8px;\n }\n\n .log-body {\n flex: 1;\n\n a {\n color: ", ";\n }\n\n .log-header {\n }\n\n .log-content {\n p {\n margin-bottom: 4px;\n }\n ul,\n ol {\n padding-left: 2rem;\n }\n li {\n list-style-type: disc;\n }\n }\n\n .log-meta {\n margin-top: 4px;\n\n span {\n font-size: 0.8rem;\n display: inline-block;\n margin-right: 8px;\n padding-right: 8px;\n border-right: 1px solid #ccc;\n\n &:last-of-type {\n border-right: none;\n }\n }\n }\n }\n }\n"])), _ref4 => {
|
|
229
|
+
const Div = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .log-controls {\n display: flex;\n justify-content: space-between;\n }\n .log-entry {\n display: flex;\n margin: 16px 0;\n\n .log-author {\n margin-right: 8px;\n }\n\n .log-body {\n flex: 1;\n\n a {\n color: ", ";\n }\n\n .log-header {\n }\n\n .log-content {\n p {\n margin-bottom: 4px;\n }\n ul,\n ol {\n padding-left: 2rem;\n }\n li {\n list-style-type: disc;\n }\n code.code-highlight {\n max-height: 300px;\n overflow: auto;\n }\n }\n\n .log-meta {\n margin-top: 4px;\n\n span {\n font-size: 0.8rem;\n display: inline-block;\n margin-right: 8px;\n padding-right: 8px;\n border-right: 1px solid #ccc;\n\n &:last-of-type {\n border-right: none;\n }\n }\n }\n }\n }\n"])), _ref4 => {
|
|
222
230
|
let {
|
|
223
231
|
theme
|
|
224
232
|
} = _ref4;
|
|
@@ -13,6 +13,7 @@ var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
|
13
13
|
var _Grid = _interopRequireDefault(require("@mui/material/Grid"));
|
|
14
14
|
var _Skeleton = _interopRequireDefault(require("@mui/material/Skeleton"));
|
|
15
15
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
16
|
+
var _constant = require("@blocklet/constant");
|
|
16
17
|
var _blocklet = require("../../../contexts/blocklet");
|
|
17
18
|
var _useAppLogo = _interopRequireDefault(require("../../../hooks/use-app-logo"));
|
|
18
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -20,6 +21,7 @@ var _templateObject;
|
|
|
20
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
22
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
22
23
|
function NavigationPreview(_ref) {
|
|
24
|
+
var _blocklet$environment, _blocklet$environment2, _blocklet$environment3, _blocklet$environment4;
|
|
23
25
|
let {
|
|
24
26
|
className,
|
|
25
27
|
navigation
|
|
@@ -32,13 +34,20 @@ function NavigationPreview(_ref) {
|
|
|
32
34
|
} = (0, _useAppLogo.default)({
|
|
33
35
|
blocklet
|
|
34
36
|
});
|
|
37
|
+
const owner = blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$environment = blocklet.environments) === null || _blocklet$environment === void 0 ? void 0 : (_blocklet$environment2 = _blocklet$environment.find(x => x.key === _constant.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER)) === null || _blocklet$environment2 === void 0 ? void 0 : _blocklet$environment2.value;
|
|
38
|
+
const year = blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$environment3 = blocklet.environments) === null || _blocklet$environment3 === void 0 ? void 0 : (_blocklet$environment4 = _blocklet$environment3.find(x => x.key === _constant.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR)) === null || _blocklet$environment4 === void 0 ? void 0 : _blocklet$environment4.value;
|
|
39
|
+
const copyright = owner || year ? {
|
|
40
|
+
owner,
|
|
41
|
+
year
|
|
42
|
+
} : undefined;
|
|
35
43
|
const blockletInfo = {
|
|
36
44
|
appId: blocklet.appDid,
|
|
37
45
|
appLogo: logoUrl,
|
|
38
46
|
appName: blocklet.meta.title,
|
|
39
47
|
enableConnect: true,
|
|
40
48
|
enableLocale: false,
|
|
41
|
-
navigation
|
|
49
|
+
navigation,
|
|
50
|
+
copyright
|
|
42
51
|
};
|
|
43
52
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_linkBlocker.default, {
|
|
44
53
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
@@ -87,14 +87,16 @@ function BlockletEnvironment(_ref) {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
// configurable blocklet environment
|
|
90
|
-
const customDelete = blocklet.environments.find(x => x.key ===
|
|
90
|
+
const customDelete = blocklet.environments.find(x => x.key === _constant2.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_DELETABLE);
|
|
91
91
|
const deletable = !customDelete || customDelete.value === 'yes';
|
|
92
|
-
const customLanguages = blocklet.environments.find(x => x.key ===
|
|
93
|
-
const customUrl = blocklet.environments.find(x => x.key ===
|
|
94
|
-
const customLogoSquare = blocklet.environments.find(x => x.key ===
|
|
95
|
-
const customLogoRect = blocklet.environments.find(x => x.key ===
|
|
96
|
-
const customLogoFavicon = blocklet.environments.find(x => x.key ===
|
|
97
|
-
const customLogoDeprecated = blocklet.environments.find(x => x.key ===
|
|
92
|
+
const customLanguages = blocklet.environments.find(x => x.key === _constant2.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LANGUAGES);
|
|
93
|
+
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
|
+
const copyrightOwner = blocklet.environments.find(x => x.key === _constant2.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER);
|
|
99
|
+
const copyrightYear = blocklet.environments.find(x => x.key === _constant2.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR);
|
|
98
100
|
const configurableEnvs = [{
|
|
99
101
|
key: _constant2.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_NAME,
|
|
100
102
|
description: t('blocklet.config.name'),
|
|
@@ -123,6 +125,14 @@ function BlockletEnvironment(_ref) {
|
|
|
123
125
|
key: _constant2.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO,
|
|
124
126
|
description: t('blocklet.config.logo'),
|
|
125
127
|
value: customLogoDeprecated ? customLogoDeprecated.value : ''
|
|
128
|
+
}, {
|
|
129
|
+
key: _constant2.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER,
|
|
130
|
+
description: t('blocklet.config.copyrightOwner'),
|
|
131
|
+
value: copyrightOwner ? copyrightOwner.value : ''
|
|
132
|
+
}, {
|
|
133
|
+
key: _constant2.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR,
|
|
134
|
+
description: t('blocklet.config.copyrightYear'),
|
|
135
|
+
value: copyrightYear ? copyrightYear.value : ''
|
|
126
136
|
}];
|
|
127
137
|
if (clusterMode) {
|
|
128
138
|
const exist = blocklet.configs.find(x => x.key === _constant2.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE);
|
|
@@ -16,6 +16,8 @@ var _material = require("@mui/material");
|
|
|
16
16
|
var _didConnect = require("@arcblock/did-connect");
|
|
17
17
|
var _Dialog = _interopRequireDefault(require("@arcblock/ux/lib/Dialog"));
|
|
18
18
|
var _Stars = _interopRequireDefault(require("@mui/icons-material/Stars"));
|
|
19
|
+
var _isUrl = _interopRequireDefault(require("is-url"));
|
|
20
|
+
var _urlJoin = _interopRequireDefault(require("url-join"));
|
|
19
21
|
var _blocklet = require("../../contexts/blocklet");
|
|
20
22
|
var _node = require("../../contexts/node");
|
|
21
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -68,6 +70,9 @@ const FederatedDetailDialog = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
|
|
|
68
70
|
approve
|
|
69
71
|
}), [open, close, approve]);
|
|
70
72
|
const infoList = (0, _ahooks.useCreation)(() => {
|
|
73
|
+
if (!state.show) {
|
|
74
|
+
return [];
|
|
75
|
+
}
|
|
71
76
|
state.data.migratedFrom = [state.data.appId, state.data.appPid];
|
|
72
77
|
const keys = ['appName', 'appLogo', 'appId', 'appPid', 'migratedFrom', 'appDescription', 'appUrl', 'version', 'appliedAt', 'status', 'serverId', 'serverVersion'];
|
|
73
78
|
if (state.data.isMaster !== false) {
|
|
@@ -99,12 +104,27 @@ const FederatedDetailDialog = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
|
|
|
99
104
|
});
|
|
100
105
|
}
|
|
101
106
|
if (['appLogo'].includes(key)) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
107
|
+
const logoUrl = (0, _isUrl.default)(value) ? value : (0, _urlJoin.default)(state.data.appUrl || '', value || '');
|
|
108
|
+
try {
|
|
109
|
+
const logoUrlInstance = new URL(logoUrl);
|
|
110
|
+
logoUrlInstance.searchParams.set('imageFilter', 'resize');
|
|
111
|
+
// HACK: 保持跟其他地方使用的尺寸一致,可以复用同一资源的缓存,减少网络请求
|
|
112
|
+
logoUrlInstance.searchParams.set('w', '80');
|
|
113
|
+
logoUrlInstance.searchParams.set('h', '80');
|
|
114
|
+
value = /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
115
|
+
src: logoUrlInstance.href,
|
|
116
|
+
width: "60",
|
|
117
|
+
height: "60",
|
|
118
|
+
alt: state.data.appName
|
|
119
|
+
});
|
|
120
|
+
} catch (_unused) {
|
|
121
|
+
value = /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
122
|
+
src: logoUrl,
|
|
123
|
+
width: "60",
|
|
124
|
+
height: "60",
|
|
125
|
+
alt: state.data.appName
|
|
126
|
+
});
|
|
127
|
+
}
|
|
108
128
|
}
|
|
109
129
|
if (key === 'status') {
|
|
110
130
|
value = value && t("federated.status.".concat(value));
|
|
@@ -16,6 +16,7 @@ var _react = require("react");
|
|
|
16
16
|
var _ahooks = require("ahooks");
|
|
17
17
|
var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
|
|
18
18
|
var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
|
|
19
|
+
var _constant = require("@blocklet/constant");
|
|
19
20
|
var _blocklet = require("../../contexts/blocklet");
|
|
20
21
|
var _node = require("../../contexts/node");
|
|
21
22
|
var _confirm = _interopRequireDefault(require("../../hooks/confirm"));
|
|
@@ -27,7 +28,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
27
28
|
/* eslint-disable react/no-unstable-nested-components */
|
|
28
29
|
|
|
29
30
|
function FederatedSiteList(_ref) {
|
|
30
|
-
var _blocklet$settings$fe, _blocklet$settings$fe2, _blocklet$
|
|
31
|
+
var _blocklet$settings$fe, _blocklet$settings$fe2, _blocklet$site, _blocklet$site$domain, _blocklet$site$domain2;
|
|
31
32
|
let {
|
|
32
33
|
mode
|
|
33
34
|
} = _ref;
|
|
@@ -237,20 +238,16 @@ function FederatedSiteList(_ref) {
|
|
|
237
238
|
};
|
|
238
239
|
}, []);
|
|
239
240
|
const showInvite = (0, _ahooks.useMemoizedFn)(() => {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
});
|
|
249
|
-
} catch (_unused) {
|
|
250
|
-
_Toast.default.error(t('federated.failedToGetFederatedLoginLink'));
|
|
251
|
-
}
|
|
241
|
+
const customUrl = blocklet.environments.find(x => x.key === _constant.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL);
|
|
242
|
+
if (customUrl !== null && customUrl !== void 0 && customUrl.value) {
|
|
243
|
+
var _federatedInviteDialo;
|
|
244
|
+
(_federatedInviteDialo = federatedInviteDialogRef.current) === null || _federatedInviteDialo === void 0 ? void 0 : _federatedInviteDialo.open({
|
|
245
|
+
link: customUrl.value
|
|
246
|
+
});
|
|
247
|
+
} else {
|
|
248
|
+
_Toast.default.error(t('federated.failedToGetFederatedLoginLink'));
|
|
252
249
|
}
|
|
253
|
-
}, [(_blocklet$
|
|
250
|
+
}, [(_blocklet$site = blocklet.site) === null || _blocklet$site === void 0 ? void 0 : (_blocklet$site$domain = _blocklet$site.domainAliases) === null || _blocklet$site$domain === void 0 ? void 0 : (_blocklet$site$domain2 = _blocklet$site$domain[0]) === null || _blocklet$site$domain2 === void 0 ? void 0 : _blocklet$site$domain2.href]);
|
|
254
251
|
const [checked, setChecked] = (0, _react.useState)(federatedConfig.autoLogin || false);
|
|
255
252
|
const changeAutoLogin = (0, _ahooks.useMemoizedFn)(() => {
|
|
256
253
|
confirmApi.open({
|
package/lib/locales/en.js
CHANGED
|
@@ -393,6 +393,8 @@ module.exports = {
|
|
|
393
393
|
logoRect: 'Horizontal logo URL or path for the blocklet (optional)',
|
|
394
394
|
logoFavicon: 'favicon URL or path for the blocklet (optional, default to square logo)',
|
|
395
395
|
clusterSize: 'Instance count when run this blocklet in cluster mode',
|
|
396
|
+
copyrightOwner: 'Copyright Owner (Display in footer)',
|
|
397
|
+
copyrightYear: 'Copyright Year (Display in footer)',
|
|
396
398
|
deletable: {
|
|
397
399
|
name: 'Delete Protection',
|
|
398
400
|
enable: 'This blocklet can NOT currently be deleted',
|
package/lib/locales/zh.js
CHANGED
|
@@ -397,6 +397,8 @@ module.exports = {
|
|
|
397
397
|
logoRect: '横版 Logo 地址或路径 (可选)',
|
|
398
398
|
logoFavicon: 'favicon 地址或路径 (可选,默认和正方形 Logo 相同)',
|
|
399
399
|
clusterSize: '以 Cluster 模式启动时的实例数量',
|
|
400
|
+
copyrightOwner: '版权所有者 (展示在页脚中)',
|
|
401
|
+
copyrightYear: '版权年份 (展示在页脚中)',
|
|
400
402
|
deletable: {
|
|
401
403
|
name: '删除保护',
|
|
402
404
|
enable: '此应用当前不可被删除',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abtnode/ux",
|
|
3
|
-
"version": "1.16.16-beta-
|
|
3
|
+
"version": "1.16.16-beta-cfa95fa6",
|
|
4
4
|
"description": "UX components shared across abtnode packages",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -27,32 +27,32 @@
|
|
|
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.16-beta-
|
|
31
|
-
"@abtnode/constant": "1.16.16-beta-
|
|
32
|
-
"@abtnode/util": "1.16.16-beta-
|
|
30
|
+
"@abtnode/auth": "1.16.16-beta-cfa95fa6",
|
|
31
|
+
"@abtnode/constant": "1.16.16-beta-cfa95fa6",
|
|
32
|
+
"@abtnode/util": "1.16.16-beta-cfa95fa6",
|
|
33
33
|
"@ahooksjs/use-url-state": "^3.5.1",
|
|
34
34
|
"@arcblock/did": "^1.18.90",
|
|
35
|
-
"@arcblock/did-connect": "^2.7.
|
|
35
|
+
"@arcblock/did-connect": "^2.7.23",
|
|
36
36
|
"@arcblock/did-motif": "^1.1.13",
|
|
37
|
-
"@arcblock/icons": "^2.7.
|
|
38
|
-
"@arcblock/nft-display": "2.7.
|
|
39
|
-
"@arcblock/react-hooks": "^2.7.
|
|
40
|
-
"@arcblock/terminal": "^2.7.
|
|
41
|
-
"@arcblock/ux": "^2.7.
|
|
42
|
-
"@blocklet/constant": "1.16.16-beta-
|
|
43
|
-
"@blocklet/launcher-layout": "2.2.
|
|
44
|
-
"@blocklet/list": "^0.12.
|
|
45
|
-
"@blocklet/meta": "1.16.16-beta-
|
|
46
|
-
"@blocklet/ui-react": "^2.7.
|
|
37
|
+
"@arcblock/icons": "^2.7.23",
|
|
38
|
+
"@arcblock/nft-display": "2.7.23",
|
|
39
|
+
"@arcblock/react-hooks": "^2.7.23",
|
|
40
|
+
"@arcblock/terminal": "^2.7.23",
|
|
41
|
+
"@arcblock/ux": "^2.7.23",
|
|
42
|
+
"@blocklet/constant": "1.16.16-beta-cfa95fa6",
|
|
43
|
+
"@blocklet/launcher-layout": "2.2.16",
|
|
44
|
+
"@blocklet/list": "^0.12.42",
|
|
45
|
+
"@blocklet/meta": "1.16.16-beta-cfa95fa6",
|
|
46
|
+
"@blocklet/ui-react": "^2.7.23",
|
|
47
47
|
"@emotion/react": "^11.10.4",
|
|
48
48
|
"@emotion/styled": "^11.10.4",
|
|
49
49
|
"@iconify/react": "^4.0.0",
|
|
50
50
|
"@material-table/core": "^0.2.48",
|
|
51
|
-
"@mui/icons-material": "^5.
|
|
52
|
-
"@mui/lab": "^5.0.0-alpha.
|
|
53
|
-
"@mui/material": "^5.10
|
|
54
|
-
"@mui/styles": "^5.10
|
|
55
|
-
"@mui/x-date-pickers": "^6.
|
|
51
|
+
"@mui/icons-material": "^5.14.9",
|
|
52
|
+
"@mui/lab": "^5.0.0-alpha.145",
|
|
53
|
+
"@mui/material": "^5.14.10",
|
|
54
|
+
"@mui/styles": "^5.14.10",
|
|
55
|
+
"@mui/x-date-pickers": "^6.14.0",
|
|
56
56
|
"@ocap/client": "1.18.90",
|
|
57
57
|
"@uiw/react-markdown-preview": "4.0.6",
|
|
58
58
|
"ahooks": "^3.7.1",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"babel-plugin-inline-react-svg": "^1.1.2",
|
|
99
99
|
"glob": "^10.3.3"
|
|
100
100
|
},
|
|
101
|
-
"gitHead": "
|
|
101
|
+
"gitHead": "7c554d38470156df47f8bc5bc6da1e359b007552",
|
|
102
102
|
"exports": {
|
|
103
103
|
".": {
|
|
104
104
|
"import": "./es/index.js",
|