@arcblock/ux 3.0.28 → 3.0.29

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.
@@ -1,12 +1,21 @@
1
- import { jsxs as i, jsx as t } from "react/jsx-runtime";
2
- import { Box as e, Typography as l } from "@mui/material";
3
- import o from "../../Img/index.js";
4
- function c({
5
- requestAppInfo: r,
6
- currentAppInfo: a
1
+ import { jsxs as a, jsx as o } from "react/jsx-runtime";
2
+ import { Box as r, Typography as n } from "@mui/material";
3
+ import i from "../../Img/index.js";
4
+ import { BLOCKLET_SERVICE_PATH_PREFIX as s } from "../../Util/constant.js";
5
+ const l = (e) => {
6
+ if (!e) return "";
7
+ try {
8
+ return new URL(e).protocol !== "https:" ? (console.warn("Image URL must use HTTPS protocol:", e), "") : `${s}/proxy?url=${e}`;
9
+ } catch (t) {
10
+ return console.warn("Invalid image URL format:", e, t), "";
11
+ }
12
+ };
13
+ function g({
14
+ requestAppInfo: e,
15
+ currentAppInfo: t
7
16
  }) {
8
- return /* @__PURE__ */ i(
9
- e,
17
+ return /* @__PURE__ */ a(
18
+ r,
10
19
  {
11
20
  sx: {
12
21
  textAlign: "center",
@@ -16,8 +25,8 @@ function c({
16
25
  gap: 2
17
26
  },
18
27
  children: [
19
- /* @__PURE__ */ i(
20
- e,
28
+ /* @__PURE__ */ a(
29
+ r,
21
30
  {
22
31
  sx: {
23
32
  display: "flex",
@@ -25,9 +34,18 @@ function c({
25
34
  justifyContent: "center"
26
35
  },
27
36
  children: [
28
- /* @__PURE__ */ t(o, { src: a.appLogo, alt: "Server", width: 48, height: 48 }),
29
- /* @__PURE__ */ i(
30
- e,
37
+ /* @__PURE__ */ o(
38
+ i,
39
+ {
40
+ src: t.appLogo,
41
+ alt: "Server",
42
+ width: 48,
43
+ height: 48,
44
+ fallback: l(t.appLogo)
45
+ }
46
+ ),
47
+ /* @__PURE__ */ a(
48
+ r,
31
49
  {
32
50
  sx: {
33
51
  mx: 2,
@@ -42,18 +60,27 @@ function c({
42
60
  }
43
61
  },
44
62
  children: [
45
- /* @__PURE__ */ t(e, { className: "dot" }),
46
- /* @__PURE__ */ t(e, { className: "dot" }),
47
- /* @__PURE__ */ t(e, { className: "dot" })
63
+ /* @__PURE__ */ o(r, { className: "dot" }),
64
+ /* @__PURE__ */ o(r, { className: "dot" }),
65
+ /* @__PURE__ */ o(r, { className: "dot" })
48
66
  ]
49
67
  }
50
68
  ),
51
- /* @__PURE__ */ t(o, { src: r.appLogo, alt: r.appName, width: 48, height: 48 })
69
+ /* @__PURE__ */ o(
70
+ i,
71
+ {
72
+ src: e.appLogo,
73
+ alt: e.appName,
74
+ width: 48,
75
+ height: 48,
76
+ fallback: l(e.appLogo)
77
+ }
78
+ )
52
79
  ]
53
80
  }
54
81
  ),
55
- /* @__PURE__ */ i(
56
- l,
82
+ /* @__PURE__ */ a(
83
+ n,
57
84
  {
58
85
  sx: {
59
86
  mb: 1,
@@ -62,7 +89,7 @@ function c({
62
89
  children: [
63
90
  "Authorize",
64
91
  " ",
65
- /* @__PURE__ */ t(e, { component: "span", sx: { color: "primary.main" }, children: r.appName })
92
+ /* @__PURE__ */ o(r, { component: "span", sx: { color: "primary.main" }, children: e.appName })
66
93
  ]
67
94
  }
68
95
  )
@@ -71,5 +98,5 @@ function c({
71
98
  );
72
99
  }
73
100
  export {
74
- c as default
101
+ g as default
75
102
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "3.0.28",
3
+ "version": "3.0.29",
4
4
  "description": "Common used react components for arcblock products",
5
5
  "keywords": [
6
6
  "react",
@@ -60,16 +60,16 @@
60
60
  "react": "^19.0.0",
61
61
  "react-router-dom": "^6.22.3"
62
62
  },
63
- "gitHead": "a2d0c2d51c4a6f4fd301e59104fa5811bf4bd4ab",
63
+ "gitHead": "3c3532881441518b47bce00147ba469a03baad78",
64
64
  "dependencies": {
65
- "@arcblock/bridge": "3.0.28",
65
+ "@arcblock/bridge": "3.0.29",
66
66
  "@arcblock/did": "^1.20.15",
67
67
  "@arcblock/did-motif": "^1.1.14",
68
- "@arcblock/icons": "3.0.28",
69
- "@arcblock/nft-display": "3.0.28",
70
- "@arcblock/react-hooks": "3.0.28",
68
+ "@arcblock/icons": "3.0.29",
69
+ "@arcblock/nft-display": "3.0.29",
70
+ "@arcblock/react-hooks": "3.0.29",
71
71
  "@blocklet/js-sdk": "^1.16.46",
72
- "@blocklet/theme": "3.0.28",
72
+ "@blocklet/theme": "3.0.29",
73
73
  "@fontsource/roboto": "~5.1.1",
74
74
  "@fontsource/ubuntu-mono": "^5.2.6",
75
75
  "@iconify-icons/logos": "^1.2.36",
@@ -1,5 +1,28 @@
1
1
  import { Box, Typography } from '@mui/material';
2
2
  import Img from '../../Img';
3
+ import { BLOCKLET_SERVICE_PATH_PREFIX } from '../../Util/constant';
4
+
5
+ const getProxyImageUrl = (url: string) => {
6
+ if (!url) return '';
7
+
8
+ try {
9
+ // 检查是否是一个有效的URL
10
+ const urlObj = new URL(url);
11
+
12
+ // 检查协议是否是https
13
+ if (urlObj.protocol !== 'https:') {
14
+ console.warn('Image URL must use HTTPS protocol:', url);
15
+ return '';
16
+ }
17
+
18
+ // 返回代理URL
19
+ return `${BLOCKLET_SERVICE_PATH_PREFIX}/proxy?url=${url}`;
20
+ } catch (error) {
21
+ // URL construction failed, indicating invalid URL format
22
+ console.warn('Invalid image URL format:', url, error);
23
+ return '';
24
+ }
25
+ };
3
26
 
4
27
  export type RequestAppInfo = {
5
28
  appLogo: string;
@@ -36,7 +59,13 @@ export default function AuthAppsInfo({
36
59
  justifyContent: 'center',
37
60
  }}>
38
61
  {/* FIXME: @zhanghan 增加 hover 的效果 */}
39
- <Img src={currentAppInfo.appLogo} alt="Server" width={48} height={48} />
62
+ <Img
63
+ src={currentAppInfo.appLogo}
64
+ alt="Server"
65
+ width={48}
66
+ height={48}
67
+ fallback={getProxyImageUrl(currentAppInfo.appLogo)}
68
+ />
40
69
 
41
70
  <Box
42
71
  sx={{
@@ -57,7 +86,13 @@ export default function AuthAppsInfo({
57
86
  </Box>
58
87
 
59
88
  {/* FIXME: @zhanghan 增加 hover 的效果 */}
60
- <Img src={requestAppInfo.appLogo} alt={requestAppInfo.appName} width={48} height={48} />
89
+ <Img
90
+ src={requestAppInfo.appLogo}
91
+ alt={requestAppInfo.appName}
92
+ width={48}
93
+ height={48}
94
+ fallback={getProxyImageUrl(requestAppInfo.appLogo)}
95
+ />
61
96
  </Box>
62
97
 
63
98
  <Typography