chore: secret is empty and no parameters are passed

This commit is contained in:
huzibaca 2024-12-25 02:15:06 +08:00
parent 53334f05b8
commit bfea52f9dd

View File

@ -48,7 +48,7 @@ export const LayoutTraffic = () => {
const { server = "", secret = "" } = clashInfo!; const { server = "", secret = "" } = clashInfo!;
const s = createSockette( const s = createSockette(
`ws://${server}/traffic?token=${encodeURIComponent(secret)}`, `ws://${server}${secret ? `/traffic?token=${encodeURIComponent(secret)}` : "/traffic"}`,
{ {
onmessage(event) { onmessage(event) {
const data = JSON.parse(event.data) as ITrafficItem; const data = JSON.parse(event.data) as ITrafficItem;
@ -86,7 +86,7 @@ export const LayoutTraffic = () => {
const { server = "", secret = "" } = clashInfo!; const { server = "", secret = "" } = clashInfo!;
const s = createSockette( const s = createSockette(
`ws://${server}/memory?token=${encodeURIComponent(secret)}`, `ws://${server}${secret ? `/memory?token=${encodeURIComponent(secret)}` : "/memory"}`,
{ {
onmessage(event) { onmessage(event) {
const data = JSON.parse(event.data) as MemoryUsage; const data = JSON.parse(event.data) as MemoryUsage;