mirror of
https://github.com/certd/certd.git
synced 2026-04-24 04:17:25 +08:00
fix: 修复下载证书时提示token已过期的问题
This commit is contained in:
@@ -56,7 +56,20 @@ export class AuthorityMiddleware implements IWebMiddleware {
|
||||
token = token.replace('Bearer ', '').trim();
|
||||
if (!token) {
|
||||
//尝试从cookie中获取token
|
||||
token = ctx.cookies.get('token') || '';
|
||||
const cookie = ctx.headers.cookie;
|
||||
if (cookie) {
|
||||
const items = cookie.split(';');
|
||||
for (const item of items) {
|
||||
if (!item || !item.trim()) {
|
||||
continue;
|
||||
}
|
||||
const [key, value] = item.split('=');
|
||||
if (key.trim() === 'certd_token') {
|
||||
token = value.trim();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!token) {
|
||||
//尝试从query中获取token
|
||||
|
||||
Reference in New Issue
Block a user