mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-22 22:36:06 +08:00
修复获取sample文件
This commit is contained in:
parent
53123af832
commit
5c2bbc941f
|
@ -36,9 +36,16 @@ export default (app: Router) => {
|
|||
async (req: Request, res: Response, next: NextFunction) => {
|
||||
const logger: Logger = Container.get('logger');
|
||||
try {
|
||||
const content = getFileContentByName(
|
||||
`${config.configPath}${req.params.file}`,
|
||||
);
|
||||
let content = '';
|
||||
if (req.params.file.includes('sample')) {
|
||||
content = getFileContentByName(
|
||||
`${config.samplePath}${req.params.file}`,
|
||||
);
|
||||
} else {
|
||||
content = getFileContentByName(
|
||||
`${config.configPath}${req.params.file}`,
|
||||
);
|
||||
}
|
||||
res.send({ code: 200, data: content });
|
||||
} catch (e) {
|
||||
logger.error('🔥 error: %o', e);
|
||||
|
|
|
@ -15,6 +15,7 @@ const authConfigFile = path.join(rootPath, 'config/auth.json');
|
|||
const extraFile = path.join(rootPath, 'config/extra.sh');
|
||||
const configPath = path.join(rootPath, 'config/');
|
||||
const scriptPath = path.join(rootPath, 'scripts/');
|
||||
const samplePath = path.join(rootPath, 'sample/');
|
||||
const logPath = path.join(rootPath, 'log/');
|
||||
const authError = '错误的用户名密码,请重试';
|
||||
const loginFaild = '请先登录!';
|
||||
|
@ -58,5 +59,6 @@ export default {
|
|||
envDbFile,
|
||||
configPath,
|
||||
scriptPath,
|
||||
samplePath,
|
||||
blackFileList: ['auth.json', 'config.sh.sample', 'cookie.sh', 'crontab.list'],
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user