Commit e9057621 authored by 郑磊's avatar 郑磊

当取到的token无效时继续取下一个位置

parent ec74e6b8
......@@ -48,15 +48,25 @@ export function parseToken(): TokenData | undefined {
if (token) {
//先尝试解码,如果失败则使用明文
try {
const value = decodeToken(token)
if (!value) {
throw new Error()
}
return {
token: decodeToken(token),
token: value,
source: 'hash_encoded',
}
} catch (e: unknown) {
return {
token: decodeToken(token),
source: 'hash_raw',
}
try {
const value = decodeToken(token)
if (!value) {
throw new Error()
}
return {
token: value,
source: 'hash_raw',
}
} catch (e: unknown) {}
}
}
}
......@@ -68,15 +78,25 @@ export function parseToken(): TokenData | undefined {
if (token) {
//先尝试解码,如果失败则使用明文
try {
const value = decodeToken(token)
if (!value) {
throw new Error()
}
return {
token: decodeToken(token),
token: value,
source: 'url_encoded',
}
} catch (e: unknown) {
return {
token: decodeToken(token),
source: 'url_raw',
}
try {
const value = decodeToken(token)
if (!value) {
throw new Error()
}
return {
token: value,
source: 'url_raw',
}
} catch (e: unknown) {}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment