@abtnode/ux 1.16.28-beta-8acda0e6 → 1.16.28-next-5a717317
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 +10 -4
- 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 +3 -2
- 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/resources.js +3 -4
- 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/en.js +0 -4
- package/lib/locales/i18n.db +0 -0
- package/lib/locales/zh-tw.js +1 -1
- package/lib/locales/zh.js +1 -5
- 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 +2 -4
- package/package.json +20 -19
- package/lib/blocklet/publish/create-release/keep-now-resources.js +0 -15
package/lib/analytics/traffic.js
CHANGED
|
@@ -3,10 +3,16 @@
|
|
|
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 'url-join';
|
|
7
7
|
import useAsyncRetry from 'react-use/lib/useAsyncRetry';
|
|
8
8
|
import Iframe from 'react-iframe';
|
|
9
|
-
import
|
|
9
|
+
import Alert from '@mui/material/Alert';
|
|
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';
|
|
10
16
|
import ViewIcon from '@mui/icons-material/LaunchOutlined';
|
|
11
17
|
import { DateRangePicker } from 'mui-daterange-picker';
|
|
12
18
|
import { DatePicker } from '@mui/x-date-pickers';
|
|
@@ -108,7 +114,7 @@ export default function TrafficInsights({
|
|
|
108
114
|
error
|
|
109
115
|
} = data;
|
|
110
116
|
if (!list.length && loading) {
|
|
111
|
-
return /*#__PURE__*/_jsx(
|
|
117
|
+
return /*#__PURE__*/_jsx(Spinner, {});
|
|
112
118
|
}
|
|
113
119
|
if (error) {
|
|
114
120
|
return /*#__PURE__*/_jsx(Alert, {
|
|
@@ -144,7 +150,7 @@ export default function TrafficInsights({
|
|
|
144
150
|
|
|
145
151
|
// eslint-disable-next-line no-nested-ternary
|
|
146
152
|
const pathPrefix = inService ? WELLKNOWN_SERVICE_PATH_PREFIX : process.env.NODE_ENV === 'production' ? info.routing.adminPath : '';
|
|
147
|
-
const breakdownUrl =
|
|
153
|
+
const breakdownUrl = joinUrl(window.location.origin, pathPrefix, `/api/analytics/traffic?date=${dayjs(date).format('YYYY-MM-DD')}&did=${did}`);
|
|
148
154
|
const onRangeChange = range => {
|
|
149
155
|
setDateRange(range);
|
|
150
156
|
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 'url-join';
|
|
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 'url-join';
|
|
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 'url-join';
|
|
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,7 +23,8 @@ 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
|
|
26
|
+
import urljoin from 'url-join';
|
|
27
|
+
import { withoutTrailingSlash } from 'ufo/dist/index.mjs';
|
|
27
28
|
import isAbsoluteUrl from 'is-absolute-url';
|
|
28
29
|
import { SUPPORTED_LANGUAGES } from '@blocklet/constant';
|
|
29
30
|
import LocaleTabs from './locale-tabs';
|
|
@@ -168,7 +169,7 @@ const NavigationDialog = /*#__PURE__*/forwardRef(function NavigationDialog({
|
|
|
168
169
|
return withoutTrailingSlash(stringLink);
|
|
169
170
|
}
|
|
170
171
|
const selectedLink = isObject(selectedOption.link) ? selectedOption.link[state.locale] : selectedOption.link;
|
|
171
|
-
return withoutTrailingSlash(
|
|
172
|
+
return withoutTrailingSlash(urljoin(stringLink, selectedLink || '/'));
|
|
172
173
|
}
|
|
173
174
|
return null;
|
|
174
175
|
}, [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 'url-join';
|
|
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 'url-join';
|
|
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 'url-join';
|
|
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 'url-join';
|
|
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: 'z1b9wxs47TXpA5s6VMoGFBk933tF7ujzFDt',
|
|
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 'url-join';
|
|
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,
|
|
@@ -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 'url-join';
|
|
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,7 +14,6 @@ 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';
|
|
18
17
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
18
|
const fillParent = (nodes, parentId) => {
|
|
20
19
|
nodes.forEach(node => {
|
|
@@ -32,7 +31,7 @@ const parseUrl = (component, projectId, releaseId, locale, initUrl) => {
|
|
|
32
31
|
const {
|
|
33
32
|
exportApi = '/'
|
|
34
33
|
} = component?.meta.resource || {};
|
|
35
|
-
const urlObj = new URL(
|
|
34
|
+
const urlObj = new URL(joinUrl('http://127.0.0.1', component.mountPoint, exportApi || '/').replace(/\/+/g, '/'));
|
|
36
35
|
urlObj.searchParams.set('projectId', projectId);
|
|
37
36
|
urlObj.searchParams.set('releaseId', releaseId);
|
|
38
37
|
urlObj.searchParams.set('local', locale);
|
|
@@ -179,7 +178,7 @@ export default function Resources({
|
|
|
179
178
|
const list = res?.resources || [];
|
|
180
179
|
if (list?.length) {
|
|
181
180
|
setSelectedResourceIds({
|
|
182
|
-
[child.meta.did]:
|
|
181
|
+
[child.meta.did]: list
|
|
183
182
|
});
|
|
184
183
|
setSelectedComponentsMapByIds(child.meta.did, tree, list);
|
|
185
184
|
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 'url-join';
|
|
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 'url-join';
|
|
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 'url-join';
|
|
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 'url-join';
|
|
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 'url-join';
|
|
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 'url-join';
|
|
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 'url-join';
|
|
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 'url-join';
|
|
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
|
|
7
|
+
import joinURL from 'url-join';
|
|
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/en.js
CHANGED
|
@@ -833,10 +833,6 @@ 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
|
-
},
|
|
840
836
|
upgrade: {
|
|
841
837
|
title: 'Upgrade Blocklet Server to {version}',
|
|
842
838
|
description: 'During the upgrade, your Blocklet Server will enter maintenance mode for a few minutes while the update is completed.',
|
package/lib/locales/i18n.db
CHANGED
|
Binary file
|
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: '推送套件的 API 路徑(預設 /api/push)',
|
|
984
984
|
did: 'PushKit Blocklet DID',
|
|
985
985
|
customOptions: '自訂選項'
|
|
986
986
|
}
|
package/lib/locales/zh.js
CHANGED
|
@@ -874,10 +874,6 @@ export default {
|
|
|
874
874
|
welcome: {
|
|
875
875
|
switchLabel: 'Welcome 页面'
|
|
876
876
|
},
|
|
877
|
-
security: {
|
|
878
|
-
switchLabel: '文件系统隔离',
|
|
879
|
-
switchTips: '关闭此选项后,Blocklet 的文件系统将不再处于隔离状态,可能会存在恶意软件破坏文件系统的风险。'
|
|
880
|
-
},
|
|
881
877
|
register: {
|
|
882
878
|
titleAdded: '当前节点已经添加到应用启动器',
|
|
883
879
|
title: '添加节点到应用启动器',
|
|
@@ -987,7 +983,7 @@ export default {
|
|
|
987
983
|
testSend: '测试推送',
|
|
988
984
|
inputTestReceiver: '请输入测试接收者 DID',
|
|
989
985
|
receiverRequired: '需要 PushKit 接收者 DID',
|
|
990
|
-
pushPath: '
|
|
986
|
+
pushPath: '推送套件的 API 路径(默认 /api/push)',
|
|
991
987
|
did: 'PushKit Blocklet DID',
|
|
992
988
|
customOptions: '自定义选项'
|
|
993
989
|
}
|
|
@@ -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 'url-join';
|
|
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 'url-join';
|
|
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 'url-join';
|
|
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 'url-join';
|
|
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 'url-join';
|
|
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
|
|
4
|
+
import { joinURL } from 'ufo';
|
|
5
5
|
import { api } from './api';
|
|
6
6
|
|
|
7
7
|
/* eslint-disable import/prefer-default-export */
|
|
@@ -230,8 +230,6 @@ 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') ?
|
|
234
|
-
spaceDid: u.searchParams.get('spaceDid')
|
|
235
|
-
}) : didSpacesCoreUrl;
|
|
233
|
+
const spaceGatewayUrl = options.withSearchParams && u.searchParams.get('spaceDid') ? joinURL(didSpacesCoreUrl, `?spaceDid=${u.searchParams.get('spaceDid')}`) : didSpacesCoreUrl;
|
|
236
234
|
return spaceGatewayUrl;
|
|
237
235
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abtnode/ux",
|
|
3
|
-
"version": "1.16.28-
|
|
3
|
+
"version": "1.16.28-next-5a717317",
|
|
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-
|
|
29
|
-
"@abtnode/constant": "1.16.28-
|
|
30
|
-
"@abtnode/util": "1.16.28-
|
|
28
|
+
"@abtnode/auth": "1.16.28-next-5a717317",
|
|
29
|
+
"@abtnode/constant": "1.16.28-next-5a717317",
|
|
30
|
+
"@abtnode/util": "1.16.28-next-5a717317",
|
|
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.9.90",
|
|
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-
|
|
41
|
-
"@blocklet/launcher-layout": "2.3.
|
|
42
|
-
"@blocklet/list": "^0.12.
|
|
43
|
-
"@blocklet/meta": "1.16.28-
|
|
44
|
-
"@blocklet/ui-react": "^2.
|
|
45
|
-
"@blocklet/uploader": "^0.1.
|
|
35
|
+
"@arcblock/icons": "^2.9.90",
|
|
36
|
+
"@arcblock/nft-display": "2.9.90",
|
|
37
|
+
"@arcblock/react-hooks": "^2.9.90",
|
|
38
|
+
"@arcblock/terminal": "^2.9.90",
|
|
39
|
+
"@arcblock/ux": "^2.9.90",
|
|
40
|
+
"@blocklet/constant": "1.16.28-next-5a717317",
|
|
41
|
+
"@blocklet/launcher-layout": "2.3.21",
|
|
42
|
+
"@blocklet/list": "^0.12.111",
|
|
43
|
+
"@blocklet/meta": "1.16.28-next-5a717317",
|
|
44
|
+
"@blocklet/ui-react": "^2.9.90",
|
|
45
|
+
"@blocklet/uploader": "^0.1.6",
|
|
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": "^0.27.2",
|
|
62
62
|
"classnames": "^2.3.2",
|
|
63
63
|
"copy-to-clipboard": "^3.3.3",
|
|
64
64
|
"date-fns": "^2.30.0",
|
|
@@ -93,7 +93,8 @@
|
|
|
93
93
|
"rehype-external-links": "^3.0.0",
|
|
94
94
|
"semver": "^7.3.8",
|
|
95
95
|
"timeago.js": "^4.0.2",
|
|
96
|
-
"ufo": "^1.
|
|
96
|
+
"ufo": "^1.0.1",
|
|
97
|
+
"url-join": "^4.0.1",
|
|
97
98
|
"validator": "^13.9.0"
|
|
98
99
|
},
|
|
99
100
|
"devDependencies": {
|
|
@@ -107,5 +108,5 @@
|
|
|
107
108
|
"jest": "^29.7.0",
|
|
108
109
|
"jest-environment-jsdom": "^29.7.0"
|
|
109
110
|
},
|
|
110
|
-
"gitHead": "
|
|
111
|
+
"gitHead": "3624967f9549de3a25a87ed6b20f82519ddb4757"
|
|
111
112
|
}
|
|
@@ -1,15 +0,0 @@
|
|
|
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;
|