修复修改任务状态本地免认证

This commit is contained in:
whyour
2022-01-25 22:52:27 +08:00
parent 764a3492cc
commit 2713419b32
7 changed files with 63 additions and 19 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ if (envFound.error) {
}
export default {
port: parseInt(process.env.PORT as string, 10),
port: parseInt(process.env.BACK_PORT as string, 10),
cronPort: parseInt(process.env.CRON_PORT as string, 10),
secret: process.env.SECRET || createRandomString(16, 32),
logs: {
+5 -4
View File
@@ -68,18 +68,19 @@ export default ({ app }: { app: Application }) => {
}
}
const originPath = `${req.baseUrl}${req.path === '/' ? '' : req.path}`;
if (
!headerToken &&
req.path &&
config.apiWhiteList.includes(req.path) &&
req.path !== '/api/crons/status'
originPath &&
config.apiWhiteList.includes(originPath) &&
originPath !== '/api/crons/status'
) {
return next();
}
const remoteAddress = req.socket.remoteAddress;
if (
remoteAddress === '::ffff:127.0.0.1' &&
req.path === '/api/crons/status'
originPath === '/api/crons/status'
) {
return next();
}