mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-23 14:56:07 +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) => {
|
async (req: Request, res: Response, next: NextFunction) => {
|
||||||
const logger: Logger = Container.get('logger');
|
const logger: Logger = Container.get('logger');
|
||||||
try {
|
try {
|
||||||
const content = getFileContentByName(
|
let content = '';
|
||||||
`${config.configPath}${req.params.file}`,
|
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 });
|
res.send({ code: 200, data: content });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.error('🔥 error: %o', 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 extraFile = path.join(rootPath, 'config/extra.sh');
|
||||||
const configPath = path.join(rootPath, 'config/');
|
const configPath = path.join(rootPath, 'config/');
|
||||||
const scriptPath = path.join(rootPath, 'scripts/');
|
const scriptPath = path.join(rootPath, 'scripts/');
|
||||||
|
const samplePath = path.join(rootPath, 'sample/');
|
||||||
const logPath = path.join(rootPath, 'log/');
|
const logPath = path.join(rootPath, 'log/');
|
||||||
const authError = '错误的用户名密码,请重试';
|
const authError = '错误的用户名密码,请重试';
|
||||||
const loginFaild = '请先登录!';
|
const loginFaild = '请先登录!';
|
||||||
|
@ -58,5 +59,6 @@ export default {
|
||||||
envDbFile,
|
envDbFile,
|
||||||
configPath,
|
configPath,
|
||||||
scriptPath,
|
scriptPath,
|
||||||
|
samplePath,
|
||||||
blackFileList: ['auth.json', 'config.sh.sample', 'cookie.sh', 'crontab.list'],
|
blackFileList: ['auth.json', 'config.sh.sample', 'cookie.sh', 'crontab.list'],
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user