@abtnode/ux 1.16.21-beta-2e75c75c → 1.16.21-beta-da3f852a

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/locales/zh.js CHANGED
@@ -1,3 +1,4 @@
1
+ /* eslint-disable prettier/prettier */
1
2
  export default {
2
3
  setup: {
3
4
  connect: {
@@ -64,7 +65,8 @@ export default {
64
65
  scan: '连接 DID 钱包出示 NFT 以换取通行证',
65
66
  confirm: '在钱包中选择 NFT',
66
67
  success: '通行证换取成功'
67
- }
68
+ },
69
+ login: '登录'
68
70
  },
69
71
  payablePassport: {
70
72
  title: 'Purchase passport with payment',
@@ -376,7 +378,8 @@ export default {
376
378
  upgradeDescription: '升级基石程序可能会导致其短暂不可用,是否要继续?',
377
379
  confirmUpgrade: '是的,升级吧',
378
380
  confirmRestart: '是的,重启吧',
379
- restartDescription: '服务会短暂暂停,并且有可能因为变更了配置无法启动'
381
+ restartDescription: '服务会短暂暂停,并且有可能因为变更了配置无法启动',
382
+ confirmComponentRemove: '是的,刪除它'
380
383
  },
381
384
  dev: {
382
385
  modeTip: '请将节点切换至 DEBUG 模式'
@@ -807,7 +810,11 @@ export default {
807
810
  monitor: {
808
811
  diskThreshold: '当磁盘使用率超过(%)时发送报警',
809
812
  diskThresholdPlaceholder: '请设置磁盘使用率报警阈值'
810
- }
813
+ },
814
+ domainRequired: '服务器域名是必需的',
815
+ ipPlaceholder: 'IP',
816
+ ipRequired: 'IP是必需的',
817
+ enableWelcomePage: '启用欢迎页'
811
818
  },
812
819
  accessKey: {
813
820
  accessKeyId: 'Access Key',
@@ -1069,7 +1076,8 @@ export default {
1069
1076
  sourceTypes: {
1070
1077
  upload: '通过上传文件',
1071
1078
  lets_encrypt: "通过 Let's Encrypt 自动生成"
1072
- }
1079
+ },
1080
+ source: '來源'
1073
1081
  },
1074
1082
  detail: {
1075
1083
  title: '证书详情'
@@ -1415,7 +1423,8 @@ export default {
1415
1423
  dialog: {
1416
1424
  confirm: '在您的 DID 钱包上确认',
1417
1425
  success: '通行证已成功添加到您的 DID 钱包',
1418
- loginWithPassport: '用此通行证连接'
1426
+ loginWithPassport: '用此通行证连接',
1427
+ scan: '使用您的DID钱包来申领护照'
1419
1428
  }
1420
1429
  },
1421
1430
  lostPassport: {
@@ -1566,7 +1575,8 @@ export default {
1566
1575
  switch: {
1567
1576
  failedForMismatchSpace: '请连接至正确的 Space{name}'
1568
1577
  },
1569
- connectTo: '连接至 DID Spaces'
1578
+ connectTo: '连接至 DID Spaces',
1579
+ title: '门户'
1570
1580
  },
1571
1581
  strategy: {
1572
1582
  title: '备份策略',
package/es/util/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable max-len */
2
2
  /* eslint-disable implicit-arrow-linebreak */
3
3
  /* eslint-disable import/prefer-default-export */
4
- import { BLOCKLET_STORE_API_PREFIX, DEFAULT_DID_DOMAIN, DEFAULT_IP_DOMAIN_SUFFIX, DEFAULT_SLP_DOMAIN, DOMAIN_FOR_DEFAULT_SITE, DOMAIN_FOR_INTERNAL_SITE, DOMAIN_FOR_IP_SITE, DOMAIN_FOR_IP_SITE_REGEXP, IP, ROLES, SLOT_FOR_IP_DNS_SITE, WEB_WALLET_URL, WELLKNOWN_PATH_PREFIX, WELLKNOWN_PING_PREFIX, WELLKNOWN_SERVICE_PATH_PREFIX } from '@abtnode/constant';
4
+ import { BLOCKLET_STORE_API_PREFIX, DEFAULT_DID_DOMAIN, DEFAULT_IP_DOMAIN_SUFFIX, DEFAULT_SLP_DOMAIN, DOMAIN_FOR_DEFAULT_SITE, DOMAIN_FOR_INTERNAL_SITE, DOMAIN_FOR_IP_SITE, DOMAIN_FOR_IP_SITE_REGEXP, IP, ROLES, SLOT_FOR_IP_DNS_SITE, WEB_WALLET_URL, WELLKNOWN_PATH_PREFIX, WELLKNOWN_PING_PREFIX, WELLKNOWN_SERVICE_PATH_PREFIX, WELLKNOWN_BLOCKLET_HEALTH_PATH } from '@abtnode/constant';
5
5
  import filesize from 'filesize';
6
6
  import humanizeUrl from 'humanize-url';
7
7
  import isUrl from 'is-url';
@@ -12,6 +12,7 @@ import qs from 'querystring';
12
12
  import joinUrl from 'url-join';
13
13
  import axios from '@abtnode/util/lib/axios';
14
14
  import dayjs from '@abtnode/util/lib/dayjs';
15
+ import tryWithTimeout from '@abtnode/util/lib/try-with-timeout';
15
16
  import formatError from '@abtnode/util/lib/format-error';
16
17
  import normalizePathPrefix from '@abtnode/util/lib/normalize-path-prefix';
17
18
  import { evaluateURLs } from '@abtnode/util/lib/url-evaluation';
@@ -375,12 +376,49 @@ export const getBlockletLogoUrl = ({
375
376
  };
376
377
  export const getPathPrefix = () => window.env && window.env.apiPrefix ? window.env.apiPrefix : '/';
377
378
  export const isUrlAccessible = url => checkAccessible(joinUrl(new URL(url).origin, WELLKNOWN_PING_PREFIX));
379
+ const checkBlockletAccessible = async (url, timeout = 5000) => {
380
+ try {
381
+ const urlObj = new URL(url);
382
+ urlObj.protocol = 'https';
383
+ urlObj.pathname = joinUrl(WELLKNOWN_BLOCKLET_HEALTH_PATH);
384
+ const response = await axios.get(urlObj.toString(), {
385
+ timeout,
386
+ validateStatus: status => {
387
+ return status >= 200 && status < 400 || status === 503; // 503 是 not running, 可以访问 blocklet service
388
+ }
389
+ });
390
+ return !!response?.data?.message;
391
+ } catch (error) {
392
+ console.error(error);
393
+ return false;
394
+ }
395
+ };
396
+ const waitingForAccessible = async (urls, timeout = 30 * 1000) => {
397
+ const tasks = await urls.map(async url => {
398
+ try {
399
+ await tryWithTimeout(async () => {
400
+ let accessible = false;
401
+ do {
402
+ /* eslint-disable no-await-in-loop */
403
+ accessible = await checkBlockletAccessible(url);
404
+ await sleep(2000);
405
+ } while (!accessible);
406
+ }, timeout);
407
+ } catch (error) {
408
+ console.error(error);
409
+ }
410
+ });
411
+ await Promise.all(tasks);
412
+ };
378
413
  export const getAccessibleUrl = async urls => {
379
414
  try {
380
- const res = await evaluateURLs(urls);
415
+ await waitingForAccessible(urls);
416
+ const res = await evaluateURLs(urls, {
417
+ checkAccessible: checkBlockletAccessible
418
+ });
381
419
  return res[0].url;
382
420
  } catch (error) {
383
- console.warn('get accessible url failed');
421
+ console.warn('get accessible url failed', error);
384
422
  return '';
385
423
  }
386
424
  };
@@ -5,24 +5,24 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
- var _styled = _interopRequireDefault(require("@emotion/styled"));
9
8
  var _reactRouterDom = require("react-router-dom");
9
+ var _Box = _interopRequireDefault(require("@mui/material/Box"));
10
10
  var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
11
11
  var _Center = _interopRequireDefault(require("@arcblock/ux/lib/Center"));
12
12
  var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
13
13
  var _Connect = _interopRequireDefault(require("@arcblock/did-connect/lib/Connect"));
14
14
  var _context = require("@arcblock/ux/lib/Locale/context");
15
+ var _fullpage = _interopRequireDefault(require("@arcblock/did-connect/lib/Connect/fullpage"));
15
16
  var _constant = require("@abtnode/constant");
16
17
  var _wrapLocale = _interopRequireDefault(require("./wrap-locale"));
17
18
  var _jsxRuntime = require("react/jsx-runtime");
18
- var _templateObject;
19
- /* eslint-disable react/prop-types */
20
- /* eslint-disable react/jsx-one-expression-per-line */
21
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
20
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
23
21
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
24
- function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
22
+ /* eslint-disable react/prop-types */
23
+
25
24
  function ExchangePassport(_ref) {
25
+ var _window, _window$blocklet, _window2, _window2$env;
26
26
  let {
27
27
  SessionContext,
28
28
  webWalletUrl,
@@ -73,9 +73,14 @@ function ExchangePassport(_ref) {
73
73
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgress.default, {})
74
74
  });
75
75
  }
76
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(Div, {
77
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
78
- className: "connect-wrapper",
76
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_fullpage.default, {
77
+ did: ((_window = window) === null || _window === void 0 ? void 0 : (_window$blocklet = _window.blocklet) === null || _window$blocklet === void 0 ? void 0 : _window$blocklet.appPid) || ((_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$env = _window2.env) === null || _window2$env === void 0 ? void 0 : _window2$env.appPid),
78
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
79
+ sx: {
80
+ width: '560px',
81
+ maxWidth: '100%',
82
+ height: '100%'
83
+ },
79
84
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Connect.default, {
80
85
  className: "connect",
81
86
  action: "exchange-passport",
@@ -97,5 +102,4 @@ function ExchangePassport(_ref) {
97
102
  })
98
103
  });
99
104
  }
100
- var _default = exports.default = (0, _wrapLocale.default)(ExchangePassport);
101
- const Div = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n box-sizing: border-box;\n width: 100%;\n height: 100vh;\n position: relative;\n display: flex;\n flex-direction: column;\n .connect-wrapper {\n flex: 1;\n }\n .connect {\n background: #fafafa;\n }\n"])));
105
+ var _default = exports.default = (0, _wrapLocale.default)(ExchangePassport);
@@ -100,4 +100,4 @@ HeaderAddon.defaultProps = {
100
100
  showHelper: true,
101
101
  sessionManagerProps: {}
102
102
  };
103
- const Div = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n justify-content: center;\n align-items: center;\n\n .MuiIconButton-root svg {\n width: 26px;\n height: 26px;\n }\n\n .user-addon {\n .user-avatar {\n width: 28px;\n border-radius: 14px;\n height: auto;\n }\n }\n\n ", " {\n > button,\n > a {\n padding-left: 8px;\n padding-right: 8px;\n }\n }\n"])), props => props.theme.breakpoints.down('md'));
103
+ const Div = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n justify-content: center;\n align-items: center;\n\n .MuiIconButton-root svg {\n width: 26px;\n height: 26px;\n }\n\n .user-addon {\n .user-avatar {\n width: 28px;\n border-radius: 14px;\n height: auto;\n }\n }\n\n .locale-addon .locales {\n max-height: 400px;\n overflow-y: auto;\n }\n\n ", " {\n > button,\n > a {\n padding-left: 8px;\n padding-right: 8px;\n }\n }\n"])), props => props.theme.breakpoints.down('md'));