fix: encodeURIComponent secret
This commit is contained in:
parent
c2109d245f
commit
6cf174c5ed
@ -46,7 +46,7 @@ const LayoutTraffic = () => {
|
||||
if (document.visibilityState === "visible") {
|
||||
// reconnect websocket
|
||||
const { server = "", secret = "" } = clashInfo;
|
||||
connect(`ws://${server}/traffic?token=${secret}`);
|
||||
connect(`ws://${server}/traffic?token=${encodeURIComponent(secret)}`);
|
||||
} else {
|
||||
disconnect();
|
||||
}
|
||||
|
@ -60,7 +60,10 @@ export const WebUIViewer = forwardRef<DialogRef>((props, ref) => {
|
||||
.trim();
|
||||
|
||||
url = url.replaceAll("%port", port || "9090");
|
||||
url = url.replaceAll("%secret", clashInfo.secret || "");
|
||||
url = url.replaceAll(
|
||||
"%secret",
|
||||
encodeURIComponent(clashInfo.secret || "")
|
||||
);
|
||||
}
|
||||
|
||||
await openWebUrl(url);
|
||||
|
@ -96,7 +96,7 @@ const ConnectionsPage = () => {
|
||||
if (!clashInfo) return;
|
||||
|
||||
const { server = "", secret = "" } = clashInfo;
|
||||
connect(`ws://${server}/connections?token=${secret}`);
|
||||
connect(`ws://${server}/connections?token=${encodeURIComponent(secret)}`);
|
||||
|
||||
return () => {
|
||||
disconnect();
|
||||
|
Loading…
Reference in New Issue
Block a user