mirror of
https://github.com/woodchen-ink/clash-and-dashboard.git
synced 2025-07-18 14:01:56 +08:00
Fix: secret should be urlencode
This commit is contained in:
parent
e08ffad94e
commit
a46ac3456f
@ -256,7 +256,7 @@ export function useLogsStreamReader () {
|
|||||||
|
|
||||||
const level = logLevel || general.logLevel
|
const level = logLevel || general.logLevel
|
||||||
const previousKey = usePreviousDistinct(
|
const previousKey = usePreviousDistinct(
|
||||||
`${apiInfo.protocol}//${apiInfo.hostname}:${apiInfo.port}/logs?level=${level}&secret=${apiInfo.secret}`,
|
`${apiInfo.protocol}//${apiInfo.hostname}:${apiInfo.port}/logs?level=${level}&secret=${encodeURIComponent(apiInfo.secret)}`,
|
||||||
)
|
)
|
||||||
|
|
||||||
const apiInfoRef = useSyncedRef(apiInfo)
|
const apiInfoRef = useSyncedRef(apiInfo)
|
||||||
@ -265,7 +265,7 @@ export function useLogsStreamReader () {
|
|||||||
if (level) {
|
if (level) {
|
||||||
const apiInfo = apiInfoRef.current
|
const apiInfo = apiInfoRef.current
|
||||||
const protocol = apiInfo.protocol === 'http:' ? 'ws:' : 'wss:'
|
const protocol = apiInfo.protocol === 'http:' ? 'ws:' : 'wss:'
|
||||||
const logUrl = `${protocol}//${apiInfo.hostname}:${apiInfo.port}/logs?level=${level}&token=${apiInfo.secret}`
|
const logUrl = `${protocol}//${apiInfo.hostname}:${apiInfo.port}/logs?level=${level}&token=${encodeURIComponent(apiInfo.secret)}`
|
||||||
item.connect(logUrl)
|
item.connect(logUrl)
|
||||||
}
|
}
|
||||||
}, [apiInfoRef, item, level, previousKey])
|
}, [apiInfoRef, item, level, previousKey])
|
||||||
@ -279,7 +279,7 @@ export function useConnectionStreamReader () {
|
|||||||
const connection = useRef(new StreamReader<Snapshot>({ bufferLength: 200 }))
|
const connection = useRef(new StreamReader<Snapshot>({ bufferLength: 200 }))
|
||||||
|
|
||||||
const protocol = apiInfo.protocol === 'http:' ? 'ws:' : 'wss:'
|
const protocol = apiInfo.protocol === 'http:' ? 'ws:' : 'wss:'
|
||||||
const url = `${protocol}//${apiInfo.hostname}:${apiInfo.port}/connections?token=${apiInfo.secret}`
|
const url = `${protocol}//${apiInfo.hostname}:${apiInfo.port}/connections?token=${encodeURIComponent(apiInfo.secret)}`
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
connection.current.connect(url)
|
connection.current.connect(url)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user