修改系统内部获取token方式

This commit is contained in:
whyour
2022-06-14 22:43:18 +08:00
parent 9f5fb30334
commit 57e7d756cb
9 changed files with 104 additions and 38 deletions
+5 -1
View File
@@ -6,6 +6,7 @@ import config from '../config';
import { getFileContentByName, readDirs } from '../config/util';
import { join } from 'path';
const route = Router();
const blacklist = ['.tmp'];
export default (app: Router) => {
app.use('/logs', route);
@@ -13,7 +14,7 @@ export default (app: Router) => {
route.get('/', async (req: Request, res: Response, next: NextFunction) => {
const logger: Logger = Container.get('logger');
try {
const result = readDirs(config.logPath, config.logPath);
const result = readDirs(config.logPath, config.logPath, blacklist);
res.send({
code: 200,
data: result,
@@ -29,6 +30,9 @@ export default (app: Router) => {
async (req: Request, res: Response, next: NextFunction) => {
const logger: Logger = Container.get('logger');
try {
if (blacklist.includes(req.path)) {
return res.send({ code: 403, message: '暂无权限' });
}
const filePath = join(
config.logPath,
(req.query.path || '') as string,