mirror of
https://github.com/whyour/qinglong.git
synced 2026-06-30 20:35:09 +08:00
更新通知服务
This commit is contained in:
@@ -47,13 +47,6 @@ export default ({ app }: { app: Application }) => {
|
||||
}
|
||||
}
|
||||
|
||||
const data = fs.readFileSync(config.authConfigFile, 'utf8');
|
||||
if (data) {
|
||||
const { token } = JSON.parse(data);
|
||||
if (token && headerToken === token) {
|
||||
return next();
|
||||
}
|
||||
}
|
||||
if (
|
||||
!headerToken &&
|
||||
req.path &&
|
||||
@@ -71,6 +64,14 @@ export default ({ app }: { app: Application }) => {
|
||||
return next();
|
||||
}
|
||||
|
||||
const data = fs.readFileSync(config.authConfigFile, 'utf8');
|
||||
if (data) {
|
||||
const { token } = JSON.parse(data);
|
||||
if (token && headerToken === token) {
|
||||
return next();
|
||||
}
|
||||
}
|
||||
|
||||
const err: any = new Error('UnauthorizedError');
|
||||
err.status = 401;
|
||||
next(err);
|
||||
|
||||
Reference in New Issue
Block a user