diff --git a/.env b/.env
index cdb5aed..d8c1c7b 100644
--- a/.env
+++ b/.env
@@ -4,3 +4,4 @@ NODE_SECRET="aHVnZSBjb21wYW55IHBob25lIHdlc3QgcGxhY2Ugc2VtaW5hciBtaXJhY2xlIGxlbmQ
IS_DEBUG="true"
ACCOUNT_NAME="de1"
VITE_BASE_URL="http://10.66.66.234:6060"
+VITE_BLOCK_URL="http://localhost:3001"
diff --git a/src/api/block.ts b/src/api/block.ts
index 8919c25..0eaa410 100644
--- a/src/api/block.ts
+++ b/src/api/block.ts
@@ -4,7 +4,7 @@ import { api } from "@/utils/api";
// 区块链api 类
export class BlockChainApi {
public coreConfig: CoreConfig;
- public baseUrl = "http://localhost:3000/api";
+ public baseUrl = import.meta.env.VITE_BLOCK_URL;
constructor() {
this.coreConfig = {} as CoreConfig;
diff --git a/src/api/flying-line.ts b/src/api/flying-line.ts
index 91583f4..597ff21 100644
--- a/src/api/flying-line.ts
+++ b/src/api/flying-line.ts
@@ -4,24 +4,24 @@ const baseUrl = import.meta.env.VITE_BASE_URL;
// 通行认证
export const getPassAuthentication = async () => {
- return await api.get(`${baseUrl}/step/pass_authentication`);
+ return (await api.get(`${baseUrl}/step/pass_authentication`)).data;
};
// 流量混淆
export const getTrafficObfuscation = async () => {
- return await api.get(`${baseUrl}/step/traffic_obfuscation`);
-}
+ return (await api.get(`${baseUrl}/step/traffic_obfuscation`)).data;
+};
// 嵌套加密
export const getNestedEncryption = async () => {
- return await api.get(`${baseUrl}/step/nested_encryption`);
-}
+ return (await api.get(`${baseUrl}/step/nested_encryption`)).data;
+};
// 动态路由生成
export const getDynamicRouteGeneration = async () => {
- return await api.get(`${baseUrl}/step/dynamic_route_generator`);
-}
+ return (await api.get(`${baseUrl}/step/dynamic_route_generator`)).data;
+};
// 应用分流
export const getApplicationDiversion = async () => {
- return await api.get(`${baseUrl}/step/app_diversion`);
-}
+ return (await api.get(`${baseUrl}/step/app_diversion`)).data;
+};
diff --git a/src/pages/anti-forensics-forwarding/data/mockData.ts b/src/pages/anti-forensics-forwarding/data/mockData.ts
index 0348841..eeb1dca 100644
--- a/src/pages/anti-forensics-forwarding/data/mockData.ts
+++ b/src/pages/anti-forensics-forwarding/data/mockData.ts
@@ -2,7 +2,7 @@
export const TRAFFIC_OBFUSCATION = {
type: "NESTED_ENCRYPTION",
name: "流量混淆",
- code: "BR",
+ code: "ZA",
data: [
{
country_code: "gl",
@@ -404,6 +404,8 @@ export const APP_DIVERSION = [
export const PASS_AUTHENTICATION = {
type: "PASS_AUTHENTICATION",
name: "通行认证",
+ startPoint: "GL",
+ endPoint: "CA",
authenticationPoint: [
[-103.346771, 54.130366],
[-120.346771, 52.130366],
@@ -444,4 +446,4 @@ export const PASS_AUTHENTICATION = {
},
],
isLine: true,
-};
+}
diff --git a/src/pages/decentralized-lastic-network/components/FormAlertDialog/index.tsx b/src/pages/decentralized-lastic-network/components/FormAlertDialog/index.tsx
index 577a903..cc433ec 100644
--- a/src/pages/decentralized-lastic-network/components/FormAlertDialog/index.tsx
+++ b/src/pages/decentralized-lastic-network/components/FormAlertDialog/index.tsx
@@ -100,13 +100,13 @@ const NodeForm = ({ form }: { form: FormInstance }) => {
{/*
uid
*/}
-
+
-
+
{
await form.validateFields();
const formValue: any = form.getFieldsValue();
if (type.title === DIALOGTYPE.ADDNode.title) {
+ console.log(formValue,"formValue")
setOpen(false);
} else {
const { inbound, outbound } = formValue || {};
diff --git a/src/pages/new-home/components/world-geo.tsx b/src/pages/new-home/components/world-geo.tsx
index 7433670..13c8275 100644
--- a/src/pages/new-home/components/world-geo.tsx
+++ b/src/pages/new-home/components/world-geo.tsx
@@ -168,7 +168,6 @@ export const WorldGeo = memo(
// 定位自定义提示框 - 优化版本
const positionCustomTooltip = () => {
if (!customTooltipRef.current || !proxyGeoRef.current) return;
- console.log(dataInfo.nestedEncryption?.[0]?.code, "sssss");
// 找到US点
const coords = geoCoordMap[dataInfo.nestedEncryption?.[0]?.code ?? "GL"];
if (!coords) return;
@@ -1159,7 +1158,6 @@ export const WorldGeo = memo(
};
}, []);
useEffect(() => {
- console.log(tooltipClosed, "tooltipClosedtooltipClosed");
if (tooltipClosed) {
createCustomTooltip();
createCustomTooltip2();
diff --git a/src/pages/new-home/index.tsx b/src/pages/new-home/index.tsx
index 499504a..bcf81a9 100644
--- a/src/pages/new-home/index.tsx
+++ b/src/pages/new-home/index.tsx
@@ -22,7 +22,6 @@ import type { AppDispatch, RootState } from "@/store";
import "./index.scss";
import { DialogConfig, FormAlertDialog } from "./components/FormAlertDialog";
import { ClearNodeDialog } from "./components/ClearNodeDialog";
-import { blockChainApi } from "@/api/block";
import {
getPassAuthentication,
getTrafficObfuscation,
@@ -30,6 +29,7 @@ import {
getDynamicRouteGeneration,
getApplicationDiversion,
} from "@/api/flying-line";
+import { blockChainApi } from "@/api/block";
export const DIALOGTYPE = {
ADDNode: {
@@ -58,7 +58,7 @@ export const NODEDIALOGTYPE = {
};
const NewHome = () => {
const dispatch = useDispatch();
- const { web3List, web3List2, } = useSelector(
+ const { web3List, web3List2 } = useSelector(
(state: RootState) => state.web3Reducer
);
@@ -242,10 +242,9 @@ const NewHome = () => {
});
};
useEffect(() => {
- // blockChainApi.getLatestBlock().then((res) => {
- // console.log("res", res);
- // setBlockChain(res);
- // });
+ blockChainApi.getLatestBlock().then((res) => {
+ console.log("res", res);
+ });
initData();
}, []);
diff --git a/src/routes/index.tsx b/src/routes/index.tsx
index 3740dcc..07871a5 100644
--- a/src/routes/index.tsx
+++ b/src/routes/index.tsx
@@ -15,7 +15,7 @@ export const router = createBrowserRouter([
children: [
{
index: true, // 默认路由
- element: , // 重定向到 /home
+ element: , // 重定向到 /home
},
{
path: '/new-home',
diff --git a/src/utils/api.ts b/src/utils/api.ts
index d9c781f..541f362 100644
--- a/src/utils/api.ts
+++ b/src/utils/api.ts
@@ -16,9 +16,15 @@ class FetchApi {
...config,
});
if (result.ok) {
- return await result.json();
+ return {
+ success: true,
+ data: await result.json(),
+ };
} else {
- return null;
+ return {
+ success: false,
+ data: await result.text(),
+ };
}
}
diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts
index b1f45c7..e5abdb9 100644
--- a/src/vite-env.d.ts
+++ b/src/vite-env.d.ts
@@ -1,2 +1,11 @@
///
///
+interface ImportMetaEnv {
+ // 定义你的环境变量,例如:
+ readonly VITE_BASE_URL: string
+ readonly VITE_BLOCK_URL: string
+ }
+
+ interface ImportMeta {
+ readonly env: ImportMetaEnv
+ }
\ No newline at end of file