@abtnode/ux 1.16.28-beta-17c98819 → 1.16.28-beta-10ca1aad
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/analytics/traffic.js +4 -10
- package/lib/blocklet/authentication/federated/federated-detail-dialog.js +2 -2
- package/lib/blocklet/blocklet-source.js +2 -2
- package/lib/blocklet/component/did-space/connect-to.js +4 -4
- package/lib/blocklet/component/navigation/navigation-dialog.js +2 -3
- package/lib/blocklet/component/space-connector.js +3 -3
- package/lib/blocklet/component/space-selector.js +2 -2
- package/lib/blocklet/component/store-blocklet-list.js +3 -3
- package/lib/blocklet/logo-uploader.js +2 -2
- package/lib/blocklet/notification/push-kit.js +1 -1
- package/lib/blocklet/preferences/index.js +3 -3
- package/lib/blocklet/publish/create-release/keep-now-resources.js +15 -0
- package/lib/blocklet/publish/create-release/resources.js +4 -3
- package/lib/blocklet/publish/release-list.js +4 -4
- package/lib/blocklet/purchase/component-purchase.js +2 -2
- package/lib/blocklet/storage/connect-to.js +4 -4
- package/lib/blocklet/storage/item.js +3 -3
- package/lib/blocklet/util.js +4 -4
- package/lib/hooks/url-evaluation.js +2 -2
- package/lib/hooks/use-app-logo.js +4 -4
- package/lib/hooks/use-bundle-logo.js +4 -4
- package/lib/invitation/invitation-receive.js +1 -1
- package/lib/locales/ar.js +1 -1
- package/lib/locales/de.js +1 -1
- package/lib/locales/en.js +4 -0
- package/lib/locales/es.js +1 -1
- package/lib/locales/fr.js +1 -1
- package/lib/locales/hi.js +1 -1
- package/lib/locales/id.js +1 -1
- package/lib/locales/ja.js +1 -1
- package/lib/locales/ko.js +1 -1
- package/lib/locales/pt.js +1 -1
- package/lib/locales/ru.js +1 -1
- package/lib/locales/th.js +1 -1
- package/lib/locales/vi.js +1 -1
- package/lib/locales/zh-tw.js +2 -2
- package/lib/locales/zh.js +6 -2
- package/lib/store/connect-actions.js +2 -2
- package/lib/store/item.js +2 -2
- package/lib/team/members/util.js +3 -3
- package/lib/util/index.js +18 -18
- package/lib/util/join-url-keep-search.js +2 -2
- package/lib/util/spaces.js +4 -2
- package/package.json +19 -20
package/lib/analytics/traffic.js
CHANGED
|
@@ -3,16 +3,10 @@
|
|
|
3
3
|
import { useEffect, useState } from 'react';
|
|
4
4
|
import dayjs from '@abtnode/util/lib/dayjs';
|
|
5
5
|
import nthArg from 'lodash/nthArg';
|
|
6
|
-
import
|
|
6
|
+
import { joinURL } from 'ufo';
|
|
7
7
|
import useAsyncRetry from 'react-use/lib/useAsyncRetry';
|
|
8
8
|
import Iframe from 'react-iframe';
|
|
9
|
-
import Alert from '@mui/material
|
|
10
|
-
import Spinner from '@mui/material/CircularProgress';
|
|
11
|
-
import Grid from '@mui/material/Grid';
|
|
12
|
-
import Typography from '@mui/material/Typography';
|
|
13
|
-
import Button from '@mui/material/Button';
|
|
14
|
-
import IconButton from '@mui/material/IconButton';
|
|
15
|
-
import Popover from '@mui/material/Popover';
|
|
9
|
+
import { Alert, CircularProgress, Grid, Typography, Button, IconButton, Popover } from '@mui/material';
|
|
16
10
|
import ViewIcon from '@mui/icons-material/LaunchOutlined';
|
|
17
11
|
import { DateRangePicker } from 'mui-daterange-picker';
|
|
18
12
|
import { DatePicker } from '@mui/x-date-pickers';
|
|
@@ -114,7 +108,7 @@ export default function TrafficInsights({
|
|
|
114
108
|
error
|
|
115
109
|
} = data;
|
|
116
110
|
if (!list.length && loading) {
|
|
117
|
-
return /*#__PURE__*/_jsx(
|
|
111
|
+
return /*#__PURE__*/_jsx(CircularProgress, {});
|
|
118
112
|
}
|
|
119
113
|
if (error) {
|
|
120
114
|
return /*#__PURE__*/_jsx(Alert, {
|
|
@@ -150,7 +144,7 @@ export default function TrafficInsights({
|
|
|
150
144
|
|
|
151
145
|
// eslint-disable-next-line no-nested-ternary
|
|
152
146
|
const pathPrefix = inService ? WELLKNOWN_SERVICE_PATH_PREFIX : process.env.NODE_ENV === 'production' ? info.routing.adminPath : '';
|
|
153
|
-
const breakdownUrl =
|
|
147
|
+
const breakdownUrl = joinURL(window.location.origin, pathPrefix, `/api/analytics/traffic?date=${dayjs(date).format('YYYY-MM-DD')}&did=${did}`);
|
|
154
148
|
const onRangeChange = range => {
|
|
155
149
|
setDateRange(range);
|
|
156
150
|
setAnchorEl(null);
|
|
@@ -11,7 +11,7 @@ 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
13
|
import isUrl from 'is-url';
|
|
14
|
-
import
|
|
14
|
+
import { joinURL } from 'ufo';
|
|
15
15
|
import { useBlockletContext } from '../../../contexts/blocklet';
|
|
16
16
|
import { useNodeContext } from '../../../contexts/node';
|
|
17
17
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -95,7 +95,7 @@ const FederatedDetailDialog = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
97
|
if (['appLogo'].includes(key)) {
|
|
98
|
-
const logoUrl = isUrl(value) ? value :
|
|
98
|
+
const logoUrl = isUrl(value) ? value : joinURL(state.data.appUrl || '', value || '');
|
|
99
99
|
try {
|
|
100
100
|
const logoUrlInstance = new URL(logoUrl);
|
|
101
101
|
logoUrlInstance.searchParams.set('imageFilter', 'resize');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import
|
|
3
|
+
import { joinURL } from 'ufo';
|
|
4
4
|
import toUpper from 'lodash/toUpper';
|
|
5
5
|
import Tag from '@arcblock/ux/lib/Tag';
|
|
6
6
|
import { LocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
@@ -21,7 +21,7 @@ export default function BlockletSource({
|
|
|
21
21
|
type: "success",
|
|
22
22
|
children: toUpper(sourceInfo.source)
|
|
23
23
|
}, "source"), sourceInfo.source === 'registry' && /*#__PURE__*/_jsx(ExternalLink, {
|
|
24
|
-
href:
|
|
24
|
+
href: joinURL(sourceInfo.deployedFrom, 'blocklets', blocklet?.meta?.bundleDid || ''),
|
|
25
25
|
target: "_blank",
|
|
26
26
|
className: "page-link",
|
|
27
27
|
underline: "hover",
|
|
@@ -3,7 +3,7 @@ import React, { useState } from 'react';
|
|
|
3
3
|
import Button from '@arcblock/ux/lib/Button';
|
|
4
4
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
5
5
|
import DidConnect from '@arcblock/did-connect/lib/Connect';
|
|
6
|
-
import
|
|
6
|
+
import { joinURL } from 'ufo';
|
|
7
7
|
import toast from '@arcblock/ux/lib/Toast';
|
|
8
8
|
import SplitButton from '@arcblock/ux/lib/SplitButton';
|
|
9
9
|
import Dialog from '@arcblock/ux/lib/Dialog';
|
|
@@ -62,7 +62,7 @@ function ConnectTo({
|
|
|
62
62
|
checkTimeout: 1000 * 300,
|
|
63
63
|
prefix: '/api/did',
|
|
64
64
|
checkFn: axios.create({
|
|
65
|
-
baseURL:
|
|
65
|
+
baseURL: joinURL(window.location.origin, getPathPrefix())
|
|
66
66
|
}).get,
|
|
67
67
|
messages: {
|
|
68
68
|
title: t('storage.spaces.provideNFT.title', {
|
|
@@ -191,10 +191,10 @@ function ConnectTo({
|
|
|
191
191
|
setAuthorizeConnect(preValue => ({
|
|
192
192
|
...preValue,
|
|
193
193
|
open: true,
|
|
194
|
-
prefix:
|
|
194
|
+
prefix: joinURL(didSpacesCoreUrl, 'space/api/did'),
|
|
195
195
|
baseUrl: new URL(didSpacesCoreUrl).origin,
|
|
196
196
|
checkFn: axios.create({
|
|
197
|
-
baseURL:
|
|
197
|
+
baseURL: joinURL(didSpacesCoreUrl, 'space')
|
|
198
198
|
}).get,
|
|
199
199
|
extraParams: {
|
|
200
200
|
appDid: blockletInfo.appDid,
|
|
@@ -23,8 +23,7 @@ import { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRe
|
|
|
23
23
|
import { Controller, useForm } from 'react-hook-form';
|
|
24
24
|
import { Icon, loadIcon } from '@iconify/react';
|
|
25
25
|
import { isMatchSection, checkLink, flattenNavigation } from '@blocklet/meta/lib/parse-navigation-from-blocklet';
|
|
26
|
-
import
|
|
27
|
-
import { withoutTrailingSlash } from 'ufo/dist/index.mjs';
|
|
26
|
+
import { joinURL, withoutTrailingSlash } from 'ufo';
|
|
28
27
|
import isAbsoluteUrl from 'is-absolute-url';
|
|
29
28
|
import { SUPPORTED_LANGUAGES } from '@blocklet/constant';
|
|
30
29
|
import LocaleTabs from './locale-tabs';
|
|
@@ -169,7 +168,7 @@ const NavigationDialog = /*#__PURE__*/forwardRef(function NavigationDialog({
|
|
|
169
168
|
return withoutTrailingSlash(stringLink);
|
|
170
169
|
}
|
|
171
170
|
const selectedLink = isObject(selectedOption.link) ? selectedOption.link[state.locale] : selectedOption.link;
|
|
172
|
-
return withoutTrailingSlash(
|
|
171
|
+
return withoutTrailingSlash(joinURL(stringLink, selectedLink || '/'));
|
|
173
172
|
}
|
|
174
173
|
return null;
|
|
175
174
|
}, [components, state.locale, selectedOption, watchComponent]);
|
|
@@ -4,7 +4,7 @@ import { LocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
|
4
4
|
import { BLOCKLET_CONFIGURABLE_KEY, DID_SPACES } from '@blocklet/constant';
|
|
5
5
|
import axios from 'axios';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
|
-
import
|
|
7
|
+
import { joinURL } from 'ufo';
|
|
8
8
|
import { isEmpty } from 'lodash';
|
|
9
9
|
import Typography from '@mui/material/Typography';
|
|
10
10
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
@@ -118,10 +118,10 @@ const SpaceConnector = /*#__PURE__*/forwardRef(({
|
|
|
118
118
|
...preValue,
|
|
119
119
|
action: 'one-click-authorization',
|
|
120
120
|
checkTimeout: 1000 * 300,
|
|
121
|
-
prefix:
|
|
121
|
+
prefix: joinURL(gatewayUrl, 'space/api/did'),
|
|
122
122
|
baseUrl: new URL(gatewayUrl).origin,
|
|
123
123
|
checkFn: axios.create({
|
|
124
|
-
baseURL:
|
|
124
|
+
baseURL: joinURL(gatewayUrl, 'space')
|
|
125
125
|
}).get,
|
|
126
126
|
extraParams: {
|
|
127
127
|
appDid: blocklet.appDid,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import styled from '@emotion/styled';
|
|
4
|
-
import
|
|
4
|
+
import { joinURL } from 'ufo';
|
|
5
5
|
import isUrl from 'is-url';
|
|
6
6
|
import useLocalStorage from 'react-use/lib/useLocalStorage';
|
|
7
7
|
import Button from '@arcblock/ux/lib/Button';
|
|
@@ -40,7 +40,7 @@ function SpaceSelector({
|
|
|
40
40
|
} = useSessionContext();
|
|
41
41
|
useEffect(() => {
|
|
42
42
|
if (gatewayUrl && !gatewayList.find(x => x.value === gatewayUrl)) {
|
|
43
|
-
api.get(
|
|
43
|
+
api.get(joinURL(gatewayUrl, '/__blocklet__.js?type=json')).then(res => {
|
|
44
44
|
// FIXME: @wangshijun handle mountPoint
|
|
45
45
|
setGatewayList([...gatewayList, {
|
|
46
46
|
value: gatewayUrl,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { useEffect, useState } from 'react';
|
|
4
4
|
import styled from '@emotion/styled';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import
|
|
6
|
+
import { joinURL } from 'ufo';
|
|
7
7
|
import Link from '@mui/material/Link';
|
|
8
8
|
import { ErrorFallback } from '@arcblock/ux/lib/ErrorBoundary';
|
|
9
9
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
@@ -20,7 +20,7 @@ import { formatRegistryLogoPath } from '../../util';
|
|
|
20
20
|
import { useBlockletContext } from '../../contexts/blocklet';
|
|
21
21
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
22
|
const getStoreDetail = (meta, endpoint) => {
|
|
23
|
-
return
|
|
23
|
+
return joinURL(endpoint, `/blocklets/${meta.did}`);
|
|
24
24
|
};
|
|
25
25
|
const displayAttributes = ({
|
|
26
26
|
blocklet,
|
|
@@ -42,7 +42,7 @@ function BlockletItem({
|
|
|
42
42
|
const {
|
|
43
43
|
t
|
|
44
44
|
} = useLocaleContext();
|
|
45
|
-
let logoUrl =
|
|
45
|
+
let logoUrl = joinURL(endpoint, formatRegistryLogoPath(blocklet.did, blocklet.logo || ''));
|
|
46
46
|
try {
|
|
47
47
|
const tempURL = new URL(logoUrl);
|
|
48
48
|
tempURL.searchParams.set('v', blocklet.version || +new Date());
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { lazy, useRef } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import
|
|
3
|
+
import { joinURL } from 'ufo';
|
|
4
4
|
import styled from '@emotion/styled';
|
|
5
5
|
import noop from 'lodash/noop';
|
|
6
6
|
import Box from '@mui/material/Box';
|
|
@@ -52,7 +52,7 @@ export default function LogoUploader({
|
|
|
52
52
|
disabled: true
|
|
53
53
|
},
|
|
54
54
|
apiPathProps: {
|
|
55
|
-
uploader:
|
|
55
|
+
uploader: joinURL(prefix, uploadPrefix, type, did),
|
|
56
56
|
disableMediaKitPrefix: true
|
|
57
57
|
},
|
|
58
58
|
coreProps: {
|
|
@@ -85,7 +85,7 @@ function NotificationPushKit() {
|
|
|
85
85
|
await api.sendPush({
|
|
86
86
|
input: {
|
|
87
87
|
did,
|
|
88
|
-
receiver:
|
|
88
|
+
receiver: pageState.testReceiver,
|
|
89
89
|
notification: JSON.stringify({
|
|
90
90
|
title: 'Test push-kit notification',
|
|
91
91
|
body: 'This is message from push-kit config test',
|
|
@@ -2,7 +2,7 @@ import React, { useState, useContext } from 'react';
|
|
|
2
2
|
import styled from '@emotion/styled';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import Iframe from 'react-iframe';
|
|
5
|
-
import
|
|
5
|
+
import { joinURL } from 'ufo';
|
|
6
6
|
import { WELLKNOWN_SERVICE_PATH_PREFIX } from '@abtnode/constant';
|
|
7
7
|
import { Grid, Box } from '@mui/material';
|
|
8
8
|
import GeneralIcon from '@mui/icons-material/TuneRounded';
|
|
@@ -236,9 +236,9 @@ export default function BlockletPreferences({
|
|
|
236
236
|
if (!inService) {
|
|
237
237
|
urlSearchParams.set('authKey', '__sst');
|
|
238
238
|
}
|
|
239
|
-
urlSearchParams.set('schemaKey',
|
|
239
|
+
urlSearchParams.set('schemaKey', joinURL(window.location.origin, pathPrefix, `/api/preferences?id=${encodeURIComponent(current)}`));
|
|
240
240
|
content = /*#__PURE__*/_jsx(Iframe, {
|
|
241
|
-
url: `${
|
|
241
|
+
url: `${joinURL(window.location.origin, pathPrefix, '/hosted/form-collector/')}?${urlSearchParams.toString()}`,
|
|
242
242
|
width: "100%",
|
|
243
243
|
height: "100%",
|
|
244
244
|
frameBorder: 0,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
function keepNowResources(trees, list) {
|
|
2
|
+
const listSet = new Set(list || []);
|
|
3
|
+
const result = [];
|
|
4
|
+
function traverse(tree) {
|
|
5
|
+
if (listSet.has(tree?.id)) {
|
|
6
|
+
result.push(tree?.id);
|
|
7
|
+
}
|
|
8
|
+
if (tree?.children) {
|
|
9
|
+
tree.children.forEach(traverse);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
(trees || []).forEach(traverse);
|
|
13
|
+
return result;
|
|
14
|
+
}
|
|
15
|
+
export default keepNowResources;
|
|
@@ -3,7 +3,7 @@ import classnames from 'classnames';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { useEffect, useRef } from 'react';
|
|
5
5
|
import useSetState from 'react-use/lib/useSetState';
|
|
6
|
-
import
|
|
6
|
+
import { joinURL } from 'ufo';
|
|
7
7
|
import { Box } from '@mui/material';
|
|
8
8
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
9
9
|
import { hasStartEngine } from '@blocklet/meta/lib/engine';
|
|
@@ -14,6 +14,7 @@ import { useNodeContext } from '../../../contexts/node';
|
|
|
14
14
|
import { axios } from '../../../util/api';
|
|
15
15
|
import StopBox from './stop-box';
|
|
16
16
|
import Tree from './tree';
|
|
17
|
+
import keepNowResources from './keep-now-resources';
|
|
17
18
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
19
|
const fillParent = (nodes, parentId) => {
|
|
19
20
|
nodes.forEach(node => {
|
|
@@ -31,7 +32,7 @@ const parseUrl = (component, projectId, releaseId, locale, initUrl) => {
|
|
|
31
32
|
const {
|
|
32
33
|
exportApi = '/'
|
|
33
34
|
} = component?.meta.resource || {};
|
|
34
|
-
const urlObj = new URL(
|
|
35
|
+
const urlObj = new URL(joinURL('http://127.0.0.1', component.mountPoint, exportApi || '/').replace(/\/+/g, '/'));
|
|
35
36
|
urlObj.searchParams.set('projectId', projectId);
|
|
36
37
|
urlObj.searchParams.set('releaseId', releaseId);
|
|
37
38
|
urlObj.searchParams.set('local', locale);
|
|
@@ -178,7 +179,7 @@ export default function Resources({
|
|
|
178
179
|
const list = res?.resources || [];
|
|
179
180
|
if (list?.length) {
|
|
180
181
|
setSelectedResourceIds({
|
|
181
|
-
[child.meta.did]: list
|
|
182
|
+
[child.meta.did]: keepNowResources(tree, list)
|
|
182
183
|
});
|
|
183
184
|
setSelectedComponentsMapByIds(child.meta.did, tree, list);
|
|
184
185
|
if (!readOnly) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import React, { useState, useEffect } from 'react';
|
|
3
3
|
import { Link, useParams } from 'react-router-dom';
|
|
4
4
|
import styled from '@emotion/styled';
|
|
5
|
-
import
|
|
5
|
+
import { joinURL } from 'ufo';
|
|
6
6
|
import upperFirst from 'lodash/upperFirst';
|
|
7
7
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
8
8
|
import { Box, useMediaQuery, IconButton, Typography, Tooltip, Breadcrumbs } from '@mui/material';
|
|
@@ -234,12 +234,12 @@ export default function ReleaseList() {
|
|
|
234
234
|
let downloadUrl = '';
|
|
235
235
|
const published = release.status === 'published';
|
|
236
236
|
if (published) {
|
|
237
|
-
const blockletMetaUrl =
|
|
237
|
+
const blockletMetaUrl = joinURL(serverEndpoint, `/api/project/${blocklet.meta.did}/${project.id}/${project.lastReleaseId}/release/blocklet.json`);
|
|
238
238
|
const url = new URL(serverEndpoint);
|
|
239
|
-
url.pathname =
|
|
239
|
+
url.pathname = joinURL(url.pathname, '/launch-blocklet/agreement');
|
|
240
240
|
url.searchParams.set('blocklet_meta_url', blockletMetaUrl);
|
|
241
241
|
installUrl = url.href;
|
|
242
|
-
downloadUrl =
|
|
242
|
+
downloadUrl = joinURL(`${WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${blocklet.meta.did}/${project.id}/${project.lastReleaseId}/download/${(project.lastReleaseFiles || [])[0]}`);
|
|
243
243
|
}
|
|
244
244
|
return /*#__PURE__*/_jsxs(Box, {
|
|
245
245
|
display: "flex",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable react/jsx-one-expression-per-line */
|
|
2
2
|
import { useState, useEffect, useImperativeHandle, forwardRef } from 'react';
|
|
3
|
-
import
|
|
3
|
+
import { joinURL } from 'ufo';
|
|
4
4
|
import { getDisplayName } from '@blocklet/meta/lib/util';
|
|
5
5
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
6
6
|
import DidConnect from '@arcblock/did-connect/lib/Connect';
|
|
@@ -132,7 +132,7 @@ export function ComponentPurchase({
|
|
|
132
132
|
purchase: {
|
|
133
133
|
action: 'acquire-asset',
|
|
134
134
|
checkFn: axios.create({
|
|
135
|
-
baseURL:
|
|
135
|
+
baseURL: joinURL(baseUrl, '/store')
|
|
136
136
|
}).get,
|
|
137
137
|
extraParams: {
|
|
138
138
|
factory: meta.nftFactory,
|
|
@@ -3,7 +3,7 @@ import React, { useState } from 'react';
|
|
|
3
3
|
import Button from '@arcblock/ux/lib/Button';
|
|
4
4
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
5
5
|
import DidConnect from '@arcblock/did-connect/lib/Connect';
|
|
6
|
-
import
|
|
6
|
+
import { joinURL } from 'ufo';
|
|
7
7
|
import toast from '@arcblock/ux/lib/Toast';
|
|
8
8
|
import SplitButton from '@arcblock/ux/lib/SplitButton';
|
|
9
9
|
import Dialog from '@arcblock/ux/lib/Dialog';
|
|
@@ -53,7 +53,7 @@ function ConnectTo({
|
|
|
53
53
|
action: 'connect-to-did-spaces',
|
|
54
54
|
checkTimeout: 1000 * 300,
|
|
55
55
|
checkFn: axios.create({
|
|
56
|
-
baseURL:
|
|
56
|
+
baseURL: joinURL(window.location.origin, getPathPrefix())
|
|
57
57
|
}).get,
|
|
58
58
|
messages: {
|
|
59
59
|
title: t('storage.spaces.provideNFT.title', {
|
|
@@ -198,10 +198,10 @@ function ConnectTo({
|
|
|
198
198
|
setAuthorizeConnect(preValue => ({
|
|
199
199
|
...preValue,
|
|
200
200
|
open: true,
|
|
201
|
-
prefix:
|
|
201
|
+
prefix: joinURL(didSpacesCoreUrl, 'space/api/did'),
|
|
202
202
|
baseUrl: new URL(didSpacesCoreUrl).origin,
|
|
203
203
|
checkFn: axios.create({
|
|
204
|
-
baseURL:
|
|
204
|
+
baseURL: joinURL(didSpacesCoreUrl, 'space')
|
|
205
205
|
}).get,
|
|
206
206
|
extraParams: {
|
|
207
207
|
appDid: blockletInfo.appDid,
|
|
@@ -4,7 +4,7 @@ import Button from '@arcblock/ux/lib/Button';
|
|
|
4
4
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
7
|
-
import
|
|
7
|
+
import { joinURL } from 'ufo';
|
|
8
8
|
import { BLOCKLET_CONFIGURABLE_KEY } from '@blocklet/constant';
|
|
9
9
|
import DidConnect from '@arcblock/did-connect/lib/Connect';
|
|
10
10
|
import { useRequest } from 'ahooks';
|
|
@@ -176,10 +176,10 @@ function SpaceItem({
|
|
|
176
176
|
setAuthorizeConnect(preValue => ({
|
|
177
177
|
...preValue,
|
|
178
178
|
open: true,
|
|
179
|
-
prefix:
|
|
179
|
+
prefix: joinURL(spaceGateway.url, 'space/api/did'),
|
|
180
180
|
baseUrl: new URL(spaceGateway.url).origin,
|
|
181
181
|
checkFn: axios.create({
|
|
182
|
-
baseURL:
|
|
182
|
+
baseURL: joinURL(spaceGateway.url, 'space')
|
|
183
183
|
}).get,
|
|
184
184
|
extraParams: {
|
|
185
185
|
appDid,
|
package/lib/blocklet/util.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import sortBy from 'lodash/sortBy';
|
|
2
|
-
import
|
|
2
|
+
import { joinURL } from 'ufo';
|
|
3
3
|
import isEmpty from 'lodash/isEmpty';
|
|
4
4
|
import normalizePathPrefix from '@abtnode/util/lib/normalize-path-prefix';
|
|
5
5
|
import { forEachBlockletSync, replaceSlotToIp } from '@blocklet/meta/lib/util';
|
|
@@ -7,12 +7,12 @@ import { BLOCKLET_APP_SPACE_REQUIREMENT } from '@blocklet/constant';
|
|
|
7
7
|
import { SLOT_FOR_IP_DNS_SITE } from '@abtnode/constant';
|
|
8
8
|
export const getServerUrl = (info, encodeURI = false) => {
|
|
9
9
|
const adminPath = process.env.NODE_ENV === 'production' ? info.routing.adminPath : '';
|
|
10
|
-
return encodeURI ? encodeURIComponent(
|
|
10
|
+
return encodeURI ? encodeURIComponent(joinURL(window.location.origin, adminPath)) : joinURL(window.location.origin, adminPath);
|
|
11
11
|
};
|
|
12
12
|
export const getLaunchAgreementUrl = (meta, info, storeUrl) => {
|
|
13
13
|
const serverUrl = getServerUrl(info);
|
|
14
|
-
const metaUrl =
|
|
15
|
-
const url = new URL(
|
|
14
|
+
const metaUrl = joinURL(storeUrl, `/api/blocklets/${meta.did}/blocklet.json`);
|
|
15
|
+
const url = new URL(joinURL(serverUrl, '/launch-blocklet/agreement'));
|
|
16
16
|
url.searchParams.set('blocklet_meta_url', metaUrl);
|
|
17
17
|
url.searchParams.set('from', window.location.href);
|
|
18
18
|
return url.href;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState, useEffect, useMemo, useRef, useContext } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { joinURL } from 'ufo';
|
|
3
3
|
import memoize from 'lodash/memoize';
|
|
4
4
|
import { WELLKNOWN_PING_PREFIX } from '@abtnode/constant';
|
|
5
5
|
import { evaluateURLs } from '@abtnode/util/lib/url-evaluation';
|
|
@@ -16,7 +16,7 @@ const ping = memoize(url => {
|
|
|
16
16
|
if (hostname === window.location.hostname) {
|
|
17
17
|
return true;
|
|
18
18
|
}
|
|
19
|
-
return defaultCheckAccessible(
|
|
19
|
+
return defaultCheckAccessible(joinURL(origin, WELLKNOWN_PING_PREFIX));
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
// url <-> evaluation cache
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { joinURL } from 'ufo';
|
|
2
2
|
import { BLOCKLET_CONFIGURABLE_KEY } from '@blocklet/constant';
|
|
3
3
|
import { useNodeContext } from '../contexts/node';
|
|
4
4
|
import { isInstalling, getLogoHash } from '../util';
|
|
@@ -21,9 +21,9 @@ export default function useAppLogo({
|
|
|
21
21
|
const customRectLogo = (blocklet?.environments || []).find(x => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_RECT)?.value;
|
|
22
22
|
const customFavicon = (blocklet?.environments || []).find(x => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_FAVICON)?.value;
|
|
23
23
|
const prefix = window.env?.apiPrefix || '/';
|
|
24
|
-
const logoUrl =
|
|
25
|
-
const rectLogoUrl =
|
|
26
|
-
const faviconUrl =
|
|
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)}`;
|
|
27
27
|
return {
|
|
28
28
|
logoUrl,
|
|
29
29
|
rectLogoUrl,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { joinURL } from 'ufo';
|
|
2
2
|
import { WELLKNOWN_SERVICE_PATH_PREFIX } from '@abtnode/constant';
|
|
3
3
|
import { useNodeContext } from '../contexts/node';
|
|
4
4
|
import { formatRegistryLogoPath, APP_PREFIX, isDownloading, isExtracting } from '../util';
|
|
@@ -12,14 +12,14 @@ export default function useAvatar({
|
|
|
12
12
|
} = node;
|
|
13
13
|
const pending = isDownloading(blocklet?.status) || isExtracting(blocklet?.status);
|
|
14
14
|
const search = `?v=${blocklet?.meta?.version}${pending ? '~' : ''}`;
|
|
15
|
-
let logoUrl = inService ?
|
|
15
|
+
let logoUrl = inService ? `${joinURL(APP_PREFIX, WELLKNOWN_SERVICE_PATH_PREFIX, '/blocklet/logo-bundle')}${search}` : joinURL(node.imgPrefix, 'blocklet.png');
|
|
16
16
|
if (blocklet.source === 'registry' && blocklet.deployedFrom && blocklet.meta.logo) {
|
|
17
|
-
logoUrl =
|
|
17
|
+
logoUrl = `${joinURL(blocklet.deployedFrom, formatRegistryLogoPath(blocklet.meta.bundleDid, blocklet.meta.logo))}${search}`;
|
|
18
18
|
} else {
|
|
19
19
|
const prefix = window.env.apiPrefix || '/';
|
|
20
20
|
const components = ancestors.concat(blocklet);
|
|
21
21
|
const list = inService ? components.slice(1) : components;
|
|
22
|
-
logoUrl =
|
|
22
|
+
logoUrl = `${joinURL(prefix, `/blocklet/logo-bundle${list.map(x => `/${x.meta.did}`).join('')}`)}${search}`;
|
|
23
23
|
}
|
|
24
24
|
return {
|
|
25
25
|
logoUrl,
|
|
@@ -4,7 +4,7 @@ import styled from '@emotion/styled';
|
|
|
4
4
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
5
5
|
import DidButton from '@arcblock/did-connect/lib/Button';
|
|
6
6
|
import { AUTH_SERVICE_PREFIX, API_DID_PREFIX } from '@arcblock/did-connect/lib/constant';
|
|
7
|
-
import joinURL from '
|
|
7
|
+
import { joinURL } from 'ufo';
|
|
8
8
|
import { formatDateTime } from '../util';
|
|
9
9
|
import usePassportId from '../hooks/use-passport-id';
|
|
10
10
|
import { useSessionContext } from '../contexts/session';
|
package/lib/locales/ar.js
CHANGED
|
@@ -1504,7 +1504,7 @@ export default {
|
|
|
1504
1504
|
installedButStopped: 'تم تثبيت التطبيق بنجاح ، ولكن لا يمكن تشغيله. يمكنك بدء تشغيله يدويًا بعد حل مشكلة الحجب.',
|
|
1505
1505
|
installedButError: 'تم تثبيت التطبيق بنجاح ، ولكن فشل في البدء',
|
|
1506
1506
|
restoreFailed: 'فشل في استعادة التطبيق، يرجى المحاولة مرة أخرى',
|
|
1507
|
-
resourceBlocklet: 'لا يمكن تثبيت
|
|
1507
|
+
resourceBlocklet: 'لا يمكن تثبيت الكتلة كتطبيق، يمكنك إضافة هذه الكتلة إلى التطبيقات الحالية.'
|
|
1508
1508
|
},
|
|
1509
1509
|
steps: {
|
|
1510
1510
|
introduction: 'مقدمة',
|
package/lib/locales/de.js
CHANGED
|
@@ -1504,7 +1504,7 @@ export default {
|
|
|
1504
1504
|
installedButStopped: 'Die App wurde erfolgreich installiert, kann jedoch nicht gestartet werden. Sie können sie manuell starten, nachdem Sie die blockierenden Probleme behoben haben.',
|
|
1505
1505
|
installedButError: 'Die App wurde erfolgreich installiert, konnte jedoch nicht gestartet werden',
|
|
1506
1506
|
restoreFailed: 'Fehler beim Wiederherstellen der App, bitte versuchen Sie es erneut',
|
|
1507
|
-
resourceBlocklet: '
|
|
1507
|
+
resourceBlocklet: 'Blocklet kann nicht als Anwendung installiert werden, Sie können diese Blocklet in vorhandene Anwendungen einfügen.'
|
|
1508
1508
|
},
|
|
1509
1509
|
steps: {
|
|
1510
1510
|
introduction: 'Einführung',
|
package/lib/locales/en.js
CHANGED
|
@@ -833,6 +833,10 @@ export default {
|
|
|
833
833
|
welcome: {
|
|
834
834
|
switchLabel: 'Welcome Page'
|
|
835
835
|
},
|
|
836
|
+
security: {
|
|
837
|
+
switchLabel: 'File System Isolation',
|
|
838
|
+
switchTips: 'After disabling this option, the file system of the Blocklet will no longer be in isolation, which may pose a risk of malicious software damaging the file system.'
|
|
839
|
+
},
|
|
836
840
|
upgrade: {
|
|
837
841
|
title: 'Upgrade Blocklet Server to {version}',
|
|
838
842
|
description: 'During the upgrade, your Blocklet Server will enter maintenance mode for a few minutes while the update is completed.',
|
package/lib/locales/es.js
CHANGED
|
@@ -1504,7 +1504,7 @@ export default {
|
|
|
1504
1504
|
installedButStopped: 'La aplicación se instaló correctamente, pero no se puede iniciar. Puede iniciarlo manualmente después de resolver los problemas de bloqueo',
|
|
1505
1505
|
installedButError: 'La aplicación se instaló correctamente, pero no se pudo iniciar',
|
|
1506
1506
|
restoreFailed: 'Error al restaurar la aplicación, por favor intente nuevamente',
|
|
1507
|
-
resourceBlocklet: 'El
|
|
1507
|
+
resourceBlocklet: 'El Blocklet no se puede instalar como una aplicación, puedes añadir este Blocklet a aplicaciones existentes.'
|
|
1508
1508
|
},
|
|
1509
1509
|
steps: {
|
|
1510
1510
|
introduction: 'Introducción',
|
package/lib/locales/fr.js
CHANGED
|
@@ -1504,7 +1504,7 @@ export default {
|
|
|
1504
1504
|
installedButStopped: "L'application a été installée avec succès, mais ne peut pas être démarrée. Vous pouvez la démarrer manuellement après avoir résolu les problèmes de blocage.",
|
|
1505
1505
|
installedButError: "L'application est installée avec succès, mais n'a pas réussi à démarrer",
|
|
1506
1506
|
restoreFailed: "Échec de la restauration de l'application, veuillez réessayer",
|
|
1507
|
-
resourceBlocklet: "Le
|
|
1507
|
+
resourceBlocklet: "Le bloc ne peut pas être installé en tant qu'application, vous pouvez ajouter ce bloc à des applications existantes."
|
|
1508
1508
|
},
|
|
1509
1509
|
steps: {
|
|
1510
1510
|
introduction: 'Introduction',
|
package/lib/locales/hi.js
CHANGED
|
@@ -1504,7 +1504,7 @@ export default {
|
|
|
1504
1504
|
installedButStopped: 'ऐप सफलतापूर्वक स्थापित हो गया है, लेकिन यह शुरू नहीं किया जा सकता है। आप इसे अवरोधक मुद्दों को हल करने के बाद मैन्युअल रूप से शुरू कर सकते हैं।',
|
|
1505
1505
|
installedButError: 'ऐप सफलतापूर्वक स्थापित किया गया है, लेकिन शुरू करने में विफल हो गया',
|
|
1506
1506
|
restoreFailed: 'ऐप को पुनर्स्थापित करने में विफल, कृपया पुनः प्रयास करें',
|
|
1507
|
-
resourceBlocklet: '
|
|
1507
|
+
resourceBlocklet: 'ब्लॉकलेट को एक एप्लिकेशन के रूप में स्थापित नहीं किया जा सकता है, आप इस ब्लॉकलेट को मौजूदा एप्लिकेशन में जोड़ सकते हैं।'
|
|
1508
1508
|
},
|
|
1509
1509
|
steps: {
|
|
1510
1510
|
introduction: 'परिचय',
|
package/lib/locales/id.js
CHANGED
|
@@ -1504,7 +1504,7 @@ export default {
|
|
|
1504
1504
|
installedButStopped: 'Aplikasi berhasil diinstal, tetapi tidak dapat dijalankan. Anda dapat menjalankannya secara manual setelah memecahkan masalah pemblokiran',
|
|
1505
1505
|
installedButError: 'Aplikasi berhasil diinstal, tetapi gagal untuk memulai',
|
|
1506
1506
|
restoreFailed: 'Gagal mengembalikan aplikasi, silakan coba lagi',
|
|
1507
|
-
resourceBlocklet: '
|
|
1507
|
+
resourceBlocklet: 'Blocklet tidak dapat diinstal sebagai aplikasi, Anda dapat menambahkan blocklet ini ke aplikasi yang sudah ada.'
|
|
1508
1508
|
},
|
|
1509
1509
|
steps: {
|
|
1510
1510
|
introduction: 'Pengenalan',
|
package/lib/locales/ja.js
CHANGED
|
@@ -1504,7 +1504,7 @@ export default {
|
|
|
1504
1504
|
installedButStopped: 'アプリは正常にインストールされましたが、起動できません。ブロッキングの問題を解決した後、手動で起動できます',
|
|
1505
1505
|
installedButError: 'アプリが正常にインストールされましたが、起動できませんでした',
|
|
1506
1506
|
restoreFailed: 'アプリの復元に失敗しました。もう一度お試しください',
|
|
1507
|
-
resourceBlocklet: '
|
|
1507
|
+
resourceBlocklet: 'Blocklet はアプリケーションとしてインストールできません、このBlocklet を既存のアプリケーションに追加することができます。'
|
|
1508
1508
|
},
|
|
1509
1509
|
steps: {
|
|
1510
1510
|
introduction: '紹介',
|
package/lib/locales/ko.js
CHANGED
|
@@ -1504,7 +1504,7 @@ export default {
|
|
|
1504
1504
|
installedButStopped: '앱은 성공적으로 설치되었지만 시작할 수 없습니다. 차단 문제를 해결한 후에 수동으로 시작할 수 있습니다',
|
|
1505
1505
|
installedButError: '앱이 성공적으로 설치되었지만 시작하지 못했습니다',
|
|
1506
1506
|
restoreFailed: '앱 복원 실패. 다시 시도해주세요',
|
|
1507
|
-
resourceBlocklet: '
|
|
1507
|
+
resourceBlocklet: 'Blocklet을 앱으로 설치할 수 없습니다. 대신,이 블록을 기존 애플리케이션에 추가할 수 있습니다.'
|
|
1508
1508
|
},
|
|
1509
1509
|
steps: {
|
|
1510
1510
|
introduction: '소개',
|
package/lib/locales/pt.js
CHANGED
|
@@ -1504,7 +1504,7 @@ export default {
|
|
|
1504
1504
|
installedButStopped: 'O aplicativo foi instalado com sucesso, mas não pode ser iniciado. Você pode iniciá-lo manualmente após resolver problemas de bloqueio',
|
|
1505
1505
|
installedButError: 'O aplicativo foi instalado com sucesso, mas falhou ao iniciar',
|
|
1506
1506
|
restoreFailed: 'Falha ao restaurar o aplicativo, por favor, tente novamente',
|
|
1507
|
-
resourceBlocklet: '
|
|
1507
|
+
resourceBlocklet: 'Blocklet não pode ser instalado como um aplicativo, você pode adicionar esta blocklet em aplicativos existentes.'
|
|
1508
1508
|
},
|
|
1509
1509
|
steps: {
|
|
1510
1510
|
introduction: 'Introdução',
|
package/lib/locales/ru.js
CHANGED
|
@@ -1504,7 +1504,7 @@ export default {
|
|
|
1504
1504
|
installedButStopped: 'Приложение успешно установлено, но не может быть запущено. Вы можете запустить его вручную после устранения блокирующих проблем.',
|
|
1505
1505
|
installedButError: 'Приложение успешно установлено, но не удалось запустить',
|
|
1506
1506
|
restoreFailed: 'Не удалось восстановить приложение, пожалуйста, попробуйте снова',
|
|
1507
|
-
resourceBlocklet: '
|
|
1507
|
+
resourceBlocklet: 'Блоклет нельзя установить как приложение, вы можете добавить этот блоклет в существующие приложения.'
|
|
1508
1508
|
},
|
|
1509
1509
|
steps: {
|
|
1510
1510
|
introduction: 'Введение',
|
package/lib/locales/th.js
CHANGED
|
@@ -1504,7 +1504,7 @@ export default {
|
|
|
1504
1504
|
installedButStopped: 'แอปติดตั้งสำเร็จ แต่ไม่สามารถเริ่มต้นใช้งานได้ คุณสามารถเริ่มใช้งานด้วยตนเองหลังจากแก้ไขปัญหาการบล็อก',
|
|
1505
1505
|
installedButError: 'แอปพลิเคชันถูกติดตั้งเรียบร้อยแล้ว แต่ไม่สามารถเริ่มต้นใช้งานได้',
|
|
1506
1506
|
restoreFailed: 'การเรียกคืนแอปล้มเหลว โปรดลองอีกครั้ง',
|
|
1507
|
-
resourceBlocklet: '
|
|
1507
|
+
resourceBlocklet: 'Blocklet ไม่สามารถติดตั้งเป็นแอพพลิเคชั่นได้ คุณสามารถเพิ่มบล็อกเลทนี้ในแอพพลิเคชั่นที่มีอยู่'
|
|
1508
1508
|
},
|
|
1509
1509
|
steps: {
|
|
1510
1510
|
introduction: 'แนะนำ',
|
package/lib/locales/vi.js
CHANGED
|
@@ -1504,7 +1504,7 @@ export default {
|
|
|
1504
1504
|
installedButStopped: 'Ứng dụng được cài đặt thành công, nhưng không thể khởi động. Bạn có thể khởi động nó thủ công sau khi giải quyết các vấn đề chặn',
|
|
1505
1505
|
installedButError: 'Ứng dụng đã được cài đặt thành công, nhưng không khởi động được',
|
|
1506
1506
|
restoreFailed: 'Không thể khôi phục ứng dụng, vui lòng thử lại',
|
|
1507
|
-
resourceBlocklet: '
|
|
1507
|
+
resourceBlocklet: 'Blocklet không thể được cài đặt như một ứng dụng, bạn có thể thêm blocklet này vào các ứng dụng hiện có.'
|
|
1508
1508
|
},
|
|
1509
1509
|
steps: {
|
|
1510
1510
|
introduction: 'Giới thiệu',
|
package/lib/locales/zh-tw.js
CHANGED
|
@@ -980,7 +980,7 @@ export default {
|
|
|
980
980
|
testSend: '測試推播套件發送',
|
|
981
981
|
inputTestReceiver: '請輸入測試接收者 DID',
|
|
982
982
|
receiverRequired: '需要 PushKit 接收者 DID',
|
|
983
|
-
pushPath: '
|
|
983
|
+
pushPath: 'PushKit 的 API 路徑(預設 /api/push)',
|
|
984
984
|
did: 'PushKit Blocklet DID',
|
|
985
985
|
customOptions: '自訂選項'
|
|
986
986
|
}
|
|
@@ -1504,7 +1504,7 @@ export default {
|
|
|
1504
1504
|
installedButStopped: '應用程式安裝成功,但無法啟動。在解決阻塞問題後,您可以手動啟動它',
|
|
1505
1505
|
installedButError: '應用程式安裝成功,但無法啟動',
|
|
1506
1506
|
restoreFailed: '應用程式恢復失敗,請重試',
|
|
1507
|
-
resourceBlocklet: '
|
|
1507
|
+
resourceBlocklet: '無法將Blocklet安裝為應用程式,您可以將這個Blocklet添加到現有應用程式中。'
|
|
1508
1508
|
},
|
|
1509
1509
|
steps: {
|
|
1510
1510
|
introduction: '介紹',
|
package/lib/locales/zh.js
CHANGED
|
@@ -874,6 +874,10 @@ export default {
|
|
|
874
874
|
welcome: {
|
|
875
875
|
switchLabel: 'Welcome 页面'
|
|
876
876
|
},
|
|
877
|
+
security: {
|
|
878
|
+
switchLabel: '文件系统隔离',
|
|
879
|
+
switchTips: '关闭此选项后,Blocklet 的文件系统将不再处于隔离状态,可能会存在恶意软件破坏文件系统的风险。'
|
|
880
|
+
},
|
|
877
881
|
register: {
|
|
878
882
|
titleAdded: '当前节点已经添加到应用启动器',
|
|
879
883
|
title: '添加节点到应用启动器',
|
|
@@ -983,7 +987,7 @@ export default {
|
|
|
983
987
|
testSend: '测试推送',
|
|
984
988
|
inputTestReceiver: '请输入测试接收者 DID',
|
|
985
989
|
receiverRequired: '需要 PushKit 接收者 DID',
|
|
986
|
-
pushPath: '
|
|
990
|
+
pushPath: 'PushKit 的 API 路径(默认 /api/push)',
|
|
987
991
|
did: 'PushKit Blocklet DID',
|
|
988
992
|
customOptions: '自定义选项'
|
|
989
993
|
}
|
|
@@ -1511,7 +1515,7 @@ export default {
|
|
|
1511
1515
|
installedButStopped: '应用安装成功,但是无法启动,解决启动问题之后后可手动启动',
|
|
1512
1516
|
installedButError: '应用已经安装,但是运行出错了',
|
|
1513
1517
|
restoreFailed: '还原应用失败,请重试',
|
|
1514
|
-
resourceBlocklet: '
|
|
1518
|
+
resourceBlocklet: 'Blocklet 无法安装为应用程序,您可以将此 Blocklet 添加到现有应用程序中。'
|
|
1515
1519
|
},
|
|
1516
1520
|
steps: {
|
|
1517
1521
|
introduction: '简介',
|
|
@@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
|
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import { Box, Button, Menu, MenuItem } from '@mui/material';
|
|
4
4
|
import MoreVertIcon from '@mui/icons-material/MoreVert';
|
|
5
|
-
import
|
|
5
|
+
import { joinURL } from 'ufo';
|
|
6
6
|
import LaunchIcon from '@mui/icons-material/Launch';
|
|
7
7
|
import LinkOutlinedIcon from '@mui/icons-material/LinkOutlined';
|
|
8
8
|
import DeleteOutlineIcon from '@mui/icons-material/DeleteOutline';
|
|
@@ -26,7 +26,7 @@ function ConnectActions({
|
|
|
26
26
|
const [showReconnectConfirm, setShowReconnectConfirm] = useState(false);
|
|
27
27
|
const handleOpenUrl = e => {
|
|
28
28
|
e.stopPropagation();
|
|
29
|
-
window.open(
|
|
29
|
+
window.open(joinURL(store.url, 'developer/blocklets'));
|
|
30
30
|
window.open(store.url);
|
|
31
31
|
};
|
|
32
32
|
const handleOpen = event => {
|
package/lib/store/item.js
CHANGED
|
@@ -7,7 +7,7 @@ import AdminPanelSettingsIcon from '@mui/icons-material/AdminPanelSettings';
|
|
|
7
7
|
import DoneIcon from '@mui/icons-material/Done';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import { useEffect, useState } from 'react';
|
|
10
|
-
import
|
|
10
|
+
import { joinURL } from 'ufo';
|
|
11
11
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
12
12
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
13
13
|
import DeleteStore from './delete';
|
|
@@ -117,7 +117,7 @@ export default function StoreItem({
|
|
|
117
117
|
const handleOpenUrl = e => {
|
|
118
118
|
e.stopPropagation();
|
|
119
119
|
if (isPublish) {
|
|
120
|
-
window.open(
|
|
120
|
+
window.open(joinURL(store.url, 'developer/blocklets'));
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
123
|
window.open(store.url);
|
package/lib/team/members/util.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { joinURL } from 'ufo';
|
|
2
2
|
import { USER_AVATAR_URL_PREFIX, USER_AVATAR_PATH_PREFIX } from '@abtnode/constant';
|
|
3
3
|
|
|
4
4
|
// eslint-disable-next-line import/prefer-default-export
|
|
@@ -6,9 +6,9 @@ export function parseAvatar(avatar, teamDid, inService) {
|
|
|
6
6
|
if (avatar && avatar.startsWith(USER_AVATAR_URL_PREFIX)) {
|
|
7
7
|
const prefix = window.env.apiPrefix || '/';
|
|
8
8
|
if (inService) {
|
|
9
|
-
return
|
|
9
|
+
return joinURL(prefix, USER_AVATAR_PATH_PREFIX, avatar.replace(USER_AVATAR_URL_PREFIX, ''));
|
|
10
10
|
}
|
|
11
|
-
return
|
|
11
|
+
return joinURL(prefix, USER_AVATAR_PATH_PREFIX, teamDid, avatar.replace(USER_AVATAR_URL_PREFIX, ''));
|
|
12
12
|
}
|
|
13
13
|
return avatar;
|
|
14
14
|
}
|
package/lib/util/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import isUrl from 'is-url';
|
|
|
8
8
|
import get from 'lodash/get';
|
|
9
9
|
import trimEnd from 'lodash/trimEnd';
|
|
10
10
|
import qs from 'querystring';
|
|
11
|
-
import
|
|
11
|
+
import { joinURL } from 'ufo';
|
|
12
12
|
import axios from '@abtnode/util/lib/axios';
|
|
13
13
|
import dayjs from '@abtnode/util/lib/dayjs';
|
|
14
14
|
import tryWithTimeout from '@abtnode/util/lib/try-with-timeout';
|
|
@@ -272,7 +272,7 @@ export const getInviteLink = ({
|
|
|
272
272
|
return '';
|
|
273
273
|
}
|
|
274
274
|
const u = new URL(endpoint);
|
|
275
|
-
u.pathname =
|
|
275
|
+
u.pathname = joinURL(u.pathname, WELLKNOWN_SERVICE_PATH_PREFIX, 'invite');
|
|
276
276
|
u.searchParams.set('inviteId', inviteId);
|
|
277
277
|
return u.href;
|
|
278
278
|
};
|
|
@@ -284,7 +284,7 @@ export const getTransferAppLink = ({
|
|
|
284
284
|
return '';
|
|
285
285
|
}
|
|
286
286
|
const u = new URL(endpoint);
|
|
287
|
-
u.pathname =
|
|
287
|
+
u.pathname = joinURL(u.pathname, WELLKNOWN_SERVICE_PATH_PREFIX, 'transfer');
|
|
288
288
|
u.searchParams.set('transferId', transferId);
|
|
289
289
|
return u.href;
|
|
290
290
|
};
|
|
@@ -296,7 +296,7 @@ export const getIssuePassportLink = ({
|
|
|
296
296
|
return '';
|
|
297
297
|
}
|
|
298
298
|
const u = new URL(endpoint);
|
|
299
|
-
u.pathname =
|
|
299
|
+
u.pathname = joinURL(u.pathname, WELLKNOWN_SERVICE_PATH_PREFIX, 'issue-passport');
|
|
300
300
|
u.searchParams.set('id', id);
|
|
301
301
|
return u.href;
|
|
302
302
|
};
|
|
@@ -366,22 +366,22 @@ export const getBlockletLogoUrl = ({
|
|
|
366
366
|
return logoPath;
|
|
367
367
|
}
|
|
368
368
|
if (baseUrl.startsWith('http') && logoPath) {
|
|
369
|
-
return
|
|
369
|
+
return joinURL(baseUrl, formatRegistryLogoPath(did, logoPath, version));
|
|
370
370
|
}
|
|
371
371
|
const prefix = window.env.apiPrefix || '/';
|
|
372
372
|
let apiPrefix = prefix.replace(/^\/+/, '').replace(/\/+$/, '');
|
|
373
373
|
if (apiPrefix) {
|
|
374
374
|
apiPrefix = `/${apiPrefix}`;
|
|
375
375
|
}
|
|
376
|
-
return
|
|
376
|
+
return joinURL(apiPrefix, version ? `/blocklet/logo/${did}?v=${version}` : `/blocklet/logo/${did}`);
|
|
377
377
|
};
|
|
378
378
|
export const getPathPrefix = () => window.env && window.env.apiPrefix ? window.env.apiPrefix : '/';
|
|
379
|
-
export const isUrlAccessible = url => checkAccessible(
|
|
379
|
+
export const isUrlAccessible = url => checkAccessible(joinURL(new URL(url).origin, WELLKNOWN_PING_PREFIX));
|
|
380
380
|
const checkBlockletAccessible = async (url, timeout = 5000) => {
|
|
381
381
|
try {
|
|
382
382
|
const urlObj = new URL(url);
|
|
383
383
|
urlObj.protocol = 'https';
|
|
384
|
-
urlObj.pathname =
|
|
384
|
+
urlObj.pathname = joinURL(WELLKNOWN_BLOCKLET_HEALTH_PATH);
|
|
385
385
|
const response = await axios.get(urlObj.toString(), {
|
|
386
386
|
timeout,
|
|
387
387
|
validateStatus: status => {
|
|
@@ -501,10 +501,10 @@ export function getBlockletMetaUrl(storeUrl, did, dist) {
|
|
|
501
501
|
if (!origin && dist?.tarball) {
|
|
502
502
|
origin = new URL(dist.tarball).origin;
|
|
503
503
|
}
|
|
504
|
-
return
|
|
504
|
+
return joinURL(origin, BLOCKLET_STORE_API_PREFIX, `/blocklets/${did}/blocklet.json`);
|
|
505
505
|
}
|
|
506
506
|
export async function getAsset(chainHost, address) {
|
|
507
|
-
const result = await axios.post(
|
|
507
|
+
const result = await axios.post(joinURL(chainHost, '/api/gql/'), JSON.stringify({
|
|
508
508
|
query: `{
|
|
509
509
|
getAssetState(address: "${address}") {
|
|
510
510
|
state {
|
|
@@ -627,12 +627,12 @@ const getLauncherBaseURL = async launcherUrl => {
|
|
|
627
627
|
try {
|
|
628
628
|
const {
|
|
629
629
|
data: appMeta
|
|
630
|
-
} = await axios.get(
|
|
630
|
+
} = await axios.get(joinURL(launcherUrl, '__blocklet__.js?type=json'), {
|
|
631
631
|
timeout: 5000
|
|
632
632
|
});
|
|
633
633
|
const mountPoint = appMeta.componentMountPoints?.find(item => item.did === 'z8iZkFBbrVQxZHvcWWB3Sa2TrfGmSeFz9MSU7');
|
|
634
634
|
const launcherUrlObj = new URL(launcherUrl);
|
|
635
|
-
baseUrl =
|
|
635
|
+
baseUrl = joinURL(launcherUrlObj.origin, mountPoint?.mountPoint);
|
|
636
636
|
} catch (error) {
|
|
637
637
|
console.error(error);
|
|
638
638
|
}
|
|
@@ -646,20 +646,20 @@ export const getSubscriptionURL = async ({
|
|
|
646
646
|
if (!launcherUrl) {
|
|
647
647
|
return '';
|
|
648
648
|
}
|
|
649
|
-
let baseUrl =
|
|
649
|
+
let baseUrl = joinURL(launcherUrl, '/instances');
|
|
650
650
|
try {
|
|
651
651
|
const {
|
|
652
652
|
data: appMeta
|
|
653
|
-
} = await axios.get(
|
|
653
|
+
} = await axios.get(joinURL(launcherUrl, '__blocklet__.js?type=json'), {
|
|
654
654
|
timeout: 5000
|
|
655
655
|
});
|
|
656
656
|
const mountPoint = appMeta.componentMountPoints?.find(item => item.did === 'z8iZy4P83i6AgnNdNUexsh2kBcsDHoqcwPavn');
|
|
657
657
|
const launcherUrlObj = new URL(launcherUrl);
|
|
658
|
-
baseUrl =
|
|
658
|
+
baseUrl = joinURL(launcherUrlObj.origin, mountPoint?.mountPoint, '/nfts');
|
|
659
659
|
} catch (error) {
|
|
660
660
|
console.error(error);
|
|
661
661
|
}
|
|
662
|
-
return
|
|
662
|
+
return joinURL(baseUrl, `/${nftId}/subscription?locale=${locale}&return-url=${encodeURIComponent(window.location.href)}`);
|
|
663
663
|
};
|
|
664
664
|
export const getSubscriptionUrlV2 = async ({
|
|
665
665
|
launcherUrl = '',
|
|
@@ -671,7 +671,7 @@ export const getSubscriptionUrlV2 = async ({
|
|
|
671
671
|
return '';
|
|
672
672
|
}
|
|
673
673
|
const baseUrl = await getLauncherBaseURL(launcherUrl);
|
|
674
|
-
return
|
|
674
|
+
return joinURL(baseUrl, `/embed/subscription?launcherSessionId=${launcherSessionId}&nftDid=${nftDid}&locale=${locale}`); // nftDid 是兼容字段
|
|
675
675
|
};
|
|
676
676
|
export const getManageSubscriptionURL = async ({
|
|
677
677
|
launcherUrl = '',
|
|
@@ -682,7 +682,7 @@ export const getManageSubscriptionURL = async ({
|
|
|
682
682
|
return '';
|
|
683
683
|
}
|
|
684
684
|
const baseUrl = await getLauncherBaseURL(launcherUrl);
|
|
685
|
-
return
|
|
685
|
+
return joinURL(baseUrl, `/embed/manage-subscription?launcherSessionId=${launcherSessionId}&locale=${locale}`);
|
|
686
686
|
};
|
|
687
687
|
export const nanoid = (length = 16) => [...Array(length)].map(() => Math.random().toString(36)[2]).join('');
|
|
688
688
|
export const getSystemDomains = domains => domains.filter(x => x.isProtected);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { joinURL } from 'ufo';
|
|
2
2
|
const joinUrlKeepSearch = (originalUrl, path) => {
|
|
3
3
|
if (!originalUrl) {
|
|
4
4
|
return '';
|
|
@@ -8,7 +8,7 @@ const joinUrlKeepSearch = (originalUrl, path) => {
|
|
|
8
8
|
}
|
|
9
9
|
const url = new URL(originalUrl);
|
|
10
10
|
const searchParams = new URLSearchParams(url.searchParams);
|
|
11
|
-
const newPath = new URL(
|
|
11
|
+
const newPath = new URL(joinURL(url.origin, path));
|
|
12
12
|
newPath.search = searchParams.toString();
|
|
13
13
|
return newPath.toString();
|
|
14
14
|
};
|
package/lib/util/spaces.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import isUrl from 'is-url';
|
|
2
2
|
import { BLOCKLET_CONFIGURABLE_KEY } from '@blocklet/constant';
|
|
3
3
|
import { isObject, isString } from 'lodash';
|
|
4
|
-
import { joinURL } from 'ufo';
|
|
4
|
+
import { joinURL, withQuery } from 'ufo';
|
|
5
5
|
import { api } from './api';
|
|
6
6
|
|
|
7
7
|
/* eslint-disable import/prefer-default-export */
|
|
@@ -230,6 +230,8 @@ export async function getSpaceGatewayUrl(anyUrl, options = {
|
|
|
230
230
|
throw new Error(`MountPoint(${mountPoint}) not found`);
|
|
231
231
|
}
|
|
232
232
|
const didSpacesCoreUrl = joinURL(u.origin, mountPoint);
|
|
233
|
-
const spaceGatewayUrl = options.withSearchParams && u.searchParams.get('spaceDid') ?
|
|
233
|
+
const spaceGatewayUrl = options.withSearchParams && u.searchParams.get('spaceDid') ? withQuery(didSpacesCoreUrl, {
|
|
234
|
+
spaceDid: u.searchParams.get('spaceDid')
|
|
235
|
+
}) : didSpacesCoreUrl;
|
|
234
236
|
return spaceGatewayUrl;
|
|
235
237
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abtnode/ux",
|
|
3
|
-
"version": "1.16.28-beta-
|
|
3
|
+
"version": "1.16.28-beta-10ca1aad",
|
|
4
4
|
"description": "UX components shared across abtnode packages",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -25,24 +25,24 @@
|
|
|
25
25
|
"author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
|
|
26
26
|
"license": "Apache-2.0",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@abtnode/auth": "1.16.28-beta-
|
|
29
|
-
"@abtnode/constant": "1.16.28-beta-
|
|
30
|
-
"@abtnode/util": "1.16.28-beta-
|
|
28
|
+
"@abtnode/auth": "1.16.28-beta-10ca1aad",
|
|
29
|
+
"@abtnode/constant": "1.16.28-beta-10ca1aad",
|
|
30
|
+
"@abtnode/util": "1.16.28-beta-10ca1aad",
|
|
31
31
|
"@ahooksjs/use-url-state": "^3.5.1",
|
|
32
32
|
"@arcblock/did": "^1.18.123",
|
|
33
|
-
"@arcblock/did-connect": "^2.
|
|
33
|
+
"@arcblock/did-connect": "^2.10.0",
|
|
34
34
|
"@arcblock/did-motif": "^1.1.13",
|
|
35
|
-
"@arcblock/icons": "^2.
|
|
36
|
-
"@arcblock/nft-display": "2.
|
|
37
|
-
"@arcblock/react-hooks": "^2.
|
|
38
|
-
"@arcblock/terminal": "^2.
|
|
39
|
-
"@arcblock/ux": "^2.
|
|
40
|
-
"@blocklet/constant": "1.16.28-beta-
|
|
41
|
-
"@blocklet/launcher-layout": "2.3.
|
|
42
|
-
"@blocklet/list": "^0.12.
|
|
43
|
-
"@blocklet/meta": "1.16.28-beta-
|
|
44
|
-
"@blocklet/ui-react": "^2.
|
|
45
|
-
"@blocklet/uploader": "^0.1.
|
|
35
|
+
"@arcblock/icons": "^2.10.0",
|
|
36
|
+
"@arcblock/nft-display": "2.10.0",
|
|
37
|
+
"@arcblock/react-hooks": "^2.10.0",
|
|
38
|
+
"@arcblock/terminal": "^2.10.0",
|
|
39
|
+
"@arcblock/ux": "^2.10.0",
|
|
40
|
+
"@blocklet/constant": "1.16.28-beta-10ca1aad",
|
|
41
|
+
"@blocklet/launcher-layout": "2.3.22",
|
|
42
|
+
"@blocklet/list": "^0.12.114",
|
|
43
|
+
"@blocklet/meta": "1.16.28-beta-10ca1aad",
|
|
44
|
+
"@blocklet/ui-react": "^2.10.0",
|
|
45
|
+
"@blocklet/uploader": "^0.1.10",
|
|
46
46
|
"@emotion/react": "^11.10.4",
|
|
47
47
|
"@emotion/styled": "^11.10.4",
|
|
48
48
|
"@iconify-icons/logos": "^1.2.36",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@ocap/client": "1.18.123",
|
|
59
59
|
"@uiw/react-markdown-preview": "^5.1.1",
|
|
60
60
|
"ahooks": "^3.7.8",
|
|
61
|
-
"axios": "^
|
|
61
|
+
"axios": "^1.7.2",
|
|
62
62
|
"classnames": "^2.3.2",
|
|
63
63
|
"copy-to-clipboard": "^3.3.3",
|
|
64
64
|
"date-fns": "^2.30.0",
|
|
@@ -93,8 +93,7 @@
|
|
|
93
93
|
"rehype-external-links": "^3.0.0",
|
|
94
94
|
"semver": "^7.3.8",
|
|
95
95
|
"timeago.js": "^4.0.2",
|
|
96
|
-
"ufo": "^1.
|
|
97
|
-
"url-join": "^4.0.1",
|
|
96
|
+
"ufo": "^1.5.3",
|
|
98
97
|
"validator": "^13.9.0"
|
|
99
98
|
},
|
|
100
99
|
"devDependencies": {
|
|
@@ -108,5 +107,5 @@
|
|
|
108
107
|
"jest": "^29.7.0",
|
|
109
108
|
"jest-environment-jsdom": "^29.7.0"
|
|
110
109
|
},
|
|
111
|
-
"gitHead": "
|
|
110
|
+
"gitHead": "ed0958b6b5414ae5a3f4066bdf138a157d046b59"
|
|
112
111
|
}
|