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