From f9a68e8b234102b69db7b623f63d596b17d8a0a4 Mon Sep 17 00:00:00 2001 From: GyDi Date: Thu, 8 Jun 2023 13:48:58 +0800 Subject: [PATCH] fix: encode controller secret, close #601 --- src/components/layout/layout-traffic.tsx | 2 +- src/components/layout/use-log-setup.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/layout/layout-traffic.tsx b/src/components/layout/layout-traffic.tsx index e920e7c..97caa82 100644 --- a/src/components/layout/layout-traffic.tsx +++ b/src/components/layout/layout-traffic.tsx @@ -32,7 +32,7 @@ const LayoutTraffic = () => { if (!clashInfo) return; const { server = "", secret = "" } = clashInfo; - connect(`ws://${server}/traffic?token=${secret}`); + connect(`ws://${server}/traffic?token=${encodeURIComponent(secret)}`); return () => { disconnect(); diff --git a/src/components/layout/use-log-setup.ts b/src/components/layout/use-log-setup.ts index 8dde19d..0c130ac 100644 --- a/src/components/layout/use-log-setup.ts +++ b/src/components/layout/use-log-setup.ts @@ -30,7 +30,7 @@ export const useLogSetup = () => { getClashLogs().then(setLogData); const { server = "", secret = "" } = clashInfo; - connect(`ws://${server}/logs?token=${secret}`); + connect(`ws://${server}/logs?token=${encodeURIComponent(secret)}`); return () => { disconnect();